!function(t){"function"==typeof define&&define.noamd?define(["jquery"],t):t(jQuery)}(function(k){k.ui=k.ui||{};k.ui.version="1.12.1";var n,i=0,r=Array.prototype.slice;k.cleanData=(n=k.cleanData,function(t){for(var e,i,s=0;null!=(i=t[s]);s++)try{(e=k._data(i,"events"))&&e.remove&&k(i).triggerHandler("remove")}catch(t){}n(t)}),k.widget=function(t,i,e){var s,n,o,a={},r=t.split(".")[0],h=r+"-"+(t=t.split(".")[1]);return e||(e=i,i=k.Widget),k.isArray(e)&&(e=k.extend.apply(null,[{}].concat(e))),k.expr[":"][h.toLowerCase()]=function(t){return!!k.data(t,h)},k[r]=k[r]||{},s=k[r][t],n=k[r][t]=function(t,e){if(!this._createWidget)return new n(t,e);arguments.length&&this._createWidget(t,e)},k.extend(n,s,{version:e.version,_proto:k.extend({},e),_childConstructors:[]}),(o=new i).options=k.widget.extend({},o.options),k.each(e,function(e,s){function n(){return i.prototype[e].apply(this,arguments)}function o(t){return i.prototype[e].apply(this,t)}k.isFunction(s)?a[e]=function(){var t,e=this._super,i=this._superApply;return this._super=n,this._superApply=o,t=s.apply(this,arguments),this._super=e,this._superApply=i,t}:a[e]=s}),n.prototype=k.widget.extend(o,{widgetEventPrefix:s&&o.widgetEventPrefix||t},a,{constructor:n,namespace:r,widgetName:t,widgetFullName:h}),s?(k.each(s._childConstructors,function(t,e){var i=e.prototype;k.widget(i.namespace+"."+i.widgetName,n,e._proto)}),delete s._childConstructors):i._childConstructors.push(n),k.widget.bridge(t,n),n},k.widget.extend=function(t){for(var e,i,s=r.call(arguments,1),n=0,o=s.length;n<o;n++)for(e in s[n])i=s[n][e],s[n].hasOwnProperty(e)&&void 0!==i&&(k.isPlainObject(i)?t[e]=k.isPlainObject(t[e])?k.widget.extend({},t[e],i):k.widget.extend({},i):t[e]=i);return t},k.widget.bridge=function(o,e){var a=e.prototype.widgetFullName||o;k.fn[o]=function(i){var t="string"==typeof i,s=r.call(arguments,1),n=this;return t?this.length||"instance"!==i?this.each(function(){var t,e=k.data(this,a);return"instance"===i?(n=e,!1):e?k.isFunction(e[i])&&"_"!==i.charAt(0)?(t=e[i].apply(e,s))!==e&&void 0!==t?(n=t&&t.jquery?n.pushStack(t.get()):t,!1):void 0:k.error("no such method '"+i+"' for "+o+" widget instance"):k.error("cannot call methods on "+o+" prior to initialization; attempted to call method '"+i+"'")}):n=void 0:(s.length&&(i=k.widget.extend.apply(null,[i].concat(s))),this.each(function(){var t=k.data(this,a);t?(t.option(i||{}),t._init&&t._init()):k.data(this,a,new e(i,this))})),n}},k.Widget=function(){},k.Widget._childConstructors=[],k.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=k(e||this.defaultElement||this)[0],this.element=k(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=k(),this.hoverable=k(),this.focusable=k(),this.classesElementLookup={},e!==this&&(k.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=k(e.style?e.ownerDocument:e.document||e),this.window=k(this.document[0].defaultView||this.document[0].parentWindow)),this.options=k.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:k.noop,_create:k.noop,_init:k.noop,destroy:function(){var i=this;this._destroy(),k.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:k.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return k.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t]=k.widget.extend({},this.options[t]),n=0;n<i.length-1;n++)s[i[n]]=s[i[n]]||{},s=s[i[n]];if(t=i.pop(),1===arguments.length)return void 0===s[t]?null:s[t];s[t]=e}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=e}return this._setOptions(o),this},_setOptions:function(t){for(var e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(t){var e,i,s;for(e in t)s=this.classesElementLookup[e],t[e]!==this.options.classes[e]&&s&&s.length&&(i=k(s.get()),this._removeClass(s,e),i.addClass(this._classes({element:i,keys:e,classes:t,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(n){var o=[],a=this;function t(t,e){for(var i,s=0;s<t.length;s++)i=a.classesElementLookup[t[s]]||k(),i=n.add?k(k.unique(i.get().concat(n.element.get()))):k(i.not(n.element).get()),a.classesElementLookup[t[s]]=i,o.push(t[s]),e&&n.classes[t[s]]&&o.push(n.classes[t[s]])}return n=k.extend({element:this.element,classes:this.options.classes||{}},n),this._on(n.element,{remove:"_untrackClassesElement"}),n.keys&&t(n.keys.match(/\S+/g)||[],!0),n.extra&&t(n.extra.match(/\S+/g)||[]),o.join(" ")},_untrackClassesElement:function(i){var s=this;k.each(s.classesElementLookup,function(t,e){-1!==k.inArray(i.target,e)&&(s.classesElementLookup[t]=k(e.not(i.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,t={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return t.element.toggleClass(this._classes(t),s),this},_on:function(n,o,t){var a,r=this;"boolean"!=typeof n&&(t=o,o=n,n=!1),t?(o=a=k(o),this.bindings=this.bindings.add(o)):(t=o,o=this.element,a=this.widget()),k.each(t,function(t,e){function i(){if(n||!0!==r.options.disabled&&!k(this).hasClass("ui-state-disabled"))return("string"==typeof e?r[e]:e).apply(r,arguments)}"string"!=typeof e&&(i.guid=e.guid=e.guid||i.guid||k.guid++);var s=t.match(/^([\w:-]*)\s*(.*)$/),t=s[1]+r.eventNamespace,s=s[2];s?a.on(t,s,i):o.on(t,i)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.off(e).off(e),this.bindings=k(this.bindings.not(t).get()),this.focusable=k(this.focusable.not(t).get()),this.hoverable=k(this.hoverable.not(t).get())},_delay:function(t,e){var i=this;return setTimeout(function(){return("string"==typeof t?i[t]:t).apply(i,arguments)},e||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){this._addClass(k(t.currentTarget),null,"ui-state-hover")},mouseleave:function(t){this._removeClass(k(t.currentTarget),null,"ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){this._addClass(k(t.currentTarget),null,"ui-state-focus")},focusout:function(t){this._removeClass(k(t.currentTarget),null,"ui-state-focus")}})},_trigger:function(t,e,i){var s,n,o=this.options[t];if(i=i||{},(e=k.Event(e)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),e.target=this.element[0],n=e.originalEvent)for(s in n)s in e||(e[s]=n[s]);return this.element.trigger(e,i),!(k.isFunction(o)&&!1===o.apply(this.element[0],[e].concat(i))||e.isDefaultPrevented())}},k.each({show:"fadeIn",hide:"fadeOut"},function(o,a){k.Widget.prototype["_"+o]=function(e,t,i){var s;"string"==typeof t&&(t={effect:t});var n=t?!0!==t&&"number"!=typeof t&&t.effect||a:o;"number"==typeof(t=t||{})&&(t={duration:t}),s=!k.isEmptyObject(t),t.complete=i,t.delay&&e.delay(t.delay),s&&k.effects&&k.effects.effect[n]?e[o](t):n!==o&&e[n]?e[n](t.duration,t.easing,i):e.queue(function(t){k(this)[o](),i&&i.call(e[0]),t()})}});var s,C,x,o,a,h,l,c,D;k.widget;function I(t,e,i){return[parseFloat(t[0])*(c.test(t[0])?e/100:1),parseFloat(t[1])*(c.test(t[1])?i/100:1)]}function P(t,e){return parseInt(k.css(t,e),10)||0}C=Math.max,x=Math.abs,o=/left|center|right/,a=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,l=/^\w+/,c=/%$/,D=k.fn.position,k.position={scrollbarWidth:function(){if(void 0!==s)return s;var t,e=k("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),i=e.children()[0];return k("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),s=t-i},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.width<t.element[0].scrollWidth;return{width:"scroll"===i||"auto"===i&&t.height<t.element[0].scrollHeight?k.position.scrollbarWidth():0,height:e?k.position.scrollbarWidth():0}},getWithinInfo:function(t){var e=k(t||window),i=k.isWindow(e[0]),s=!!e[0]&&9===e[0].nodeType;return{element:e,isWindow:i,isDocument:s,offset:!i&&!s?k(t).offset():{left:0,top:0},scrollLeft:e.scrollLeft(),scrollTop:e.scrollTop(),width:e.outerWidth(),height:e.outerHeight()}}},k.fn.position=function(u){if(!u||!u.of)return D.apply(this,arguments);u=k.extend({},u);var d,p,f,g,m,t,_=k(u.of),v=k.position.getWithinInfo(u.within),b=k.position.getScrollInfo(v),y=(u.collision||"flip").split(" "),w={},e=9===(t=(e=_)[0]).nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:k.isWindow(t)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:t.preventDefault?{width:0,height:0,offset:{top:t.pageY,left:t.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()};return _[0].preventDefault&&(u.at="left top"),p=e.width,f=e.height,g=e.offset,m=k.extend({},g),k.each(["my","at"],function(){var t,e,i=(u[this]||"").split(" ");1===i.length&&(i=o.test(i[0])?i.concat(["center"]):a.test(i[0])?["center"].concat(i):["center","center"]),i[0]=o.test(i[0])?i[0]:"center",i[1]=a.test(i[1])?i[1]:"center",t=h.exec(i[0]),e=h.exec(i[1]),w[this]=[t?t[0]:0,e?e[0]:0],u[this]=[l.exec(i[0])[0],l.exec(i[1])[0]]}),1===y.length&&(y[1]=y[0]),"right"===u.at[0]?m.left+=p:"center"===u.at[0]&&(m.left+=p/2),"bottom"===u.at[1]?m.top+=f:"center"===u.at[1]&&(m.top+=f/2),d=I(w.at,p,f),m.left+=d[0],m.top+=d[1],this.each(function(){var i,t,a=k(this),r=a.outerWidth(),h=a.outerHeight(),e=P(this,"marginLeft"),s=P(this,"marginTop"),n=r+e+P(this,"marginRight")+b.width,o=h+s+P(this,"marginBottom")+b.height,l=k.extend({},m),c=I(w.my,a.outerWidth(),a.outerHeight());"right"===u.my[0]?l.left-=r:"center"===u.my[0]&&(l.left-=r/2),"bottom"===u.my[1]?l.top-=h:"center"===u.my[1]&&(l.top-=h/2),l.left+=c[0],l.top+=c[1],i={marginLeft:e,marginTop:s},k.each(["left","top"],function(t,e){k.ui.position[y[t]]&&k.ui.position[y[t]][e](l,{targetWidth:p,targetHeight:f,elemWidth:r,elemHeight:h,collisionPosition:i,collisionWidth:n,collisionHeight:o,offset:[d[0]+c[0],d[1]+c[1]],my:u.my,at:u.at,within:v,elem:a})}),u.using&&(t=function(t){var e=g.left-l.left,i=e+p-r,s=g.top-l.top,n=s+f-h,o={target:{element:_,left:g.left,top:g.top,width:p,height:f},element:{element:a,left:l.left,top:l.top,width:r,height:h},horizontal:i<0?"left":0<e?"right":"center",vertical:n<0?"top":0<s?"bottom":"middle"};p<r&&x(e+i)<p&&(o.horizontal="center"),f<h&&x(s+n)<f&&(o.vertical="middle"),C(x(e),x(i))>C(x(s),x(n))?o.important="horizontal":o.important="vertical",u.using.call(this,t,o)}),a.offset(k.extend(l,{using:t}))})},k.ui.position={fit:{left:function(t,e){var i=e.within,s=i.isWindow?i.scrollLeft:i.offset.left,n=i.width,o=t.left-e.collisionPosition.marginLeft,a=s-o,r=o+e.collisionWidth-n-s;e.collisionWidth>n?0<a&&r<=0?(i=t.left+a+e.collisionWidth-n-s,t.left+=a-i):t.left=!(0<r&&a<=0)&&r<a?s+n-e.collisionWidth:s:0<a?t.left+=a:0<r?t.left-=r:t.left=C(t.left-o,t.left)},top:function(t,e){var i=e.within,s=i.isWindow?i.scrollTop:i.offset.top,n=e.within.height,o=t.top-e.collisionPosition.marginTop,a=s-o,r=o+e.collisionHeight-n-s;e.collisionHeight>n?0<a&&r<=0?(i=t.top+a+e.collisionHeight-n-s,t.top+=a-i):t.top=!(0<r&&a<=0)&&r<a?s+n-e.collisionHeight:s:0<a?t.top+=a:0<r?t.top-=r:t.top=C(t.top-o,t.top)}},flip:{left:function(t,e){var i=e.within,s=i.offset.left+i.scrollLeft,n=i.width,o=i.isWindow?i.scrollLeft:i.offset.left,a=t.left-e.collisionPosition.marginLeft,r=a-o,h=a+e.collisionWidth-n-o,l="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,i="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,a=-2*e.offset[0];r<0?((s=t.left+l+i+a+e.collisionWidth-n-s)<0||s<x(r))&&(t.left+=l+i+a):0<h&&(0<(o=t.left-e.collisionPosition.marginLeft+l+i+a-o)||x(o)<h)&&(t.left+=l+i+a)},top:function(t,e){var i=e.within,s=i.offset.top+i.scrollTop,n=i.height,o=i.isWindow?i.scrollTop:i.offset.top,a=t.top-e.collisionPosition.marginTop,r=a-o,h=a+e.collisionHeight-n-o,l="top"===e.my[1]?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,i="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,a=-2*e.offset[1];r<0?((s=t.top+l+i+a+e.collisionHeight-n-s)<0||s<x(r))&&(t.top+=l+i+a):0<h&&(0<(o=t.top-e.collisionPosition.marginTop+l+i+a-o)||x(o)<h)&&(t.top+=l+i+a)}},flipfit:{left:function(){k.ui.position.flip.left.apply(this,arguments),k.ui.position.fit.left.apply(this,arguments)},top:function(){k.ui.position.flip.top.apply(this,arguments),k.ui.position.fit.top.apply(this,arguments)}}};var t;k.ui.position,k.extend(k.expr[":"],{data:k.expr.createPseudo?k.expr.createPseudo(function(e){return function(t){return!!k.data(t,e)}}):function(t,e,i){return!!k.data(t,i[3])}}),k.fn.extend({disableSelection:(t="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.off(".ui-disableSelection")}});k.ui.focusable=function(t,e){var i,s,n,o,a=t.nodeName.toLowerCase();return"area"===a?(s=(i=t.parentNode).name,!(!t.href||!s||"map"!==i.nodeName.toLowerCase())&&(0<(s=k("img[usemap='#"+s+"']")).length&&s.is(":visible"))):(/^(input|select|textarea|button|object)$/.test(a)?(n=!t.disabled)&&(o=k(t).closest("fieldset")[0])&&(n=!o.disabled):n="a"===a&&t.href||e,n&&k(t).is(":visible")&&function(t){var e=t.css("visibility");for(;"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}(k(t)))},k.extend(k.expr[":"],{focusable:function(t){return k.ui.focusable(t,null!=k.attr(t,"tabindex"))}});k.ui.focusable,k.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):k(this[0].form)},k.ui.formResetMixin={_formResetHandler:function(){var e=k(this);setTimeout(function(){var t=e.data("ui-form-reset-instances");k.each(t,function(){this.refresh()})})},_bindFormResetHandler:function(){var t;this.form=this.element.form(),this.form.length&&((t=this.form.data("ui-form-reset-instances")||[]).length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t))},_unbindFormResetHandler:function(){var t;this.form.length&&((t=this.form.data("ui-form-reset-instances")).splice(k.inArray(this,t),1),t.length?this.form.data("ui-form-reset-instances",t):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset"))}},k.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},k.ui.escapeSelector=(e=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g,function(t){return t.replace(e,"\\$1")}),k.fn.labels=function(){var t,e,i;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(e=this.eq(0).parents("label"),(t=this.attr("id"))&&(i=(i=this.eq(0).parents().last()).add((i.length?i:this).siblings()),t="label[for='"+k.ui.escapeSelector(t)+"']",e=e.add(i.find(t).addBack(t))),this.pushStack(e))},k.fn.scrollParent=function(t){var e=this.css("position"),i="absolute"===e,s=t?/(auto|scroll|hidden)/:/(auto|scroll)/,t=this.parents().filter(function(){var t=k(this);return(!i||"static"!==t.css("position"))&&s.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==e&&t.length?t:k(this[0].ownerDocument||document)},k.extend(k.expr[":"],{tabbable:function(t){var e=k.attr(t,"tabindex"),i=null!=e;return(!i||0<=e)&&k.ui.focusable(t,i)}}),k.fn.extend({uniqueId:(u=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++u)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&k(this).removeAttr("id")})}}),k.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var e,u,d=!1;k(document).on("mouseup",function(){d=!1});k.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(t){if(!0===k.data(t.target,e.widgetName+".preventClickEvent"))return k.removeData(t.target,e.widgetName+".preventClickEvent"),t.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!d){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var e=this,i=1===t.which,s=!("string"!=typeof this.options.cancel||!t.target.nodeName)&&k(t.target).closest(this.options.cancel).length;return i&&!s&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=!1!==this._mouseStart(t),!this._mouseStarted)?(t.preventDefault(),!0):(!0===k.data(t.target,this.widgetName+".preventClickEvent")&&k.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return e._mouseMove(t)},this._mouseUpDelegate=function(t){return e._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),d=!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(k.ui.ie&&(!document.documentMode||document.documentMode<9)&&!t.button)return this._mouseUp(t);if(!t.which)if(t.originalEvent.altKey||t.originalEvent.ctrlKey||t.originalEvent.metaKey||t.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,t),this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&k.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,d=!1,t.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),k.ui.plugin={add:function(t,e,i){var s,n=k.ui[t].prototype;for(s in i)n.plugins[s]=n.plugins[s]||[],n.plugins[s].push([e,i[s]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;n<o.length;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},k.ui.safeActiveElement=function(e){var i;try{i=e.activeElement}catch(t){i=e.body}return(i=i||e.body).nodeName||(i=e.body),i},k.ui.safeBlur=function(t){t&&"body"!==t.nodeName.toLowerCase()&&k(t).trigger("blur")};k.widget("ui.draggable",k.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){(this.helper||this.element).is(".ui-draggable-dragging")?this.destroyOnClear=!0:(this._removeHandleClassName(),this._mouseDestroy())},_mouseCapture:function(t){var e=this.options;return!(this.helper||e.disabled||0<k(t.target).closest(".ui-resizable-handle").length)&&(this.handle=this._getHandle(t),!!this.handle&&(this._blurActiveElement(t),this._blockFrames(!0===e.iframeFix?"iframe":e.iframeFix),!0))},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=k(this);return k("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var e=k.ui.safeActiveElement(this.document[0]);k(t.target).closest(e).length||k.ui.safeBlur(e)},_mouseStart:function(t){var e=this.options;return this.helper=this._createHelper(t),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),k.ui.ddmanager&&(k.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=0<this.helper.parents().filter(function(){return"fixed"===k(this).css("position")}).length,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this._setContainment(),!1===this._trigger("start",t)?(this._clear(),!1):(this._cacheHelperProportions(),k.ui.ddmanager&&!e.dropBehaviour&&k.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),k.ui.ddmanager&&k.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(t,e){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!e){e=this._uiHash();if(!1===this._trigger("drag",t,e))return this._mouseUp(new k.Event("mouseup",t)),!1;this.position=e.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",k.ui.ddmanager&&k.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var e=this,i=!1;return k.ui.ddmanager&&!this.options.dropBehaviour&&(i=k.ui.ddmanager.drop(this,t)),this.dropped&&(i=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!i||"valid"===this.options.revert&&i||!0===this.options.revert||k.isFunction(this.options.revert)&&this.options.revert.call(this.element,i)?k(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){!1!==e._trigger("stop",t)&&e._clear()}):!1!==this._trigger("stop",t)&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),k.ui.ddmanager&&k.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.trigger("focus"),k.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new k.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(t){return!this.options.handle||!!k(t.target).closest(this.element.find(this.options.handle)).length},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(t){var e=this.options,i=k.isFunction(e.helper),t=i?k(e.helper.apply(this.element[0],[t])):"clone"===e.helper?this.element.clone().removeAttr("id"):this.element;return t.parents("body").length||t.appendTo("parent"===e.appendTo?this.element[0].parentNode:e.appendTo),i&&t[0]===this.element[0]&&this._setPositionRelative(),t[0]===this.element[0]||/(fixed|absolute)/.test(t.css("position"))||t.css("position","absolute"),t},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),k.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),e=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==e&&k.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,e,i,s=this.options,n=this.document[0];this.relativeContainer=null,s.containment?"window"!==s.containment?"document"!==s.containment?s.containment.constructor!==Array?("parent"===s.containment&&(s.containment=this.helper[0].parentNode),(i=(e=k(s.containment))[0])&&(t=/(scroll|auto)/.test(e.css("overflow")),this.containment=[(parseInt(e.css("borderLeftWidth"),10)||0)+(parseInt(e.css("paddingLeft"),10)||0),(parseInt(e.css("borderTopWidth"),10)||0)+(parseInt(e.css("paddingTop"),10)||0),(t?Math.max(i.scrollWidth,i.offsetWidth):i.offsetWidth)-(parseInt(e.css("borderRightWidth"),10)||0)-(parseInt(e.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(i.scrollHeight,i.offsetHeight):i.offsetHeight)-(parseInt(e.css("borderBottomWidth"),10)||0)-(parseInt(e.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=e)):this.containment=s.containment:this.containment=[0,0,k(n).width()-this.helperProportions.width-this.margins.left,(k(n).height()||n.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:this.containment=[k(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,k(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,k(window).scrollLeft()+k(window).width()-this.helperProportions.width-this.margins.left,k(window).scrollTop()+(k(window).height()||n.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:this.containment=null},_convertPositionTo:function(t,e){e=e||this.position;var i="absolute"===t?1:-1,t=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:t?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:t?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s=this.options,n=this._isRootNode(this.scrollParent[0]),o=t.pageX,a=t.pageY;return n&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(i=this.relativeContainer?(i=this.relativeContainer.offset(),[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]):this.containment,t.pageX-this.offset.click.left<i[0]&&(o=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(a=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(o=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(a=i[3]+this.offset.click.top)),s.grid&&(t=s.grid[1]?this.originalPageY+Math.round((a-this.originalPageY)/s.grid[1])*s.grid[1]:this.originalPageY,a=!i||t-this.offset.click.top>=i[1]||t-this.offset.click.top>i[3]?t:t-this.offset.click.top>=i[1]?t-s.grid[1]:t+s.grid[1],t=s.grid[0]?this.originalPageX+Math.round((o-this.originalPageX)/s.grid[0])*s.grid[0]:this.originalPageX,o=!i||t-this.offset.click.left>=i[0]||t-this.offset.click.left>i[2]?t:t-this.offset.click.left>=i[0]?t-s.grid[0]:t+s.grid[0]),"y"===s.axis&&(o=this.originalPageX),"x"===s.axis&&(a=this.originalPageY)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:n?0:this.offset.scroll.top),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:n?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(t,e,i){return i=i||this._uiHash(),k.ui.plugin.call(this,t,[e,i,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),i.offset=this.positionAbs),k.Widget.prototype._trigger.call(this,t,e,i)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),k.ui.plugin.add("draggable","connectToSortable",{start:function(e,t,i){var s=k.extend({},t,{item:i.element});i.sortables=[],k(i.options.connectToSortable).each(function(){var t=k(this).sortable("instance");t&&!t.options.disabled&&(i.sortables.push(t),t.refreshPositions(),t._trigger("activate",e,s))})},stop:function(e,t,i){var s=k.extend({},t,{item:i.element});i.cancelHelperRemoval=!1,k.each(i.sortables,function(){var t=this;t.isOver?(t.isOver=0,i.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,s))})},drag:function(i,s,n){k.each(n.sortables,function(){var t=!1,e=this;e.positionAbs=n.positionAbs,e.helperProportions=n.helperProportions,e.offset.click=n.offset.click,e._intersectsWith(e.containerCache)&&(t=!0,k.each(n.sortables,function(){return this.positionAbs=n.positionAbs,this.helperProportions=n.helperProportions,this.offset.click=n.offset.click,this!==e&&this._intersectsWith(this.containerCache)&&k.contains(e.element[0],this.element[0])&&(t=!1),t})),t?(e.isOver||(e.isOver=1,n._parent=s.helper.parent(),e.currentItem=s.helper.appendTo(e.element).data("ui-sortable-item",!0),e.options._helper=e.options.helper,e.options.helper=function(){return s.helper[0]},i.target=e.currentItem[0],e._mouseCapture(i,!0),e._mouseStart(i,!0,!0),e.offset.click.top=n.offset.click.top,e.offset.click.left=n.offset.click.left,e.offset.parent.left-=n.offset.parent.left-e.offset.parent.left,e.offset.parent.top-=n.offset.parent.top-e.offset.parent.top,n._trigger("toSortable",i),n.dropped=e.element,k.each(n.sortables,function(){this.refreshPositions()}),n.currentItem=n.element,e.fromOutside=n),e.currentItem&&(e._mouseDrag(i),s.position=e.position)):e.isOver&&(e.isOver=0,e.cancelHelperRemoval=!0,e.options._revert=e.options.revert,e.options.revert=!1,e._trigger("out",i,e._uiHash(e)),e._mouseStop(i,!0),e.options.revert=e.options._revert,e.options.helper=e.options._helper,e.placeholder&&e.placeholder.remove(),s.helper.appendTo(n._parent),n._refreshOffsets(i),s.position=n._generatePosition(i,!0),n._trigger("fromSortable",i),n.dropped=!1,k.each(n.sortables,function(){this.refreshPositions()}))})}}),k.ui.plugin.add("draggable","cursor",{start:function(t,e,i){var s=k("body"),i=i.options;s.css("cursor")&&(i._cursor=s.css("cursor")),s.css("cursor",i.cursor)},stop:function(t,e,i){i=i.options;i._cursor&&k("body").css("cursor",i._cursor)}}),k.ui.plugin.add("draggable","opacity",{start:function(t,e,i){e=k(e.helper),i=i.options;e.css("opacity")&&(i._opacity=e.css("opacity")),e.css("opacity",i.opacity)},stop:function(t,e,i){i=i.options;i._opacity&&k(e.helper).css("opacity",i._opacity)}}),k.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,e,i){var s=i.options,n=!1,o=i.scrollParentNotHidden[0],a=i.document[0];o!==a&&"HTML"!==o.tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+o.offsetHeight-t.pageY<s.scrollSensitivity?o.scrollTop=n=o.scrollTop+s.scrollSpeed:t.pageY-i.overflowOffset.top<s.scrollSensitivity&&(o.scrollTop=n=o.scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+o.offsetWidth-t.pageX<s.scrollSensitivity?o.scrollLeft=n=o.scrollLeft+s.scrollSpeed:t.pageX-i.overflowOffset.left<s.scrollSensitivity&&(o.scrollLeft=n=o.scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(t.pageY-k(a).scrollTop()<s.scrollSensitivity?n=k(a).scrollTop(k(a).scrollTop()-s.scrollSpeed):k(window).height()-(t.pageY-k(a).scrollTop())<s.scrollSensitivity&&(n=k(a).scrollTop(k(a).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(t.pageX-k(a).scrollLeft()<s.scrollSensitivity?n=k(a).scrollLeft(k(a).scrollLeft()-s.scrollSpeed):k(window).width()-(t.pageX-k(a).scrollLeft())<s.scrollSensitivity&&(n=k(a).scrollLeft(k(a).scrollLeft()+s.scrollSpeed)))),!1!==n&&k.ui.ddmanager&&!s.dropBehaviour&&k.ui.ddmanager.prepareOffsets(i,t)}}),k.ui.plugin.add("draggable","snap",{start:function(t,e,i){var s=i.options;i.snapElements=[],k(s.snap.constructor!==String?s.snap.items||":data(ui-draggable)":s.snap).each(function(){var t=k(this),e=t.offset();this!==i.element[0]&&i.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:e.top,left:e.left})})},drag:function(t,e,i){for(var s,n,o,a,r,h,l,c,u,d=i.options,p=d.snapTolerance,f=e.offset.left,g=f+i.helperProportions.width,m=e.offset.top,_=m+i.helperProportions.height,v=i.snapElements.length-1;0<=v;v--)h=(r=i.snapElements[v].left-i.margins.left)+i.snapElements[v].width,c=(l=i.snapElements[v].top-i.margins.top)+i.snapElements[v].height,g<r-p||h+p<f||_<l-p||c+p<m||!k.contains(i.snapElements[v].item.ownerDocument,i.snapElements[v].item)?(i.snapElements[v].snapping&&i.options.snap.release&&i.options.snap.release.call(i.element,t,k.extend(i._uiHash(),{snapItem:i.snapElements[v].item})),i.snapElements[v].snapping=!1):("inner"!==d.snapMode&&(s=Math.abs(l-_)<=p,n=Math.abs(c-m)<=p,o=Math.abs(r-g)<=p,a=Math.abs(h-f)<=p,s&&(e.position.top=i._convertPositionTo("relative",{top:l-i.helperProportions.height,left:0}).top),n&&(e.position.top=i._convertPositionTo("relative",{top:c,left:0}).top),o&&(e.position.left=i._convertPositionTo("relative",{top:0,left:r-i.helperProportions.width}).left),a&&(e.position.left=i._convertPositionTo("relative",{top:0,left:h}).left)),u=s||n||o||a,"outer"!==d.snapMode&&(s=Math.abs(l-m)<=p,n=Math.abs(c-_)<=p,o=Math.abs(r-f)<=p,a=Math.abs(h-g)<=p,s&&(e.position.top=i._convertPositionTo("relative",{top:l,left:0}).top),n&&(e.position.top=i._convertPositionTo("relative",{top:c-i.helperProportions.height,left:0}).top),o&&(e.position.left=i._convertPositionTo("relative",{top:0,left:r}).left),a&&(e.position.left=i._convertPositionTo("relative",{top:0,left:h-i.helperProportions.width}).left)),!i.snapElements[v].snapping&&(s||n||o||a||u)&&i.options.snap.snap&&i.options.snap.snap.call(i.element,t,k.extend(i._uiHash(),{snapItem:i.snapElements[v].item})),i.snapElements[v].snapping=s||n||o||a||u)}}),k.ui.plugin.add("draggable","stack",{start:function(t,e,i){var s,i=i.options,i=k.makeArray(k(i.stack)).sort(function(t,e){return(parseInt(k(t).css("zIndex"),10)||0)-(parseInt(k(e).css("zIndex"),10)||0)});i.length&&(s=parseInt(k(i[0]).css("zIndex"),10)||0,k(i).each(function(t){k(this).css("zIndex",s+t)}),this.css("zIndex",s+i.length))}}),k.ui.plugin.add("draggable","zIndex",{start:function(t,e,i){e=k(e.helper),i=i.options;e.css("zIndex")&&(i._zIndex=e.css("zIndex")),e.css("zIndex",i.zIndex)},stop:function(t,e,i){i=i.options;i._zIndex&&k(e.helper).css("zIndex",i._zIndex)}});k.ui.draggable;k.widget("ui.droppable",{version:"1.12.1",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,e=this.options,i=e.accept;this.isover=!1,this.isout=!0,this.accept=k.isFunction(i)?i:function(t){return t.is(i)},this.proportions=function(){if(!arguments.length)return t||(t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight});t=arguments[0]},this._addToManager(e.scope),e.addClasses&&this._addClass("ui-droppable")},_addToManager:function(t){k.ui.ddmanager.droppables[t]=k.ui.ddmanager.droppables[t]||[],k.ui.ddmanager.droppables[t].push(this)},_splice:function(t){for(var e=0;e<t.length;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var t=k.ui.ddmanager.droppables[this.options.scope];this._splice(t)},_setOption:function(t,e){var i;"accept"===t?this.accept=k.isFunction(e)?e:function(t){return t.is(e)}:"scope"===t&&(i=k.ui.ddmanager.droppables[this.options.scope],this._splice(i),this._addToManager(e)),this._super(t,e)},_activate:function(t){var e=k.ui.ddmanager.current;this._addActiveClass(),e&&this._trigger("activate",t,this.ui(e))},_deactivate:function(t){var e=k.ui.ddmanager.current;this._removeActiveClass(),e&&this._trigger("deactivate",t,this.ui(e))},_over:function(t){var e=k.ui.ddmanager.current;e&&(e.currentItem||e.element)[0]!==this.element[0]&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this._addHoverClass(),this._trigger("over",t,this.ui(e)))},_out:function(t){var e=k.ui.ddmanager.current;e&&(e.currentItem||e.element)[0]!==this.element[0]&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this._removeHoverClass(),this._trigger("out",t,this.ui(e)))},_drop:function(e,t){var i=t||k.ui.ddmanager.current,s=!1;return!(!i||(i.currentItem||i.element)[0]===this.element[0])&&(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=k(this).droppable("instance");if(t.options.greedy&&!t.options.disabled&&t.options.scope===i.options.scope&&t.accept.call(t.element[0],i.currentItem||i.element)&&p(i,k.extend(t,{offset:t.element.offset()}),t.options.tolerance,e))return!(s=!0)}),!s&&(!!this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(i)),this.element)))},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}});var p=k.ui.intersect=function(t,e,i,s){if(!e.offset)return!1;var n=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,a=n+t.helperProportions.width,r=o+t.helperProportions.height,h=e.offset.left,l=e.offset.top,c=h+e.proportions().width,u=l+e.proportions().height;switch(i){case"fit":return h<=n&&a<=c&&l<=o&&r<=u;case"intersect":return h<n+t.helperProportions.width/2&&a-t.helperProportions.width/2<c&&l<o+t.helperProportions.height/2&&r-t.helperProportions.height/2<u;case"pointer":return f(s.pageY,l,e.proportions().height)&&f(s.pageX,h,e.proportions().width);case"touch":return(l<=o&&o<=u||l<=r&&r<=u||o<l&&u<r)&&(h<=n&&n<=c||h<=a&&a<=c||n<h&&c<a);default:return!1}};function f(t,e,i){return e<=t&&t<e+i}!(k.ui.ddmanager={current:null,droppables:{default:[]},prepareOffsets:function(t,e){var i,s,n=k.ui.ddmanager.droppables[t.options.scope]||[],o=e?e.type:null,a=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();t:for(i=0;i<n.length;i++)if(!(n[i].options.disabled||t&&!n[i].accept.call(n[i].element[0],t.currentItem||t.element))){for(s=0;s<a.length;s++)if(a[s]===n[i].element[0]){n[i].proportions().height=0;continue t}n[i].visible="none"!==n[i].element.css("display"),n[i].visible&&("mousedown"===o&&n[i]._activate.call(n[i],e),n[i].offset=n[i].element.offset(),n[i].proportions({width:n[i].element[0].offsetWidth,height:n[i].element[0].offsetHeight}))}},drop:function(t,e){var i=!1;return k.each((k.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&p(t,this,this.options.tolerance,e)&&(i=this._drop.call(this,e)||i),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,e)))}),i},dragStart:function(t,e){t.element.parentsUntil("body").on("scroll.droppable",function(){t.options.refreshPositions||k.ui.ddmanager.prepareOffsets(t,e)})},drag:function(n,o){n.options.refreshPositions&&k.ui.ddmanager.prepareOffsets(n,o),k.each(k.ui.ddmanager.droppables[n.options.scope]||[],function(){var t,e,i,s;this.options.disabled||this.greedyChild||!this.visible||(s=!(i=p(n,this,this.options.tolerance,o))&&this.isover?"isout":i&&!this.isover?"isover":null)&&(this.options.greedy&&(e=this.options.scope,(i=this.element.parents(":data(ui-droppable)").filter(function(){return k(this).droppable("instance").options.scope===e})).length&&((t=k(i[0]).droppable("instance")).greedyChild="isover"===s)),t&&"isover"===s&&(t.isover=!1,t.isout=!0,t._out.call(t,o)),this[s]=!0,this["isout"===s?"isover":"isout"]=!1,this["isover"===s?"_over":"_out"].call(this,o),t&&"isout"===s&&(t.isout=!1,t.isover=!0,t._over.call(t,o)))})},dragStop:function(t,e){t.element.parentsUntil("body").off("scroll.droppable"),t.options.refreshPositions||k.ui.ddmanager.prepareOffsets(t,e)}})!==k.uiBackCompat&&k.widget("ui.droppable",k.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}});k.ui.droppable;k.widget("ui.resizable",k.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(t,e){if("hidden"===k(t).css("overflow"))return!1;var i=e&&"left"===e?"scrollLeft":"scrollTop",e=!1;return 0<t[i]||(t[i]=1,e=0<t[i],t[i]=0,e)},_create:function(){var t,e=this.options,i=this;this._addClass("ui-resizable"),k.extend(this,{_aspectRatio:!!e.aspectRatio,aspectRatio:e.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:e.helper||e.ghost||e.animate?e.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(k("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,t={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(t),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(t),this._proportionallyResize()),this._setupHandles(),e.autoHide&&k(this.element).on("mouseenter",function(){e.disabled||(i._removeClass("ui-resizable-autohide"),i._handles.show())}).on("mouseleave",function(){e.disabled||i.resizing||(i._addClass("ui-resizable-autohide"),i._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();function t(t){k(t).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()}var e;return this.elementIsWrapper&&(t(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),t(this.originalElement),this},_setOption:function(t,e){this._super(t,e),"handles"===t&&(this._removeHandles(),this._setupHandles())},_setupHandles:function(){var t,e,i,s,n,o=this.options,a=this;if(this.handles=o.handles||(k(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=k(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),i=this.handles.split(","),this.handles={},e=0;e<i.length;e++)s="ui-resizable-"+(t=k.trim(i[e])),n=k("<div>"),this._addClass(n,"ui-resizable-handle "+s),n.css({zIndex:o.zIndex}),this.handles[t]=".ui-resizable-"+t,this.element.append(n);this._renderAxis=function(t){var e,i,s;for(e in t=t||this.element,this.handles)this.handles[e].constructor===String?this.handles[e]=this.element.children(this.handles[e]).first().show():(this.handles[e].jquery||this.handles[e].nodeType)&&(this.handles[e]=k(this.handles[e]),this._on(this.handles[e],{mousedown:a._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(i=k(this.handles[e],this.element),s=/sw|ne|nw|se|n|s/.test(e)?i.outerHeight():i.outerWidth(),i=["padding",/ne|nw|n/.test(e)?"Top":/se|sw|s/.test(e)?"Bottom":/^e$/.test(e)?"Right":"Left"].join(""),t.css(i,s),this._proportionallyResize()),this._handles=this._handles.add(this.handles[e])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){a.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),a.axis=n&&n[1]?n[1]:"se")}),o.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(t){var e,i,s=!1;for(e in this.handles)(i=k(this.handles[e])[0])!==t.target&&!k.contains(i,t.target)||(s=!0);return!this.options.disabled&&s},_mouseStart:function(t){var e,i,s=this.options,n=this.element;return this.resizing=!0,this._renderProxy(),e=this._num(this.helper.css("left")),i=this._num(this.helper.css("top")),s.containment&&(e+=k(s.containment).scrollLeft()||0,i+=k(s.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:e,top:i},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:n.width(),height:n.height()},this.originalSize=this._helper?{width:n.outerWidth(),height:n.outerHeight()}:{width:n.width(),height:n.height()},this.sizeDiff={width:n.outerWidth()-n.width(),height:n.outerHeight()-n.height()},this.originalPosition={left:e,top:i},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof s.aspectRatio?s.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=k(".ui-resizable-"+this.axis).css("cursor"),k("body").css("cursor","auto"===s?this.axis+"-resize":s),this._addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var e=this.originalMousePosition,i=this.axis,s=t.pageX-e.left||0,e=t.pageY-e.top||0,i=this._change[i];return this._updatePrevProperties(),i&&(e=i.apply(this,[t,s,e]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(e=this._updateRatio(e,t)),e=this._respectSize(e,t),this._updateCache(e),this._propagate("resize",t),e=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),k.isEmptyObject(e)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges())),!1},_mouseStop:function(t){this.resizing=!1;var e,i,s,n=this.options,o=this;return this._helper&&(s=(e=(i=this._proportionallyResizeElements).length&&/textarea/i.test(i[0].nodeName))&&this._hasScroll(i[0],"left")?0:o.sizeDiff.height,i=e?0:o.sizeDiff.width,e={width:o.helper.width()-i,height:o.helper.height()-s},i=parseFloat(o.element.css("left"))+(o.position.left-o.originalPosition.left)||null,s=parseFloat(o.element.css("top"))+(o.position.top-o.originalPosition.top)||null,n.animate||this.element.css(k.extend(e,{top:s,left:i})),o.helper.height(o.size.height),o.helper.width(o.size.width),this._helper&&!n.animate&&this._proportionallyResize()),k("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s=this.options,n={minWidth:this._isNumber(s.minWidth)?s.minWidth:0,maxWidth:this._isNumber(s.maxWidth)?s.maxWidth:1/0,minHeight:this._isNumber(s.minHeight)?s.minHeight:0,maxHeight:this._isNumber(s.maxHeight)?s.maxHeight:1/0};(this._aspectRatio||t)&&(e=n.minHeight*this.aspectRatio,i=n.minWidth/this.aspectRatio,s=n.maxHeight*this.aspectRatio,t=n.maxWidth/this.aspectRatio,e>n.minWidth&&(n.minWidth=e),i>n.minHeight&&(n.minHeight=i),s<n.maxWidth&&(n.maxWidth=s),t<n.maxHeight&&(n.maxHeight=t)),this._vBoundaries=n},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidth<t.width,n=this._isNumber(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=this._isNumber(t.width)&&e.minWidth&&e.minWidth>t.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),i=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&i&&(t.top=h-e.minHeight),n&&i&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];e<4;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;e<this._proportionallyResizeElements.length;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,e=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||k("<div style='overflow:hidden;'></div>"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++e.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize;return{left:this.originalPosition.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize;return{top:this.originalPosition.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(t,e,i){return k.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},sw:function(t,e,i){return k.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,e,i]))},ne:function(t,e,i){return k.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},nw:function(t,e,i){return k.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,e,i]))}},_propagate:function(t,e){k.ui.plugin.call(this,t,[e,this.ui()]),"resize"!==t&&this._trigger(t,e,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),k.ui.plugin.add("resizable","animate",{stop:function(e){var i=k(this).resizable("instance"),t=i.options,s=i._proportionallyResizeElements,n=s.length&&/textarea/i.test(s[0].nodeName),o=n&&i._hasScroll(s[0],"left")?0:i.sizeDiff.height,a=n?0:i.sizeDiff.width,n={width:i.size.width-a,height:i.size.height-o},a=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,o=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(k.extend(n,o&&a?{top:o,left:a}:{}),{duration:t.animateDuration,easing:t.animateEasing,step:function(){var t={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};s&&s.length&&k(s[0]).css({width:t.width,height:t.height}),i._updateCache(t),i._propagate("resize",e)}})}}),k.ui.plugin.add("resizable","containment",{start:function(){var i,s,n=k(this).resizable("instance"),t=n.options,e=n.element,o=t.containment,a=o instanceof k?o.get(0):/parent/.test(o)?e.parent().get(0):o;a&&(n.containerElement=k(a),/document/.test(o)||o===document?(n.containerOffset={left:0,top:0},n.containerPosition={left:0,top:0},n.parentData={element:k(document),left:0,top:0,width:k(document).width(),height:k(document).height()||document.body.parentNode.scrollHeight}):(i=k(a),s=[],k(["Top","Right","Left","Bottom"]).each(function(t,e){s[t]=n._num(i.css("padding"+e))}),n.containerOffset=i.offset(),n.containerPosition=i.position(),n.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},t=n.containerOffset,e=n.containerSize.height,o=n.containerSize.width,o=n._hasScroll(a,"left")?a.scrollWidth:o,e=n._hasScroll(a)?a.scrollHeight:e,n.parentData={element:a,left:t.left,top:t.top,width:o,height:e}))},resize:function(t){var e=k(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.position,o=e._aspectRatio||t.shiftKey,a={top:0,left:0},r=e.containerElement,t=!0;r[0]!==document&&/static/.test(r.css("position"))&&(a=s),n.left<(e._helper?s.left:0)&&(e.size.width=e.size.width+(e._helper?e.position.left-s.left:e.position.left-a.left),o&&(e.size.height=e.size.width/e.aspectRatio,t=!1),e.position.left=i.helper?s.left:0),n.top<(e._helper?s.top:0)&&(e.size.height=e.size.height+(e._helper?e.position.top-s.top:e.position.top),o&&(e.size.width=e.size.height*e.aspectRatio,t=!1),e.position.top=e._helper?s.top:0),i=e.containerElement.get(0)===e.element.parent().get(0),n=/relative|absolute/.test(e.containerElement.css("position")),i&&n?(e.offset.left=e.parentData.left+e.position.left,e.offset.top=e.parentData.top+e.position.top):(e.offset.left=e.element.offset().left,e.offset.top=e.element.offset().top),n=Math.abs(e.sizeDiff.width+(e._helper?e.offset.left-a.left:e.offset.left-s.left)),s=Math.abs(e.sizeDiff.height+(e._helper?e.offset.top-a.top:e.offset.top-s.top)),n+e.size.width>=e.parentData.width&&(e.size.width=e.parentData.width-n,o&&(e.size.height=e.size.width/e.aspectRatio,t=!1)),s+e.size.height>=e.parentData.height&&(e.size.height=e.parentData.height-s,o&&(e.size.width=e.size.height*e.aspectRatio,t=!1)),t||(e.position.left=e.prevPosition.left,e.position.top=e.prevPosition.top,e.size.width=e.prevSize.width,e.size.height=e.prevSize.height)},stop:function(){var t=k(this).resizable("instance"),e=t.options,i=t.containerOffset,s=t.containerPosition,n=t.containerElement,o=k(t.helper),a=o.offset(),r=o.outerWidth()-t.sizeDiff.width,o=o.outerHeight()-t.sizeDiff.height;t._helper&&!e.animate&&/relative/.test(n.css("position"))&&k(this).css({left:a.left-s.left-i.left,width:r,height:o}),t._helper&&!e.animate&&/static/.test(n.css("position"))&&k(this).css({left:a.left-s.left-i.left,width:r,height:o})}}),k.ui.plugin.add("resizable","alsoResize",{start:function(){var t=k(this).resizable("instance").options;k(t.alsoResize).each(function(){var t=k(this);t.data("ui-resizable-alsoresize",{width:parseFloat(t.width()),height:parseFloat(t.height()),left:parseFloat(t.css("left")),top:parseFloat(t.css("top"))})})},resize:function(t,i){var e=k(this).resizable("instance"),s=e.options,n=e.originalSize,o=e.originalPosition,a={height:e.size.height-n.height||0,width:e.size.width-n.width||0,top:e.position.top-o.top||0,left:e.position.left-o.left||0};k(s.alsoResize).each(function(){var t=k(this),s=k(this).data("ui-resizable-alsoresize"),n={},e=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];k.each(e,function(t,e){var i=(s[e]||0)+(a[e]||0);i&&0<=i&&(n[e]=i||null)}),t.css(n)})},stop:function(){k(this).removeData("ui-resizable-alsoresize")}}),k.ui.plugin.add("resizable","ghost",{start:function(){var t=k(this).resizable("instance"),e=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}),t._addClass(t.ghost,"ui-resizable-ghost"),!1!==k.uiBackCompat&&"string"==typeof t.options.ghost&&t.ghost.addClass(this.options.ghost),t.ghost.appendTo(t.helper)},resize:function(){var t=k(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=k(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),k.ui.plugin.add("resizable","grid",{resize:function(){var t,e=k(this).resizable("instance"),i=e.options,s=e.size,n=e.originalSize,o=e.originalPosition,a=e.axis,r="number"==typeof i.grid?[i.grid,i.grid]:i.grid,h=r[0]||1,l=r[1]||1,c=Math.round((s.width-n.width)/h)*h,u=Math.round((s.height-n.height)/l)*l,d=n.width+c,p=n.height+u,f=i.maxWidth&&i.maxWidth<d,g=i.maxHeight&&i.maxHeight<p,m=i.minWidth&&i.minWidth>d,s=i.minHeight&&i.minHeight>p;i.grid=r,m&&(d+=h),s&&(p+=l),f&&(d-=h),g&&(p-=l),/^(se|s|e)$/.test(a)?(e.size.width=d,e.size.height=p):/^(ne)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.top=o.top-u):/^(sw)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.left=o.left-c):((p-l<=0||d-h<=0)&&(t=e._getPaddingPlusBorderDimensions(this)),0<p-l?(e.size.height=p,e.position.top=o.top-u):(p=l-t.height,e.size.height=p,e.position.top=o.top+n.height-p),0<d-h?(e.size.width=d,e.position.left=o.left-c):(d=h-t.width,e.size.width=d,e.position.left=o.left+n.width-d))}});k.ui.resizable,k.widget("ui.selectable",k.ui.mouse,{version:"1.12.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var i=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){i.elementPos=k(i.element[0]).offset(),i.selectees=k(i.options.filter,i.element[0]),i._addClass(i.selectees,"ui-selectee"),i.selectees.each(function(){var t=k(this),e=t.offset(),e={left:e.left-i.elementPos.left,top:e.top-i.elementPos.top};k.data(this,"selectable-item",{element:this,$element:t,left:e.left,top:e.top,right:e.left+t.outerWidth(),bottom:e.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=k("<div>"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(i){var s=this,t=this.options;this.opos=[i.pageX,i.pageY],this.elementPos=k(this.element[0]).offset(),this.options.disabled||(this.selectees=k(t.filter,this.element[0]),this._trigger("start",i),k(t.appendTo).append(this.helper),this.helper.css({left:i.pageX,top:i.pageY,width:0,height:0}),t.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var t=k.data(this,"selectable-item");t.startselected=!0,i.metaKey||i.ctrlKey||(s._removeClass(t.$element,"ui-selected"),t.selected=!1,s._addClass(t.$element,"ui-unselecting"),t.unselecting=!0,s._trigger("unselecting",i,{unselecting:t.element}))}),k(i.target).parents().addBack().each(function(){var t,e=k.data(this,"selectable-item");if(e)return t=!i.metaKey&&!i.ctrlKey||!e.$element.hasClass("ui-selected"),s._removeClass(e.$element,t?"ui-unselecting":"ui-selected")._addClass(e.$element,t?"ui-selecting":"ui-unselecting"),e.unselecting=!t,e.selecting=t,(e.selected=t)?s._trigger("selecting",i,{selecting:e.element}):s._trigger("unselecting",i,{unselecting:e.element}),!1}))},_mouseDrag:function(s){if(this.dragged=!0,!this.options.disabled){var t,n=this,o=this.options,a=this.opos[0],r=this.opos[1],h=s.pageX,l=s.pageY;return h<a&&(t=h,h=a,a=t),l<r&&(t=l,l=r,r=t),this.helper.css({left:a,top:r,width:h-a,height:l-r}),this.selectees.each(function(){var t=k.data(this,"selectable-item"),e=!1,i={};t&&t.element!==n.element[0]&&(i.left=t.left+n.elementPos.left,i.right=t.right+n.elementPos.left,i.top=t.top+n.elementPos.top,i.bottom=t.bottom+n.elementPos.top,"touch"===o.tolerance?e=!(i.left>h||i.right<a||i.top>l||i.bottom<r):"fit"===o.tolerance&&(e=i.left>a&&i.right<h&&i.top>r&&i.bottom<l),e?(t.selected&&(n._removeClass(t.$element,"ui-selected"),t.selected=!1),t.unselecting&&(n._removeClass(t.$element,"ui-unselecting"),t.unselecting=!1),t.selecting||(n._addClass(t.$element,"ui-selecting"),t.selecting=!0,n._trigger("selecting",s,{selecting:t.element}))):(t.selecting&&((s.metaKey||s.ctrlKey)&&t.startselected?(n._removeClass(t.$element,"ui-selecting"),t.selecting=!1,n._addClass(t.$element,"ui-selected"),t.selected=!0):(n._removeClass(t.$element,"ui-selecting"),t.selecting=!1,t.startselected&&(n._addClass(t.$element,"ui-unselecting"),t.unselecting=!0),n._trigger("unselecting",s,{unselecting:t.element}))),t.selected&&(s.metaKey||s.ctrlKey||t.startselected||(n._removeClass(t.$element,"ui-selected"),t.selected=!1,n._addClass(t.$element,"ui-unselecting"),t.unselecting=!0,n._trigger("unselecting",s,{unselecting:t.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,k(".ui-unselecting",this.element[0]).each(function(){var t=k.data(this,"selectable-item");i._removeClass(t.$element,"ui-unselecting"),t.unselecting=!1,t.startselected=!1,i._trigger("unselected",e,{unselected:t.element})}),k(".ui-selecting",this.element[0]).each(function(){var t=k.data(this,"selectable-item");i._removeClass(t.$element,"ui-selecting")._addClass(t.$element,"ui-selected"),t.selecting=!1,t.selected=!0,t.startselected=!0,i._trigger("selected",e,{selected:t.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),k.widget("ui.sortable",k.ui.mouse,{version:"1.12.1",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return e<=t&&t<e+i},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var t=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),k.each(this.items,function(){t._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;0<=t;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,e){var i=null,s=!1,n=this;return!this.reverting&&(!this.options.disabled&&"static"!==this.options.type&&(this._refreshItems(t),k(t.target).parents().each(function(){if(k.data(this,n.widgetName+"-item")===n)return i=k(this),!1}),k.data(t.target,n.widgetName+"-item")===n&&(i=k(t.target)),!!i&&(!(this.options.handle&&!e&&(k(this.options.handle,i).find("*").addBack().each(function(){this===t.target&&(s=!0)}),!s))&&(this.currentItem=i,this._removeCurrentsFromItems(),!0))))},_mouseStart:function(t,e,i){var s,n,o=this.options;if((this.currentContainer=this).refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},k.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(n=this.document.find("body"),this.storedCursor=n.css("cursor"),n.css("cursor",o.cursor),this.storedStylesheet=k("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(n)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!i)for(s=this.containers.length-1;0<=s;s--)this.containers[s]._trigger("activate",t,this._uiHash(this));return k.ui.ddmanager&&(k.ui.ddmanager.current=this),k.ui.ddmanager&&!o.dropBehaviour&&k.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var e,i,s,n,o=this.options,a=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=a=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=a=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=a=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=a=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-this.document.scrollTop()<o.scrollSensitivity?a=this.document.scrollTop(this.document.scrollTop()-o.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<o.scrollSensitivity&&(a=this.document.scrollTop(this.document.scrollTop()+o.scrollSpeed)),t.pageX-this.document.scrollLeft()<o.scrollSensitivity?a=this.document.scrollLeft(this.document.scrollLeft()-o.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<o.scrollSensitivity&&(a=this.document.scrollLeft(this.document.scrollLeft()+o.scrollSpeed))),!1!==a&&k.ui.ddmanager&&!o.dropBehaviour&&k.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),e=this.items.length-1;0<=e;e--)if(s=(i=this.items[e]).item[0],(n=this._intersectsWithPointer(i))&&i.instance===this.currentContainer&&!(s===this.currentItem[0]||this.placeholder[1===n?"next":"prev"]()[0]===s||k.contains(this.placeholder[0],s)||"semi-dynamic"===this.options.type&&k.contains(this.element[0],s))){if(this.direction=1===n?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;this._rearrange(t,i),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),k.ui.ddmanager&&k.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,e){var i,s,n,o;if(t)return k.ui.ddmanager&&!this.options.dropBehaviour&&k.ui.ddmanager.drop(this,t),this.options.revert?(s=(i=this).placeholder.offset(),o={},(n=this.options.axis)&&"x"!==n||(o.left=s.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),n&&"y"!==n||(o.top=s.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,k(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){i._clear(t)})):this._clear(t,e),!1},cancel:function(){if(this.dragging){this._mouseUp(new k.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var t=this.containers.length-1;0<=t;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),k.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?k(this.domPosition.prev).after(this.currentItem):k(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var t=this._getItemsAsjQuery(e&&e.connected),i=[];return e=e||{},k(t).each(function(){var t=(k(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);t&&i.push((e.key||t[1]+"[]")+"="+(e.key&&e.expression?t[1]:t[2]))}),!i.length&&e.key&&i.push(e.key+"="),i.join("&")},toArray:function(t){var e=this._getItemsAsjQuery(t&&t.connected),i=[];return t=t||{},e.each(function(){i.push(k(t.item||this).attr(t.attribute||"id")||"")}),i},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,l="x"===this.options.axis||r<s+l&&s+l<h,c="y"===this.options.axis||o<e+c&&e+c<a,c=l&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?c:o<e+this.helperProportions.width/2&&i-this.helperProportions.width/2<a&&r<s+this.helperProportions.height/2&&n-this.helperProportions.height/2<h},_intersectsWithPointer:function(t){var e="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),t="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width);return!(!e||!t)&&(e=this._getDragVerticalDirection(),t=this._getDragHorizontalDirection(),this.floating?"right"===t||"down"===e?2:1:e&&("down"===e?2:1))},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),t=this._getDragHorizontalDirection();return this.floating&&t?"right"===t&&i||"left"===t&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!=t&&(0<t?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!=t&&(0<t?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(t){var e,i,s,n,o=[],a=[],r=this._connectWith();if(r&&t)for(e=r.length-1;0<=e;e--)for(i=(s=k(r[e],this.document[0])).length-1;0<=i;i--)(n=k.data(s[i],this.widgetFullName))&&n!==this&&!n.options.disabled&&a.push([k.isFunction(n.options.items)?n.options.items.call(n.element):k(n.options.items,n.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),n]);function h(){o.push(this)}for(a.push([k.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):k(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),e=a.length-1;0<=e;e--)a[e][0].each(h);return k(o)},_removeCurrentsFromItems:function(){var i=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=k.grep(this.items,function(t){for(var e=0;e<i.length;e++)if(i[e]===t.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var e,i,s,n,o,a,r,h,l=this.items,c=[[k.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):k(this.options.items,this.element),this]],u=this._connectWith();if(u&&this.ready)for(e=u.length-1;0<=e;e--)for(i=(s=k(u[e],this.document[0])).length-1;0<=i;i--)(n=k.data(s[i],this.widgetFullName))&&n!==this&&!n.options.disabled&&(c.push([k.isFunction(n.options.items)?n.options.items.call(n.element[0],t,{item:this.currentItem}):k(n.options.items,n.element),n]),this.containers.push(n));for(e=c.length-1;0<=e;e--)for(o=c[e][1],i=0,h=(a=c[e][0]).length;i<h;i++)(r=k(a[i])).data(this.widgetName+"-item",o),l.push({item:r,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){var e,i,s,n;for(this.floating=!!this.items.length&&("x"===this.options.axis||this._isFloating(this.items[0].item)),this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset()),e=this.items.length-1;0<=e;e--)(i=this.items[e]).instance!==this.currentContainer&&this.currentContainer&&i.item[0]!==this.currentItem[0]||(s=this.options.toleranceElement?k(this.options.toleranceElement,i.item):i.item,t||(i.width=s.outerWidth(),i.height=s.outerHeight()),n=s.offset(),i.left=n.left,i.top=n.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(e=this.containers.length-1;0<=e;e--)n=this.containers[e].element.offset(),this.containers[e].containerCache.left=n.left,this.containers[e].containerCache.top=n.top,this.containers[e].containerCache.width=this.containers[e].element.outerWidth(),this.containers[e].containerCache.height=this.containers[e].element.outerHeight();return this},_createPlaceholder:function(i){var s,n=(i=i||this).options;n.placeholder&&n.placeholder.constructor!==String||(s=n.placeholder,n.placeholder={element:function(){var t=i.currentItem[0].nodeName.toLowerCase(),e=k("<"+t+">",i.document[0]);return i._addClass(e,"ui-sortable-placeholder",s||i.currentItem[0].className)._removeClass(e,"ui-sortable-helper"),"tbody"===t?i._createTrPlaceholder(i.currentItem.find("tr").eq(0),k("<tr>",i.document[0]).appendTo(e)):"tr"===t?i._createTrPlaceholder(i.currentItem,e):"img"===t&&e.attr("src",i.currentItem.attr("src")),s||e.css("visibility","hidden"),e},update:function(t,e){s&&!n.forcePlaceholderSize||(e.height()||e.height(i.currentItem.innerHeight()-parseInt(i.currentItem.css("paddingTop")||0,10)-parseInt(i.currentItem.css("paddingBottom")||0,10)),e.width()||e.width(i.currentItem.innerWidth()-parseInt(i.currentItem.css("paddingLeft")||0,10)-parseInt(i.currentItem.css("paddingRight")||0,10)))}}),i.placeholder=k(n.placeholder.element.call(i.element,i.currentItem)),i.currentItem.after(i.placeholder),n.placeholder.update(i,i.placeholder)},_createTrPlaceholder:function(t,e){var i=this;t.children().each(function(){k("<td>&#160;</td>",i.document[0]).attr("colspan",k(this).attr("colspan")||1).appendTo(e)})},_contactContainers:function(t){for(var e,i,s,n,o,a,r,h,l,c=null,u=null,d=this.containers.length-1;0<=d;d--)k.contains(this.currentItem[0],this.containers[d].element[0])||(this._intersectsWith(this.containers[d].containerCache)?c&&k.contains(this.containers[d].element[0],c.element[0])||(c=this.containers[d],u=d):this.containers[d].containerCache.over&&(this.containers[d]._trigger("out",t,this._uiHash(this)),this.containers[d].containerCache.over=0));if(c)if(1===this.containers.length)this.containers[u].containerCache.over||(this.containers[u]._trigger("over",t,this._uiHash(this)),this.containers[u].containerCache.over=1);else{for(i=1e4,s=null,n=(h=c.floating||this._isFloating(this.currentItem))?"left":"top",o=h?"width":"height",l=h?"pageX":"pageY",e=this.items.length-1;0<=e;e--)k.contains(this.containers[u].element[0],this.items[e].item[0])&&this.items[e].item[0]!==this.currentItem[0]&&(a=this.items[e].item.offset()[n],r=!1,t[l]-a>this.items[e][o]/2&&(r=!0),Math.abs(t[l]-a)<i&&(i=Math.abs(t[l]-a),s=this.items[e],this.direction=r?"up":"down"));(s||this.options.dropOnEmpty)&&(this.currentContainer!==this.containers[u]?(s?this._rearrange(t,s,null,!0):this._rearrange(t,null,this.containers[u].element,!0),this._trigger("change",t,this._uiHash()),this.containers[u]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[u],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[u]._trigger("over",t,this._uiHash(this)),this.containers[u].containerCache.over=1):this.currentContainer.containerCache.over||(this.containers[u]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1))}},_createHelper:function(t){var e=this.options,t=k.isFunction(e.helper)?k(e.helper.apply(this.element[0],[t,this.currentItem])):"clone"===e.helper?this.currentItem.clone():this.currentItem;return t.parents("body").length||k("parent"!==e.appendTo?e.appendTo:this.currentItem[0].parentNode)[0].appendChild(t[0]),t[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),t[0].style.width&&!e.forceHelperSize||t.width(this.currentItem.width()),t[0].style.height&&!e.forceHelperSize||t.height(this.currentItem.height()),t},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),k.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&k.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&k.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,e,i=this.options;"parent"===i.containment&&(i.containment=this.helper[0].parentNode),"document"!==i.containment&&"window"!==i.containment||(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===i.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===i.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(i.containment)||(t=k(i.containment)[0],e=k(i.containment).offset(),i="hidden"!==k(t).css("overflow"),this.containment=[e.left+(parseInt(k(t).css("borderLeftWidth"),10)||0)+(parseInt(k(t).css("paddingLeft"),10)||0)-this.margins.left,e.top+(parseInt(k(t).css("borderTopWidth"),10)||0)+(parseInt(k(t).css("paddingTop"),10)||0)-this.margins.top,e.left+(i?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(k(t).css("borderLeftWidth"),10)||0)-(parseInt(k(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,e.top+(i?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(k(t).css("borderTopWidth"),10)||0)-(parseInt(k(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,e){e=e||this.position;var i="absolute"===t?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&k.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,t=/(html|body)/i.test(s[0].tagName);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():t?0:s.scrollTop())*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():t?0:s.scrollLeft())*i}},_generatePosition:function(t){var e=this.options,i=t.pageX,s=t.pageY,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&k.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(i=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(s=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(i=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(s=this.containment[3]+this.offset.click.top)),e.grid&&(t=this.originalPageY+Math.round((s-this.originalPageY)/e.grid[1])*e.grid[1],s=!this.containment||t-this.offset.click.top>=this.containment[1]&&t-this.offset.click.top<=this.containment[3]?t:t-this.offset.click.top>=this.containment[1]?t-e.grid[1]:t+e.grid[1],t=this.originalPageX+Math.round((i-this.originalPageX)/e.grid[0])*e.grid[0],i=!this.containment||t-this.offset.click.left>=this.containment[0]&&t-this.offset.click.left<=this.containment[2]?t:t-this.offset.click.left>=this.containment[0]?t-e.grid[0]:t+e.grid[0])),{top:s-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop()),left:i-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)"auto"!==this._storedCSS[i]&&"static"!==this._storedCSS[i]||(this._storedCSS[i]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();function n(e,i,s){return function(t){s._trigger(e,t,i._uiHash(i))}}for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(s.push(function(t){this._trigger("remove",t,this._uiHash())}),s.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;0<=i;i--)e||s.push(n("deactivate",this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(n("out",this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(i=0;i<s.length;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){!1===k.Widget.prototype._trigger.apply(this,arguments)&&this.cancel()},_uiHash:function(t){var e=t||this;return{helper:e.helper,placeholder:e.placeholder||k([]),position:e.position,originalPosition:e.originalPosition,offset:e.positionAbs,item:e.currentItem,sender:t?t.element:null}}}),k.widget("ui.accordion",{version:"1.12.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:"> li > :first-child, > :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=k(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),t.collapsible||!1!==t.active&&null!=t.active||(t.active=0),this._processPanels(),t.active<0&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():k()}},_createIcons:function(){var t,e=this.options.icons;e&&(t=k("<span>"),this._addClass(t,"ui-accordion-header-icon","ui-icon "+e.header),t.prependTo(this.headers),t=this.active.children(".ui-accordion-header-icon"),this._removeClass(t,e.header)._addClass(t,null,e.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){"active"!==t?("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||!1!==this.options.active||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons())):this._activate(e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var e=k.ui.keyCode,i=this.headers.length,s=this.headers.index(t.target),n=!1;switch(t.keyCode){case e.RIGHT:case e.DOWN:n=this.headers[(s+1)%i];break;case e.LEFT:case e.UP:n=this.headers[(s-1+i)%i];break;case e.SPACE:case e.ENTER:this._eventHandler(t);break;case e.HOME:n=this.headers[0];break;case e.END:n=this.headers[i-1]}n&&(k(t.target).attr("tabIndex",-1),k(n).attr("tabIndex",0),k(n).trigger("focus"),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===k.ui.keyCode.UP&&t.ctrlKey&&k(t.currentTarget).prev().trigger("focus")},refresh:function(){var t=this.options;this._processPanels(),!1===t.active&&!0===t.collapsible||!this.headers.length?(t.active=!1,this.active=k()):!1===t.active?this._activate(0):this.active.length&&!k.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=k()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var i,t=this.options,e=t.heightStyle,s=this.element.parent();this.active=this._findActive(t.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var t=k(this),e=t.uniqueId().attr("id"),i=t.next(),s=i.uniqueId().attr("id");t.attr("aria-controls",s),i.attr("aria-labelledby",e)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(t.event),"fill"===e?(i=s.height(),this.element.siblings(":visible").each(function(){var t=k(this),e=t.css("position");"absolute"!==e&&"fixed"!==e&&(i-=t.outerHeight(!0))}),this.headers.each(function(){i-=k(this).outerHeight(!0)}),this.headers.next().each(function(){k(this).height(Math.max(0,i-k(this).innerHeight()+k(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.headers.next().each(function(){var t=k(this).is(":visible");t||k(this).show(),i=Math.max(i,k(this).css("height","").height()),t||k(this).hide()}).height(i))},_activate:function(t){t=this._findActive(t)[0];t!==this.active[0]&&(t=t||this.active[0],this._eventHandler({target:t,currentTarget:t,preventDefault:k.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):k()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&k.each(t.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var e=this.options,i=this.active,s=k(t.currentTarget),n=s[0]===i[0],o=n&&e.collapsible,a=o?k():s.next(),r=i.next(),a={oldHeader:i,oldPanel:r,newHeader:o?k():s,newPanel:a};t.preventDefault(),n&&!e.collapsible||!1===this._trigger("beforeActivate",t,a)||(e.active=!o&&this.headers.index(s),this.active=n?k():s,this._toggle(a),this._removeClass(i,"ui-accordion-header-active","ui-state-active"),e.icons&&(i=i.children(".ui-accordion-header-icon"),this._removeClass(i,null,e.icons.activeHeader)._addClass(i,null,e.icons.header)),n||(this._removeClass(s,"ui-accordion-header-collapsed")._addClass(s,"ui-accordion-header-active","ui-state-active"),e.icons&&(n=s.children(".ui-accordion-header-icon"),this._removeClass(n,null,e.icons.header)._addClass(n,null,e.icons.activeHeader)),this._addClass(s.next(),"ui-accordion-content-active")))},_toggle:function(t){var e=t.newPanel,i=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=e,this.prevHide=i,this.options.animate?this._animate(e,i,t):(i.hide(),e.show(),this._toggleComplete(t)),i.attr({"aria-hidden":"true"}),i.prev().attr({"aria-selected":"false","aria-expanded":"false"}),e.length&&i.length?i.prev().attr({tabIndex:-1,"aria-expanded":"false"}):e.length&&this.headers.filter(function(){return 0===parseInt(k(this).attr("tabIndex"),10)}).attr("tabIndex",-1),e.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,i,e){var s,n,o,a=this,r=0,h=t.css("box-sizing"),l=t.length&&(!i.length||t.index()<i.index()),c=this.options.animate||{},u=l&&c.down||c,l=function(){a._toggleComplete(e)};return"number"==typeof u&&(o=u),"string"==typeof u&&(n=u),n=n||u.easing||c.easing,o=o||u.duration||c.duration,i.length?t.length?(s=t.show().outerHeight(),i.animate(this.hideProps,{duration:o,easing:n,step:function(t,e){e.now=Math.round(t)}}),void t.hide().animate(this.showProps,{duration:o,easing:n,complete:l,step:function(t,e){e.now=Math.round(t),"height"!==e.prop?"content-box"===h&&(r+=e.now):"content"!==a.options.heightStyle&&(e.now=Math.round(s-i.outerHeight()-r),r=0)}})):i.animate(this.hideProps,o,n,l):t.animate(this.showProps,o,n,l)},_toggleComplete:function(t){var e=t.oldPanel,i=e.prev();this._removeClass(e,"ui-accordion-content-active"),this._removeClass(i,"ui-accordion-header-active")._addClass(i,"ui-accordion-header-collapsed"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}}),k.widget("ui.menu",{version:"1.12.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(t){var e=k(t.target),i=k(k.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&e.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),e.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&i.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){var e,i;this.previousFilter||(e=k(t.target).closest(".ui-menu-item"),i=k(t.currentTarget),e[0]===i[0]&&(this._removeClass(i.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(t,i)))},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(t){this._delay(function(){k.contains(this.element[0],k.ui.safeActiveElement(this.document[0]))||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var t=this.element.find(".ui-menu-item").removeAttr("role aria-disabled").children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),t.children().each(function(){var t=k(this);t.data("ui-menu-submenu-caret")&&t.remove()})},_keydown:function(t){var e,i,s,n=!0;switch(t.keyCode){case k.ui.keyCode.PAGE_UP:this.previousPage(t);break;case k.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case k.ui.keyCode.HOME:this._move("first","first",t);break;case k.ui.keyCode.END:this._move("last","last",t);break;case k.ui.keyCode.UP:this.previous(t);break;case k.ui.keyCode.DOWN:this.next(t);break;case k.ui.keyCode.LEFT:this.collapse(t);break;case k.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case k.ui.keyCode.ENTER:case k.ui.keyCode.SPACE:this._activate(t);break;case k.ui.keyCode.ESCAPE:this.collapse(t);break;default:n=!1,e=this.previousFilter||"",s=!1,i=96<=t.keyCode&&t.keyCode<=105?(t.keyCode-96).toString():String.fromCharCode(t.keyCode),clearTimeout(this.filterTimer),i===e?s=!0:i=e+i,e=this._filterMenuItems(i),(e=s&&-1!==e.index(this.active.next())?this.active.nextAll(".ui-menu-item"):e).length||(i=String.fromCharCode(t.keyCode),e=this._filterMenuItems(i)),e.length?(this.focus(t,e),this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}n&&t.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var t,e,s=this,n=this.options.icons.submenu,i=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),e=i.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=k(this),e=t.prev(),i=k("<span>").data("ui-menu-submenu-caret",!0);s._addClass(i,"ui-menu-icon","ui-icon "+n),e.attr("aria-haspopup","true").prepend(i),t.attr("aria-labelledby",e.attr("id"))}),this._addClass(e,"ui-menu","ui-widget ui-widget-content ui-front"),(t=i.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var t=k(this);s._isDivider(t)&&s._addClass(t,"ui-menu-divider","ui-widget-content")}),i=(e=t.not(".ui-menu-item, .ui-menu-divider")).children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(e,"ui-menu-item")._addClass(i,"ui-menu-item-wrapper"),t.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!k.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){var i;"icons"===t&&(i=this.element.find(".ui-menu-icon"),this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",String(t)),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),i=this.active.children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",i.attr("id")),i=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(t){var e,i,s;this._hasScroll()&&(i=parseFloat(k.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(k.css(this.activeMenu[0],"paddingTop"))||0,e=t.offset().top-this.activeMenu.offset().top-i-s,i=this.activeMenu.scrollTop(),s=this.activeMenu.height(),t=t.outerHeight(),e<0?this.activeMenu.scrollTop(i+e):s<e+t&&this.activeMenu.scrollTop(i+e-s+t))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(t){var e=k.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(e)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var t=i?this.element:k(e&&e.target).closest(this.element.find(".ui-menu"));t.length||(t=this.element),this._close(t),this.blur(e),this._removeClass(t.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=t},this.delay)},_close:function(t){(t=t||(this.active?this.active.parent():this.element)).find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(t){return!k(t.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(t){var e,i,s;this.active?this.isLastItem()||(this._hasScroll()?(i=this.active.offset().top,s=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return(e=k(this)).offset().top-i-s<0}),this.focus(t,e)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())):this.next(t)},previousPage:function(t){var e,i,s;this.active?this.isFirstItem()||(this._hasScroll()?(i=this.active.offset().top,s=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return 0<(e=k(this)).offset().top-i+s}),this.focus(t,e)):this.focus(t,this.activeMenu.find(this.options.items).first())):this.next(t)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||k(t.target).closest(".ui-menu-item");var e={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,e)},_filterMenuItems:function(t){var t=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),e=new RegExp("^"+t,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return e.test(k.trim(k(this).children(".ui-menu-item-wrapper").text()))})}});k.widget("ui.autocomplete",{version:"1.12.1",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var i,s,n,t=this.element[0].nodeName.toLowerCase(),e="textarea"===t,t="input"===t;this.isMultiLine=e||!t&&this._isContentEditable(this.element),this.valueMethod=this.element[e||t?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(t){if(this.element.prop("readOnly"))s=n=i=!0;else{s=n=i=!1;var e=k.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:i=!0,this._move("previousPage",t);break;case e.PAGE_DOWN:i=!0,this._move("nextPage",t);break;case e.UP:i=!0,this._keyEvent("previous",t);break;case e.DOWN:i=!0,this._keyEvent("next",t);break;case e.ENTER:this.menu.active&&(i=!0,t.preventDefault(),this.menu.select(t));break;case e.TAB:this.menu.active&&this.menu.select(t);break;case e.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(t),t.preventDefault());break;default:s=!0,this._searchTimeout(t)}}},keypress:function(t){if(i)return i=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||t.preventDefault());if(!s){var e=k.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:this._move("previousPage",t);break;case e.PAGE_DOWN:this._move("nextPage",t);break;case e.UP:this._keyEvent("previous",t);break;case e.DOWN:this._keyEvent("next",t)}}},input:function(t){if(n)return n=!1,void t.preventDefault();this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){this.cancelBlur?delete this.cancelBlur:(clearTimeout(this.searching),this.close(t),this._change(t))}}),this._initSource(),this.menu=k("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==k.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(t,e){var i;if(this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type)))return this.menu.blur(),void this.document.one("mousemove",function(){k(t.target).trigger(t.originalEvent)});i=e.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:i})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(i.value),(i=e.item.attr("aria-label")||i.value)&&k.trim(i).length&&(this.liveRegion.children().hide(),k("<div>").text(i).appendTo(this.liveRegion))},menuselect:function(t,e){var i=e.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==k.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",t,{item:i})&&this._value(i.value),this.term=this._value(),this.close(t),this.selectedItem=i}}),this.liveRegion=k("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(t){var e=this.menu.element[0];return t.target===this.element[0]||t.target===e||k.contains(e,t.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var t=this.options.appendTo;return(t=t&&(t.jquery||t.nodeType?k(t):this.document.find(t).eq(0)))&&t[0]||(t=this.element.closest(".ui-front, dialog")),t.length||(t=this.document[0].body),t},_initSource:function(){var i,s,n=this;k.isArray(this.options.source)?(i=this.options.source,this.source=function(t,e){e(k.ui.autocomplete.filter(i,t.term))}):"string"==typeof this.options.source?(s=this.options.source,this.source=function(t,e){n.xhr&&n.xhr.abort(),n.xhr=k.ajax({url:s,data:t,dataType:"json",success:function(t){e(t)},error:function(){e([])}})}):this.source=this.options.source},_searchTimeout:function(s){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),e=this.menu.element.is(":visible"),i=s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;t&&(!t||e||i)||(this.selectedItem=null,this.search(null,s))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):!1!==this._trigger("search",e)?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return k.proxy(function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")},this)},__response:function(t){t=t&&this._normalize(t),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:k.map(t,function(t){return"string"==typeof t?{label:t,value:t}:k.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var e=this.menu.element.empty();this._renderMenu(e,t),this.isNewMenu=!0,this.menu.refresh(),e.show(),this._resizeMenu(),e.position(k.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(i,t){var s=this;k.each(t,function(t,e){s._renderItemData(i,e)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(t,e){return k("<li>").append(k("<div>").text(e.label)).appendTo(t)},_move:function(t,e){if(this.menu.element.is(":visible"))return this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),void this.menu.blur()):void this.menu[t](e);this.search(null,e)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){this.isMultiLine&&!this.menu.element.is(":visible")||(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),k.extend(k.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,e){var i=new RegExp(k.ui.autocomplete.escapeRegex(e),"i");return k.grep(t,function(t){return i.test(t.label||t.value||t)})}}),k.widget("ui.autocomplete",k.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(1<t?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var e;this._superApply(arguments),this.options.disabled||this.cancelSearch||(e=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),k("<div>").text(e).appendTo(this.liveRegion))}});k.ui.autocomplete;var g=/ui-corner-([a-z]){2,6}/g;k.widget("ui.controlgroup",{version:"1.12.1",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var o=this,a=[];k.each(this.options.items,function(s,t){var e,n={};if(t)return"controlgroupLabel"===s?((e=o.element.find(t)).each(function(){var t=k(this);t.children(".ui-controlgroup-label-contents").length||t.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),o._addClass(e,null,"ui-widget ui-widget-content ui-state-default"),void(a=a.concat(e.get()))):void(k.fn[s]&&(n=o["_"+s+"Options"]?o["_"+s+"Options"]("middle"):{classes:{}},o.element.find(t).each(function(){var t=k(this),e=t[s]("instance"),i=k.widget.extend({},n);"button"===s&&t.parent(".ui-spinner").length||((e=e||t[s]()[s]("instance"))&&(i.classes=o._resolveClassesValues(i.classes,e)),t[s](i),i=t[s]("widget"),k.data(i[0],"ui-controlgroup-data",e||t[s]("instance")),a.push(i[0]))})))}),this.childWidgets=k(k.unique(a)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var t=k(this).data("ui-controlgroup-data");t&&t[e]&&t[e]()})},_updateCornerClass:function(t,e){e=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,"ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"),this._addClass(t,null,e)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],s},_spinnerOptions:function(t){t=this._buildSimpleOptions(t,"ui-spinner");return t.classes["ui-spinner-up"]="",t.classes["ui-spinner-down"]="",t},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e&&"auto",classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(i,s){var n={};return k.each(i,function(t){var e=s.options.classes[t]||"",e=k.trim(e.replace(g,""));n[t]=(e+" "+i[t]).replace(/\s+/g," ")}),n},_setOption:function(t,e){"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"!==t?this.refresh():this._callChildMethod(e?"disable":"enable")},refresh:function(){var n,o=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),n=this.childWidgets,this.options.onlyVisible&&(n=n.filter(":visible")),n.length&&(k.each(["first","last"],function(t,e){var i,s=n[e]().data("ui-controlgroup-data");s&&o["_"+s.widgetName+"Options"]?((i=o["_"+s.widgetName+"Options"](1===n.length?"only":e)).classes=o._resolveClassesValues(i.classes,s),s.element[s.widgetName](i)):o._updateCornerClass(n[e](),e)}),this._callChildMethod("refresh"))}});k.widget("ui.checkboxradio",[k.ui.formResetMixin,{version:"1.12.1",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var t,e=this,i=this._super()||{};return this._readType(),t=this.element.labels(),this.label=k(t[t.length-1]),this.label.length||k.error("No label found for checkboxradio widget"),this.originalLabel="",this.label.contents().not(this.element[0]).each(function(){e.originalLabel+=3===this.nodeType?k(this).text():this.outerHTML}),this.originalLabel&&(i.label=this.originalLabel),null!=(t=this.element[0].disabled)&&(i.disabled=t),i},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&(this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this.icon&&this._addClass(this.icon,null,"ui-state-hover")),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var t=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===t&&/radio|checkbox/.test(this.type)||k.error("Can't create checkboxradio on element.nodeName="+t+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var t=this.element[0].name,e="input[name='"+k.ui.escapeSelector(t)+"']";return t?(this.form.length?k(this.form[0].elements).filter(e):k(e).filter(function(){return 0===k(this).form().length})).not(this.element):k([])},_toggleClasses:function(){var t=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",t)._toggleClass(this.icon,null,"ui-icon-blank",!t),"radio"===this.type&&this._getRadioGroup().each(function(){var t=k(this).checkboxradio("instance");t&&t._removeClass(t.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){if("label"!==t||e){if(this._super(t,e),"disabled"===t)return this._toggleClass(this.label,null,"ui-state-disabled",e),void(this.element[0].disabled=e);this.refresh()}},_updateIcon:function(t){var e="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=k("<span>"),this.iconSpace=k("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(e+=t?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,t?"ui-icon-blank":"ui-icon-check")):e+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",e),t||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),this.iconSpace&&(t=t.not(this.iconSpace[0])),t.remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]);var m;k.ui.checkboxradio;k.widget("ui.button",{version:"1.12.1",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,e=this._super()||{};return this.isInput=this.element.is("input"),null!=(t=this.element[0].disabled)&&(e.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(t){t.keyCode===k.ui.keyCode.SPACE&&(t.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(t,e){var i="iconPosition"!==t,s=i?this.options.iconPosition:e,t="top"===s||"bottom"===s;this.icon?i&&this._removeClass(this.icon,null,this.options.icon):(this.icon=k("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),i&&this._addClass(this.icon,null,e),this._attachIcon(s),t?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=k("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(s))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var e=(void 0===t.showLabel?this.options:t).showLabel,i=(void 0===t.icon?this.options:t).icon;e||i||(t.showLabel=!0),this._super(t)},_setOption:function(t,e){"icon"===t&&(e?this._updateIcon(t,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===t&&this._updateIcon(t,e),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,e),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",e),(this.element[0].disabled=e)&&this.element.blur())},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),!1!==k.uiBackCompat&&(k.widget("ui.button",k.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(t,e){"text"!==t?("showLabel"===t&&(this.options.text=e),"icon"===t&&(this.options.icons.primary=e),"icons"===t&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments)):this._super("showLabel",e)}}),k.fn.button=(m=k.fn.button,function(){return!this.length||this.length&&"INPUT"!==this[0].tagName||this.length&&"INPUT"===this[0].tagName&&"checkbox"!==this.attr("type")&&"radio"!==this.attr("type")?m.apply(this,arguments):(k.ui.checkboxradio||k.error("Checkboxradio widget missing"),0===arguments.length?this.checkboxradio({icon:!1}):this.checkboxradio.apply(this,arguments))}),k.fn.buttonset=function(){return k.ui.controlgroup||k.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))});var _;k.ui.button;function v(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},k.extend(this._defaults,this.regional[""]),this.regional.en=k.extend(!0,{},this.regional[""]),this.regional["en-US"]=k.extend(!0,{},this.regional.en),this.dpDiv=b(k("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function b(t){var e="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.on("mouseout",e,function(){k(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&k(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&k(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",e,y)}function y(){k.datepicker._isDisabledDatepicker((_.inline?_.dpDiv.parent():_.input)[0])||(k(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),k(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&k(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&k(this).addClass("ui-datepicker-next-hover"))}function w(t,e){for(var i in k.extend(t,e),e)null==e[i]&&(t[i]=e[i]);return t}k.extend(k.ui,{datepicker:{version:"1.12.1"}}),k.extend(v.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return w(this._defaults,t||{}),this},_attachDatepicker:function(t,e){var i,s=t.nodeName.toLowerCase(),n="div"===s||"span"===s;t.id||(this.uuid+=1,t.id="dp"+this.uuid),(i=this._newInst(k(t),n)).settings=k.extend({},e||{}),"input"===s?this._connectDatepicker(t,i):n&&this._inlineDatepicker(t,i)},_newInst:function(t,e){return{id:t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1"),input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:e,dpDiv:e?b(k("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,e){var i=k(t);e.append=k([]),e.trigger=k([]),i.hasClass(this.markerClassName)||(this._attachments(i,e),i.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(e),k.data(t,"datepicker",e),e.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,e){var i,s=this._get(e,"appendText"),n=this._get(e,"isRTL");e.append&&e.append.remove(),s&&(e.append=k("<span class='"+this._appendClass+"'>"+s+"</span>"),t[n?"before":"after"](e.append)),t.off("focus",this._showDatepicker),e.trigger&&e.trigger.remove(),"focus"!==(i=this._get(e,"showOn"))&&"both"!==i||t.on("focus",this._showDatepicker),"button"!==i&&"both"!==i||(s=this._get(e,"buttonText"),i=this._get(e,"buttonImage"),e.trigger=k(this._get(e,"buttonImageOnly")?k("<img/>").addClass(this._triggerClass).attr({src:i,alt:s,title:s}):k("<button type='button'></button>").addClass(this._triggerClass).html(i?k("<img/>").attr({src:i,alt:s,title:s}):s)),t[n?"before":"after"](e.trigger),e.trigger.on("click",function(){return k.datepicker._datepickerShowing&&k.datepicker._lastInput===t[0]?k.datepicker._hideDatepicker():(k.datepicker._datepickerShowing&&k.datepicker._lastInput!==t[0]&&k.datepicker._hideDatepicker(),k.datepicker._showDatepicker(t[0])),!1}))},_autoSize:function(t){var e,i,s,n,o,a;this._get(t,"autoSize")&&!t.inline&&(o=new Date(2009,11,20),(a=this._get(t,"dateFormat")).match(/[DM]/)&&(e=function(t){for(n=s=i=0;n<t.length;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length))},_inlineDatepicker:function(t,e){var i=k(t);i.hasClass(this.markerClassName)||(i.addClass(this.markerClassName).append(e.dpDiv),k.data(t,"datepicker",e),this._setDate(e,this._getDefaultDate(e),!0),this._updateDatepicker(e),this._updateAlternate(e),e.settings.disabled&&this._disableDatepicker(t),e.dpDiv.css("display","block"))},_dialogDatepicker:function(t,e,i,s,n){var o,a=this._dialogInst;return a||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=k("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.on("keydown",this._doKeyDown),k("body").append(this._dialogInput),(a=this._dialogInst=this._newInst(this._dialogInput,!1)).settings={},k.data(this._dialogInput[0],"datepicker",a)),w(a.settings,s||{}),e=e&&e.constructor===Date?this._formatDate(a,e):e,this._dialogInput.val(e),this._pos=n?n.length?n:[n.pageX,n.pageY]:null,this._pos||(o=document.documentElement.clientWidth,s=document.documentElement.clientHeight,e=document.documentElement.scrollLeft||document.body.scrollLeft,n=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[o/2-100+e,s/2-150+n]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),a.settings.onSelect=i,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),k.blockUI&&k.blockUI(this.dpDiv),k.data(this._dialogInput[0],"datepicker",a),this},_destroyDatepicker:function(t){var e,i=k(t),s=k.data(t,"datepicker");i.hasClass(this.markerClassName)&&(e=t.nodeName.toLowerCase(),k.removeData(t,"datepicker"),"input"===e?(s.append.remove(),s.trigger.remove(),i.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):"div"!==e&&"span"!==e||i.removeClass(this.markerClassName).empty(),_===s&&(_=null))},_enableDatepicker:function(e){var t,i=k(e),s=k.data(e,"datepicker");i.hasClass(this.markerClassName)&&("input"===(t=e.nodeName.toLowerCase())?(e.disabled=!1,s.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):"div"!==t&&"span"!==t||((i=i.children("."+this._inlineClass)).children().removeClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=k.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var t,i=k(e),s=k.data(e,"datepicker");i.hasClass(this.markerClassName)&&("input"===(t=e.nodeName.toLowerCase())?(e.disabled=!0,s.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):"div"!==t&&"span"!==t||((i=i.children("."+this._inlineClass)).children().addClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=k.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;e<this._disabledInputs.length;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(t){try{return k.data(t,"datepicker")}catch(t){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,e,i){var s,n,o,a,r=this._getInst(t);if(2===arguments.length&&"string"==typeof e)return"defaults"===e?k.extend({},k.datepicker._defaults):r?"all"===e?k.extend({},r.settings):this._get(r,e):null;s=e||{},"string"==typeof e&&((s={})[e]=i),r&&(this._curInst===r&&this._hideDatepicker(),n=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(r,"min"),a=this._getMinMaxDate(r,"max"),w(r.settings,s),null!==o&&void 0!==s.dateFormat&&void 0===s.minDate&&(r.settings.minDate=this._formatDate(r,o)),null!==a&&void 0!==s.dateFormat&&void 0===s.maxDate&&(r.settings.maxDate=this._formatDate(r,a)),"disabled"in s&&(s.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(k(t),r),this._autoSize(r),this._setDate(r,n),this._updateAlternate(r),this._updateDatepicker(r))},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){t=this._getInst(t);t&&this._updateDatepicker(t)},_setDateDatepicker:function(t,e){t=this._getInst(t);t&&(this._setDate(t,e),this._updateDatepicker(t),this._updateAlternate(t))},_getDateDatepicker:function(t,e){t=this._getInst(t);return t&&!t.inline&&this._setDateFromField(t,e),t?this._getDate(t):null},_doKeyDown:function(t){var e,i,s=k.datepicker._getInst(t.target),n=!0,o=s.dpDiv.is(".ui-datepicker-rtl");if(s._keyEvent=!0,k.datepicker._datepickerShowing)switch(t.keyCode){case 9:k.datepicker._hideDatepicker(),n=!1;break;case 13:return(i=k("td."+k.datepicker._dayOverClass+":not(."+k.datepicker._currentClass+")",s.dpDiv))[0]&&k.datepicker._selectDay(t.target,s.selectedMonth,s.selectedYear,i[0]),(e=k.datepicker._get(s,"onSelect"))?(i=k.datepicker._formatDate(s),e.apply(s.input?s.input[0]:null,[i,s])):k.datepicker._hideDatepicker(),!1;case 27:k.datepicker._hideDatepicker();break;case 33:k.datepicker._adjustDate(t.target,t.ctrlKey?-k.datepicker._get(s,"stepBigMonths"):-k.datepicker._get(s,"stepMonths"),"M");break;case 34:k.datepicker._adjustDate(t.target,t.ctrlKey?+k.datepicker._get(s,"stepBigMonths"):+k.datepicker._get(s,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&k.datepicker._clearDate(t.target),n=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&k.datepicker._gotoToday(t.target),n=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&k.datepicker._adjustDate(t.target,o?1:-1,"D"),n=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&k.datepicker._adjustDate(t.target,t.ctrlKey?-k.datepicker._get(s,"stepBigMonths"):-k.datepicker._get(s,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&k.datepicker._adjustDate(t.target,-7,"D"),n=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&k.datepicker._adjustDate(t.target,o?-1:1,"D"),n=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&k.datepicker._adjustDate(t.target,t.ctrlKey?+k.datepicker._get(s,"stepBigMonths"):+k.datepicker._get(s,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&k.datepicker._adjustDate(t.target,7,"D"),n=t.ctrlKey||t.metaKey;break;default:n=!1}else 36===t.keyCode&&t.ctrlKey?k.datepicker._showDatepicker(this):n=!1;n&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var e,i=k.datepicker._getInst(t.target);if(k.datepicker._get(i,"constrainInput"))return e=k.datepicker._possibleChars(k.datepicker._get(i,"dateFormat")),i=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||i<" "||!e||-1<e.indexOf(i)},_doKeyUp:function(t){var e=k.datepicker._getInst(t.target);if(e.input.val()!==e.lastVal)try{k.datepicker.parseDate(k.datepicker._get(e,"dateFormat"),e.input?e.input.val():null,k.datepicker._getFormatConfig(e))&&(k.datepicker._setDateFromField(e),k.datepicker._updateAlternate(e),k.datepicker._updateDatepicker(e))}catch(t){}return!0},_showDatepicker:function(t){var e,i,s,n;"input"!==(t=t.target||t).nodeName.toLowerCase()&&(t=k("input",t.parentNode)[0]),k.datepicker._isDisabledDatepicker(t)||k.datepicker._lastInput===t||(n=k.datepicker._getInst(t),k.datepicker._curInst&&k.datepicker._curInst!==n&&(k.datepicker._curInst.dpDiv.stop(!0,!0),n&&k.datepicker._datepickerShowing&&k.datepicker._hideDatepicker(k.datepicker._curInst.input[0])),!1!==(i=(s=k.datepicker._get(n,"beforeShow"))?s.apply(t,[t,n]):{})&&(w(n.settings,i),n.lastVal=null,k.datepicker._lastInput=t,k.datepicker._setDateFromField(n),k.datepicker._inDialog&&(t.value=""),k.datepicker._pos||(k.datepicker._pos=k.datepicker._findPos(t),k.datepicker._pos[1]+=t.offsetHeight),e=!1,k(t).parents().each(function(){return!(e|="fixed"===k(this).css("position"))}),s={left:k.datepicker._pos[0],top:k.datepicker._pos[1]},k.datepicker._pos=null,n.dpDiv.empty(),n.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),k.datepicker._updateDatepicker(n),s=k.datepicker._checkOffset(n,s,e),n.dpDiv.css({position:k.datepicker._inDialog&&k.blockUI?"static":e?"fixed":"absolute",display:"none",left:s.left+"px",top:s.top+"px"}),n.inline||(i=k.datepicker._get(n,"showAnim"),s=k.datepicker._get(n,"duration"),n.dpDiv.css("z-index",function(t){for(var e,i;t.length&&t[0]!==document;){if(("absolute"===(e=t.css("position"))||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}(k(t))+1),k.datepicker._datepickerShowing=!0,k.effects&&k.effects.effect[i]?n.dpDiv.show(i,k.datepicker._get(n,"showOptions"),s):n.dpDiv[i||"show"](i?s:null),k.datepicker._shouldFocusInput(n)&&n.input.trigger("focus"),k.datepicker._curInst=n)))},_updateDatepicker:function(t){this.maxRows=4,(_=t).dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var e,i=this._getNumberOfMonths(t),s=i[1],n=t.dpDiv.find("."+this._dayOverClass+" a");0<n.length&&y.apply(n.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),1<s&&t.dpDiv.addClass("ui-datepicker-multi-"+s).css("width",17*s+"em"),t.dpDiv[(1!==i[0]||1!==i[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===k.datepicker._curInst&&k.datepicker._datepickerShowing&&k.datepicker._shouldFocusInput(t)&&t.input.trigger("focus"),t.yearshtml&&(e=t.yearshtml,setTimeout(function(){e===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),e=t.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(t,e,i){var s=t.dpDiv.outerWidth(),n=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,a=t.input?t.input.outerHeight():0,r=document.documentElement.clientWidth+(i?0:k(document).scrollLeft()),h=document.documentElement.clientHeight+(i?0:k(document).scrollTop());return e.left-=this._get(t,"isRTL")?s-o:0,e.left-=i&&e.left===t.input.offset().left?k(document).scrollLeft():0,e.top-=i&&e.top===t.input.offset().top+a?k(document).scrollTop():0,e.left-=Math.min(e.left,e.left+s>r&&s<r?Math.abs(e.left+s-r):0),e.top-=Math.min(e.top,e.top+n>h&&n<h?Math.abs(n+a):0),e},_findPos:function(t){for(var e=this._getInst(t),i=this._get(e,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||k.expr.filters.hidden(t));)t=t[i?"previousSibling":"nextSibling"];return[(e=k(t).offset()).left,e.top]},_hideDatepicker:function(t){var e,i,s=this._curInst;!s||t&&s!==k.data(t,"datepicker")||this._datepickerShowing&&(e=this._get(s,"showAnim"),i=this._get(s,"duration"),t=function(){k.datepicker._tidyDialog(s)},k.effects&&(k.effects.effect[e]||k.effects[e])?s.dpDiv.hide(e,k.datepicker._get(s,"showOptions"),i,t):s.dpDiv["slideDown"===e?"slideUp":"fadeIn"===e?"fadeOut":"hide"](e?i:null,t),e||t(),this._datepickerShowing=!1,(t=this._get(s,"onClose"))&&t.apply(s.input?s.input[0]:null,[s.input?s.input.val():"",s]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),k.blockUI&&(k.unblockUI(),k("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(t){var e;k.datepicker._curInst&&(e=k(t.target),t=k.datepicker._getInst(e[0]),(e[0].id===k.datepicker._mainDivId||0!==e.parents("#"+k.datepicker._mainDivId).length||e.hasClass(k.datepicker.markerClassName)||e.closest("."+k.datepicker._triggerClass).length||!k.datepicker._datepickerShowing||k.datepicker._inDialog&&k.blockUI)&&(!e.hasClass(k.datepicker.markerClassName)||k.datepicker._curInst===t)||k.datepicker._hideDatepicker())},_adjustDate:function(t,e,i){var s=k(t),t=this._getInst(s[0]);this._isDisabledDatepicker(s[0])||(this._adjustInstDate(t,e+("M"===i?this._get(t,"showCurrentAtPos"):0),i),this._updateDatepicker(t))},_gotoToday:function(t){var e=k(t),i=this._getInst(e[0]);this._get(i,"gotoCurrent")&&i.currentDay?(i.selectedDay=i.currentDay,i.drawMonth=i.selectedMonth=i.currentMonth,i.drawYear=i.selectedYear=i.currentYear):(t=new Date,i.selectedDay=t.getDate(),i.drawMonth=i.selectedMonth=t.getMonth(),i.drawYear=i.selectedYear=t.getFullYear()),this._notifyChange(i),this._adjustDate(e)},_selectMonthYear:function(t,e,i){var s=k(t),t=this._getInst(s[0]);t["selected"+("M"===i?"Month":"Year")]=t["draw"+("M"===i?"Month":"Year")]=parseInt(e.options[e.selectedIndex].value,10),this._notifyChange(t),this._adjustDate(s)},_selectDay:function(t,e,i,s){var n=k(t);k(s).hasClass(this._unselectableClass)||this._isDisabledDatepicker(n[0])||((n=this._getInst(n[0])).selectedDay=n.currentDay=k("a",s).html(),n.selectedMonth=n.currentMonth=e,n.selectedYear=n.currentYear=i,this._selectDate(t,this._formatDate(n,n.currentDay,n.currentMonth,n.currentYear)))},_clearDate:function(t){t=k(t);this._selectDate(t,"")},_selectDate:function(t,e){var i=k(t),t=this._getInst(i[0]);e=null!=e?e:this._formatDate(t),t.input&&t.input.val(e),this._updateAlternate(t),(i=this._get(t,"onSelect"))?i.apply(t.input?t.input[0]:null,[e,t]):t.input&&t.input.trigger("change"),t.inline?this._updateDatepicker(t):(this._hideDatepicker(),this._lastInput=t.input[0],"object"!=typeof t.input[0]&&t.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(t){var e,i,s=this._get(t,"altField");s&&(e=this._get(t,"altFormat")||this._get(t,"dateFormat"),i=this._getDate(t),t=this.formatDate(e,i,this._getFormatConfig(t)),k(s).val(t))},noWeekends:function(t){t=t.getDay();return[0<t&&t<6,""]},iso8601Week:function(t){var e=new Date(t.getTime());return e.setDate(e.getDate()+4-(e.getDay()||7)),t=e.getTime(),e.setMonth(0),e.setDate(1),Math.floor(Math.round((t-e)/864e5)/7)+1},parseDate:function(e,n,t){if(null==e||null==n)throw"Invalid arguments";if(""===(n="object"==typeof n?n.toString():n+""))return null;function o(t){return(t=w+1<e.length&&e.charAt(w+1)===t)&&w++,t}function i(t){var e=o(t),e="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,e=new RegExp("^\\d{"+("y"===t?e:1)+","+e+"}");if(!(e=n.substring(c).match(e)))throw"Missing number at position "+c;return c+=e[0].length,parseInt(e[0],10)}function s(t,e,i){var s=-1,e=k.map(o(t)?i:e,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(k.each(e,function(t,e){var i=e[1];if(n.substr(c,i.length).toLowerCase()===i.toLowerCase())return s=e[0],c+=i.length,!1}),-1!==s)return s+1;throw"Unknown name at position "+c}function a(){if(n.charAt(c)!==e.charAt(w))throw"Unexpected literal at position "+c;c++}for(var r,h,l,c=0,u=(t?t.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof u?u:(new Date).getFullYear()%100+parseInt(u,10),d=(t?t.dayNamesShort:null)||this._defaults.dayNamesShort,p=(t?t.dayNames:null)||this._defaults.dayNames,f=(t?t.monthNamesShort:null)||this._defaults.monthNamesShort,g=(t?t.monthNames:null)||this._defaults.monthNames,m=-1,_=-1,v=-1,b=-1,y=!1,w=0;w<e.length;w++)if(y)"'"!==e.charAt(w)||o("'")?a():y=!1;else switch(e.charAt(w)){case"d":v=i("d");break;case"D":s("D",d,p);break;case"o":b=i("o");break;case"m":_=i("m");break;case"M":_=s("M",f,g);break;case"y":m=i("y");break;case"@":m=(l=new Date(i("@"))).getFullYear(),_=l.getMonth()+1,v=l.getDate();break;case"!":m=(l=new Date((i("!")-this._ticksTo1970)/1e4)).getFullYear(),_=l.getMonth()+1,v=l.getDate();break;case"'":o("'")?a():y=!0;break;default:a()}if(c<n.length&&(h=n.substr(c),!/^\s+/.test(h)))throw"Extra/unparsed characters found in date: "+h;if(-1===m?m=(new Date).getFullYear():m<100&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(m<=u?0:-100)),-1<b)for(_=1,v=b;;){if(v<=(r=this._getDaysInMonth(m,_-1)))break;_++,v-=r}if((l=this._daylightSavingAdjust(new Date(m,_-1,v))).getFullYear()!==m||l.getMonth()+1!==_||l.getDate()!==v)throw"Invalid date";return l},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*60*60*1e7,formatDate:function(e,t,i){if(!t)return"";function n(t){return(t=a+1<e.length&&e.charAt(a+1)===t)&&a++,t}function s(t,e,i){var s=""+e;if(n(t))for(;s.length<i;)s="0"+s;return s}function o(t,e,i,s){return(n(t)?s:i)[e]}var a,r=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,h=(i?i.dayNames:null)||this._defaults.dayNames,l=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,c=(i?i.monthNames:null)||this._defaults.monthNames,u="",d=!1;if(t)for(a=0;a<e.length;a++)if(d)"'"!==e.charAt(a)||n("'")?u+=e.charAt(a):d=!1;else switch(e.charAt(a)){case"d":u+=s("d",t.getDate(),2);break;case"D":u+=o("D",t.getDay(),r,h);break;case"o":u+=s("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=s("m",t.getMonth()+1,2);break;case"M":u+=o("M",t.getMonth(),l,c);break;case"y":u+=n("y")?t.getFullYear():(t.getFullYear()%100<10?"0":"")+t.getFullYear()%100;break;case"@":u+=t.getTime();break;case"!":u+=1e4*t.getTime()+this._ticksTo1970;break;case"'":n("'")?u+="'":d=!0;break;default:u+=e.charAt(a)}return u},_possibleChars:function(e){function t(t){return(t=n+1<e.length&&e.charAt(n+1)===t)&&n++,t}for(var i="",s=!1,n=0;n<e.length;n++)if(s)"'"!==e.charAt(n)||t("'")?i+=e.charAt(n):s=!1;else switch(e.charAt(n)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":t("'")?i+="'":s=!0;break;default:i+=e.charAt(n)}return i},_get:function(t,e){return(void 0!==t.settings[e]?t.settings:this._defaults)[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(t){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(r,t,e){var i,s,t=null==t||""===t?e:"string"==typeof t?function(t){try{return k.datepicker.parseDate(k.datepicker._get(r,"dateFormat"),t,k.datepicker._getFormatConfig(r))}catch(t){}for(var e=(t.toLowerCase().match(/^c/)?k.datepicker._getDate(r):null)||new Date,i=e.getFullYear(),s=e.getMonth(),n=e.getDate(),o=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,a=o.exec(t);a;){switch(a[2]||"d"){case"d":case"D":n+=parseInt(a[1],10);break;case"w":case"W":n+=7*parseInt(a[1],10);break;case"m":case"M":s+=parseInt(a[1],10),n=Math.min(n,k.datepicker._getDaysInMonth(i,s));break;case"y":case"Y":i+=parseInt(a[1],10),n=Math.min(n,k.datepicker._getDaysInMonth(i,s))}a=o.exec(t)}return new Date(i,s,n)}(t):"number"==typeof t?isNaN(t)?e:(i=t,(s=new Date).setDate(s.getDate()+i),s):new Date(t.getTime());return(t=t&&"Invalid Date"===t.toString()?e:t)&&(t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0)),this._daylightSavingAdjust(t)},_daylightSavingAdjust:function(t){return t?(t.setHours(12<t.getHours()?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,e=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=e.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=e.getMonth(),t.drawYear=t.selectedYear=t.currentYear=e.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){return!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay))},_attachHandlers:function(t){var e=this._get(t,"stepMonths"),i="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){k.datepicker._adjustDate(i,-e,"M")},next:function(){k.datepicker._adjustDate(i,+e,"M")},hide:function(){k.datepicker._hideDatepicker()},today:function(){k.datepicker._gotoToday(i)},selectDay:function(){return k.datepicker._selectDay(i,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return k.datepicker._selectMonthYear(i,this,"M"),!1},selectYear:function(){return k.datepicker._selectMonthYear(i,this,"Y"),!1}};k(this).on(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,h,l,c,u,d,p,f,g,m,_,v,b,y,w,k,C,x,D,I,P,T,M,S,z,O=new Date,A=this._daylightSavingAdjust(new Date(O.getFullYear(),O.getMonth(),O.getDate())),H=this._get(t,"isRTL"),N=this._get(t,"showButtonPanel"),E=this._get(t,"hideIfNoPrevNext"),W=this._get(t,"navigationAsDateFormat"),F=this._getNumberOfMonths(t),L=this._get(t,"showCurrentAtPos"),O=this._get(t,"stepMonths"),R=1!==F[0]||1!==F[1],Y=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),B=this._getMinMaxDate(t,"min"),K=this._getMinMaxDate(t,"max"),j=t.drawMonth-L,U=t.drawYear;if(j<0&&(j+=12,U--),K)for(e=this._daylightSavingAdjust(new Date(K.getFullYear(),K.getMonth()-F[0]*F[1]+1,K.getDate())),e=B&&e<B?B:e;this._daylightSavingAdjust(new Date(U,j,1))>e;)--j<0&&(j=11,U--);for(t.drawMonth=j,t.drawYear=U,L=this._get(t,"prevText"),L=W?this.formatDate(L,this._daylightSavingAdjust(new Date(U,j-O,1)),this._getFormatConfig(t)):L,i=this._canAdjustMonth(t,-1,U,j)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+L+"'><span class='ui-icon ui-icon-circle-triangle-"+(H?"e":"w")+"'>"+L+"</span></a>":E?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+L+"'><span class='ui-icon ui-icon-circle-triangle-"+(H?"e":"w")+"'>"+L+"</span></a>",L=this._get(t,"nextText"),L=W?this.formatDate(L,this._daylightSavingAdjust(new Date(U,j+O,1)),this._getFormatConfig(t)):L,s=this._canAdjustMonth(t,1,U,j)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+L+"'><span class='ui-icon ui-icon-circle-triangle-"+(H?"w":"e")+"'>"+L+"</span></a>":E?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+L+"'><span class='ui-icon ui-icon-circle-triangle-"+(H?"w":"e")+"'>"+L+"</span></a>",E=this._get(t,"currentText"),L=this._get(t,"gotoCurrent")&&t.currentDay?Y:A,E=W?this.formatDate(E,L,this._getFormatConfig(t)):E,W=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",W=N?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(H?W:"")+(this._isInRange(t,L)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+E+"</button>":"")+(H?"":W)+"</div>":"",n=parseInt(this._get(t,"firstDay"),10),n=isNaN(n)?0:n,o=this._get(t,"showWeek"),a=this._get(t,"dayNames"),r=this._get(t,"dayNamesMin"),h=this._get(t,"monthNames"),l=this._get(t,"monthNamesShort"),c=this._get(t,"beforeShowDay"),u=this._get(t,"showOtherMonths"),d=this._get(t,"selectOtherMonths"),p=this._getDefaultDate(t),f="",m=0;m<F[0];m++){for(_="",this.maxRows=4,v=0;v<F[1];v++){if(b=this._daylightSavingAdjust(new Date(U,j,t.selectedDay)),C=" ui-corner-all",y="",R){if(y+="<div class='ui-datepicker-group",1<F[1])switch(v){case 0:y+=" ui-datepicker-group-first",C=" ui-corner-"+(H?"right":"left");break;case F[1]-1:y+=" ui-datepicker-group-last",C=" ui-corner-"+(H?"left":"right");break;default:y+=" ui-datepicker-group-middle",C=""}y+="'>"}for(y+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+C+"'>"+(/all|left/.test(C)&&0===m?H?s:i:"")+(/all|right/.test(C)&&0===m?H?i:s:"")+this._generateMonthYearHeader(t,j,U,B,K,0<m||0<v,h,l)+"</div><table class='ui-datepicker-calendar'><thead><tr>",w=o?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",g=0;g<7;g++)w+="<th scope='col'"+(5<=(g+n+6)%7?" class='ui-datepicker-week-end'":"")+"><span title='"+a[k=(g+n)%7]+"'>"+r[k]+"</span></th>";for(y+=w+"</tr></thead><tbody>",x=this._getDaysInMonth(U,j),U===t.selectedYear&&j===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,x)),C=(this._getFirstDayOfMonth(U,j)-n+7)%7,x=Math.ceil((C+x)/7),D=R&&this.maxRows>x?this.maxRows:x,this.maxRows=D,I=this._daylightSavingAdjust(new Date(U,j,1-C)),P=0;P<D;P++){for(y+="<tr>",T=o?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(I)+"</td>":"",g=0;g<7;g++)M=c?c.apply(t.input?t.input[0]:null,[I]):[!0,""],z=(S=I.getMonth()!==j)&&!d||!M[0]||B&&I<B||K&&K<I,T+="<td class='"+(5<=(g+n+6)%7?" ui-datepicker-week-end":"")+(S?" ui-datepicker-other-month":"")+(I.getTime()===b.getTime()&&j===t.selectedMonth&&t._keyEvent||p.getTime()===I.getTime()&&p.getTime()===b.getTime()?" "+this._dayOverClass:"")+(z?" "+this._unselectableClass+" ui-state-disabled":"")+(S&&!u?"":" "+M[1]+(I.getTime()===Y.getTime()?" "+this._currentClass:"")+(I.getTime()===A.getTime()?" ui-datepicker-today":""))+"'"+(S&&!u||!M[2]?"":" title='"+M[2].replace(/'/g,"&#39;")+"'")+(z?"":" data-handler='selectDay' data-event='click' data-month='"+I.getMonth()+"' data-year='"+I.getFullYear()+"'")+">"+(S&&!u?"&#xa0;":z?"<span class='ui-state-default'>"+I.getDate()+"</span>":"<a class='ui-state-default"+(I.getTime()===A.getTime()?" ui-state-highlight":"")+(I.getTime()===Y.getTime()?" ui-state-active":"")+(S?" ui-priority-secondary":"")+"' href='#'>"+I.getDate()+"</a>")+"</td>",I.setDate(I.getDate()+1),I=this._daylightSavingAdjust(I);y+=T+"</tr>"}11<++j&&(j=0,U++),_+=y+="</tbody></table>"+(R?"</div>"+(0<F[0]&&v===F[1]-1?"<div class='ui-datepicker-row-break'></div>":""):"")}f+=_}return f+=W,t._keyEvent=!1,f},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var h,l,c,u,d,p,f,g=this._get(t,"changeMonth"),m=this._get(t,"changeYear"),_=this._get(t,"showMonthAfterYear"),v="<div class='ui-datepicker-title'>",b="";if(o||!g)b+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,b+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;c<12;c++)(!h||c>=s.getMonth())&&(!l||c<=n.getMonth())&&(b+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");b+="</select>"}if(_||(v+=b+(!o&&g&&m?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",o||!m)v+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=(a=function(t){t=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(t)?d:t})(u[0]),f=Math.max(p,a(u[1]||"")),p=s?Math.max(p,s.getFullYear()):p,f=n?Math.min(f,n.getFullYear()):f,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";p<=f;p++)t.yearshtml+="<option value='"+p+"'"+(p===i?" selected='selected'":"")+">"+p+"</option>";t.yearshtml+="</select>",v+=t.yearshtml,t.yearshtml=null}return v+=this._get(t,"yearSuffix"),_&&(v+=(!o&&g&&m?"":"&#xa0;")+b),v+="</div>"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),e=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),e=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,e)));t.selectedDay=e.getDate(),t.drawMonth=t.selectedMonth=e.getMonth(),t.drawYear=t.selectedYear=e.getFullYear(),"M"!==i&&"Y"!==i||this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),t=this._getMinMaxDate(t,"max"),e=i&&e<i?i:e;return t&&t<e?t:e},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){t=this._get(t,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),n=this._daylightSavingAdjust(new Date(i,s+(e<0?e:n[0]*n[1]),1));return e<0&&n.setDate(this._getDaysInMonth(n.getFullYear(),n.getMonth())),this._isInRange(t,n)},_isInRange:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=null,o=null,a=this._get(t,"yearRange");return a&&(t=a.split(":"),a=(new Date).getFullYear(),n=parseInt(t[0],10),o=parseInt(t[1],10),t[0].match(/[+\-].*/)&&(n+=a),t[1].match(/[+\-].*/)&&(o+=a)),(!i||e.getTime()>=i.getTime())&&(!s||e.getTime()<=s.getTime())&&(!n||e.getFullYear()>=n)&&(!o||e.getFullYear()<=o)},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return{shortYearCutoff:e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);e=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),e,this._getFormatConfig(t))}}),k.fn.datepicker=function(t){if(!this.length)return this;k.datepicker.initialized||(k(document).on("mousedown",k.datepicker._checkExternalClick),k.datepicker.initialized=!0),0===k("#"+k.datepicker._mainDivId).length&&k("body").append(k.datepicker.dpDiv);var e=Array.prototype.slice.call(arguments,1);return"string"==typeof t&&("isDisabled"===t||"getDate"===t||"widget"===t)||"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?k.datepicker["_"+t+"Datepicker"].apply(k.datepicker,[this[0]].concat(e)):this.each(function(){"string"==typeof t?k.datepicker["_"+t+"Datepicker"].apply(k.datepicker,[this].concat(e)):k.datepicker._attachDatepicker(this,t)})},k.datepicker=new v,k.datepicker.initialized=!1,k.datepicker.uuid=(new Date).getTime(),k.datepicker.version="1.12.1";k.datepicker;k.widget("ui.dialog",{version:"1.12.1",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var e=k(this).css(t).offset().top;e<0&&k(this).css("top",t.top-e)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&k.fn.draggable&&this._makeDraggable(),this.options.resizable&&k.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?k(t):this.document.find(t||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),(t=e.parent.children().eq(e.index)).length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog},disable:k.noop,enable:k.noop,close:function(t){var e=this;this._isOpen&&!1!==this._trigger("beforeClose",t)&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||k.ui.safeBlur(k.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){e._trigger("close",t)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,e){var i=!1,s=this.uiDialog.siblings(".ui-front:visible").map(function(){return+k(this).css("z-index")}).get(),s=Math.max.apply(null,s);return s>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",s+1),i=!0),i&&!e&&this._trigger("focus",t),i},open:function(){var t=this;this._isOpen?this._moveToTop()&&this._focusTabbable():(this._isOpen=!0,this.opener=k(k.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"))},_focusTabbable:function(){var t=this._focusedElement;(t=t||this.element.find("[autofocus]")).length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).trigger("focus")},_keepFocus:function(t){function e(){var t=k.ui.safeActiveElement(this.document[0]);this.uiDialog[0]===t||k.contains(this.uiDialog[0],t)||this._focusTabbable()}t.preventDefault(),e.call(this),this._delay(e)},_createWrapper:function(){this.uiDialog=k("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===k.ui.keyCode.ESCAPE)return t.preventDefault(),void this.close(t);var e,i,s;t.keyCode!==k.ui.keyCode.TAB||t.isDefaultPrevented()||(e=this.uiDialog.find(":tabbable"),i=e.filter(":first"),s=e.filter(":last"),t.target!==s[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==i[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){s.trigger("focus")}),t.preventDefault()):(this._delay(function(){i.trigger("focus")}),t.preventDefault()))},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=k("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(t){k(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=k("<button type='button'></button>").button({label:k("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),t=k("<span>").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(t,"ui-dialog-title"),this._title(t),this.uiDialogTitlebar.prependTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(t){this.options.title?t.text(this.options.title):t.html("&#160;")},_createButtonPane:function(){this.uiDialogButtonPane=k("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=k("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var s=this,t=this.options.buttons;this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),k.isEmptyObject(t)||k.isArray(t)&&!t.length?this._removeClass(this.uiDialog,"ui-dialog-buttons"):(k.each(t,function(t,e){var i;e=k.isFunction(e)?{click:e,text:t}:e,e=k.extend({type:"button"},e),i=e.click,t={icon:e.icon,iconPosition:e.iconPosition,showLabel:e.showLabel,icons:e.icons,text:e.text},delete e.click,delete e.icon,delete e.iconPosition,delete e.showLabel,delete e.icons,"boolean"==typeof e.text&&delete e.text,k("<button></button>",e).button(t).appendTo(s.uiButtonSet).on("click",function(){i.apply(s.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog))},_makeDraggable:function(){var n=this,o=this.options;function a(t){return{position:t.position,offset:t.offset}}this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(t,e){n._addClass(k(this),"ui-dialog-dragging"),n._blockFrames(),n._trigger("dragStart",t,a(e))},drag:function(t,e){n._trigger("drag",t,a(e))},stop:function(t,e){var i=e.offset.left-n.document.scrollLeft(),s=e.offset.top-n.document.scrollTop();o.position={my:"left top",at:"left"+(0<=i?"+":"")+i+" top"+(0<=s?"+":"")+s,of:n.window},n._removeClass(k(this),"ui-dialog-dragging"),n._unblockFrames(),n._trigger("dragStop",t,a(e))}})},_makeResizable:function(){var n=this,o=this.options,t=o.resizable,e=this.uiDialog.css("position"),t="string"==typeof t?t:"n,e,s,w,se,sw,ne,nw";function a(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:o.maxWidth,maxHeight:o.maxHeight,minWidth:o.minWidth,minHeight:this._minHeight(),handles:t,start:function(t,e){n._addClass(k(this),"ui-dialog-resizing"),n._blockFrames(),n._trigger("resizeStart",t,a(e))},resize:function(t,e){n._trigger("resize",t,a(e))},stop:function(t,e){var i=n.uiDialog.offset(),s=i.left-n.document.scrollLeft(),i=i.top-n.document.scrollTop();o.height=n.uiDialog.height(),o.width=n.uiDialog.width(),o.position={my:"left top",at:"left"+(0<=s?"+":"")+s+" top"+(0<=i?"+":"")+i,of:n.window},n._removeClass(k(this),"ui-dialog-resizing"),n._unblockFrames(),n._trigger("resizeStop",t,a(e))}}).css("position",e)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=k(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),e=k.inArray(this,t);-1!==e&&t.splice(e,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||(t=[],this.document.data("ui-dialog-instances",t)),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,n={};k.each(t,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(t,e){var i,s=this.uiDialog;"disabled"!==t&&(this._super(t,e),"appendTo"===t&&this.uiDialog.appendTo(this._appendTo()),"buttons"===t&&this._createButtons(),"closeText"===t&&this.uiDialogTitlebarClose.button({label:k("<a>").text(""+this.options.closeText).html()}),"draggable"===t&&((i=s.is(":data(ui-draggable)"))&&!e&&s.draggable("destroy"),!i&&e&&this._makeDraggable()),"position"===t&&this._position(),"resizable"===t&&((i=s.is(":data(ui-resizable)"))&&!e&&s.resizable("destroy"),i&&"string"==typeof e&&s.resizable("option","handles",e),i||!1===e||this._makeResizable()),"title"===t&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=k(this);return k("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return!!k(t.target).closest(".ui-dialog").length||!!k(t.target).closest(".ui-datepicker").length},_createOverlay:function(){var e;this.options.modal&&(e=!0,this._delay(function(){e=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(t){e||this._allowInteraction(t)||(t.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=k("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1))},_destroyOverlay:function(){var t;this.options.modal&&this.overlay&&((t=this.document.data("ui-dialog-overlays")-1)?this.document.data("ui-dialog-overlays",t):(this._off(this.document,"focusin"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null)}}),!1!==k.uiBackCompat&&k.widget("ui.dialog",k.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(t,e){"dialogClass"===t&&this.uiDialog.removeClass(this.options.dialogClass).addClass(e),this._superApply(arguments)}});k.ui.dialog,k.widget("ui.progressbar",{version:"1.12.1",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=k("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(t){if(void 0===t)return this.options.value;this.options.value=this._constrainedValue(t),this._refreshValue()},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=!1===t,"number"!=typeof t&&(t=0),!this.indeterminate&&Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,e=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).width(e.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,t===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=k("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),k.widget("ui.selectmenu",[k.ui.formResetMixin,{version:"1.12.1",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:function(){var t=this.element.uniqueId().attr("id");this.ids={element:t,button:t+"-button",menu:t+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=k()},_drawButton:function(){var t,e=this,i=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:function(t){this.button.focus(),t.preventDefault()}}),this.element.hide(),this.button=k("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),t=k("<span>").appendTo(this.button),this._addClass(t,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(i).appendTo(this.button),!1!==this.options.width&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){e._rendered||e._refreshMenu()})},_drawMenu:function(){var i=this;this.menu=k("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=k("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(t,e){t.preventDefault(),i._setSelection(),i._select(e.item.data("ui-selectmenu-item"),t)},focus:function(t,e){e=e.item.data("ui-selectmenu-item");null!=i.focusIndex&&e.index!==i.focusIndex&&(i._trigger("focus",t,{item:e}),i.isOpen||i._select(e,t)),i.focusIndex=e.index,i.button.attr("aria-activedescendant",i.menuItems.eq(e.index).attr("id"))}}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),null===this.options.width&&this._resizeButton()},_refreshMenu:function(){var t=this.element.find("option");this.menu.empty(),this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,t.length&&(t=this._getSelectedItem(),this.menuInstance.focus(null,t),this._setAria(t.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(t){this.options.disabled||(this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",t)))},_position:function(){this.menuWrap.position(k.extend({of:this.button},this.options.position))},close:function(t){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",t))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(t){var e=k("<span>");return this._setText(e,t.label),this._addClass(e,"ui-selectmenu-text"),e},_renderMenu:function(s,t){var n=this,o="";k.each(t,function(t,e){var i;e.optgroup!==o&&(i=k("<li>",{text:e.optgroup}),n._addClass(i,"ui-selectmenu-optgroup","ui-menu-divider"+(e.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),i.appendTo(s),o=e.optgroup),n._renderItemData(s,e)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-selectmenu-item",e)},_renderItem:function(t,e){var i=k("<li>"),s=k("<div>",{title:e.element.attr("title")});return e.disabled&&this._addClass(i,null,"ui-state-disabled"),this._setText(s,e.label),i.append(s).appendTo(t)},_setText:function(t,e){e?t.text(e):t.html("&#160;")},_move:function(t,e){var i,s=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex).parent("li"):(i=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),s+=":not(.ui-state-disabled)"),(s="first"===t||"last"===t?i["first"===t?"prevAll":"nextAll"](s).eq(-1):i[t+"All"](s).eq(0)).length&&this.menuInstance.focus(e,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},_toggle:function(t){this[this.isOpen?"close":"open"](t)},_setSelection:function(){var t;this.range&&(window.getSelection?((t=window.getSelection()).removeAllRanges(),t.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(t){this.isOpen&&(k(t.target).closest(".ui-selectmenu-menu, #"+k.ui.escapeSelector(this.ids.button)).length||this.close(t))}},_buttonEvents:{mousedown:function(){var t;window.getSelection?(t=window.getSelection()).rangeCount&&(this.range=t.getRangeAt(0)):this.range=document.selection.createRange()},click:function(t){this._setSelection(),this._toggle(t)},keydown:function(t){var e=!0;switch(t.keyCode){case k.ui.keyCode.TAB:case k.ui.keyCode.ESCAPE:this.close(t),e=!1;break;case k.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case k.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case k.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case k.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case k.ui.keyCode.LEFT:this._move("prev",t);break;case k.ui.keyCode.RIGHT:this._move("next",t);break;case k.ui.keyCode.HOME:case k.ui.keyCode.PAGE_UP:this._move("first",t);break;case k.ui.keyCode.END:case k.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),e=!1}e&&t.preventDefault()}},_selectFocusedItem:function(t){var e=this.menuItems.eq(this.focusIndex).parent("li");e.hasClass("ui-state-disabled")||this._select(e.data("ui-selectmenu-item"),t)},_select:function(t,e){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=t.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(t)),this._setAria(t),this._trigger("select",e,{item:t}),t.index!==i&&this._trigger("change",e,{item:t}),this.close(e)},_setAria:function(t){t=this.menuItems.eq(t.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(t,e){var i;"icons"===t&&(i=this.button.find("span.ui-icon"),this._removeClass(i,null,this.options.icons.button)._addClass(i,null,e.button)),this._super(t,e),"appendTo"===t&&this.menuWrap.appendTo(this._appendTo()),"width"===t&&this._resizeButton()},_setOptionDisabled:function(t){this._super(t),this.menuInstance.option("disabled",t),this.button.attr("aria-disabled",t),this._toggleClass(this.button,null,"ui-state-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},_appendTo:function(){var t=this.options.appendTo;return(t=t&&(t.jquery||t.nodeType?k(t):this.document.find(t).eq(0)))&&t[0]||(t=this.element.closest(".ui-front, dialog")),t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var t=this.options.width;!1!==t?(null===t&&(t=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(t)):this.button.css("width","")},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){var t=this._super();return t.disabled=this.element.prop("disabled"),t},_parseOptions:function(t){var i=this,s=[];t.each(function(t,e){s.push(i._parseOption(k(e),t))}),this.items=s},_parseOption:function(t,e){var i=t.parent("optgroup");return{element:t,index:e,value:t.val(),label:t.text(),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||t.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)}}]),k.widget("ui.slider",k.ui.mouse,{version:"1.12.1",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,e=this.options,i=this.element.find(".ui-slider-handle"),s=[],n=e.values&&e.values.length||1;for(i.length>n&&(i.slice(n).remove(),i=i.slice(0,n)),t=i.length;t<n;t++)s.push("<span tabindex='0'></span>");this.handles=i.add(k(s.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(t){k(this).data("ui-slider-handle-index",t).attr("tabIndex",0)})},_createRange:function(){var t=this.options;t.range?(!0===t.range&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:k.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=k("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),"min"!==t.range&&"max"!==t.range||this._addClass(this.range,"ui-slider-range-"+t.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(t){var i,s,n,o,e,a,r=this,h=this.options;return!h.disabled&&(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),a={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(a),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var e=Math.abs(i-r.values(t));(e<s||s===e&&(t===r._lastChangedValue||r.values(t)===h.min))&&(s=e,n=k(this),o=t)}),!1!==this._start(t,o)&&(this._mouseSliding=!0,this._handleIndex=o,this._addClass(n,null,"ui-state-active"),n.trigger("focus"),e=n.offset(),a=!k(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=a?{left:0,top:0}:{left:t.pageX-e.left-n.width()/2,top:t.pageY-e.top-n.height()/2-(parseInt(n.css("borderTopWidth"),10)||0)-(parseInt(n.css("borderBottomWidth"),10)||0)+(parseInt(n.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,i),this._animateOff=!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},e=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,e),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,t="horizontal"===this.orientation?(e=this.elementSize.width,t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),t=t/e;return 1<t&&(t=1),t<0&&(t=0),"vertical"===this.orientation&&(t=1-t),e=this._valueMax()-this._valueMin(),e=this._valueMin()+t*e,this._trimAlignValue(e)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n=this.value(),o=this.values();this._hasMultipleValues()&&(s=this.values(e?0:1),n=this.values(e),2===this.options.values.length&&!0===this.options.range&&(i=0===e?Math.min(s,i):Math.max(s,i)),o[e]=i),i!==n&&!1!==this._trigger("slide",t,this._uiHash(e,i,o))&&(this._hasMultipleValues()?this.values(e,i):this.value(i))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),void this._change(null,0)):this._value()},values:function(t,e){var i,s,n;if(1<arguments.length)return this.options.values[t]=this._trimAlignValue(e),this._refreshValue(),void this._change(null,t);if(!arguments.length)return this._values();if(!k.isArray(t))return this._hasMultipleValues()?this._values(t):this.value();for(i=this.options.values,s=t,n=0;n<i.length;n+=1)i[n]=this._trimAlignValue(s[n]),this._change(null,n);this._refreshValue()},_setOption:function(t,e){var i,s=0;switch("range"===t&&!0===this.options.range&&("min"===e?(this.options.value=this._values(0),this.options.values=null):"max"===e&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),k.isArray(this.options.values)&&(s=this.options.values.length),this._super(t,e),t){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(e),this.handles.css("horizontal"===e?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),i=s-1;0<=i;i--)this._change(null,i);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],this._trimAlignValue(e);if(this._hasMultipleValues()){for(i=this.options.values.slice(),s=0;s<i.length;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(t<=this._valueMin())return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=0<this.options.step?this.options.step:1,i=(t-this._valueMin())%e,t=t-i;return 2*Math.abs(i)>=e&&(t+=0<i?e:-e),parseFloat(t.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step;(t=Math.round((t-e)/i)*i+e)>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=t.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,t,s,n,o=this.options.range,a=this.options,r=this,h=!this._animateOff&&a.animate,l={};this._hasMultipleValues()?this.handles.each(function(t){i=(r.values(t)-r._valueMin())/(r._valueMax()-r._valueMin())*100,l["horizontal"===r.orientation?"left":"bottom"]=i+"%",k(this).stop(1,1)[h?"animate":"css"](l,a.animate),!0===r.options.range&&("horizontal"===r.orientation?(0===t&&r.range.stop(1,1)[h?"animate":"css"]({left:i+"%"},a.animate),1===t&&r.range[h?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:a.animate})):(0===t&&r.range.stop(1,1)[h?"animate":"css"]({bottom:i+"%"},a.animate),1===t&&r.range[h?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:a.animate}))),e=i}):(t=this.value(),s=this._valueMin(),n=this._valueMax(),i=n!==s?(t-s)/(n-s)*100:0,l["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[h?"animate":"css"](l,a.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:i+"%"},a.animate),"max"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:100-i+"%"},a.animate),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:i+"%"},a.animate),"max"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:100-i+"%"},a.animate))},_handleEvents:{keydown:function(t){var e,i,s,n=k(t.target).data("ui-slider-handle-index");switch(t.keyCode){case k.ui.keyCode.HOME:case k.ui.keyCode.END:case k.ui.keyCode.PAGE_UP:case k.ui.keyCode.PAGE_DOWN:case k.ui.keyCode.UP:case k.ui.keyCode.RIGHT:case k.ui.keyCode.DOWN:case k.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(k(t.target),null,"ui-state-active"),!1===this._start(t,n)))return}switch(s=this.options.step,e=i=this._hasMultipleValues()?this.values(n):this.value(),t.keyCode){case k.ui.keyCode.HOME:i=this._valueMin();break;case k.ui.keyCode.END:i=this._valueMax();break;case k.ui.keyCode.PAGE_UP:i=this._trimAlignValue(e+(this._valueMax()-this._valueMin())/this.numPages);break;case k.ui.keyCode.PAGE_DOWN:i=this._trimAlignValue(e-(this._valueMax()-this._valueMin())/this.numPages);break;case k.ui.keyCode.UP:case k.ui.keyCode.RIGHT:if(e===this._valueMax())return;i=this._trimAlignValue(e+s);break;case k.ui.keyCode.DOWN:case k.ui.keyCode.LEFT:if(e===this._valueMin())return;i=this._trimAlignValue(e-s)}this._slide(t,n,i)},keyup:function(t){var e=k(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,e),this._change(t,e),this._removeClass(k(t.target),null,"ui-state-active"))}}});function T(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}k.widget("ui.spinner",{version:"1.12.1",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var s=this._super(),n=this.element;return k.each(["min","max","step"],function(t,e){var i=n.attr(e);null!=i&&i.length&&(s[e]=i)}),s},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){this.cancelBlur?delete this.cancelBlur:(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t))},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((0<e?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(t){var e;function i(){this.element[0]===k.ui.safeActiveElement(this.document[0])||(this.element.trigger("focus"),this.previous=e,this._delay(function(){this.previous=e}))}e=this.element[0]===k.ui.safeActiveElement(this.document[0])?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),!1!==this._start(t)&&this._repeat(null,k(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){if(k(t.currentTarget).hasClass("ui-state-active"))return!1!==this._start(t)&&void this._repeat(null,k(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&0<this.uiSpinner.height()&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(t){var e=this.options,i=k.ui.keyCode;switch(t.keyCode){case i.UP:return this._repeat(null,1,t),!0;case i.DOWN:return this._repeat(null,-1,t),!0;case i.PAGE_UP:return this._repeat(null,e.page,t),!0;case i.PAGE_DOWN:return this._repeat(null,-e.page,t),!0}return!1},_start:function(t){return!(!this.spinning&&!1===this._trigger("start",t))&&(this.counter||(this.counter=1),this.spinning=!0)},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&!1===this._trigger("spin",e,{value:i})||(this._value(i),this.counter++)},_increment:function(t){var e=this.options.incremental;return e?k.isFunction(e)?e(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=t.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_adjustValue:function(t){var e=this.options,i=null!==e.min?e.min:0,s=t-i;return t=i+Math.round(s/e.step)*e.step,t=parseFloat(t.toFixed(this._precision())),null!==e.max&&t>e.max?e.max:null!==e.min&&t<e.min?e.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i;if("culture"===t||"numberFormat"===t)return i=this._parse(this.element.val()),this.options[t]=e,void this.element.val(this._format(i));"max"!==t&&"min"!==t&&"step"!==t||"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(i=this.buttons.first().find(".ui-icon"),this._removeClass(i,null,this.options.icons.up),this._addClass(i,null,e.up),i=this.buttons.last().find(".ui-icon"),this._removeClass(i,null,this.options.icons.down),this._addClass(i,null,e.down)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:T(function(t){this._super(t)}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null!==t&&t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&null!==(i=this._parse(t))&&(e||(i=this._adjustValue(i)),t=this._format(i)),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:T(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:T(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:T(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:T(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){if(!arguments.length)return this._parse(this.element.val());T(this._value).call(this,t)},widget:function(){return this.uiSpinner}}),!1!==k.uiBackCompat&&k.widget("ui.spinner",k.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}});var M;k.ui.spinner;k.widget("ui.tabs",{version:"1.12.1",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:(M=/#.*$/,function(t){var e=t.href.replace(M,""),i=location.href.replace(M,"");try{e=decodeURIComponent(e)}catch(t){}try{i=decodeURIComponent(i)}catch(t){}return 1<t.hash.length&&e===i}),_create:function(){var e=this,t=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,t.collapsible),this._processTabs(),t.active=this._initialActive(),k.isArray(t.disabled)&&(t.disabled=k.unique(t.disabled.concat(k.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),!1!==this.options.active&&this.anchors.length?this.active=this._findActive(t.active):this.active=k(),this._refresh(),this.active.length&&this.load(t.active)},_initialActive:function(){var i=this.options.active,t=this.options.collapsible,s=location.hash.substring(1);return null===i&&(s&&this.tabs.each(function(t,e){if(k(e).attr("aria-controls")===s)return i=t,!1}),null===i&&(i=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),null!==i&&-1!==i||(i=!!this.tabs.length&&0)),!1!==i&&-1===(i=this.tabs.index(this.tabs.eq(i)))&&(i=!t&&0),!t&&!1===i&&this.anchors.length&&(i=0),i},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):k()}},_tabKeydown:function(t){var e=k(k.ui.safeActiveElement(this.document[0])).closest("li"),i=this.tabs.index(e),s=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case k.ui.keyCode.RIGHT:case k.ui.keyCode.DOWN:i++;break;case k.ui.keyCode.UP:case k.ui.keyCode.LEFT:s=!1,i--;break;case k.ui.keyCode.END:i=this.anchors.length-1;break;case k.ui.keyCode.HOME:i=0;break;case k.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),void this._activate(i);case k.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),void this._activate(i!==this.options.active&&i);default:return}t.preventDefault(),clearTimeout(this.activating),i=this._focusNextTab(i,s),t.ctrlKey||t.metaKey||(e.attr("aria-selected","false"),this.tabs.eq(i).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",i)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===k.ui.keyCode.UP&&(t.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(t){return t.altKey&&t.keyCode===k.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===k.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,e){var i=this.tabs.length-1;for(;-1!==k.inArray((i<t&&(t=0),t<0&&(t=i),t),this.options.disabled);)t=e?t+1:t-1;return t},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){"active"!==t?(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||!1!==this.options.active||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e)):this._activate(e)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,e=this.tablist.children(":has(a[href])");t.disabled=k.map(e.filter(".ui-state-disabled"),function(t){return e.index(t)}),this._processTabs(),!1!==t.active&&this.anchors.length?this.active.length&&!k.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=k()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=k()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var h=this,t=this.tabs,e=this.anchors,i=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(t){k(this).is(".ui-state-disabled")&&t.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){k(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return k("a",this)[0]}).attr({role:"presentation",tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=k(),this.anchors.each(function(t,e){var i,s,n,o=k(e).uniqueId().attr("id"),a=k(e).closest("li"),r=a.attr("aria-controls");h._isLocal(e)?(n=(i=e.hash).substring(1),s=h.element.find(h._sanitizeSelector(i))):(i="#"+(n=a.attr("aria-controls")||k({}).uniqueId()[0].id),(s=h.element.find(i)).length||(s=h._createPanel(n)).insertAfter(h.panels[t-1]||h.tablist),s.attr("aria-live","polite")),s.length&&(h.panels=h.panels.add(s)),r&&a.data("ui-tabs-aria-controls",r),a.attr({"aria-controls":n,"aria-labelledby":o}),s.attr("aria-labelledby",o)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),t&&(this._off(t.not(this.tabs)),this._off(e.not(this.anchors)),this._off(i.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(t){return k("<div>").attr("id",t).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(t){var e,i;for(k.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1),i=0;e=this.tabs[i];i++)e=k(e),!0===t||-1!==k.inArray(i,t)?(e.attr("aria-disabled","true"),this._addClass(e,null,"ui-state-disabled")):(e.removeAttr("aria-disabled"),this._removeClass(e,null,"ui-state-disabled"));this.options.disabled=t,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!0===t)},_setupEvents:function(t){var i={};t&&k.each(t.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,e=this.element.parent();"fill"===t?(i=e.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=k(this),e=t.css("position");"absolute"!==e&&"fixed"!==e&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=k(this).outerHeight(!0)}),this.panels.each(function(){k(this).height(Math.max(0,i-k(this).innerHeight()+k(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,k(this).height("").height())}).height(i))},_eventHandler:function(t){var e=this.options,i=this.active,s=k(t.currentTarget).closest("li"),n=s[0]===i[0],o=n&&e.collapsible,a=o?k():this._getPanelForTab(s),r=i.length?this._getPanelForTab(i):k(),i={oldTab:i,oldPanel:r,newTab:o?k():s,newPanel:a};t.preventDefault(),s.hasClass("ui-state-disabled")||s.hasClass("ui-tabs-loading")||this.running||n&&!e.collapsible||!1===this._trigger("beforeActivate",t,i)||(e.active=!o&&this.tabs.index(s),this.active=n?k():s,this.xhr&&this.xhr.abort(),r.length||a.length||k.error("jQuery UI Tabs: Mismatching fragment identifier."),a.length&&this.load(this.tabs.index(s),t),this._toggle(t,i))},_toggle:function(t,e){var i=this,s=e.newPanel,n=e.oldPanel;function o(){i.running=!1,i._trigger("activate",t,e)}function a(){i._addClass(e.newTab.closest("li"),"ui-tabs-active","ui-state-active"),s.length&&i.options.show?i._show(s,i.options.show,o):(s.show(),o())}this.running=!0,n.length&&this.options.hide?this._hide(n,this.options.hide,function(){i._removeClass(e.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),a()}):(this._removeClass(e.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n.hide(),a()),n.attr("aria-hidden","true"),e.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),s.length&&n.length?e.oldTab.attr("tabIndex",-1):s.length&&this.tabs.filter(function(){return 0===k(this).attr("tabIndex")}).attr("tabIndex",-1),s.attr("aria-hidden","false"),e.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var t=this._findActive(t);t[0]!==this.active[0]&&(t.length||(t=this.active),t=t.find(".ui-tabs-anchor")[0],this._eventHandler({target:t,currentTarget:t,preventDefault:k.noop}))},_findActive:function(t){return!1===t?k():this.tabs.eq(t)},_getIndex:function(t){return"string"==typeof t&&(t=this.anchors.index(this.anchors.filter("[href$='"+k.ui.escapeSelector(t)+"']"))),t},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){k.data(this,"ui-tabs-destroy")?k(this).remove():k(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var t=k(this),e=t.data("ui-tabs-aria-controls");e?t.attr("aria-controls",e).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var t=this.options.disabled;!1!==t&&(t=void 0!==i&&(i=this._getIndex(i),k.isArray(t)?k.map(t,function(t){return t!==i?t:null}):k.map(this.tabs,function(t,e){return e!==i?e:null})),this._setOptionDisabled(t))},disable:function(t){var e=this.options.disabled;if(!0!==e){if(void 0===t)e=!0;else{if(t=this._getIndex(t),-1!==k.inArray(t,e))return;e=k.isArray(e)?k.merge([t],e).sort():[t]}this._setOptionDisabled(e)}},load:function(t,s){t=this._getIndex(t);function n(t,e){"abort"===e&&o.panels.stop(!1,!0),o._removeClass(i,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===o.xhr&&delete o.xhr}var o=this,i=this.tabs.eq(t),t=i.find(".ui-tabs-anchor"),a=this._getPanelForTab(i),r={tab:i,panel:a};this._isLocal(t[0])||(this.xhr=k.ajax(this._ajaxSettings(t,s,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(i,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,i){setTimeout(function(){a.html(t),o._trigger("load",s,r),n(i,e)},1)}).fail(function(t,e){setTimeout(function(){n(t,e)},1)})))},_ajaxSettings:function(t,i,s){var n=this;return{url:t.attr("href").replace(/#.*$/,""),beforeSend:function(t,e){return n._trigger("beforeLoad",i,k.extend({jqXHR:t,ajaxSettings:e},s))}}},_getPanelForTab:function(t){t=k(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+t))}}),!1!==k.uiBackCompat&&k.widget("ui.tabs",k.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}});k.ui.tabs;k.widget("ui.tooltip",{version:"1.12.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var t=k(this).attr("title")||"";return k("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(t,e){var i=(t.attr("aria-describedby")||"").split(/\s+/);i.push(e),t.data("ui-tooltip-id",e).attr("aria-describedby",k.trim(i.join(" ")))},_removeDescribedBy:function(t){var e=t.data("ui-tooltip-id"),i=(t.attr("aria-describedby")||"").split(/\s+/),e=k.inArray(e,i);-1!==e&&i.splice(e,1),t.removeData("ui-tooltip-id"),(i=k.trim(i.join(" ")))?t.attr("aria-describedby",i):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=k("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=k([])},_setOption:function(t,e){var i=this;this._super(t,e),"content"===t&&k.each(this.tooltips,function(t,e){i._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var s=this;k.each(this.tooltips,function(t,e){var i=k.Event("blur");i.target=i.currentTarget=e.element[0],s.close(i,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var t=k(this);if(t.is("[title]"))return t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")}))},_enable:function(){this.disabledTitles.each(function(){var t=k(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))}),this.disabledTitles=k([])},open:function(t){var i=this,e=k(t?t.target:this.element).closest(this.options.items);e.length&&!e.data("ui-tooltip-id")&&(e.attr("title")&&e.data("ui-tooltip-title",e.attr("title")),e.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&e.parents().each(function(){var t,e=k(this);e.data("ui-tooltip-open")&&((t=k.Event("blur")).target=t.currentTarget=this,i.close(t,!0)),e.attr("title")&&(e.uniqueId(),i.parents[this.id]={element:this,title:e.attr("title")},e.attr("title",""))}),this._registerCloseHandlers(t,e),this._updateContent(e,t))},_updateContent:function(e,i){var t=this.options.content,s=this,n=i?i.type:null;if("string"==typeof t||t.nodeType||t.jquery)return this._open(i,e,t);(t=t.call(e[0],function(t){s._delay(function(){e.data("ui-tooltip-open")&&(i&&(i.type=n),this._open(i,e,t))})}))&&this._open(i,e,t)},_open:function(t,e,i){var s,n,o,a=k.extend({},this.options.position);function r(t){a.of=t,n.is(":hidden")||n.position(a)}i&&((s=this._find(e))?s.tooltip.find(".ui-tooltip-content").html(i):(e.is("[title]")&&(t&&"mouseover"===t.type?e.attr("title",""):e.removeAttr("title")),s=this._tooltip(e),n=s.tooltip,this._addDescribedBy(e,n.attr("id")),n.find(".ui-tooltip-content").html(i),this.liveRegion.children().hide(),(i=k("<div>").html(n.find(".ui-tooltip-content").html())).removeAttr("name").find("[name]").removeAttr("name"),i.removeAttr("id").find("[id]").removeAttr("id"),i.appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:r}),r(t)):n.position(k.extend({of:e},this.options.position)),n.hide(),this._show(n,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(o=this.delayedShow=setInterval(function(){n.is(":visible")&&(r(a.of),clearInterval(o))},k.fx.interval)),this._trigger("open",t,{tooltip:n})))},_registerCloseHandlers:function(t,e){var i={keyup:function(t){t.keyCode===k.ui.keyCode.ESCAPE&&((t=k.Event(t)).currentTarget=e[0],this.close(t,!0))}};e[0]!==this.element[0]&&(i.remove=function(){this._removeTooltip(this._find(e).tooltip)}),t&&"mouseover"!==t.type||(i.mouseleave="close"),t&&"focusin"!==t.type||(i.focusout="close"),this._on(!0,e,i)},close:function(t){var e,i=this,s=k(t?t.currentTarget:this.element),n=this._find(s);n?(e=n.tooltip,n.closing||(clearInterval(this.delayedShow),s.data("ui-tooltip-title")&&!s.attr("title")&&s.attr("title",s.data("ui-tooltip-title")),this._removeDescribedBy(s),n.hiding=!0,e.stop(!0),this._hide(e,this.options.hide,function(){i._removeTooltip(k(this))}),s.removeData("ui-tooltip-open"),this._off(s,"mouseleave focusout keyup"),s[0]!==this.element[0]&&this._off(s,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&k.each(this.parents,function(t,e){k(e.element).attr("title",e.title),delete i.parents[t]}),n.closing=!0,this._trigger("close",t,{tooltip:e}),n.hiding||(n.closing=!1))):s.removeData("ui-tooltip-open")},_tooltip:function(t){var e=k("<div>").attr("role","tooltip"),i=k("<div>").appendTo(e),s=e.uniqueId().attr("id");return this._addClass(i,"ui-tooltip-content"),this._addClass(e,"ui-tooltip","ui-widget ui-widget-content"),e.appendTo(this._appendTo(t)),this.tooltips[s]={element:t,tooltip:e}},_find:function(t){t=t.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){t=t.closest(".ui-front, dialog");return t.length||(t=this.document[0].body),t},_destroy:function(){var s=this;k.each(this.tooltips,function(t,e){var i=k.Event("blur"),e=e.element;i.target=i.currentTarget=e[0],s.close(i,!0),k("#"+t).remove(),e.data("ui-tooltip-title")&&(e.attr("title")||e.attr("title",e.data("ui-tooltip-title")),e.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),!1!==k.uiBackCompat&&k.widget("ui.tooltip",k.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}});k.ui.tooltip});!function(e,n){function t(e,n){return typeof e===n}function o(){var e,n,o,i,s,r,d;for(var l in f){if(e=[],n=f[l],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(o=0;o<n.options.aliases.length;o++)e.push(n.options.aliases[o].toLowerCase());for(i=t(n.fn,"function")?n.fn():n.fn,s=0;s<e.length;s++)r=e[s],d=r.split("."),1===d.length?Modernizr[d[0]]=i:(!Modernizr[d[0]]||Modernizr[d[0]]instanceof Boolean||(Modernizr[d[0]]=new Boolean(Modernizr[d[0]])),Modernizr[d[0]][d[1]]=i),a.push((i?"":"no-")+d.join("-"))}}function i(e){var n=l.className,t=Modernizr._config.classPrefix||"";if(Modernizr._config.enableJSClass){var o=new RegExp("(^|\\s)"+t+"no-js(\\s|$)");n=n.replace(o,"$1"+t+"js$2")}Modernizr._config.enableClasses&&(n+=" "+t+e.join(" "+t),l.className=n)}function s(){var e=n.body;return e||(e=c("body"),e.fake=!0),e}function r(e,n,t,o){var i,r,a,f,d="modernizr",u=c("div"),p=s();if(parseInt(t,10))for(;t--;)a=c("div"),a.id=o?o[t]:d+(t+1),u.appendChild(a);return i=["&#173;",'<style id="s',d,'">',e,"</style>"].join(""),u.id=d,(p.fake?p:u).innerHTML+=i,p.appendChild(u),p.fake&&(p.style.background="",p.style.overflow="hidden",f=l.style.overflow,l.style.overflow="hidden",l.appendChild(p)),r=n(u,e),p.fake?(p.parentNode.removeChild(p),l.style.overflow=f,l.offsetHeight):u.parentNode.removeChild(u),!!r}var a=[],f=[],d={_version:"3.0.0-alpha.3",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,n){var t=this;setTimeout(function(){n(t[e])},0)},addTest:function(e,n,t){f.push({name:e,fn:n,options:t})},addAsyncTest:function(e){f.push({name:null,fn:e})}},Modernizr=function(){};Modernizr.prototype=d,Modernizr=new Modernizr,Modernizr.addTest("cookies",function(){try{n.cookie="cookietest=1";var e=-1!=n.cookie.indexOf("cookietest=");return n.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(t){return!1}}),Modernizr.addTest("filereader",!!(e.File&&e.FileList&&e.FileReader));var l=n.documentElement,u=d._config.usePrefixes?" -webkit- -moz- -o- -ms- ".split(" "):[];d._prefixes=u;var c=function(){return"function"!=typeof n.createElement?n.createElement(arguments[0]):n.createElement.apply(n,arguments)};Modernizr.addTest("draganddrop",function(){var e=c("div");return"draggable"in e||"ondragstart"in e&&"ondrop"in e});var p=function(e){function t(n,t){var i;return n?(t&&"string"!=typeof t||(t=c(t||"div")),n="on"+n,i=n in t,!i&&o&&(t.setAttribute||(t=c("div")),t.setAttribute(n,""),i="function"==typeof t[n],t[n]!==e&&(t[n]=e),t.removeAttribute(n)),i):!1}var o=!("onblur"in n.documentElement);return t}(),v=(d.hasEvent=p,d.testStyles=r);Modernizr.addTest("touchevents",function(){var t;if("ontouchstart"in e||e.DocumentTouch&&n instanceof DocumentTouch)t=!0;else{var o=["@media (",u.join("touch-enabled),("),"heartz",")","{#modernizr{top:9px;position:absolute}}"].join("");v(o,function(e){t=9===e.offsetTop})}return t}),o(),i(a),delete d.addTest,delete d.addAsyncTest;for(var h=0;h<Modernizr._q.length;h++)Modernizr._q[h]();e.Modernizr=Modernizr}(window,document);!function(e){var t={};function a(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=t,a.d=function(e,t,i){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(i,n,function(t){return e[t]}.bind(null,n));return i},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=27)}({0:function(e,t){e.exports=jQuery},1:function(e,t,a){"use strict";a.d(t,"a",function(){return n});var i=a(2),n={embedded:"undefined"!=typeof TYGH_LOADER,doc:"undefined"!=typeof TYGH_LOADER?TYGH_LOADER.doc:document,body:"undefined"!=typeof TYGH_LOADER?TYGH_LOADER.body:null,otherjQ:"undefined"!=typeof TYGH_LOADER&&TYGH_LOADER.otherjQ,facebook:"undefined"!=typeof TYGH_FACEBOOK&&TYGH_FACEBOOK,container:"tygh_main_container",init_container:"tygh_container",area:"",security_hash:"",isTouch:!1,anchor:"undefined"!=typeof TYGH_LOADER?"":window.location.hash},o={};n.tr=function(e,t){var a=n.$;return"string"==typeof e&&void 0===t?(o[e]||console.error("'".concat(e,"' is not defined")),o[e]):void 0!==t?(o[e]=t,!0):"object"==Object(i.a)(e)&&(a.extend(o,e),!0)},n.lang=o,n.toNumeric=function(e){var t=Number(String(e).str_replace(",","."));return isNaN(t)?0:t},n.getFloatPrecision=function(e){return String(e).replace(".","").length-e.toFixed().length}},2:function(e,t,a){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e){return(n="function"==typeof Symbol&&"symbol"===i(Symbol.iterator)?function(e){return i(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":i(e)})(e)}a.d(t,"a",function(){return n})},27:function(e,t,a){"use strict";a.r(t);var i,n=a(0),o=a.n(n),r=a(2),s=function(e){l(c(e))},l=function(e,t){e=t?e:d(e),alert(e)},c=function e(t,a){var i="";a||(a=0);for(var n="",o=0;o<a+1;o++)n+="    ";if("object"==Object(r.a)(t))for(var s in t){var l=t[s];"object"==Object(r.a)(l)?(i+=n+"'"+s+"' ...\n",i+=e(l,a+1)):i+=n+"'"+s+"' => \""+l+'"\n'}else i=t+" ("+Object(r.a)(t)+")";return i},_=function(e){var t=Tygh.current_location+"/"+Tygh.index_script,a=o.a.parseUrl(e);if(""==e)e=t;else if(a.protocol){var i,n;if(Tygh.embedded)if(Tygh.facebook&&-1!=Tygh.facebook.url.indexOf(a.location)?i="&app_data=":Tygh.init_context==a.source.str_replace("#"+a.anchor,"")&&(i="#!"),i){var r="";-1!=(n=e.indexOf(i))&&(r=decodeURIComponent(e.substr(n+i.length)).replace("&amp;","&")),e=Tygh.current_location+r}}else a.file!=Tygh.index_script&&(e=0==e.indexOf("?")?t+e:t+"?dispatch="+e.replace("?","&"));return e},d=function(e){return e=String(e).replace(/<.*?>/g,"")},u=function(e){var t=e.parents("form"),a=t.parent(),i=t.find("input[type='submit']");if(i.length||(i=Tygh.$("[data-ca-target-form="+t.prop("name")+"]")),a.length&&i.length){var n,o=t.prop("action")+"?reload_form=1&"+i.prop("name"),r=t.serializeObject();n="undefined"!=r.result_ids?r.result_ids:a.prop("id"),Tygh.$.ceAjax("request",_(o),{data:r,result_ids:n})}},p=function(e){Tygh.$;var t=[Tygh.cart_language,Tygh.default_language,"en"],a="";if(e.length){a=e[0];for(var i=0;i<t.length;i++)if(-1!=Tygh.$.inArray(t[i],e)){a=t[i];break}}return a},f=function(e,t){if(void 0===t)return e;"string"==typeof t&&(t=[t]);var a=e;if(e.indexOf("?")>=0){a=e.substr(0,e.indexOf("?")+1);for(var i=e.substr(e.indexOf("?")+1).split("&"),n=[],o=!0,r="",s=0;s<i.length;s++){n=i[s].split("="),o=!0;for(var l=0;l<t.length;l++)if(t[l]==n[0]||-1!=n[0].indexOf(t[l]+"[")){o=!1;break}1==o&&(a+=r+n[0]+"="+n[1]),r="&"}}return a},h=function(e){var t=Tygh.$,a=t("#"+(e=e||"shipping_estimation")),i=t("input[type=radio]:checked",a),n=[];t.each(i,function(e,t){n.push({name:t.name,value:t.value})});var o=_("checkout.shipping_estimation.get_total");for(var r in n)o+="&"+n[r].name+"="+encodeURIComponent(n[r].value);var s=a.find('input[name="suffix"]').first().val(),l={additional_id:a.find('input[name="additional_id"]').first().val()};t.ceEvent("trigger","ce.calculate_total_shipping.before_send_request",[l,a]),t.ceAjax("request",o,{result_ids:"rate_extra_*,shipping_label_*,shipping_estimation_total"+s,data:l,method:"post"})},m=a(1),g=m.a,v=function(){var e=o()(this);"object"!==Object(r.a)(e.data("select2"))&&e.select2();var t=e.siblings(".select2-container").first("ul.select2-selection__rendered");t.sortable({placeholder:"ui-select2-sortable-placeholder",forcePlaceholderSize:!0,items:"li:not(.select2-search,.select2-drag--disabled)",tolerance:"pointer",stop:function(){o.a.each(t.find(".select2-selection__choice").get().reverse(),function(){var t=o()(this).data("optionId"),a=e.find('option[value="'+t+'"]').get();e.prepend(a)})}})},E=function(e){return 0==e||1==e?0==e?this.show():this.hide():this.toggle(),!0},b=function(e,t){t=t||{};if(o()("option"+(t.move_all?"":":selected")+":not(.cm-required)",this).appendTo(e),t.check_required){var a=[];o()("option.cm-required:selected",this).each(function(){a.push(o()(this).text())}),a.length&&fn_alert(t.message+"\n"+a.join(", "))}return this.change(),o()(e).change(),!0},y=function(e){return o()("option:selected",this).each(function(){"up"==e?o()(this).prev().insertAfter(this):o()(this).next().insertBefore(this)}),this.change(),!0},C=function(e){return o()("option",this).prop("selected",e),!0},D=function(){var e=o.a.getWindowSizes(),t=o()(this);t.css({display:"block",top:e.offset_y+(e.view_height-t.height())/2,left:e.offset_x+(e.view_width-t.width())/2})},j=function(e,t){var a=!1,i={$elems:o()(),getElems:function(e){var t=this;e.each(function(){t._pushToElems(o()(this).closest('[id^="content_"].hidden')),o()('[id^="content_"].hidden',this).each(function(){t._pushToElems(o()(this))})})},toggleHiddenAccessible:function(e){this.$elems.toggleClass("js-tmp-hidden-accessible",e).toggleClass("hidden",!e)},_pushToElems:function(e){e.length&&o()("li#"+e.attr("id").substring(8)).closest(".cm-j-tabs").length&&(this.$elems=this.$elems.add(e))}},n=":input:visible,.cm-wysiwyg,.cm-object-picker";if(o()(this).hasClass("cm-skip-check-items"))return!1;e&&(n=":input:enabled,.cm-wysiwyg,.cm-object-picker"),t&&(i.getElems(o()(this)),i.toggleHiddenAccessible(!0));var r=o()(n).filter(function(){return o()(this).is('[form]:not(button):not(input[type="button"]):not(input[type="submit"]):not(input[type="reset"])')&&o()(this).attr("form")!==o()(this).closest("form").attr("id")});return o()(n,this).add(r).each(function(){return a=o()(this).fieldIsChanged(),t&&i.toggleHiddenAccessible(!1),!a}),t&&i.toggleHiddenAccessible(!1),a},O=function(e){var t=!1,a=o()(this),i=a.get(0);if(void 0===e&&(e=!1),a.hasClass("cm-skip-check-item")||!e&&(a.hasClass("cm-item")||a.hasClass("cm-check-items")||a.hasClass("bulkedit-toggler")||a.hasClass("bulkedit-disabler")))return t;if(a.is("select")){var n=!1,r=[];o()("option",a).each(function(){this.defaultSelected&&(n=!0),this.selected!=this.defaultSelected&&r.push(this)}),(1==n&&r.length||1!=n&&(r.length&&"select-multiple"==a.prop("type")||"select-one"==a.prop("type")&&i.selectedIndex>0))&&(t=!0)}else if(a.is("input[type=radio], input[type=checkbox]"))i.checked!=i.defaultChecked&&(t=!0);else if(a.is("input,textarea")){var s,l=i.defaultValue;if(a.hasClass("cm-numeric"))s=parseFloat(a.autoNumeric("get")),l=parseFloat(l);else if(a.hasClass("cm-wysiwyg")){s=i.value;var c=o()(i).ceEditor("val");!1!==c&&(s=c)}else s=i.value;s!==l&&(t=!0)}return t},P=function(){"A"==g.area&&o()(this).each(function(){var e=o()(this),t=":not(.cm-no-hide-input):not(.cm-no-hide-input *)";o()("input[type=text]",e).filter(t).each(function(){var e=o()(this),t=e.hasClass("hidden")?" hidden":"",a="",i=e.data("caMetaClass")?" "+e.data("caMetaClass"):"";e.prev().hasClass("cm-field-prefix")&&(a+=e.prev().text(),e.prev().remove()),a+=e.val(),e.next().hasClass("cm-field-suffix")&&(a+=e.next().text(),e.next().remove()),e.wrap('<span class="shift-input'+t+i+'">'+a+"</span>"),e.remove()}),o()("label.cm-required",e).filter(t).each(function(){o()(this).removeClass("cm-required")}),o()("textarea",e).filter(t).each(function(){var e=o()(this);e.wrap('<div class="shift-input">'+e.val()+"</div>"),e.remove()}),o()("select:not([multiple]):not(.cm-object-picker)",e).filter(t).each(function(){var e=o()(this),t=e.hasClass("hidden")?" hidden":"";e.wrap('<span class="shift-input'+t+'">'+o()(":selected",e).text()+"</span>"),e.remove()}),o()("input[type=radio]",e).filter(t).each(function(){var e=o()(this),t=o()("label[for="+e.prop("id")+"]"),a=e.hasClass("hidden")?" hidden":"";e.prop("checked")?(t.wrap('<span class="shift-input'+a+'">'+t.text()+"</span>"),o()('<input type="radio" checked="checked" disabled="disabled">').insertAfter(e)):o()('<input type="radio" disabled="disabled">').insertAfter(e),e.prop("id")&&t.remove(),e.remove()}),o()(":input:not([type=submit])",e).filter(t).each(function(){o()(this).prop("disabled",!0)}),o()("a[id^='on_b']",e).remove(),o()("a[id^='off_b']",e).remove(),o()("a",e).filter(t).prop("onclick",""),o()("a[id^=opener_picker_], a[data-ca-external-click-id^=opener_picker_]",e).filter(t).each(function(){o()(this).remove()}),o()(".attach-images-alt",e).filter(t).remove(),o()("tbody[id^='box_add_']",e).filter(t).remove(),o()("tr[id^='box_add_']",e).filter(t).remove(),o()("[id$='_ajax_select_object']",e).filter(t).each(function(){var e=o()(this).prop("id").replace(/_ajax_select_object/,""),t=o()("#sw_"+e+"_wrap_"),a=t.closest(".dropdown-toggle").parent();a.wrap('<span class="shift-input">'+t.html()+"</span>"),a.remove(),o()(this).remove()}),o()("a.cm-delete-row",e).filter(t).each(function(){o()(this).remove()}),o()("button.cm-delete-row",e).filter(t).each(function(){o()(this).remove()}),o()(e).removeClass("cm-sortable"),o()(".cm-sortable-row",e).filter(t).removeClass("cm-sortable-row"),o()("p.description",e).filter(t).remove(),o()("a.cm-delete-image-link",e).filter(t).remove(),o()(".action-add",e).filter(t).remove(),o()(".cm-hide-with-inputs",e).filter(t).remove()})},w=function(e){return e?this.on("click",e):(o()(this).each(function(){if(document.createEventObject)o()(this).trigger("click");else{var e=document.createEvent("MouseEvents");e.initEvent("click",!0,!0),this.dispatchEvent(e)}}),this)},M=function(e,t){if(1!=t&&0!=t&&(t=!0),0==e||1==e){o()(":input:not(.cm-skip-avail-switch)",this).prop("disabled",e).toggleClass("disabled",e);var a=o()(".cm-fileuploader:not(.cm-skip-avail-switch)",this);a.prop("hidden",e),o()(a).find(".cm-fileuploader-field").prop("disabled",e),t&&this.toggle(!e)}else o()(":input:not(.cm-skip-avail-switch)",this).each(function(){var e=o()(this),t=e.prop("disabled");e.prop("disabled",!t),e[t?"removeClass":"addClass"]("disabled")}),o()(".cm-fileuploader:not(.cm-skip-avail-switch)",this).each(function(){var e=o()(this),t=e.prop("hidden");e.prop("hidden",!t),e.find(".cm-fileuploader-field").prop("disabled",!t)}),t&&this.toggle()},k=function(){var e={},t=this.serializeArray();o.a.each(t,function(){void 0!==e[this.name]&&this.name.indexOf("[]")>0?(e[this.name].push||(e[this.name]=[e[this.name]]),e[this.name].push(this.value||"")):e[this.name]=this.value||""});var a=this.find(".cm-j-tabs .active");return void 0!==a&&a.length>0&&(e.active_tab=a.prop("id")),e},A=function(e){var t=o()(this);t.css("position","absolute");var a=t.is(":hidden");a&&t.show(),t.position(e),a&&t.hide()},x=a(8),T=(m.a,{in_out_callback:function(e,t,a,i,n){if(e.allow_in_out_callback)if("next"==e.options.autoDirection)e.add(a+e.options.item_count,o()(t).html()),e.remove(a);else{var r=o()("li:last",e.list);e.add(r.data("caJcarouselindex")-e.options.item_count,r.html()),e.remove(r.data("caJcarouselindex"))}},next_callback:function(e,t,a,i,n){"next"==i&&(e.add(a+e.options.item_count,o()(t).html()),e.remove(a))},prev_callback:function(e,t,a,i,n){if("prev"==i){var r=o()("li:last",e.list),s=(t=r.html(),r.data("caJcarouselindex")-e.options.item_count);e.remove(r.data("caJcarouselindex")),e.add(s,t)}},init_callback:function(e,t){if("prev"==e.options.autoDirection){var a=e.buttonNext;e.buttonNext=e.buttonPrev,e.buttonPrev=a}o()(".jcarousel-clip",e.container).height(e.options.clip_height+"px"),o()(".jcarousel-clip",e.container).width(e.options.clip_width+"px");var i=e.options.clip_width;if(e.container.width(i),i>e.container.width()){var n=e.pos(e.options.start,!0);e.animate(n,!1)}e.clip.hover(function(){e.stopAuto()},function(){e.startAuto()}),(!o.a.browser.msie||o.a.browser.version>8)&&o()(window).on("beforeunload",function(){e.allow_in_out_callback=!1}),o.a.browser.chrome&&o.a.jcarousel.windowLoaded()}}),I=m.a,B={open:function(e){e=e||{};var t={is_opening_allowed:!0};if(o.a.ceEvent("trigger","ce.dialog.before_open",[t,e]),!t.is_opening_allowed)return!1;var a=o()(this);if(!a.length)return!1;if(a.attr("tabindex",-1).focus(),o()("html").addClass("dialog-is-open"),a.hasClass("ui-dialog-content")){if(e.view_id&&a.data("caViewId")!=e.view_id&&a.ceDialog("_load_content",e))return!1;a.dialog("isOpen")&&(a.height("auto"),a.parent().height("auto"),B._resize(o()(this)))}else{if(a.ceDialog("_load_content",e))return!1;a.ceDialog("_init",e)}o.a.browser.msie&&"auto"==e.width&&(e.width=a.dialog("option","width")),0==o()(".object-container",a).length&&(a.wrapInner('<div class="object-container '+(e.containerClass?e.containerClass:"")+'" />'),a.find(".object-container").prepend('<div class="cm-notification-container-dialog notification-container-dialog"/>')),e&&a.dialog("option",e),o.a.popupStack.add({name:a.prop("id"),close:function(){try{a.dialog("close")}catch(e){}}}),1==I.isTouch&&(o.a.ui.dialog.prototype._focusTabbable=function(){});var i=a.dialog("open");return e.scroll&&o.a.scrollToElm(e.scroll,a),i},_is_empty:function(){var e=o()(this).html().trim();return e&&(e=e.replace(/<!--(.*?)-->/g,"")),!e.trim()},_load_content:function(e){var t=o()(this),a={};if(e.href=e.href||"",e.href&&(t.ceDialog("_is_empty")||e.view_id&&t.data("caViewId")!=e.view_id)){if(e.view_id&&t.data("caViewId",e.view_id),e.contentRequestForm){var i=o()("#"+e.contentRequestForm);i.length&&(a=i.serializeObject())}return e.actionContext&&(a._action_context=e.actionContext),o.a.ceAjax("request",e.href,{full_render:0,result_ids:t.prop("id"),skip_result_ids_check:!0,keep_status_box:!0,data:a,callback:function(){if(t.ceDialog("_is_empty")){o.a.toggleStatusBox("hide"),0==o.a.ceDialog("get_last").length&&o()("html").removeClass("dialog-is-open")}else{var a=t.find("img");a.length?a.each(function(i){var n=new Image;n.src=this.src,n.onload=function(){++i==a.length&&(o.a.toggleStatusBox("hide"),t.ceDialog("open",e))}}):(o.a.toggleStatusBox("hide"),t.ceDialog("open",e))}}}),!0}return!1},close:function(){var e=o()(this);e.data("close",!0),e.dialog("close"),o.a.popupStack.remove(e.prop("id"))},reload:function(){var e=o()(this);if(o()("img",e).length>0&&!1===e.dialog("option","destroyOnClose")){var t=o.a.debounce(B._resize_and_center,50);o()("img",e).on("load",function(){t(e)})}else B._resize_and_center(e)},_resize_and_center:function(e){e.ceDialog("resize"),e.dialog("option","position",e.dialog("option","position"))},resize:function(){var e=this,t=e.find(".object-container"),a=B._get_buttons(e);B.reset_default_height(t,e,a),B._resize(o()(this))},change_title:function(e){o()(this).dialog("option","title",e)},destroy:function(){var e=o()(this).prop("id"),t=q.indexOf(e);o.a.popupStack.remove(e),-1!=t&&q.splice(t,1);try{o()(this).dialog("destroy")}catch(e){}},_get_buttons:function(e){var t=e.find(".buttons-container"),a=null;if(t.length){var i=e.find(".cm-dialog-opener");i.length?t.each(function(){var e=!1,t=o()(this);return i.each(function(){var a=o()(this).data("caTargetId");return!t.parents("#"+a).length||(e=!0,!1)}),e||(a=t),!0}):a=e.find(".buttons-container:last")}return a},_init:function(e){e=e||{};var t=o()(this),a=80,i=e.dialogClass||"";o.a.matchScreenSize(["xs","xs-large","sm"])&&(a=0);var n=o.a.getWindowSizes(),s=t.parent();"auto"!==e.height&&"A"==I.area&&(e.height=n.view_height-a),t.find("form").length||t.parents(".object-container").length||t.data("caKeepInPlace")||(e.keepInPlace=!0),o.a.ui.dialog.overlayInstances||(o.a.ui.dialog.overlayInstances=1),t.find("script[src]").remove(),o.a.browser.msie&&"auto"==e.width&&(o.a.browser.version<8&&t.appendTo(I.body),e.width=t.outerWidth()+10),o.a.matchScreenSize(["xs","xs-large","sm"])&&(e.height=n.height),t.dialog({title:e.title||null,autoOpen:!1,draggable:!1,modal:!0,width:e.width||(n.view_width>926?926:n.view_width-120),height:e.height,maxWidth:926,resizable:!1,closeOnEscape:!1,dialogClass:i,destroyOnClose:e.destroyOnClose||!1,closeText:I.tr("close"),appendTo:e.keepInPlace?s:I.body,show:150,hide:150,open:function(t,a){var i=o()(this),n=i.dialog("widget");if(n.find(".ui-dialog-titlebar-close").attr({"data-dismiss":"modal",type:"button"}),Object(r.a)(e.titleFirstChunk)==Object(r.a)("string")&&Object(r.a)(e.titleSecondChunk)==Object(r.a)("string")&&Object(r.a)(e.titleTemplate)==Object(r.a)("string")){var s=o.a.sprintf(e.titleTemplate,[e.titleFirstChunk,e.titleSecondChunk]);n.find(".ui-dialog-title").html(s)}var l=1099;if(q.length){var c=q.pop(),_=o()("#"+c).parent(".ui-front");q.push(c),l=_.css("z-index")?_.css("z-index"):0}n.css("z-index",++l),n.prev().css("z-index",l);var d=i.prop("id");q.push(d),e.keepInPlace||-1==R.indexOf(d)&&R.push(d),B._resize(i),o()("html").addClass("dialog-is-open"),o.a.ceEvent("trigger","ce.dialogshow",[i,t,a]),o()("textarea.cm-wysiwyg",i).ceEditor("destroy"),o()("textarea.cm-wysiwyg",i).ceEditor("recover"),e.switch_avail&&i.switchAvailability(!1,!1)},beforeClose:function(t,a){var i=o()(this),n=i.find(".object-container"),r=e.nonClosable||!1,s=B._get_buttons(i);B.reset_default_height(n,i,s);var l=o()("textarea.cm-wysiwyg",i);if(l.length&&l.each(function(){o()(this).ceEditor("destroy")}),r&&!i.data("close"))return!1;q.pop(),e.switch_avail&&i.switchAvailability(!0,!1),o.a.ceEvent("trigger","ce.dialogbeforeclose",[i,t,a])},close:function(t,a){o()(this).dialog("option","destroyNestedOnClose")&&o()(".cm-dialog-opener",this).each(function(){var e=o()("#"+o()(this).data("caTargetId"));e.length&&e.data("uiDialog")&&e.dialog("destroy").remove()}),o()(this).dialog("option","destroyOnClose")&&o()(this).dialog("destroy").remove(),setTimeout(function(){0==o()(".ui-widget-overlay").length&&o()("html").removeClass("dialog-is-open"),e.onClose&&e.onClose()},50),o.a.ceEvent("trigger","ce.dialogclose",[o()(this),t,a])}})},_resize:function(e){var t=B._get_buttons(e),a=e.find(".cm-picker-options-container"),i=e.find(".object-container"),n=o.a.getWindowSizes().view_height,r=0,s=0,l=0,c=e.parent().outerHeight(!0),_=e.parent().find(".ui-dialog-titlebar").outerHeight();t&&(t.addClass("buttons-container-picker"),r=t.outerHeight(!0)),a.length&&(s=a.outerHeight(!0)),c>n&&e.parent().outerHeight(n),l=e.parent().outerHeight()-_,"C"==I.area?(t&&(c>=n?(l-=r,t.css({position:"absolute",bottom:-r})):t.css({position:"absolute",bottom:0}),i.outerHeight(l)),c>n&&i.outerHeight(l)):(t&&"A"==I.area&&(l-=r,t.css({position:"absolute",bottom:0,left:0,right:0})),o.a.matchScreenSize(["xs","xs-large","sm"])&&(l=e.parent().outerHeight()-_),i.outerHeight(l)),s&&(a.positionElm({my:"left top",at:"left bottom",of:i,collision:"none"}),a.css("width",i.outerWidth()))},reset_default_height:function(e,t,a){e.height("inherit"),t.parent().height("auto"),a&&a.css({position:"static"})}},q=[],R=[],S=m.a,L={init:function(e){(e=e||{}).heightStyle=e.heightStyle||"content",e.animate=e.animate||o()(S.body).data("caAccordionAnimateDelay")||300,o()(this).accordion(e)},reinit:function(e){o()(this).accordion(e)}},U=(m.a,{}),W="not-loaded",K=[],F={run:function(e){if(!this.length)return!1;"loading"==o.a.ceEditor("state")?o.a.ceEditor("push",this):o.a.ceEditor("run",this,e)},destroy:function(){if(!this.length||"loaded"!=o.a.ceEditor("state"))return!1;o.a.ceEditor("destroy",this)},recover:function(){if(!this.length||"loaded"!=o.a.ceEditor("state"))return!1;o.a.ceEditor("recover",this)},val:function(e){return!!this.length&&o.a.ceEditor("val",this,e)},disable:function(e){if(!this.length||"loaded"!=o.a.ceEditor("state"))return!1;o.a.ceEditor("disable",this,e)},change:function(e){var t=this.data("ceeditor_onchange")||[];t.push(e),this.data("ceeditor_onchange",t)},changed:function(e){for(var t=this.data("ceeditor_onchange")||[],a=0;a<t.length;a++)t[a](e)},insert:function(e){return!!this.length&&o.a.ceEditor("insert",this,e)}},z=(m.a,{display:function(){o.a.cePreviewer("display",this)}}),N=(m.a,function(e){var t=o()(e);if(0==t.length)return!1;var a=t.prop("href").split("#")[1];return o()("#"+a)}),H={init:function(){var e=N(this);if(0==e)return!1;e.find(".bar").css("width",0).prop("data-percentage",0),this.trigger("click"),this.data("ceProgressbar",!0),o.a.ceEvent("trigger","ce.progress_init")},setValue:function(e){var t=N(this);if(0==t)return!1;this.data("ceProgressbar")||this.ceProgress("init"),e.progress&&t.find(".bar").css("width",e.progress+"%").prop("data-percentage",e.progress),e.text&&t.find(".modal-body p").html(e.text),o.a.ceEvent("trigger","ce.progress",[e])},getValue:function(e){var t=N(this);return 0!=t&&(this.data("ceProgressbar")?parseInt(t.find(".bar").prop("data-percentage")):0)},setTitle:function(e){if(0==N(this))return!1;this.data("ceProgressbar")||this.ceProgress("init"),e.title&&o()("#comet_title").text(e.title)},finish:function(){var e=N(this);if(0==e)return!1;e.find(".bar").css("width",100).prop("data-percentage",100),e.modal("hide"),this.removeData("ceProgressbar"),o.a.ceEvent("trigger","ce.progress_finish")}},V=m.a,G={init:function(){return!!o.a.history&&(o.a.history.init(function(e,t){if(t&&"result_ids"in t){var a=G.parseHash("#"+e),i=-1!=a.indexOf(V.current_location)?a:V.current_location+"/"+a,n=t.result_ids,r=o()('a[data-ca-target-id="'+n+'"]:first'),s=r.prop("name");o.a.ceAjax("request",i,{full_render:t.full_render,result_ids:n,caching:!1,obj:r,skip_history:!0,callback:"ce.ajax_callback_"+s})}else if(V.embedded){var l=fn_url(window.location.href);l!=V.current_url&&o.a.redirect(l)}},{unescape:!1}),!0)},load:function(e,t){var a,i;e=G.prepareHash(e),i=G.prepareHash(V.current_url),a={result_ids:t.result_ids,full_render:t.full_render},o.a.ceEvent("trigger","ce.history_load",[e]),o.a.history.reload(i,a),o.a.history.load(e,a)},prepareHash:function(e){try{e=decodeURI(e)}finally{return-1!==e.indexOf("://")&&(e=e.str_replace(V.current_location+"/","")),e="!/"+(e=fn_query_remove(e,["result_ids"]))}},parseHash:function(e){return-1!==e.indexOf("%")&&(e=decodeURI(e)),-1!=e.indexOf("#!")&&e.split("#!/")[1]||""}},Y=(m.a,{init:function(){return this.each(function(){var e=o()(this);e.bind({click:function(){o()(this).ceHint("_check_hint")},focus:function(){o()(this).ceHint("_check_hint")},focusin:function(){o()(this).ceHint("_check_hint")},blur:function(){o()(this).ceHint("_check_hint_focused")},focusout:function(){o()(this).ceHint("_check_hint_focused")}}),e.addClass("cm-hint-focused"),e.removeClass("cm-hint"),e.ceHint("_check_hint_focused")})},is_hint:function(){return o()(this).hasClass("cm-hint")&&o()(this).val()==o()(this).ceHint("_get_hint_value")},_check_hint:function(){var e=o()(this);e.ceHint("is_hint")&&(e.addClass("cm-hint-focused"),e.val(""),e.removeClass("cm-hint"),e.prop("name",e.prop("name").str_replace("hint_","")))},_check_hint_focused:function(){var e=o()(this);e.hasClass("cm-hint-focused")&&(""!=e.val()&&e.val()!=e.ceHint("_get_hint_value")||(e.addClass("cm-hint"),e.removeClass("cm-hint-focused"),e.val(e.ceHint("_get_hint_value")),e.prop("name","hint_"+e.prop("name"))))},_get_hint_value:function(){return""!=o()(this).prop("title")?o()(this).prop("title"):o()(this).prop("defaultValue")}}),J=m.a,Z={init:function(e){var t={events:{def:"mouseover, mouseout",input:"focus, blur"},layout:'<div><span class="tooltip-arrow"></span></div>',use_dynamic_plugin:!0};return o.a.extend(t,e),this.each(function(){var e=o()(this),a=t;if(e.data("tooltip"))return!1;"top"===e.data("ceTooltipPosition")?(a.position="top left",a.tipClass="tooltip arrow-top",a.offset=[-10,7],"rtl"==J.language_direction&&(a.offset=[-10,-7],a.position="top right")):"center"===e.data("ceTooltipPosition")?(a.offset=[10,7],a.tipClass="tooltip arrow-down center",a.position="bottom center","rtl"==J.language_direction&&(a.offset=[10,-7],a.position="bottom center")):"centerRight"===e.data("ceTooltipPosition")?(a.offset=[0,7],a.tipClass="tooltip arrow-right center",a.position="center right","rtl"==J.language_direction&&(a.offset=[0,7],a.position="center right")):"centerLeft"===e.data("ceTooltipPosition")?(a.offset=[0,-7],a.tipClass="tooltip arrow-left center",a.position="center left","rtl"==J.language_direction&&(a.offset=[0,-7],a.position="center left")):(a.offset=[10,7],a.tipClass="tooltip arrow-down",a.position="bottom left","rtl"==J.language_direction&&(a.offset=[10,-7],a.position="bottom right")),"undefined"!==e.data("ceTooltipClass")&&(a.tipClass+=" "+e.data("ceTooltipClass")),e.data("caTooltipLayoutSelector")&&(a.layout=o()(e.data("caTooltipLayoutSelector")).html()),e.data("ceTooltipEventsTooltip")&&(a.events.tooltip=e.data("ceTooltipEventsTooltip")),e.tooltip(a),a.use_dynamic_plugin&&"function"==typeof e.dynamic&&e.dynamic({right:{},left:{}}),e.get(0).addEventListener("DOMNodeRemovedFromDocument",function(e){o()(e.target).trigger("mouseout")},!1),e.on("remove",function(){o()(this).trigger("mouseout")})})},show:function(){return this.each(function(){var e=o()(this);if(!e.data("tooltip"))return!1;e.data("tooltip").show()})},hide:function(){return this.each(function(){var e=o()(this);if(!e.data("tooltip"))return!1;e.data("tooltip").hide()})}},Q=m.a,X={init:function(e){return this.each(function(){var e=Q.tr("text_position_updating"),t=o()(this),a=t.data("caSortableTable"),i=t.data("caSortableIdName"),n={accept:"cm-sortable-row",items:".cm-row-item",tolerance:"pointer",axis:"y",containment:"parent",opacity:"0.9",update:function(t,n){var r=[],s=[],l=o()(n.item).closest(".cm-sortable");o()(".cm-row-item",l).each(function(){var e=o()(this).prop("class").match(/cm-sortable-id-([^\s]+)/i),t=o()(this).index();r[t]=t,s[t]=e[1]});var c={positions:r.join(","),ids:s.join(",")};return o.a.ceAjax("request",fn_url("tools.update_position?table="+a+"&id_name="+i),{method:"get",caching:!1,message:e,data:c}),!0}};o()(".cm-sortable-handle",t).length&&(n=o.a.extend(n,{opacity:"0.5",handle:".cm-sortable-handle"})),t.sortable(n)})}},ee=(m.a,{init:function(e){if(!o()(this).length)return!1;if(!o.a.fn.spectrum){var t=o()(this);return o.a.loadCss(["js/lib/spectrum/spectrum.css"],!1,!0),o.a.getScript("js/lib/spectrum/spectrum.js",function(){t.ceColorpicker()}),!1}var a=[["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#efefef","#f3f3f3","#ffffff"],["#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#0000ff","#9900ff","#ff00ff"],["#e6b8af","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#c9daf8","#cfe2f3","#d9d2e9","#ead1dc"],["#dd7e6b","#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#a4c2f4","#9fc5e8","#b4a7d6","#d5a6bd"],["#cc4125","#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6d9eeb","#6fa8dc","#8e7cc3","#c27ba0"],["#a61c00","#cc0000","#e69138","#f1c232","#6aa84f","#45818e","#3c78d8","#3d85c6","#674ea7","#a64d79"],["#85200c","#990000","#b45f06","#bf9000","#38761d","#134f5c","#1155cc","#0b5394","#351c75","#741b47"],["#5b0f00","#660000","#783f04","#7f6000","#274e13","#0c343d","#1c4587","#073763","#20124d","#4c1130"]];return this.each(function(){var e=o()(this),t={showInput:!e.data("caSpectrumShowInput")||e.data("caSpectrumShowInput"),showInitial:!!e.data("caSpectrumShowInitial")&&e.data("caSpectrumShowInitial"),showPalette:!!e.data("caSpectrumShowPalette")&&e.data("caSpectrumShowPalette"),showAlpha:!!e.data("caSpectrumShowAlpha")&&e.data("caSpectrumShowAlpha"),showSelectionPalette:!!e.data("caSpectrumShowSelectionPalette")&&e.data("caSpectrumShowSelectionPalette"),palette:e.data("caSpectrumPalette")?JSON.parse(e.data("caSpectrumPalette")):a,preferredFormat:e.data("caSpectrumPreferredFormat")?e.data("caSpectrumPreferredFormat"):"hex6",beforeShow:function(){e.spectrum("option","showPalette",!0),e.spectrum("option","showInitial",!0),e.spectrum("option","showSelectionPalette",!0)},hide:function(){o.a.ceEvent("trigger","ce.colorpicker.hide")},show:function(){o.a.ceEvent("trigger","ce.colorpicker.show")}};e.data("caView")&&"palette"==e.data("caView")&&(t.showPaletteOnly=!0),e.data("caStorage")&&(t.localStorageKey=e.data("caStorage")),e.spectrum(t),e.spectrum("container").appendTo(e.parent())})},destroy:function(){o.a.fn.spectrum&&this.spectrum("destroy")},reset:function(){o.a.fn.spectrum&&this.spectrum("set",this.val())},set:function(e){o.a.fn.spectrum&&this.spectrum("set",e)}}),te=m.a,ae={init:function(){ae.setMoreVisibility($(this)),ae.bindEvents()},showFullText:function(e){ae._getElement("contentMoreBtnWrapper",e).addClass("hidden"),ae._getElement("contentMoreText",e).addClass("cs-content-more__text--full")},setMoreVisibility:function(e){ae._getElement("contentMoreText",e).each(function(){var e=$(this);ae._getElement("contentMoreBtnWrapper",e).toggleClass("hidden",Math.round(e.height())>=e[0].scrollHeight)})},_getElement:function(e,t){return t.closest('[data-ca-elem="contentMore"]').find('[data-ca-elem="'.concat(e,'"]'))},bindEvents:function(){$(te.doc).on("click",'[data-ca-elem="contentMoreBtn"]',function(){ae.showFullText($(this))})}},ie=m.a,ne={},oe={},re=[],se={};function le(e,t){var a,i,n,r,s={};i=t?o()(t,e).find("label"):o()("label",e),e.hasClass("cm-outside-inputs")&&o.a.each(e.get(0).elements,function(e,t){t.labels&&t.labels.length&&t.labels.forEach(function(e){i=i.add(o()(e))})});for(var l=0;l<i.length;l++)(n=(a=o()(i[l])).prop("for"))&&a.prop("class")&&n.match(/^([a-z0-9-_]+)$/i)&&!a.parents(".cm-skip-validation").length&&((r=o()("#"+n)).prop("form")&&r.prop("form")!==e.get(0)||r.length&&!r.prop("disabled")&&(s[n]={elm:r,lbl:a}));return s}function ce(e,t,a,i){var n,r,s,l,c,_,d=!1;for(var u in a=a||!1,i=i||!a,o()(".cm-failed-field",e).removeClass("cm-failed-field"),se={},t){if(n=!1,r=t[u].elm,(s=t[u].lbl).hasClass("cm-trim")&&!a&&r.val(o.a.trim(r.val())),s.hasClass("cm-email")&&(o.a.is.email(r.val())||o.a.is.blank(r.val())||(de(ie.tr("error_validator_email"),s),n=!0)),s.hasClass("cm-color")&&0==o.a.is.color(r.val())&&(s.hasClass("cm-required")||0==o.a.is.blank(r.val()))&&(de(ie.tr("error_validator_color"),s),n=!0),s.hasClass("cm-phone")&&1!=o.a.is.phone(r.val())&&(s.hasClass("cm-required")||0==o.a.is.blank(r.val()))&&(de(ie.tr("error_validator_phone"),s),n=!0),s.hasClass("cm-zipcode")){var p=s.prop("class").match(/cm-location-([^\s]+)/i)[1]||"",f=o()(".cm-country"+(p?".cm-location-"+p:""),e).val(),h=r.val();ne[f]&&!r.val().match(ne[f].regexp)&&(s.hasClass("cm-required")||0==o.a.is.blank(r.val()))&&(de(ie.tr("error_validator_zipcode"),s,null,ne[f].format),n=!0)}if(s.hasClass("cm-integer")&&0==o.a.is.integer(r.val())&&(s.hasClass("cm-required")||0==o.a.is.blank(r.val()))&&(de(ie.tr("error_validator_integer"),s),n=!0),s.hasClass("cm-multiple")&&0==r.prop("length")&&(de(ie.tr("error_validator_multiple"),s),n=!0),s.hasClass("cm-password")){var m=o()("label.cm-password",e).not(s),g=o()("#"+m.prop("for"));r.val()&&r.val()!=g.val()&&(de(ie.tr("error_validator_password"),s,m),n=!0)}if(re)for(var v=0;v<re.length;v++)s.hasClass(re[v].class_name)&&1!=(E=re[v].func(u,r,s))&&(de(re[v].message,s),n=!0);if(s.hasClass("cm-regexp")&&(c=null,_=null,u in oe?(c=oe[u].regexp,_=oe[u].message?oe[u].message:ie.tr("error_validator_message")):s.data("caRegexp")&&(c=s.data("caRegexp"),_=s.data("caMessage")),c&&!r.ceHint("is_hint")&&(""!==r.val()||!s.hasClass("cm-required")&&!s.data("caRegexpAllowEmpty")))){h=r.val();var E=new RegExp(c).test(h);E||(de(_,s),n=!0)}if((s.hasClass("cm-multiple-checkboxes")||s.hasClass("cm-multiple-radios"))&&s.hasClass("cm-required")){var b=s.hasClass("cm-multiple-checkboxes")?"[type=checkbox]":"[type=radio]";if(o()(b+":not(:disabled)",r).length&&!o()(b+":checked",r).length)de(s.data("caValidatorErrorMessage")||ie.tr("error_validator_required"),s),n=!0}if(s.hasClass("cm-all"))0==r.prop("length")&&s.hasClass("cm-required")?(de(ie.tr("error_validator_multiple"),s),n=!0):o()("option",r).prop("selected",!0);else if(r.is(":input"))if(s.hasClass("cm-required")&&(r.is("[type=checkbox]")&&!r.prop("checked")||1==o.a.is.blank(r.val())||r.ceHint("is_hint")))de(s.data("caValidatorErrorMessage")||ie.tr("error_validator_required"),s),n=!0;if(s.hasClass("cm-required")&&r.is(":disabled"))de(s.data("caValidatorErrorMessage")||ie.tr("error_validator_required"),s),n=!0;if((l=r.closest(".cm-field-container")).length&&(r=l),i)if(o()('[id="'+u+'_error_message"].help-inline',r.parent()).remove(),1==n){s.parent().addClass("error"),r.addClass("cm-failed-field"),s.addClass("cm-failed-label");var y=r.data(),C=y.caErrorMessageTargetNode,D=y.caErrorMessageTargetNodeOnScreen,j=y.caErrorMessageTargetNodeAfterMode,O=y.caErrorMessageTargetNodeChangeOnScreen,P=y.caErrorMessageTargetMethod,w=!1,M=o()(r),k="after";if(O&&Object(x.matchScreenSize)(O.split(","))&&(M=o()(D),w=!0),C&&!w&&(M=o()(C),j||(k="html")),P&&(k=P),!r.hasClass("cm-no-failed-msg")){var A='<span id="'.concat(u,'_error_message" class="help-inline">').concat(pe(u),"</span>");M[k](A)}d||(M.data("caNoScroll")||o.a.scrollToElm(M),d=!0);var T=o.a.ceDialog("get_last");if(o()('.cm-dialog-auto-size[data-ca-target-id="'+T.attr("id")+'"]').length&&T.ceDialog("reload"),o.a.fn.ceSidebar){var I=r.closest(".cm-sidebar");I.length&&I.ceSidebar("open")}}else s.parent().removeClass("error"),r.removeClass("cm-failed-field"),s.removeClass("cm-failed-label");else n&&(d=!0)}return!d}function _e(e,t){var a,n=!0,r=!0,s=!1;if((t=t||{}).only_check=t.only_check||!1,t.show_validation_errors=t.show_validation_errors||!t.only_check,i||(o()("[type=submit]",e).length?i=o()("[type=submit]:first",e):o()("input[type=image]",e).length&&(i=o()("input[type=image]:first",e))),!i.hasClass("cm-skip-validation")){var l=le(e,t.check_filter||i.data("caCheckFilter"));!1===o.a.ceEvent("trigger","ce.formpre_"+e.prop("name"),[e,i])&&(n=!1),r=ce(e,l,t.only_check,t.show_validation_errors)}if(t.only_check)return r&&n;if(r&&n){if(function(e){var t=[];(e.hasClass("cm-disable-empty")||e.hasClass("cm-disable-empty-all"))&&t.push("input[type=text]"),e.hasClass("cm-disable-empty-all")&&(t.push("input[type=hidden]"),t.push("input[type=radio]")),e.hasClass("cm-disable-empty-files")&&(t.push("input[type=file]"),o()('input[type=file][data-ca-empty-file=""]',e).prop("disabled",!0)),t.length&&o()(t.join(","),e).each(function(){var e=o()(this);""==e.val()&&(e.prop("disabled",!0),e.addClass("cm-disabled"))})}(e),e.find(".cm-numeric").each(function(){var e=o()(this).autoNumeric("get");o()(this).prop("value",e)}),1==(a=i.data("original_element")?i.data("original_element"):i).data("clicked")&&!e.data("caIsMultipleSubmitAllowed"))return!1;if(a.data("clicked",!0),!e.hasClass("cm-ajax")&&!i.hasClass("cm-ajax")||i.hasClass("cm-no-ajax")||o.a.ceEvent("one","ce.ajaxdone",function(){a.data("clicked",!1)}),i.hasClass("cm-comet")&&o.a.ceEvent("one","ce.cometdone",function(){a.data("clicked",!1)}),i.hasClass("cm-new-window"))return e.prop("target","_blank"),setTimeout(function(){a.data("clicked",!1)},1e3),!0;if(i.hasClass("cm-parent-window"))return e.prop("target","_parent"),!0;if(e.prop("target","_self"),!1===o.a.ceEvent("trigger","ce.formpost_"+e.prop("name"),[e,i])&&(n=!1),i.closest(".cm-dialog-closer").length&&setTimeout(function(){o.a.ceDialog("get_last").ceDialog("close")},100),n&&(e.hasClass("cm-ajax")||i.hasClass("cm-ajax"))&&!i.hasClass("cm-no-ajax")){var c=e.add(i);(c.hasClass("cm-form-dialog-closer")||c.hasClass("cm-form-dialog-opener"))&&o.a.ceEvent("one","ce.formajaxpost_"+e.prop("name"),function(t,a){if(t.failed_request)return!1;if(c.hasClass("cm-form-dialog-closer")&&("C"==ie.area?o.a.ceDialog("get_last").ceDialog("close"):"A"==ie.area&&o.a.popupStack.last_close()),c.hasClass("cm-form-dialog-opener")){var i=e.find("input[name=result_ids]").val();i&&void 0!==t.html&&o()("#"+i).ceDialog("open",o.a.ceDialog("get_params",e))}}),e.find(".cm-wysiwyg").each(function(){o.a.ceEditor("updateTextFields",o()(this))}),s=o.a.ceAjax("submitForm",e,i);var _=c.find(".cm-dialog-opener");return _.length&&_.each(function(){if(o()(this).attr("href")){var e="#"+o()(this).data("caTargetId");o()(e).ceDialog("destroy"),o()(e).find(".object-container").remove(),o.a.popupStack.remove(e)}}),s}return i.hasClass("cm-no-ajax")&&o()("input[name=is_ajax]",e).remove(),ie.embedded&&1==n&&!o.a.externalLink(e.prop("action"))?(e.append('<input type="hidden" name="result_ids" value="'+ie.container+'" />'),i.data("caScroll",ie.container),o.a.ceAjax("submitForm",e,i)):(!1===o.a.ceEvent("trigger","ce.form.beforeSubmit",[e,i,n])&&(n=!1),0==n&&a.data("clicked",!1),n)}if(0==r){var d=o()(".cm-failed-field",e).parents('[id^="content_"]:hidden');d.length&&o()(".cm-failed-field",e).length==o()(".cm-failed-field",d).length&&d.closest('[id^="content_"]').each(function(){o()("#"+o()(this).prop("id").str_replace("content_","")).click()}),o.a.ceEvent("trigger","ce.formcheckfailed_"+e.prop("name"),[e,i])}return!1}function de(e,t,a,i){var n=t.prop("for");if(se[n])return!1;se[n]=[],e=e.str_replace("[field]",ue(t)),a&&(e=e.str_replace("[field2]",ue(a))),i&&(e=e.str_replace("[extra]",i)),se[n].push(e)}function ue(e){return e.text().replace(/(\s*\(\?\))?:\s*$/,"")}function pe(e){return"<p>"+se[e].join("</p><p>")+"</p>"}var fe={init:function(){var e=o()(this);e.on("submit",function(t){return _e(e)})},setClicked:function(e){i=e},check:function(e,t,a){var i=o()(this);return void 0===e&&(e=!0),void 0===t&&(t=null),void 0===a&&(a=!1),_e(i,{only_check:e,filter:t,show_validation_errors:a})},checkFields:function(e,t,a){var i=o()(this);return void 0===e&&(e=!0),void 0===t&&(t=null),void 0===a&&(a=!1),ce(i,le(i,t),e,a)}},he=m.a,me={},ge=!1;function ve(){var e=o()(this).prop("class").match(/cm-location-([^\s]+)/i);e&&function(e,t){t=t||o()(".cm-state.cm-location-"+e).prop("id");var a=o()("select#"+t).length>0?o()("select#"+t):o()("select#".concat(t,"_d")),i=o()("input#"+t).length>0?o()("input#"+t):o()("input#".concat(t,"_d")),n=o()(".cm-country.cm-location-"+e).last(),r=i.val(),s=n.length?n.val():me.default_country,l=n.length?n.prop("disabled"):a.prop("disabled"),c=a.is(":focus")||i.is(":focus"),_=n.is(":focus");if(a.prop("id",t).prop("disabled",!1).removeClass("hidden cm-skip-avail-switch"),i.prop("id",t+"_d").prop("disabled",!0).addClass("hidden cm-skip-avail-switch"),_&&i.val(""),i.hasClass("disabled")||a.removeClass("disabled"),me.states&&me.states[s]){a.find("option").each(function(){var e=o()(this);e.val()&&"skip"!==e.data("caRebuildStates")&&e.remove()});for(var d=0;d<me.states[s].length;d++)a.append('<option value="'.concat(me.states[s][d].code,'" \n                            ').concat(me.states[s][d].code==r?" selected":"",">\n                            ").concat(me.states[s][d].state,"\n                         </option>"));a.prop("id",t).prop("disabled",!1).removeClass("cm-skip-avail-switch"),i.prop("id",t+"_d").prop("disabled",!0).addClass("cm-skip-avail-switch").val(""),c&&a.focus(),i.hasClass("disabled")||a.removeClass("disabled")}else a.prop("id",t+"_d").prop("disabled",!0).addClass("hidden cm-skip-avail-switch"),i.prop("id",t).prop("disabled",!1).removeClass("hidden cm-skip-avail-switch"),c&&i.focus(),a.hasClass("disabled")||i.removeClass("disabled");!0===l&&(a.prop("disabled",!0),i.prop("disabled",!0)),o.a.ceEvent("trigger","ce.rebuild_states")}(e[1],o()(".cm-state.cm-location-"+e[1]).not(":disabled").last().prop("id"))}var Ee,be={init:function(){o()(this).hasClass("cm-country")?(0==ge&&(o()(he.doc).on("change","select.cm-country",ve),ge=!0),o()(this).trigger("change",{is_triggered_by_user:!1})):ve.call(this)}},ye=(m.a,o()(window),{init:function(e){var t=!1;if(!(t=(t=(t=t||o.a.browser.edge&&+o.a.browser.version<17.17134||!1)||o.a.browser.msie||!1)||o.a.browser.chrome&&+o.a.browser.version.split(".")[0]<63||!1))return this.each(function(){var e=o()(this);e.data("caStickOnScreens")&&e.data("caStickOnScreens").split(",");e.css({position:"sticky",top:e.data("caTop")||0}),o.a.browser.safari&&e.css({position:"-webkit-sticky"})});o()("body").toggleClass("sticky-no-support")}}),Ce=m.a,De={},je=0,Oe='<span class="ty-icon cm-icon-live-edit icon-live-edit ty-icon-live-edit"></span>';function Pe(e){return Ce.live_editor_mode&&-1!=e.indexOf("[lang")&&(e='<var class="live-edit-wrap">'+Oe+'<var class="cm-live-edit live-edit-item" data-ca-live-edit="langvar::'+e.substring(e.indexOf("=")+1,e.indexOf("]"))+'">'+e.substring(e.indexOf("]")+1,e.lastIndexOf("["))+"</var></var>"),e}function we(e){var t=o()(".cm-notification-content",o()(e.target));return t.length&&(Me(t)||Ee.append(t)),!0}function Me(e){var t=o.a.ceDialog("get_last");return!!t.length&&(o()(".cm-notification-container-dialog",t).prepend(e),t.off("dialogclose",we),t.on("dialogclose",we),!0)}var ke={show:function(e,t){if(t||(t=o.a.crc32(e.message)),void 0===e.message)return!1;if(function(e){var t=o()("div[data-ca-notification-key="+e+"]");return!!t.length&&(Me(t)||t.fadeTo("fast",.5).fadeTo("fast",1).fadeTo("fast",.5).fadeTo("fast",1),De[e]&&(clearTimeout(De[e]),ke.close(t,!0)),!0)}(t))return!0;if(e.message=Pe(e.message),e.title=Pe(e.title),"I"==e.type){o()(".cm-notification-content.cm-notification-content-extended").each(function(){ke.close(o()(this),!1)}),o()(Ce.body).append('<div class="ui-widget-overlay" style="z-index:1010" data-ca-notification-key="'+t+'"></div>');var a=o()('<div class="cm-notification-content cm-notification-content-extended notification-content-extended '+("I"==e.message_state?" cm-auto-hide":"")+'" data-ca-notification-key="'+t+'"><h1>'+e.title+'<span class="cm-notification-close close"></span></h1><div class="notification-body-extended">'+e.message+"</div></div>");ke.position(a)}else{var i="alert",n="";"N"==e.type?i+=" alert-success":"W"==e.type?i+=" alert-warning":"S"==e.type?i+=" alert-info":i+=" alert-error","I"==e.message_state?i+=" cm-auto-hide":"S"==e.message_state&&(n+=" cm-notification-close-ajax"),Me(a=o()('<div class="cm-notification-content notification-content '+i+'" data-ca-notification-key="'+t+'"><button type="button" class="close cm-notification-close '+n+'" data-dismiss="alert">&times;</button><strong>'+e.title+"</strong>"+e.message+"</div>"))||Ee.append(a)}o.a.ceEvent("trigger","ce.notificationshow",[a]),"I"==e.message_state&&ke.close(a,!0)},showMany:function(e){for(var t in e)ke.show(e[t],t)},closeAll:function(){var e=Ee.find(".cm-notification-content"),t=o.a.ceDialog("get_last");t.length&&(e=e.add(t.find(".cm-notification-content"))),e.each(function(){var e=o()(this);e.hasClass("cm-notification-close-ajax")||ke.close(e,!1)})},close:function(e,t){if(1==t)return 0===je||(De[e.data("caNotificationKey")]=setTimeout(function(){ke.close(e,!1)},je),!0);!function(e){if(e.find(".cm-notification-close-ajax").length&&o.a.ceAjax("request",fn_url("notifications.close?notification_id="+e.data("caNotificationKey")),{hidden:!0}),e.fadeOut("fast",function(){e.remove()}),e.hasClass("cm-notification-content-extended")){var t=o()(".ui-widget-overlay[data-ca-notification-key="+e.data("caNotificationKey")+"]");t.length&&t.fadeOut("fast",function(){t.remove()})}0==o()(".ui-dialog").is(":visible")&&o()("html").removeClass("dialog-is-open")}(e)},init:function(){je=1e3*Ce.notice_displaying_time,Ee=o()(".cm-notification-container"),o()(Ce.doc).on("click",".cm-notification-close",function(){ke.close(o()(this).parents(".cm-notification-content:first"),!1)}),Ee.find(".cm-auto-hide").each(function(){ke.close(o()(this),!0)}),o()(".cm-notification-content.notification-content-extended").each(function(e,t){var a=o()(t);ke.position(a)})},position:function(e,t){t=!1!==t;var a=o.a.getWindowSizes(),i=a.view_height-300;e.find(".cm-notification-max-height").css({"max-height":i}),t&&o()(Ce.body).append(e),e.css("top",a.view_height/2-e.height()/2)}},Ae=(m.a,{}),xe={on:function(e,t,a){a=a||!1,e in Ae||(Ae[e]=[]),Ae[e].push({handler:t,one:a})},one:function(e,t){xe.on(e,t,!0)},trigger:function(e,t){t=t||[];var a,i=!0;if(e in Ae)for(var n=0;n<Ae[e].length;n++)if(a=Ae[e][n].handler.apply(Ae[e][n].handler,t),Ae[e][n].one&&(Ae[e].splice(n,1),n--),!1===a){i=!1;break}return i}},Te=(m.a,{_init:function(e){if(!e.data("codeEditor")){var t=ace.edit(e.prop("id"));t.session.setUseWrapMode(!0),t.session.setWrapLimitRange(),t.setFontSize("14px"),t.renderer.setShowPrintMargin(!1),t.getSession().on("change",function(t){e.addClass("cm-item-modified")}),e.data("codeEditor",t)}return o()(this)},init:function(e){var t=o()(this);return Te._init(t),e&&t.data("codeEditor").getSession().setMode(e),o()(this)},set_value:function(e,t){var a=o()(this);return Te._init(a),void 0==t&&(t="ace/mode/html"),a.data("codeEditor").getSession().setMode(t),a.data("codeEditor").setValue(e),a.data("codeEditor").navigateLineStart(),a.data("codeEditor").clearSelection(),a.data("codeEditor").scrollToRow(0),o()(this)},set_show_gutter:function(e){o()(this).data("codeEditor").renderer.setShowGutter(e)},value:function(){var e=o()(this);return Te._init(e),e.data("codeEditor").getValue()},focus:function(){var e=o()(this),t=e.data("codeEditor").getSession(),a=t.getLength();e.data("codeEditor").focus(),e.data("codeEditor").gotoLine(a,t.getLine(a-1).length)},set_listener:function(e,t){return o()(this).data("codeEditor").getSession().on(e,function(e){t(e)}),o()(this)}}),Ie=m.a,Be={pageSize:10,enableSearch:!0,closeOnSelect:!0,loadViaAjax:!1,dataUrl:null,enableImages:!1,imageWidth:20,imageHeight:20,placeholder:null,allowClear:!1,debug:!1,autofocus:!1,dropdownCssClass:"",delay:0};function qe(e,t){this.$el=o()(e),this.settings=o.a.extend({},Be,t),this.init()}o.a.extend(qe.prototype,{init:function(){var e=this.$el.data();this.settings.bulkEditMode=e.caBulkEditMode||!1,this.settings.dropdownParent=e.caDropdownParent||!1,this.settings.placeholder=e.caPlaceholder||this.settings.placeholder,this.settings.pageSize=e.caPageSize||this.settings.pageSize,this.settings.dataUrl=e.caDataUrl||this.settings.dataUrl,this.settings.loadViaAjax=void 0===e.caLoadViaAjax?this.settings.loadViaAjax:e.caLoadViaAjax,this.settings.closeOnSelect=void 0===e.caCloseOnSelect?this.settings.closeOnSelect:e.caCloseOnSelect,this.settings.enableImages=void 0===e.caEnableImages?this.settings.enableImages:e.caEnableImages,this.settings.enableSearch=void 0===e.caEnableSearch?this.settings.enableSearch:e.caEnableSearch,this.settings.imageWidth=void 0===e.caImageWidth?this.settings.imageWidth:e.caImageWidth,this.settings.imageHeight=void 0===e.caImageHeight?this.settings.imageHeight:e.caImageHeight,this.settings.multiple=void 0===this.settings.multiple?this.$el.is("[multiple]"):this.settings.multiple,this.settings.debug=void 0===e.debug?this.settings.debug:e.caDebug,this.settings.allowClear=void 0===e.caAllowClear?this.settings.allowClear:e.caAllowClear,this.settings.autofocus=void 0===e.caAutofocus?this.settings.autofocus:e.caAutofocus,this.settings.dropdownCssClass=e.caDropdownCssClass||this.settings.dropdownCssClass,this.settings.delay=e.caAjaxDelay||this.settings.delay,this.settings.allowSorting=e.caAllowSorting||!1,this.settings.escapeHtml=void 0===e.caEscapeHtml||e.caEscapeHtml,this.settings.addTemplateSelectionHook=void 0!==e.caAddTemplateSelectionHook&&e.caAddTemplateSelectionHook,this.settings.isRequired=void 0!==e.caRequired&&e.caRequired,this.settings.width=void 0!==e.caSelectWidth&&e.caSelectWidth,this.settings.repaintDropdownOnChange=e.caRepaintDropdownOnChange||!1,this.settings.templateType=e.caTemplateType||"",this.settings.enableAdd=e.caEnableAdd||!1,this.settings.templateResultSelector=e.caTemplateResultSelector||"",this.settings.templateSelectionSelector=e.caTemplateSelectionSelector||"",this.settings.templateResultAddSelector=e.caTemplateResultAddSelector||"",this.settings.newValueHolderSelector=e.caNewValueHolderSelector||null,this.settings.newValueAllowMultiple=e.caNewValueAllowMultiple||!1,this.initSelect2(this.settings)},initSelect2:function(e){var t=this,a={language:{loadingMore:function(){return Ie.tr("loading")},searching:function(){return Ie.tr("loading")},errorLoading:function(){return Ie.tr("error")},noResults:function(){return Ie.tr("nothing_found")}},closeOnSelect:this.settings.closeOnSelect,placeholder:this.settings.placeholder,allowClear:this.settings.allowClear,multiple:this.settings.multiple,dropdownCssClass:this.settings.dropdownCssClass};this.settings.loadViaAjax&&null!==this.settings.dataUrl&&(a.ajax={url:this.settings.dataUrl,delay:this.settings.delay,data:function(e){var a={q:e.term,page:e.page||1,page_size:t.settings.pageSize};return t.settings.enableImages&&(a.image_width=t.settings.imageWidth,a.image_height=t.settings.imageHeight),a},processResults:function(e,a){return a.page=a.page||1,{results:e.objects,pagination:{more:a.page*t.settings.pageSize<e.total_objects}}},transport:function(e,t,a){return e.callback=t,e.hidden=!0,o.a.ceAjax("request",e.url,e)}}),this.settings.escapeHtml||(a.escapeMarkup=function(e){return e}),a.templateSelection=function(a,i){a.content||(a.content={text:a.text,append:""});var n="";a.type=t.settings.templateType,a.bulkEditMode=e.bulkEditMode,a.context=a.text,t.templateResultAddSelector&&a.newTag?n=o()(t.settings.templateResultAddSelector).html():t.settings.templateSelectionSelector&&(n=o()(t.settings.templateSelectionSelector).html());var r=Object.assign({},o()(a.element).data()).data;return r&&(a.data=r.data),void 0!==a.element&&o()(a.element).data("caObjectSelectorItemTemplate")&&(a.context=o()(a.element).data("caObjectSelectorItemTemplate")),n&&(Object.keys(a.content).forEach(function(e){n=n.str_replace("[".concat(e,"]"),a.content[e])}),a.context=n),o.a.ceEvent("trigger","ce.select_template_selection",[a,i,t.$el]),a.context};var i=this.$el;if(this.settings.data&&(a.data=this.settings.data,Array.isArray(a.data))){var n={};i.find("option").each(function(){n[o()(this).val()]=o()(this)}),this.settings.data.forEach(function(e){e.id&&e.text&&n[e.id]&&!n[e.id].text()&&n[e.id].text(e.text)})}(this.settings.templateSelectionSelector||this.settings.enableImages||this.settings.enableAdd)&&(a.templateResult=function(e){if(e.loading)return e.text;if(e.content||(e.content={text:e.text,append:""}),t.settings.enableImages&&!e.image_url)return o()("<span>"+e.text+"</span>");e.type=t.settings.templateType,e.context=e.text;var a="";return o.a.ceEvent("trigger","ce.select_template_result",[e,i]),t.settings.enableImages&&e.image_url&&(e.content.append=e.image_url),t.settings.enableAdd&&e.newTag?a=o()(t.settings.templateResultAddSelector).html():t.settings.templateResultSelector&&(a=o()(t.settings.templateResultSelector).html()),a&&(Object.keys(e.content).forEach(function(t){var i=new RegExp("\\[".concat(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"\\]"),"g");a=a.replace(i,e.content[t])}),e.context=a),o.a.ceEvent("trigger","ce.change_select_list",[e,i]),a?o()(e.context):e.image_url?o()('<img src="'+e.image_url+'" alt="'+e.text+'" /><span>'+e.context+"</span>"):o()("<span>"+e.context+"</span>")}),this.settings.enableSearch||(a.minimumResultsForSearch=1/0),this.settings.width&&(a.width=this.settings.width),this.settings.repaintDropdownOnChange&&this.$el.on("select2:select select2:unselect",function(){var e=o()(this).data("select2");e.isOpen()&&e.dropdown._positionDropdown()}),this.settings.dropdownParent&&(a.dropdownParent=o()(this.settings.dropdownParent)),this.settings.enableAdd&&(a.tags=!0,a.createTag=function(e){var a=o.a.trim(e.term);if(""===a)return null;var n={id:a,text:a,newTag:!0,type:t.settings.templateType,content:{text:a}};return o.a.ceEvent("trigger","ce.select2.create_tag",[i,n,a]),n.content.append||(n.content.append=""),n}),i.select2(a),o.a.ceEvent("on","ce.window.resize",function(e,t){var a=i.parent();a.hasClass("select2-wrapper--width-auto")||a.find("input.select2-search__field, .select2-container").css({width:"100%"})}),o.a.ceEvent("on","ce.tab.show",function(e,t){o()(window).width()<=768&&i.parent().find("input.select2-search__field, .select2-container").css({width:"100%"})}),this.settings.allowSorting&&this.$el.select2Sortable(),this.settings.autofocus&&this.$el.select2("focus"),i.on("select2:select",function(e){var a=e.params.data;if(t.settings.newValueHolderSelector)if(t.settings.newValueAllowMultiple){if(a.newTag){var n=o()(t.settings.newValueHolderSelector).last(),r=n.val()?n.clone():n;r.val(a.id),r.insertAfter(n)}}else a.newTag?o()(t.settings.newValueHolderSelector).val(a.id):o()(t.settings.newValueHolderSelector).val(null);o.a.ceEvent("trigger","ce.select2.select",[i,a,e])}),i.on("select2:unselect",function(e){var a=e.params.data;if(t.settings.newValueHolderSelector&&a.newTag){var n=o()(t.settings.newValueHolderSelector);n.length>1?n.each(function(e,t){var i=o()(t);i.val()===a.id&&i.remove()}):n.val(null)}o.a.ceEvent("trigger","ce.select2.unselect",[i,e])}),o.a.ceEvent("trigger","ce.select2.init",[i])}});m.a;var Re,Se={init:function(e){var t=this.get(0);if(document.selection)t.focus(),document.selection.createRange().text=e,t.focus();else if(t.selectionStart||"0"==t.selectionStart){var a=t.selectionStart,i=t.selectionEnd,n=t.scrollTop;t.value=t.value.substring(0,a)+e+t.value.substring(i,t.value.length),t.focus(),t.selectionStart=a+e.length,t.selectionEnd=a+e.length,t.scrollTop=n}else t.value+=e,t.focus()}},Le=(m.a,{init:function(){var e=o()(this);return e.length?(o.a.fn.bootstrapSwitch?e.bootstrapSwitch():o.a.getScript("js/lib/bootstrap_switch/js/bootstrapSwitch.js",function(){e.bootstrapSwitch()}),e):e},isActive:function(){return o()(this).bootstrapSwitch("isActive")},setActive:function(e){o()(this).bootstrapSwitch("setActive",e),o()(this).find("input").prop("disabled",!e)},getStatus:function(){return o()(this).bootstrapSwitch("status")}}),Ue=(m.a,{selectToggler:function(e,t){e.prop("checked",!1),t.prop("checked",!0).prop("disabled",!0)},init:function(){var e=o()(this),t=e.data("caCheckboxGroupRole"),a=e.data("caCheckboxGroup"),i=o()('[data-ca-checkbox-group="'.concat(a,'"][data-ca-checkbox-group-role="').concat("togglee",'"]')),n=o()('[data-ca-checkbox-group="'.concat(a,'"][data-ca-checkbox-group-role="').concat("toggler",'"]'));e.on("change",function(a){var r=e.is(":checked"),s=!1;i.each(function(e,t){o()(t).is(":checked")&&(s=!0)}),"toggler"===t&&r?Ue.selectToggler(i,n):"togglee"===t&&r?n.prop("checked",!1).prop("disabled",!1):"togglee"!==t||s||Ue.selectToggler(i,n)})}}),We={container_selector:"[data-ca-block-manager-container-id]",row_selector:"[data-ca-block-manager-row-id]",grid_selector:"[data-ca-block-manager-grid-id]",block_selector:"[data-ca-block-manager-snapping-id]",blocks_place_selector:"[data-ca-block-manager-blocks-place]",block_disabled_class:"bm-block-manager__block--disabled",block_got_up_class:"bm-block-manager__block--got-up",block_got_down_class:"bm-block-manager__block--got-down",block_menu_wrapper_bottom_class:"bm-block-manager__menu-wrapper--bottom",block_menu_bottom_class:"bm-block-manager__menu--bottom",menu_wrapper_selector:"[data-ca-block-manager-menu-wrapper]",menu_selector:"[data-ca-block-manager-menu]",action_selector:"[data-ca-block-manager-action]",switch_selector:"[data-ca-block-manager-switch]",switch_icon_selector:"[data-ca-block-manager-switch-icon]",switch_icon_show_selector:'[data-ca-block-manager-switch-icon="show"]',switch_icon_hide_selector:'[data-ca-block-manager-switch-icon="hide"]',switch_icon_hidden_class:"bm-block-manager__icon--hidden",move_selector:"[data-ca-block-manager-move]",left_alignment_selector:'[data-ca-block-manager-is-left-alignment="true"]',right_alignment_selector:'[data-ca-block-manager-is-right-alignment="true"]',float_left_class:"ty-float-left",float_right_class:"ty-float-right",sortable_items_selector:"> *:not(#litecheckout_form):not(#litecheckout_final_section)",offset_threshold:50,_hover_element:{},_self:{}},Ke={sendRequest:function(e,t,a){o.a.ceAjax("request",fn_url("block_manager."+e+(t?"."+t:"")),{data:a,method:"post"})}},Fe={up:function(){We._hover_element.addClass(We.block_got_up_class),setTimeout(function(){We._hover_element.removeClass(We.block_got_up_class),We._hover_element.trigger("block_manager:animation_complete","up")},300)},down:function(){We._hover_element.addClass(We.block_got_down_class),setTimeout(function(){We._hover_element.removeClass(We.block_got_down_class),We._hover_element.trigger("block_manager:animation_complete","down")},300)}},$e={_snapBlocks:function(e){var t={};return e.parent().find(We.block_selector).each(function(){var e=o()(this),a=e.index();t[a]={grid_id:e.closest(We.grid_selector).data("caBlockManagerGridId"),order:a,snapping_id:e.data("caBlockManagerSnappingId"),action:"update"}}),t},_executeAction:function(e){var t=!1;return"switch"==e?t=$e._blockSwitch():"move"==e&&(t=$e._blockMove()),t},_blockSwitch:function(){var e=We._self.data("caBlockManagerSwitch")?"A":"D",t=We._self.find(We.switch_icon_show_selector),a=We._self.find(We.switch_icon_hide_selector),i={snapping_id:We._hover_element.data("caBlockManagerSnappingId"),object_id:0,object_type:"",status:e,type:"block"};return Ke.sendRequest("update_status","",i),"A"===e?(We._self.removeClass(We.block_disabled_class),We._hover_element.removeClass(We.block_disabled_class),We._self.data("caBlockManagerSwitch",!1),a.addClass(We.switch_icon_hidden_class),t.removeClass(We.switch_icon_hidden_class)):(We._self.addClass(We.block_disabled_class),We._hover_element.addClass(We.block_disabled_class),We._self.data("caBlockManagerSwitch",!0),t.addClass(We.switch_icon_hidden_class),a.removeClass(We.switch_icon_hidden_class)),!0},_blockMove:function(){var e=We._self.data("caBlockManagerMove"),t=We._hover_element,a=$e._getNearElem(t,e);if(o.a.isEmptyObject(a))return!0;var i=$e._getBlockMovingTactics(t,a,e);return $e._setBlockFloats(t,a),t[i](a),$e._updateBlock(t),Fe[e](),Ke.sendRequest("snapping","",{snappings:$e._snapBlocks(We._hover_element)}),!0},_updateBlock:function(e){return o()(window).trigger("resize"),e.find(".cm-image-gallery").each(function(){o()(this).data("owlCarousel").reinit()}),!0},_setMenuPosition:function(e){var t=e.offset().top<We.offset_threshold;return e.find(We.menu_wrapper_selector).toggleClass(We.block_menu_wrapper_bottom_class,t),e.find(We.menu_selector).toggleClass(We.block_menu_bottom_class,t),!0},_setBlockFloats:function(e,t){var a=t.closest(We.grid_selector).filter(We.left_alignment_selector).length>0,i=t.closest(We.grid_selector).filter(We.right_alignment_selector).length>0;return e.toggleClass(We.float_left_class,a&&i||a),e.toggleClass(We.float_right_class,a&&i||i),!0},_getBlockMovingTactics:function(e,t,a){var i="up"===a,n=0===e.prevAll(We.block_selector).first().length,o=0===e.nextAll(We.block_selector).first().length,r=t.is(We.blocks_place_selector);return r&&i&&n?"appendTo":r&&!i&&o?"prependTo":i&&n||!i&&!o?"insertAfter":"insertBefore"},_getNearElem:function(e,t,a){var i="up"===t,n=!1,o=We.container_selector,r="";e.is(We.blocks_place_selector+":not("+We.grid_selector+")")&&console.log("BLOCKS PLACE STOP"),e.is(We.block_selector)?(o=We.block_selector,r=We.grid_selector):e.is(We.grid_selector)?(n=!0,o=We.grid_selector,r=We.row_selector):e.is(We.row_selector)&&e.closest(We.grid_selector).length?(n=!0,o=We.row_selector,r=We.grid_selector):e.is(We.row_selector)&&(n=!0,o=We.row_selector,r=We.container_selector);var s=i?"last":"first",l=e[i?"prevAll":"nextAll"](o).first(),c=a?e:l,_=a||l.length>0,d=c.find(We.grid_selector),u=d.length>0,p=c.find(We.blocks_place_selector),f=p.length>0;return _&&n&&u?$e._getNearElem(d[s](),t,!0):f?p:_?c:r?$e._getNearElem(e.closest(r),t):{}}},ze=function(){var e={items:We.sortable_items_selector,connectWith:We.blocks_place_selector,update:function(e,t){var a=$e._snapBlocks(o()(t.item));Ke.sendRequest("snapping","",{snappings:a})}};o.a.extend(We,e),o()(We.blocks_place_selector).sortable(We)},Ne={init:{init:function(){Re||(ze(),o()(We.block_selector).each(function(){$e._setMenuPosition(o()(this))}),o()(m.a.doc).on("click",We.action_selector,function(e){We._self=o()(this);var t=We._self.parents(We.menu_selector).parent().parent();We._hover_element=t;var a=We._self.data("caBlockManagerAction");return $e._executeAction(a)}),o()(m.a.doc).on("block_manager:animation_complete",function(e){$e._setMenuPosition(o()(e.target))}),Re=!0)}}.init,api:{sendRequest:Ke.sendRequest},defaults:We},He=m.a;var Ve={init:function(){o()(this).each(function(){var e,t=o()(this);if(!t.length)return!1;if(t[0].classList.forEach(function(t){0===t.indexOf("cm-block-loader--")&&(e=t.split("--")[1])}),void 0!==e){var a=o()('<div class="cm-block-loader" data-ca-object-key="'.concat(e,'"></div>'));t.after(a),t.remove(),o.a.ceAjax("request",fn_url("block_manager.render&object_key=".concat(encodeURIComponent(e),"&redirect_url=").concat(encodeURIComponent(He.current_url))),{method:"get",callback:Ve.processResponse(a),hidden:!0})}})},processResponse:function(e){return function(t){var a=o()(t.block_content);a.toggleClass("cm-block-loaded");var i=[];a.find("script").each(function(e,t){t.src&&i.push(t.src)}),function(e){var t=o.a.map(e,function(e){return o.a.getScript(e)});return t.push(o.a.Deferred(function(e){o()(e.resolve)})),o.a.when.apply(o.a,t)}(i).done(function(){a.find("script[src]").remove(),o()(".cm-block-loaded",o()(e)).remove(),o()(e).append(a),o.a.commonInit(e)})}}},Ge={objectType:"",ajaxUrl:"",ajaxDelay:"",ajaxPageSize:10,ajaxMethod:"get",allowSorting:!1,enableSearch:!0,enableCreateObject:!1,createObjectToEnd:!1,tokenSeparators:[],allowMultipleCreatedObjects:!1,closeOnSelect:!0,selectOnClose:!1,allowClear:!1,autofocus:!1,autoopen:!1,escapeHtml:!0,redrawDropdownOnChange:!1,width:"100%",showDropdown:!0,containerHideCssClass:"object-picker__selection-simple--disable-dropdown",dropdownHideCssClass:"object-picker__select2-dropdown--disable-dropdown",containerCssClass:"",dropdownCssClass:"",templateResultSelector:null,templateResultNewSelector:null,templateResultPredefinedSelector:null,templateSelectionSelector:null,templateSelectionNewSelector:null,templateSelectionLoadSelector:null,templateSelectionPredefinedSelector:null,createdObjectHolderSelector:null,externalContainerSelector:null,placeholder:"",placeholderValue:"",hasStrictComplianceMatcher:!1,maximumInputLength:0,minimumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,languageLoadingMore:"loading",languageSearching:"loading",languageErrorLoading:"error",languageNoResults:"nothing_found",extendedPickerId:null,extendedPickerIdKey:"",extendedPickerTextKey:"",predefinedVariants:[],dropdownParentSelector:"",searchRequestData:{},unremovableItemIds:[],hideSelection:!1,enablePermanentPlaceholder:!1,lazyLoad:!1},Ye=a(4),Je=a(5),Ze=function(){function e(){Object(Ye.a)(this,e)}return Object(Je.a)(e,null,[{key:"set",value:function(e,t){var a=this;try{t.forEach(function(t){sessionStorage.setItem(a.getItemKey(e,t.id),JSON.stringify(t))})}catch(e){}}},{key:"get",value:function(e,t){try{var a=sessionStorage.getItem(this.getItemKey(e,t));if(a)return a=JSON.parse(a),a=this.normalizeObject(a)}catch(e){}return null}},{key:"mget",value:function(e,t){var a=[],i=this;return t.forEach(function(t){var n=i.get(e,t);n&&a.push(n)}),a}},{key:"load",value:function(e,t,a,i){var n=o.a.Deferred(),s=this;return o.a.ceAjax("request",e,{method:i||"get",hidden:!0,caching:!0,data:{ids:a},error_callback:function(){n.reject()},callback:function(e){if(void 0!==Object(r.a)(e.objects)){var a={};o.a.each(e.objects,function(e,t){(t=s.normalizeObject(t)).loaded=!0,a[t.id]=t}),s.set(t,e.objects),n.resolve(a)}}}),n.promise()}},{key:"find",value:function(e,t,a){var i=o.a.Deferred();return a=o.a.extend({},a,{error_callback:function(){i.reject()},callback:function(e){i.resolve(e)},hidden:!0}),o.a.ceAjax("request",e,a),i.promise()}},{key:"getItemKey",value:function(e,t){return"".concat(e,"_").concat(t)}},{key:"normalizeObject",value:function(e){return e.id&&null!==e.id&&(e.id=e.id.toString()),e}}]),e}();function Qe(e,t,a){e.call(this,t,a),this.unremovableItemsIds=a.get("unremovableItemIds"),this.enablePermanentPlaceholder=a.get("enablePermanentPlaceholder")}function Xe(e,t,a){e.call(this,t,a),this.$externalSelectionContainer=o()(a.get("externalContainerSelector"))}function et(e,t,a){e.call(this,t,a)}function tt(e,t,a){e.call(this,t,a),this.variants=a.get("predefinedVariants")}function at(e,t,a,i){e.call(this,t,a,i),this.unremovableItemsIds=a.get("unremovableItemIds")}Qe.prototype.bind=function(e,t,a){this.$selection.on("click",function(e){o()(e.target).hasClass("select2-search__field")||o()(e.target).hasClass("select2-selection__rendered")||e.stopImmediatePropagation()}),e.call(this,t,a)},Qe.prototype.display=function(e,t,a){return t.id&&Array.isArray(this.unremovableItemsIds)&&-1!==this.unremovableItemsIds.indexOf(t.id)&&(a.find(".select2-selection__choice__remove").remove(),a.addClass("select2-selection__choice--unremovable")),e.call(this,t,a)},Qe.prototype.searchRemoveChoice=function(){return!1},Qe.prototype.update=function(e,t){e.call(this,t),this.enablePermanentPlaceholder&&this.$search.attr("placeholder",this.placeholder.text)},Xe.prototype.update=function(e,t){e.call(this,[]);var a=o.a.fn.select2.amd.require("select2/utils"),i=[],n=new Map;this.$externalSelectionContainer.children().each(function(){var e=o()(this),t=a.GetData(e[0],"data");t&&n.set(t.id,e)});for(var r=0;r<t.length;r++){var s=t[r];s.data&&(s.data._index=r);var l=o()(this.display(s,""));if(n.has(s.id)){var c=n.get(s.id);a.GetData(c[0],"data");s.isChanged&&c.replaceWith(l),n.delete(s.id)}else i.push(l);a.StoreData(l[0],"data",s)}i.length&&a.appendMany(this.$externalSelectionContainer,i),n.size&&n.forEach(function(e){a.RemoveData(e[0]),e.remove()})},Xe.prototype.bind=function(e,t,a){e.call(this,t,a);var i=this,n=o.a.fn.select2.amd.require("select2/utils");this.$externalSelectionContainer.on("click",".cm-object-picker-remove-object",function(e){if(!i.options.get("disabled")){var t=o()(this).closest(".cm-object-picker-object"),a=n.GetData(t[0],"data");e.originalEvent&&(e.originalEvent=Object.assign({},e.originalEvent,{metaKey:!0})),i.trigger("unselect",{originalEvent:e,data:a})}})},et.prototype.update=function(e,t){e.call(this,[])},tt.prototype.current=function(e,t){e.call(this,t);var a=[],i=this,n=this.$element.val();Array.isArray(n)||(n=[n]),this.variants.forEach(function(e){e=i._normalizeVariant(e),-1!==n.indexOf(e.id)&&a.push(e)}),a.length&&t(a)},tt.prototype.query=function(e,t,a){var i=this;t.term||null!=t.page?e.call(this,t,a):e.call(this,t,function(e){var t=e.results,n=[];i.variants.forEach(function(e){e=i._normalizeVariant(e);var a=i.option(e);a.attr("data-select2-predefined-variant",!0),n.push(a),i._insertVariant(t,e)}),e.results=t,a(e)})},tt.prototype._insertVariant=function(e,t,a){t.unshift(a)},tt.prototype._normalizeVariant=function(e,t){return Object.assign(t,{data:t.data||{},loaded:!0,isPredefined:!0})},at.prototype.option=function(e,t){return t.id&&Array.isArray(this.unremovableItemsIds)&&-1!==this.unremovableItemsIds.indexOf(t.id)&&(t.disabled=!0),e.call(this,t)};var it=m.a,nt=function(){function e(t,a){Object(Ye.a)(this,e),this.$elem=t,this.options=a,this.tryLoadFromStorage();this.$elem.select2(this.buildSelect2Options());this.options.allowSorting&&this.$elem.select2Sortable(),this.options.autofocus&&this.$elem.select2("focus"),this.options.autoopen&&this.openDropdown(),this.bindEvents(),this.fireEvent("inited")}return Object(Je.a)(e,[{key:"destroy",value:function(){this.$elem.select2("destroy")}},{key:"resize",value:function(){var e=this.$elem.parent();e.hasClass("select2-wrapper--width-auto")||(e.find("input.select2-search__field, .select2-container").css({width:"100%"}),this.fireEvent("resized"))}},{key:"getSelectedObjectIds",value:function(){var e=this.$elem.val();return Array.isArray(e)||(e=[e]),e}},{key:"setSelectedObjectIds",value:function(e){this.$elem.val(e),this.$elem.trigger("change")}},{key:"selectObjectId",value:function(e){if(this.isMultiple()){var t=new Set(this.getSelectedObjectIds());t.add(e),e=Array.from(t)}this.setSelectedObjectIds(e)}},{key:"unselectObjectId",value:function(e){if(this.isMultiple()){var t=new Set(this.getSelectedObjectIds());t.delete(String(e)),e=Array.from(t)}else e=null;this.setSelectedObjectIds(e)}},{key:"addObjects",value:function(t){var a=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=this,r=new Set;t.forEach(function(e){var t=n.$elem.find('option[value="'.concat(e.id,'"]'));if(t.length)a&&t.prop("selected",!0);else{var s=new Option(e.text,e.id,a,a);n.$elem.append(s),i||(e.loaded=!0,o()(s).data("data",e))}r.add(e.id)}),this.$elem.trigger("change"),this.isAjaxSource()&&i&&e.loadObjects(o()([this.$elem]),this.options.objectType,r)}},{key:"updateObjects",value:function(e){var t=this,a=this.$elem.data("select2");e.forEach(function(e){var a=t.$elem.find('option[value="'.concat(e.id,'"]')),i=a.data("data")||{},n=o.a.extend({},i,e);i.isChanged=n.isChanged=!1,n.isChanged=JSON.stringify(i)!==JSON.stringify(n),a.text(e.text),a.data("data",n),a.removeAttr("data-select2-id")}),a&&a.dataAdapter.current(function(e){a.trigger("selection:update",{data:e})})}},{key:"openDropdown",value:function(){this.$elem.select2("open")}},{key:"closeDropdown",value:function(){this.$elem.select2("close")}},{key:"isMultiple",value:function(){return this.$elem.is("[multiple]")}},{key:"isCreateObjectAvailable",value:function(){return Boolean(this.options.enableCreateObject)}},{key:"isAjaxSource",value:function(){return Boolean(this.options.ajaxUrl)}},{key:"getObjectType",value:function(){return this.options.objectType}},{key:"extendSearchRequestData",value:function(e){this.options.searchRequestData=o.a.extend({},this.options.searchRequestData,e)}},{key:"isInited",value:function(){return!0===this.$elem.data("caObjectPickerInited")}},{key:"isDropdownOpen",value:function(){return this.$elem.data("select2").isOpen()}},{key:"fireEvent",value:function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),i=1;i<t;i++)a[i-1]=arguments[i];this.$elem.trigger("ce:object_picker:".concat(e),[this].concat(a)),o.a.ceEvent("trigger","ce.object_picker.".concat(e),[this].concat(a))}},{key:"buildSelect2Options",value:function(){var e=this,t={width:this.options.width,allowClear:this.options.allowClear,closeOnSelect:this.options.closeOnSelect,containerCssClass:this.options.containerCssClass,dropdownCssClass:this.options.dropdownCssClass,showDropdown:this.options.showDropdown,language:{loadingMore:function(){return it.tr(e.options.languageLoadingMore)},searching:function(){return it.tr(e.options.languageSearching)},errorLoading:function(){return it.tr(e.options.languageErrorLoading)},noResults:function(){return it.tr(e.options.languageNoResults)}},maximumInputLength:this.options.maximumInputLength,maximumSelectionLength:this.options.maximumSelectionLength,minimumInputLength:this.options.minimumInputLength,minimumResultsForSearch:this.options.enableSearch?this.options.minimumResultsForSearch:1/0,externalContainerSelector:this.options.externalContainerSelector,unremovableItemIds:this.options.unremovableItemIds,enablePermanentPlaceholder:this.options.enablePermanentPlaceholder,placeholder:{id:this.options.placeholderValue,text:this.options.placeholder,loaded:!0,data:{name:this.options.placeholder}},selectOnClose:this.options.selectOnClose,templateResult:function(t){return e.renderResultItemTemplate(t)},templateSelection:function(t,a){return e.renderSelectionItemTemplate(t,a)},predefinedVariants:this.options.predefinedVariants,tokenSeparators:this.options.tokenSeparators};this.options.showDropdown||(t.containerCssClass+=" "+this.options.containerHideCssClass+" ",t.dropdownCssClass+=" "+this.options.dropdownHideCssClass+" "),this.options.dropdownParentSelector&&(t.dropdownParent=o()(this.options.dropdownParentSelector)),this.options.hasStrictComplianceMatcher&&(t.matcher=function(e,t){return""===o.a.trim(e.term)?t:void 0===t.text?null:t.text.toUpperCase()==e.term.toUpperCase()?t:null}),this.isAjaxSource()&&(t.ajax={url:this.options.ajaxUrl,delay:this.options.ajaxDelay,data:function(t){var a={q:t.term,page:t.page||1,page_size:e.options.ajaxPageSize};return e.options.searchRequestData&&(a=o.a.extend({},e.options.searchRequestData,a)),a},processResults:function(t,a){return a.page=a.page||1,t.objects=t.objects||[],t.objects.forEach(function(e){(e=Ze.normalizeObject(e)).loaded=!0}),{results:t.objects,pagination:{more:a.page*e.options.ajaxPageSize<t.total_objects}}},transport:function(t,a,i){Ze.find(t.url,e.options.objectType,t).done(a).fail(i)}}),this.isCreateObjectAvailable()&&(t.tags=!0,t.createTag=function(t){return e.createNewObjectCallback(t)},t.insertTag=function(t,a){return e.insertNewObjectCallback(t,a)}),this.options.escapeHtml||(t.escapeMarkup=function(e){return e});var a=o.a.fn.select2.amd.require("select2/options"),i=o.a.fn.select2.amd.require("select2/utils"),n=new a(t,this.$elem);if(this.isMultiple()){var r=n.get("selectionAdapter");r=i.Decorate(r,Qe),this.options.externalContainerSelector&&(r=i.Decorate(r,Xe)),n.set("selectionAdapter",r)}if(this.options.hideSelection){var s=n.get("selectionAdapter");s=i.Decorate(s,et),n.set("selectionAdapter",s)}if(this.options.predefinedVariants.length){var l=n.get("dataAdapter");l=i.Decorate(l,tt),n.set("dataAdapter",l)}var c=n.get("resultsAdapter");return c=i.Decorate(c,at),n.set("resultsAdapter",c),n.options}},{key:"renderTemplate",value:function(e,t){return new Function("data","return `".concat(t,"`;"))(e)}},{key:"getItemTemplate",value:function(e){return o()(e).html()}},{key:"renderResultItemTemplate",value:function(e){return e.loading?e.text:(e.data=e.data||{},e.data.text=e.text,e.isPredefined&&this.options.templateResultPredefinedSelector?t=this.renderTemplate(e.data,this.getItemTemplate(this.options.templateResultPredefinedSelector)):e.isNew&&this.options.templateResultNewSelector?t=this.renderTemplate(e.data,this.getItemTemplate(this.options.templateResultNewSelector)):this.options.templateResultSelector&&(t=this.renderTemplate(e.data,this.getItemTemplate(this.options.templateResultSelector))),t||(t=e.text),this.fireEvent("init_template_result_item",e,t),t);var t}},{key:"renderSelectionItemTemplate",value:function(e,t){var a;return e.data=e.data||{},e.data.text=e.text,e.isPredefined&&this.options.templateSelectionPredefinedSelector?a=this.renderTemplate(e.data,this.getItemTemplate(this.options.templateSelectionPredefinedSelector)):e.isNew&&this.options.templateSelectionNewSelector?a=this.renderTemplate(e.data,this.getItemTemplate(this.options.templateSelectionNewSelector)):this.isAjaxSource()&&!e.loaded&&this.options.templateSelectionLoadSelector?a=this.renderTemplate(e.data,this.getItemTemplate(this.options.templateSelectionLoadSelector)):this.options.templateSelectionSelector&&(a=this.renderTemplate(e.data,this.getItemTemplate(this.options.templateSelectionSelector))),a||(a=e.text),this.options.allowSorting&&o()(t).data("optionId",e.id?e.id:0),this.fireEvent("init_template_selection_item",e,a,t),a}},{key:"createNewObjectCallback",value:function(e){var t=o.a.trim(e.term);if(e.enableCreateNewObject=!0,this.fireEvent("before_create_object",e,a),""===t||!e.enableCreateNewObject)return null;var a={id:t,text:t,isNew:!0,content:{text:t},data:{name:t}};return this.fireEvent("create_object",e,a),a}},{key:"insertNewObjectCallback",value:function(e,t){this.fireEvent("before_insert_object",e,t),this.options.createObjectToEnd?e.push(t):e.unshift(t),this.fireEvent("insert_object",e,t)}},{key:"bindEvents",value:function(){var e=this,t=o.a.fn.select2.amd.require("select2/selection/allowClear"),a=o.a.fn.select2.amd.require("select2/keys"),i=o.a.fn.select2.amd.require("select2/utils");t.prototype._handleKeyboardClear=function(e,t,n){if(!n.isOpen())if(t.which==a.DELETE)this._handleClear(t);else if(t.which==a.BACKSPACE&&n.$element[0].lastChild){var o=this.$selection.find(".select2-selection__clear"),r=i.GetData(o[0],"data");n.$element.trigger({type:"select2:unselect",params:{data:r[r.length-1]}}),n.$element[0].lastChild.remove()}},this.options.redrawDropdownOnChange&&this.$elem.on("select2:select select2:unselect",function(){var e=o()(this).data("select2");e.isOpen()&&e.dropdown._positionDropdown()}),this.$elem.on("select2:select",function(t){var a=t.params.data;if(e.options.createdObjectHolderSelector)if(e.options.allowMultipleCreatedObjects){if(a.isNew){var i=o()(e.options.createdObjectHolderSelector).last(),n=i.val()?i.clone():i;n.val(a.id),n.insertAfter(i)}}else a.isNew?o()(e.options.createdObjectHolderSelector).val(a.id):o()(e.options.createdObjectHolderSelector).val(null);e.fireEvent("object_selected",a,t)}),this.$elem.on("select2:unselect",function(t){var a=t.params.data;if(e.options.createdObjectHolderSelector&&a.isNew){var i=o()(e.options.createdObjectHolderSelector);i.length>1?i.each(function(e,t){var i=o()(t);i.val()===a.id&&i.remove()}):i.val(null)}e.fireEvent("object_unselected",a,t)}),this.$elem.on("change",function(){var t=[];o()(this).find("option:selected").each(function(){t.push(i.GetData(this,"data"))}),e.fireEvent("change",e.isMultiple()?t:t.shift())}),this.$elem.on("select2:open",function(){e.fireEvent("dropdown_opened")}),this.$elem.on("select2:close",function(){e.fireEvent("dropdown_closed")}),this.$elem.on("select2:clear",function(){e.fireEvent("cleared")}),o.a.ceEvent("on","ce.window.resize",function(t,a){e.resize()}),o.a.ceEvent("on","ce.tab.show",function(t,a){e.resize()}),this.options.extendedPickerId&&(o.a.ceEvent("on","ce.picker_add_js_items",function(t,a,i){if(e.options.extendedPickerId===i.root_id){var n=[];o.a.map(a,function(t,a){if(t instanceof Object)var i=t[e.options.extendedPickerTextKey];else i=t;n.push({id:a,text:i,loaded:!e.isAjaxSource(),extended_picker_data:t,data:{}})}),n.length&&e.addObjects(n)}}),o.a.ceEvent("on","ce.picker_delete_js_items",function(t,a,i){e.options.extendedPickerId===i.root_id&&o.a.map(a,function(t,a){e.unselectObjectId(a)})})),this.$elem.data("select2").on("selection:update",function(){(e.fireEvent("selection_before_update"),e.options.externalContainerSelector)&&(e.$elem.closest(".cm-hide-inputs").length&&o()(e.options.externalContainerSelector).disableFields());e.fireEvent("selection_updated")})}},{key:"tryLoadFromStorage",value:function(){if(this.isAjaxSource()){var e=Ze.mget(this.options.objectType,this.getSelectedObjectIds());e.length&&this.updateObjects(e)}}}],[{key:"loadObjects",value:function(e,t,a){a=Array.from(a);var i=e.get(0).data("caObjectPicker").options;Ze.load(i.ajaxUrl,t,a,i.ajaxMethod).done(function(t){e.each(function(e,a){if(a.data("caObjectPicker")){var i=a.data("caObjectPicker"),n=i.getSelectedObjectIds(),r=[];o.a.each(n,function(e,a){t[a]&&r.push(t[a])}),r.length&&i.updateObjects(r)}})})}}]),e}();m.a;function ot(e,t){e.length&&function(){var e=o.a.Deferred();o.a.fn.select2?e.resolve():o.a.getScript("js/lib/select2/dist/js/select2.full.min.js",e.resolve);return e.promise()}().done(function(){var t={},a={};e.each(function(){var e=o()(this),i=o.a.extend({},Ge,function(e){var t={};for(var a in Ge)t[a]=e.data(o.a.camelCase("ca-object-picker-".concat(a)));return t}(e),i);if(!i.lazyLoad||e.data("caObjectPickerLazyLoadInited")){var n=new nt(e,i);e.data("caObjectPicker",n),n.isAjaxSource()&&(t[n.options.objectType]||(t[n.options.objectType]=new Set),a[n.options.objectType]||(a[n.options.objectType]=[]),n.getSelectedObjectIds().forEach(function(e){e&&0!=e&&t[n.options.objectType].add(e)}),a[n.options.objectType].push(e))}else!function(e){var t=e.closest("[data-object-picker]");o()("[data-ca-object-picker-lazy-load-field]",t).on("click",function(t){e.hasClass("select2-hidden-accessible")||rt(e)}),o()("[data-ca-object-picker-lazy-load-clear]",t).on("click",function(t){var a=this,i=e.attr("multiple")?e.val().filter(function(e){return e!==""+o()(a).data("caObjectPickerLazyLoadSelect2Id")}):null;rt(e),e.val(i).trigger("change")})}(e)}),o.a.each(t,function(e,t){t.size&&nt.loadObjects(o()(a[e]),e,t)})})}function rt(e){var t=e.closest("[data-object-picker]"),a=o()("[data-ca-object-picker-lazy-load-field]",t);e.data({caObjectPickerAutoopen:!0,caObjectPickerLazyLoadInited:!0}).ceObjectPicker(),a.remove()}var st=function(e){e.fn.ceObjectPicker=function(t){for(var a=arguments.length,i=new Array(a>1?a-1:0),n=1;n<a;n++)i[n-1]=arguments[n];return t&&"init"!==t?function(e,t){for(var a=arguments.length,i=new Array(a>2?a-2:0),n=2;n<a;n++)i[n-2]=arguments[n];e.each(function(){var e=o()(this).data("caObjectPicker");e&&"function"==typeof e[t]&&e[t].apply(e,i)})}.apply(void 0,[e(this),t].concat(i)):ot(e(this),i[0]),e(this)}},lt=(m.a,function(){function e(t,a){Object(Ye.a)(this,e),this.$elem=t,this.options=a,this.bindEvents(),this.fireEvent("inited")}return Object(Je.a)(e,[{key:"fireEvent",value:function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),i=1;i<t;i++)a[i-1]=arguments[i];this.$elem.trigger("ce:notification_receivers_editor:".concat(e),[this].concat(a)),o.a.ceEvent("trigger","ce.notification_receivers_editor.".concat(e),[this].concat(a))}},{key:"bindEvents",value:function(){var e=this;this.$elem.on("click",this.options.cancelButtonSelector,function(){e.resetChanges.apply(e)}),this.$elem.on("click",this.options.updateButtonSelector,function(){e.saveReceivers.apply(e)})}},{key:"resetChanges",value:function(){var e=this,t={};o.a.ceAjax("request",this.options.loadUrl,{method:"get",result_ids:this.options.resultIds,data:t,caching:!0,hidden:!0,callback:function(a){e.options.resetCallback(e,t,a),e.fireEvent("reset")}})}},{key:"saveReceivers",value:function(){var e=this,t={object_type:this.options.objectType,object_id:this.options.objectId,conditions:this.serialize()};o.a.ceAjax("request",this.options.submitUrl,{method:"post",result_ids:this.options.resultIds,data:t,caching:!1,callback:function(a){e.options.saveCallback(e,t,a),e.fireEvent("saved",t,a)}})}},{key:"serialize",value:function(){var e=[],t=this;return this.$elem.find(this.options.receiverPickerSelector).each(function(){var a=o()(this);t.getSelectedReceivers(a).forEach(function(t){e.push(t)})}),this.fireEvent("serialized",e),e}},{key:"getSelectedReceivers",value:function(e){var t=[];return e.select2("data").forEach(function(a){var i=a.data,n=i.method,o=i.criterion;n=n||e.data("caNotificationReceiversEditorReceiverSearchMethod"),o=o||a.text,t.push({method:n,criterion:o})}),t}},{key:"getEditorObjectType",value:function(){return this.options.groupName?"group":"event"}},{key:"getEditorObjectId",value:function(){return this.options.groupName?this.options.groupName:this.options.eventName}}]),e}()),ct={cancelButtonSelector:null,updateButtonSelector:null,receiverPickerSelector:null,submitUrl:"",loadUrl:"",resultIds:"",saveCallback:function(){},resetCallback:function(){},objectType:"group",objectId:null},_t=function(e,t){e.each(function(){var e=$(this),t=$.extend({},ct,dt(e,ct),t),a=new lt(e,t);e.data("caNotificationReceiversEditor",a)})},dt=function(e){var t={};for(var a in ct)t[a]=e.data($.camelCase("ca-notification-receivers-editor-".concat(a)));return t},ut=m.a,pt={init:function(e){return e=e||{},this.each(function(){var t=o()(this),a=e.url||t.data("caInlineDialogUrl"),i=e.actionContext||t.data("caInlineDialogActionContext"),n=e.data||t.data("caInlineDialogData")||{},r=t.prop("id");if(a){t.data("caInlineDialog")&&pt._destroy(t),i&&(n._action_context=i),t.data("caInlineDialog",{placeholder:t.html()}),t.addClass("cm-inline-dialog");var s=o.a.ceAjax("request",a,{full_render:0,result_ids:r,get_promise:!0,skip_result_ids_check:!0,data:n,pre_processing:function(e){e.html&&e.html[r]&&(e.html[r]=e.html[r].replace("<form","<x-form").replace("</form","</x-form"))}});s.done(function(e){var a=[];t.find("x-form").each(function(){var e=o()("<form>"),t=o()(this),i=t.attr("id")||r+"_"+a.length;o.a.each(t.prop("attributes"),function(){e.attr(this.name,this.value)}),e.attr("id",i),e.addClass("hidden cm-outside-inputs"),o()(ut.body).append(e),t.attr("id",i+"_base"),t.find(":input").attr("form",i),a.push(e),e.ceFormValidator()});var i=t.data("caInlineDialog");i.forms=a,t.data("caInlineDialog",i)}),s.fail(function(){pt._destroy(t)})}})},destroy:function(){pt._destroy(this)},opener:function(){return this.on("click",function(){var e=o()(this).data("caInlineDialogContainer");if(e)return o()("#"+e).ceInlineDialog(),!1}),this},closer:function(){return this.on("click",function(){var e=o()(this),t=e.data("caInlineDialogContainer"),a=null;if((a=t?o()("#"+t):e.closest(".cm-inline-dialog")).length)return pt._destroy(a),o.a.ceEvent("trigger","ce.inline_dialog.closed",[this]),a.trigger("ce:inline_dialog:closed"),!1}),this},_destroy:function(e){var t=e.data("caInlineDialog");if(t&&(e.find(".cm-dialog-opener").each(function(){var e=o()(this).data("caTargetId"),t=o()("#"+e);t.length&&t.ceDialog("close")}),e.html(t.placeholder),e.removeData("caInlineDialog"),e.removeClass("cm-inline-dialog"),t.forms&&t.forms.length))for(var a in t.forms)t.forms[a].remove()}},ft=m.a,ht=function(){};ht.prototype=Object.create(Array.prototype,{orderFilesByPosition:{value:function(){return this.sort(function(e,t){return e.tygh.position<t.tygh.position?-1:e.tygh.position>t.tygh.position?1:0}),this},enumerable:!1},getFirstActive:{value:function(){this.orderFilesByPosition();for(var e=0;e<this.length;e++)if(!this[e].removed)return this[e];return!1},enumerable:!1},getMainFile:{value:function(){for(var e=0;e<this.length;e++)if("M"===this[e].image_type)return this[e];return!1},enumerable:!1},isUploadingInProgress:{value:function(){for(var e=0;e<this.length;e++)if("uploading"===this[e].status)return!0;return!1},enumerable:!1}});var mt=ft.FileUploader=function(e,t){this.$el=e,this.el=e.get(0),this.$context=t,this.files=new ht};o.a.extend(mt.prototype,{options:{},elements:{},newAttachedFilesCounter:0,orderPositionCounter:null,init:function(){this.initOptions(),this.lookupDomElements();var e=gt(this.elements.$parentForm);e.push(this),vt(this.elements.$parentForm,e),this.initDropzone(),this.bindEvents(),this.registerExistingFiles()},initOptions:function(){this.options.thumbnailWidth=this.$el.data("caThumbnailWidth"),this.options.thumbnailHeight=this.$el.data("caThumbnailHeight"),this.options.uploadUrl=this.$el.data("caUploadUrl"),this.options.maxFileSize=this.$el.data("caMaxFileSize"),this.options.newFilesParamName=this.$el.data("caNewFilesParamName"),this.options.previewTemplateId=this.$el.data("caTemplateId"),this.options.existingFiles=this.$el.data("caExistingPairs"),this.options.maxFilesCount=this.$el.data("caMaxFilesCount"),this.options.allowSorting=this.$el.data("caAllowSorting"),this.options.destroyAfterInitializing=this.$el.data("caDestroyAfterInitializing"),this.options.defaultImagePairType=this.$el.data("caDefaultImagePairType"),this.options.imagePairTypes=this.$el.data("caImagePairTypes"),this.options.imagePairObjectId=this.$el.data("caImagePairObjectId"),this.options.existingPairThumbnails=this.$el.data("caExistingPairThumbnails"),this.options.expandedDropzoneSelector="file-uploader__pickers--expanded"},lookupDomElements:function(){this.elements.$parentForm=this.$el.parents("form"),this.elements.$filesContainerEl=o()("[data-ca-fileuploader-files-container]",this.$el),this.elements.$pickerContainerEl=o()("[data-ca-fileupload-picker-container]",this.$el),this.elements.$pickerBtnEl=o()("[data-ca-fileupload-picker-btn]",this.$el),this.elements.$pickerMenuEl=o()("[data-ca-fileupload-picker-menu]",this.$el),this.elements.$localFilePickerTrigger=o()("[data-ca-fileupload-picker-local]",this.$el),this.elements.$serverFilePickerTrigger=o()("[data-ca-fileupload-picker-server]",this.$el),this.elements.$urlFilePickerTrigger=o()("[data-ca-fileupload-picker-url]",this.$el),this.elements.$removeAllFilesTrigger=o()("[data-ca-fileupload-remove-all]",this.$el),this.elements.$previewTemplate=o()("#"+this.options.previewTemplateId,this.$context),this.elements.$uploaderPickers=this.$el.find(".file-uploader__pickers")},initDropzone:function(){var e={url:this.options.uploadUrl,thumbnailWidth:this.options.thumbnailWidth,thumbnailHeight:this.options.thumbnailHeight,paramName:this.options.newFilesParamName+"[]",autoProcessQueue:!0,uploadMultiple:!1,parallelUploads:3,maxFiles:this.options.maxFilesCount,previewsContainer:this.elements.$filesContainerEl.get(0),clickable:this.elements.$localFilePickerTrigger.get(0),previewTemplate:this.elements.$previewTemplate.html()};this.options.maxFileSize&&(e.maxFilesize=this.options.maxFileSize),this.dropzone=new Dropzone(this.el,e)},reindexFileOrderPositions:function(){var e=0;this.elements.$filesContainerEl.children().each(function(){o()(this).data("caNewPosition",e++)}),o.a.each(this.files,function(){var e=o()(this.previewElement),t=e.data("caNewPosition");e.data("caNewPosition",null),this.tygh.position=t,this.dynamicData["image-position"]={name:"position",value:t,postfix:"_data"},this.tygh.$sortingPositionInput.val(t)}),this.files.orderFilesByPosition(),this._changeFilesInputNames()},_changeFilesInputNames:function(){var e=this;o.a.each(e.files,function(){e._isMainImagePair(this)?(e._changeMainFileToAdditional(),e._markFileAsMain(this),e.filesGotChanged=!0):(e._markFileAsAdditional(this),e.filesGotChanged=!0),e.refreshPreview(this)})},bindEvents:function(){var e=this;o()(window).on("beforeunload",function(t){return e.isUploadingInProgress()?ft.tr("file_uploading_in_progress_please_wait"):e.filesGotChanged?ft.tr("file_uploading_in_progress_please_wait"):void 0}),o()(".cm-product-save-buttons").on("click",function(t){e.filesGotChanged=!1,t.preventDefault()}),e.options.allowSorting&&this.elements.$filesContainerEl.sortable({tolerance:"pointer",containment:e.elements.$filesContainerEl,cursor:"move",placeholder:"file-uploader__sortable-placeholder",forceHelperSize:!0,axis:"xy",items:".file-uploader__file",update:function(t,a){e.reindexFileOrderPositions()}}),this.elements.$pickerBtnEl.on("click",function(t){var a=o()(t.target),i=e.elements,n=i.$filesContainerEl.offset().left+i.$filesContainerEl.outerWidth()-(a.offset().left+a.outerWidth()),r=i.$pickerMenuEl.outerWidth(),s=i.$filesContainerEl.offset().top+i.$filesContainerEl.outerHeight()-(a.offset().top+a.outerHeight()),l=i.$pickerMenuEl.outerHeight();i.$pickerMenuEl.toggleClass("pull-right",n<r),i.$pickerContainerEl.toggleClass("dropup",s<l)}),this.elements.$serverFilePickerTrigger.on("click",function(t){t.preventDefault(),e.runElfinderFilePickerModal()}),this.elements.$removeAllFilesTrigger.on("click",function(){o()(".file-uploader__file-button-delete").trigger("removefiles")}),this.elements.$urlFilePickerTrigger.on("click",function(t){t.preventDefault();var a;if(a=prompt(ft.tr("url")).trim()){var i={name:"",size:null,image_type:"N",dynamicData:{},mock:{type:"url",value:a}};i.dynamicData["upload-type"]={prefix:"type_",value:"url",postfix:"_detailed"},i.dynamicData["upload-file"]={prefix:"file_",value:a,postfix:"_detailed"},e.dropzone.emit("addedfile",i),e.dropzone.emit("complete",i),e.dropzone.emit("thumbnail",i,a)}}),this.dropzone.on("dragover",function(t){void 0==e._dragTimer&&(e._dragTimer=null);var a=t.dataTransfer,i=a.types.indexOf?1!=a.types.indexOf("Files"):a.types.contains("Files");"application/x-moz-file"==a.types[0]&&(i=!0),a.types&&i&&(e._expandDropzone(),window.clearTimeout(e._dragTimer))}),this.dropzone.on("dragleave",function(t){e._dragTimer=window.setTimeout(function(){e._shrinkDropzone()},25)}),this.dropzone.on("complete",function(t){e.options.destroyAfterInitializing&&e.dropzone.destroy()}),this.dropzone.on("success",function(t,a){a.local_data?"path"in a.local_data&&(t.dynamicData["upload-type"]={prefix:"type_",value:"uploaded",postfix:"_detailed"},t.dynamicData["upload-file"]={prefix:"file_",value:a.local_data.path,postfix:"_detailed"},e._isMainImagePair(t)&&(e._changeMainFileToAdditional(),e._markFileAsMain(t)),e.refreshPreview(t)):e.dropzone.emit("error",t,{error:ft.tr("cannot_upload_file")},a)}),this.dropzone.on("sending",function(e,t,a){a.append("is_ajax",1),ft.security_hash&&ft.security_hash.length&&a.append("security_hash",ft.security_hash)}),this.dropzone.on("addedfile",function(t){if(t.tygh=t.tygh||{},t.dynamicData=t.dynamicData||{},t.dynamicData=t.dynamicData||{},t.tygh.index=e.getImageDataIndex(t),e._shrinkDropzone(),e._moveDropzoneToEnd(),t.image_type=t.original_image_type="N",t.dynamicData["image-type"]={name:"type",value:e.options.defaultImagePairType,postfix:"_data"},t.dynamicData["image-object-id"]={name:"object_id",value:e.options.imagePairObjectId,postfix:"_data"},t.dynamicData["is-new-file"]={name:"is_new",value:"Y",postfix:"_data"},t.dynamicData["alt-text-detailed"]={name:"detailed_alt",value:"",postfix:"_data"},t.mock)if("existing"===t.mock.type){if(t.mock.existingPair){var a=t.mock.existingPair.detailed?t.mock.existingPair.detailed:t.mock.existingPair.icon;t.previewLink=a.image_path,t.dynamicData["image-pair-id"]={name:"pair_id",value:t.mock.existingPair.pair_id,postfix:"_data"},t.dynamicData["alt-text-detailed"]={name:"detailed_alt",value:a.alt?a.alt:"",defaultValue:a.alt?a.alt:"",postfix:"_data"},t.dynamicData["is-new-file"]={name:"is_new",value:"N",postfix:"_data"}}t.image_type=t.original_image_type="A"}else t.dynamicData["upload-type"]={prefix:"type_",value:t.mock.type,postfix:"_detailed"},t.dynamicData["upload-file"]={prefix:"file_",value:t.mock.value,postfix:"_detailed"};e.options.allowSorting&&(t.mock&&"existing"===t.mock.type?t.tygh.position=t.mock.position:t.tygh.position=null!==e.orderPositionCounter?++e.orderPositionCounter:e.orderPositionCounter=0,t.dynamicData["image-position"]={name:"position",value:t.tygh.position,postfix:"_data"}),void 0!==t.mock&&"existing"===t.mock.type||e.newAttachedFilesCounter++,e.files.push(t),e.newAttachedFilesCounter&&(e.filesGotChanged=!0),e._isMainImagePair(t)&&e._markFileAsMain(t),e.options.allowSorting&&e.elements.$filesContainerEl.sortable("refresh"),e.refreshPreview(t),e.registerCustomRemoveEvent(t),e.registerCustomAltUpdateEvent(t),e.expandAltTextarea(t)})},getImageDataIndex:function(e){return e.mock&&"existing"===e.mock.type?e.mock.index:this.newAttachedFilesCounter},registerExistingFiles:function(){var e=this;this.options.existingFiles.forEach(function(e,t){e.index=t}),this.options.existingFiles.sort(function(e,t){var a=Number(e.position)-Number(t.position);return 0===a&&(a=e.index-t.index),a}),o.a.each(this.options.existingFiles,function(){var t=e.options.existingPairThumbnails[this.pair_id];if(e.orderPositionCounter=Math.max(e.orderPositionCounter,Number(this.position)),this.detailed_id&&this.detailed||this.image_id&&this.icon){var a={name:null,size:null,mock:{type:"existing",index:this.pair_id,position:Number(this.position),existingPair:this}};e.dropzone.emit("addedfile",a),e.dropzone.emit("complete",a),t.detailed?e.dropzone.emit("thumbnail",a,t.detailed.image_path):t.icon&&e.dropzone.emit("thumbnail",a,t.icon.image_path)}})},expandAltTextarea:function(e){var t=e.previewElement,a=o()(t).find(".file-uploader__file-control-menu"),i=o()(t).find("textarea"),n=function(){a.toggleClass("file-uploader__file-control-menu--expanded")};a.on("click",function(e){n(),i.focus().select()}),i.on("blur",function(e){n()})},registerCustomRemoveEvent:function(e){var t=this;o()(e.previewElement).find("[data-ca-dz-remove]").each(function(a,i){o()(i).on("click touch removefiles",function(e){return function(a){var i=o()(e.previewElement),n="";i.find(".cm-file-uploader-dynamic-field").prop("disabled",!0),i.find(".file-uploader__remove-overlay").removeClass("hidden"),i.find("[data-ca-dz-remove]").hide(),i.addClass("file-uploader__file--removed"),"mock"in e&&"existing"===e.mock.type&&(n=e.mock.existingPair.pair_id),e.removed=!0,e.dynamicData["image-remove"]={value:n,update_name:!1};var r=t.files.getFirstActive();t._isMainImagePair(r)&&(t._markFileAsMain(r),t.refreshPreview(r)),t.filesGotChanged=!0,t._markFileAsAdditional(e),t.refreshPreview(e)}}(e))}),o()(e.previewElement).find(".file-uploader__remove-button-recover").each(function(a,i){o()(i).on("click touch",function(e,a){return function(i){var n=o()(e.previewElement);n.find(".cm-file-uploader-dynamic-field").prop("disabled",!1),n.find(".file-uploader__remove-overlay").addClass("hidden"),n.find("[data-ca-dz-remove]").css("display",""),n.removeClass("file-uploader__file--removed"),e.removed=!1,e.dynamicData["image-remove"]={value:"",update_name:!1},t._isMainImagePair(e)&&(t._changeMainFileToAdditional(),t._markFileAsMain(e)),t.filesGotChanged=!0,a.refreshPreview(e)}}(e,t))})},registerCustomAltUpdateEvent:function(e){var t=this;o()(e.previewElement).find(".file-uploader__file-description-input").on("keyup",function(){e.dynamicData["alt-text-detailed"].value=o()(this).val(),t.refreshPreview(e)})},refreshPreview:function(e){if("dynamicData"in e){var t=this,a=o()(e.previewElement),i=["[",e.tygh.index,"]"].join("");o.a.each(e.dynamicData,function(n,r){var s=a.find(["[data-ca-",n,"]"].join("")),l=t.options.imagePairTypes[e.image_type];if(!1!==r.update_name){var c=[r.prefix,l,r.postfix,i].filter(function(e){return void 0!==e});r.name&&c.push(["[",r.name,"]"].join("")),s.attr("name",c.join(""))}o()(s).val(r.value),"defaultValue"in r&&s.length&&(s.get(0).defaultValue=r.value)});var n=a.find("[data-ca-preview-detailed]");e.previewLink?(n.attr("href",e.previewLink),n.show()):n.hide(),e.tygh.$sortingPositionInput=o()("[data-ca-image-position]",a)}},runElfinderFilePickerModal:function(){var e=this;o.a.fn.elfinder?this._initElfinderFilePickerModal():(o.a.loadCss(["js/lib/elfinder/css/elfinder.min.css"]),o.a.loadCss(["js/lib/elfinder/css/theme.css"]),o.a.getScript("js/lib/elfinder/js/elfinder.min.js",function(){e._initElfinderFilePickerModal()}))},_initElfinderFilePickerModal:function(){var e=this,t=o.a.ceDialog("get_last").parent(".ui-front").css("z-index"),a=o()('<div id="server_file_browser"></div>'),i=o.a.extend(ft.fileManagerOptions,{url:fn_url("elf_connector.files?security_hash="+ft.security_hash),cutURL:ft.allowed_file_path,getFileCallback:function(t){a.dialog("close"),e.registerFileFromElfinder(t)}}),n=a.elfinder(i).dialog({width:900,height:500,modal:!0,title:ft.tr("file_browser"),close:function(e,t){a.dialog("destroy").elfinder("destroy").remove()}});t&&n.closest(".ui-dialog").css("z-index",t+1)},registerFileFromElfinder:function(e){var t=e.path.split("/");t.shift();var a=t.join("/"),i={name:e.name,size:Number(e.size),type:e.mime,lastModified:e.ts,mock:{type:"server",value:a}};e.height&&(i.height=Number(e.height)),e.width&&(i.width=Number(e.width)),this.dropzone.emit("addedfile",i),this.dropzone.emit("complete",i),this.dropzone.emit("thumbnail",i,e.url)},isUploadingInProgress:function(){return this.files.isUploadingInProgress()},_markFileAsMain:function(e){e.image_type="M",e.dynamicData["image-type"]={name:"type",value:"M",postfix:"_data"}},_markFileAsAdditional:function(e){e.image_type=e.original_image_type,e.dynamicData["image-type"]={name:"type",value:"A",postfix:"_data"}},_changeMainFileToAdditional:function(){var e=this.files.getMainFile();e&&(this._markFileAsAdditional(e),this.refreshPreview(e))},_isMainImagePair:function(e){var t=this.files.getFirstActive();return t&&o()(e.previewElement).is(o()(t.previewElement))},_validateUrl:function(e){e.includes("://")||(e="http://"+e);return/^[A-Za-z]+:\/\/[A-Za-z0-9-_:@]+\.[A-Za-z0-9-+_%~&\\?\/.=()]+$/.test(e)},_expandDropzone:function(){this.elements.$uploaderPickers.hasClass(this.options.expandedDropzoneSelector)||this.elements.$uploaderPickers.addClass(this.options.expandedDropzoneSelector)},_shrinkDropzone:function(){this.elements.$uploaderPickers.removeClass(this.options.expandedDropzoneSelector)},_moveDropzoneToEnd:function(){var e=this.elements;e.$filesContainerEl.append(e.$uploaderPickers)}});var gt=function(e){return e.data("caContainedFileUploaders")||[]},vt=function(e,t){e.data("caContainedFileUploaders",t)};function Et(e){e.length&&o.a.ceEvent("on","ce.commoninit",function(e){o.a.ceEvent("on","ce.form.beforeSubmit",function(e,t,a){var i=gt(e),n=!1;return o.a.each(i,function(){this.isUploadingInProgress()&&(n=!0)}),n?(o.a.ceNotification("show",{type:"W",title:ft.tr("warning"),message:ft.tr("file_uploading_in_progress_please_wait")}),!1):a}),function(e){var t=o.a.Deferred();o.a.fn.file_uploader?t.resolve():o.a.getScript("js/lib/dropzone/dist/dropzone.js",t.resolve),Promise.resolve(t).then(function(){o()(".cm-file-uploader",e).each(function(){new mt(o()(this),e).init()})}),t.promise()}(e)})}m.a;var bt={init:function(){var e=o()(this);e.on("change",function(){var t=e.data("caAuthUserId"),a=e.data("caProductObjectPrefix"),i=e.data("caProductId"),n=e.prop("checked"),r="";if(!t){var s=o()("#product_notify_email_".concat(a).concat(i));if(s.length){var l=s.attr("placeholder"),c=s.val();if(!(r=c.length&&c!==l?"&email="+c:r).length)return}}if(t||!n){var _=o()('[name="product_form_'.concat(a).concat(i,'"]')).ceFormValidator("checkFields",!0,!1,!0),d=n?"Y":"N";_?o.a.ceAjax("request",fn_url("products.product_notifications?enable=".concat(d,"&product_id=").concat(i).concat(r)),{caching:!1}):e.prop("checked",!n)}})}},yt=m.a,Ct={init:function(){if(yt.deferred_scripts)for(var e=function(e){setTimeout(function(){o.a.getScript(yt.deferred_scripts[e].src,function(){o.a.ceEvent("trigger","ce.lazy_script_load_".concat(yt.deferred_scripts[e].event_suffix))})},yt.deferred_scripts[e].delay||3e3)},t=0;t<yt.deferred_scripts.length;t++)e(t)}},Dt=function(e){!function(e){e.ceScrollerMethods=T}(e),function(e){e.fn.ceDialog=function(t){return B[t]?B[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.dialog: method "+t+" does not exist"):B._init.apply(this,arguments)},e.ceDialog=function(t,a){if(a=a||{},"get_last"==t){if(0==q.length)return e();var i=e("#"+q[q.length-1]);return a.getWidget?i.dialog("widget"):i}if("fit_elements"==t)a.jelm.parents(".cm-picker-options-container").length&&e.ceDialog("get_last").data("dialog")._trigger("resize");else if("reload_parent"==t){i=a.jelm.closest(".ui-dialog-content");var n=e(".object-container",i);if(n.length||(i.wrapInner('<div class="object-container" />'),i.find(".object-container").prepend('<div class="cm-notification-container-dialog notification-container-dialog"/>')),i.length&&i.is(":visible")){var o=n.scrollTop();i.ceDialog("reload"),n.animate({scrollTop:o},0)}}else{if("inside_dialog"==t)return 0!=a.jelm.closest(".ui-dialog-content").length;if("get_params"==t){if(!a.length)return;var r={keepInPlace:a.hasClass("cm-dialog-keep-in-place"),nonClosable:a.hasClass("cm-dialog-non-closable"),scroll:a.data("caScroll")?a.data("caScroll"):"",titleTemplate:a.data("caDialogTemplate")||null,titleFirstChunk:a.data("caDialogTextFirst")||null,titleSecondChunk:a.data("caDialogTextSecond")||null,purpose:a.data("caDialogPurpose")||null};if(a.data("caDialogTitle")?r.title=a.data("caDialogTitle"):(r.title=a.prop("title")||e("#".concat(a.data("caTargetId"))).prop("title")||"",a.prop("title",r.title)),a.prop("href")&&(r.href=a.prop("href")),a.hasClass("cm-dialog-auto-size")?(r.width="auto",r.height="auto",r.dialogClass="dialog-auto-sized"):a.hasClass("cm-dialog-auto-width")?r.width="auto":a.hasClass("cm-dialog-auto-height")&&(r.height="auto"),a.hasClass("cm-dialog-switch-avail")&&(r.switch_avail=!0),a.hasClass("cm-dialog-destroy-on-close")&&(r.destroyOnClose=!0),a.hasClass("cm-dialog-destroy-nested-on-close")&&(r.destroyNestedOnClose=!0),0==e("#"+a.data("caTargetId")).length){var s=a.data("caDialogTitle")?a.data("caDialogTitle"):a.prop("title");e('<div class="hidden" title="'+s+'" id="'+a.data("caTargetId")+'">\x3c!--'+a.data("caTargetId")+"--\x3e</div>").appendTo(I.body)}return a.prop("href")&&a.data("caViewId")&&(r.view_id=a.data("caViewId")),a.data("caDialogClass")&&(r.dialogClass=a.data("caDialogClass")),a.data("caDialogContentRequestForm")&&(r.contentRequestForm=a.data("caDialogContentRequestForm")),a.data("caDialogActionContext")&&(r.actionContext=a.data("caDialogActionContext")),r}if("clear_stack"==t)return e.popupStack.clear_stack(),q=[];if("destroy_loaded"==t){var l=e("<div>").html(a.content);e.each(R,function(t,a){l.find("#"+a).length&&e("#"+a).ceDialog("destroy")})}}},e.extend({popupStack:{stack:[],add:function(e){return this.stack.push(e)},remove:function(e){var t=this.stack.indexOf(e);if(-1!=t)return this.stack.splice(t,1)},last_close:function(){var e=this.stack.pop();return!(!e||!e.close||(e.close(),0))},last:function(){return this.stack[this.stack.length-1]},close:function(e){var t=this.stack.indexOf(e);if(-1!=t){var a=this.stack.splice(t,1)[0];return a.close&&a.close(),!0}return!1},clear_stack:function(){return this.stack=[]}}})}(e),function(e){e.fn.ceAccordion=function(t){return L[t]?L[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.accordion: method "+t+" does not exist"):L.init.apply(this,arguments)},e.ceAccordion=function(t,a){if(L[t])return L[t].apply(this,Array.prototype.slice.call(arguments,1));e.error("ty.notification: method "+t+" does not exist")}}(e),function(e){e.fn.ceEditor=function(t){return F[t]?F[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.editor: method "+t+" does not exist"):F.run.apply(this,arguments)},e.ceEditor=function(e,t,a){if("push"==e){if(!t)return K.unshift();K.push(t)}else if("state"==e){if(!t)return W;if(W=t,"loaded"==t&&K.length){for(var i=0;i<K.length;i++)K[i].ceEditor("run",a);K=[]}}else if("handlers"==e)U=t;else if("run"==e||"destroy"==e||"updateTextFields"==e||"recover"==e||"val"==e||"disable"==e||"insert"==e)return U[e](t,a)}}(e),function(e){e.fn.cePreviewer=function(t){return z[t]?z[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.previewer: method "+t+" does not exist"):z.run.apply(this,arguments)},e.cePreviewer=function(e,t){if("handlers"==e)this.handlers=t;else if("display"==e)return this.handlers[e](t)}}(e),function(e){e.fn.ceProgress=function(t){return H[t]?H[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.progress: method "+t+" does not exist"):H.init.apply(this,arguments)}}(e),function(e){e.ceHistory=function(t){if(G[t])return G[t].apply(this,Array.prototype.slice.call(arguments,1));e.error("ty.history: method "+t+" does not exist")}}(e),function(e){e.fn.ceHint=function(t){return Y[t]?Y[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.hint: method "+t+" does not exist"):Y.run.apply(this,arguments)}}(e),function(e){e.fn.ceTooltip=function(t){return Z[t]?Z[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.tooltip: method "+t+" does not exist"):Z.init.apply(this,arguments)}}(e),function(e){e.fn.ceSortable=function(t){return X[t]?X[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.sortable: method "+t+" does not exist"):X.init.apply(this,arguments)}}(e),function(e){e.fn.ceColorpicker=function(t){return ee[t]?ee[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.colorpicker: method "+t+" does not exist"):ee.init.apply(this,arguments)}}(e),function(e){e.fn.ceContentMore=function(t){return e(this).each(function(e,a){(ae[t]||ae.init).apply(this,Array.prototype.slice.call(arguments,1))})}}(e),function(e){e.fn.ceFormValidator=function(t){var a,i=arguments;return e(this).each(function(n,o){fe[t]?a=fe[t].apply(this,Array.prototype.slice.call(i,1)):"object"!==Object(r.a)(t)&&t?e.error("ty.formvalidator: method "+t+" does not exist"):a=fe.init.apply(this,i)}),a},e.ceFormValidator=function(t,a){if(a=a||{},"setZipcode"==t)ne=a;else if("setRegexp"==t)"console"in window&&console.log('This method is deprecated, use data-attributes "data-ca-regexp" and "data-ca-message" instead'),oe=e.extend(oe,a);else if("registerValidator"==t)re.push(a);else if("check"==t&&a.form)return void 0===a.only_check&&(a.only_check=!0),fe.check.apply(a.form,[a.only_check])}}(e),function(e){e.fn.ceRebuildStates=function(t){var a=arguments;return e(this).each(function(i,n){return be[t]?be[t].apply(this,Array.prototype.slice.call(a,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.rebuildstates: method "+t+" does not exist"):be.init.apply(this,a)})},e.ceRebuildStates=function(e,t){t=t||{},"init"==e&&(me=t)}}(e),function(e){e.fn.ceStickyScroll=function(t){return ye[t]?ye[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.stickyScroll: method "+t+" does not exist"):ye.init.apply(this,arguments)}}(e),function(e){e.ceNotification=function(t){if(ke[t])return ke[t].apply(this,Array.prototype.slice.call(arguments,1));e.error("ty.notification: method "+t+" does not exist")}}(e),function(e){e.ceEvent=function(t){if(xe[t])return xe[t].apply(this,Array.prototype.slice.call(arguments,1));e.error("ty.event: method "+t+" does not exist")}}(e),function(e){e.fn.ceCodeEditor=function(t){return Te[t]?Te[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.codeeditor: method "+t+" does not exist"):Te.init.apply(this,arguments)}}(e),function(e){e.fn.ceObjectSelector=function(t){var a=this,i=function(){var i=e.fn.select2.amd.require("select2/selection/multiple"),n=e.fn.select2.amd.require("select2/selection/search"),o=i.prototype.bind;return i.prototype.bind=function(t,a){this.$selection.on("click",function(t){e(t.target).hasClass("select2-search__field")||e(t.target).hasClass("select2-selection__rendered")||t.stopImmediatePropagation()}),o.apply(this,arguments)},n.prototype.searchRemoveChoice=function(){return!1},a.each(function(){if(e.data(this,"plugin_ceObjectSelector")){var a=e.data(this,"plugin_ceObjectSelector");a.settings=e.extend({},Be,t),a.init()}else e.data(this,"plugin_ceObjectSelector",new qe(this,t))})};if(this.length){if(e.fn.select2)return i();e.getScript("js/lib/select2/dist/js/select2.full.min.js",function(){i()})}return this}}(e),function(e){e.fn.ceInsertAtCaret=function(){return Se.init.apply(this,arguments)}}(e),function(e){e.fn.ceSwitchCheckbox=function(t){return Le[t]?Le[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.switchcheckbox: method "+t+" does not exist"):Le.init.apply(this,arguments)}}(e),function(e){e.fn.ceCheckboxGroup=function(t){var a=arguments;return e(this).each(function(i,n){return Ue[t]?Ue[t].apply(this,Array.prototype.slice.call(a,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.checkboxGroup: method "+t+" does not exist"):Ue.init.apply(this,a)})}}(e),function(e){e.fn.ceBlockManager=function(t){return Ne[t]?Ne[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.accordion: method "+t+" does not exist"):Ne.init.apply(this,arguments)},e.ceBlockManager=function(t,a){if(Ne[t])return Ne[t].apply(this,Array.prototype.slice.call(arguments,1));e.error("ty.notification: method "+t+" does not exist")}}(e),Object(x.createPlugin)("ceBlockLoader",Ve,"ce.block_loader",!0),st(e),function(e){e.fn.ceTableSortable=function(){0!==e('[data-ca-sortable="true"]').length&&e.getScript("js/lib/tablesorter/jquery.tablesorter.combined.min.js",function(){e('[data-ca-sortable-column="false"]').data("sorter",!1),e('[data-ca-sortable="true"]').each(function(t,a){var i=e(a);i.tablesorter({sortList:i.data("caSortList")||[[0,0]],emptyTo:i.data("caEmptyTo")||"emptyMin",widgets:["saveSort"],saveSort:!0,widgetOptions:{storage_useSessionStorage:!0}})})})}}(e),function(e){e.fn.ceNotificationReceiversEditor=function(t){for(var a=arguments.length,i=new Array(a>1?a-1:0),n=1;n<a;n++)i[n-1]=arguments[n];return t&&"init"!==t?function(){}.apply(void 0,[e(this),t].concat(i)):_t(e(this),i[0]),e(this)}}(e),function(e){e.fn.ceInlineDialog=function(t){if(t||(t="init"),pt[t])return pt[t].apply(this,Array.prototype.slice.call(arguments,1));e.error("ty.inlineDialog: method "+t+" does not exist")}}(e),function(e){e.fn.ceFileUploader=function(){return Et(e(this)),e(this)}}(e),function(e){e.fn.ceBackInStockNotificationSwitcher=function(t){return bt[t]?bt[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(r.a)(t)&&t?void e.error("ty.backinstocknotificationswitcher: method "+t+" does not exist"):bt.init.apply(this,arguments)}}(e),function(e){e.ceLazyLoader=function(t){if(Ct[t])return Ct[t].apply(this,Array.prototype.slice.call(arguments,1));e.error("ty.lazyloader: method "+t+" does not exist")}}(e)};String.prototype.str_replace=function(e,t){return this.toString().split(e).join(t)},String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}),window.Tygh=m.a,window.fn_print_r=s,window.fn_alert=l,window.fn_print_array=c,window.fn_url=_,window.fn_strip_tags=d,window.fn_reload_form=u,window.fn_get_listed_lang=p,window.fn_query_remove=f,window.fn_calculate_total_shipping=h,function(e,t){if(e.$=t,t.fn.extend({select2Sortable:v,toggleBy:E,moveOptions:b,swapOptions:y,selectOptions:C,alignElement:D,formIsChanged:j,fieldIsChanged:O,disableFields:P,click:w,switchAvailability:M,serializeObject:k,positionElm:A}),t.extend(x),Dt(t),function(e){var t=!0,a={"screen--xs":[0,350],"screen--xs-large":[350,480],"screen--sm":[481,767],"screen--sm-large":[768,1024],"screen--md":[1024,1280],"screen--md-large":[1280,1440],"screen--lg":[1440,1920],"screen--uhd":[1920,9999]},i=e.debounce(function(i){var n={old:"",new:""},o=e(window).width();for(var r in a){e("body").hasClass(r)&&(n.old=r,e("body").removeClass(r));var s=a[r];o>=s[0]&&o<=s[1]&&(e("body").addClass(r),n.new=r)}e.ceEvent("trigger","ce.window.resize",[i,n]),t&&(t=!1,e.ceEvent("trigger","ce.responsive_classes.ready",[]))});e.ceEvent("on","ce.commoninit",function(){e(window).on("resize",i),e(window).trigger("resize")})}(t),!e.embedded&&location.hash&&0===decodeURIComponent(location.hash).indexOf("#!/")){var a=t.parseUrl(location.href),i=t.ceHistory("parseHash",location.hash);t.redirect(a.protocol+"://"+a.host+a.directory+i)}}(m.a,o.a)},4:function(e,t,a){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}a.d(t,"a",function(){return i})},5:function(e,t,a){"use strict";function i(e,t){for(var a=0;a<t.length;a++){var i=t[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function n(e,t,a){return t&&i(e.prototype,t),a&&i(e,a),e}a.d(t,"a",function(){return n})},8:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,"lastClickedElement",function(){return lastClickedElement}),__webpack_require__.d(__webpack_exports__,"getWindowSizes",function(){return getWindowSizes}),__webpack_require__.d(__webpack_exports__,"disable_elms",function(){return disable_elms}),__webpack_require__.d(__webpack_exports__,"ua",function(){return ua}),__webpack_require__.d(__webpack_exports__,"is",function(){return is}),__webpack_require__.d(__webpack_exports__,"cookie",function(){return cookie}),__webpack_require__.d(__webpack_exports__,"redirect",function(){return redirect}),__webpack_require__.d(__webpack_exports__,"dispatchEvent",function(){return dispatchEvent}),__webpack_require__.d(__webpack_exports__,"runCart",function(){return runCart}),__webpack_require__.d(__webpack_exports__,"commonInit",function(){return commonInit}),__webpack_require__.d(__webpack_exports__,"afterLoad",function(){return afterLoad}),__webpack_require__.d(__webpack_exports__,"processForms",function(){return processForms}),__webpack_require__.d(__webpack_exports__,"formatPrice",function(){return formatPrice}),__webpack_require__.d(__webpack_exports__,"formatNum",function(){return formatNum}),__webpack_require__.d(__webpack_exports__,"utf8Encode",function(){return utf8Encode}),__webpack_require__.d(__webpack_exports__,"crc32",function(){return crc32}),__webpack_require__.d(__webpack_exports__,"rc64_helper",function(){return rc64_helper}),__webpack_require__.d(__webpack_exports__,"utf8_decode",function(){return utf8_decode}),__webpack_require__.d(__webpack_exports__,"rc64",function(){return rc64}),__webpack_require__.d(__webpack_exports__,"toggleStatusBox",function(){return toggleStatusBox}),__webpack_require__.d(__webpack_exports__,"scrollToElm",function(){return scrollToElm}),__webpack_require__.d(__webpack_exports__,"stickyFooter",function(){return stickyFooter}),__webpack_require__.d(__webpack_exports__,"showPickerByAnchor",function(){return showPickerByAnchor}),__webpack_require__.d(__webpack_exports__,"ltrim",function(){return ltrim}),__webpack_require__.d(__webpack_exports__,"rtrim",function(){return rtrim}),__webpack_require__.d(__webpack_exports__,"loadCss",function(){return loadCss}),__webpack_require__.d(__webpack_exports__,"loadAjaxContent",function(){return loadAjaxContent}),__webpack_require__.d(__webpack_exports__,"ajaxLink",function(){return ajaxLink}),__webpack_require__.d(__webpack_exports__,"isJson",function(){return isJson}),__webpack_require__.d(__webpack_exports__,"isMobile",function(){return isMobile}),__webpack_require__.d(__webpack_exports__,"isUndefined",function(){return isUndefined}),__webpack_require__.d(__webpack_exports__,"debounce",function(){return debounce}),__webpack_require__.d(__webpack_exports__,"matchScreenSize",function(){return matchScreenSize}),__webpack_require__.d(__webpack_exports__,"createPlugin",function(){return createPlugin}),__webpack_require__.d(__webpack_exports__,"sprintf",function(){return sprintf}),__webpack_require__.d(__webpack_exports__,"parseUrl",function(){return parseUrl}),__webpack_require__.d(__webpack_exports__,"attachToUrl",function(){return attachToUrl}),__webpack_require__.d(__webpack_exports__,"matchClass",function(){return matchClass}),__webpack_require__.d(__webpack_exports__,"getProcessItemsMeta",function(){return getProcessItemsMeta}),__webpack_require__.d(__webpack_exports__,"getTargetForm",function(){return getTargetForm}),__webpack_require__.d(__webpack_exports__,"checkSelectedItems",function(){return checkSelectedItems}),__webpack_require__.d(__webpack_exports__,"submitForm",function(){return submitForm}),__webpack_require__.d(__webpack_exports__,"externalLink",function(){return externalLink}),__webpack_require__.d(__webpack_exports__,"toggleCombination",function(){return toggleCombination}),__webpack_require__.d(__webpack_exports__,"toggleCheckbox",function(){return toggleCheckbox}),__webpack_require__.d(__webpack_exports__,"performPostRequest",function(){return performPostRequest});var _tmp_ipac_builder_CsCartMultivendor_195356_911_repo_js_core_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(2),jquery__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(0),jquery__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__),___WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(1),_=___WEBPACK_IMPORTED_MODULE_2__.a;!function(e){var t=navigator.userAgent.toLowerCase(),a=/(edge)[ \/]([\w.]+)/.exec(t)||/(chrome)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+)/.exec(t)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||(/(trident\/7.0;)/.exec(t)?[null,"msie","11"]:void 0)||t.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(t)||[],i={browser:a[1]||"",version:a[2]||"0"},n={};i.browser&&(n[i.browser]=!0,n.version=i.version),n.chrome?n.webkit=!0:n.webkit&&(n.safari=!0),e.browser=n}(jquery__WEBPACK_IMPORTED_MODULE_1___default.a);var lastClickedElement=null,getWindowSizes=function(){var e=document.compatMode&&"BackCompat"!=document.compatMode?document.documentElement:document.body;return{offset_x:e.scrollLeft?e.scrollLeft:self.pageXOffset?self.pageXOffset:0,offset_y:e.scrollTop?e.scrollTop:self.pageYOffset?self.pageYOffset:0,view_height:self.innerHeight?self.innerHeight:e.clientHeight,view_width:self.innerWidth?self.innerWidth:e.clientWidth,height:e.scrollHeight?e.scrollHeight:window.height,width:e.scrollWidth?e.scrollWidth:window.width}},disable_elms=function(e,t){jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+e.join(",#")).prop("disabled",t)},ua={version:navigator.userAgent.toLowerCase().indexOf("chrome")>=0?(navigator.userAgent.match(/.+(?:chrome)[\/: ]([\d.]+)/i)||[])[1]:navigator.userAgent.toLowerCase().indexOf("msie")>=0?(navigator.userAgent.match(/.*?msie[\/:\ ]([\d.]+)/i)||[])[1]:(navigator.userAgent.match(/.+(?:it|pera|irefox|ersion)[\/: ]([\d.]+)/i)||[])[1],browser:navigator.userAgent.toLowerCase().indexOf("chrome")>=0?"Chrome":jquery__WEBPACK_IMPORTED_MODULE_1___default.a.browser.safari?"Safari":jquery__WEBPACK_IMPORTED_MODULE_1___default.a.browser.opera?"Opera":jquery__WEBPACK_IMPORTED_MODULE_1___default.a.browser.msie?"Internet Explorer":"Firefox",os:-1!=navigator.platform.toLowerCase().indexOf("mac")?"MacOS":-1!=navigator.platform.toLowerCase().indexOf("win")?"Windows":"Linux",language:navigator.language?navigator.language:navigator.browserLanguage?navigator.browserLanguage:navigator.userLanguage?navigator.userLanguage:navigator.systemLanguage?navigator.systemLanguage:""},is={email:function(e){return!!/^([^@\s]+<?)([^@\s]*)@(([^@\.\s]+?)|([^@\s]+?\.[^@\s]+?))(>?)$/i.test(e)},blank:function(e){return!!(jquery__WEBPACK_IMPORTED_MODULE_1___default.a.isArray(e)&&0==e.length||"null"===jquery__WEBPACK_IMPORTED_MODULE_1___default.a.type(e)||""==(""+e).replace(/[\n\r\t]/gi,""))},integer:function(e){return!(!/^[0-9]+$/.test(e)||jquery__WEBPACK_IMPORTED_MODULE_1___default.a.is.blank(e))},rgbColor:function(e){return/^(rgb)\((\d*)(,|,*)(\d*)(,|,*)(\d*)\)$/.test(e)},rgbaColor:function(e){return/^(rgba)\((\d*)(,|,*)(\d*)(,|,*)(\d*)(,|,*)(\d*|\d.\d*)\)$/.test(e)},hex6Color:function(e){return/^\#[0-9a-fA-F]{6}$/.test(e)},color:function(e){return jquery__WEBPACK_IMPORTED_MODULE_1___default.a.is.rgbColor(e)||jquery__WEBPACK_IMPORTED_MODULE_1___default.a.is.rgbaColor(e)||jquery__WEBPACK_IMPORTED_MODULE_1___default.a.is.hex6Color(e)},phone:function(e){return!(!/^[\s()+-]*([0-9][\s()+-]*){6,20}$/.test(e)||!e.length)}},cookie={get:function(e){for(var t=e+"=",a=t.length,i=document.cookie.length,n=0;n<i;){var o=n+a;if(document.cookie.substring(n,o)==t){var r=document.cookie.indexOf(";",o);return-1==r&&(r=document.cookie.length),decodeURI(document.cookie.substring(o,r))}if(0==(n=document.cookie.indexOf(" ",n)+1))break}return null},set:function(e,t,a,i,n,o){document.cookie=e+"="+encodeURIComponent(t)+(a?"; expires="+a.toGMTString():"")+(i?"; path="+i:"")+(n?"; domain="+n:"")+(o?"; secure":"")},remove:function(e,t,a){jquery__WEBPACK_IMPORTED_MODULE_1___default.a.cookie.get(e)&&(document.cookie=e+"="+(t?"; path="+t:"")+(a?"; domain="+a:"")+"; expires=Thu, 01-Jan-70 00:00:01 GMT")}},redirect=function(e,t){t=t||!1,jquery__WEBPACK_IMPORTED_MODULE_1___default()("base").length&&0!=e.indexOf("/")&&0!==e.indexOf("http")&&(e=jquery__WEBPACK_IMPORTED_MODULE_1___default()("base").prop("href")+e),_.embedded?jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceAjax("request",e,{result_ids:_.container}):t?window.location.replace(e):window.location.href=e},dispatchEvent=function dispatchEvent(e){var jelm=jquery__WEBPACK_IMPORTED_MODULE_1___default()(e.target),elm=e.target,s;if(e.which=e.which||1,("click"==e.type||"mousedown"==e.type)&&jquery__WEBPACK_IMPORTED_MODULE_1___default.a.browser.mozilla&&1!=e.which)return!0;var processed={status:!1,to_return:!0};if(jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("trigger","dispatch_event_pre",[e,jelm,processed]),processed.status)return processed.to_return;if("click"==e.type){if(jquery__WEBPACK_IMPORTED_MODULE_1___default.a.getProcessItemsMeta(elm)){if(!jquery__WEBPACK_IMPORTED_MODULE_1___default.a.checkSelectedItems(elm))return!1}else if((jelm.hasClass("cm-confirm")||jelm.parents().hasClass("cm-confirm"))&&!jelm.parents().hasClass("cm-skip-confirmation")){var confirm_text=_.tr("text_are_you_sure_to_proceed"),$parent_confirm;if(jelm.hasClass("cm-confirm")&&jelm.data("ca-confirm-text")?confirm_text=jelm.data("ca-confirm-text"):($parent_confirm=jelm.parents('[class="cm-confirm"][data-ca-confirm-text]').first(),$parent_confirm.get(0)&&(confirm_text=$parent_confirm.data("ca-confirm-text"))),!1===confirm(fn_strip_tags(confirm_text)))return!1;jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("trigger","ce.form_confirm",[jelm])}if(jquery__WEBPACK_IMPORTED_MODULE_1___default.a.lastClickedElement=jelm,jelm.hasClass("cm-select-bm-block")||jelm.parent(".cm-select-bm-block").length){var _elm2=jelm.hasClass("cm-select-bm-block")?jelm:jelm.parent(".cm-select-bm-block"),data=jquery__WEBPACK_IMPORTED_MODULE_1___default()(_elm2).data();return jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("trigger","ce.bm.block.selected",[data]),!0}if(jelm.hasClass("cm-disabled")||jelm.parents(".cm-disabled").length)return!1;if(jelm.hasClass("cm-delete-row")||jelm.parents(".cm-delete-row").length){var holder;if(jelm.is("tr")||jelm.hasClass("cm-row-item"))holder=jelm;else if(jelm.parents(".cm-row-item").length)holder=jelm.parents(".cm-row-item:first");else{if(!jelm.parents("tr").length||jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-picker",jelm.parents("tr:first")).length)return!1;holder=jelm.parents("tr:first")}jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-combination[id^=off_]",holder).click(),holder.parent("tbody.cm-row-item").length&&(holder=holder.parent("tbody.cm-row-item")),jelm.hasClass("cm-ajax")||jelm.parents(".cm-ajax").length?(jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceAjax("clearCache"),holder.remove()):holder.hasClass("cm-opacity")?(jquery__WEBPACK_IMPORTED_MODULE_1___default()(":input",holder).each(function(){jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).prop("name",jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).data("caInputName"))}),holder.removeClass("cm-delete-row cm-opacity")):(jquery__WEBPACK_IMPORTED_MODULE_1___default()(":input[name]",holder).each(function(){var e=jquery__WEBPACK_IMPORTED_MODULE_1___default()(this),t=e.prop("name");e.data("caInputName",t).attr("data-ca-input-name",t).prop("name","")}),holder.addClass("cm-delete-row cm-opacity"))}if(jelm.hasClass("cm-save-and-close")&&jelm.parents("form:first").append('<input type="hidden" name="return_to_list" value="Y" />'),jelm.hasClass("cm-new-window")&&jelm.prop("href")||jelm.closest(".cm-new-window")&&jelm.closest(".cm-new-window").prop("href")){var _e=jelm.hasClass("cm-new-window")?jelm.prop("href"):jelm.closest(".cm-new-window").prop("href");return window.open(_e),!1}if(jelm.hasClass("cm-select-text"))if(jelm.data("caSelectId")){var c_elm=jelm.data("caSelectId");c_elm&&jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+c_elm).length&&jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+c_elm).select()}else jelm.get(0).select();if(jelm.hasClass("cm-external-click")||jelm.parents(".cm-external-click").length){var _e=jelm.hasClass("cm-external-click")?jelm:jelm.parents(".cm-external-click:first"),c_elm=_e.data("caExternalClickId");c_elm&&jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+c_elm).length&&jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+c_elm).click();var opt={need_scroll:!0,jelm:_e,timeout:0};jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("trigger","ce.needScroll",[opt]),_e.data("caScroll")&&opt.need_scroll&&(opt.timeout?setTimeout(function(){jquery__WEBPACK_IMPORTED_MODULE_1___default.a.scrollToElm(_e.data("caScroll"))},opt.timeout):jquery__WEBPACK_IMPORTED_MODULE_1___default.a.scrollToElm(_e.data("caScroll")))}if(jelm.closest(".cm-dialog-opener").length){var _e=jelm.closest(".cm-dialog-opener"),params=jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceDialog("get_params",_e);return jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+_e.data("caTargetId")).ceDialog("open",params),!1}if("modal"==jelm.data("toggle")&&jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceDialog("get_last").length){var href=jelm.prop("href"),target=jquery__WEBPACK_IMPORTED_MODULE_1___default()(jelm.data("target")||href&&href.replace(/.*(?=#[^\s]+$)/,""));if(target.length){var $dialog=jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceDialog("get_last").parent(".ui-front"),minZ=$dialog.css("z-index");target.css("z-index",minZ+2),target.on("shown",function(){jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).data("modal").$backdrop.css("z-index",minZ+1)})}}if(jelm.hasClass("cm-cancel")){var form=jelm.parents("form");form.length&&(form.get(0).reset(),_.fileuploader&&_.fileuploader.clean_form(),form.find(".error-message").remove(),form.find("input[checked]").change(),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("trigger","ce.cm_cancel.clean_form",[form,jelm]))}if(jelm.hasClass("cm-scroll")&&jelm.data("caScroll")&&jquery__WEBPACK_IMPORTED_MODULE_1___default.a.scrollToElm(jelm.data("caScroll")),"Y"==_.changes_warning&&jelm.parents(".cm-confirm-changes").length&&jelm.parents("form").length&&jelm.parents("form:first").formIsChanged()&&!1===confirm(fn_strip_tags(_.tr("text_changes_not_saved"))))return!1;if(jelm.hasClass("cm-check-items")||jelm.parents(".cm-check-items").length){var check_disabled=jelm.hasClass("cm-check-disabled"),disabled_state=check_disabled?"":":disabled",container_selector=jquery__WEBPACK_IMPORTED_MODULE_1___default()(elm).data("caContainer"),elms_container=container_selector&&jquery__WEBPACK_IMPORTED_MODULE_1___default()(container_selector).length?jquery__WEBPACK_IMPORTED_MODULE_1___default()(container_selector):elm.form;elms_container||(elms_container=jelm.parents("form:first"));var item_class=".cm-item"+(jelm.data("caTarget")?"-"+jelm.data("caTarget"):"");if(jelm.data("caStatus")){var items=jquery__WEBPACK_IMPORTED_MODULE_1___default()("input"+item_class+"[type=checkbox]:not("+disabled_state+")",elms_container);jelm.hasClass("cm-skip-unselect-all")||(items.prop("checked",!1),items.trigger("change")),item_class+=".cm-item-status-"+jelm.data("caStatus")}var inputs=jquery__WEBPACK_IMPORTED_MODULE_1___default()("input"+item_class+"[type=checkbox]:not("+disabled_state+")",elms_container);if(inputs.length){var flag=!0;jelm.is("[type=checkbox]")&&(flag=jelm.prop("checked")),jelm.hasClass("cm-on")?flag=!0:jelm.hasClass("cm-off")&&(flag=!1),inputs.prop("checked",flag),inputs.trigger("change")}}else{if(jelm.hasClass("cm-promo-popup")||jelm.parents(".cm-promo-popup").length)return jquery__WEBPACK_IMPORTED_MODULE_1___default()("#restriction_promo_dialog").ceDialog("open",{width:"auto",height:"auto",dialogClass:"restriction-promo"}),e.stopPropagation(),!1;if("submit"==jelm.prop("type")||jelm.closest("button[type=submit]").length){var _jelm=jelm.is("input,button")?jelm:jelm.closest("button[type=submit]");return jquery__WEBPACK_IMPORTED_MODULE_1___default()(_jelm.prop("form")).ceFormValidator("setClicked",_jelm),1==_jelm.length&&null==_jelm.prop("form")?jquery__WEBPACK_IMPORTED_MODULE_1___default.a.submitForm(_jelm):!_jelm.hasClass("cm-no-submit")}if(jelm.closest("a.cm-ajax[href]").length)return jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ajaxLink(e);if(jelm.parents(".cm-reset-link").length||jelm.hasClass("cm-reset-link")){var frm=jelm.parents("form:first");jquery__WEBPACK_IMPORTED_MODULE_1___default()("[type=checkbox]",frm).prop("checked",!1).change(),jquery__WEBPACK_IMPORTED_MODULE_1___default()("input[type=text], input[type=password], input[type=file]",frm).val(""),jquery__WEBPACK_IMPORTED_MODULE_1___default()("select",frm).each(function(){jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).val(jquery__WEBPACK_IMPORTED_MODULE_1___default()("option:first",this).val()).change()});var radio_names=[];return jquery__WEBPACK_IMPORTED_MODULE_1___default()("input[type=radio]",frm).each(function(){-1==jquery__WEBPACK_IMPORTED_MODULE_1___default.a.inArray(this.name,radio_names)?(jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).prop("checked",!0).change(),radio_names.push(this.name)):jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).prop("checked",!1)}),!0}if(jelm.hasClass("cm-submit")||jelm.parents(".cm-submit").length){if(!jelm.is("select,input"))return jquery__WEBPACK_IMPORTED_MODULE_1___default.a.submitForm(jelm)}else{if(jelm.hasClass("cm-popup-switch")||jelm.parents(".cm-popup-switch").length)return jelm.parents(".cm-popup-box:first").hide(),!1;if(jquery__WEBPACK_IMPORTED_MODULE_1___default.a.matchClass(elm,/cm-combinations([-\w]+)?/gi)){var s=elm.className.match(/cm-combinations([-\w]+)?/gi)||jelm.parent().get(0).className.match(/cm-combinations(-[\w]+)?/gi),p_elm=jelm.prop("id")?jelm:jelm.parent(),class_group=s[0].replace(/cm-combinations/,""),id_group=p_elm.prop("id").replace(/on_|off_|sw_/,"");return jquery__WEBPACK_IMPORTED_MODULE_1___default()("#on_"+id_group).toggle(),jquery__WEBPACK_IMPORTED_MODULE_1___default()("#off_"+id_group).toggle(),0==p_elm.prop("id").indexOf("sw_")?jquery__WEBPACK_IMPORTED_MODULE_1___default()('[data-ca-switch-id="'+id_group+'"]').toggle():0==p_elm.prop("id").indexOf("on_")?jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-combination"+class_group+':visible[id^="on_"]').click():jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-combination"+class_group+':visible[id^="off_"]').click(),!0}if(jquery__WEBPACK_IMPORTED_MODULE_1___default.a.matchClass(elm,/cm-combination(-[\w]+)?/gi)||jelm.parents(".cm-combination").length){var toggleCombinationBool=toggleCombination(jelm);if(void 0!==toggleCombinationBool)return toggleCombinationBool}else{if((jelm.is(":not(:focusable)")||jelm.is("label"))&&(jelm.hasClass("cm-click-on-visible")||jelm.parents(".cm-click-on-visible").length)){var _data=jelm.parents(".cm-click-on-visible:first").data()||jelm.data(),clickAt=jquery__WEBPACK_IMPORTED_MODULE_1___default()(_.body);return clickAt=void 0!=_data.caSearchInner?jquery__WEBPACK_IMPORTED_MODULE_1___default()(_data.caSearchInnerContainer).find("".concat(_data.caTarget,":visible")):jquery__WEBPACK_IMPORTED_MODULE_1___default()("".concat(_data.caTarget,":visible")),clickAt.click(),!1}if((jelm.is("a.cm-increase, a.cm-decrease")||jelm.parents("a.cm-increase").length||jelm.parents("a.cm-decrease").length)&&jelm.parents(".cm-value-changer").length){var inp=jquery__WEBPACK_IMPORTED_MODULE_1___default()("input",jelm.closest(".cm-value-changer")),step=1,min_qty=0,currentValue=inp.val();inp.attr("data-ca-step")&&(step=parseInt(inp.attr("data-ca-step"))),inp.data("caMinQty")&&(min_qty=parseInt(inp.data("caMinQty")));var new_val=parseInt(inp.val())+(jelm.is("a.cm-increase")||jelm.parents("a.cm-increase").length?step:-step),newValue=new_val>min_qty?new_val:min_qty;inp.val(newValue),inp.keypress(),currentValue!=newValue&&inp.trigger("change");var trigger_name="ce.valuechangerincrease",trigger_params=[inp,step,min_qty,new_val];return jelm.is("a.cm-decrease")&&(trigger_name="ce.valuechangerdecrease"),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("trigger",trigger_name,trigger_params),!0}if(jelm.hasClass("cm-external-focus")||jelm.parents(".cm-external-focus").length){var f_elm=jelm.data("caExternalFocusId")?jelm.data("caExternalFocusId"):jelm.parents(".cm-external-focus:first").data("caExternalFocusId");f_elm&&jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+f_elm).length&&jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+f_elm).focus()}else{if(jelm.hasClass("cm-previewer")||jelm.parent().hasClass("cm-previewer")){var lnk=jelm.hasClass("cm-previewer")?jelm:jelm.parent();return lnk.cePreviewer("display"),!1}if(jelm.hasClass("cm-update-for-all-icon")){var object_ids=jelm.data("caDisableId"),disable=jelm.hasClass("visible");if(jelm.toggleClass("visible"),jelm.prop("title",jelm.data("caTitle"+(disable?"Disabled":"Active"))),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.isArray(object_ids)||(object_ids=[object_ids]),object_ids.forEach(function(e){jquery__WEBPACK_IMPORTED_MODULE_1___default()("#hidden_update_all_vendors_"+e).prop("disabled",disable)}),jelm.data("caHideId")){var parent_elm=jquery__WEBPACK_IMPORTED_MODULE_1___default()("#container_"+jelm.data("caHideId"));parent_elm.find(":input:visible").prop("disabled",disable),parent_elm.find(":input[type=hidden]").prop("disabled",disable),parent_elm.find("textarea.cm-wysiwyg").ceEditor("disable",disable),parent_elm.find(".cm-switch-checkbox").ceSwitchCheckbox("setActive",!disable)}var state_select_trigger=jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-state").parent().find(".cm-update-for-all-icon");jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+jelm.data("caHideId")).hasClass("cm-country")&&jelm.hasClass("visible")!=state_select_trigger.hasClass("visible")&&state_select_trigger.click();var country_select_trigger=jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-country").parent().find(".cm-update-for-all-icon");jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+jelm.data("caHideId")).hasClass("cm-state")&&jelm.hasClass("visible")!=country_select_trigger.hasClass("visible")&&country_select_trigger.click()}else{if((jelm.hasClass("cm-toggle-checked")||jelm.parents(".cm-toggle-checked").length)&&!jelm.is('input[type="checkbox"]')&&!jelm.is('input[type="radio"]')){var $target=jquery__WEBPACK_IMPORTED_MODULE_1___default()(jelm.data("caTarget")||jelm.parents(".cm-toggle-checked:first").data("caTarget"));return toggleCheckbox($target),!1}if(jelm.hasClass("cm-toggle-checkbox"))jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-toggle-element").prop("disabled",!jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-toggle-checkbox").prop("checked"));else if(jelm.hasClass("cm-back-link")||jelm.parents(".cm-back-link").length)window.history.back();else if(jelm.closest(".cm-post").length){var _elm=jelm.closest(".cm-post");if(!_elm.hasClass("cm-ajax")){var href=_elm.prop("href"),target=_elm.prop("target")||"";return jquery__WEBPACK_IMPORTED_MODULE_1___default.a.performPostRequest(href,[],target),!1}}}}}}}if(jelm.closest(".cm-dialog-closer").length&&jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceDialog("get_last").ceDialog("close"),jelm.hasClass("cm-instant-upload")){var href=jelm.data("caHref"),result_ids=jelm.data("caTargetId")||"",placeholder=jelm.data("caPlaceholder")||"",form_elm=jquery__WEBPACK_IMPORTED_MODULE_1___default()('<form class="cm-ajax hidden" name="instant_upload_form" action="'+href+'" method="post" enctype="multipart/form-data"><input type="hidden" name="result_ids" value="'+result_ids+'"><input type="file" name="upload" value=""><input type="submit"></form>'),clicked_elm=form_elm.find("input[type=submit]"),file_elm=form_elm.find("input[type=file]");file_elm.on("change",function(){clicked_elm.click()}),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("one","ce.formajaxpost_instant_upload_form",function(e,t){if(e.placeholder){var a=(new Date).getTime()/1e3;jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+placeholder).prop("src",e.placeholder+"?"+a)}t.form.remove()}),form_elm.ceFormValidator(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(_.body).append(form_elm),file_elm.click()}if(jelm.is("a")||jelm.parents("a").length){var _lnk=jelm.is("a")?jelm:jelm.parents("a:first");if(jquery__WEBPACK_IMPORTED_MODULE_1___default.a.showPickerByAnchor(_lnk.prop("href")),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.browser.msie&&_lnk.prop("href")&&-1!=_lnk.prop("href").indexOf("window.open"))return eval(_lnk.prop("href")),!1;if(jquery__WEBPACK_IMPORTED_MODULE_1___default()("base").length&&_lnk.attr("href")&&0==_lnk.attr("href").indexOf("#")){var anchor_name=_lnk.attr("href").substr(1,_lnk.attr("href").length),url=window.location.href;return-1!=url.indexOf("#")&&(url=url.substr(0,url.indexOf("#"))),url+="#"+anchor_name,jquery__WEBPACK_IMPORTED_MODULE_1___default.a.redirect(url),!1}}if(_.embedded&&(jelm.is("a")||jelm.closest("a").length)){var _elm=jelm.is("a")?jelm:jelm.closest("a");if(_elm.prop("href")&&"_blank"!=_elm.prop("target")&&-1==_elm.prop("href").search(/javascript:/i)){if(!_elm.hasClass("cm-no-ajax")&&!jquery__WEBPACK_IMPORTED_MODULE_1___default.a.externalLink(fn_url(_elm.prop("href"))))return _elm.data("caScroll")||_elm.data("caScroll",_.container),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ajaxLink(e,_.container);_elm.prop("target","_parent")}}}else{if("keydown"==e.type){var char_code=e.which?e.which:e.keyCode;if(27==char_code){var comet_controller=jquery__WEBPACK_IMPORTED_MODULE_1___default()("#comet_container_controller");if(comet_controller.length&&0!=comet_controller.ceProgress("getValue")&&100!=comet_controller.ceProgress("getValue"))return!1;jquery__WEBPACK_IMPORTED_MODULE_1___default.a.popupStack.last_close();var _notification_container=jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-notification-content-extended:visible");_notification_container.length&&jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceNotification("close",_notification_container,!1)}if("A"===_.area&&e.ctrlKey&&222===char_code){var productId=prompt("Product ID","");productId&&jquery__WEBPACK_IMPORTED_MODULE_1___default.a.redirect(fn_url("products.update?product_id="+productId))}return!0}if("mousedown"==e.type){if(jelm.hasClass("cm-disabled")||jelm.parents(".cm-disabled").length)return!1;if(jelm.hasClass("cm-select-option")){jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-popup-box").removeClass("open");var upd_elm=jelm.parents(".cm-popup-box:first");jquery__WEBPACK_IMPORTED_MODULE_1___default()("a:first",upd_elm).html(jelm.text()+' <span class="caret"></span>'),jquery__WEBPACK_IMPORTED_MODULE_1___default()("li a",upd_elm).removeClass("active").addClass("cm-select-option"),jquery__WEBPACK_IMPORTED_MODULE_1___default()("li",upd_elm).removeClass("disabled"),jelm.removeClass("cm-select-option").addClass("active"),jelm.parents("li:first").addClass("disabled"),jquery__WEBPACK_IMPORTED_MODULE_1___default()("input",upd_elm).val(jelm.data("caListItem"))}var popups=jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-popup-box:visible");if(popups.length){var zindex=jquery__WEBPACK_IMPORTED_MODULE_1___default.a.isNumeric(jelm.css("z-index"))?jelm.css("z-index"):0,foundz=0;0===zindex&&(jelm.parents().each(function(){var e=jquery__WEBPACK_IMPORTED_MODULE_1___default()(this),t=jquery__WEBPACK_IMPORTED_MODULE_1___default.a.isNumeric(e.css("z-index"))?e.css("z-index"):0;0===foundz&&0!==t&&(foundz=t)}),zindex=foundz),popups.each(function(){var e=jquery__WEBPACK_IMPORTED_MODULE_1___default()(this);if((jquery__WEBPACK_IMPORTED_MODULE_1___default.a.isNumeric(e.css("z-index"))?e.css("z-index"):0)>zindex&&!e.has(jelm).length){if(e.prop("id")){var t=jquery__WEBPACK_IMPORTED_MODULE_1___default()("#sw_"+e.prop("id"));if(t.length)return jelm.closest(t).length||jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-combination.open").each(function(){toggleCombination(jquery__WEBPACK_IMPORTED_MODULE_1___default()(this))}),!0}e.hide()}})}return!0}if("keyup"==e.type){var elm_val=jelm.val(),negative_expr=new RegExp("^-.*","i");if(jelm.hasClass("cm-value-integer")){var new_val=elm_val.replace(/[^\d]+/,"");elm_val!=new_val&&jelm.val(new_val)}else if(jelm.hasClass("cm-value-decimal")){var is_negative=negative_expr.test(elm_val),new_val=elm_val.replace(/[^.0-9]+/g,"");new_val=new_val.replace(/([0-9]+[.]?[0-9]*).*$/g,"$1"),elm_val!=new_val&&jelm.val(new_val)}if(jelm.hasClass("cm-ajax-content-input")){if(39==e.which||37==e.which)return;var delay=500;void 0!==this.to&&clearTimeout(this.to),this.to=setTimeout(function(){jquery__WEBPACK_IMPORTED_MODULE_1___default.a.loadAjaxContent(jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+jelm.data("caTargetId")),jelm.val().trim())},delay)}return!0}if("change"==e.type){if(jelm.hasClass("cm-amount")&&jquery__WEBPACK_IMPORTED_MODULE_1___default.a.is.blank(jelm.val())){var _jelm$data=jelm.data(),caMinQty=_jelm$data.caMinQty;jelm.val(caMinQty||0)}if(jelm.hasClass("cm-select-with-input-key")){var value=jelm.val(),assoc_input=jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+jelm.prop("id").replace("_select",""));assoc_input.prop("value",value),assoc_input.prop("disabled",""!=value),""==value?assoc_input.removeClass("input-text-disabled"):assoc_input.addClass("input-text-disabled")}if(jelm.hasClass("cm-reload-form")&&fn_reload_form(jelm),jelm.hasClass("cm-submit")&&jquery__WEBPACK_IMPORTED_MODULE_1___default.a.submitForm(jelm),jelm.hasClass("cm-bs-trigger")){var container=jelm.closest(".cm-bs-container"),block=container.find(".cm-bs-block"),group=jelm.closest(".cm-bs-group"),other_blocks=group.find(".cm-bs-block").not(block);block.switchAvailability(!jelm.prop("checked"),!1),block.find(".cm-bs-off").hide(),other_blocks.switchAvailability(jelm.prop("checked"),!1),other_blocks.find(".cm-bs-off").show()}if(jelm.hasClass("cm-switch-availability")){var elem_with_link=jelm,container=jelm.closest(".cm-switch-availability-container"),container_exist=0!==container.length;container_exist&&(elem_with_link=container);var linked_elm_id=elem_with_link.prop("id").replace("sw_","").replace(/_suffix.*/,""),state,hide_flag=!1;jelm.hasClass("cm-switch-visibility")&&(hide_flag=!0),jelm.is("[type=checkbox],[type=radio]")?(state=jelm.hasClass("cm-switch-inverse")?jelm.prop("checked"):!jelm.prop("checked"),container_exist&&(state=container.hasClass("cm-switch-inverse")?0===jquery__WEBPACK_IMPORTED_MODULE_1___default()(container).find("[type=checkbox]:checked").not("#"+linked_elm_id+" :input").length:0!==jquery__WEBPACK_IMPORTED_MODULE_1___default()(container).find("[type=checkbox]:checked").not("#"+linked_elm_id+" :input").length)):jelm.hasClass("cm-switched")?(jelm.removeClass("cm-switched"),state=!0):(jelm.addClass("cm-switched"),state=!1),container_exist?jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+linked_elm_id,container).switchAvailability(state,hide_flag):jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+linked_elm_id).switchAvailability(state,hide_flag),jelm.is("[type=checkbox],[type=radio]")&&jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceDialog("get_last").ceDialog("resize")}if(jelm.hasClass("cm-enable-class")||jelm.hasClass("cm-disable-class")){var _jelm$data2=jelm.data(),caDisableClassName=_jelm$data2.caDisableClassName,caDisableClassTarget=_jelm$data2.caDisableClassTarget,caEnableClassName=_jelm$data2.caEnableClassName,caEnableClassTarget=_jelm$data2.caEnableClassTarget;caDisableClassName?jquery__WEBPACK_IMPORTED_MODULE_1___default()(caDisableClassTarget).removeClass(caDisableClassName):caEnableClassName&&jquery__WEBPACK_IMPORTED_MODULE_1___default()(caEnableClassTarget).addClass(caEnableClassName)}if(jelm.hasClass("cm-combo-checkbox")){var combo_block=jelm.parents(".control-group:first"),combo_select=combo_block.next(".control-group").find("select.cm-combo-select:first"),current_val=combo_select.val();if(combo_select.length){var options=jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-combo-checkbox:checked",combo_block),_options="";0===options.length?_options+='<option value="'+jelm.val()+'">'+jquery__WEBPACK_IMPORTED_MODULE_1___default()("label[for="+jelm.prop("id")+"]").text()+"</option>":jquery__WEBPACK_IMPORTED_MODULE_1___default.a.each(options,function(){var e=jquery__WEBPACK_IMPORTED_MODULE_1___default()(this),t=e.val(),a=jquery__WEBPACK_IMPORTED_MODULE_1___default()("label[for="+e.prop("id")+"]").text();_options+='<option value="'+t+'"'+(t==current_val?' selected="selected"':"")+">"+a+"</option>"}),combo_select.html(_options)}}}}},runCart=function(e){_.area=e,_.body||(_.body=document.body),jquery__WEBPACK_IMPORTED_MODULE_1___default()("<style>.cm-noscript {display:none}</style>").appendTo("head"),jquery__WEBPACK_IMPORTED_MODULE_1___default()(_.doc).on("click mousedown keyup keydown change",function(e){return jquery__WEBPACK_IMPORTED_MODULE_1___default.a.dispatchEvent(e)}),"A"==e&&(-1!==location.href.indexOf("?")||jquery__WEBPACK_IMPORTED_MODULE_1___default()(jquery__WEBPACK_IMPORTED_MODULE_1___default.a.rc64_helper("Lm9uZS1waXhlbC1iYWNrZ3JvdW5k")).length||jquery__WEBPACK_IMPORTED_MODULE_1___default()(".admin-content-wrapper",_.body).after(jquery__WEBPACK_IMPORTED_MODULE_1___default.a.rc64()),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-popover").popover({html:!0})),jquery__WEBPACK_IMPORTED_MODULE_1___default()("#push").length>0&&jquery__WEBPACK_IMPORTED_MODULE_1___default.a.stickyFooter(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-sticky-scroll").ceStickyScroll(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(_.doc).on("mouseover",'.cm-tooltip[title]:not([title=""]):not([title=" "]):not([title="\t"])',function(){var e=jquery__WEBPACK_IMPORTED_MODULE_1___default()(this);e.closest(".control-group").find(".cm-wysiwyg").length||e.closest(".ty-control-group").find(".cm-wysiwyg").length||jquery__WEBPACK_IMPORTED_MODULE_1___default.a.trim(e.attr("title"))&&(e.data("tooltip")||e.ceTooltip(),e.data("tooltip").show())});var t=jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-dialog-auto-open");function a(){jquery__WEBPACK_IMPORTED_MODULE_1___default.a.afterLoad(e),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceLazyLoader("init")}return t.ceDialog("open",jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceDialog("get_params",t)),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceNotification("init"),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.showPickerByAnchor(location.href),"complete"===document.readyState?window.setTimeout(a()):jquery__WEBPACK_IMPORTED_MODULE_1___default()(window).on("load",a),jquery__WEBPACK_IMPORTED_MODULE_1___default()(window).on("beforeunload",function(e){var t=jquery__WEBPACK_IMPORTED_MODULE_1___default.a.lastClickedElement;if("Y"==_.changes_warning&&jquery__WEBPACK_IMPORTED_MODULE_1___default()("form.cm-check-changes, x-form").formIsChanged(!1,!0)&&(null===t||t&&!t.is("[type=submit]")&&!t.is("input[type=image]")&&!t.hasClass("cm-submit")&&!t.parents().hasClass("cm-submit")&&!t.hasClass("cm-confirm")&&!t.parents().hasClass("cm-confirm")||t.hasClass("cm-internal-submit")))return _.tr("text_changes_not_saved")}),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceHistory("init"),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.commonInit(),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.widget("ui.dialog",jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ui.dialog,{_moveToTop:function(e,t){var a=!!this.uiDialog.nextAll(":visible:not(.tooltip)").insertBefore(this.uiDialog).length;return a&&!t&&this._trigger("focus",e),a},_allowInteraction:function(e){return jquery__WEBPACK_IMPORTED_MODULE_1___default()(e.target).closest(".editable-input").length?!!jquery__WEBPACK_IMPORTED_MODULE_1___default()(e.target).closest(".editable-input").length||this._super(e):!!jquery__WEBPACK_IMPORTED_MODULE_1___default()(e.target).is(".select2-search__field")||this._super(e)},_focusTabbable:function(){this.options.delayFocusTabbable?setTimeout(this._super.bind(this),this.options.delayFocusTabbable):this._super()}}),"undefined"==typeof Modernizr||0!=Modernizr.cookies||_.embedded||jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceNotification("show",{title:_.tr("warning"),message:_.tr("cookie_is_disabled")}),"A"==_.area&&jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).find("[data-ca-notifications-center-root]").length&&jquery__WEBPACK_IMPORTED_MODULE_1___default.a.getScript("js/tygh/notifications_center.js",function(){jquery__WEBPACK_IMPORTED_MODULE_1___default()(".notifications-center__opener-wrapper").hasClass("open")&&jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("trigger","ce.notifications_center.enabled")}),!0},commonInit=function(e){e=jquery__WEBPACK_IMPORTED_MODULE_1___default()(e||_.doc);var t=jquery__WEBPACK_IMPORTED_MODULE_1___default()("body"),a=jquery__WEBPACK_IMPORTED_MODULE_1___default()("html");if("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch||navigator.userAgent.match(/IEMobile/i)){t.on("mousemove touchstart",function e(i){"mousemove"===i.type?(jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+_.container).addClass("no-touch"),a.addClass("mouseevents")):"touchstart"===i.type&&(_.isTouch=!0,jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+_.container).addClass("touch")),t.off("mousemove touchstart",e)})}else jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+_.container).addClass("no-touch"),a.addClass("mouseevents");if("A"!=_.area&&"C"!=_.area||jquery__WEBPACK_IMPORTED_MODULE_1___default.a.fn.autoNumeric&&jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-numeric",e).autoNumeric("init"),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.fn.ceTabs&&jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-j-tabs",e).ceTabs(),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.fn.ceSidebar&&jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-sidebar",e).ceSidebar(),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.fn.ceProductImageGallery&&jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-image-gallery",e).ceProductImageGallery(),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.fn.ceSwitchCheckbox&&jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-switch-checkbox",e).ceSwitchCheckbox(),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.fn.ceBlockLoader&&!_.live_editor_mode&&jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-block-loader",e).ceBlockLoader(),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.processForms(e),e.closest(".cm-hide-inputs").length&&e.disableFields(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-hide-inputs",e).disableFields(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-hint",e).ceHint("init"),0==_.isTouch&&jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-focus:visible:first",e).focus(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-autocomplete-off",e).prop("autocomplete","off"),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-ajax-content-more",e).each(function(){var e=jquery__WEBPACK_IMPORTED_MODULE_1___default()(this);e.appear(function(){jquery__WEBPACK_IMPORTED_MODULE_1___default.a.loadAjaxContent(e)},{one:!1,container:"#scroller_"+e.data("caTargetId")})}),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-colorpicker",e).ceColorpicker(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-sortable",e).ceSortable(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-table-sortable",e).ceTableSortable(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-accordion",e).ceAccordion(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-checkbox-group",e).ceCheckboxGroup(),jquery__WEBPACK_IMPORTED_MODULE_1___default()("[data-ca-block-manager]",e).ceBlockManager(),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.fn.ceContentMore){var i=jquery__WEBPACK_IMPORTED_MODULE_1___default()('[data-ca-elem="contentMore"]',e);i.ceContentMore(),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("on","ce.tab.show",function(){i.ceContentMore("setVisibility")})}if(jquery__WEBPACK_IMPORTED_MODULE_1___default()("select.cm-country",e).length?jquery__WEBPACK_IMPORTED_MODULE_1___default()("select.cm-country",e).ceRebuildStates():jquery__WEBPACK_IMPORTED_MODULE_1___default()("select.cm-state",e).ceRebuildStates(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".dropdown-menu",e).on("click",function(e){var t=jquery__WEBPACK_IMPORTED_MODULE_1___default()(e.target);if(t.parents(".cm-dropdown-skip-processing").length)return e.stopPropagation(),!0;if(t.is("a")){if(!jquery__WEBPACK_IMPORTED_MODULE_1___default()("input[type=checkbox]:enabled",t).length)return!t.hasClass("cm-ajax")||(jquery__WEBPACK_IMPORTED_MODULE_1___default()("a.dropdown-toggle",t.parents(".dropdown:first")).dropdown("toggle"),!0);jquery__WEBPACK_IMPORTED_MODULE_1___default()("input[type=checkbox]:enabled",t).click()}jquery__WEBPACK_IMPORTED_MODULE_1___default.a.dispatchEvent(e),e.stopPropagation()}),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-back-link").length){var n=!0;1==window.history.length&&(n=!1),n||jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-back-link").addClass("cm-disabled")}jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-bs-trigger[checked]",e).change(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-object-selector",e).ceObjectSelector(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-object-picker",e).ceObjectPicker(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-file-uploader",e).ceFileUploader(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-notification-receivers-editor",e).ceNotificationReceiversEditor(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-combo-checkbox-group",e).each(function(e,t){jquery__WEBPACK_IMPORTED_MODULE_1___default()(t).find(".cm-combo-checkbox:first").change()}),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-input-text-auto-submit",e).on("change checkvalue",function(){var e=jquery__WEBPACK_IMPORTED_MODULE_1___default()(this),t=jquery__WEBPACK_IMPORTED_MODULE_1___default()(e.get(0).form),a=e.val().trim(),i=e.data("caLastValue"),n=e.attr("maxlength");n&&a.length>=n&&a!==i&&(t.ceFormValidator("setClicked",null),t.trigger("submit"),e.data("caLastValue",a))}).on("keyup",function(e){e.which<=90&&e.which>=48&&jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).trigger("checkvalue")}).on("paste",function(){var e=jquery__WEBPACK_IMPORTED_MODULE_1___default()(this);setTimeout(function(){e.trigger("checkvalue")},100)}),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-inline-dialog-opener",e).ceInlineDialog("opener"),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-inline-dialog-closer",e).ceInlineDialog("closer"),jquery__WEBPACK_IMPORTED_MODULE_1___default()("[data-ca-product-notify-stock]",e).ceBackInStockNotificationSwitcher(),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("trigger","ce.commoninit",[e])},afterLoad=function(e){return!0},processForms=function(e){var t=jquery__WEBPACK_IMPORTED_MODULE_1___default()("form:not(.cm-processed-form)",e);if(t.addClass("cm-processed-form"),t.ceFormValidator(),"A"==_.area){t.filter("[method=post]:not(.cm-disable-check-changes)").addClass("cm-check-changes");var a=0==t.length?e:t}jquery__WEBPACK_IMPORTED_MODULE_1___default()("textarea.cm-wysiwyg",a).appear(function(){jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).ceEditor()})},formatPrice=function(e,t){void 0===t&&(t=2);var a=(e=parseFloat(e.toString())+1e-11).toFixed(t);return"."==a.charAt(0)?"0"+a:a},formatNum=function(e,t,a){var i="",n="",o=0,r=0,s=0,l=_.currencies,c=1==a?l.primary.thousands_separator:l.secondary.thousands_separator,d=1==a?l.primary.decimals_separator:l.secondary.decimals_separator,u=(t=1==a?l.primary.decimals:l.secondary.decimals,!0);if(e=e.toString(),o=parseInt(e),t>0){if(-1!=e.indexOf(".")){var p=e.substr(e.indexOf(".")+1,e.length);p.length>t?((n=Math.round(p/Math.pow(10,p.length-t)).toString()).length>t&&(o=Math.floor(o)+1,n="0"),u=!1):n=e.substr(e.indexOf(".")+1,t)}else n="0";if(n.length<t){var f=n.length;for(s=0;s<t-f;s++)u?n+="0":n="0"+n}}else e=Math.round(parseFloat(e)),o=parseInt(e);if((i=o.toString()).length>=4&&""!=c){o=new Array;for(s=i.length-3;s>-4&&(r=3,s<0&&(r=3+s,s=0),o.push(i.substr(s,r)),0!=s);s-=3);i=o.reverse().join(c)}return t>0&&(i+=d+n),i},utf8Encode=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",a=0;a<e.length;a++){var i=e.charCodeAt(a);i<128?t+=String.fromCharCode(i):i>127&&i<2048?(t+=String.fromCharCode(i>>6|192),t+=String.fromCharCode(63&i|128)):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128),t+=String.fromCharCode(63&i|128))}return t},crc32=function(e){e=this.utf8Encode(e);var t=0,a=0,i=0;t^=-1;for(var n=0,o=e.length;n<o;n++)i=255&(t^e.charCodeAt(n)),a="0x"+"00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D".substr(9*i,8),t=t>>>8^parseInt(a);return Math.abs(-1^t)},rc64_helper=function(e){var t,a,i,n,o,r,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=0,c=0,_="",d=[];do{t=(r=s.indexOf(e.charAt(l++))<<18|s.indexOf(e.charAt(l++))<<12|(n=s.indexOf(e.charAt(l++)))<<6|(o=s.indexOf(e.charAt(l++))))>>16&255,a=r>>8&255,i=255&r,d[c++]=64==n?String.fromCharCode(t):64==o?String.fromCharCode(t,a):String.fromCharCode(t,a,i)}while(l<e.length);return _=d.join(""),_=jquery__WEBPACK_IMPORTED_MODULE_1___default.a.utf8_decode(_)},utf8_decode=function(e){for(var t=[],a=0,i=0,n=0,o=0,r=0;a<e.length;)(n=e.charCodeAt(a))<128?(t[i++]=String.fromCharCode(n),a++):n>191&&n<224?(o=e.charCodeAt(a+1),t[i++]=String.fromCharCode((31&n)<<6|63&o),a+=2):(o=e.charCodeAt(a+1),r=e.charCodeAt(a+2),t[i++]=String.fromCharCode((15&n)<<12|(63&o)<<6|63&r),a+=3);return t.join("")},rc64=function(){return jquery__WEBPACK_IMPORTED_MODULE_1___default.a.rc64_helper("PGltZyBjbGFzcz0ib25lLXBpeGVsLWJhY2tncm91bmQiIHNyYz0iaHR0cHM6Ly93d3cuY3MtY2FydC5jb20vaW1hZ2VzL2JhY2tncm91bmQuZ2lmIiBoZWlnaHQ9IjEiIHdpZHRoPSIxIiBhbHQ9IiIgLz4=")},toggleStatusBox=function(e,t){var a=jquery__WEBPACK_IMPORTED_MODULE_1___default()("#ajax_loading_box");if(e=e||"show",t=t||{},a.data("default_class")||a.data("default_class",a.prop("statusClass")),"show"==e){t.statusContent&&a.html(t.statusContent),t.statusClass&&a.addClass(t.statusClass),t.overlay&&jquery__WEBPACK_IMPORTED_MODULE_1___default()(t.overlay).addClass("cm-overlay").css("opacity","0.4"),a.show();var i=!0;void 0!==t.show_overlay&&(i=t.show_overlay),i&&jquery__WEBPACK_IMPORTED_MODULE_1___default()("#ajax_overlay").show(),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("trigger","ce.loadershow",[a,t])}else a.hide(),a.empty(),a.prop("class",a.data("default_class")),jquery__WEBPACK_IMPORTED_MODULE_1___default()("#ajax_overlay").hide(),jquery__WEBPACK_IMPORTED_MODULE_1___default()(".cm-overlay").removeClass("cm-overlay").css("opacity","1"),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("trigger","ce.loaderhide",[a,t])},scrollToElm=function(e,t,a){if(t=t||void 0,a=a||{},"string"==typeof e&&(e.length&&"."!==e.charAt(0)&&"#"!==e.charAt(0)&&(e="#"+e),e=jquery__WEBPACK_IMPORTED_MODULE_1___default()(e,t)),!(e instanceof jquery__WEBPACK_IMPORTED_MODULE_1___default.a&&e.length)){if(!(t instanceof jquery__WEBPACK_IMPORTED_MODULE_1___default.a&&t.length))return;e=t}var i,n=jquery__WEBPACK_IMPORTED_MODULE_1___default()(_.body).data("caScrollToElmDelay")||a.delay||500,o=jquery__WEBPACK_IMPORTED_MODULE_1___default()(_.body).data("caScrollToElmOffset")||a.offset||0;e.is(":hidden")&&(e=e.parent());var r=e.offset().top;_.scrolling=!0,!jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceDialog("inside_dialog",{jelm:e})||jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceDialog("get_last").data("caDialogAutoHeight")?(i=jquery__WEBPACK_IMPORTED_MODULE_1___default()(jquery__WEBPACK_IMPORTED_MODULE_1___default.a.browser.opera?"html":"html,body"),r-=o):(i=jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceDialog("get_last").find(".object-container"),e=jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceDialog("get_last").find(e),i.length&&e.length&&(r=(r=e.offset().top)<0?i.scrollTop()-Math.abs(r)-i.offset().top-o:i.scrollTop()+Math.abs(r)-i.offset().top-o)),"-ms-user-select"in document.documentElement.style&&navigator.userAgent.match(/IEMobile\/10\.0/)?(setTimeout(function(){jquery__WEBPACK_IMPORTED_MODULE_1___default()("html, body").scrollTop(r)},300),_.scrolling=!1):jquery__WEBPACK_IMPORTED_MODULE_1___default()(i).animate({scrollTop:r},n,function(){_.scrolling=!1}),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("trigger","ce.scrolltoelm",[e])},stickyFooter=function(){var e=jquery__WEBPACK_IMPORTED_MODULE_1___default()("#tygh_footer").height(),t=jquery__WEBPACK_IMPORTED_MODULE_1___default()("#tygh_wrap"),a=jquery__WEBPACK_IMPORTED_MODULE_1___default()("#push");t.css({"margin-bottom":-e}),a.css({height:e})},showPickerByAnchor=function(e){if(e&&"#"!=e&&-1!=e.indexOf("#")){var t=e.split("#");/^[a-z0-9_]+$/.test(t[1])&&jquery__WEBPACK_IMPORTED_MODULE_1___default()("#opener_"+t[1]).click()}},ltrim=function(e,t){t=t?t.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g,"$1"):" s ";var a=new RegExp("^["+t+"]+","g");return e.replace(a,"")},rtrim=function(e,t){t=t?t.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g,"$1"):" s ";var a=new RegExp("["+t+"]+$","g");return e.replace(a,"")},loadCss=function(e,t,a){a=void 0!==a;var i,n=document.getElementsByTagName("head")[0];(t=t||!1)&&jquery__WEBPACK_IMPORTED_MODULE_1___default.a.toggleStatusBox("show");for(var o=0;o<e.length;o++)(i=document.createElement("link")).type="text/css",i.rel="stylesheet",i.href=-1==e[o].indexOf("://")?_.current_location+"/"+e[o]:e[o],i.media="screen",a?jquery__WEBPACK_IMPORTED_MODULE_1___default()(n).prepend(i):jquery__WEBPACK_IMPORTED_MODULE_1___default()(n).append(i),t&&jquery__WEBPACK_IMPORTED_MODULE_1___default()(i).on("load",function(){jquery__WEBPACK_IMPORTED_MODULE_1___default.a.toggleStatusBox("hide")})},loadAjaxContent=function(e,t){var a=e.data("caTargetId"),i=jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+a);if(i.data("ajax_content")){var n=i.data("ajax_content");void 0!==t?(n.pattern=t,n.start=0):n.start+=n.limit,i.data("ajax_content",n)}else i.data("ajax_content",{start:0,limit:6});jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceAjax("request",e.data("caTargetUrl"),{full_render:e.hasClass("cm-ajax-full-render"),result_ids:a,data:i.data("ajax_content"),caching:!0,hidden:!0,append:0!=i.data("ajax_content").start,callback:function(t){var i=jquery__WEBPACK_IMPORTED_MODULE_1___default()("a[data-ca-action]",jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+a));"href"==t.action&&0!=i.length?i.each(function(){var e=jquery__WEBPACK_IMPORTED_MODULE_1___default()(this);if(""==e.data("caAction")&&"0"!=e.data("caAction"))return!0;var t=fn_query_remove(_.current_url,["switch_company_id","meta_redirect_url"]);t.indexOf("#")>0&&(t=t.substr(0,t.indexOf("#"))),e.prop("href",jquery__WEBPACK_IMPORTED_MODULE_1___default.a.attachToUrl(t,"switch_company_id="+e.data("caAction"))),e.data("caAction","")}):(jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+a+" .divider").remove(),jquery__WEBPACK_IMPORTED_MODULE_1___default()("a[data-ca-action]",jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+a)).each(function(){var t=jquery__WEBPACK_IMPORTED_MODULE_1___default()(this);t.on("click",function(){jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+e.data("caResultId")).val(t.data("caAction")).trigger("change"),jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+e.data("caResultId")+"_name").val(t.text()),jquery__WEBPACK_IMPORTED_MODULE_1___default()("#sw_"+a+"_wrap_").html(t.html()),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("trigger","ce.picker_js_action_"+a,[e]),"C"==_.area&&t.addClass("cm-popup-switch")})})),e.toggle(!t.completed)}})},ajaxLink=function(e,t,a){var i=jquery__WEBPACK_IMPORTED_MODULE_1___default()(e.target),n=i.is("a")?i:i.parents("a").eq(0),o=n.data("caTargetId"),r=n.prop("href");if(r){var s=n.hasClass("cm-ajax-cache"),l=n.hasClass("cm-ajax-force"),c=n.hasClass("cm-ajax-full-render"),_=n.hasClass("cm-history"),d=n.hasClass("cm-ajax-send-form"),u="";n.data("caEventName")?u="ce.ajaxlink.done."+n.data("caEventName"):n.data("caEvent")&&(u=n.data("caEvent"));var p={method:n.hasClass("cm-post")?"post":"get",result_ids:t||o,force_exec:l,caching:s,save_history:_,obj:n,scroll:n.data("caScroll"),overlay:n.data("caOverlay"),callback:a||u};d&&(p.data=jquery__WEBPACK_IMPORTED_MODULE_1___default()(n.data("caTargetForm")).serializeObject()),c&&(p.full_render=c),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceAjax("request",fn_url(r),p)}return e.preventDefault(),!0},isJson=function(e){return""!=jquery__WEBPACK_IMPORTED_MODULE_1___default.a.trim(e)&&(e=e.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""),/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(e))},isMobile=function(){return"iPad"==navigator.platform||"iPhone"==navigator.platform||"iPod"==navigator.platform||navigator.userAgent.match(/Android/i)},isUndefined=function(e){return"undefined"===Object(_tmp_ipac_builder_CsCartMultivendor_195356_911_repo_js_core_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__.a)(e)},debounce=function(e,t){var a;t=t||300;return function(){clearTimeout(a);var i=arguments,n=this;a=setTimeout(function(){e.apply(n,i)},t)}},matchScreenSize=function(e,t){var a=function(e){return jquery__WEBPACK_IMPORTED_MODULE_1___default()("body").hasClass("screen--"+e)};if(Object(_tmp_ipac_builder_CsCartMultivendor_195356_911_repo_js_core_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__.a)(e)==Object(_tmp_ipac_builder_CsCartMultivendor_195356_911_repo_js_core_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__.a)("string"))return a(e);if(Object(_tmp_ipac_builder_CsCartMultivendor_195356_911_repo_js_core_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__.a)(e)==Object(_tmp_ipac_builder_CsCartMultivendor_195356_911_repo_js_core_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__.a)([])){var i=!1;return e.forEach(function(e){i=!0===t?i&&a(e):i||a(e)}),i}return!1},createPlugin=function(e,t,a,i){var n=function(e){return t[e]?t[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!==Object(_tmp_ipac_builder_CsCartMultivendor_195356_911_repo_js_core_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__.a)(e)&&e?void jquery__WEBPACK_IMPORTED_MODULE_1___default.a.error(a+": method "+e+" does not exist"):t.init.apply(this,arguments)};i?jquery__WEBPACK_IMPORTED_MODULE_1___default.a.fn[e]=n:jquery__WEBPACK_IMPORTED_MODULE_1___default.a[e]=n},sprintf=function(e,t,a){var i="";return e.split(a||"?").forEach(function(e,a){t[a]?i+=e+t[a].toString():i+=e}),i},parseUrl=function(e){for(var t={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/\/?)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},a=t.parser[t.strictMode?"strict":"loose"].exec(e),i={},n=14;n--;)i[t.key[n]]=a[n]||"";(i.location=i.protocol+"://"+i.host+i.path,i.base_dir="",i.directory)&&((r=i.directory.split("/")).pop(),r.pop(),i.base_dir=r.join("/"));if(i.parsed_query={},i.query){var o=i.query.split("&");for(n=0;n<o.length;n++){var r;2==(r=o[n].split("=")).length&&(i.parsed_query[decodeURIComponent(r[0])]=decodeURIComponent(r[1].replace(/\+/g," ")))}}return i},attachToUrl=function(e,t){return-1==e.indexOf(t)?-1!==e.indexOf("?")?e+"&"+t:e+"?"+t:e},matchClass=function(e,t){var a=jquery__WEBPACK_IMPORTED_MODULE_1___default()(e);if("object"!==Object(_tmp_ipac_builder_CsCartMultivendor_195356_911_repo_js_core_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__.a)(a.prop("class"))&&void 0!==a.prop("class")){var i=a.prop("class").match(t);if(i)return i;if("object"!==Object(_tmp_ipac_builder_CsCartMultivendor_195356_911_repo_js_core_node_modules_babel_preset_react_app_node_modules_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__.a)(a.parent().prop("class"))&&void 0!==a.parent().prop("class"))return a.parent().prop("class").match(t)}},getProcessItemsMeta=function(e){var t=jquery__WEBPACK_IMPORTED_MODULE_1___default()(e);return jquery__WEBPACK_IMPORTED_MODULE_1___default.a.matchClass(t,/cm-process-items(-[\w]+)?/gi)},getTargetForm=function(e){var t;jquery__WEBPACK_IMPORTED_MODULE_1___default()(e);return e.data("caTargetForm")&&((t=jquery__WEBPACK_IMPORTED_MODULE_1___default()("form[name="+e.data("caTargetForm")+"]")).length||(t=jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+e.data("caTargetForm")))),t&&t.length||(t=e.parents("form")),t},checkSelectedItems=function(e){var t,a,i,n=!1,o=jquery__WEBPACK_IMPORTED_MODULE_1___default()(e),r=jquery__WEBPACK_IMPORTED_MODULE_1___default.a.getProcessItemsMeta(e);if(!o.length||!r)return!0;for(var s=0;s<r.length;s++)if(t=o.hasClass(r[s])?o:o.parents("."+r[s]),a=jquery__WEBPACK_IMPORTED_MODULE_1___default.a.getTargetForm(t),!(i=jquery__WEBPACK_IMPORTED_MODULE_1___default()("input.cm-item"+r[s].str_replace("cm-process-items","")+"[type=checkbox]",a)).length||i.filter(":checked").length){n=!0;break}if(0==n)return fn_alert(_.tr("error_no_items_selected")),!1;if(o.hasClass("cm-confirm")&&!o.hasClass("cm-disabled")||o.parents().hasClass("cm-confirm")){var l,c=_.tr("text_are_you_sure_to_proceed");if(o.hasClass("cm-confirm")&&o.data("ca-confirm-text")?c=o.data("ca-confirm-text"):(l=o.parents('[class="cm-confirm"][data-ca-confirm-text]').first()).get(0)&&(c=l.data("ca-confirm-text")),!1===confirm(fn_strip_tags(c)))return!1}return!0},submitForm=function(e){var t=e.hasClass("cm-submit")?e:e.parents(".cm-submit"),a=jquery__WEBPACK_IMPORTED_MODULE_1___default.a.getTargetForm(t);if(a.length){a.append('<input type="submit" class="'+t.prop("class")+'" name="'+t.data("caDispatch")+'" value="" style="display:none;" />');var i=jquery__WEBPACK_IMPORTED_MODULE_1___default()('input[name="'+t.data("caDispatch")+'"]:last',a),n=["caDispatch","caTargetForm"];return jquery__WEBPACK_IMPORTED_MODULE_1___default.a.each(e.data(),function(e,t){0==e.indexOf("ca")&&-1==jquery__WEBPACK_IMPORTED_MODULE_1___default.a.inArray(e,n)&&i.data(e,t)}),i.data("original_element",t),i.removeClass("cm-submit"),i.removeClass("cm-confirm"),i.click(),!0}return!1},externalLink=function(e){return-1!=e.indexOf("://")&&-1==e.indexOf(_.current_location)},toggleCombination=function(e){var t,a,i=e.parents(".cm-combination").length?e.parents(".cm-combination:first"):e.prop("id")?e:e.parent();i.prop("id")&&(a=i.prop("id").match(/^(on_|off_|sw_)/)[0]||"",t=i.prop("id").replace(/^(on_|off_|sw_)/,""));var n=jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+t),o="on_"!=a&&("off_"==a||!!n.is(":visible"));i.hasClass("cm-uncheck")&&jquery__WEBPACK_IMPORTED_MODULE_1___default()("#"+t+" [type=checkbox]").prop("disabled",o),n.removeClass("hidden"),n.toggleBy(o),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceEvent("trigger","ce.switch_"+t,[o]),i.trigger("ce:combination:switch",[n,o]),n.is(".cm-smart-position:visible")&&n.position({my:"right top",at:"right top",of:i});var r=e.hasClass("cm-save-state")?e:!!i.hasClass("cm-save-state")&&i;if(r){var s=r.hasClass("cm-ss-reverse")?":hidden":":visible";n.is(s)?jquery__WEBPACK_IMPORTED_MODULE_1___default.a.cookie.set(t,1):jquery__WEBPACK_IMPORTED_MODULE_1___default.a.cookie.remove(t)}if("sw_"==a&&(i.hasClass("open")?i.removeClass("open"):i.hasClass("open")||i.addClass("open")),jquery__WEBPACK_IMPORTED_MODULE_1___default()("#on_"+t).removeClass("hidden").toggleBy(!o),jquery__WEBPACK_IMPORTED_MODULE_1___default()("#off_"+t).removeClass("hidden").toggleBy(o),jquery__WEBPACK_IMPORTED_MODULE_1___default.a.ceDialog("fit_elements",{container:n,jelm:e}),!e.is("[type=checkbox]"))return!1};function toggleCheckbox(e){e.prop("checked",!e.prop("checked"))}var performPostRequest=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i='<input type="hidden" name="security_hash" value="'+_.security_hash+'">';jquery__WEBPACK_IMPORTED_MODULE_1___default.a.map(t,function(e,t){i+='<input type="hidden" name="'+t+'" value="'+e+'">'}),jquery__WEBPACK_IMPORTED_MODULE_1___default()('<form class="hidden" action="'+e+'" method="post" target="'+a+'">'+i+"</form>").appendTo(_.body).submit()}}});function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}
(function(_,$){var loadedScripts={};var loadedScriptPromises={};var sessionData={};(function($){var REQUEST_XML=1;var REQUEST_IFRAME=2;var REQUEST_COMET=3;var REQUEST_JSONP_POST=5;var QUERIES_LIMIT=1;var queryStack=[];var activeQueries=0;var evalCache={};var responseCache={};var getScriptQueries=0;var oldjQuery={};var methods={request:function request(url,params){params=params||{};params.method=params.method||'get';params.data=params.data||{};params.message=params.message||_.tr('loading');params.caching=params.caching||false;params.hidden=params.hidden||false;params.repeat_on_error=params.repeat_on_error||false;params.force_exec=params.force_exec||false;params.obj=params.obj||null;params.append=params.append||null;params.scroll=params.scroll||null;params.overlay=params.overlay||null;params.original_url=_.current_url||null;params.get_promise=params.get_promise||null;if(_.embedded){params.full_render=true;}
if(params.full_render){params.data.full_render=params.full_render;}
if(typeof params.data.security_hash=='undefined'&&typeof _.security_hash!='undefined'&&params.method.toLowerCase()=='post'){params.data.security_hash=_.security_hash;}
if(params.result_ids){params.data.result_ids=params.result_ids;}
if(params.skip_result_ids_check){params.data.skip_result_ids_check=params.skip_result_ids_check;}
if(activeQueries>=QUERIES_LIMIT){var result=true;if(params.get_promise){params.defered_object=methods.createDeferedObject();result=methods.createPromise(params.defered_object);}
queryStack.unshift(function(){methods.request(url,params);});return result;}
if(params.defered_object&&params.defered_object.isAborted){params.defered_object.reject({},'abort','abort');methods.executeNext();return false;}
if(params.hidden===false){$.toggleStatusBox('show',{overlay:params.overlay});}
var hash='';if(params.caching===true){hash=$.crc32(url+$.param(params.data));}
if(!hash||!responseCache[hash]){var saved_data={};var result_ids=params.data.result_ids?params.data.result_ids.split(','):[];if(result_ids.length>0){for(var j=0;j<result_ids.length;j++){var container=$('#'+result_ids[j]);var $save_fields_block=container.find('.cm-save-fields');if(container.hasClass('cm-save-fields')){saved_data[result_ids[j]]=$(':input:visible',container).serializeArray();}else if($save_fields_block.length){saved_data[result_ids[j]]=$(':input:visible',$save_fields_block).serializeArray();}}
params.saved_data=saved_data;}
if(url){url=fn_query_remove(url,'result_ids');if(url.indexOf('://')==-1){url=_.current_location+'/'+url;}
if(params.obj&&params.obj.hasClass('cm-comet')){params.url=url+'&result_ids='+params.result_ids+'&is_ajax='+REQUEST_COMET;return transports.iframe(null,params,{is_comet:true});}else{activeQueries++;var data_type=!$.support.cors&&url.indexOf('://'+window.location.hostname)==-1?'jsonp':'json';if(!('is_ajax'in params.data)&&data_type=='json'){params.data.is_ajax=REQUEST_XML;}
if(sessionData.name&&url.indexOf(sessionData.name)==-1){params.data[sessionData.name]=localStorage.getItem(sessionData.name);}
var components=$.parseUrl(url);if(components.anchor){params.data.anchor=components.anchor;}
var jqXHR=$.ajax({type:params.method,url:url,dataType:data_type,cache:true,data:params.data,xhrFields:{withCredentials:true},success:function success(data,textStatus){if(hash){responseCache[hash]=data;}
_response(data,params);},error:function error(XMLHttpRequest,textStatus,errorThrown){if(textStatus==='abort'){$.toggleStatusBox('hide');return false;}
if(params.repeat_on_error){params.repeat_on_error=false;methods.request(url,params);return false;}
$.toggleStatusBox('hide');if(params.hidden===false&&errorThrown){var err_msg=_.tr('error_ajax').str_replace('[error]',errorThrown);$.ceNotification('show',{type:'E',title:_.tr('error'),message:err_msg});}
if(params.error_callback&&typeof params.error_callback=='function'){params.error_callback(XMLHttpRequest,textStatus,errorThrown);}},complete:function complete(XMLHttpRequest,textStatus){methods.executeNext();}});if(params.get_promise){if(params.defered_object){var deferedObject=params.defered_object;}else{var deferedObject=methods.createDeferedObject();}
methods.bindXhrToDeferedObject(jqXHR,deferedObject);return methods.createPromise(deferedObject);}else{return jqXHR;}}}}else if(hash&&responseCache[hash]){var result=false;_response(responseCache[hash],params);if(params.get_promise){var deferedObject=methods.createDeferedObject();var result=methods.createPromise(deferedObject);deferedObject.resolve(responseCache[hash]);}
methods.executeNext();return result;}
return false;},submitForm:function submitForm(form,clicked_elm){if(activeQueries>=QUERIES_LIMIT){queryStack.unshift(function(){var submit_name=clicked_elm.attr('name'),submit_value=clicked_elm.val(),input;if(submit_name){input=$('<input>',{type:'hidden',value:submit_value,name:submit_name}).appendTo(form);}
if(methods.submitForm(form,clicked_elm)){form.get(0).submit();}
if(input){input.remove();}});return false;}
var params={form:form,obj:clicked_elm,scroll:clicked_elm.data('caScroll')||'',overlay:clicked_elm.data('caOverlay')||'',callback:'ce.formajaxpost_'+form.prop('name')};$.ceNotification('closeAll');$.toggleStatusBox('show',{overlay:params.overlay});var options=_getOptions(form,params);if(options.force_exec){params['force_exec']=true;}
if(sessionData.name){form.append('<input type="hidden" name="'+sessionData.name+'" value="'+localStorage.getItem(sessionData.name)+'">');}
if(options.full_render){form.append('<input type="hidden" name="full_render" value="Y">');}
form.append('<input type="hidden" name="is_ajax" value="'+(options.transport=='iframe'?options.is_comet?REQUEST_COMET:REQUEST_IFRAME:options.transport=='jsonpPOST'?REQUEST_JSONP_POST:REQUEST_XML)+'">');return transports[options.transport](form,params,options);},inProgress:function inProgress(){return activeQueries!==0;},clearCache:function clearCache(){responseCache={};return true;},response:function response(_response2,params){return _response(_response2,params);},executeNext:function executeNext(){activeQueries--;if(queryStack.length){var f=queryStack.shift();f();}},createDeferedObject:function createDeferedObject(){var deferredObject=$.Deferred();deferredObject.jqXHR=null;deferredObject.isAborted=false;deferredObject.abort=function(){deferredObject.isAborted=true;if(deferredObject.jqXHR){deferredObject.jqXHR.abort();}};return deferredObject;},bindXhrToDeferedObject:function bindXhrToDeferedObject(jqXHR,deferredObject){jqXHR.done(deferredObject.resolve);jqXHR.fail(deferredObject.reject);deferredObject.jqXHR=jqXHR;},createPromise:function createPromise(deferredObject){var promise=deferredObject.promise();promise.abort=function(){deferredObject.abort();};return promise;}};var transports={iframe:function iframe(form,params,options){var iframe=$('<iframe name="upload_iframe" src="about:blank" class="hidden"></iframe>').appendTo(_.body);activeQueries++;if(options.is_comet&&$('#comet_control:visible').length===0){$('#comet_container_controller').ceProgress('init');}
iframe.on('load',function(){var response={};var self=$(this);if(self.contents().text()!==null){eval('var response = '+self.contents().find('textarea').val());}
response=response||{};_response(response,params);if(options.is_comet&&jQuery.isEmptyObject(response)==false){if(typeof response.comet_is_finished==='undefined'){response.comet_is_finished=true;}
if(response.comet_is_finished){$('#comet_container_controller').ceProgress('finish');}
$.ceEvent('trigger','ce.cometdone',[form,params,options,response]);}
self.remove();activeQueries--;if(queryStack.length){var f=queryStack.shift();f();}});if(form){form.prop('target','upload_iframe');}else if(params.url){if(params.method=='post'){$('<form class="hidden" action="'+params.url+'" method="post" target="upload_iframe"><input type="hidden" name="security_hash" value="'+_.security_hash+'"></form>').appendTo(_.body).submit();}else{iframe.prop('src',params.url);}}
return true;},xml:function xml(form,params){if(form.hasClass('cm-outside-inputs')){var hash=form.serializeObject();}else{var hash=$(':input',form).serializeObject();}
if(params.obj&&params.obj.prop('name')){hash[params.obj.prop('name')]=params.obj.val();}
params['method']=form.prop('method');params['data']=hash;params['result_ids']=form.data('caTargetId');methods.request(form.prop('action'),params);return false;},jsonpPOST:function jsonpPOST(form,params,options){$.receiveMessage(function(e){if(options.is_comet){$('#comet_container_controller').ceProgress('finish');}
iframe.remove();_response($.parseJSON(e.data),params);activeQueries--;});var iframe=$('<iframe name="upload_iframe" src="about:blank" class="hidden"></iframe>').appendTo(_.body);activeQueries++;if(options.is_comet){$('#comet_container_controller').ceProgress('init');}
if(form){form.prop('target','upload_iframe');}else if(params.url){iframe.prop('src',params.url);}
return true;}};function _getOptions(obj,params){var is_comet=obj.hasClass('cm-comet')||params.obj&&params.obj.hasClass('cm-comet');var transport='xml';var uploads=is_comet;if(!is_comet&&obj.prop('enctype')=='multipart/form-data'){obj.find('input[type=file]').each(function(){if($(this).val()){uploads=true;}});}
if((!$.support.cors||_.embedded&&uploads)&&obj.prop('action').indexOf('//')!=-1&&obj.prop('action').indexOf('//'+window.location.hostname)==-1&&obj.prop('method')=='post'){transport='jsonpPOST';}else if(uploads){transport='iframe';}
return{'full_render':obj.hasClass('cm-ajax-full-render'),'is_comet':is_comet,'force_exec':obj.hasClass('cm-ajax-force'),'transport':transport};}
function _response(response,params){params=params||{};params.force_exec=params.force_exec||false;params.pre_processing=params.pre_processing||{};var regex_all=new RegExp("<script[^>\xA7]*>([\x01-\uFFFF]*?)</script>",'img');var matches=[];var match='';var elm;var data=response||{};var inline_scripts=null;var scripts_to_load=[];var elms=[];var content;if(params.pre_processing&&typeof params.pre_processing=='function'){params.pre_processing(data,params);}
if(data.force_redirection){$.toggleStatusBox('hide');$.redirect(data.force_redirection);return true;}
if($.isEmptyObject(evalCache)){$('script:not([src])').each(function(){var self=$(this);evalCache[$.crc32(self.html())]=true;});}
if(data.html){for(var k in data.html){elm=$('#'+k);if(elm.length!=1||data.html[k]===null){continue;}
if(data.html[k].indexOf('<form')!=-1&&elm.parents('form').length){$(_.body).append(elm);}
matches=data.html[k].match(regex_all);content=matches?data.html[k].replace(regex_all,''):data.html[k];$('textarea.cm-wysiwyg',elm).each(function(){$(this).ceEditor('destroy');});$.ceDialog('destroy_loaded',{content:content});if(params.append){elm.append(content);}else{elm.html(content);}
if(typeof params.saved_data!='undefined'&&typeof params.saved_data[k]!='undefined'){var elements=[];for(var i in params.saved_data[k]){elements[params.saved_data[k][i]['name']]=params.saved_data[k][i]['value'];}
$(':input:visible',elm).each(function(id,local_elm){var jelm=$(local_elm);if(typeof elements[jelm.prop('name')]!='undefined'&&!jelm.parents().hasClass('cm-skip-save-fields')){if(jelm.prop('type')=='radio'){if(jelm.val()==elements[jelm.prop('name')]){jelm.prop('checked',true);}}else{jelm.val(elements[jelm.prop('name')]);}
jelm.trigger('change');}});}
if(elm.html().trim()){elm.parents('.hidden.cm-hidden-wrapper').removeClass('hidden');}else{elm.parents('.cm-hidden-wrapper').addClass('hidden');}
var all_scripts=null,ext_scripts=null;if(matches){all_scripts=$(matches.join('\n'));ext_scripts=all_scripts.filter('[src]');inline_scripts=inline_scripts?inline_scripts.add(all_scripts.filter(':not([src])')):all_scripts.filter(':not([src])');if(ext_scripts.length){for(var i=0;i<ext_scripts.length;i++){var _src=ext_scripts.eq(i).prop('src');if(loadedScripts[_src]){if(ext_scripts.eq(i).hasClass('cm-ajax-force')){loadedScripts[_src]=null;}else{continue;}}
scripts_to_load.push($.getScript(_src));}}}
elms.push(elm);}
if($.ceDialog('inside_dialog',{jelm:elm})){$.ceDialog('reload_parent',{jelm:elm});}
if(response.title){$(document).prop('title',response.title);}}
var done_event=function done_event(){$.ceEvent('trigger','ce.ajaxdone',[elms,inline_scripts,params,data,response.text||'']);};if(scripts_to_load.length){$.when.apply(null,scripts_to_load).then(done_event);}else{done_event();}}
var ajax=$.ajax;$.ajax=function(origSettings){if(origSettings.dataType&&origSettings.dataType==='script'){var _src=origSettings.url,promise;if(loadedScripts[_src]){promise=_src in loadedScriptPromises?loadedScriptPromises[_src]:$.Deferred().resolve().promise();if('success'in origSettings){promise.done(origSettings.success);}}else{promise=ajax(origSettings);loadedScripts[_src]=true;loadedScriptPromises[_src]=promise;}
return promise;}
return ajax(origSettings);};$.getScript=function(url,callback){url=url.indexOf('//')==-1?_.current_location+'/'+url:url;if(_.otherjQ&&getScriptQueries===0){oldjQuery=jQuery;jQuery=_.$;}
getScriptQueries++;return $.ajax({type:"GET",url:url,success:function success(data,textStatus,jqxhr){getScriptQueries--;if(_.otherjQ&&getScriptQueries===0){_.$=jQuery;jQuery=oldjQuery;}
if(callback){callback(data,textStatus,jqxhr);}},dataType:"script",cache:true});};$.ceEvent('on','ce.ajaxdone',function(elms,scripts,params,response_data,response_text){var i;if(_.embedded&&response_data.language_changed){_.embedded=false;$.redirect(response_data.current_url,false);window.location.reload(true);return;}
if(params.on_ajax_done&&typeof params.on_ajax_done=='function'){params.on_ajax_done(response_data,params,response_text);}
if(scripts){for(i=0;i<scripts.length;i++){var _hash=$.crc32(scripts.eq(i).html());if(!evalCache[_hash]||params.force_exec||scripts.eq(i).hasClass('cm-ajax-force')){$.globalEval(scripts.eq(i).html());evalCache[_hash]=true;}}}
if(response_data.debug_info){console.log(response_data.debug_info);}
var link_history=params.save_history&&(!params.obj||params.obj&&$.ceDialog('inside_dialog',{jelm:params.obj})===false);if(response_data.session_data){sessionData=response_data.session_data;localStorage.setItem(sessionData.name,sessionData.id);}
if(response_data.current_url){var current_url=decodeURIComponent(response_data.current_url);if(!params.skip_history&&(_.embedded||link_history)){var _params=params;if(!link_history){_params.result_ids=_.container;}
if(response_data.anchor){current_url+='#'+response_data.anchor;}
$.ceHistory('load',current_url,_params,true);_.current_url=current_url;}
if(response_data.anchor){params.scroll=response_data.anchor;_.anchor='#'+response_data.anchor;}}
for(i=0;i<elms.length;i++){$.commonInit(elms[i]);}
if(params.form){$('input[name=is_ajax]',params.form).remove();$('input[name=full_render]',params.form).remove();if(params.form.hasClass('cm-disable-empty')||params.form.hasClass('cm-disable-empty-all')||params.form.hasClass('cm-disable-empty-files')){$('input.cm-disabled',params.form).prop('disabled',false).removeClass('cm-disabled');}
if(params.form.data('caAjaxDoneEvent')){$.ceEvent('trigger',params.form.data('caAjaxDoneEvent'),[response_data,params,response_text]);}}
if(params.callback&&$.isFunction(params.callback)){params.callback(response_data,params,response_text);}else if(params.callback){$.ceEvent('trigger',params.callback,[response_data,params,response_text]);}
if(!params.keep_status_box){$.toggleStatusBox('hide');}
if(params.scroll){if(!_.scrolling){$.scrollToElm(params.scroll);}}
if(response_data.notifications){$.ceNotification('showMany',response_data.notifications);}});$.ceAjax=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1));}else if(_typeof(method)==='object'||!method){return methods.init.apply(this,arguments);}else{$.error('ty.ajax: method '+method+' does not exist');}};})($);$(document).ready(function(){$('script').each(function(){var _src=$(this).prop('src');if(_src){loadedScripts[_src]=true;}});if(typeof ajax_callback_data!='undefined'&&ajax_callback_data){$.globalEval(ajax_callback_data);ajax_callback_data=false;}});})(Tygh,Tygh.$);(function(_,$){var locationWrapper={put:function put(hash,win){(win||window).location.hash=this.encoder(hash);},get:function get(win){var hash=(win||window).location.hash.replace(/^#/,'');try{return decodeURIComponent(hash);}catch(error){return hash;}},encoder:encodeURIComponent};var historyState={storage:null,first:'',put:function put(hash,params){if(!this.storage){this.storage={};this.first=hash;}
this.storage[hash]=params;},get:function get(hash){if(hash in this.storage){return this.storage[hash];}
return{};}};function initObjects(options){options=$.extend({unescape:false},options||{});locationWrapper.encoder=encoder(options.unescape);function encoder(unescape_){if(unescape_===true){return function(hash){return hash;};}
if(typeof unescape_=="string"&&(unescape_=partialDecoder(unescape_.split("")))||typeof unescape_=="function"){return function(hash){return unescape_(encodeURIComponent(hash));};}
return encodeURIComponent;}
function partialDecoder(chars){var re=new RegExp($.map(chars,encodeURIComponent).join("|"),"ig");return function(enc){return enc.replace(re,decodeURIComponent);};}}
var implementations={};implementations.base={callback:undefined,type:undefined,check:function check(){},load:function load(hash){},init:function init(callback,options){initObjects(options);self.callback=callback;self._options=options;self._init();},_init:function _init(){},_options:{}};implementations.hashchangeEvent={_skip:false,_init:function _init(){$(window).bind('hashchange',function(){if(self._skip===true){self._skip=false;return;}
self.check();});},check:function check(){var hash=locationWrapper.get()?locationWrapper.get():historyState.first;self.callback(hash,historyState.get(hash));},load:function load(hash,params){var current_hash=locationWrapper.get()?locationWrapper.get():historyState.first;historyState.put(hash,params);if(hash!=current_hash){self._skip=true;}
locationWrapper.put(hash);},reload:function reload(hash,params){historyState.put(hash,params);}};implementations.HTML5={_init:function _init(){$(window).bind('popstate',self.check);},check:function check(evt){var state=evt.originalEvent.state;self.callback(state?'#!/'+document.location:'',state);},load:function load(hash,params){window.history.pushState(params,null,_.current_location+'/'+hash.replace(/^\!\//,''));},reload:function reload(hash,params){window.history.replaceState(params,null,_.current_location+'/'+hash.replace(/^\!\//,''));}};var self=$.extend({},implementations.base);if(!_.embedded&&"pushState"in window.history){self.type='HTML5';}else if("onhashchange"in window){self.type='hashchangeEvent';}
if(self.type){$.extend(self,implementations[self.type]);$.history=self;}})(Tygh,Tygh.$);(function(factory){if(typeof define==="function"&&define.noamd){define(["jquery"],factory);}else if(typeof module==="object"&&module.exports){module.exports=factory(require("jquery"));}else{factory(window.jQuery);}}(function($){"use strict";function getElementSelection(that){var position={};if(that.selectionStart===undefined){that.focus();var select=document.selection.createRange();position.length=select.text.length;select.moveStart('character',-that.value.length);position.end=select.text.length;position.start=position.end-position.length;}else{position.start=that.selectionStart;position.end=that.selectionEnd;position.length=position.end-position.start;}
return position;}
function setElementSelection(that,start,end){if(that.selectionStart===undefined){that.focus();var r=that.createTextRange();r.collapse(true);r.moveEnd('character',end);r.moveStart('character',start);r.select();}else{that.selectionStart=start;that.selectionEnd=end;}}
function runCallbacks($this,settings){$.each(settings,function(k,val){if(typeof val==='function'){settings[k]=val($this,settings,k);}else if(typeof $this.autoNumeric[val]==='function'){settings[k]=$this.autoNumeric[val]($this,settings,k);}});}
function convertKeyToNumber(settings,key){if(typeof(settings[key])==='string'){settings[key]*=1;}}
function autoCode($this,settings){runCallbacks($this,settings);settings.tagList=['b','caption','cite','code','dd','del','div','dfn','dt','em','h1','h2','h3','h4','h5','h6','ins','kdb','label','li','output','p','q','s','sample','span','strong','td','th','u','var'];var vmax=settings.vMax.toString().split('.'),vmin=(!settings.vMin&&settings.vMin!==0)?[]:settings.vMin.toString().split('.');convertKeyToNumber(settings,'vMax');convertKeyToNumber(settings,'vMin');convertKeyToNumber(settings,'mDec');settings.mDec=(settings.mRound==='CHF')?'2':settings.mDec;settings.allowLeading=true;settings.aNeg=settings.vMin<0?'-':'';vmax[0]=vmax[0].replace('-','');vmin[0]=vmin[0].replace('-','');settings.mInt=Math.max(vmax[0].length,vmin[0].length,1);if(settings.mDec===null){var vmaxLength=0,vminLength=0;if(vmax[1]){vmaxLength=vmax[1].length;}
if(vmin[1]){vminLength=vmin[1].length;}
settings.mDec=Math.max(vmaxLength,vminLength);}
if(settings.altDec===null&&settings.mDec>0){if(settings.aDec==='.'&&settings.aSep!==','){settings.altDec=',';}else if(settings.aDec===','&&settings.aSep!=='.'){settings.altDec='.';}}
var aNegReg=settings.aNeg?'([-\\'+settings.aNeg+']?)':'(-?)';settings.aNegRegAutoStrip=aNegReg;settings.skipFirstAutoStrip=new RegExp(aNegReg+'[^-'+(settings.aNeg?'\\'+settings.aNeg:'')+'\\'+settings.aDec+'\\d]'+'.*?(\\d|\\'+settings.aDec+'\\d)');settings.skipLastAutoStrip=new RegExp('(\\d\\'+settings.aDec+'?)[^\\'+settings.aDec+'\\d]\\D*$');var allowed='-'+settings.aNum+'\\'+settings.aDec;settings.allowedAutoStrip=new RegExp('[^'+allowed+']','gi');settings.numRegAutoStrip=new RegExp(aNegReg+'(?:\\'+settings.aDec+'?(\\d+\\'+settings.aDec+'\\d+)|(\\d*(?:\\'+settings.aDec+'\\d*)?))');return settings;}
function autoStrip(s,settings,strip_zero){if(settings.aSign){while(s.indexOf(settings.aSign)>-1){s=s.replace(settings.aSign,'');}}
s=s.replace(settings.skipFirstAutoStrip,'$1$2');s=s.replace(settings.skipLastAutoStrip,'$1');s=s.replace(settings.allowedAutoStrip,'');if(settings.altDec){s=s.replace(settings.altDec,settings.aDec);}
var m=s.match(settings.numRegAutoStrip);s=m?[m[1],m[2],m[3]].join(''):'';if((settings.lZero==='allow'||settings.lZero==='keep')&&strip_zero!=='strip'){var parts=[],nSign='';parts=s.split(settings.aDec);if(parts[0].indexOf('-')!==-1){nSign='-';parts[0]=parts[0].replace('-','');}
if(parts[0].length>settings.mInt&&parts[0].charAt(0)==='0'){parts[0]=parts[0].slice(1);}
s=nSign+parts.join(settings.aDec);}
if((strip_zero&&settings.lZero==='deny')||(strip_zero&&settings.lZero==='allow'&&settings.allowLeading===false)){var strip_reg='^'+settings.aNegRegAutoStrip+'0*(\\d'+(strip_zero==='leading'?')':'|$)');strip_reg=new RegExp(strip_reg);s=s.replace(strip_reg,'$1$2');}
return s;}
function negativeBracket(s,settings){if(settings.pSign==='p'){var brackets=settings.nBracket.split(',');if(!settings.hasFocus&&!settings.removeBrackets){s=s.replace(settings.aNeg,'');s=brackets[0]+s+brackets[1];}else if((settings.hasFocus&&s.charAt(0)===brackets[0])||(settings.removeBrackets&&s.charAt(0)===brackets[0])){s=s.replace(brackets[0],settings.aNeg);s=s.replace(brackets[1],'');}}
return s;}
function checkValue(value,settings){if(value){var checkSmall=+value;if(checkSmall<0.000001&&checkSmall>-1){value=+value;if(value<0.000001&&value>0){value=(value+10).toString();value=value.substring(1);}
if(value<0&&value>-1){value=(value-10).toString();value='-'+value.substring(2);}
value=value.toString();}else{var parts=value.split('.');if(parts[1]!==undefined){if(+parts[1]===0){value=parts[0];}else{parts[1]=parts[1].replace(/0*$/,'');value=parts.join('.');}}}}
return(settings.lZero==='keep')?value:value.replace(/^0*(\d)/,'$1');}
function fixNumber(s,aDec,aNeg){if(aDec&&aDec!=='.'){s=s.replace(aDec,'.');}
if(aNeg&&aNeg!=='-'){s=s.replace(aNeg,'-');}
if(!s.match(/\d/)){s+='0';}
return s;}
function presentNumber(s,aDec,aNeg){if(aNeg&&aNeg!=='-'){s=s.replace('-',aNeg);}
if(aDec&&aDec!=='.'){s=s.replace('.',aDec);}
return s;}
function checkEmpty(iv,settings,signOnEmpty){if(iv===''||iv===settings.aNeg){if(settings.wEmpty==='zero'){return iv+'0';}
if(settings.wEmpty==='sign'||signOnEmpty){return iv+settings.aSign;}
return iv;}
return null;}
function autoGroup(iv,settings){iv=autoStrip(iv,settings);var testNeg=iv.replace(',','.'),empty=checkEmpty(iv,settings,true);if(empty!==null){return empty;}
var digitalGroup='';if(settings.dGroup===2){digitalGroup=/(\d)((\d)(\d{2}?)+)$/;}else if(settings.dGroup===4){digitalGroup=/(\d)((\d{4}?)+)$/;}else{digitalGroup=/(\d)((\d{3}?)+)$/;}
var ivSplit=iv.split(settings.aDec);if(settings.altDec&&ivSplit.length===1){ivSplit=iv.split(settings.altDec);}
var s=ivSplit[0];if(settings.aSep){while(digitalGroup.test(s)){s=s.replace(digitalGroup,'$1'+settings.aSep+'$2');}}
if(settings.mDec!==0&&ivSplit.length>1){if(ivSplit[1].length>settings.mDec){ivSplit[1]=ivSplit[1].substring(0,settings.mDec);}
iv=s+settings.aDec+ivSplit[1];}else{iv=s;}
if(settings.aSign){var has_aNeg=iv.indexOf(settings.aNeg)!==-1;iv=iv.replace(settings.aNeg,'');iv=settings.pSign==='p'?settings.aSign+iv:iv+settings.aSign;if(has_aNeg){iv=settings.aNeg+iv;}}
if(testNeg<0&&settings.nBracket!==null){iv=negativeBracket(iv,settings);}
return iv;}
function autoRound(iv,settings){iv=(iv==='')?'0':iv.toString();convertKeyToNumber(settings,'mDec');if(settings.mRound==='CHF'){iv=(Math.round(iv*20)/ 20).toString();}
var ivRounded='',i=0,nSign='',rDec=(typeof(settings.aPad)==='boolean'||settings.aPad===null)?(settings.aPad?settings.mDec:0):+settings.aPad;var truncateZeros=function(ivRounded){var regex=(rDec===0)?(/(\.(?:\d*[1-9])?)0*$/):rDec===1?(/(\.\d(?:\d*[1-9])?)0*$/):new RegExp('(\\.\\d{'+rDec+'}(?:\\d*[1-9])?)0*$');ivRounded=ivRounded.replace(regex,'$1');if(rDec===0){ivRounded=ivRounded.replace(/\.$/,'');}
return ivRounded;};if(iv.charAt(0)==='-'){nSign='-';iv=iv.replace('-','');}
if(!iv.match(/^\d/)){iv='0'+iv;}
if(nSign==='-'&&+iv===0){nSign='';}
if((+iv>0&&settings.lZero!=='keep')||(iv.length>0&&settings.lZero==='allow')){iv=iv.replace(/^0*(\d)/,'$1');}
var dPos=iv.lastIndexOf('.'),vdPos=(dPos===-1)?iv.length-1:dPos,cDec=(iv.length-1)-vdPos;if(cDec<=settings.mDec){ivRounded=iv;if(cDec<rDec){if(dPos===-1){ivRounded+=settings.aDec;}
var zeros='000000';while(cDec<rDec){zeros=zeros.substring(0,rDec-cDec);ivRounded+=zeros;cDec+=zeros.length;}}else if(cDec>rDec){ivRounded=truncateZeros(ivRounded);}else if(cDec===0&&rDec===0){ivRounded=ivRounded.replace(/\.$/,'');}
if(settings.mRound!=='CHF'){return(+ivRounded===0)?ivRounded:nSign+ivRounded;}
if(settings.mRound==='CHF'){dPos=ivRounded.lastIndexOf('.');iv=ivRounded;}}
var rLength=dPos+settings.mDec,tRound=+iv.charAt(rLength+1),ivArray=iv.substring(0,rLength+1).split(''),odd=(iv.charAt(rLength)==='.')?(iv.charAt(rLength-1)%2):(iv.charAt(rLength)%2),onePass=true;if(odd!==1){odd=(odd===0&&(iv.substring(rLength+2,iv.length)>0))?1:0;}
if((tRound>4&&settings.mRound==='S')||(tRound>4&&settings.mRound==='A'&&nSign==='')||(tRound>5&&settings.mRound==='A'&&nSign==='-')||(tRound>5&&settings.mRound==='s')||(tRound>5&&settings.mRound==='a'&&nSign==='')||(tRound>4&&settings.mRound==='a'&&nSign==='-')||(tRound>5&&settings.mRound==='B')||(tRound===5&&settings.mRound==='B'&&odd===1)||(tRound>0&&settings.mRound==='C'&&nSign==='')||(tRound>0&&settings.mRound==='F'&&nSign==='-')||(tRound>0&&settings.mRound==='U')||(settings.mRound==='CHF')){for(i=(ivArray.length-1);i>=0;i-=1){if(ivArray[i]!=='.'){if(settings.mRound==='CHF'&&ivArray[i]<=2&&onePass){ivArray[i]=0;onePass=false;break;}
if(settings.mRound==='CHF'&&ivArray[i]<=7&&onePass){ivArray[i]=5;onePass=false;break;}
if(settings.mRound==='CHF'&&onePass){ivArray[i]=10;onePass=false;}else{ivArray[i]=+ivArray[i]+1;}
if(ivArray[i]<10){break;}
if(i>0){ivArray[i]='0';}}}}
ivArray=ivArray.slice(0,rLength+1);ivRounded=truncateZeros(ivArray.join(''));return(+ivRounded===0)?ivRounded:nSign+ivRounded;}
function truncateDecimal(s,settings,paste){var aDec=settings.aDec,mDec=settings.mDec;s=(paste==='paste')?autoRound(s,settings):s;if(aDec&&mDec){var parts=s.split(aDec);if(parts[1]&&parts[1].length>mDec){if(mDec>0){parts[1]=parts[1].substring(0,mDec);s=parts.join(aDec);}else{s=parts[0];}}}
return s;}
function autoCheck(s,settings){s=autoStrip(s,settings);s=truncateDecimal(s,settings);s=fixNumber(s,settings.aDec,settings.aNeg);var value=+s;return value>=settings.vMin&&value<=settings.vMax;}
function AutoNumericHolder(that,settings){this.settings=settings;this.that=that;this.$that=$(that);this.formatted=false;this.settingsClone=autoCode(this.$that,this.settings);this.value=that.value;}
AutoNumericHolder.prototype={init:function(e){this.value=this.that.value;this.settingsClone=autoCode(this.$that,this.settings);this.ctrlKey=e.ctrlKey;this.cmdKey=e.metaKey;this.shiftKey=e.shiftKey;this.selection=getElementSelection(this.that);if(e.type==='keydown'||e.type==='keyup'){this.kdCode=e.keyCode;}
this.which=e.which;this.processed=false;this.formatted=false;},setSelection:function(start,end,setReal){start=Math.max(start,0);end=Math.min(end,this.that.value.length);this.selection={start:start,end:end,length:end-start};if(setReal===undefined||setReal){setElementSelection(this.that,start,end);}},setPosition:function(pos,setReal){this.setSelection(pos,pos,setReal);},getBeforeAfter:function(){var value=this.value,left=value.substring(0,this.selection.start),right=value.substring(this.selection.end,value.length);return[left,right];},getBeforeAfterStriped:function(){var parts=this.getBeforeAfter();parts[0]=autoStrip(parts[0],this.settingsClone);parts[1]=autoStrip(parts[1],this.settingsClone);return parts;},normalizeParts:function(left,right){var settingsClone=this.settingsClone;right=autoStrip(right,settingsClone);var strip=right.match(/^\d/)?true:'leading';left=autoStrip(left,settingsClone,strip);if((left===''||left===settingsClone.aNeg)&&settingsClone.lZero==='deny'){if(right>''){right=right.replace(/^0*(\d)/,'$1');}}
var new_value=left+right;if(settingsClone.aDec){var m=new_value.match(new RegExp('^'+settingsClone.aNegRegAutoStrip+'\\'+settingsClone.aDec));if(m){left=left.replace(m[1],m[1]+'0');new_value=left+right;}}
if(settingsClone.wEmpty==='zero'&&(new_value===settingsClone.aNeg||new_value==='')){left+='0';}
return[left,right];},setValueParts:function(left,right,paste){var settingsClone=this.settingsClone,parts=this.normalizeParts(left,right),new_value=parts.join(''),position=parts[0].length;if(autoCheck(new_value,settingsClone)){new_value=truncateDecimal(new_value,settingsClone,paste);if(position>new_value.length){position=new_value.length;}
this.value=new_value;this.setPosition(position,false);return true;}
return false;},signPosition:function(){var settingsClone=this.settingsClone,aSign=settingsClone.aSign,that=this.that;if(aSign){var aSignLen=aSign.length;if(settingsClone.pSign==='p'){var hasNeg=settingsClone.aNeg&&that.value&&that.value.charAt(0)===settingsClone.aNeg;return hasNeg?[1,aSignLen+1]:[0,aSignLen];}
var valueLen=that.value.length;return[valueLen-aSignLen,valueLen];}
return[1000,-1];},expandSelectionOnSign:function(setReal){var sign_position=this.signPosition(),selection=this.selection;if(selection.start<sign_position[1]&&selection.end>sign_position[0]){if((selection.start<sign_position[0]||selection.end>sign_position[1])&&this.value.substring(Math.max(selection.start,sign_position[0]),Math.min(selection.end,sign_position[1])).match(/^\s*$/)){if(selection.start<sign_position[0]){this.setSelection(selection.start,sign_position[0],setReal);}else{this.setSelection(sign_position[1],selection.end,setReal);}}else{this.setSelection(Math.min(selection.start,sign_position[0]),Math.max(selection.end,sign_position[1]),setReal);}}},checkPaste:function(){if(this.valuePartsBeforePaste!==undefined){var parts=this.getBeforeAfter(),oldParts=this.valuePartsBeforePaste;delete this.valuePartsBeforePaste;parts[0]=parts[0].substr(0,oldParts[0].length)+autoStrip(parts[0].substr(oldParts[0].length),this.settingsClone);if(!this.setValueParts(parts[0],parts[1],'paste')){this.value=oldParts.join('');this.setPosition(oldParts[0].length,false);}}},skipAllways:function(e){var kdCode=this.kdCode,which=this.which,ctrlKey=this.ctrlKey,cmdKey=this.cmdKey,shiftKey=this.shiftKey;if(((ctrlKey||cmdKey)&&e.type==='keyup'&&this.valuePartsBeforePaste!==undefined)||(shiftKey&&kdCode===45)){this.checkPaste();return false;}
if((kdCode>=112&&kdCode<=123)||(kdCode>=91&&kdCode<=93)||(kdCode>=9&&kdCode<=31)||(kdCode<8&&(which===0||which===kdCode))||kdCode===144||kdCode===145||kdCode===45||kdCode===224){return true;}
if((ctrlKey||cmdKey)&&kdCode===65){return true;}
if((ctrlKey||cmdKey)&&(kdCode===67||kdCode===86||kdCode===88)){if(e.type==='keydown'){this.expandSelectionOnSign();}
if(kdCode===86||kdCode===45){if(e.type==='keydown'||e.type==='keypress'){if(this.valuePartsBeforePaste===undefined){this.valuePartsBeforePaste=this.getBeforeAfter();}}else{this.checkPaste();}}
return e.type==='keydown'||e.type==='keypress'||kdCode===67;}
if(ctrlKey||cmdKey){return true;}
if(kdCode===37||kdCode===39){var aSep=this.settingsClone.aSep,start=this.selection.start,value=this.that.value;if(e.type==='keydown'&&aSep&&!this.shiftKey){if(kdCode===37&&value.charAt(start-2)===aSep){this.setPosition(start-1);}else if(kdCode===39&&value.charAt(start+1)===aSep){this.setPosition(start+1);}}
return true;}
if(kdCode>=34&&kdCode<=40){return true;}
return false;},processAllways:function(){var parts;if(this.kdCode===8||this.kdCode===46){if(!this.selection.length){parts=this.getBeforeAfterStriped();if(this.kdCode===8){parts[0]=parts[0].substring(0,parts[0].length-1);}else{parts[1]=parts[1].substring(1,parts[1].length);}
this.setValueParts(parts[0],parts[1]);}else{this.expandSelectionOnSign(false);parts=this.getBeforeAfterStriped();this.setValueParts(parts[0],parts[1]);}
return true;}
return false;},processKeypress:function(){var settingsClone=this.settingsClone,cCode=String.fromCharCode(this.which),parts=this.getBeforeAfterStriped(),left=parts[0],right=parts[1];if(cCode===settingsClone.aDec||(settingsClone.altDec&&cCode===settingsClone.altDec)||((cCode==='.'||cCode===',')&&this.kdCode===110)){if(!settingsClone.mDec||!settingsClone.aDec){return true;}
if(settingsClone.aNeg&&right.indexOf(settingsClone.aNeg)>-1){return true;}
if(left.indexOf(settingsClone.aDec)>-1){return true;}
if(right.indexOf(settingsClone.aDec)>0){return true;}
if(right.indexOf(settingsClone.aDec)===0){right=right.substr(1);}
this.setValueParts(left+settingsClone.aDec,right);return true;}
if(cCode==='-'||cCode==='+'){if(!settingsClone.aNeg){return true;}
if(left===''&&right.indexOf(settingsClone.aNeg)>-1){left=settingsClone.aNeg;right=right.substring(1,right.length);}
if(left.charAt(0)===settingsClone.aNeg){left=left.substring(1,left.length);}else{left=(cCode==='-')?settingsClone.aNeg+left:left;}
this.setValueParts(left,right);return true;}
if(cCode>='0'&&cCode<='9'){if(settingsClone.aNeg&&left===''&&right.indexOf(settingsClone.aNeg)>-1){left=settingsClone.aNeg;right=right.substring(1,right.length);}
if(settingsClone.vMax<=0&&settingsClone.vMin<settingsClone.vMax&&this.value.indexOf(settingsClone.aNeg)===-1&&cCode!=='0'){left=settingsClone.aNeg+left;}
this.setValueParts(left+cCode,right);return true;}
return true;},formatQuick:function(){var settingsClone=this.settingsClone,parts=this.getBeforeAfterStriped(),leftLength=this.value;if((settingsClone.aSep===''||(settingsClone.aSep!==''&&leftLength.indexOf(settingsClone.aSep)===-1))&&(settingsClone.aSign===''||(settingsClone.aSign!==''&&leftLength.indexOf(settingsClone.aSign)===-1))){var subParts=[],nSign='';subParts=leftLength.split(settingsClone.aDec);if(subParts[0].indexOf('-')>-1){nSign='-';subParts[0]=subParts[0].replace('-','');parts[0]=parts[0].replace('-','');}
if(subParts[0].length>settingsClone.mInt&&parts[0].charAt(0)==='0'){parts[0]=parts[0].slice(1);}
parts[0]=nSign+parts[0];}
var value=autoGroup(this.value,this.settingsClone),position=value.length;if(value){var left_ar=parts[0].split(''),i=0;for(i;i<left_ar.length;i+=1){if(!left_ar[i].match('\\d')){left_ar[i]='\\'+left_ar[i];}}
var leftReg=new RegExp('^.*?'+left_ar.join('.*?'));var newLeft=value.match(leftReg);if(newLeft){position=newLeft[0].length;if(((position===0&&value.charAt(0)!==settingsClone.aNeg)||(position===1&&value.charAt(0)===settingsClone.aNeg))&&settingsClone.aSign&&settingsClone.pSign==='p'){position=this.settingsClone.aSign.length+(value.charAt(0)==='-'?1:0);}}else if(settingsClone.aSign&&settingsClone.pSign==='s'){position-=settingsClone.aSign.length;}}
this.that.value=value;this.setPosition(position);this.formatted=true;}};function autoGet(obj){if(typeof obj==='string'){obj=obj.replace(/\[/g,"\\[").replace(/\]/g,"\\]");obj='#'+obj.replace(/(:|\.)/g,'\\$1');}
return $(obj);}
function getHolder($that,settings,update){var data=$that.data('autoNumeric');if(!data){data={};$that.data('autoNumeric',data);}
var holder=data.holder;if((holder===undefined&&settings)||update){holder=new AutoNumericHolder($that.get(0),settings);data.holder=holder;}
return holder;}
var methods={init:function(options){return this.each(function(){var $this=$(this),settings=$this.data('autoNumeric'),tagData=$this.data(),$input=$this.is('input[type=text], input[type=hidden], input[type=tel], input:not([type])');if(typeof settings!=='object'){settings=$.extend({},$.fn.autoNumeric.defaults,tagData,options,{aNum:'0123456789',hasFocus:false,removeBrackets:false,runOnce:false,tagList:['b','caption','cite','code','dd','del','div','dfn','dt','em','h1','h2','h3','h4','h5','h6','ins','kdb','label','li','output','p','q','s','sample','span','strong','td','th','u','var']});if(settings.aDec===settings.aSep){$.error("autoNumeric will not function properly when the decimal character aDec: '"+settings.aDec+"' and thousand separator aSep: '"+settings.aSep+"' are the same character");}
$this.data('autoNumeric',settings);}else{return this;}
var holder=getHolder($this,settings);if(!$input&&$this.prop('tagName').toLowerCase()==='input'){$.error('The input type "'+$this.prop('type')+'" is not supported by autoNumeric()');}
if($.inArray($this.prop('tagName').toLowerCase(),settings.tagList)===-1&&$this.prop('tagName').toLowerCase()!=='input'){$.error("The <"+$this.prop('tagName').toLowerCase()+"> is not supported by autoNumeric()");}
if(settings.runOnce===false&&settings.aForm){if($input){var setValue=true;if($this[0].value===''&&settings.wEmpty==='empty'){$this[0].value='';setValue=false;}
if($this[0].value===''&&settings.wEmpty==='sign'){$this[0].value=settings.aSign;setValue=false;}
if(setValue&&$this.val()!==''&&((settings.anDefault===null&&$this[0].value===$this.prop('defaultValue'))||(settings.anDefault!==null&&settings.anDefault.toString()===$this.val()))){$this.autoNumeric('set',$this.val());}}
if($.inArray($this.prop('tagName').toLowerCase(),settings.tagList)!==-1&&$this.text()!==''){$this.autoNumeric('set',$this.text());}}
settings.runOnce=true;if($this.is('input[type=text], input[type=hidden], input[type=tel], input:not([type])')){$this.on('keydown.autoNumeric',function(e){holder=getHolder($this);if(holder.settings.aDec===holder.settings.aSep){$.error("autoNumeric will not function properly when the decimal character aDec: '"+holder.settings.aDec+"' and thousand separator aSep: '"+holder.settings.aSep+"' are the same character");}
if(holder.that.readOnly){holder.processed=true;return true;}
holder.init(e);if(holder.skipAllways(e)){holder.processed=true;return true;}
if(holder.processAllways()){holder.processed=true;holder.formatQuick();e.preventDefault();return false;}
holder.formatted=false;return true;});$this.on('keypress.autoNumeric',function(e){holder=getHolder($this);var processed=holder.processed;holder.init(e);if(holder.skipAllways(e)){return true;}
if(processed){e.preventDefault();return false;}
if(holder.processAllways()||holder.processKeypress()){holder.formatQuick();e.preventDefault();return false;}
holder.formatted=false;});$this.on('keyup.autoNumeric',function(e){holder=getHolder($this);holder.init(e);var skip=holder.skipAllways(e);holder.kdCode=0;delete holder.valuePartsBeforePaste;if($this[0].value===holder.settings.aSign){if(holder.settings.pSign==='s'){setElementSelection(this,0,0);}else{setElementSelection(this,holder.settings.aSign.length,holder.settings.aSign.length);}}
if(skip){return true;}
if(this.value===''){return true;}
if(!holder.formatted){holder.formatQuick();}});$this.on('focusin.autoNumeric',function(){holder=getHolder($this);var $settings=holder.settingsClone;$settings.hasFocus=true;if($settings.nBracket!==null){var checkVal=$this.val();$this.val(negativeBracket(checkVal,$settings));}
holder.inVal=$this.val();var onEmpty=checkEmpty(holder.inVal,$settings,true);if(onEmpty!==null&&onEmpty!==''){$this.val(onEmpty);}});$this.on('focusout.autoNumeric',function(){holder=getHolder($this);var $settings=holder.settingsClone,value=$this.val(),origValue=value;$settings.hasFocus=false;var strip_zero='';if($settings.lZero==='allow'){$settings.allowLeading=false;strip_zero='leading';}
if(value!==''){value=autoStrip(value,$settings,strip_zero);if(checkEmpty(value,$settings)===null&&autoCheck(value,$settings,$this[0])){value=fixNumber(value,$settings.aDec,$settings.aNeg);value=autoRound(value,$settings);value=presentNumber(value,$settings.aDec,$settings.aNeg);}else{value='';}}
var groupedValue=checkEmpty(value,$settings,false);if(groupedValue===null){groupedValue=autoGroup(value,$settings);}
if(groupedValue!==holder.inVal||groupedValue!==origValue){$this.val(groupedValue);$this.change();delete holder.inVal;}});}});},destroy:function(){return $(this).each(function(){var $this=$(this);$this.removeData('autoNumeric');$this.off('autoNumeric');});},update:function(options){return $(this).each(function(){var $this=autoGet($(this)),settings=$this.data('autoNumeric');if(typeof settings!=='object'){$.error("You must initialize autoNumeric('init', {options}) prior to calling the 'update' method");}
var strip=$this.autoNumeric('get');settings=$.extend(settings,options);getHolder($this,settings,true);if(settings.aDec===settings.aSep){$.error("autoNumeric will not function properly when the decimal character aDec: '"+settings.aDec+"' and thousand separator aSep: '"+settings.aSep+"' are the same character");}
$this.data('autoNumeric',settings);if($this.val()!==''||$this.text()!==''){return $this.autoNumeric('set',strip);}
return;});},set:function(valueIn){if(valueIn===null||isNaN(valueIn)){return;}
return $(this).each(function(){var $this=autoGet($(this)),settings=$this.data('autoNumeric'),value=valueIn.toString(),testValue=valueIn.toString(),$input=$this.is('input[type=text], input[type=hidden], input[type=tel], input:not([type])');if(typeof settings!=='object'){$.error("You must initialize autoNumeric('init', {options}) prior to calling the 'set' method");}
if((testValue===$this.attr('value')||testValue===$this.text())&&settings.runOnce===false){value=value.replace(',','.');}
if(!$.isNumeric(+value)){$.error("The value ("+value+") being 'set' is not numeric and has caused a error to be thrown");}
value=checkValue(value,settings);settings.setEvent=true;value.toString();if(value!==''){value=autoRound(value,settings);}
value=presentNumber(value,settings.aDec,settings.aNeg);if(!autoCheck(value,settings)){value=autoRound('',settings);}
value=autoGroup(value,settings);if($input){return $this.val(value);}
if($.inArray($this.prop('tagName').toLowerCase(),settings.tagList)!==-1){return $this.text(value);}
return false;});},get:function(){var $this=autoGet($(this)),settings=$this.data('autoNumeric');if(typeof settings!=='object'){$.error("You must initialize autoNumeric('init', {options}) prior to calling the 'get' method");}
var getValue='';if($this.is('input[type=text], input[type=hidden], input[type=tel], input:not([type])')){getValue=$this.eq(0).val();}else if($.inArray($this.prop('tagName').toLowerCase(),settings.tagList)!==-1){getValue=$this.eq(0).text();}else{$.error("The <"+$this.prop('tagName').toLowerCase()+"> is not supported by autoNumeric()");}
if((getValue===''&&settings.wEmpty==='empty')||(getValue===settings.aSign&&(settings.wEmpty==='sign'||settings.wEmpty==='empty'))){return'';}
if(getValue!==''&&settings.nBracket!==null){settings.removeBrackets=true;getValue=negativeBracket(getValue,settings);settings.removeBrackets=false;}
if(settings.runOnce||settings.aForm===false){getValue=autoStrip(getValue,settings);}
getValue=fixNumber(getValue,settings.aDec,settings.aNeg);if(+getValue===0&&settings.lZero!=='keep'){getValue='0';}
if(settings.lZero==='keep'){return getValue;}
getValue=checkValue(getValue,settings);return getValue;},getString:function(){var isAutoNumeric=false,$this=autoGet($(this)),formFields=$this.serialize(),formParts=formFields.split('&'),formIndex=$('form').index($this),allFormElements=$('form:eq('+formIndex+')'),aiIndex=[],scIndex=[],rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i,rcheckableType=/^(?:checkbox|radio)$/i,rnonAutoNumericTypes=/^(?:button|checkbox|color|date|datetime|datetime-local|email|file|image|month|number|password|radio|range|reset|search|submit|time|url|week)/i,count=0;$.each(allFormElements[0],function(i,field){if(field.name!==''&&rsubmittable.test(field.localName)&&!rsubmitterTypes.test(field.type)&&!field.disabled&&(field.checked||!rcheckableType.test(field.type))){scIndex.push(count);count=count+1;}else{scIndex.push(-1);}});count=0;$.each(allFormElements[0],function(i,field){if(field.localName==='input'&&(field.type===''||field.type==='text'||field.type==='hidden'||field.type==='tel')){aiIndex.push(count);count=count+1;}else{aiIndex.push(-1);if(field.localName==='input'&&rnonAutoNumericTypes.test(field.type)){count=count+1;}}});$.each(formParts,function(i,miniParts){miniParts=formParts[i].split('=');var scElement=$.inArray(i,scIndex);if(scElement>-1&&aiIndex[scElement]>-1){var testInput=$('form:eq('+formIndex+') input:eq('+aiIndex[scElement]+')'),settings=testInput.data('autoNumeric');if(typeof settings==='object'){if(miniParts[1]!==null){miniParts[1]=$('form:eq('+formIndex+') input:eq('+aiIndex[scElement]+')').autoNumeric('get').toString();formParts[i]=miniParts.join('=');isAutoNumeric=true;}}}});if(!isAutoNumeric){$.error("You must initialize autoNumeric('init', {options}) prior to calling the 'getString' method");}
return formParts.join('&');},getArray:function(){var isAutoNumeric=false,$this=autoGet($(this)),formFields=$this.serializeArray(),formIndex=$('form').index($this),allFormElements=$('form:eq('+formIndex+')'),aiIndex=[],scIndex=[],rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i,rcheckableType=/^(?:checkbox|radio)$/i,rnonAutoNumericTypes=/^(?:button|checkbox|color|date|datetime|datetime-local|email|file|image|month|number|password|radio|range|reset|search|submit|time|url|week)/i,count=0;$.each(allFormElements[0],function(i,field){if(field.name!==''&&rsubmittable.test(field.localName)&&!rsubmitterTypes.test(field.type)&&!field.disabled&&(field.checked||!rcheckableType.test(field.type))){scIndex.push(count);count=count+1;}else{scIndex.push(-1);}});count=0;$.each(allFormElements[0],function(i,field){if(field.localName==='input'&&(field.type===''||field.type==='text'||field.type==='hidden'||field.type==='tel')){aiIndex.push(count);count=count+1;}else{aiIndex.push(-1);if(field.localName==='input'&&rnonAutoNumericTypes.test(field.type)){count=count+1;}}});$.each(formFields,function(i,field){var scElement=$.inArray(i,scIndex);if(scElement>-1&&aiIndex[scElement]>-1){var testInput=$('form:eq('+formIndex+') input:eq('+aiIndex[scElement]+')'),settings=testInput.data('autoNumeric');if(typeof settings==='object'){field.value=$('form:eq('+formIndex+') input:eq('+aiIndex[scElement]+')').autoNumeric('get').toString();isAutoNumeric=true;}}});if(!isAutoNumeric){$.error("None of the successful form inputs are initialized by autoNumeric.");}
return formFields;},getSettings:function(){var $this=autoGet($(this));return $this.eq(0).data('autoNumeric');}};$.fn.autoNumeric=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1));}
if(typeof method==='object'||!method){return methods.init.apply(this,arguments);}
$.error('Method "'+method+'" is not supported by autoNumeric()');};$.fn.autoNumeric.defaults={aSep:',',dGroup:'3',aDec:'.',altDec:null,aSign:'',pSign:'p',vMax:'9999999999999.99',vMin:'-9999999999999.99',mDec:null,mRound:'S',aPad:true,nBracket:null,wEmpty:'empty',lZero:'allow',sNumber:true,aForm:true,anDefault:null};}));(function($){$.fn.appear=function(fn,options){var settings=$.extend({data:undefined,one:true},options);return this.each(function(){var t=$(this);t.appeared=false;if(!fn){t.trigger('appear',settings.data);return;}
var w=settings.container?$(settings.container):$(window);if(settings.container){w.data('customContainer',true);}
var check=function(){if(!t.is(':visible')){t.appeared=false;return;}
var a=w.scrollLeft();var b=w.scrollTop();var wh=w.height();var ww=w.width();var o=t.offset();if(w.data('customContainer')){var cOffset=w.offset();var x=o.left-cOffset.left+a;var y=o.top-cOffset.top+b;}else{var x=o.left;var y=o.top;}
if(y+t.height()>=b&&y<=b+wh&&x+t.width()>=a&&x<=a+ww){if(!t.appeared)t.trigger('appear',settings.data);}else{t.appeared=false;}};var modifiedFn=function(){t.appeared=true;if(settings.one){w.unbind('scroll',check);var i=$.inArray(check,$.fn.appear.checks);if(i>=0)$.fn.appear.checks.splice(i,1);}
fn.apply(this,arguments);};if(settings.one)t.one('appear',settings.data,modifiedFn);else t.bind('appear',settings.data,modifiedFn);w.scroll(check);$.fn.appear.checks.push(check);(check)();});};$.extend($.fn.appear,{checks:[],timeout:null,checkAll:function(){var length=$.fn.appear.checks.length;if(length>0)while(length--)($.fn.appear.checks[length])();},run:function(){if($.fn.appear.timeout)clearTimeout($.fn.appear.timeout);$.fn.appear.timeout=setTimeout($.fn.appear.checkAll,20);}});$.each(['append','prepend','after','before','attr','removeAttr','addClass','removeClass','toggleClass','remove','css','show','hide'],function(i,n){var old=$.fn[n];if(old){$.fn[n]=function(){var r=old.apply(this,arguments);$.fn.appear.run();return r;}}});})(jQuery);(function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeTo(c.fadeInSpeed,c.opacity,b):(this.getTip().show(),b())},function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeOut(c.fadeOutSpeed,b):(this.getTip().hide(),b())}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1];var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.on(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).on(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next(),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.off(p[0]).on(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.off(p[1]).on(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),e.tip||h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}})}a.fn.tooltip=function(b){var c=this.data("tooltip");if(c)return c;b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){c=new d(a(this),b),a(this).data("tooltip",c)});return b.api?c:this}})(jQuery);(function(a){var b=a.tools.tooltip;b.dynamic={conf:{classNames:"top right bottom left"}};function c(b){var c=a(window),d=c.width()+c.scrollLeft(),e=c.height()+c.scrollTop();return[b.offset().top<=c.scrollTop(),d<=b.offset().left+b.width(),e<=b.offset().top+b.height(),c.scrollLeft()>=b.offset().left]}function d(a){var b=a.length;while(b--)if(a[b])return!1;return!0}a.fn.dynamic=function(e){typeof e=="number"&&(e={speed:e}),e=a.extend({},b.dynamic.conf,e);var f=a.extend(!0,{},e),g=e.classNames.split(/\s/),h;this.each(function(){var b=a(this).tooltip().onBeforeShow(function(b,e){var i=this.getTip(),j=this.getConf();h||(h=[j.position[0],j.position[1],j.offset[0],j.offset[1],a.extend({},j)]),a.extend(j,h[4]),j.position=[h[0],h[1]],j.offset=[h[2],h[3]],i.css({visibility:"hidden",position:"absolute",top:e.top,left:e.left}).show();var k=a.extend(!0,{},f),l=c(i);if(!d(l)){l[2]&&(a.extend(j,k.top),j.position[0]="top",i.addClass(g[0])),l[3]&&(a.extend(j,k.right),j.position[1]="right",i.addClass(g[1])),l[0]&&(a.extend(j,k.bottom),j.position[0]="bottom",i.addClass(g[2])),l[1]&&(a.extend(j,k.left),j.position[1]="left",i.addClass(g[3]));if(l[0]||l[2])j.offset[0]*=-1;if(l[1]||l[3])j.offset[1]*=-1}i.css({visibility:"visible"}).hide()});b.onBeforeShow(function(){var a=this.getConf(),b=this.getTip();setTimeout(function(){a.position=[h[0],h[1]],a.offset=[h[2],h[3]]},0)}),b.onHide(function(){var a=this.getTip();a.removeClass(e.classNames)}),ret=b});return e.api?ret:this}})(jQuery);(function(a){var b=a.tools.tooltip;a.extend(b.conf,{direction:"up",bounce:!1,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!a.browser.msie});var c={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};b.addEffect("slide",function(a){var b=this.getConf(),d=this.getTip(),e=b.slideFade?{opacity:b.opacity}:{},f=c[b.direction]||c.up;e[f[1]]=f[0]+"="+b.slideOffset,b.slideFade&&d.css({opacity:0}),d.show().animate(e,b.slideInSpeed,a)},function(b){var d=this.getConf(),e=d.slideOffset,f=d.slideFade?{opacity:0}:{},g=c[d.direction]||c.up,h=""+g[0];d.bounce&&(h=h=="+"?"-":"+"),f[g[1]]=h+"="+e,this.getTip().animate(f,d.slideOutSpeed,function(){a(this).hide(),b.call()})})})(jQuery);(function(_,$){$.widget("ui.dialog",$.ui.dialog,{_allowInteraction:function _allowInteraction(event){if(this._super(event)){return true;}
if(event.target.ownerDocument!=this.document[0]){return true;}
if($(event.target).closest(".ui-draggable").length){return true;}
if($(event.target).closest(".cke").length){return true;}},_moveToTop:function _moveToTop(event,silent){if(!event||!this.options.modal){this._super(event,silent);}}});var methods={_getEditor:function _getEditor(elm){if(!elm.filter('[id]').length){return;}
var obj=$('#'+elm.prop('id'));if(obj.data('redactor')){return obj;}
return false;}};$.ceEditor('handlers',{editorName:'redactor2',params:null,elms:[],run:function run(elm,params){var support_langs={'de':{'path':'js/lib/redactor2/lang/de.js'},'en':{'path':'js/lib/redactor2/lang/en.js'},'es':{'path':'js/lib/redactor2/lang/es.js'},'fa':{'path':'js/lib/redactor2/lang/fa.js'},'fi':{'path':'js/lib/redactor2/lang/fi.js'},'fr':{'path':'js/lib/redactor2/lang/fr.js'},'he':{'path':'js/lib/redactor2/lang/he.js'},'hu':{'path':'js/lib/redactor2/lang/hu.js'},'it':{'path':'js/lib/redactor2/lang/it.js'},'ja':{'path':'js/lib/redactor2/lang/ja.js'},'ko':{'path':'js/lib/redactor2/lang/ko.js'},'nl':{'path':'js/lib/redactor2/lang/nl.js'},'pl':{'path':'js/lib/redactor2/lang/pl.js'},'pt':{'path':'js/lib/redactor2/lang/pt_br.js','lang_code_full':'pt_br'},'ru':{'path':'js/tygh/wysiwyg_plugins/langs/redactor2/ru.js'},'sv':{'path':'js/lib/redactor2/lang/sv.js'},'tr':{'path':'js/lib/redactor2/lang/tr.js'},'zh':{'path':'js/lib/redactor2/lang/zh_cn.js','lang_code_full':'zh_cn'}};var lang_code=fn_get_listed_lang(Object.keys(support_langs)),lang_code_full=support_langs[lang_code].lang_code_full||lang_code,lang_route=support_langs[lang_code].path;var isBlockManagerEnabled=elm.data('caIsBlockManagerEnabled');if(typeof $.fn.redactor=='undefined'){$.ceEditor('state','loading');$.loadCss(['js/lib/redactor2/redactor.min.css']);$.loadCss(['js/lib/redactor2/plugins/alignment/alignment.css']);$.loadCss(['js/lib/elfinder/css/elfinder.min.css']);$.loadCss(['js/lib/elfinder/css/theme.css']);$.getScript('js/lib/elfinder/js/elfinder.min.js');var pluginsQueue=['js/lib/redactor2/plugins/fontcolor/fontcolor.js','js/lib/redactor2/plugins/table/table.js','js/lib/redactor2/plugins/imageupload/imageupload.js','js/lib/redactor2/plugins/source/source.js','js/lib/redactor2/plugins/alignment/alignment.js','js/lib/redactor2/plugins/video/video.js'];if(isBlockManagerEnabled){pluginsQueue.push('js/tygh/wysiwyg_plugins/block_manager/redactor2.js');}
if(lang_code!=='en'){pluginsQueue.push(lang_route);}
var pluginsLoadedCount=0;$.getScript('js/lib/redactor2/redactor.min.js',function(){for(var i in pluginsQueue){$.getScript(pluginsQueue[i],function(){pluginsLoadedCount++;if(pluginsLoadedCount===pluginsQueue.length){callback();}});}});var callback=function callback(){$.ceEditor('state','loaded');elm.ceEditor('run',params);};return true;}
if(!this.params){this.params={lang:lang_code_full,removeComments:false,replaceTags:false,overrideStyles:true};this.params.direction=_.language_direction;}
if(typeof params!=='undefined'&&params[this.editorName]){$.extend(this.params,params[this.editorName]);}
this.params.callbacks={init:function init(){$('.redactor-toolbar-tooltip').each(function(){$(this).css('z-index',50001);});$('.redactor-box').addClass('redactor2-box');},modalOpened:function modalOpened(){$('#redactor-modal-overlay, #redactor-modal-box, #redactor-modal, .redactor-dropdown').each(function(){$(this).css('z-index',50001,'important');});},dropdownShow:function dropdownShow(){$('#redactor-modal-overlay, #redactor-modal-box, #redactor-modal, .redactor-dropdown').each(function(){$(this).css('z-index',50001,'important');});},changeCallback:function changeCallback(html){elm.ceEditor('changed',html);}};this.params.plugins=['alignment','fontcolor','table','source'];this.params.buttons=['source','format','bold','italic','deleted','lists','video','table','link','alignment','horizontalrule'];if(_.area==='A'||_.live_editor_mode===true){this.params.plugins.push('imageupload','video');if(isBlockManagerEnabled){this.params.plugins.push('blockManager');}}
this.params.imageResizable=true;this.params.imageCaption=false;this.params.imagePosition=true;this.params.keepStyleAttr=['*'];elm.redactor(this.params);elm.get(0).defaultValue=elm.get(0).value;var $parent=elm.parent();$parent.find('textarea:not([name])').addClass("cm-skip-check-item");if(elm.prop('disabled')){elm.ceEditor('disable',true);}
this.elms.push(elm.get(0));return true;},destroy:function destroy(elm){var ed=methods._getEditor(elm);if(ed){ed.redactor('core.destroy');}},recover:function recover(elm){if($.inArray(elm.get(0),this.elms)!==-1){$.ceEditor('run',elm);}},val:function val(elm,value){var ed=methods._getEditor(elm);if(!ed){return false;}
if(typeof value=='undefined'){return ed.redactor('code.get');}else{ed.redactor('code.set',value);}
return true;},updateTextFields:function updateTextFields(elm){return true;},insert:function insert(elm,text){var ed=methods._getEditor(elm);if(ed){ed.redactor('selection.restore');ed.redactor('insert.text',text);}},disable:function disable(elm,value){var ed=methods._getEditor(elm);if(ed){var obj=ed.redactor('core.getBox');if(value==true){if(!$(obj).parent().hasClass('disable-overlay-wrap')){$(obj).wrap("<div class='disable-overlay-wrap wysiwyg-overlay'></div>");$(obj).before("<div id='"+elm.prop('id')+"_overlay' class='disable-overlay'></div>");elm.prop('disabled',true);}}else{$(obj).unwrap();$('#'+elm.prop('id')+'_overlay').remove();elm.prop('disabled',false);}}}});})(Tygh,Tygh.$);(function(_,$){var breakpoints={tablet:767,phone:479};var ui=function(){return{winWidth:function winWidth(){return $(window).width();},windowFullWidth:function windowFullWidth(){return window.innerWidth;},responsiveScroll:function responsiveScroll(){this.needScrollInited=this.needScrollInited||false;if(this.needScrollInited){return;}
this.needScrollInited=true;$.ceEvent('on','ce.needScroll',function(opt){opt.timeout=310;});},responsiveTabs:function responsiveTabs(){if(ui.winWidth()<=breakpoints.phone+1){var accordionOptions={animate:$(_.body).data('caAccordionAnimateDelay')||300,heightStyle:"content",activate:function activate(event,ui){var selectedItem=$(ui.newHeader);if(!selectedItem.length)return;var tabId=selectedItem.prop('id');var isActiveScrollToElm=ui.newPanel.data('caAccordionIsActiveScrollToElm');if(isActiveScrollToElm){$.scrollToElm(selectedItem);}
selectedItem.addClass('active');if(tabId){$.ceEvent('trigger','ce.tab.show',[tabId,$(this)]);}}};$('.cm-j-tabs:not(.cm-j-tabs-disable-convertation)').each(function(index){var accordion=$('<div class="ty-accordion cm-accordion" id="accordion_id_'+index+'">');var tabsContent=$(this).nextAll('.cm-tabs-content:not(.cm-j-content-disable-convertation)').first();var self=this;$(this).hide();tabsContent.hide();if(!$('#accordion_id_'+index).length){$(this).find('>ul>li').each(function(indexTab){var id=$(this).attr('id');if($(this).hasClass('active')){accordionOptions.active=indexTab;}
var content=$('> #content_'+id,tabsContent).show();$(this).attr('id','hidden_tab_'+id);accordion.append('<h3 id="'+id+'">'+$(this).text()+'</h3>');$(content).appendTo(accordion);});$(self).before(accordion);}});$('.cm-accordion').ceAccordion('reinit',accordionOptions);var active=_.anchor;if(typeof active!=='undefined'&&$(active).length>0){$(active).click();}}else{$('.cm-accordion').accordion('destroy');$('.cm-accordion > div').each(function(index){var $tabsContent=$(this).parent().nextAll('.cm-tabs-content:not(.cm-j-content-disable-convertation)').first();$(this).hide();$(this).appendTo($tabsContent);});$('.cm-accordion').remove();$('.cm-j-tabs>ul>li').each(function(){var $tabs=$(this).closest('.cm-j-tabs');var $tabsContent=$tabs.nextAll('.cm-tabs-content:not(.cm-j-content-disable-convertation)').first();var id=$(this).attr('id').replace('hidden_tab_','');$(this).attr('id',id);var $content=$tabsContent.find('#content_'+id);$content.css('display','');});$('.cm-j-tabs, .cm-tabs-content').show();}},responsiveMenu:function responsiveMenu(elms){var whichEvent='ontouch'in document.documentElement?"touch":"click";if(_.isTouch&&window.navigator.msPointerEnabled){whichEvent='click';}
if(_.isTouch==false&&ui.windowFullWidth()>=breakpoints.tablet){var $hoveredMenuItem=$('.cm-responsive-menu .ty-menu__item-link:hover');if($hoveredMenuItem.length){ui.detectMenuWidth(null,$hoveredMenuItem);}
$('.cm-responsive-menu').on('mouseover mouseout',function(e){ui.detectMenuWidth(e);});}
if($('html').data('caResponsiveMenu')){return;}
$(_.doc).on(whichEvent,'.cm-responsive-menu-toggle-main',function(e){e.preventDefault();$(this).parent('.cm-responsive-menu').find('.cm-menu-item-responsive').toggle();});$(_.doc).on(whichEvent,'.cm-responsive-menu-toggle',function(e){e.preventDefault();$(this).toggleClass('ty-menu__item-toggle-active');$(this).parent().find('.cm-responsive-menu-submenu').first().toggleClass('ty-menu__items-show');});$('html').data('caResponsiveMenu',true);},responsiveMenuLargeTouch:function responsiveMenuLargeTouch(e){var elm=$(e.target);if(ui.winWidth()>=breakpoints.tablet&&e.type=='touchstart'){if(elm.is('.ty-menu__submenu-link')){elm.click();}
if(elm.hasClass('cm-menu-item-responsive')||elm.closest('.cm-menu-item-responsive').length){var menuItem=elm.hasClass('cm-menu-item-responsive')?elm:elm.closest('.cm-menu-item-responsive');if(!menuItem.hasClass('is-hover-menu')&&menuItem.find('.ty-menu__submenu-items').length>0){e.preventDefault();menuItem.siblings('.cm-menu-item-responsive').removeClass('is-hover-menu');menuItem.addClass('is-hover-menu');$(_.doc).off('click.resposive.responsiveMenuLargeTouch').on('click.resposive.responsiveMenuLargeTouch',function(e){var $clickedElm=$(e.target);if($clickedElm.hasClass('cm-menu-item-responsive')||$clickedElm.closest('.cm-menu-item-responsive').length){return;}
$('.is-hover-menu').removeClass('is-hover-menu');$(_.doc).off('click.resposive.responsiveMenuLargeTouch');});}}
var subMenu=$('.ty-menu__submenu-items');if(subMenu.is(':visible')&&!elm.closest('.cm-menu-item-responsive').length){$('.cm-menu-item-responsive').removeClass('is-hover-menu');}}else{$('.cm-menu-item-responsive').removeClass('is-hover-menu');}
ui.detectMenuWidth(e);},detectMenuWidth:function detectMenuWidth(e,$targetElm){var $self=e?$(e.target):$targetElm,$menuItem=$self.closest('.cm-menu-item-responsive'),$menuItemSubmenu=$('.cm-responsive-menu-submenu',$menuItem).first(),$menu=$self.parents('.cm-responsive-menu');var verticalMenuClassName='ty-menu-vertical',reverseDirectionClassName='ty-menu__submenu-reverse-direction',isHorizontal=!$menu.parent().hasClass(verticalMenuClassName),isRtl=_.language_direction==='rtl';if(!isHorizontal||!$menuItemSubmenu.length||!$menuItem.length){return false;}
var menuWidth=$menu.outerWidth(),itemWidth=$menuItem.outerWidth(),menuItemSubmenuWidth=_getSubmenuOriginWidth($menuItemSubmenu),isSecondHalfOfMenu=itemWidth / 2+$menuItem.position().left>menuWidth / 2;if(isRtl){isSecondHalfOfMenu=!isSecondHalfOfMenu;}
$('.'+reverseDirectionClassName).removeClass(reverseDirectionClassName);if(isSecondHalfOfMenu){var _offset=Math.abs(isRtl?$menuItem.offset().left+itemWidth-($menu.offset().left+menuWidth):$menuItem.offset().left-$menu.offset().left);$menuItemSubmenu.toggleClass(reverseDirectionClassName,menuWidth-itemWidth*2<menuItemSubmenuWidth+itemWidth||_offset+menuItemSubmenuWidth>menuWidth);}
function _getSubmenuOriginWidth($submenu){$submenu.css('left',0);var _width=$submenu.outerWidth()||0;$submenu.get(0).style.left='';return _width;}},responsiveTables:function responsiveTables(e){var tables=$('.ty-table');if(ui.winWidth()<=breakpoints.tablet){tables.each(function(){var thTexts=[];var subTable=$(this).find('.ty-table');if(subTable.length){var subTableStack=[];subTable.each(function(index){$(this).parent().attr('data-ca-has-sub-table_'+index,'true');subTableStack.push($(this).detach());});}
$(this).find('th:not(.ty-table-disable-convertation)').each(function(){thTexts.push($(this).text());});$(this).find('tr:not(.ty-table__no-items)').each(function(){$(this).find('td:not(.ty-table-disable-convertation)').each(function(index){var $elm=$(this);if($elm.find('.ty-table__responsive-content').length==0){$elm.wrapInner('<div class="ty-table__responsive-content"></div>');$elm.prepend('<div class="ty-table__responsive-header">'+thTexts[index]+'</div>');}});});if(subTable.length){subTable.each(function(index){var subTableElm=$('[data-ca-has-sub-table_'+index+']');subTableElm.prepend(subTableStack[index]);subTableElm.removeAttr('data-ca-has-sub-table_'+index);});}});}},resizeDialog:function resizeDialog(){var dlg=$('.ui-dialog');var $contentElem=$(dlg).find('.ui-dialog-content');if(ui.winWidth()>breakpoints.tablet){$contentElem.data('caDialogAutoHeight',false);return;}
$contentElem.data('caDialogAutoHeight',true);$('.ui-widget-overlay').css({'min-height':$(window).height()});$(dlg).css({'position':'absolute','width':$(window).width()-20,'left':'10px','top':'10px','max-height':'none','height':'auto','margin-bottom':'10px'});$(dlg).find('.ui-dialog-title').css({'width':$(window).width()-80});$contentElem.css({'height':'auto','max-height':'none'});$(dlg).find('.object-container').css({'height':'auto'});$(dlg).find('.buttons-container').css({'position':'relative','top':'auto','left':'0px','right':'0px','bottom':'0px','width':'auto'});$('.cm-notification-content.notification-content-extended').each(function(id,elm){$.ceNotification('position',$(elm),false);});},responsiveDialog:function responsiveDialog(){$.ceEvent('on','ce.dialogshow',function(){if(ui.winWidth()<=breakpoints.tablet){var currentScrollPosition=$(document).scrollTop();ui.resizeDialog();$('body,html').scrollTop(0);$.ceEvent('on','ce.dialogclose',function(){$('body,html').scrollTop(currentScrollPosition);});}});},responsiveFilters:function responsiveFilters(e){var filtersContent=$('.cm-horizontal-filters-content');if(ui.winWidth()<=breakpoints.tablet){filtersContent.removeClass('cm-popup-box');}else{filtersContent.addClass('cm-popup-box');}
if(ui.winWidth()>breakpoints.tablet){$('.ty-horizontal-filters-content-to-right').removeClass('ty-horizontal-filters-content-to-right');$('.ty-horizontal-product-filters-dropdown').click(function(){var hrFiltersWidth=$(".cm-horizontal-filters").width();var hrFiltersContent=$('.cm-horizontal-filters-content',this);setTimeout(function(){var position=hrFiltersContent.offset().left+hrFiltersContent.width();if(position>hrFiltersWidth){hrFiltersContent.addClass("ty-horizontal-filters-content-to-right");}},1);});}},responsiveInlineTextLinksLargeTouch:function responsiveInlineTextLinksLargeTouch(e){var elm=$(e.target);if(ui.winWidth()>=breakpoints.tablet&&e.type=='touchstart'){var linksItem=elm.hasClass('ty-text-links__item')?elm:elm.closest('.ty-text-links__item');if(!linksItem.hasClass('is-hover-link')&&linksItem.hasClass('ty-text-links__subitems')){e.preventDefault();linksItem.siblings('.ty-text-links__item').removeClass('is-hover-link');linksItem.addClass('is-hover-link');}}else{$('.ty-text-links__item').removeClass('is-hover-link');}}};}();$(document).ready(function(){var responsiveTablesDebounced=$.debounce(ui.responsiveTables);var responsiveFiltersDebounced=$.debounce(ui.responsiveFilters);var resizeDialogDebounced=$.debounce(ui.resizeDialog);var responsiveMenuDebounced=$.debounce(ui.responsiveMenu);$(window).on('resize',function(){responsiveTablesDebounced();responsiveFiltersDebounced();resizeDialogDebounced();responsiveMenuDebounced();});if(window.addEventListener){window.addEventListener('orientationchange',function(){resizeDialogDebounced();$.ceDialog('get_last').ceDialog('reload');},false);}
ui.responsiveDialog();responsiveTablesDebounced();responsiveFiltersDebounced();$.ceEvent('on','ce.ajaxdone',function(elms){responsiveTablesDebounced();responsiveFiltersDebounced();resizeDialogDebounced();if(elms.length){ui.responsiveMenu(elms);}else{responsiveMenuDebounced();}});ui.responsiveMenu();$('.cm-responsive-menu').on('touchstart',function(e){ui.responsiveMenuLargeTouch(e);});$(document).on('touchstart',function(e){var elm=$(e.target);if(elm.hasClass('ty-text-links__subitems')||elm.closest('.ty-text-links__subitems').length){ui.responsiveInlineTextLinksLargeTouch(e);}else{$('.is-hover-link').removeClass('is-hover-link');}});});$.ceEvent('on','ce.tab.init',function(){var responsiveTabsDebounced=$.debounce(ui.responsiveTabs);$(window).on('resize',function(){responsiveTabsDebounced();});responsiveTabsDebounced();ui.responsiveScroll();});})(Tygh,Tygh.$);(function(e){function t(){var e=document.createElement("input"),t="onpaste";return e.setAttribute(t,""),"function"==typeof e[t]?"paste":"input"}var n,a=t()+".mask",r=navigator.userAgent,i=/iphone/i.test(r),o=/android/i.test(r);e.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},dataName:"rawMaskFn",placeholder:"_"},e.fn.extend({caret:function(e,t){var n;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof e?(t="number"==typeof t?t:e,this.each(function(){this.setSelectionRange?this.setSelectionRange(e,t):this.createTextRange&&(n=this.createTextRange(),n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",e),n.select())})):(this[0].setSelectionRange?(e=this[0].selectionStart,t=this[0].selectionEnd):document.selection&&document.selection.createRange&&(n=document.selection.createRange(),e=0-n.duplicate().moveStart("character",-1e5),t=e+n.text.length),{begin:e,end:t})},unmask:function(){return this.trigger("unmask")},mask:function(t,r){var c,l,s,u,f,h;return!t&&this.length>0?(c=e(this[0]),c.data(e.mask.dataName)()):(r=e.extend({placeholder:e.mask.placeholder,completed:null},r),l=e.mask.definitions,s=[],u=h=t.length,f=null,e.each(t.split(""),function(e,t){"?"==t?(h--,u=e):l[t]?(s.push(RegExp(l[t])),null===f&&(f=s.length-1)):s.push(null)}),this.trigger("unmask").each(function(){function c(e){for(;h>++e&&!s[e];);return e}function d(e){for(;--e>=0&&!s[e];);return e}function m(e,t){var n,a;if(!(0>e)){for(n=e,a=c(t);h>n;n++)if(s[n]){if(!(h>a&&s[n].test(R[a])))break;R[n]=R[a],R[a]=r.placeholder,a=c(a)}b(),x.caret(Math.max(f,e))}}function p(e){var t,n,a,i;for(t=e,n=r.placeholder;h>t;t++)if(s[t]){if(a=c(t),i=R[t],R[t]=n,!(h>a&&s[a].test(i)))break;n=i}}function g(e){var t,n,a,r=e.which;8===r||46===r||i&&127===r?(t=x.caret(),n=t.begin,a=t.end,0===a-n&&(n=46!==r?d(n):a=c(n-1),a=46===r?c(a):a),k(n,a),m(n,a-1),e.preventDefault()):27==r&&(x.val(S),x.caret(0,y()),e.preventDefault())}function v(t){var n,a,i,l=t.which,u=x.caret();t.ctrlKey||t.altKey||t.metaKey||32>l||l&&(0!==u.end-u.begin&&(k(u.begin,u.end),m(u.begin,u.end-1)),n=c(u.begin-1),h>n&&(a=String.fromCharCode(l),s[n].test(a)&&(p(n),R[n]=a,b(),i=c(n),o?setTimeout(e.proxy(e.fn.caret,x,i),0):x.caret(i),r.completed&&i>=h&&r.completed.call(x))),t.preventDefault())}function k(e,t){var n;for(n=e;t>n&&h>n;n++)s[n]&&(R[n]=r.placeholder)}function b(){x.val(R.join(""))}function y(e){var t,n,a=x.val(),i=-1;for(t=0,pos=0;h>t;t++)if(s[t]){for(R[t]=r.placeholder;pos++<a.length;)if(n=a.charAt(pos-1),s[t].test(n)){R[t]=n,i=t;break}if(pos>a.length)break}else R[t]===a.charAt(pos)&&t!==u&&(pos++,i=t);return e?b():u>i+1?(x.val(""),k(0,h)):(b(),x.val(x.val().substring(0,i+1))),u?t:f}var x=e(this),R=e.map(t.split(""),function(e){return"?"!=e?l[e]?r.placeholder:e:void 0}),S=x.val();x.data(e.mask.dataName,function(){return e.map(R,function(e,t){return s[t]&&e!=r.placeholder?e:null}).join("")}),x.attr("readonly")||x.one("unmask",function(){x.unbind(".mask").removeData(e.mask.dataName)}).bind("focus.mask",function(){clearTimeout(n);var e;S=x.val(),e=y(),n=setTimeout(function(){b(),e==t.length?x.caret(0,e):x.caret(e)},10)}).bind("blur.mask",function(){y(),x.val()!=S&&x.change()}).bind("keydown.mask",g).bind("keypress.mask",v).bind(a,function(){setTimeout(function(){var e=y(!0);x.caret(e),r.completed&&e==x.val().length&&r.completed.call(x)},0)}),y()}))}})})(jQuery);!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("jquery"));else if("function"==typeof define&&define.noamd)define(["jquery"],t);else{var i="object"==typeof exports?t(require("jquery")):t(e.jQuery);for(var a in i)("object"==typeof exports?exports:e)[a]=i[a]}}(this,(function(e){return function(){"use strict";var t={3046:function(e,t,i){var a;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,i(3851),i(219),i(207),i(5296);var n=((a=i(2394))&&a.__esModule?a:{default:a}).default;t.default=n},8741:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=!("undefined"==typeof window||!window.document||!window.document.createElement);t.default=i},3976:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,n=(a=i(5581))&&a.__esModule?a:{default:a};var r={_maxTestPos:500,placeholder:"_",optionalmarker:["[","]"],quantifiermarker:["{","}"],groupmarker:["(",")"],alternatormarker:"|",escapeChar:"\\",mask:null,regex:null,oncomplete:function(){},onincomplete:function(){},oncleared:function(){},repeat:0,greedy:!1,autoUnmask:!1,removeMaskOnSubmit:!1,clearMaskOnLostFocus:!0,insertMode:!0,insertModeVisual:!0,clearIncomplete:!1,alias:null,onKeyDown:function(){},onBeforeMask:null,onBeforePaste:function(e,t){return"function"==typeof t.onBeforeMask?t.onBeforeMask.call(this,e,t):e},onBeforeWrite:null,onUnMask:null,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:function(){},skipOptionalPartCharacter:" ",numericInput:!1,rightAlign:!1,undoOnEscape:!0,radixPoint:"",_radixDance:!1,groupSeparator:"",keepStatic:null,positionCaretOnTab:!0,tabThrough:!1,supportsInputType:["text","tel","url","password","search"],ignorables:[n.default.BACKSPACE,n.default.TAB,n.default["PAUSE/BREAK"],n.default.ESCAPE,n.default.PAGE_UP,n.default.PAGE_DOWN,n.default.END,n.default.HOME,n.default.LEFT,n.default.UP,n.default.RIGHT,n.default.DOWN,n.default.INSERT,n.default.DELETE,93,112,113,114,115,116,117,118,119,120,121,122,123,0,229],isComplete:null,preValidation:null,postValidation:null,staticDefinitionSymbol:void 0,jitMasking:!1,nullable:!0,inputEventOnly:!1,noValuePatching:!1,positionCaretOnClick:"lvp",casing:null,inputmode:"text",importDataAttributes:!0,shiftPositions:!0,usePrototypeDefinitions:!0,validationEventTimeOut:3e3,substitutes:{}};t.default=r},7392:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={9:{validator:"[0-9\uff10-\uff19]",definitionSymbol:"*"},a:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",definitionSymbol:"*"},"*":{validator:"[0-9\uff10-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]"}}},3287:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,n=(a=i(8254))&&a.__esModule?a:{default:a};if(void 0===n.default)throw"jQuery not loaded!";var r=n.default;t.default=r},9845:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.iphone=t.iemobile=t.mobile=t.ie=t.ua=void 0;var a,n=(a=i(9380))&&a.__esModule?a:{default:a};var r=n.default.navigator&&n.default.navigator.userAgent||"",o=r.indexOf("MSIE ")>0||r.indexOf("Trident/")>0,s="ontouchstart"in n.default,l=/iemobile/i.test(r),u=/iphone/i.test(r)&&!l;t.iphone=u,t.iemobile=l,t.mobile=s,t.ie=o,t.ua=r},7184:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e.replace(i,"\\$1")};var i=new RegExp("(\\"+["/",".","*","+","?","|","(",")","[","]","{","}","\\","$","^"].join("|\\")+")","gim")},6030:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.EventHandlers=void 0;var a,n=i(8711),r=(a=i(5581))&&a.__esModule?a:{default:a},o=i(9845),s=i(7215),l=i(7760),u=i(4713);function c(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,t){if(!e)return;if("string"==typeof e)return f(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return f(e,t)}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var a=0,n=function(){};return{s:n,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,s=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return o=e.done,e},e:function(e){s=!0,r=e},f:function(){try{o||null==i.return||i.return()}finally{if(s)throw r}}}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i<t;i++)a[i]=e[i];return a}var d={keydownEvent:function(e){var t=this.inputmask,i=t.opts,a=t.dependencyLib,c=t.maskset,f=this,d=a(f),p=e.keyCode,h=n.caret.call(t,f),v=i.onKeyDown.call(this,e,n.getBuffer.call(t),h,i);if(void 0!==v)return v;if(p===r.default.BACKSPACE||p===r.default.DELETE||o.iphone&&p===r.default.BACKSPACE_SAFARI||e.ctrlKey&&p===r.default.X&&!("oncut"in f))e.preventDefault(),s.handleRemove.call(t,f,p,h),(0,l.writeBuffer)(f,n.getBuffer.call(t,!0),c.p,e,f.inputmask._valueGet()!==n.getBuffer.call(t).join(""));else if(p===r.default.END||p===r.default.PAGE_DOWN){e.preventDefault();var m=n.seekNext.call(t,n.getLastValidPosition.call(t));n.caret.call(t,f,e.shiftKey?h.begin:m,m,!0)}else p===r.default.HOME&&!e.shiftKey||p===r.default.PAGE_UP?(e.preventDefault(),n.caret.call(t,f,0,e.shiftKey?h.begin:0,!0)):i.undoOnEscape&&p===r.default.ESCAPE&&!0!==e.altKey?((0,l.checkVal)(f,!0,!1,t.undoValue.split("")),d.trigger("click")):!0===i.tabThrough&&p===r.default.TAB?!0===e.shiftKey?(h.end=n.seekPrevious.call(t,h.end,!0),!0===u.getTest.call(t,h.end-1).match.static&&h.end--,h.begin=n.seekPrevious.call(t,h.end,!0),h.begin>=0&&h.end>0&&(e.preventDefault(),n.caret.call(t,f,h.begin,h.end))):(h.begin=n.seekNext.call(t,h.begin,!0),h.end=n.seekNext.call(t,h.begin,!0),h.end<c.maskLength&&h.end--,h.begin<=c.maskLength&&(e.preventDefault(),n.caret.call(t,f,h.begin,h.end))):e.shiftKey||i.insertModeVisual&&!1===i.insertMode&&(p===r.default.RIGHT?setTimeout((function(){var e=n.caret.call(t,f);n.caret.call(t,f,e.begin)}),0):p===r.default.LEFT&&setTimeout((function(){var e=n.translatePosition.call(t,f.inputmask.caretPos.begin);n.translatePosition.call(t,f.inputmask.caretPos.end);t.isRTL?n.caret.call(t,f,e+(e===c.maskLength?0:1)):n.caret.call(t,f,e-(0===e?0:1))}),0));t.ignorable=i.ignorables.includes(p)},keypressEvent:function(e,t,i,a,o){var u=this.inputmask||this,c=u.opts,f=u.dependencyLib,d=u.maskset,p=u.el,h=f(p),v=e.keyCode;if(!(!0===t||e.ctrlKey&&e.altKey)&&(e.ctrlKey||e.metaKey||u.ignorable))return v===r.default.ENTER&&u.undoValue!==u._valueGet(!0)&&(u.undoValue=u._valueGet(!0),setTimeout((function(){h.trigger("change")}),0)),u.skipInputEvent=!0,!0;if(v){44!==v&&46!==v||3!==e.location||""===c.radixPoint||(v=c.radixPoint.charCodeAt(0));var m,g=t?{begin:o,end:o}:n.caret.call(u,p),k=String.fromCharCode(v);k=c.substitutes[k]||k,d.writeOutBuffer=!0;var y=s.isValid.call(u,g,k,a,void 0,void 0,void 0,t);if(!1!==y&&(n.resetMaskSet.call(u,!0),m=void 0!==y.caret?y.caret:n.seekNext.call(u,y.pos.begin?y.pos.begin:y.pos),d.p=m),m=c.numericInput&&void 0===y.caret?n.seekPrevious.call(u,m):m,!1!==i&&(setTimeout((function(){c.onKeyValidation.call(p,v,y)}),0),d.writeOutBuffer&&!1!==y)){var b=n.getBuffer.call(u);(0,l.writeBuffer)(p,b,m,e,!0!==t)}if(e.preventDefault(),t)return!1!==y&&(y.forwardPosition=m),y}},keyupEvent:function(e){var t=this.inputmask;!t.isComposing||e.keyCode!==r.default.KEY_229&&e.keyCode!==r.default.ENTER||t.$el.trigger("input")},pasteEvent:function(e){var t,i=this.inputmask,a=i.opts,r=i._valueGet(!0),o=n.caret.call(i,this);i.isRTL&&(t=o.end,o.end=n.translatePosition.call(i,o.begin),o.begin=n.translatePosition.call(i,t));var s=r.substr(0,o.begin),u=r.substr(o.end,r.length);if(s==(i.isRTL?n.getBufferTemplate.call(i).slice().reverse():n.getBufferTemplate.call(i)).slice(0,o.begin).join("")&&(s=""),u==(i.isRTL?n.getBufferTemplate.call(i).slice().reverse():n.getBufferTemplate.call(i)).slice(o.end).join("")&&(u=""),window.clipboardData&&window.clipboardData.getData)r=s+window.clipboardData.getData("Text")+u;else{if(!e.clipboardData||!e.clipboardData.getData)return!0;r=s+e.clipboardData.getData("text/plain")+u}var f=r;if(i.isRTL){f=f.split("");var d,p=c(n.getBufferTemplate.call(i));try{for(p.s();!(d=p.n()).done;){var h=d.value;f[0]===h&&f.shift()}}catch(e){p.e(e)}finally{p.f()}f=f.join("")}if("function"==typeof a.onBeforePaste){if(!1===(f=a.onBeforePaste.call(i,f,a)))return!1;f||(f=r)}(0,l.checkVal)(this,!0,!1,f.toString().split(""),e),e.preventDefault()},inputFallBackEvent:function(e){var t=this.inputmask,i=t.opts,a=t.dependencyLib;var s=this,c=s.inputmask._valueGet(!0),f=(t.isRTL?n.getBuffer.call(t).slice().reverse():n.getBuffer.call(t)).join(""),p=n.caret.call(t,s,void 0,void 0,!0);if(f!==c){var h=function(e,a,r){for(var o,s,l,c=e.substr(0,r.begin).split(""),f=e.substr(r.begin).split(""),d=a.substr(0,r.begin).split(""),p=a.substr(r.begin).split(""),h=c.length>=d.length?c.length:d.length,v=f.length>=p.length?f.length:p.length,m="",g=[],k="~";c.length<h;)c.push(k);for(;d.length<h;)d.push(k);for(;f.length<v;)f.unshift(k);for(;p.length<v;)p.unshift(k);var y=c.concat(f),b=d.concat(p);for(s=0,o=y.length;s<o;s++)switch(l=u.getPlaceholder.call(t,n.translatePosition.call(t,s)),m){case"insertText":b[s-1]===y[s]&&r.begin==y.length-1&&g.push(y[s]),s=o;break;case"insertReplacementText":case"deleteContentBackward":y[s]===k?r.end++:s=o;break;default:y[s]!==b[s]&&(y[s+1]!==k&&y[s+1]!==l&&void 0!==y[s+1]||(b[s]!==l||b[s+1]!==k)&&b[s]!==k?b[s+1]===k&&b[s]===y[s+1]?(m="insertText",g.push(y[s]),r.begin--,r.end--):y[s]!==l&&y[s]!==k&&(y[s+1]===k||b[s]!==y[s]&&b[s+1]===y[s+1])?(m="insertReplacementText",g.push(y[s]),r.begin--):y[s]===k?(m="deleteContentBackward",(n.isMask.call(t,n.translatePosition.call(t,s),!0)||b[s]===i.radixPoint)&&r.end++):s=o:(m="insertText",g.push(y[s]),r.begin--,r.end--))}return{action:m,data:g,caret:r}}(c=function(e,i,a){if(o.iemobile){var r=i.replace(n.getBuffer.call(t).join(""),"");if(1===r.length){var s=i.split("");s.splice(a.begin,0,r),i=s.join("")}}return i}(0,c,p),f,p);switch((s.inputmask.shadowRoot||s.ownerDocument).activeElement!==s&&s.focus(),(0,l.writeBuffer)(s,n.getBuffer.call(t)),n.caret.call(t,s,p.begin,p.end,!0),h.action){case"insertText":case"insertReplacementText":h.data.forEach((function(e,i){var n=new a.Event("keypress");n.keyCode=e.charCodeAt(0),t.ignorable=!1,d.keypressEvent.call(s,n)})),setTimeout((function(){t.$el.trigger("keyup")}),0);break;case"deleteContentBackward":var v=new a.Event("keydown");v.keyCode=r.default.BACKSPACE,d.keydownEvent.call(s,v);break;default:(0,l.applyInputValue)(s,c)}e.preventDefault()}},compositionendEvent:function(e){var t=this.inputmask;t.isComposing=!1,t.$el.trigger("input")},setValueEvent:function(e){var t=this.inputmask,i=this,a=e&&e.detail?e.detail[0]:arguments[1];void 0===a&&(a=i.inputmask._valueGet(!0)),(0,l.applyInputValue)(i,a),(e.detail&&void 0!==e.detail[1]||void 0!==arguments[2])&&n.caret.call(t,i,e.detail?e.detail[1]:arguments[2])},focusEvent:function(e){var t=this.inputmask,i=t.opts,a=this,r=a.inputmask._valueGet();i.showMaskOnFocus&&r!==n.getBuffer.call(t).join("")&&(0,l.writeBuffer)(a,n.getBuffer.call(t),n.seekNext.call(t,n.getLastValidPosition.call(t))),!0!==i.positionCaretOnTab||!1!==t.mouseEnter||s.isComplete.call(t,n.getBuffer.call(t))&&-1!==n.getLastValidPosition.call(t)||d.clickEvent.apply(a,[e,!0]),t.undoValue=t._valueGet(!0)},invalidEvent:function(e){this.inputmask.validationEvent=!0},mouseleaveEvent:function(){var e=this.inputmask,t=e.opts,i=this;e.mouseEnter=!1,t.clearMaskOnLostFocus&&(i.inputmask.shadowRoot||i.ownerDocument).activeElement!==i&&(0,l.HandleNativePlaceholder)(i,e.originalPlaceholder)},clickEvent:function(e,t){var i=this.inputmask,a=this;if((a.inputmask.shadowRoot||a.ownerDocument).activeElement===a){var r=n.determineNewCaretPosition.call(i,n.caret.call(i,a),t);void 0!==r&&n.caret.call(i,a,r)}},cutEvent:function(e){var t=this.inputmask,i=t.maskset,a=this,o=n.caret.call(t,a),u=t.isRTL?n.getBuffer.call(t).slice(o.end,o.begin):n.getBuffer.call(t).slice(o.begin,o.end),c=t.isRTL?u.reverse().join(""):u.join("");window.navigator.clipboard?window.navigator.clipboard.writeText(c):window.clipboardData&&window.clipboardData.getData&&window.clipboardData.setData("Text",c),s.handleRemove.call(t,a,r.default.DELETE,o),(0,l.writeBuffer)(a,n.getBuffer.call(t),i.p,e,t.undoValue!==t._valueGet(!0))},blurEvent:function(e){var t=this.inputmask,i=t.opts,a=(0,t.dependencyLib)(this),r=this;if(r.inputmask){(0,l.HandleNativePlaceholder)(r,t.originalPlaceholder);var o=r.inputmask._valueGet(),u=n.getBuffer.call(t).slice();""!==o&&(i.clearMaskOnLostFocus&&(-1===n.getLastValidPosition.call(t)&&o===n.getBufferTemplate.call(t).join("")?u=[]:l.clearOptionalTail.call(t,u)),!1===s.isComplete.call(t,u)&&(setTimeout((function(){a.trigger("incomplete")}),0),i.clearIncomplete&&(n.resetMaskSet.call(t),u=i.clearMaskOnLostFocus?[]:n.getBufferTemplate.call(t).slice())),(0,l.writeBuffer)(r,u,void 0,e)),t.undoValue!==t._valueGet(!0)&&(t.undoValue=t._valueGet(!0),a.trigger("change"))}},mouseenterEvent:function(){var e=this.inputmask,t=e.opts,i=this;if(e.mouseEnter=!0,(i.inputmask.shadowRoot||i.ownerDocument).activeElement!==i){var a=(e.isRTL?n.getBufferTemplate.call(e).slice().reverse():n.getBufferTemplate.call(e)).join("");e.placeholder!==a&&i.placeholder!==e.originalPlaceholder&&(e.originalPlaceholder=i.placeholder),t.showMaskOnHover&&(0,l.HandleNativePlaceholder)(i,a)}},submitEvent:function(){var e=this.inputmask,t=e.opts;e.undoValue!==e._valueGet(!0)&&e.$el.trigger("change"),-1===n.getLastValidPosition.call(e)&&e._valueGet&&e._valueGet()===n.getBufferTemplate.call(e).join("")&&e._valueSet(""),t.clearIncomplete&&!1===s.isComplete.call(e,n.getBuffer.call(e))&&e._valueSet(""),t.removeMaskOnSubmit&&(e._valueSet(e.unmaskedvalue(),!0),setTimeout((function(){(0,l.writeBuffer)(e.el,n.getBuffer.call(e))}),0))},resetEvent:function(){var e=this.inputmask;e.refreshValue=!0,setTimeout((function(){(0,l.applyInputValue)(e.el,e._valueGet(!0))}),0)}};t.EventHandlers=d},9716:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.EventRuler=void 0;var a=s(i(2394)),n=s(i(5581)),r=i(8711),o=i(7760);function s(e){return e&&e.__esModule?e:{default:e}}var l={on:function(e,t,i){var s=e.inputmask.dependencyLib,l=function(t){t.originalEvent&&(t=t.originalEvent||t,arguments[0]=t);var l,u=this,c=u.inputmask,f=c?c.opts:void 0;if(void 0===c&&"FORM"!==this.nodeName){var d=s.data(u,"_inputmask_opts");s(u).off(),d&&new a.default(d).mask(u)}else{if(["submit","reset","setvalue"].includes(t.type)||"FORM"===this.nodeName||!(u.disabled||u.readOnly&&!("keydown"===t.type&&t.ctrlKey&&67===t.keyCode||!1===f.tabThrough&&t.keyCode===n.default.TAB))){switch(t.type){case"input":if(!0===c.skipInputEvent||t.inputType&&"insertCompositionText"===t.inputType)return c.skipInputEvent=!1,t.preventDefault();break;case"keydown":c.skipKeyPressEvent=!1,c.skipInputEvent=c.isComposing=t.keyCode===n.default.KEY_229;break;case"keyup":case"compositionend":c.isComposing&&(c.skipInputEvent=!1);break;case"keypress":if(!0===c.skipKeyPressEvent)return t.preventDefault();c.skipKeyPressEvent=!0;break;case"click":case"focus":return c.validationEvent?(c.validationEvent=!1,e.blur(),(0,o.HandleNativePlaceholder)(e,(c.isRTL?r.getBufferTemplate.call(c).slice().reverse():r.getBufferTemplate.call(c)).join("")),setTimeout((function(){e.focus()}),f.validationEventTimeOut),!1):(l=arguments,setTimeout((function(){e.inputmask&&i.apply(u,l)}),0),!1)}var p=i.apply(u,arguments);return!1===p&&(t.preventDefault(),t.stopPropagation()),p}t.preventDefault()}};["submit","reset"].includes(t)?(l=l.bind(e),null!==e.form&&s(e.form).on(t,l)):s(e).on(t,l),e.inputmask.events[t]=e.inputmask.events[t]||[],e.inputmask.events[t].push(l)},off:function(e,t){if(e.inputmask&&e.inputmask.events){var i=e.inputmask.dependencyLib,a=e.inputmask.events;for(var n in t&&((a=[])[t]=e.inputmask.events[t]),a){for(var r=a[n];r.length>0;){var o=r.pop();["submit","reset"].includes(n)?null!==e.form&&i(e.form).off(n,o):i(e).off(n,o)}delete e.inputmask.events[n]}}}};t.EventRuler=l},219:function(e,t,i){var a=c(i(2394)),n=c(i(5581)),r=c(i(7184)),o=i(8711),s=i(4713);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){for(var i=0;i<t.length;i++){var a=t[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function c(e){return e&&e.__esModule?e:{default:e}}var f=a.default.dependencyLib,d=function(){function e(t,i,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mask=t,this.format=i,this.opts=a,this._date=new Date(1,0,1),this.initDateObject(t,this.opts)}var t,i,a;return t=e,(i=[{key:"date",get:function(){return void 0===this._date&&(this._date=new Date(1,0,1),this.initDateObject(void 0,this.opts)),this._date}},{key:"initDateObject",value:function(e,t){var i;for(b(t).lastIndex=0;i=b(t).exec(this.format);){var a=new RegExp("\\d+$").exec(i[0]),n=a?i[0][0]+"x":i[0],r=void 0;if(void 0!==e){if(a){var o=b(t).lastIndex,s=_(i.index,t);b(t).lastIndex=o,r=e.slice(0,e.indexOf(s.nextMatch[0]))}else r=e.slice(0,n.length);e=e.slice(r.length)}Object.prototype.hasOwnProperty.call(v,n)&&this.setValue(this,r,n,v[n][2],v[n][1])}}},{key:"setValue",value:function(e,t,i,a,n){if(void 0!==t&&(e[a]="ampm"===a?t:t.replace(/[^0-9]/g,"0"),e["raw"+a]=t.replace(/\s/g,"_")),void 0!==n){var r=e[a];("day"===a&&29===parseInt(r)||"month"===a&&2===parseInt(r))&&(29!==parseInt(e.day)||2!==parseInt(e.month)||""!==e.year&&void 0!==e.year||e._date.setFullYear(2012,1,29)),"day"===a&&(h=!0,0===parseInt(r)&&(r=1)),"month"===a&&(h=!0),"year"===a&&(h=!0,r.length<4&&(r=E(r,4,!0))),""===r||isNaN(r)||n.call(e._date,r),"ampm"===a&&n.call(e._date,r)}}},{key:"reset",value:function(){this._date=new Date(1,0,1)}},{key:"reInit",value:function(){this._date=void 0,this.date}}])&&u(t.prototype,i),a&&u(t,a),e}(),p=(new Date).getFullYear(),h=!1,v={d:["[1-9]|[12][0-9]|3[01]",Date.prototype.setDate,"day",Date.prototype.getDate],dd:["0[1-9]|[12][0-9]|3[01]",Date.prototype.setDate,"day",function(){return E(Date.prototype.getDate.call(this),2)}],ddd:[""],dddd:[""],m:["[1-9]|1[012]",function(e){var t=e?parseInt(e):0;return t>0&&t--,Date.prototype.setMonth.call(this,t)},"month",function(){return Date.prototype.getMonth.call(this)+1}],mm:["0[1-9]|1[012]",function(e){var t=e?parseInt(e):0;return t>0&&t--,Date.prototype.setMonth.call(this,t)},"month",function(){return E(Date.prototype.getMonth.call(this)+1,2)}],mmm:[""],mmmm:[""],yy:["[0-9]{2}",Date.prototype.setFullYear,"year",function(){return E(Date.prototype.getFullYear.call(this),2)}],yyyy:["[0-9]{4}",Date.prototype.setFullYear,"year",function(){return E(Date.prototype.getFullYear.call(this),4)}],h:["[1-9]|1[0-2]",Date.prototype.setHours,"hours",Date.prototype.getHours],hh:["0[1-9]|1[0-2]",Date.prototype.setHours,"hours",function(){return E(Date.prototype.getHours.call(this),2)}],hx:[function(e){return"[0-9]{".concat(e,"}")},Date.prototype.setHours,"hours",function(e){return Date.prototype.getHours}],H:["1?[0-9]|2[0-3]",Date.prototype.setHours,"hours",Date.prototype.getHours],HH:["0[0-9]|1[0-9]|2[0-3]",Date.prototype.setHours,"hours",function(){return E(Date.prototype.getHours.call(this),2)}],Hx:[function(e){return"[0-9]{".concat(e,"}")},Date.prototype.setHours,"hours",function(e){return function(){return E(Date.prototype.getHours.call(this),e)}}],M:["[1-5]?[0-9]",Date.prototype.setMinutes,"minutes",Date.prototype.getMinutes],MM:["0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]",Date.prototype.setMinutes,"minutes",function(){return E(Date.prototype.getMinutes.call(this),2)}],s:["[1-5]?[0-9]",Date.prototype.setSeconds,"seconds",Date.prototype.getSeconds],ss:["0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]",Date.prototype.setSeconds,"seconds",function(){return E(Date.prototype.getSeconds.call(this),2)}],l:["[0-9]{3}",Date.prototype.setMilliseconds,"milliseconds",function(){return E(Date.prototype.getMilliseconds.call(this),3)}],L:["[0-9]{2}",Date.prototype.setMilliseconds,"milliseconds",function(){return E(Date.prototype.getMilliseconds.call(this),2)}],t:["[ap]",g,"ampm",k,1],tt:["[ap]m",g,"ampm",k,2],T:["[AP]",g,"ampm",k,1],TT:["[AP]M",g,"ampm",k,2],Z:[""],o:[""],S:[""]},m={isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};function g(e){var t=this.getHours();e.toLowerCase().includes("p")?this.setHours(t+12):e.toLowerCase().includes("a")&&t>=12&&this.setHours(t-12)}function k(){}function y(e){var t=new RegExp("\\d+$").exec(e[0]);if(t&&void 0!==t[0]){var i=v[e[0][0]+"x"].slice("");return i[0]=i[0](t[0]),i[3]=i[3](t[0]),i}if(v[e[0]])return v[e[0]]}function b(e){if(!e.tokenizer){var t=[],i=[];for(var a in v)if(/\.*x$/.test(a)){var n=a[0]+"\\d+";-1===i.indexOf(n)&&i.push(n)}else-1===t.indexOf(a[0])&&t.push(a[0]);e.tokenizer="("+(i.length>0?i.join("|")+"|":"")+t.join("+|")+")+?|.",e.tokenizer=new RegExp(e.tokenizer,"g")}return e.tokenizer}function x(e,t,i){if(!h)return!0;if(void 0===e.rawday||!isFinite(e.rawday)&&new Date(e.date.getFullYear(),isFinite(e.rawmonth)?e.month:e.date.getMonth()+1,0).getDate()>=e.day||"29"==e.day&&(!isFinite(e.rawyear)||void 0===e.rawyear||""===e.rawyear)||new Date(e.date.getFullYear(),isFinite(e.rawmonth)?e.month:e.date.getMonth()+1,0).getDate()>=e.day)return t;if("29"==e.day){var a=_(t.pos,i);if("yyyy"===a.targetMatch[0]&&t.pos-a.targetMatchIndex==2)return t.remove=t.pos+1,t}else if("02"==e.month&&"30"==e.day&&void 0!==t.c)return e.day="03",e.date.setDate(3),e.date.setMonth(1),t.insert=[{pos:t.pos,c:"0"},{pos:t.pos+1,c:t.c}],t.caret=o.seekNext.call(this,t.pos+1),t;return!1}function P(e,t,i,a){var n,o,s="";for(b(i).lastIndex=0;n=b(i).exec(e);){if(void 0===t)if(o=y(n))s+="("+o[0]+")";else switch(n[0]){case"[":s+="(";break;case"]":s+=")?";break;default:s+=(0,r.default)(n[0])}else if(o=y(n))if(!0!==a&&o[3])s+=o[3].call(t.date);else o[2]?s+=t["raw"+o[2]]:s+=n[0];else s+=n[0]}return s}function E(e,t,i){for(e=String(e),t=t||2;e.length<t;)e=i?e+"0":"0"+e;return e}function S(e,t,i){return"string"==typeof e?new d(e,t,i):e&&"object"===l(e)&&Object.prototype.hasOwnProperty.call(e,"date")?e:void 0}function w(e,t){return P(t.inputFormat,{date:e},t)}function _(e,t){var i,a,n=0,r=0;for(b(t).lastIndex=0;a=b(t).exec(t.inputFormat);){var o=new RegExp("\\d+$").exec(a[0]);if((n+=r=o?parseInt(o[0]):a[0].length)>=e+1){i=a,a=b(t).exec(t.inputFormat);break}}return{targetMatchIndex:n-r,nextMatch:a,targetMatch:i}}a.default.extendAliases({datetime:{mask:function(e){return e.numericInput=!1,v.S=e.i18n.ordinalSuffix.join("|"),e.inputFormat=m[e.inputFormat]||e.inputFormat,e.displayFormat=m[e.displayFormat]||e.displayFormat||e.inputFormat,e.outputFormat=m[e.outputFormat]||e.outputFormat||e.inputFormat,e.placeholder=""!==e.placeholder?e.placeholder:e.inputFormat.replace(/[[\]]/,""),e.regex=P(e.inputFormat,void 0,e),e.min=S(e.min,e.inputFormat,e),e.max=S(e.max,e.inputFormat,e),null},placeholder:"",inputFormat:"isoDateTime",displayFormat:void 0,outputFormat:void 0,min:null,max:null,skipOptionalPartCharacter:"",i18n:{dayNames:["Mon","Tue","Wed","Thu","Fri","Sat","Sun","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],ordinalSuffix:["st","nd","rd","th"]},preValidation:function(e,t,i,a,n,r,o,s){if(s)return!0;if(isNaN(i)&&e[t]!==i){var l=_(t,n);if(l.nextMatch&&l.nextMatch[0]===i&&l.targetMatch[0].length>1){var u=v[l.targetMatch[0]][0];if(new RegExp(u).test("0"+e[t-1]))return e[t]=e[t-1],e[t-1]="0",{fuzzy:!0,buffer:e,refreshFromBuffer:{start:t-1,end:t+1},pos:t+1}}}return!0},postValidation:function(e,t,i,a,n,r,o,l){var u,c;if(o)return!0;if(!1===a&&(((u=_(t+1,n)).targetMatch&&u.targetMatchIndex===t&&u.targetMatch[0].length>1&&void 0!==v[u.targetMatch[0]]||(u=_(t+2,n)).targetMatch&&u.targetMatchIndex===t+1&&u.targetMatch[0].length>1&&void 0!==v[u.targetMatch[0]])&&(c=v[u.targetMatch[0]][0]),void 0!==c&&(void 0!==r.validPositions[t+1]&&new RegExp(c).test(i+"0")?(e[t]=i,e[t+1]="0",a={pos:t+2,caret:t}):new RegExp(c).test("0"+i)&&(e[t]="0",e[t+1]=i,a={pos:t+2})),!1===a))return a;if(a.fuzzy&&(e=a.buffer,t=a.pos),(u=_(t,n)).targetMatch&&u.targetMatch[0]&&void 0!==v[u.targetMatch[0]]){var f=v[u.targetMatch[0]];c=f[0];var d=e.slice(u.targetMatchIndex,u.targetMatchIndex+u.targetMatch[0].length);if(!1===new RegExp(c).test(d.join(""))&&2===u.targetMatch[0].length&&r.validPositions[u.targetMatchIndex]&&r.validPositions[u.targetMatchIndex+1]&&(r.validPositions[u.targetMatchIndex+1].input="0"),"year"==f[2])for(var h=s.getMaskTemplate.call(this,!1,1,void 0,!0),m=t+1;m<e.length;m++)e[m]=h[m],delete r.validPositions[m]}var g=a,k=S(e.join(""),n.inputFormat,n);return g&&k.date.getTime()==k.date.getTime()&&(n.prefillYear&&(g=function(e,t,i){if(e.year!==e.rawyear){var a=p.toString(),n=e.rawyear.replace(/[^0-9]/g,""),r=a.slice(0,n.length),o=a.slice(n.length);if(2===n.length&&n===r){var s=new Date(p,e.month-1,e.day);e.day==s.getDate()&&(!i.max||i.max.date.getTime()>=s.getTime())&&(e.date.setFullYear(p),e.year=a,t.insert=[{pos:t.pos+1,c:o[0]},{pos:t.pos+2,c:o[1]}])}}return t}(k,g,n)),g=function(e,t,i,a,n){if(!t)return t;if(t&&i.min&&i.min.date.getTime()==i.min.date.getTime()){var r;for(e.reset(),b(i).lastIndex=0;r=b(i).exec(i.inputFormat);){var o;if((o=y(r))&&o[3]){for(var s=o[1],l=e[o[2]],u=i.min[o[2]],c=i.max?i.max[o[2]]:u,f=[],d=!1,p=0;p<u.length;p++)void 0!==a.validPositions[p+r.index]||d?(f[p]=l[p],d=d||l[p]>u[p]):(f[p]=u[p],"year"===o[2]&&l.length-1==p&&u!=c&&(f=(parseInt(f.join(""))+1).toString().split("")),"ampm"===o[2]&&u!=c&&i.min.date.getTime()>e.date.getTime()&&(f[p]=c[p]));s.call(e._date,f.join(""))}}t=i.min.date.getTime()<=e.date.getTime(),e.reInit()}return t&&i.max&&i.max.date.getTime()==i.max.date.getTime()&&(t=i.max.date.getTime()>=e.date.getTime()),t}(k,g=x.call(this,k,g,n),n,r)),void 0!==t&&g&&a.pos!==t?{buffer:P(n.inputFormat,k,n).split(""),refreshFromBuffer:{start:t,end:a.pos},pos:a.caret||a.pos}:g},onKeyDown:function(e,t,i,a){e.ctrlKey&&e.keyCode===n.default.RIGHT&&(this.inputmask._valueSet(w(new Date,a)),f(this).trigger("setvalue"))},onUnMask:function(e,t,i){return t?P(i.outputFormat,S(e,i.inputFormat,i),i,!0):t},casing:function(e,t,i,a){return 0==t.nativeDef.indexOf("[ap]")?e.toLowerCase():0==t.nativeDef.indexOf("[AP]")?e.toUpperCase():e},onBeforeMask:function(e,t){return"[object Date]"===Object.prototype.toString.call(e)&&(e=w(e,t)),e},insertMode:!1,shiftPositions:!1,keepStatic:!1,inputmode:"numeric",prefillYear:!0}})},3851:function(e,t,i){var a,n=(a=i(2394))&&a.__esModule?a:{default:a},r=i(8711),o=i(4713);n.default.extendDefinitions({A:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",casing:"upper"},"&":{validator:"[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",casing:"upper"},"#":{validator:"[0-9A-Fa-f]",casing:"upper"}});var s=new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]");function l(e,t,i,a,n){return i-1>-1&&"."!==t.buffer[i-1]?(e=t.buffer[i-1]+e,e=i-2>-1&&"."!==t.buffer[i-2]?t.buffer[i-2]+e:"0"+e):e="00"+e,s.test(e)}n.default.extendAliases({cssunit:{regex:"[+-]?[0-9]+\\.?([0-9]+)?(px|em|rem|ex|%|in|cm|mm|pt|pc)"},url:{regex:"(https?|ftp)://.*",autoUnmask:!1,keepStatic:!1,tabThrough:!0},ip:{mask:"i[i[i]].j[j[j]].k[k[k]].l[l[l]]",definitions:{i:{validator:l},j:{validator:l},k:{validator:l},l:{validator:l}},onUnMask:function(e,t,i){return e},inputmode:"numeric"},email:{mask:"*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",greedy:!1,casing:"lower",onBeforePaste:function(e,t){return(e=e.toLowerCase()).replace("mailto:","")},definitions:{"*":{validator:"[0-9\uff11-\uff19A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5!#$%&'*+/=?^_`{|}~-]"},"-":{validator:"[0-9A-Za-z-]"}},onUnMask:function(e,t,i){return e},inputmode:"email"},mac:{mask:"##:##:##:##:##:##"},vin:{mask:"V{13}9{4}",definitions:{V:{validator:"[A-HJ-NPR-Za-hj-npr-z\\d]",casing:"upper"}},clearIncomplete:!0,autoUnmask:!0},ssn:{mask:"999-99-9999",postValidation:function(e,t,i,a,n,s,l){var u=o.getMaskTemplate.call(this,!0,r.getLastValidPosition.call(this),!0,!0);return/^(?!219-09-9999|078-05-1120)(?!666|000|9.{2}).{3}-(?!00).{2}-(?!0{4}).{4}$/.test(u.join(""))}}})},207:function(e,t,i){var a=s(i(2394)),n=s(i(5581)),r=s(i(7184)),o=i(8711);function s(e){return e&&e.__esModule?e:{default:e}}var l=a.default.dependencyLib;function u(e,t){for(var i="",n=0;n<e.length;n++)a.default.prototype.definitions[e.charAt(n)]||t.definitions[e.charAt(n)]||t.optionalmarker[0]===e.charAt(n)||t.optionalmarker[1]===e.charAt(n)||t.quantifiermarker[0]===e.charAt(n)||t.quantifiermarker[1]===e.charAt(n)||t.groupmarker[0]===e.charAt(n)||t.groupmarker[1]===e.charAt(n)||t.alternatormarker===e.charAt(n)?i+="\\"+e.charAt(n):i+=e.charAt(n);return i}function c(e,t,i,a){if(e.length>0&&t>0&&(!i.digitsOptional||a)){var n=e.indexOf(i.radixPoint),r=!1;i.negationSymbol.back===e[e.length-1]&&(r=!0,e.length--),-1===n&&(e.push(i.radixPoint),n=e.length-1);for(var o=1;o<=t;o++)isFinite(e[n+o])||(e[n+o]="0")}return r&&e.push(i.negationSymbol.back),e}function f(e,t){var i=0;if("+"===e){for(i in t.validPositions);i=o.seekNext.call(this,parseInt(i))}for(var a in t.tests)if((a=parseInt(a))>=i)for(var n=0,r=t.tests[a].length;n<r;n++)if((void 0===t.validPositions[a]||"-"===e)&&t.tests[a][n].match.def===e)return a+(void 0!==t.validPositions[a]&&"-"!==e?1:0);return i}function d(e,t){var i=-1;for(var a in t.validPositions){var n=t.validPositions[a];if(n&&n.match.def===e){i=parseInt(a);break}}return i}function p(e,t,i,a,n){var r=t.buffer?t.buffer.indexOf(n.radixPoint):-1,o=(-1!==r||a&&n.jitMasking)&&new RegExp(n.definitions[9].validator).test(e);return n._radixDance&&-1!==r&&o&&null==t.validPositions[r]?{insert:{pos:r===i?r+1:r,c:n.radixPoint},pos:i}:o}a.default.extendAliases({numeric:{mask:function(e){e.repeat=0,e.groupSeparator===e.radixPoint&&e.digits&&"0"!==e.digits&&("."===e.radixPoint?e.groupSeparator=",":","===e.radixPoint?e.groupSeparator=".":e.groupSeparator="")," "===e.groupSeparator&&(e.skipOptionalPartCharacter=void 0),e.placeholder.length>1&&(e.placeholder=e.placeholder.charAt(0)),"radixFocus"===e.positionCaretOnClick&&""===e.placeholder&&(e.positionCaretOnClick="lvp");var t="0",i=e.radixPoint;!0===e.numericInput&&void 0===e.__financeInput?(t="1",e.positionCaretOnClick="radixFocus"===e.positionCaretOnClick?"lvp":e.positionCaretOnClick,e.digitsOptional=!1,isNaN(e.digits)&&(e.digits=2),e._radixDance=!1,i=","===e.radixPoint?"?":"!",""!==e.radixPoint&&void 0===e.definitions[i]&&(e.definitions[i]={},e.definitions[i].validator="["+e.radixPoint+"]",e.definitions[i].placeholder=e.radixPoint,e.definitions[i].static=!0,e.definitions[i].generated=!0)):(e.__financeInput=!1,e.numericInput=!0);var a,n="[+]";if(n+=u(e.prefix,e),""!==e.groupSeparator?(void 0===e.definitions[e.groupSeparator]&&(e.definitions[e.groupSeparator]={},e.definitions[e.groupSeparator].validator="["+e.groupSeparator+"]",e.definitions[e.groupSeparator].placeholder=e.groupSeparator,e.definitions[e.groupSeparator].static=!0,e.definitions[e.groupSeparator].generated=!0),n+=e._mask(e)):n+="9{+}",void 0!==e.digits&&0!==e.digits){var o=e.digits.toString().split(",");isFinite(o[0])&&o[1]&&isFinite(o[1])?n+=i+t+"{"+e.digits+"}":(isNaN(e.digits)||parseInt(e.digits)>0)&&(e.digitsOptional||e.jitMasking?(a=n+i+t+"{0,"+e.digits+"}",e.keepStatic=!0):n+=i+t+"{"+e.digits+"}")}else e.inputmode="numeric";return n+=u(e.suffix,e),n+="[-]",a&&(n=[a+u(e.suffix,e)+"[-]",n]),e.greedy=!1,function(e){void 0===e.parseMinMaxOptions&&(null!==e.min&&(e.min=e.min.toString().replace(new RegExp((0,r.default)(e.groupSeparator),"g"),""),","===e.radixPoint&&(e.min=e.min.replace(e.radixPoint,".")),e.min=isFinite(e.min)?parseFloat(e.min):NaN,isNaN(e.min)&&(e.min=Number.MIN_VALUE)),null!==e.max&&(e.max=e.max.toString().replace(new RegExp((0,r.default)(e.groupSeparator),"g"),""),","===e.radixPoint&&(e.max=e.max.replace(e.radixPoint,".")),e.max=isFinite(e.max)?parseFloat(e.max):NaN,isNaN(e.max)&&(e.max=Number.MAX_VALUE)),e.parseMinMaxOptions="done")}(e),""!==e.radixPoint&&(e.substitutes["."==e.radixPoint?",":"."]=e.radixPoint),n},_mask:function(e){return"("+e.groupSeparator+"999){+|1}"},digits:"*",digitsOptional:!0,enforceDigitsOnBlur:!1,radixPoint:".",positionCaretOnClick:"radixFocus",_radixDance:!0,groupSeparator:"",allowMinus:!0,negationSymbol:{front:"-",back:""},prefix:"",suffix:"",min:null,max:null,SetMaxOnOverflow:!1,step:1,inputType:"text",unmaskAsNumber:!1,roundingFN:Math.round,inputmode:"decimal",shortcuts:{k:"000",m:"000000"},placeholder:"0",greedy:!1,rightAlign:!0,insertMode:!0,autoUnmask:!1,skipOptionalPartCharacter:"",usePrototypeDefinitions:!1,definitions:{0:{validator:p},1:{validator:p,definitionSymbol:"9"},9:{validator:"[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]",definitionSymbol:"*"},"+":{validator:function(e,t,i,a,n){return n.allowMinus&&("-"===e||e===n.negationSymbol.front)}},"-":{validator:function(e,t,i,a,n){return n.allowMinus&&e===n.negationSymbol.back}}},preValidation:function(e,t,i,a,n,r,o,s){var l;if(!1!==n.__financeInput&&i===n.radixPoint)return!1;if(l=n.shortcuts&&n.shortcuts[i]){if(l.length>1)for(var u=[],c=0;c<l.length;c++)u.push({pos:t+c,c:l[c],strict:!1});return{insert:u}}var p=e.indexOf(n.radixPoint),h=t;if(t=function(e,t,i,a,n){return n._radixDance&&n.numericInput&&t!==n.negationSymbol.back&&e<=i&&(i>0||t==n.radixPoint)&&(void 0===a.validPositions[e-1]||a.validPositions[e-1].input!==n.negationSymbol.back)&&(e-=1),e}(t,i,p,r,n),"-"===i||i===n.negationSymbol.front){if(!0!==n.allowMinus)return!1;var v=!1,m=d("+",r),g=d("-",r);return-1!==m&&(v=[m,g]),!1!==v?{remove:v,caret:h-n.negationSymbol.back.length}:{insert:[{pos:f.call(this,"+",r),c:n.negationSymbol.front,fromIsValid:!0},{pos:f.call(this,"-",r),c:n.negationSymbol.back,fromIsValid:void 0}],caret:h+n.negationSymbol.back.length}}if(i===n.groupSeparator)return{caret:h};if(s)return!0;if(-1!==p&&!0===n._radixDance&&!1===a&&i===n.radixPoint&&void 0!==n.digits&&(isNaN(n.digits)||parseInt(n.digits)>0)&&p!==t)return{caret:n._radixDance&&t===p-1?p+1:p};if(!1===n.__financeInput)if(a){if(n.digitsOptional)return{rewritePosition:o.end};if(!n.digitsOptional){if(o.begin>p&&o.end<=p)return i===n.radixPoint?{insert:{pos:p+1,c:"0",fromIsValid:!0},rewritePosition:p}:{rewritePosition:p+1};if(o.begin<p)return{rewritePosition:o.begin-1}}}else if(!n.showMaskOnHover&&!n.showMaskOnFocus&&!n.digitsOptional&&n.digits>0&&""===this.__valueGet.call(this.el))return{rewritePosition:p};return{rewritePosition:t}},postValidation:function(e,t,i,a,n,r,o){if(!1===a)return a;if(o)return!0;if(null!==n.min||null!==n.max){var s=n.onUnMask(e.slice().reverse().join(""),void 0,l.extend({},n,{unmaskAsNumber:!0}));if(null!==n.min&&s<n.min&&(s.toString().length>n.min.toString().length||s<0))return!1;if(null!==n.max&&s>n.max)return!!n.SetMaxOnOverflow&&{refreshFromBuffer:!0,buffer:c(n.max.toString().replace(".",n.radixPoint).split(""),n.digits,n).reverse()}}return a},onUnMask:function(e,t,i){if(""===t&&!0===i.nullable)return t;var a=e.replace(i.prefix,"");return a=(a=a.replace(i.suffix,"")).replace(new RegExp((0,r.default)(i.groupSeparator),"g"),""),""!==i.placeholder.charAt(0)&&(a=a.replace(new RegExp(i.placeholder.charAt(0),"g"),"0")),i.unmaskAsNumber?(""!==i.radixPoint&&-1!==a.indexOf(i.radixPoint)&&(a=a.replace(r.default.call(this,i.radixPoint),".")),a=(a=a.replace(new RegExp("^"+(0,r.default)(i.negationSymbol.front)),"-")).replace(new RegExp((0,r.default)(i.negationSymbol.back)+"$"),""),Number(a)):a},isComplete:function(e,t){var i=(t.numericInput?e.slice().reverse():e).join("");return i=(i=(i=(i=(i=i.replace(new RegExp("^"+(0,r.default)(t.negationSymbol.front)),"-")).replace(new RegExp((0,r.default)(t.negationSymbol.back)+"$"),"")).replace(t.prefix,"")).replace(t.suffix,"")).replace(new RegExp((0,r.default)(t.groupSeparator)+"([0-9]{3})","g"),"$1"),","===t.radixPoint&&(i=i.replace((0,r.default)(t.radixPoint),".")),isFinite(i)},onBeforeMask:function(e,t){var i=t.radixPoint||",";isFinite(t.digits)&&(t.digits=parseInt(t.digits)),"number"!=typeof e&&"number"!==t.inputType||""===i||(e=e.toString().replace(".",i));var a="-"===e.charAt(0)||e.charAt(0)===t.negationSymbol.front,n=e.split(i),o=n[0].replace(/[^\-0-9]/g,""),s=n.length>1?n[1].replace(/[^0-9]/g,""):"",l=n.length>1;e=o+(""!==s?i+s:s);var u=0;if(""!==i&&(u=t.digitsOptional?t.digits<s.length?t.digits:s.length:t.digits,""!==s||!t.digitsOptional)){var f=Math.pow(10,u||1);e=e.replace((0,r.default)(i),"."),isNaN(parseFloat(e))||(e=(t.roundingFN(parseFloat(e)*f)/f).toFixed(u)),e=e.toString().replace(".",i)}if(0===t.digits&&-1!==e.indexOf(i)&&(e=e.substring(0,e.indexOf(i))),null!==t.min||null!==t.max){var d=e.toString().replace(i,".");null!==t.min&&d<t.min?e=t.min.toString().replace(".",i):null!==t.max&&d>t.max&&(e=t.max.toString().replace(".",i))}return a&&"-"!==e.charAt(0)&&(e="-"+e),c(e.toString().split(""),u,t,l).join("")},onBeforeWrite:function(e,t,i,a){function n(e,t){if(!1!==a.__financeInput||t){var i=e.indexOf(a.radixPoint);-1!==i&&e.splice(i,1)}if(""!==a.groupSeparator)for(;-1!==(i=e.indexOf(a.groupSeparator));)e.splice(i,1);return e}var o,s=function(e,t){var i=new RegExp("(^"+(""!==t.negationSymbol.front?(0,r.default)(t.negationSymbol.front)+"?":"")+(0,r.default)(t.prefix)+")(.*)("+(0,r.default)(t.suffix)+(""!=t.negationSymbol.back?(0,r.default)(t.negationSymbol.back)+"?":"")+"$)").exec(e.slice().reverse().join("")),a=i?i[2]:"",n=!1;return a&&(a=a.split(t.radixPoint.charAt(0))[0],n=new RegExp("^[0"+t.groupSeparator+"]*").exec(a)),!(!n||!(n[0].length>1||n[0].length>0&&n[0].length<a.length))&&n}(t,a);if(s)for(var u=t.join("").lastIndexOf(s[0].split("").reverse().join(""))-(s[0]==s.input?0:1),f=s[0]==s.input?1:0,d=s[0].length-f;d>0;d--)delete this.maskset.validPositions[u+d],delete t[u+d];if(e)switch(e.type){case"blur":case"checkval":if(null!==a.min){var p=a.onUnMask(t.slice().reverse().join(""),void 0,l.extend({},a,{unmaskAsNumber:!0}));if(null!==a.min&&p<a.min)return{refreshFromBuffer:!0,buffer:c(a.min.toString().replace(".",a.radixPoint).split(""),a.digits,a).reverse()}}if(t[t.length-1]===a.negationSymbol.front){var h=new RegExp("(^"+(""!=a.negationSymbol.front?(0,r.default)(a.negationSymbol.front)+"?":"")+(0,r.default)(a.prefix)+")(.*)("+(0,r.default)(a.suffix)+(""!=a.negationSymbol.back?(0,r.default)(a.negationSymbol.back)+"?":"")+"$)").exec(n(t.slice(),!0).reverse().join(""));0==(h?h[2]:"")&&(o={refreshFromBuffer:!0,buffer:[0]})}else if(""!==a.radixPoint){t.indexOf(a.radixPoint)===a.suffix.length&&(o&&o.buffer?o.buffer.splice(0,1+a.suffix.length):(t.splice(0,1+a.suffix.length),o={refreshFromBuffer:!0,buffer:n(t)}))}if(a.enforceDigitsOnBlur){var v=(o=o||{})&&o.buffer||t.slice().reverse();o.refreshFromBuffer=!0,o.buffer=c(v,a.digits,a,!0).reverse()}}return o},onKeyDown:function(e,t,i,a){var r,o=l(this);if(e.ctrlKey)switch(e.keyCode){case n.default.UP:return this.inputmask.__valueSet.call(this,parseFloat(this.inputmask.unmaskedvalue())+parseInt(a.step)),o.trigger("setvalue"),!1;case n.default.DOWN:return this.inputmask.__valueSet.call(this,parseFloat(this.inputmask.unmaskedvalue())-parseInt(a.step)),o.trigger("setvalue"),!1}if(!e.shiftKey&&(e.keyCode===n.default.DELETE||e.keyCode===n.default.BACKSPACE||e.keyCode===n.default.BACKSPACE_SAFARI)&&i.begin!==t.length){if(t[e.keyCode===n.default.DELETE?i.begin-1:i.end]===a.negationSymbol.front)return r=t.slice().reverse(),""!==a.negationSymbol.front&&r.shift(),""!==a.negationSymbol.back&&r.pop(),o.trigger("setvalue",[r.join(""),i.begin]),!1;if(!0===a._radixDance){var s=t.indexOf(a.radixPoint);if(a.digitsOptional){if(0===s)return(r=t.slice().reverse()).pop(),o.trigger("setvalue",[r.join(""),i.begin>=r.length?r.length:i.begin]),!1}else if(-1!==s&&(i.begin<s||i.end<s||e.keyCode===n.default.DELETE&&i.begin===s))return i.begin!==i.end||e.keyCode!==n.default.BACKSPACE&&e.keyCode!==n.default.BACKSPACE_SAFARI||i.begin++,(r=t.slice().reverse()).splice(r.length-i.begin,i.begin-i.end+1),r=c(r,a.digits,a).join(""),o.trigger("setvalue",[r,i.begin>=r.length?s+1:i.begin]),!1}}}},currency:{prefix:"",groupSeparator:",",alias:"numeric",digits:2,digitsOptional:!1},decimal:{alias:"numeric"},integer:{alias:"numeric",inputmode:"numeric",digits:0},percentage:{alias:"numeric",min:0,max:100,suffix:" %",digits:0,allowMinus:!1},indianns:{alias:"numeric",_mask:function(e){return"("+e.groupSeparator+"99){*|1}("+e.groupSeparator+"999){1|1}"},groupSeparator:",",radixPoint:".",placeholder:"0",digits:2,digitsOptional:!1}})},9380:function(e,t,i){var a;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=((a=i(8741))&&a.__esModule?a:{default:a}).default?window:{};t.default=n},7760:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.applyInputValue=c,t.clearOptionalTail=f,t.checkVal=d,t.HandleNativePlaceholder=function(e,t){var i=e?e.inputmask:this;if(l.ie){if(e.inputmask._valueGet()!==t&&(e.placeholder!==t||""===e.placeholder)){var a=o.getBuffer.call(i).slice(),n=e.inputmask._valueGet();if(n!==t){var r=o.getLastValidPosition.call(i);-1===r&&n===o.getBufferTemplate.call(i).join("")?a=[]:-1!==r&&f.call(i,a),p(e,a)}}}else e.placeholder!==t&&(e.placeholder=t,""===e.placeholder&&e.removeAttribute("placeholder"))},t.unmaskedvalue=function(e){var t=e?e.inputmask:this,i=t.opts,a=t.maskset;if(e){if(void 0===e.inputmask)return e.value;e.inputmask&&e.inputmask.refreshValue&&c(e,e.inputmask._valueGet(!0))}var n=[],r=a.validPositions;for(var s in r)r[s]&&r[s].match&&(1!=r[s].match.static||Array.isArray(a.metadata)&&!0!==r[s].generatedInput)&&n.push(r[s].input);var l=0===n.length?"":(t.isRTL?n.reverse():n).join("");if("function"==typeof i.onUnMask){var u=(t.isRTL?o.getBuffer.call(t).slice().reverse():o.getBuffer.call(t)).join("");l=i.onUnMask.call(t,u,l,i)}return l},t.writeBuffer=p;var a,n=(a=i(5581))&&a.__esModule?a:{default:a},r=i(4713),o=i(8711),s=i(7215),l=i(9845),u=i(6030);function c(e,t){var i=e?e.inputmask:this,a=i.opts;e.inputmask.refreshValue=!1,"function"==typeof a.onBeforeMask&&(t=a.onBeforeMask.call(i,t,a)||t),d(e,!0,!1,t=t.toString().split("")),i.undoValue=i._valueGet(!0),(a.clearMaskOnLostFocus||a.clearIncomplete)&&e.inputmask._valueGet()===o.getBufferTemplate.call(i).join("")&&-1===o.getLastValidPosition.call(i)&&e.inputmask._valueSet("")}function f(e){e.length=0;for(var t,i=r.getMaskTemplate.call(this,!0,0,!0,void 0,!0);void 0!==(t=i.shift());)e.push(t);return e}function d(e,t,i,a,n){var l=e?e.inputmask:this,c=l.maskset,f=l.opts,d=l.dependencyLib,h=a.slice(),v="",m=-1,g=void 0,k=f.skipOptionalPartCharacter;f.skipOptionalPartCharacter="",o.resetMaskSet.call(l),c.tests={},m=f.radixPoint?o.determineNewCaretPosition.call(l,{begin:0,end:0},!1,!1===f.__financeInput?"radixFocus":void 0).begin:0,c.p=m,l.caretPos={begin:m};var y=[],b=l.caretPos;if(h.forEach((function(e,t){if(void 0!==e){var a=new d.Event("_checkval");a.keyCode=e.toString().charCodeAt(0),v+=e;var n=o.getLastValidPosition.call(l,void 0,!0);!function(e,t){for(var i=r.getMaskTemplate.call(l,!0,0).slice(e,o.seekNext.call(l,e,!1,!1)).join("").replace(/'/g,""),a=i.indexOf(t);a>0&&" "===i[a-1];)a--;var n=0===a&&!o.isMask.call(l,e)&&(r.getTest.call(l,e).match.nativeDef===t.charAt(0)||!0===r.getTest.call(l,e).match.static&&r.getTest.call(l,e).match.nativeDef==="'"+t.charAt(0)||" "===r.getTest.call(l,e).match.nativeDef&&(r.getTest.call(l,e+1).match.nativeDef===t.charAt(0)||!0===r.getTest.call(l,e+1).match.static&&r.getTest.call(l,e+1).match.nativeDef==="'"+t.charAt(0)));if(!n&&a>0&&!o.isMask.call(l,e,!1,!0)){var s=o.seekNext.call(l,e);l.caretPos.begin<s&&(l.caretPos={begin:s})}return n}(m,v)?(g=u.EventHandlers.keypressEvent.call(l,a,!0,!1,i,l.caretPos.begin))&&(m=l.caretPos.begin+1,v=""):g=u.EventHandlers.keypressEvent.call(l,a,!0,!1,i,n+1),g?(void 0!==g.pos&&c.validPositions[g.pos]&&!0===c.validPositions[g.pos].match.static&&void 0===c.validPositions[g.pos].alternation&&(y.push(g.pos),l.isRTL||(g.forwardPosition=g.pos+1)),p.call(l,void 0,o.getBuffer.call(l),g.forwardPosition,a,!1),l.caretPos={begin:g.forwardPosition,end:g.forwardPosition},b=l.caretPos):void 0===c.validPositions[t]&&h[t]===r.getPlaceholder.call(l,t)&&o.isMask.call(l,t,!0)?l.caretPos.begin++:l.caretPos=b}})),y.length>0){var x,P,E=o.seekNext.call(l,-1,void 0,!1);if(!s.isComplete.call(l,o.getBuffer.call(l))&&y.length<=E||s.isComplete.call(l,o.getBuffer.call(l))&&y.length>0&&y.length!==E&&0===y[0])for(var S=E;void 0!==(x=y.shift());){var w=new d.Event("_checkval");if((P=c.validPositions[x]).generatedInput=!0,w.keyCode=P.input.charCodeAt(0),(g=u.EventHandlers.keypressEvent.call(l,w,!0,!1,i,S))&&void 0!==g.pos&&g.pos!==x&&c.validPositions[g.pos]&&!0===c.validPositions[g.pos].match.static)y.push(g.pos);else if(!g)break;S++}}t&&p.call(l,e,o.getBuffer.call(l),g?g.forwardPosition:l.caretPos.begin,n||new d.Event("checkval"),n&&("input"===n.type||"paste"===n.type)&&l.undoValue!==l._valueGet(!0)),f.skipOptionalPartCharacter=k}function p(e,t,i,a,r){var l=e?e.inputmask:this,u=l.opts,c=l.dependencyLib;if(a&&"function"==typeof u.onBeforeWrite){var f=u.onBeforeWrite.call(l,a,t,i,u);if(f){if(f.refreshFromBuffer){var d=f.refreshFromBuffer;s.refreshFromBuffer.call(l,!0===d?d:d.start,d.end,f.buffer||t),t=o.getBuffer.call(l,!0)}void 0!==i&&(i=void 0!==f.caret?f.caret:i)}}if(void 0!==e&&(e.inputmask._valueSet(t.join("")),void 0===i||void 0!==a&&"blur"===a.type||o.caret.call(l,e,i,void 0,void 0,void 0!==a&&"keydown"===a.type&&(a.keyCode===n.default.DELETE||a.keyCode===n.default.BACKSPACE)),!0===r)){var p=c(e),h=e.inputmask._valueGet();e.inputmask.skipInputEvent=!0,p.trigger("input"),setTimeout((function(){h===o.getBufferTemplate.call(l).join("")?p.trigger("cleared"):!0===s.isComplete.call(l,t)&&p.trigger("complete")}),0)}}},2394:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,i(7149),i(3194);var a=i(157),n=m(i(3287)),r=m(i(9380)),o=i(2391),s=i(4713),l=i(8711),u=i(7215),c=i(7760),f=i(9716),d=m(i(7392)),p=m(i(3976)),h=m(i(8741));function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return e&&e.__esModule?e:{default:e}}var g=r.default.document,k="_inputmask_opts";function y(e,t,i){if(h.default){if(!(this instanceof y))return new y(e,t,i);this.dependencyLib=n.default,this.el=void 0,this.events={},this.maskset=void 0,!0!==i&&("[object Object]"===Object.prototype.toString.call(e)?t=e:(t=t||{},e&&(t.alias=e)),this.opts=n.default.extend(!0,{},this.defaults,t),this.noMasksCache=t&&void 0!==t.definitions,this.userOptions=t||{},b(this.opts.alias,t,this.opts)),this.refreshValue=!1,this.undoValue=void 0,this.$el=void 0,this.skipKeyPressEvent=!1,this.skipInputEvent=!1,this.validationEvent=!1,this.ignorable=!1,this.maxLength,this.mouseEnter=!1,this.originalPlaceholder=void 0,this.isComposing=!1}}function b(e,t,i){var a=y.prototype.aliases[e];return a?(a.alias&&b(a.alias,void 0,i),n.default.extend(!0,i,a),n.default.extend(!0,i,t),!0):(null===i.mask&&(i.mask=e),!1)}y.prototype={dataAttribute:"data-inputmask",defaults:p.default,definitions:d.default,aliases:{},masksCache:{},get isRTL(){return this.opts.isRTL||this.opts.numericInput},mask:function(e){var t=this;return"string"==typeof e&&(e=g.getElementById(e)||g.querySelectorAll(e)),(e=e.nodeName?[e]:Array.isArray(e)?e:Array.from(e)).forEach((function(e,i){var s=n.default.extend(!0,{},t.opts);if(function(e,t,i,a){function o(t,n){var o=""===a?t:a+"-"+t;null!==(n=void 0!==n?n:e.getAttribute(o))&&("string"==typeof n&&(0===t.indexOf("on")?n=r.default[n]:"false"===n?n=!1:"true"===n&&(n=!0)),i[t]=n)}if(!0===t.importDataAttributes){var s,l,u,c,f=e.getAttribute(a);if(f&&""!==f&&(f=f.replace(/'/g,'"'),l=JSON.parse("{"+f+"}")),l)for(c in u=void 0,l)if("alias"===c.toLowerCase()){u=l[c];break}for(s in o("alias",u),i.alias&&b(i.alias,i,t),t){if(l)for(c in u=void 0,l)if(c.toLowerCase()===s.toLowerCase()){u=l[c];break}o(s,u)}}n.default.extend(!0,t,i),("rtl"===e.dir||t.rightAlign)&&(e.style.textAlign="right");("rtl"===e.dir||t.numericInput)&&(e.dir="ltr",e.removeAttribute("dir"),t.isRTL=!0);return Object.keys(i).length}(e,s,n.default.extend(!0,{},t.userOptions),t.dataAttribute)){var l=(0,o.generateMaskSet)(s,t.noMasksCache);void 0!==l&&(void 0!==e.inputmask&&(e.inputmask.opts.autoUnmask=!0,e.inputmask.remove()),e.inputmask=new y(void 0,void 0,!0),e.inputmask.opts=s,e.inputmask.noMasksCache=t.noMasksCache,e.inputmask.userOptions=n.default.extend(!0,{},t.userOptions),e.inputmask.el=e,e.inputmask.$el=(0,n.default)(e),e.inputmask.maskset=l,n.default.data(e,k,t.userOptions),a.mask.call(e.inputmask))}})),e&&e[0]&&e[0].inputmask||this},option:function(e,t){return"string"==typeof e?this.opts[e]:"object"===v(e)?(n.default.extend(this.userOptions,e),this.el&&!0!==t&&this.mask(this.el),this):void 0},unmaskedvalue:function(e){if(this.maskset=this.maskset||(0,o.generateMaskSet)(this.opts,this.noMasksCache),void 0===this.el||void 0!==e){var t=("function"==typeof this.opts.onBeforeMask&&this.opts.onBeforeMask.call(this,e,this.opts)||e).split("");c.checkVal.call(this,void 0,!1,!1,t),"function"==typeof this.opts.onBeforeWrite&&this.opts.onBeforeWrite.call(this,void 0,l.getBuffer.call(this),0,this.opts)}return c.unmaskedvalue.call(this,this.el)},remove:function(){if(this.el){n.default.data(this.el,k,null);var e=this.opts.autoUnmask?(0,c.unmaskedvalue)(this.el):this._valueGet(this.opts.autoUnmask);e!==l.getBufferTemplate.call(this).join("")?this._valueSet(e,this.opts.autoUnmask):this._valueSet(""),f.EventRuler.off(this.el),Object.getOwnPropertyDescriptor&&Object.getPrototypeOf?Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this.el),"value")&&this.__valueGet&&Object.defineProperty(this.el,"value",{get:this.__valueGet,set:this.__valueSet,configurable:!0}):g.__lookupGetter__&&this.el.__lookupGetter__("value")&&this.__valueGet&&(this.el.__defineGetter__("value",this.__valueGet),this.el.__defineSetter__("value",this.__valueSet)),this.el.inputmask=void 0}return this.el},getemptymask:function(){return this.maskset=this.maskset||(0,o.generateMaskSet)(this.opts,this.noMasksCache),l.getBufferTemplate.call(this).join("")},hasMaskedValue:function(){return!this.opts.autoUnmask},isComplete:function(){return this.maskset=this.maskset||(0,o.generateMaskSet)(this.opts,this.noMasksCache),u.isComplete.call(this,l.getBuffer.call(this))},getmetadata:function(){if(this.maskset=this.maskset||(0,o.generateMaskSet)(this.opts,this.noMasksCache),Array.isArray(this.maskset.metadata)){var e=s.getMaskTemplate.call(this,!0,0,!1).join("");return this.maskset.metadata.forEach((function(t){return t.mask!==e||(e=t,!1)})),e}return this.maskset.metadata},isValid:function(e){if(this.maskset=this.maskset||(0,o.generateMaskSet)(this.opts,this.noMasksCache),e){var t=("function"==typeof this.opts.onBeforeMask&&this.opts.onBeforeMask.call(this,e,this.opts)||e).split("");c.checkVal.call(this,void 0,!0,!1,t)}else e=this.isRTL?l.getBuffer.call(this).slice().reverse().join(""):l.getBuffer.call(this).join("");for(var i=l.getBuffer.call(this),a=l.determineLastRequiredPosition.call(this),n=i.length-1;n>a&&!l.isMask.call(this,n);n--);return i.splice(a,n+1-a),u.isComplete.call(this,i)&&e===(this.isRTL?l.getBuffer.call(this).slice().reverse().join(""):l.getBuffer.call(this).join(""))},format:function(e,t){this.maskset=this.maskset||(0,o.generateMaskSet)(this.opts,this.noMasksCache);var i=("function"==typeof this.opts.onBeforeMask&&this.opts.onBeforeMask.call(this,e,this.opts)||e).split("");c.checkVal.call(this,void 0,!0,!1,i);var a=this.isRTL?l.getBuffer.call(this).slice().reverse().join(""):l.getBuffer.call(this).join("");return t?{value:a,metadata:this.getmetadata()}:a},setValue:function(e){this.el&&(0,n.default)(this.el).trigger("setvalue",[e])},analyseMask:o.analyseMask},y.extendDefaults=function(e){n.default.extend(!0,y.prototype.defaults,e)},y.extendDefinitions=function(e){n.default.extend(!0,y.prototype.definitions,e)},y.extendAliases=function(e){n.default.extend(!0,y.prototype.aliases,e)},y.format=function(e,t,i){return y(t).format(e,i)},y.unmask=function(e,t){return y(t).unmaskedvalue(e)},y.isValid=function(e,t){return y(t).isValid(e)},y.remove=function(e){"string"==typeof e&&(e=g.getElementById(e)||g.querySelectorAll(e)),(e=e.nodeName?[e]:e).forEach((function(e){e.inputmask&&e.inputmask.remove()}))},y.setValue=function(e,t){"string"==typeof e&&(e=g.getElementById(e)||g.querySelectorAll(e)),(e=e.nodeName?[e]:e).forEach((function(e){e.inputmask?e.inputmask.setValue(t):(0,n.default)(e).trigger("setvalue",[t])}))},y.dependencyLib=n.default,r.default.Inputmask=y;var x=y;t.default=x},5296:function(e,t,i){function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var n=p(i(9380)),r=p(i(2394)),o=p(i(8741));function s(e,t){if(t&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function l(e){var t="function"==typeof Map?new Map:void 0;return(l=function(e){if(null===e||(i=e,-1===Function.toString.call(i).indexOf("[native code]")))return e;var i;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,a)}function a(){return u(e,arguments,d(this).constructor)}return a.prototype=Object.create(e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),f(a,e)})(e)}function u(e,t,i){return(u=c()?Reflect.construct:function(e,t,i){var a=[null];a.push.apply(a,t);var n=new(Function.bind.apply(e,a));return i&&f(n,i.prototype),n}).apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e){return e&&e.__esModule?e:{default:e}}var h=n.default.document;if(o.default&&h&&h.head&&h.head.attachShadow&&n.default.customElements&&void 0===n.default.customElements.get("input-mask")){var v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(n,e);var t,i,a=(t=n,i=c(),function(){var e,a=d(t);if(i){var n=d(this).constructor;e=Reflect.construct(a,arguments,n)}else e=a.apply(this,arguments);return s(this,e)});function n(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n);var t=(e=a.call(this)).getAttributeNames(),i=e.attachShadow({mode:"closed"}),o=h.createElement("input");for(var s in o.type="text",i.appendChild(o),t)Object.prototype.hasOwnProperty.call(t,s)&&o.setAttribute(t[s],e.getAttribute(t[s]));var l=new r.default;return l.dataAttribute="",l.mask(o),o.inputmask.shadowRoot=i,e}return n}(l(HTMLElement));n.default.customElements.define("input-mask",v)}},443:function(e,t,i){var a=o(i(8254)),n=o(i(2394));function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e){return e&&e.__esModule?e:{default:e}}void 0===a.default.fn.inputmask&&(a.default.fn.inputmask=function(e,t){var i,o=this[0];if(void 0===t&&(t={}),"string"==typeof e)switch(e){case"unmaskedvalue":return o&&o.inputmask?o.inputmask.unmaskedvalue():(0,a.default)(o).val();case"remove":return this.each((function(){this.inputmask&&this.inputmask.remove()}));case"getemptymask":return o&&o.inputmask?o.inputmask.getemptymask():"";case"hasMaskedValue":return!(!o||!o.inputmask)&&o.inputmask.hasMaskedValue();case"isComplete":return!o||!o.inputmask||o.inputmask.isComplete();case"getmetadata":return o&&o.inputmask?o.inputmask.getmetadata():void 0;case"setvalue":n.default.setValue(o,t);break;case"option":if("string"!=typeof t)return this.each((function(){if(void 0!==this.inputmask)return this.inputmask.option(t)}));if(o&&void 0!==o.inputmask)return o.inputmask.option(t);break;default:return t.alias=e,i=new n.default(t),this.each((function(){i.mask(this)}))}else{if(Array.isArray(e))return t.alias=e,i=new n.default(t),this.each((function(){i.mask(this)}));if("object"==r(e))return i=new n.default(e),void 0===e.mask&&void 0===e.alias?this.each((function(){if(void 0!==this.inputmask)return this.inputmask.option(e);i.mask(this)})):this.each((function(){i.mask(this)}));if(void 0===e)return this.each((function(){(i=new n.default(t)).mask(this)}))}})},2391:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.generateMaskSet=function(e,t){var i;function n(e,i,n){var o,s,l=!1;if(null!==e&&""!==e||((l=null!==n.regex)?e=(e=n.regex).replace(/^(\^)(.*)(\$)$/,"$2"):(l=!0,e=".*")),1===e.length&&!1===n.greedy&&0!==n.repeat&&(n.placeholder=""),n.repeat>0||"*"===n.repeat||"+"===n.repeat){var u="*"===n.repeat?0:"+"===n.repeat?1:n.repeat;e=n.groupmarker[0]+e+n.groupmarker[1]+n.quantifiermarker[0]+u+","+n.repeat+n.quantifiermarker[1]}return s=l?"regex_"+n.regex:n.numericInput?e.split("").reverse().join(""):e,!1!==n.keepStatic&&(s="ks_"+s),void 0===r.default.prototype.masksCache[s]||!0===t?(o={mask:e,maskToken:r.default.prototype.analyseMask(e,l,n),validPositions:{},_buffer:void 0,buffer:void 0,tests:{},excludes:{},metadata:i,maskLength:void 0,jitOffset:{}},!0!==t&&(r.default.prototype.masksCache[s]=o,o=a.default.extend(!0,{},r.default.prototype.masksCache[s]))):o=a.default.extend(!0,{},r.default.prototype.masksCache[s]),o}"function"==typeof e.mask&&(e.mask=e.mask(e));if(Array.isArray(e.mask)){if(e.mask.length>1){null===e.keepStatic&&(e.keepStatic=!0);var o=e.groupmarker[0];return(e.isRTL?e.mask.reverse():e.mask).forEach((function(t){o.length>1&&(o+=e.groupmarker[1]+e.alternatormarker+e.groupmarker[0]),void 0!==t.mask&&"function"!=typeof t.mask?o+=t.mask:o+=t})),n(o+=e.groupmarker[1],e.mask,e)}e.mask=e.mask.pop()}null===e.keepStatic&&(e.keepStatic=!1);i=e.mask&&void 0!==e.mask.mask&&"function"!=typeof e.mask.mask?n(e.mask.mask,e.mask,e):n(e.mask,e.mask,e);return i},t.analyseMask=function(e,t,i){var a,o,s,l,u,c,f=/(?:[?*+]|\{[0-9+*]+(?:,[0-9+*]*)?(?:\|[0-9+*]*)?\})|[^.?*+^${[]()|\\]+|./g,d=/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,p=!1,h=new n.default,v=[],m=[],g=!1;function k(e,a,n){n=void 0!==n?n:e.matches.length;var o=e.matches[n-1];if(t)0===a.indexOf("[")||p&&/\\d|\\s|\\w]/i.test(a)||"."===a?e.matches.splice(n++,0,{fn:new RegExp(a,i.casing?"i":""),static:!1,optionality:!1,newBlockMarker:void 0===o?"master":o.def!==a,casing:null,def:a,placeholder:void 0,nativeDef:a}):(p&&(a=a[a.length-1]),a.split("").forEach((function(t,a){o=e.matches[n-1],e.matches.splice(n++,0,{fn:/[a-z]/i.test(i.staticDefinitionSymbol||t)?new RegExp("["+(i.staticDefinitionSymbol||t)+"]",i.casing?"i":""):null,static:!0,optionality:!1,newBlockMarker:void 0===o?"master":o.def!==t&&!0!==o.static,casing:null,def:i.staticDefinitionSymbol||t,placeholder:void 0!==i.staticDefinitionSymbol?t:void 0,nativeDef:(p?"'":"")+t})}))),p=!1;else{var s=i.definitions&&i.definitions[a]||i.usePrototypeDefinitions&&r.default.prototype.definitions[a];s&&!p?e.matches.splice(n++,0,{fn:s.validator?"string"==typeof s.validator?new RegExp(s.validator,i.casing?"i":""):new function(){this.test=s.validator}:new RegExp("."),static:s.static||!1,optionality:s.optional||!1,newBlockMarker:void 0===o||s.optional?"master":o.def!==(s.definitionSymbol||a),casing:s.casing,def:s.definitionSymbol||a,placeholder:s.placeholder,nativeDef:a,generated:s.generated}):(e.matches.splice(n++,0,{fn:/[a-z]/i.test(i.staticDefinitionSymbol||a)?new RegExp("["+(i.staticDefinitionSymbol||a)+"]",i.casing?"i":""):null,static:!0,optionality:!1,newBlockMarker:void 0===o?"master":o.def!==a&&!0!==o.static,casing:null,def:i.staticDefinitionSymbol||a,placeholder:void 0!==i.staticDefinitionSymbol?a:void 0,nativeDef:(p?"'":"")+a}),p=!1)}}function y(){if(v.length>0){if(k(l=v[v.length-1],o),l.isAlternator){u=v.pop();for(var e=0;e<u.matches.length;e++)u.matches[e].isGroup&&(u.matches[e].isGroup=!1);v.length>0?(l=v[v.length-1]).matches.push(u):h.matches.push(u)}}else k(h,o)}function b(e){var t=new n.default(!0);return t.openGroup=!1,t.matches=e,t}function x(){if((s=v.pop()).openGroup=!1,void 0!==s)if(v.length>0){if((l=v[v.length-1]).matches.push(s),l.isAlternator){u=v.pop();for(var e=0;e<u.matches.length;e++)u.matches[e].isGroup=!1,u.matches[e].alternatorGroup=!1;v.length>0?(l=v[v.length-1]).matches.push(u):h.matches.push(u)}}else h.matches.push(s);else y()}function P(e){var t=e.pop();return t.isQuantifier&&(t=b([e.pop(),t])),t}t&&(i.optionalmarker[0]=void 0,i.optionalmarker[1]=void 0);for(;a=t?d.exec(e):f.exec(e);){if(o=a[0],t){switch(o.charAt(0)){case"?":o="{0,1}";break;case"+":case"*":o="{"+o+"}";break;case"|":if(0===v.length){var E=b(h.matches);E.openGroup=!0,v.push(E),h.matches=[],g=!0}}switch(o){case"\\d":o="[0-9]"}}if(p)y();else switch(o.charAt(0)){case"$":case"^":t||y();break;case i.escapeChar:p=!0,t&&y();break;case i.optionalmarker[1]:case i.groupmarker[1]:x();break;case i.optionalmarker[0]:v.push(new n.default(!1,!0));break;case i.groupmarker[0]:v.push(new n.default(!0));break;case i.quantifiermarker[0]:var S=new n.default(!1,!1,!0),w=(o=o.replace(/[{}?]/g,"")).split("|"),_=w[0].split(","),M=isNaN(_[0])?_[0]:parseInt(_[0]),O=1===_.length?M:isNaN(_[1])?_[1]:parseInt(_[1]),T=isNaN(w[1])?w[1]:parseInt(w[1]);"*"!==M&&"+"!==M||(M="*"===O?0:1),S.quantifier={min:M,max:O,jit:T};var A=v.length>0?v[v.length-1].matches:h.matches;if((a=A.pop()).isAlternator){A.push(a),A=a.matches;var D=new n.default(!0),C=A.pop();A.push(D),A=D.matches,a=C}a.isGroup||(a=b([a])),A.push(a),A.push(S);break;case i.alternatormarker:if(v.length>0){var j=(l=v[v.length-1]).matches[l.matches.length-1];c=l.openGroup&&(void 0===j.matches||!1===j.isGroup&&!1===j.isAlternator)?v.pop():P(l.matches)}else c=P(h.matches);if(c.isAlternator)v.push(c);else if(c.alternatorGroup?(u=v.pop(),c.alternatorGroup=!1):u=new n.default(!1,!1,!1,!0),u.matches.push(c),v.push(u),c.openGroup){c.openGroup=!1;var B=new n.default(!0);B.alternatorGroup=!0,v.push(B)}break;default:y()}}g&&x();for(;v.length>0;)s=v.pop(),h.matches.push(s);h.matches.length>0&&(!function e(a){a&&a.matches&&a.matches.forEach((function(n,r){var o=a.matches[r+1];(void 0===o||void 0===o.matches||!1===o.isQuantifier)&&n&&n.isGroup&&(n.isGroup=!1,t||(k(n,i.groupmarker[0],0),!0!==n.openGroup&&k(n,i.groupmarker[1]))),e(n)}))}(h),m.push(h));(i.numericInput||i.isRTL)&&function e(t){for(var a in t.matches=t.matches.reverse(),t.matches)if(Object.prototype.hasOwnProperty.call(t.matches,a)){var n=parseInt(a);if(t.matches[a].isQuantifier&&t.matches[n+1]&&t.matches[n+1].isGroup){var r=t.matches[a];t.matches.splice(a,1),t.matches.splice(n+1,0,r)}void 0!==t.matches[a].matches?t.matches[a]=e(t.matches[a]):t.matches[a]=((o=t.matches[a])===i.optionalmarker[0]?o=i.optionalmarker[1]:o===i.optionalmarker[1]?o=i.optionalmarker[0]:o===i.groupmarker[0]?o=i.groupmarker[1]:o===i.groupmarker[1]&&(o=i.groupmarker[0]),o)}var o;return t}(m[0]);return m};var a=o(i(3287)),n=o(i(9695)),r=o(i(2394));function o(e){return e&&e.__esModule?e:{default:e}}},157:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.mask=function(){var e=this,t=this.opts,i=this.el,a=this.dependencyLib;s.EventRuler.off(i);var f=function(t,i){"textarea"!==t.tagName.toLowerCase()&&i.ignorables.push(n.default.ENTER);var l=t.getAttribute("type"),u="input"===t.tagName.toLowerCase()&&i.supportsInputType.includes(l)||t.isContentEditable||"textarea"===t.tagName.toLowerCase();if(!u)if("input"===t.tagName.toLowerCase()){var c=document.createElement("input");c.setAttribute("type",l),u="text"===c.type,c=null}else u="partial";return!1!==u?function(t){var n,l;function u(){return this.inputmask?this.inputmask.opts.autoUnmask?this.inputmask.unmaskedvalue():-1!==r.getLastValidPosition.call(e)||!0!==i.nullable?(this.inputmask.shadowRoot||this.ownerDocument).activeElement===this&&i.clearMaskOnLostFocus?(e.isRTL?o.clearOptionalTail.call(e,r.getBuffer.call(e).slice()).reverse():o.clearOptionalTail.call(e,r.getBuffer.call(e).slice())).join(""):n.call(this):"":n.call(this)}function c(e){l.call(this,e),this.inputmask&&(0,o.applyInputValue)(this,e)}if(!t.inputmask.__valueGet){if(!0!==i.noValuePatching){if(Object.getOwnPropertyDescriptor){var f=Object.getPrototypeOf?Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),"value"):void 0;f&&f.get&&f.set?(n=f.get,l=f.set,Object.defineProperty(t,"value",{get:u,set:c,configurable:!0})):"input"!==t.tagName.toLowerCase()&&(n=function(){return this.textContent},l=function(e){this.textContent=e},Object.defineProperty(t,"value",{get:u,set:c,configurable:!0}))}else document.__lookupGetter__&&t.__lookupGetter__("value")&&(n=t.__lookupGetter__("value"),l=t.__lookupSetter__("value"),t.__defineGetter__("value",u),t.__defineSetter__("value",c));t.inputmask.__valueGet=n,t.inputmask.__valueSet=l}t.inputmask._valueGet=function(t){return e.isRTL&&!0!==t?n.call(this.el).split("").reverse().join(""):n.call(this.el)},t.inputmask._valueSet=function(t,i){l.call(this.el,null==t?"":!0!==i&&e.isRTL?t.split("").reverse().join(""):t)},void 0===n&&(n=function(){return this.value},l=function(e){this.value=e},function(t){if(a.valHooks&&(void 0===a.valHooks[t]||!0!==a.valHooks[t].inputmaskpatch)){var n=a.valHooks[t]&&a.valHooks[t].get?a.valHooks[t].get:function(e){return e.value},s=a.valHooks[t]&&a.valHooks[t].set?a.valHooks[t].set:function(e,t){return e.value=t,e};a.valHooks[t]={get:function(t){if(t.inputmask){if(t.inputmask.opts.autoUnmask)return t.inputmask.unmaskedvalue();var a=n(t);return-1!==r.getLastValidPosition.call(e,void 0,void 0,t.inputmask.maskset.validPositions)||!0!==i.nullable?a:""}return n(t)},set:function(e,t){var i=s(e,t);return e.inputmask&&(0,o.applyInputValue)(e,t),i},inputmaskpatch:!0}}}(t.type),function(t){s.EventRuler.on(t,"mouseenter",(function(){var t=this.inputmask._valueGet(!0);t!==(e.isRTL?r.getBuffer.call(e).reverse():r.getBuffer.call(e)).join("")&&(0,o.applyInputValue)(this,t)}))}(t))}}(t):t.inputmask=void 0,u}(i,t);if(!1!==f){e.originalPlaceholder=i.placeholder,e.maxLength=void 0!==i?i.maxLength:void 0,-1===e.maxLength&&(e.maxLength=void 0),"inputMode"in i&&null===i.getAttribute("inputmode")&&(i.inputMode=t.inputmode,i.setAttribute("inputmode",t.inputmode)),!0===f&&(t.showMaskOnFocus=t.showMaskOnFocus&&-1===["cc-number","cc-exp"].indexOf(i.autocomplete),l.iphone&&(t.insertModeVisual=!1),s.EventRuler.on(i,"submit",c.EventHandlers.submitEvent),s.EventRuler.on(i,"reset",c.EventHandlers.resetEvent),s.EventRuler.on(i,"blur",c.EventHandlers.blurEvent),s.EventRuler.on(i,"focus",c.EventHandlers.focusEvent),s.EventRuler.on(i,"invalid",c.EventHandlers.invalidEvent),s.EventRuler.on(i,"click",c.EventHandlers.clickEvent),s.EventRuler.on(i,"mouseleave",c.EventHandlers.mouseleaveEvent),s.EventRuler.on(i,"mouseenter",c.EventHandlers.mouseenterEvent),s.EventRuler.on(i,"paste",c.EventHandlers.pasteEvent),s.EventRuler.on(i,"cut",c.EventHandlers.cutEvent),s.EventRuler.on(i,"complete",t.oncomplete),s.EventRuler.on(i,"incomplete",t.onincomplete),s.EventRuler.on(i,"cleared",t.oncleared),!0!==t.inputEventOnly&&(s.EventRuler.on(i,"keydown",c.EventHandlers.keydownEvent),s.EventRuler.on(i,"keypress",c.EventHandlers.keypressEvent),s.EventRuler.on(i,"keyup",c.EventHandlers.keyupEvent)),(l.mobile||t.inputEventOnly)&&i.removeAttribute("maxLength"),s.EventRuler.on(i,"input",c.EventHandlers.inputFallBackEvent),s.EventRuler.on(i,"compositionend",c.EventHandlers.compositionendEvent)),s.EventRuler.on(i,"setvalue",c.EventHandlers.setValueEvent),r.getBufferTemplate.call(e).join(""),e.undoValue=e._valueGet(!0);var d=(i.inputmask.shadowRoot||i.ownerDocument).activeElement;if(""!==i.inputmask._valueGet(!0)||!1===t.clearMaskOnLostFocus||d===i){(0,o.applyInputValue)(i,i.inputmask._valueGet(!0),t);var p=r.getBuffer.call(e).slice();!1===u.isComplete.call(e,p)&&t.clearIncomplete&&r.resetMaskSet.call(e),t.clearMaskOnLostFocus&&d!==i&&(-1===r.getLastValidPosition.call(e)?p=[]:o.clearOptionalTail.call(e,p)),(!1===t.clearMaskOnLostFocus||t.showMaskOnFocus&&d===i||""!==i.inputmask._valueGet(!0))&&(0,o.writeBuffer)(i,p),d===i&&r.caret.call(e,i,r.seekNext.call(e,r.getLastValidPosition.call(e)))}}};var a,n=(a=i(5581))&&a.__esModule?a:{default:a},r=i(8711),o=i(7760),s=i(9716),l=i(9845),u=i(7215),c=i(6030)},9695:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,i,a){this.matches=[],this.openGroup=e||!1,this.alternatorGroup=!1,this.isGroup=e||!1,this.isOptional=t||!1,this.isQuantifier=i||!1,this.isAlternator=a||!1,this.quantifier={min:1,max:1}}},3194:function(){Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(e,t){if(null==this)throw new TypeError('"this" is null or not defined');var i=Object(this),a=i.length>>>0;if(0===a)return!1;for(var n=0|t,r=Math.max(n>=0?n:a-Math.abs(n),0);r<a;){if(i[r]===e)return!0;r++}return!1}})},7149:function(){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}"function"!=typeof Object.getPrototypeOf&&(Object.getPrototypeOf="object"===e("test".__proto__)?function(e){return e.__proto__}:function(e){return e.constructor.prototype})},8711:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.caret=function(e,t,i,a,n){var r,o=this,s=this.opts;if(void 0===t)return"selectionStart"in e&&"selectionEnd"in e?(t=e.selectionStart,i=e.selectionEnd):window.getSelection?(r=window.getSelection().getRangeAt(0)).commonAncestorContainer.parentNode!==e&&r.commonAncestorContainer!==e||(t=r.startOffset,i=r.endOffset):document.selection&&document.selection.createRange&&(r=document.selection.createRange(),t=0-r.duplicate().moveStart("character",-e.inputmask._valueGet().length),i=t+r.text.length),{begin:a?t:u.call(o,t),end:a?i:u.call(o,i)};if(Array.isArray(t)&&(i=o.isRTL?t[0]:t[1],t=o.isRTL?t[1]:t[0]),void 0!==t.begin&&(i=o.isRTL?t.begin:t.end,t=o.isRTL?t.end:t.begin),"number"==typeof t){t=a?t:u.call(o,t),i="number"==typeof(i=a?i:u.call(o,i))?i:t;var l=parseInt(((e.ownerDocument.defaultView||window).getComputedStyle?(e.ownerDocument.defaultView||window).getComputedStyle(e,null):e.currentStyle).fontSize)*i;if(e.scrollLeft=l>e.scrollWidth?l:0,e.inputmask.caretPos={begin:t,end:i},s.insertModeVisual&&!1===s.insertMode&&t===i&&(n||i++),e===(e.inputmask.shadowRoot||e.ownerDocument).activeElement)if("setSelectionRange"in e)e.setSelectionRange(t,i);else if(window.getSelection){if(r=document.createRange(),void 0===e.firstChild||null===e.firstChild){var c=document.createTextNode("");e.appendChild(c)}r.setStart(e.firstChild,t<e.inputmask._valueGet().length?t:e.inputmask._valueGet().length),r.setEnd(e.firstChild,i<e.inputmask._valueGet().length?i:e.inputmask._valueGet().length),r.collapse(!0);var f=window.getSelection();f.removeAllRanges(),f.addRange(r)}else e.createTextRange&&((r=e.createTextRange()).collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r.select())}},t.determineLastRequiredPosition=function(e){var t,i,r=this,s=this.maskset,l=this.dependencyLib,u=a.getMaskTemplate.call(r,!0,o.call(r),!0,!0),c=u.length,f=o.call(r),d={},p=s.validPositions[f],h=void 0!==p?p.locator.slice():void 0;for(t=f+1;t<u.length;t++)i=a.getTestTemplate.call(r,t,h,t-1),h=i.locator.slice(),d[t]=l.extend(!0,{},i);var v=p&&void 0!==p.alternation?p.locator[p.alternation]:void 0;for(t=c-1;t>f&&(((i=d[t]).match.optionality||i.match.optionalQuantifier&&i.match.newBlockMarker||v&&(v!==d[t].locator[p.alternation]&&1!=i.match.static||!0===i.match.static&&i.locator[p.alternation]&&n.checkAlternationMatch.call(r,i.locator[p.alternation].toString().split(","),v.toString().split(","))&&""!==a.getTests.call(r,t)[0].def))&&u[t]===a.getPlaceholder.call(r,t,i.match));t--)c--;return e?{l:c,def:d[c]?d[c].match:void 0}:c},t.determineNewCaretPosition=function(e,t,i){var n=this,u=this.maskset,c=this.opts;t&&(n.isRTL?e.end=e.begin:e.begin=e.end);if(e.begin===e.end){switch(i=i||c.positionCaretOnClick){case"none":break;case"select":e={begin:0,end:r.call(n).length};break;case"ignore":e.end=e.begin=l.call(n,o.call(n));break;case"radixFocus":if(function(e){if(""!==c.radixPoint&&0!==c.digits){var t=u.validPositions;if(void 0===t[e]||t[e].input===a.getPlaceholder.call(n,e)){if(e<l.call(n,-1))return!0;var i=r.call(n).indexOf(c.radixPoint);if(-1!==i){for(var o in t)if(t[o]&&i<o&&t[o].input!==a.getPlaceholder.call(n,o))return!1;return!0}}}return!1}(e.begin)){var f=r.call(n).join("").indexOf(c.radixPoint);e.end=e.begin=c.numericInput?l.call(n,f):f;break}default:var d=e.begin,p=o.call(n,d,!0),h=l.call(n,-1!==p||s.call(n,0)?p:-1);if(d<=h)e.end=e.begin=s.call(n,d,!1,!0)?d:l.call(n,d);else{var v=u.validPositions[p],m=a.getTestTemplate.call(n,h,v?v.match.locator:void 0,v),g=a.getPlaceholder.call(n,h,m.match);if(""!==g&&r.call(n)[h]!==g&&!0!==m.match.optionalQuantifier&&!0!==m.match.newBlockMarker||!s.call(n,h,c.keepStatic,!0)&&m.match.def===g){var k=l.call(n,h);(d>=k||d===h)&&(h=k)}e.end=e.begin=h}}return e}},t.getBuffer=r,t.getBufferTemplate=function(){var e=this.maskset;void 0===e._buffer&&(e._buffer=a.getMaskTemplate.call(this,!1,1),void 0===e.buffer&&(e.buffer=e._buffer.slice()));return e._buffer},t.getLastValidPosition=o,t.isMask=s,t.resetMaskSet=function(e){var t=this.maskset;t.buffer=void 0,!0!==e&&(t.validPositions={},t.p=0)},t.seekNext=l,t.seekPrevious=function(e,t){var i=this,n=e-1;if(e<=0)return 0;for(;n>0&&(!0===t&&(!0!==a.getTest.call(i,n).match.newBlockMarker||!s.call(i,n,void 0,!0))||!0!==t&&!s.call(i,n,void 0,!0));)n--;return n},t.translatePosition=u;var a=i(4713),n=i(7215);function r(e){var t=this.maskset;return void 0!==t.buffer&&!0!==e||(t.buffer=a.getMaskTemplate.call(this,!0,o.call(this),!0),void 0===t._buffer&&(t._buffer=t.buffer.slice())),t.buffer}function o(e,t,i){var a=this.maskset,n=-1,r=-1,o=i||a.validPositions;for(var s in void 0===e&&(e=-1),o){var l=parseInt(s);o[l]&&(t||!0!==o[l].generatedInput)&&(l<=e&&(n=l),l>=e&&(r=l))}return-1===n||n==e?r:-1==r||e-n<r-e?n:r}function s(e,t,i){var n=this,r=this.maskset,o=a.getTestTemplate.call(n,e).match;if(""===o.def&&(o=a.getTest.call(n,e).match),!0!==o.static)return o.fn;if(!0===i&&void 0!==r.validPositions[e]&&!0!==r.validPositions[e].generatedInput)return!0;if(!0!==t&&e>-1){if(i){var s=a.getTests.call(n,e);return s.length>1+(""===s[s.length-1].match.def?1:0)}var l=a.determineTestTemplate.call(n,e,a.getTests.call(n,e)),u=a.getPlaceholder.call(n,e,l.match);return l.match.def!==u}return!1}function l(e,t,i){var n=this;void 0===i&&(i=!0);for(var r=e+1;""!==a.getTest.call(n,r).match.def&&(!0===t&&(!0!==a.getTest.call(n,r).match.newBlockMarker||!s.call(n,r,void 0,!0))||!0!==t&&!s.call(n,r,void 0,i));)r++;return r}function u(e){var t=this.opts,i=this.el;return!this.isRTL||"number"!=typeof e||t.greedy&&""===t.placeholder||!i||(e=Math.abs(this._valueGet().length-e)),e}},4713:function(e,t){function i(e,t){var i=(null!=e.alternation?e.mloc[a(e)]:e.locator).join("");if(""!==i)for(;i.length<t;)i+="0";return i}function a(e){var t=e.locator[e.alternation];return"string"==typeof t&&t.length>0&&(t=t.split(",")[0]),void 0!==t?t.toString():""}function n(e,t,i){var a=this.opts,n=this.maskset;if(void 0!==(t=t||s.call(this,e).match).placeholder||!0===i)return"function"==typeof t.placeholder?t.placeholder(a):t.placeholder;if(!0===t.static){if(e>-1&&void 0===n.validPositions[e]){var r,o=u.call(this,e),l=[];if(o.length>1+(""===o[o.length-1].match.def?1:0))for(var c=0;c<o.length;c++)if(""!==o[c].match.def&&!0!==o[c].match.optionality&&!0!==o[c].match.optionalQuantifier&&(!0===o[c].match.static||void 0===r||!1!==o[c].match.fn.test(r.match.def,n,e,!0,a))&&(l.push(o[c]),!0===o[c].match.static&&(r=o[c]),l.length>1&&/[0-9a-bA-Z]/.test(l[0].match.def)))return a.placeholder.charAt(e%a.placeholder.length)}return t.def}return a.placeholder.charAt(e%a.placeholder.length)}function r(e,t,i){return this.maskset.validPositions[e]||o.call(this,e,u.call(this,e,t?t.slice():t,i))}function o(e,t){var a=this.opts;e=e>0?e-1:0;for(var n,r,o,l=i(s.call(this,e)),u=0;u<t.length;u++){var c=t[u];n=i(c,l.length);var f=Math.abs(n-l);(void 0===r||""!==n&&f<r||o&&!a.greedy&&o.match.optionality&&"master"===o.match.newBlockMarker&&(!c.match.optionality||!c.match.newBlockMarker)||o&&o.match.optionalQuantifier&&!c.match.optionalQuantifier)&&(r=f,o=c)}return o}function s(e,t){var i=this.maskset;return i.validPositions[e]?i.validPositions[e]:(t||u.call(this,e))[0]}function l(e,t,i){function a(e){for(var t,i=[],a=-1,n=0,r=e.length;n<r;n++)if("-"===e.charAt(n))for(t=e.charCodeAt(n+1);++a<t;)i.push(String.fromCharCode(a));else a=e.charCodeAt(n),i.push(e.charAt(n));return i.join("")}return e.match.def===t.match.nativeDef||!(!(i.regex||e.match.fn instanceof RegExp&&t.match.fn instanceof RegExp)||!0===e.match.static||!0===t.match.static)&&-1!==a(t.match.fn.toString().replace(/[[\]/]/g,"")).indexOf(a(e.match.fn.toString().replace(/[[\]/]/g,"")))}function u(e,t,i){var a,n=this,r=this.dependencyLib,s=this.maskset,u=this.opts,c=this.el,f=s.maskToken,d=t?i:0,p=t?t.slice():[0],h=[],v=!1,m=t?t.join(""):"";function g(t,i,n,r){function o(n,r,f){function p(e,t){var i=0===t.matches.indexOf(e);return i||t.matches.every((function(a,n){return!0===a.isQuantifier?i=p(e,t.matches[n-1]):Object.prototype.hasOwnProperty.call(a,"matches")&&(i=p(e,a)),!i})),i}function k(e,t,i){var a,n;if((s.tests[e]||s.validPositions[e])&&(s.tests[e]||[s.validPositions[e]]).every((function(e,r){if(e.mloc[t])return a=e,!1;var o=void 0!==i?i:e.alternation,s=void 0!==e.locator[o]?e.locator[o].toString().indexOf(t):-1;return(void 0===n||s<n)&&-1!==s&&(a=e,n=s),!0})),a){var r=a.locator[a.alternation];return(a.mloc[t]||a.mloc[r]||a.locator).slice((void 0!==i?i:a.alternation)+1)}return void 0!==i?k(e,t):void 0}function y(e,t){var i=e.alternation,a=void 0===t||i===t.alternation&&-1===e.locator[i].toString().indexOf(t.locator[i]);if(!a&&i>t.alternation)for(var n=t.alternation;n<i;n++)if(e.locator[n]!==t.locator[n]){i=n,a=!0;break}if(a){e.mloc=e.mloc||{};var r=e.locator[i];if(void 0!==r){if("string"==typeof r&&(r=r.split(",")[0]),void 0===e.mloc[r]&&(e.mloc[r]=e.locator.slice()),void 0!==t){for(var o in t.mloc)"string"==typeof o&&(o=o.split(",")[0]),void 0===e.mloc[o]&&(e.mloc[o]=t.mloc[o]);e.locator[i]=Object.keys(e.mloc).join(",")}return!0}e.alternation=void 0}return!1}function b(e,t){if(e.locator.length!==t.locator.length)return!1;for(var i=e.alternation+1;i<e.locator.length;i++)if(e.locator[i]!==t.locator[i])return!1;return!0}if(d>e+u._maxTestPos)throw"Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. "+s.mask;if(d===e&&void 0===n.matches){if(h.push({match:n,locator:r.reverse(),cd:m,mloc:{}}),!0!==n.optionality||void 0!==f||!(u.definitions&&u.definitions[n.nativeDef]&&u.definitions[n.nativeDef].optional||Inputmask.prototype.definitions[n.nativeDef]&&Inputmask.prototype.definitions[n.nativeDef].optional))return!0;v=!0,d=e}else if(void 0!==n.matches){if(n.isGroup&&f!==n){if(n=o(t.matches[t.matches.indexOf(n)+1],r,f))return!0}else if(n.isOptional){var x=n,P=h.length;if(n=g(n,i,r,f)){if(h.forEach((function(e,t){t>=P&&(e.match.optionality=!0)})),a=h[h.length-1].match,void 0!==f||!p(a,x))return!0;v=!0,d=e}}else if(n.isAlternator){var E,S=n,w=[],_=h.slice(),M=r.length,O=!1,T=i.length>0?i.shift():-1;if(-1===T||"string"==typeof T){var A,D=d,C=i.slice(),j=[];if("string"==typeof T)j=T.split(",");else for(A=0;A<S.matches.length;A++)j.push(A.toString());if(void 0!==s.excludes[e]){for(var B=j.slice(),R=0,L=s.excludes[e].length;R<L;R++){var I=s.excludes[e][R].toString().split(":");r.length==I[1]&&j.splice(j.indexOf(I[0]),1)}0===j.length&&(delete s.excludes[e],j=B)}(!0===u.keepStatic||isFinite(parseInt(u.keepStatic))&&D>=u.keepStatic)&&(j=j.slice(0,1));for(var F=0;F<j.length;F++){A=parseInt(j[F]),h=[],i="string"==typeof T&&k(d,A,M)||C.slice();var N=S.matches[A];if(N&&o(N,[A].concat(r),f))n=!0;else if(0===F&&(O=!0),N&&N.matches&&N.matches.length>S.matches[0].matches.length)break;E=h.slice(),d=D,h=[];for(var V=0;V<E.length;V++){var G=E[V],H=!1;G.match.jit=G.match.jit||O,G.alternation=G.alternation||M,y(G);for(var K=0;K<w.length;K++){var U=w[K];if("string"!=typeof T||void 0!==G.alternation&&j.includes(G.locator[G.alternation].toString())){if(G.match.nativeDef===U.match.nativeDef){H=!0,y(U,G);break}if(l(G,U,u)){y(G,U)&&(H=!0,w.splice(w.indexOf(U),0,G));break}if(l(U,G,u)){y(U,G);break}if(W=U,!0===(Q=G).match.static&&!0!==W.match.static&&W.match.fn.test(Q.match.def,s,e,!1,u,!1)){b(G,U)||void 0!==c.inputmask.userOptions.keepStatic?y(G,U)&&(H=!0,w.splice(w.indexOf(U),0,G)):u.keepStatic=!0;break}}}H||w.push(G)}}h=_.concat(w),d=e,v=h.length>0,n=w.length>0,i=C.slice()}else n=o(S.matches[T]||t.matches[T],[T].concat(r),f);if(n)return!0}else if(n.isQuantifier&&f!==t.matches[t.matches.indexOf(n)-1])for(var $=n,q=i.length>0?i.shift():0;q<(isNaN($.quantifier.max)?q+1:$.quantifier.max)&&d<=e;q++){var z=t.matches[t.matches.indexOf($)-1];if(n=o(z,[q].concat(r),z)){if((a=h[h.length-1].match).optionalQuantifier=q>=$.quantifier.min,a.jit=(q+1)*(z.matches.indexOf(a)+1)>$.quantifier.jit,a.optionalQuantifier&&p(a,z)){v=!0,d=e;break}return a.jit&&(s.jitOffset[e]=z.matches.length-z.matches.indexOf(a)),!0}}else if(n=g(n,i,r,f))return!0}else d++;var Q,W}for(var f=i.length>0?i.shift():0;f<t.matches.length;f++)if(!0!==t.matches[f].isQuantifier){var p=o(t.matches[f],[f].concat(n),r);if(p&&d===e)return p;if(d>e)break}}if(e>-1){if(void 0===t){for(var k,y=e-1;void 0===(k=s.validPositions[y]||s.tests[y])&&y>-1;)y--;void 0!==k&&y>-1&&(p=function(e,t){var i,a=[];return Array.isArray(t)||(t=[t]),t.length>0&&(void 0===t[0].alternation||!0===u.keepStatic?0===(a=o.call(n,e,t.slice()).locator.slice()).length&&(a=t[0].locator.slice()):t.forEach((function(e){""!==e.def&&(0===a.length?(i=e.alternation,a=e.locator.slice()):e.locator[i]&&-1===a[i].toString().indexOf(e.locator[i])&&(a[i]+=","+e.locator[i]))}))),a}(y,k),m=p.join(""),d=y)}if(s.tests[e]&&s.tests[e][0].cd===m)return s.tests[e];for(var b=p.shift();b<f.length;b++){if(g(f[b],p,[b])&&d===e||d>e)break}}return(0===h.length||v)&&h.push({match:{fn:null,static:!0,optionality:!1,casing:null,def:"",placeholder:""},locator:[],mloc:{},cd:m}),void 0!==t&&s.tests[e]?r.extend(!0,[],h):(s.tests[e]=r.extend(!0,[],h),s.tests[e])}Object.defineProperty(t,"__esModule",{value:!0}),t.determineTestTemplate=o,t.getDecisionTaker=a,t.getMaskTemplate=function(e,t,i,a,s){var l=this,c=this.opts,f=this.maskset,d=c.greedy;s&&(c.greedy=!1);t=t||0;var p,h,v,m,g=[],k=0;do{if(!0===e&&f.validPositions[k])v=s&&!0===f.validPositions[k].match.optionality&&void 0===f.validPositions[k+1]&&(!0===f.validPositions[k].generatedInput||f.validPositions[k].input==c.skipOptionalPartCharacter&&k>0)?o.call(l,k,u.call(l,k,p,k-1)):f.validPositions[k],h=v.match,p=v.locator.slice(),g.push(!0===i?v.input:!1===i?h.nativeDef:n.call(l,k,h));else{v=r.call(l,k,p,k-1),h=v.match,p=v.locator.slice();var y=!0!==a&&(!1!==c.jitMasking?c.jitMasking:h.jit);(m=(m&&h.static&&h.def!==c.groupSeparator&&null===h.fn||f.validPositions[k-1]&&h.static&&h.def!==c.groupSeparator&&null===h.fn)&&f.tests[k]&&1===f.tests[k].length)||!1===y||void 0===y||"number"==typeof y&&isFinite(y)&&y>k?g.push(!1===i?h.nativeDef:n.call(l,k,h)):m=!1}k++}while(!0!==h.static||""!==h.def||t>k);""===g[g.length-1]&&g.pop();!1===i&&void 0!==f.maskLength||(f.maskLength=k-1);return c.greedy=d,g},t.getPlaceholder=n,t.getTest=s,t.getTests=u,t.getTestTemplate=r,t.isSubsetOf=l},7215:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.alternate=l,t.checkAlternationMatch=function(e,t,i){for(var a,n=this.opts.greedy?t:t.slice(0,1),r=!1,o=void 0!==i?i.split(","):[],s=0;s<o.length;s++)-1!==(a=e.indexOf(o[s]))&&e.splice(a,1);for(var l=0;l<e.length;l++)if(n.includes(e[l])){r=!0;break}return r},t.isComplete=c,t.isValid=f,t.refreshFromBuffer=p,t.revalidateMask=v,t.handleRemove=function(e,t,i,a,s){var u=this,c=this.maskset,f=this.opts;if((f.numericInput||u.isRTL)&&(t===r.default.BACKSPACE?t=r.default.DELETE:t===r.default.DELETE&&(t=r.default.BACKSPACE),u.isRTL)){var d=i.end;i.end=i.begin,i.begin=d}var p,h=o.getLastValidPosition.call(u,void 0,!0);i.end>=o.getBuffer.call(u).length&&h>=i.end&&(i.end=h+1);t===r.default.BACKSPACE?i.end-i.begin<1&&(i.begin=o.seekPrevious.call(u,i.begin)):t===r.default.DELETE&&i.begin===i.end&&(i.end=o.isMask.call(u,i.end,!0,!0)?i.end+1:o.seekNext.call(u,i.end)+1);if(!1!==(p=v.call(u,i))){if(!0!==a&&!1!==f.keepStatic||null!==f.regex&&-1!==n.getTest.call(u,i.begin).match.def.indexOf("|")){var m=l.call(u,!0);if(m){var g=void 0!==m.caret?m.caret:m.pos?o.seekNext.call(u,m.pos.begin?m.pos.begin:m.pos):o.getLastValidPosition.call(u,-1,!0);(t!==r.default.DELETE||i.begin>g)&&i.begin}}!0!==a&&(c.p=t===r.default.DELETE?i.begin+p:i.begin,c.p=o.determineNewCaretPosition.call(u,{begin:c.p,end:c.p},!1).begin)}};var a,n=i(4713),r=(a=i(5581))&&a.__esModule?a:{default:a},o=i(8711),s=i(6030);function l(e,t,i,a,r,s){var u,c,d,p,h,v,m,g,k,y,b,x=this,P=this.dependencyLib,E=this.opts,S=x.maskset,w=P.extend(!0,{},S.validPositions),_=P.extend(!0,{},S.tests),M=!1,O=!1,T=void 0!==r?r:o.getLastValidPosition.call(x);if(s&&(y=s.begin,b=s.end,s.begin>s.end&&(y=s.end,b=s.begin)),-1===T&&void 0===r)u=0,c=(p=n.getTest.call(x,u)).alternation;else for(;T>=0;T--)if((d=S.validPositions[T])&&void 0!==d.alternation){if(p&&p.locator[d.alternation]!==d.locator[d.alternation])break;u=T,c=S.validPositions[u].alternation,p=d}if(void 0!==c){m=parseInt(u),S.excludes[m]=S.excludes[m]||[],!0!==e&&S.excludes[m].push((0,n.getDecisionTaker)(p)+":"+p.alternation);var A=[],D=-1;for(h=m;h<o.getLastValidPosition.call(x,void 0,!0)+1;h++)-1===D&&e<=h&&void 0!==t&&(A.push(t),D=A.length-1),(v=S.validPositions[h])&&!0!==v.generatedInput&&(void 0===s||h<y||h>=b)&&A.push(v.input),delete S.validPositions[h];for(-1===D&&void 0!==t&&(A.push(t),D=A.length-1);void 0!==S.excludes[m]&&S.excludes[m].length<10;){for(S.tests={},o.resetMaskSet.call(x,!0),M=!0,h=0;h<A.length&&(g=M.caret||o.getLastValidPosition.call(x,void 0,!0)+1,k=A[h],M=f.call(x,g,k,!1,a,!0));h++)h===D&&(O=M),1==e&&M&&(O={caretPos:h});if(M)break;if(o.resetMaskSet.call(x),p=n.getTest.call(x,m),S.validPositions=P.extend(!0,{},w),S.tests=P.extend(!0,{},_),!S.excludes[m]){O=l.call(x,e,t,i,a,m-1,s);break}var C=(0,n.getDecisionTaker)(p);if(-1!==S.excludes[m].indexOf(C+":"+p.alternation)){O=l.call(x,e,t,i,a,m-1,s);break}for(S.excludes[m].push(C+":"+p.alternation),h=m;h<o.getLastValidPosition.call(x,void 0,!0)+1;h++)delete S.validPositions[h]}}return O&&!1===E.keepStatic||delete S.excludes[m],O}function u(e,t,i){var a=this.opts,n=this.maskset;switch(a.casing||t.casing){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase();break;case"title":var o=n.validPositions[i-1];e=0===i||o&&o.input===String.fromCharCode(r.default.SPACE)?e.toUpperCase():e.toLowerCase();break;default:if("function"==typeof a.casing){var s=Array.prototype.slice.call(arguments);s.push(n.validPositions),e=a.casing.apply(this,s)}}return e}function c(e){var t=this,i=this.opts,a=this.maskset;if("function"==typeof i.isComplete)return i.isComplete(e,i);if("*"!==i.repeat){var r=!1,s=o.determineLastRequiredPosition.call(t,!0),l=o.seekPrevious.call(t,s.l);if(void 0===s.def||s.def.newBlockMarker||s.def.optionality||s.def.optionalQuantifier){r=!0;for(var u=0;u<=l;u++){var c=n.getTestTemplate.call(t,u).match;if(!0!==c.static&&void 0===a.validPositions[u]&&!0!==c.optionality&&!0!==c.optionalQuantifier||!0===c.static&&e[u]!==n.getPlaceholder.call(t,u,c)){r=!1;break}}}return r}}function f(e,t,i,a,r,s,d){var m=this,g=this.dependencyLib,k=this.opts,y=m.maskset;function b(e){return m.isRTL?e.begin-e.end>1||e.begin-e.end==1:e.end-e.begin>1||e.end-e.begin==1}i=!0===i;var x=e;function P(e){if(void 0!==e){if(void 0!==e.remove&&(Array.isArray(e.remove)||(e.remove=[e.remove]),e.remove.sort((function(e,t){return t.pos-e.pos})).forEach((function(e){v.call(m,{begin:e,end:e+1})})),e.remove=void 0),void 0!==e.insert&&(Array.isArray(e.insert)||(e.insert=[e.insert]),e.insert.sort((function(e,t){return e.pos-t.pos})).forEach((function(e){""!==e.c&&f.call(m,e.pos,e.c,void 0===e.strict||e.strict,void 0!==e.fromIsValid?e.fromIsValid:a)})),e.insert=void 0),e.refreshFromBuffer&&e.buffer){var t=e.refreshFromBuffer;p.call(m,!0===t?t:t.start,t.end,e.buffer),e.refreshFromBuffer=void 0}void 0!==e.rewritePosition&&(x=e.rewritePosition,e=!0)}return e}function E(t,i,r){var s=!1;return n.getTests.call(m,t).every((function(l,c){var f=l.match;if(o.getBuffer.call(m,!0),!1!==(s=(!f.jit||void 0!==y.validPositions[o.seekPrevious.call(m,t)])&&(null!=f.fn?f.fn.test(i,y,t,r,k,b(e)):(i===f.def||i===k.skipOptionalPartCharacter)&&""!==f.def&&{c:n.getPlaceholder.call(m,t,f,!0)||f.def,pos:t}))){var d=void 0!==s.c?s.c:i,p=t;return d=d===k.skipOptionalPartCharacter&&!0===f.static?n.getPlaceholder.call(m,t,f,!0)||f.def:d,!0!==(s=P(s))&&void 0!==s.pos&&s.pos!==t&&(p=s.pos),!0!==s&&void 0===s.pos&&void 0===s.c?!1:(!1===v.call(m,e,g.extend({},l,{input:u.call(m,d,f,p)}),a,p)&&(s=!1),!1)}return!0})),s}void 0!==e.begin&&(x=m.isRTL?e.end:e.begin);var S=!0,w=g.extend(!0,{},y.validPositions);if(!1===k.keepStatic&&void 0!==y.excludes[x]&&!0!==r&&!0!==a)for(var _=x;_<(m.isRTL?e.begin:e.end);_++)void 0!==y.excludes[_]&&(y.excludes[_]=void 0,delete y.tests[_]);if("function"==typeof k.preValidation&&!0!==a&&!0!==s&&(S=P(S=k.preValidation.call(m,o.getBuffer.call(m),x,t,b(e),k,y,e,i||r))),!0===S){if(S=E(x,t,i),(!i||!0===a)&&!1===S&&!0!==s){var M=y.validPositions[x];if(!M||!0!==M.match.static||M.match.def!==t&&t!==k.skipOptionalPartCharacter){if(k.insertMode||void 0===y.validPositions[o.seekNext.call(m,x)]||e.end>x){var O=!1;if(y.jitOffset[x]&&void 0===y.validPositions[o.seekNext.call(m,x)]&&!1!==(S=f.call(m,x+y.jitOffset[x],t,!0,!0))&&(!0!==r&&(S.caret=x),O=!0),e.end>x&&(y.validPositions[x]=void 0),!O&&!o.isMask.call(m,x,k.keepStatic&&0===x))for(var T=x+1,A=o.seekNext.call(m,x,!1,0!==x);T<=A;T++)if(!1!==(S=E(T,t,i))){S=h.call(m,x,void 0!==S.pos?S.pos:T)||S,x=T;break}}}else S={caret:o.seekNext.call(m,x)}}!1!==S||!k.keepStatic||!c.call(m,o.getBuffer.call(m))&&0!==x||i||!0===r?b(e)&&y.tests[x]&&y.tests[x].length>1&&k.keepStatic&&!i&&!0!==r&&(S=l.call(m,!0)):S=l.call(m,x,t,i,a,void 0,e),!0===S&&(S={pos:x})}if("function"==typeof k.postValidation&&!0!==a&&!0!==s){var D=k.postValidation.call(m,o.getBuffer.call(m,!0),void 0!==e.begin?m.isRTL?e.end:e.begin:e,t,S,k,y,i,d);void 0!==D&&(S=!0===D?S:D)}S&&void 0===S.pos&&(S.pos=x),!1===S||!0===s?(o.resetMaskSet.call(m,!0),y.validPositions=g.extend(!0,{},w)):h.call(m,void 0,x,!0);var C=P(S);void 0!==m.maxLength&&(o.getBuffer.call(m).length>m.maxLength&&!a&&(o.resetMaskSet.call(m,!0),y.validPositions=g.extend(!0,{},w),C=!1));return C}function d(e,t,i){for(var a=this.maskset,r=!1,o=n.getTests.call(this,e),s=0;s<o.length;s++){if(o[s].match&&(o[s].match.nativeDef===t.match[i.shiftPositions?"def":"nativeDef"]&&(!i.shiftPositions||!t.match.static)||o[s].match.nativeDef===t.match.nativeDef||i.regex&&!o[s].match.static&&o[s].match.fn.test(t.input))){r=!0;break}if(o[s].match&&o[s].match.def===t.match.nativeDef){r=void 0;break}}return!1===r&&void 0!==a.jitOffset[e]&&(r=d.call(this,e+a.jitOffset[e],t,i)),r}function p(e,t,i){var a,n,r=this,l=this.maskset,u=this.opts,c=this.dependencyLib,f=u.skipOptionalPartCharacter,d=r.isRTL?i.slice().reverse():i;if(u.skipOptionalPartCharacter="",!0===e)o.resetMaskSet.call(r),l.tests={},e=0,t=i.length,n=o.determineNewCaretPosition.call(r,{begin:0,end:0},!1).begin;else{for(a=e;a<t;a++)delete l.validPositions[a];n=e}var p=new c.Event("keypress");for(a=e;a<t;a++){p.keyCode=d[a].toString().charCodeAt(0),r.ignorable=!1;var h=s.EventHandlers.keypressEvent.call(r,p,!0,!1,!1,n);!1!==h&&void 0!==h&&(n=h.forwardPosition)}u.skipOptionalPartCharacter=f}function h(e,t,i){var a=this,r=this.maskset,s=this.dependencyLib;if(void 0===e)for(e=t-1;e>0&&!r.validPositions[e];e--);for(var l=e;l<t;l++){if(void 0===r.validPositions[l]&&!o.isMask.call(a,l,!1))if(0==l?n.getTest.call(a,l):r.validPositions[l-1]){var u=n.getTests.call(a,l).slice();""===u[u.length-1].match.def&&u.pop();var c,d=n.determineTestTemplate.call(a,l,u);if(d&&(!0!==d.match.jit||"master"===d.match.newBlockMarker&&(c=r.validPositions[l+1])&&!0===c.match.optionalQuantifier)&&((d=s.extend({},d,{input:n.getPlaceholder.call(a,l,d.match,!0)||d.match.def})).generatedInput=!0,v.call(a,l,d,!0),!0!==i)){var p=r.validPositions[t].input;return r.validPositions[t]=void 0,f.call(a,t,p,!0,!0)}}}}function v(e,t,i,a){var r=this,s=this.maskset,l=this.opts,u=this.dependencyLib;function c(e,t,i){var a=t[e];if(void 0!==a&&!0===a.match.static&&!0!==a.match.optionality&&(void 0===t[0]||void 0===t[0].alternation)){var n=i.begin<=e-1?t[e-1]&&!0===t[e-1].match.static&&t[e-1]:t[e-1],r=i.end>e+1?t[e+1]&&!0===t[e+1].match.static&&t[e+1]:t[e+1];return n&&r}return!1}var p=0,h=void 0!==e.begin?e.begin:e,v=void 0!==e.end?e.end:e,m=!0;if(e.begin>e.end&&(h=e.end,v=e.begin),a=void 0!==a?a:h,h!==v||l.insertMode&&void 0!==s.validPositions[a]&&void 0===i||void 0===t||t.match.optionalQuantifier||t.match.optionality){var g,k=u.extend(!0,{},s.validPositions),y=o.getLastValidPosition.call(r,void 0,!0);for(s.p=h,g=y;g>=h;g--)delete s.validPositions[g],void 0===t&&delete s.tests[g+1];var b,x,P=a,E=P;for(t&&(s.validPositions[a]=u.extend(!0,{},t),E++,P++),g=t?v:v-1;g<=y;g++){if(void 0!==(b=k[g])&&!0!==b.generatedInput&&(g>=v||g>=h&&c(g,k,{begin:h,end:v}))){for(;""!==n.getTest.call(r,E).match.def;){if(!1!==(x=d.call(r,E,b,l))||"+"===b.match.def){"+"===b.match.def&&o.getBuffer.call(r,!0);var S=f.call(r,E,b.input,"+"!==b.match.def,!0);if(m=!1!==S,P=(S.pos||E)+1,!m&&x)break}else m=!1;if(m){void 0===t&&b.match.static&&g===e.begin&&p++;break}if(!m&&E>s.maskLength)break;E++}""==n.getTest.call(r,E).match.def&&(m=!1),E=P}if(!m)break}if(!m)return s.validPositions=u.extend(!0,{},k),o.resetMaskSet.call(r,!0),!1}else t&&n.getTest.call(r,a).match.cd===t.match.cd&&(s.validPositions[a]=u.extend(!0,{},t));return o.resetMaskSet.call(r,!0),p}},8254:function(t){t.exports=e},5581:function(e){e.exports=JSON.parse('{"BACKSPACE":8,"BACKSPACE_SAFARI":127,"DELETE":46,"DOWN":40,"END":35,"ENTER":13,"ESCAPE":27,"HOME":36,"INSERT":45,"LEFT":37,"PAGE_DOWN":34,"PAGE_UP":33,"RIGHT":39,"SPACE":32,"TAB":9,"UP":38,"X":88,"Z":90,"CONTROL":17,"PAUSE/BREAK":19,"WINDOWS_LEFT":91,"WINDOWS_RIGHT":92,"KEY_229":229}')}},i={};function a(e){var n=i[e];if(void 0!==n)return n.exports;var r=i[e]={exports:{}};return t[e](r,r.exports,a),r.exports}var n={};return function(){var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t,i=(t=a(3046))&&t.__esModule?t:{default:t};a(443);var r=i.default;e.default=r}(),n}()}));(function($){var splitVersion=$.fn.jquery.split(".");var major=parseInt(splitVersion[0]);var minor=parseInt(splitVersion[1]);var JQ_LT_17=(major<1)||(major==1&&minor<7);function eventsData($el){return JQ_LT_17?$el.data('events'):$._data($el[0]).events;}
function moveHandlerToTop($el,eventName,isDelegated){var data=eventsData($el);var events=data[eventName];if(!JQ_LT_17){var handler=isDelegated?events.splice(events.delegateCount-1,1)[0]:events.pop();events.splice(isDelegated?0:(events.delegateCount||0),0,handler);return;}
if(isDelegated){data.live.unshift(data.live.pop());}else{events.unshift(events.pop());}}
function moveEventHandlers($elems,eventsString,isDelegate){var events=eventsString.split(/\s+/);$elems.each(function(){for(var i=0;i<events.length;++i){var pureEventName=$.trim(events[i]).match(/[^\.]+/i)[0];moveHandlerToTop($(this),pureEventName,isDelegate);}});}
function makeMethod(methodName){$.fn[methodName+'First']=function(){var args=$.makeArray(arguments);var eventsString=args.shift();if(eventsString){$.fn[methodName].apply(this,arguments);moveEventHandlers(this,eventsString);}
return this;}}
makeMethod('bind');makeMethod('one');$.fn.delegateFirst=function(){var args=$.makeArray(arguments);var eventsString=args[1];if(eventsString){args.splice(0,2);$.fn.delegate.apply(this,arguments);moveEventHandlers(this,eventsString,true);}
return this;};$.fn.liveFirst=function(){var args=$.makeArray(arguments);args.unshift(this.selector);$.fn.delegateFirst.apply($(document),args);return this;};if(!JQ_LT_17){$.fn.onFirst=function(types,selector){var $el=$(this);var isDelegated=typeof selector==='string';$.fn.on.apply($el,arguments);if(typeof types==='object'){for(type in types)
if(types.hasOwnProperty(type)){moveEventHandlers($el,type,isDelegated);}}else if(typeof types==='string'){moveEventHandlers($el,types,isDelegated);}
return $el;};}})(jQuery);(function($){$.masksLoad=function(url){var maskList;$.ajax({url:url,async:false,dataType:'json',success:function(response){maskList=response;}});return maskList;}
$.masksSort=function(maskList,defs,match,key){maskList.sort(function(a,b){var ia=0,ib=0;for(;(ia<a[key].length&&ib<b[key].length);){var cha=a[key].charAt(ia);var chb=b[key].charAt(ib);if(!match.test(cha)){ia++;continue;}
if(!match.test(chb)){ib++;continue;}
if($.inArray(cha,defs)!=-1&&$.inArray(chb,defs)==-1){return 1;}
if($.inArray(cha,defs)==-1&&$.inArray(chb,defs)!=-1){return-1;}
if($.inArray(cha,defs)==-1&&$.inArray(chb,defs)==-1){if(cha!=chb){return cha<chb?-1:1;}}
ia++;ib++;}
for(;(ia<a[key].length||ib<b[key].length);){if(ia<a[key].length&&!match.test(a[key].charAt(ia))){ia++;continue;}
if(ib<b[key].length&&!match.test(b[key].charAt(ib))){ib++;continue;}
if(ia<a[key].length){return 1;}
if(ib<b[key].length){return-1;}}
return 0;});return maskList;}
var caret=function(begin,end){if(typeof begin=='number'){end=(typeof end=='number')?end:begin;if(this.setSelectionRange){this.setSelectionRange(begin,end);}else if(this.createTextRange){var range=this.createTextRange();range.collapse(true);range.moveEnd('character',end);range.moveStart('character',begin);range.select();}}else{if(this.setSelectionRange){begin=this.selectionStart;end=this.selectionEnd;}else if(document.selection&&document.selection.createRange){var range=document.selection.createRange();begin=0-range.duplicate().moveStart('character',-100000);end=begin+range.text.length;}
return{begin:begin,end:end};}};var keys=Object.keys||function(obj){if(obj!==Object(obj)){throw new TypeError('Invalid object');}
var keys=[];for(var key in obj){keys[keys.length]=key;}
return keys;};var maskMatch=function(text){var maskOpts=this.inputmasks.options;var mtxt="";for(var i=0;i<text.length;i++){var ch=text.charAt(i);if(ch==this.inputmasks.placeholder){break;}
if(maskOpts.match.test(ch)){mtxt+=ch;}}
for(var mid in maskOpts.list){var mask=maskOpts.list[mid][maskOpts.listKey];var pass=true;for(var it=0,im=0;(it<mtxt.length&&im<mask.length);){var chm=mask.charAt(im);var cht=mtxt.charAt(it);if(!maskOpts.match.test(chm)&&!(chm in this.inputmasks.defs)){im++;continue;}
if(((chm in this.inputmasks.defs)&&this.inputmasks.defs[chm].test(cht))||(cht==chm)){it++;im++;}else{pass=false;break;}}
if(pass&&it==mtxt.length){var determined=mask.substr(im).search(maskOpts.match)==-1;mask=mask.replace(new RegExp([maskOpts.match.source].concat(keys(this.inputmasks.defs)).join('|'),'g'),maskOpts.replace);var completed=mask.substr(im).search(maskOpts.replace)==-1;return{mask:mask,obj:maskOpts.list[mid],determined:determined,completed:completed};}}
return false;}
var caretApply=function(oldMask,newMask,oldPos){var maskOpts=this.inputmasks.options;if(!oldMask){return 0;}
var pos=0,startPos=0;for(;pos<oldPos.begin;pos++){if(oldMask.charAt(pos)==maskOpts.replace){startPos++;}}
var endPos=0;for(;pos<oldPos.end;pos++){if(oldMask.charAt(pos)==maskOpts.replace){endPos++;}}
for(pos=0;(pos<newMask.length&&(startPos>0||newMask.charAt(pos)!=maskOpts.replace));pos++){if(newMask.charAt(pos)==maskOpts.replace){startPos--;}}
startPos=pos;for(;(pos<newMask.length&&endPos>0);pos++){if(newMask.charAt(pos)==maskOpts.replace){endPos--;}}
endPos=pos;return{begin:startPos,end:endPos};}
var maskUnbind=function(){$(this).off(".inputmasks");}
var unbindOriginal=function(){events=$._data(this,"events");var types=["keydown","keypress","paste","dragdrop","drop","setvalue","reset","cut","blur"]
var that=this;$.each(types,function(idx,evt_name){$.each(that.inputmask.events[evt_name],function(evt_idx,evt_func){$(that).off(evt_name,evt_func);});});}
var runOriginal=function(event){var that=this;$.each(this.inputmask.events[event.type],function(evt_idx,evt_func){evt_func.call(that,event);});}
var maskBind=function(){$(this).on("keydown.inputmasks",masksKeyDown).on("keypress.inputmasks",masksKeyPress).on("paste.inputmasks",masksPaste).on("dragdrop.inputmasks",masksPaste).on("drop.inputmasks",masksPaste).on("cut.inputmasks",masksPaste).on("setvalue.inputmasks",masksChange).on("blur.inputmasks",masksChange).on("reset.inputmasks",masksChange);}
var maskApply=function(match,newtext){var maskOpts=this.inputmasks.options;if(match&&(newtext!==undefined||match.mask!=this.inputmasks.oldmatch.mask)){var caretPos;if(newtext===undefined){caretPos=caretApply.call(this,this.inputmasks.oldmatch.mask,match.mask,caret.call(this));}else{if(this.inputmask){this.inputmask.remove();}
this.value=newtext;}
$(this).inputmask(match.mask,$.extend(true,maskOpts.inputmask,{insertMode:this.inputmasks.insertMode}));unbindOriginal.call(this);if(newtext===undefined){caret.call(this,caretPos.begin,caretPos.end);}}
this.inputmasks.oldmatch=match;maskOpts.onMaskChange.call(this,match.obj,match.determined);}
var keyboardApply=function(e,text,insert){var match=maskMatch.call(this,text);if(!match||match.obj!=this.inputmasks.oldmatch.obj||match.determined!=this.inputmasks.oldmatch.determined){if(match){if(insert){maskApply.call(this,match);runOriginal.call(this,e);}else{runOriginal.call(this,e);maskApply.call(this,match);}}else{if(!insert||!this.inputmasks.insertMode){maskInit.call(this,text);}}
return false;}
runOriginal.call(this,e);return true;}
var masksKeyDown=function(e){if(e.metaKey){runOriginal.call(this,e);return true;}
var maskOpts=this.inputmasks.options;e=e||window.event;var k=e.which||e.charCode||e.keyCode;if(k==8||k==46||(this.inputmasks.iphone&&k==127)){var text=this.inputmask._valueGet();var caretPos=caret.call(this);if(caretPos.begin==caretPos.end){var pos=caretPos.begin;do{if(k!=46){pos--;}
var chr=text.charAt(pos);text=text.substring(0,pos)+text.substring(pos+1);}while(pos>0&&pos<text.length&&chr!=this.inputmasks.placeholder&&!maskOpts.match.test(chr));}else{text=text.substring(0,caretPos.begin)+text.substring(caretPos.end);}
return keyboardApply.call(this,e,text,false);}
if(k==45){this.inputmasks.insertMode=!this.inputmasks.insertMode;}
runOriginal.call(this,e);return true;}
var masksKeyPress=function(e){if(e.metaKey){runOriginal.call(this,e);return true;}
var text=this.inputmask._valueGet();e=e||window.event;var k=e.which||e.charCode||e.keyCode,c=String.fromCharCode(k);caretPos=caret.call(this);if(caretPos.begin==caretPos.end&&text.charAt(caretPos.begin)==this.inputmasks.placeholder){text=text.substring(0,caretPos.begin)+c+text.substring(caretPos.end+1);}else{text=text.substring(0,caretPos.begin)+c+text.substring(caretPos.end);}
return keyboardApply.call(this,e,text,true);}
var masksChange=function(e){maskInit.call(this);return true;}
var masksPaste=function(e){var input=this;setTimeout(function(){maskInit.call(input);},0);return true;}
var maskInit=function(text){if(text===undefined){if(this.inputmask&&this.inputmask._valueGet){text=this.inputmask._valueGet();}else{text=this.value;}}
var match=maskMatch.call(this,text);while(!match&&text.length>0){text=text.substr(0,text.length-1);match=maskMatch.call(this,text);}
maskApply.call(this,match,text);}
var maskStart=function(maskOpts){maskOpts=$.extend(true,{onMaskChange:$.noop},maskOpts);var defs={};for(var def in maskOpts.inputmask.definitions){var validator=maskOpts.inputmask.definitions[def].validator;switch(typeof validator){case"string":defs[def]=new RegExp(validator);break;case"object":if("test"in maskOpts.definitions[def].validator){defs[def]=validator;}
break;case"function":defs[def]={test:validator};break;}}
maskOpts.inputmask.definitions[maskOpts.replace]={validator:maskOpts.match.source,cardinality:1};if(this.inputmasks){$(this).inputmasks("remove");}
this.inputmasks={}
this.inputmasks.options=maskOpts;this.inputmasks.defs=defs;this.inputmasks.iphone=navigator.userAgent.match(/iphone/i)!=null;this.inputmasks.oldmatch=false;this.inputmasks.placeholder=maskOpts.inputmask.placeholder||Inputmask.prototype.defaults.placeholder;this.inputmasks.insertMode=(maskOpts.inputmask.insertMode!==undefined)?maskOpts.inputmask.insertMode:Inputmask.prototype.defaults.insertMode;maskInit.call(this);}
$.fn.inputmasks=function(fn){switch(fn){case"remove":maskUnbind.call(this);this.inputmasks=undefined;$(this).inputmask("remove");break;case"isCompleted":var res=maskMatch.call(this[0],(this[0].inputmask&&this[0].inputmask._valueGet())||this[0].value);return(res&&res.completed);default:this.each(function(){maskStart.call(this,fn);maskBind.call(this);});return this;}}})(jQuery);"function"!=typeof Object.create&&(Object.create=function(t){function e(){}return e.prototype=t,new e}),function(l,p,m){var o={init:function(t,e){var o=this;o.$elem=l(e),o.options=l.extend({},l.fn.owlCarousel.options,o.$elem.data(),t),o.userOptions=t,o.loadContent()},loadContent:function(){var t,i=this;"function"==typeof i.options.beforeInit&&i.options.beforeInit.apply(this,[i.$elem]),"string"==typeof i.options.jsonPath?(t=i.options.jsonPath,l.getJSON(t,function(t){var e,o="";if("function"==typeof i.options.jsonSuccess)i.options.jsonSuccess.apply(this,[t]);else{for(e in t.owl)t.owl.hasOwnProperty(e)&&(o+=t.owl[e].item);i.$elem.html(o)}i.logIn()})):i.logIn()},logIn:function(){var t=this;t.$elem.data("owl-originalStyles",t.$elem.attr("style")).data("owl-originalClasses",t.$elem.attr("class")),t.$elem.css({opacity:0}),t.orignalItems=t.options.items,t.checkBrowser(),t.wrapperWidth=0,t.checkVisible=null,t.setVars()},setVars:function(){var t=this;if(0===t.$elem.children().length)return!1;t.baseClass(),t.eventTypes(),t.$userItems=t.$elem.children(),t.itemsAmount=t.$userItems.length,t.wrapItems(),t.$owlItems=t.$elem.find(".owl-item"),t.$owlWrapper=t.$elem.find(".owl-wrapper"),t.playDirection="next",t.prevItem=0,t.prevArr=[0],t.currentItem=0,t.customEvents(),t.onStartup()},onStartup:function(){var t=this;t.updateItems(),t.calculateAll(),t.buildControls(),t.updateControls(),t.response(),t.moveEvents(),t.stopOnHover(),t.owlStatus(),!1!==t.options.transitionStyle&&t.transitionTypes(t.options.transitionStyle),!0===t.options.autoPlay&&(t.options.autoPlay=5e3),t.play(),t.$elem.find(".owl-wrapper").css("display","block"),t.$elem.is(":visible")?t.$elem.css("opacity",1):t.watchVisibility(),t.onstartup=!1,t.eachMoveUpdate(),"function"==typeof t.options.afterInit&&t.options.afterInit.apply(this,[t.$elem])},eachMoveUpdate:function(){var t=this;!0===t.options.lazyLoad&&t.lazyLoad(),!0===t.options.autoHeight&&t.autoHeight(),t.onVisibleItems(),"function"==typeof t.options.afterAction&&t.options.afterAction.apply(this,[t.$elem])},updateVars:function(){var t=this;"function"==typeof t.options.beforeUpdate&&t.options.beforeUpdate.apply(this,[t.$elem]),t.watchVisibility(),t.updateItems(),t.calculateAll(),t.updatePosition(),t.updateControls(),t.eachMoveUpdate(),"function"==typeof t.options.afterUpdate&&t.options.afterUpdate.apply(this,[t.$elem])},reload:function(){var t=this;p.setTimeout(function(){t.updateVars()},0)},watchVisibility:function(){var t=this;if(!1!==t.$elem.is(":visible"))return!1;t.$elem.css({opacity:0}),p.clearInterval(t.autoPlayInterval),p.clearInterval(t.checkVisible),t.checkVisible=p.setInterval(function(){t.$elem.is(":visible")&&(t.reload(),t.$elem.animate({opacity:1},200),p.clearInterval(t.checkVisible))},500)},wrapItems:function(){var t=this;t.$userItems.wrapAll('<div class="owl-wrapper">').wrap('<div class="owl-item"></div>'),t.$elem.find(".owl-wrapper").wrap('<div class="owl-wrapper-outer">'),t.wrapperOuter=t.$elem.find(".owl-wrapper-outer"),t.$elem.css("display","block")},baseClass:function(){var t=this,e=t.$elem.hasClass(t.options.baseClass),o=t.$elem.hasClass(t.options.theme);e||t.$elem.addClass(t.options.baseClass),o||t.$elem.addClass(t.options.theme)},updateItems:function(){var t,e,o=this;if(!1===o.options.responsive)return!1;if(!0===o.options.singleItem)return o.options.items=o.orignalItems=1,o.options.itemsCustom=!1,o.options.itemsDesktop=!1,o.options.itemsDesktopSmall=!1,o.options.itemsTablet=!1,o.options.itemsTabletSmall=!1,o.options.itemsMobile=!1;if((t=l(o.options.responsiveBaseWidth).width())>(o.options.itemsDesktop[0]||o.orignalItems)&&(o.options.items=o.orignalItems),!1!==o.options.itemsCustom)for(o.options.itemsCustom.sort(function(t,e){return t[0]-e[0]}),e=0;e<o.options.itemsCustom.length;e+=1)o.options.itemsCustom[e][0]<=t&&(o.options.items=o.options.itemsCustom[e][1]);else t<=o.options.itemsDesktop[0]&&!1!==o.options.itemsDesktop&&(o.options.items=o.options.itemsDesktop[1]),t<=o.options.itemsDesktopSmall[0]&&!1!==o.options.itemsDesktopSmall&&(o.options.items=o.options.itemsDesktopSmall[1]),t<=o.options.itemsTablet[0]&&!1!==o.options.itemsTablet&&(o.options.items=o.options.itemsTablet[1]),t<=o.options.itemsTabletSmall[0]&&!1!==o.options.itemsTabletSmall&&(o.options.items=o.options.itemsTabletSmall[1]),t<=o.options.itemsMobile[0]&&!1!==o.options.itemsMobile&&(o.options.items=o.options.itemsMobile[1]);o.options.items>o.itemsAmount&&!0===o.options.itemsScaleUp&&(o.options.items=o.itemsAmount)},response:function(){var t,e,o=this;if(!0!==o.options.responsive)return!1;e=l(p).width(),o.resizer=function(){l(p).width()!==e&&(!1!==o.options.autoPlay&&p.clearInterval(o.autoPlayInterval),p.clearTimeout(t),t=p.setTimeout(function(){e=l(p).width(),o.updateVars()},o.options.responsiveRefreshRate))},l(p).resize(o.resizer)},updatePosition:function(){var t=this;t.jumpTo(t.currentItem),!1!==t.options.autoPlay&&t.checkAp()},appendItemsSizes:function(){var o=this,i=0,s=o.itemsAmount-o.options.items;o.$owlItems.each(function(t){var e=l(this);e.css({width:o.itemWidth}).data("owl-item",Number(t)),t%o.options.items!=0&&t!==s||s<t||(i+=1),e.data("owl-roundPages",i)})},appendWrapperSizes:function(){var t=this,e=t.$owlItems.length*t.itemWidth;t.$owlWrapper.css({width:2*e,left:0}),t.appendItemsSizes()},calculateAll:function(){var t=this;t.calculateWidth(),t.appendWrapperSizes(),t.loops(),t.max()},calculateWidth:function(){var t=this;t.itemWidth=Math.round(t.$elem.width()/t.options.items)},max:function(){var t=this,e=-1*(t.itemsAmount*t.itemWidth-t.options.items*t.itemWidth);return t.options.items>t.itemsAmount?(e=t.maximumItem=0,t.maximumPixels=0):(t.maximumItem=t.itemsAmount-t.options.items,t.maximumPixels=e),e},min:function(){return 0},loops:function(){var t,e,o=this,i=0,s=0;for(o.positionsInArray=[0],o.pagesInArray=[],t=0;t<o.itemsAmount;t+=1)"rtl"===o.userOptions.direction?s-=o.itemWidth:s+=o.itemWidth,o.positionsInArray.push(-s),!0===o.options.scrollPerPage&&(e=l(o.$owlItems[t]).data("owl-roundPages"))!==i&&(o.pagesInArray[i]=o.positionsInArray[t],i=e)},buildControls:function(){var t=this;!0!==t.options.navigation&&!0!==t.options.pagination||(t.owlControls=l('<div class="owl-controls"/>').toggleClass("clickable",!t.browser.isTouch).appendTo(t.$elem)),!0===t.options.pagination&&t.buildPagination(),!0===t.options.navigation&&t.buildButtons()},buildButtons:function(){var e=this,t=l('<div class="owl-buttons"/>');e.owlControls.append(t),e.buttonPrev=l("<div/>",{class:"owl-prev",html:e.options.navigationText[0]||""}),e.buttonNext=l("<div/>",{class:"owl-next",html:e.options.navigationText[1]||""}),t.append(e.buttonPrev).append(e.buttonNext),t.on("touchstart.owlControls mousedown.owlControls",'div[class^="owl"]',function(t){t.preventDefault()}),t.on("touchend.owlControls mouseup.owlControls",'div[class^="owl"]',function(t){t.preventDefault(),l(this).hasClass("owl-next")?e.next():e.prev()})},buildPagination:function(){var e=this;e.paginationWrapper=l('<div class="owl-pagination"/>'),e.owlControls.append(e.paginationWrapper),e.paginationWrapper.on("touchend.owlControls mouseup.owlControls",".owl-page",function(t){t.preventDefault(),Number(l(this).data("owl-page"))!==e.currentItem&&e.goTo(Number(l(this).data("owl-page")),!0)})},updatePagination:function(){var t,e,o,i,s,n,a=this;if(!1===a.options.pagination)return!1;for(a.paginationWrapper.html(""),t=0,e=a.itemsAmount-a.itemsAmount%a.options.items,i=0;i<a.itemsAmount;i+=1)i%a.options.items==0&&(t+=1,e===i&&(o=a.itemsAmount-a.options.items),s=l("<div/>",{class:"owl-page"}),n=l("<span></span>",{text:!0===a.options.paginationNumbers?t:"",class:!0===a.options.paginationNumbers?"owl-numbers":""}),s.append(n),s.data("owl-page",e===i?o:i),s.data("owl-roundPages",t),a.paginationWrapper.append(s));a.checkPagination()},checkPagination:function(){var t=this;if(!1===t.options.pagination)return!1;t.paginationWrapper.find(".owl-page").each(function(){l(this).data("owl-roundPages")===l(t.$owlItems[t.currentItem]).data("owl-roundPages")&&(t.paginationWrapper.find(".owl-page").removeClass("active"),l(this).addClass("active"))})},checkNavigation:function(){var t=this;if(!1===t.options.navigation)return!1;!1===t.options.rewindNav&&(0===t.currentItem&&0===t.maximumItem?(t.buttonPrev.addClass("disabled"),t.buttonNext.addClass("disabled")):0===t.currentItem&&0!==t.maximumItem?(t.buttonPrev.addClass("disabled"),t.buttonNext.removeClass("disabled")):t.currentItem===t.maximumItem?(t.buttonPrev.removeClass("disabled"),t.buttonNext.addClass("disabled")):0!==t.currentItem&&t.currentItem!==t.maximumItem&&(t.buttonPrev.removeClass("disabled"),t.buttonNext.removeClass("disabled")))},updateControls:function(){var t=this;t.updatePagination(),t.checkNavigation(),t.owlControls&&(t.options.items>=t.itemsAmount?t.owlControls.hide():t.owlControls.show())},destroyControls:function(){this.owlControls&&this.owlControls.remove()},next:function(t){var e=this;if(e.isTransition)return!1;if(e.currentItem+=!0===e.options.scrollPerPage?e.options.items:1,e.currentItem>e.maximumItem+(!0===e.options.scrollPerPage?e.options.items-1:0)){if(!0!==e.options.rewindNav)return e.currentItem=e.maximumItem,!1;e.currentItem=0,t="rewind"}e.goTo(e.currentItem,t)},prev:function(t){var e=this;if(e.isTransition)return!1;if(!0===e.options.scrollPerPage&&0<e.currentItem&&e.currentItem<e.options.items?e.currentItem=0:e.currentItem-=!0===e.options.scrollPerPage?e.options.items:1,e.currentItem<0){if(!0!==e.options.rewindNav)return e.currentItem=0,!1;e.currentItem=e.maximumItem,t="rewind"}e.goTo(e.currentItem,t)},goTo:function(t,e,o){var i,s=this;return!s.isTransition&&("function"==typeof s.options.beforeMove&&s.options.beforeMove.apply(this,[s.$elem]),t>=s.maximumItem?t=s.maximumItem:t<=0&&(t=0),s.currentItem=s.owl.currentItem=t,!1!==s.options.transitionStyle&&"drag"!==o&&1===s.options.items&&!0===s.browser.support3d?(s.swapSpeed(0),!0===s.browser.support3d?s.transition3d(s.positionsInArray[t]):s.css2slide(s.positionsInArray[t],1),s.afterGo(),s.singleItemTransition(),!1):(i=s.positionsInArray[t],!0===s.browser.support3d?(!(s.isCss3Finish=!1)===e?(s.swapSpeed("paginationSpeed"),p.setTimeout(function(){s.isCss3Finish=!0},s.options.paginationSpeed)):"rewind"===e?(s.swapSpeed(s.options.rewindSpeed),p.setTimeout(function(){s.isCss3Finish=!0},s.options.rewindSpeed)):(s.swapSpeed("slideSpeed"),p.setTimeout(function(){s.isCss3Finish=!0},s.options.slideSpeed)),s.transition3d(i)):!0===e?s.css2slide(i,s.options.paginationSpeed):"rewind"===e?s.css2slide(i,s.options.rewindSpeed):s.css2slide(i,s.options.slideSpeed),void s.afterGo()))},jumpTo:function(t){var e=this;"function"==typeof e.options.beforeMove&&e.options.beforeMove.apply(this,[e.$elem]),t>=e.maximumItem||-1===t?t=e.maximumItem:t<=0&&(t=0),e.swapSpeed(0),!0===e.browser.support3d?e.transition3d(e.positionsInArray[t]):e.css2slide(e.positionsInArray[t],1),e.currentItem=e.owl.currentItem=t,e.afterGo()},afterGo:function(){var t=this;t.prevArr.push(t.currentItem),t.prevItem=t.owl.prevItem=t.prevArr[t.prevArr.length-2],t.prevArr.shift(0),t.prevItem!==t.currentItem&&(t.checkPagination(),t.checkNavigation(),t.eachMoveUpdate(),!1!==t.options.autoPlay&&t.checkAp()),"function"==typeof t.options.afterMove&&t.prevItem!==t.currentItem&&t.options.afterMove.apply(this,[t.$elem])},stop:function(){this.apStatus="stop",p.clearInterval(this.autoPlayInterval)},checkAp:function(){"stop"!==this.apStatus&&this.play()},play:function(){var t=this;if(!(t.apStatus="play")===t.options.autoPlay)return!1;p.clearInterval(t.autoPlayInterval),t.autoPlayInterval=p.setInterval(function(){t.next(!0)},t.options.autoPlay)},swapSpeed:function(t){var e=this;"slideSpeed"===t?e.$owlWrapper.css(e.addCssSpeed(e.options.slideSpeed)):"paginationSpeed"===t?e.$owlWrapper.css(e.addCssSpeed(e.options.paginationSpeed)):"string"!=typeof t&&e.$owlWrapper.css(e.addCssSpeed(t))},addCssSpeed:function(t){return{"-webkit-transition":"all "+t+"ms ease","-moz-transition":"all "+t+"ms ease","-o-transition":"all "+t+"ms ease",transition:"all "+t+"ms ease"}},removeTransition:function(){return{"-webkit-transition":"","-moz-transition":"","-o-transition":"",transition:""}},doTranslate:function(t){return{"-webkit-transform":"translate3d("+t+"px, 0px, 0px)","-moz-transform":"translate3d("+t+"px, 0px, 0px)","-o-transform":"translate3d("+t+"px, 0px, 0px)","-ms-transform":"translate3d("+t+"px, 0px, 0px)",transform:"translate3d("+t+"px, 0px,0px)"}},transition3d:function(t){this.$owlWrapper.css(this.doTranslate(t))},css2move:function(t){this.$owlWrapper.css({left:t})},css2slide:function(t,e){var o=this;o.isCssFinish=!1,o.$owlWrapper.stop(!0,!0).animate({left:t},{duration:e||o.options.slideSpeed,complete:function(){o.isCssFinish=!0}})},checkBrowser:function(){var t,e,o,i,s="translate3d(0px, 0px, 0px)",n=m.createElement("div");n.style.cssText="  -moz-transform:"+s+"; -ms-transform:"+s+"; -o-transform:"+s+"; -webkit-transform:"+s+"; transform:"+s,t=/translate3d\(0px, 0px, 0px\)/g,o=null!==(e=n.style.cssText.match(t))&&1===e.length,i="ontouchstart"in p||p.navigator.msMaxTouchPoints,this.browser={support3d:o,isTouch:i}},moveEvents:function(){!1===this.options.mouseDrag&&!1===this.options.touchDrag||(this.gestures(),this.disabledEvents())},eventTypes:function(){var t=this,e=["s","e","x"];t.ev_types={},!0===t.options.mouseDrag&&!0===t.options.touchDrag?e=["touchstart.owl mousedown.owl","touchmove.owl mousemove.owl","touchend.owl touchcancel.owl mouseup.owl"]:!1===t.options.mouseDrag&&!0===t.options.touchDrag?e=["touchstart.owl","touchmove.owl","touchend.owl touchcancel.owl"]:!0===t.options.mouseDrag&&!1===t.options.touchDrag&&(e=["mousedown.owl","mousemove.owl","mouseup.owl"]),t.ev_types.start=e[0],t.ev_types.move=e[1],t.ev_types.end=e[2]},disabledEvents:function(){this.$elem.on("dragstart.owl",function(t){t.preventDefault()}),this.$elem.on("mousedown.disableTextSelect",function(t){return l(t.target).is("input, textarea, select, option")})},gestures:function(){var n=this,a={offsetX:0,offsetY:0,baseElWidth:0,relativePos:0,position:null,minSwipe:null,maxSwipe:null,sliding:null,dargging:null,targetElement:null};function s(t){if(void 0!==t.touches)return{x:t.touches[0].pageX,y:t.touches[0].pageY};if(void 0===t.touches){if(void 0!==t.pageX)return{x:t.pageX,y:t.pageY};if(void 0===t.pageX)return{x:t.clientX,y:t.clientY}}}function r(t){"on"===t?(l(m).on(n.ev_types.move,e),l(m).on(n.ev_types.end,o)):"off"===t&&(l(m).off(n.ev_types.move),l(m).off(n.ev_types.end))}function e(t){var e,o,i=t.originalEvent||t||p.event;n.newPosX=s(i).x-a.offsetX,n.newPosY=s(i).y-a.offsetY,n.newRelativeX=n.newPosX-a.relativePos,"function"==typeof n.options.startDragging&&!0!==a.dragging&&0!==n.newRelativeX&&(a.dragging=!0,n.options.startDragging.apply(n,[n.$elem])),(8<n.newRelativeX||n.newRelativeX<-8)&&!0===n.browser.isTouch&&(void 0!==i.preventDefault?i.preventDefault():i.returnValue=!1,a.sliding=!0),(10<n.newPosY||n.newPosY<-10)&&!1===a.sliding&&l(m).off("touchmove.owl"),e=function(){return n.newRelativeX/5},o=function(){return n.maximumPixels+n.newRelativeX/5},"rtl"===n.userOptions.direction?n.newPosX=Math.max(Math.max(n.newPosX,e()),o()):n.newPosX=Math.max(Math.min(n.newPosX,e()),o()),!0===n.browser.support3d?n.transition3d(n.newPosX):n.css2move(n.newPosX)}function o(t){var e,o,i,s=t.originalEvent||t||p.event;s.target=s.target||s.srcElement,!(a.dragging=!1)!==n.browser.isTouch&&n.$owlWrapper.removeClass("grabbing"),n.newRelativeX<0?n.dragDirection=n.owl.dragDirection="left":n.dragDirection=n.owl.dragDirection="right",0!==n.newRelativeX&&(e=n.getNewPosition(),n.goTo(e,!1,"drag"),a.targetElement===s.target&&!0!==n.browser.isTouch&&(l(s.target).on("click.disable",function(t){t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault(),l(t.target).off("click.disable")}),i=(o=l._data(s.target,"events").click).pop(),o.splice(0,0,i))),r("off")}n.isCssFinish=!0,n.$elem.on(n.ev_types.start,".owl-wrapper",function(t){var e,o=t.originalEvent||t||p.event;if(3===o.which)return!1;if(!(n.itemsAmount<=n.options.items)){if(!1===n.isCssFinish&&!n.options.dragBeforeAnimFinish)return!1;if(!1===n.isCss3Finish&&!n.options.dragBeforeAnimFinish)return!1;!1!==n.options.autoPlay&&p.clearInterval(n.autoPlayInterval),!0===n.browser.isTouch||n.$owlWrapper.hasClass("grabbing")||n.$owlWrapper.addClass("grabbing"),n.newPosX=0,n.newRelativeX=0,l(this).css(n.removeTransition()),e=l(this).position(),"rtl"===n.userOptions.direction&&(e.left=e.left+l(this).width()-l(this).parent().width()),a.relativePos=e.left,a.offsetX=s(o).x-e.left,a.offsetY=s(o).y-e.top,r("on"),a.sliding=!1,a.targetElement=o.target||o.srcElement}})},getNewPosition:function(){var t=this,e=t.closestItem();return e>t.maximumItem?(t.currentItem=t.maximumItem,e=t.maximumItem):(t.newPosX<=0&&"rtl"===t.userOptions.direction||0<=t.newPosX&&"rtl"!==t.userOptions.direction)&&(e=0,t.currentItem=0),e},closestItem:function(){var o=this,i=!0===o.options.scrollPerPage?o.pagesInArray:o.positionsInArray,s=o.newPosX,n=null;return l.each(i,function(t,e){-s+o.itemWidth/20>-i[t+1]&&-s+o.itemWidth/20<-e&&"right"===o.moveDirection()&&"rtl"===o.userOptions.direction||s-o.itemWidth/20>i[t+1]&&s-o.itemWidth/20<e&&"left"===o.moveDirection()&&"rtl"!==o.userOptions.direction?(n=e,!0===o.options.scrollPerPage?o.currentItem=l.inArray(n,o.positionsInArray):o.currentItem=t):(-s-o.itemWidth/20<-e&&-s-o.itemWidth/20>-(i[t+1]||-(i[t]-o.itemWidth))&&"left"===o.moveDirection()&&"rtl"===o.userOptions.direction||s+o.itemWidth/20<e&&s+o.itemWidth/20>(i[t+1]||i[t]-o.itemWidth)&&"right"===o.moveDirection()&&"rtl"!==o.userOptions.direction)&&(!0===o.options.scrollPerPage?(n=i[t+1]||i[i.length-1],o.currentItem=l.inArray(n,o.positionsInArray)):(n=i[t+1],o.currentItem=t+1))}),o.currentItem},moveDirection:function(){var t;return this.newRelativeX<0?(t="right",this.playDirection="next"):(t="left",this.playDirection="prev"),t},customEvents:function(){var o=this;o.$elem.on("owl.next",function(){o.next()}),o.$elem.on("owl.prev",function(){o.prev()}),o.$elem.on("owl.play",function(t,e){o.options.autoPlay=e,o.play(),o.hoverStatus="play"}),o.$elem.on("owl.stop",function(){o.stop(),o.hoverStatus="stop"}),o.$elem.on("owl.goTo",function(t,e){o.goTo(e)}),o.$elem.on("owl.jumpTo",function(t,e){o.jumpTo(e)})},stopOnHover:function(){var t=this;!0===t.options.stopOnHover&&!0!==t.browser.isTouch&&!1!==t.options.autoPlay&&(t.$elem.on("mouseover",function(){t.stop()}),t.$elem.on("mouseout",function(){"stop"!==t.hoverStatus&&t.play()}))},lazyLoad:function(){var t,e,o,i,s=this;if(!1===s.options.lazyLoad)return!1;for(t=0;t<s.itemsAmount;t+=1)"loaded"!==(e=l(s.$owlItems[t])).data("owl-loaded")&&(o=e.data("owl-item"),"string"==typeof(i=e.find(".lazyOwl")).data("src")?(void 0===e.data("owl-loaded")&&(i.hide(),e.addClass("loading").data("owl-loaded","checked")),(!0!==s.options.lazyFollow||o>=s.currentItem)&&o<s.currentItem+s.options.items&&i.length&&s.lazyPreload(e,i)):e.data("owl-loaded","loaded"))},lazyPreload:function(t,e){var o,i=this,s=0;function n(){t.data("owl-loaded","loaded").removeClass("loading"),e.removeAttr("data-src"),"fade"===i.options.lazyEffect?e.fadeIn(400):e.show(),"function"==typeof i.options.afterLazyLoad&&i.options.afterLazyLoad.apply(this,[i.$elem])}"DIV"===e.prop("tagName")?(e.css("background-image","url("+e.data("src")+")"),o=!0):e[0].src=e.data("src"),function t(){s+=1,i.completeImg(e.get(0))||!0===o?n():s<=100?p.setTimeout(t,100):n()}()},autoHeight:function(){var e,o=this,i=l(o.$owlItems[o.currentItem]).find("img");function s(){var t=l(o.$owlItems[o.currentItem]).height();o.wrapperOuter.css("height",t+"px"),o.wrapperOuter.hasClass("autoHeight")||p.setTimeout(function(){o.wrapperOuter.addClass("autoHeight")},0)}void 0!==i.get(0)?(e=0,function t(){e+=1,o.completeImg(i.get(0))?s():e<=100?p.setTimeout(t,100):o.wrapperOuter.css("height","")}()):s()},completeImg:function(t){return!!t.complete&&("undefined"==typeof t.naturalWidth||0!==t.naturalWidth)},onVisibleItems:function(){var t,e=this;for(!0===e.options.addClassActive&&e.$owlItems.removeClass("active"),e.visibleItems=[],t=e.currentItem;t<e.currentItem+e.options.items;t+=1)e.visibleItems.push(t),!0===e.options.addClassActive&&l(e.$owlItems[t]).addClass("active");e.owl.visibleItems=e.visibleItems},transitionTypes:function(t){this.outClass="owl-"+t+"-out",this.inClass="owl-"+t+"-in"},singleItemTransition:function(){var t=this,e=t.outClass,o=t.inClass,i=t.$owlItems.eq(t.currentItem),s=t.$owlItems.eq(t.prevItem),n=Math.abs(t.positionsInArray[t.currentItem])+t.positionsInArray[t.prevItem],a=Math.abs(t.positionsInArray[t.currentItem])+t.itemWidth/2,r="webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend";t.isTransition=!0,t.$owlWrapper.addClass("owl-origin").css({"-webkit-transform-origin":a+"px","-moz-perspective-origin":a+"px","perspective-origin":a+"px"}),s.css({position:"relative",left:n+"px"}).addClass(e).on(r,function(){t.endPrev=!0,s.off(r),t.clearTransStyle(s,e)}),i.addClass(o).on(r,function(){t.endCurrent=!0,i.off(r),t.clearTransStyle(i,o)})},clearTransStyle:function(t,e){var o=this;t.css({position:"",left:""}).removeClass(e),o.endPrev&&o.endCurrent&&(o.$owlWrapper.removeClass("owl-origin"),o.endPrev=!1,o.endCurrent=!1,o.isTransition=!1)},owlStatus:function(){var t=this;t.owl={userOptions:t.userOptions,baseElement:t.$elem,userItems:t.$userItems,owlItems:t.$owlItems,currentItem:t.currentItem,prevItem:t.prevItem,visibleItems:t.visibleItems,isTouch:t.browser.isTouch,browser:t.browser,dragDirection:t.dragDirection}},clearEvents:function(){this.$elem.off(".owl owl mousedown.disableTextSelect"),l(m).off(".owl owl"),l(p).off("resize",this.resizer)},unWrap:function(){var t=this;0!==t.$elem.children().length&&(t.$owlWrapper.unwrap(),t.$userItems.unwrap().unwrap(),t.owlControls&&t.owlControls.remove()),t.clearEvents(),t.$elem.attr("style",t.$elem.data("owl-originalStyles")||"").attr("class",t.$elem.data("owl-originalClasses"))},destroy:function(){this.stop(),p.clearInterval(this.checkVisible),this.unWrap(),this.$elem.removeData()},reinit:function(t){var e=l.extend({},this.userOptions,t);this.unWrap(),this.init(e,this.$elem)},addItem:function(t,e){var o,i=this;return!!t&&(0===i.$elem.children().length?(i.$elem.append(t),i.setVars(),!1):(i.unWrap(),(o=void 0===e||-1===e?-1:e)>=i.$userItems.length||-1===o?i.$userItems.eq(-1).after(t):i.$userItems.eq(o).before(t),void i.setVars()))},removeItem:function(t){var e;if(0===this.$elem.children().length)return!1;e=void 0===t||-1===t?-1:t,this.unWrap(),this.$userItems.eq(e).remove(),this.setVars()}};l.fn.owlCarousel=function(e){return this.each(function(){if(!0===l(this).data("owl-init"))return!1;l(this).data("owl-init",!0);var t=Object.create(o);t.init(e,this),l.data(this,"owlCarousel",t)})},l.fn.owlCarousel.options={items:5,itemsCustom:!1,itemsDesktop:[1199,4],itemsDesktopSmall:[979,3],itemsTablet:[768,2],itemsTabletSmall:!1,itemsMobile:[479,1],singleItem:!1,itemsScaleUp:!1,slideSpeed:200,paginationSpeed:800,rewindSpeed:1e3,autoPlay:!1,stopOnHover:!1,navigation:!1,navigationText:["prev","next"],rewindNav:!0,scrollPerPage:!1,pagination:!0,paginationNumbers:!1,responsive:!0,responsiveRefreshRate:200,responsiveBaseWidth:p,baseClass:"owl-carousel",theme:"owl-theme",lazyLoad:!1,lazyFollow:!0,lazyEffect:"fade",autoHeight:!1,jsonPath:!1,jsonSuccess:!1,dragBeforeAnimFinish:!0,mouseDrag:!0,touchDrag:!0,addClassActive:!1,transitionStyle:!1,beforeUpdate:!1,afterUpdate:!1,beforeInit:!1,afterInit:!1,beforeMove:!1,afterMove:!1,afterAction:!1,startDragging:!1,afterLazyLoad:!1}}(jQuery,window,document);(function(_,$){var mask_list;var is_custom_format;$.ceEvent('on','ce.commoninit',function(context){is_custom_format=!!_.call_phone_mask;var $phone_elems=context.find('.cm-mask-phone'),phone_validation_mode=_.phone_validation_mode||'international_format',is_international_format=phone_validation_mode==='international_format',is_any_digits=phone_validation_mode==='any_digits';if(!$phone_elems.length||is_international_format&&!window.localStorage){return;}
if(is_international_format){$phone_elems.attr('inputmode','numeric');}
if(is_international_format||is_custom_format){loadPhoneMasks().then(function(phone_masks){_.phone_masks_list=phone_masks;_.call_requests_phone_masks_list=_.phone_masks_list;mask_list=$.masksSort(_.phone_masks_list,['#'],/[0-9]|#/,"mask");var mask_opts={inputmask:{definitions:{'#':{validator:"[0-9]",cardinality:1}},showMaskOnHover:false,autoUnmask:false,onKeyDown:function onKeyDown(){$(this).trigger('_input');}},match:/[0-9]/,replace:'#',list:mask_list,listKey:"mask"};$phone_elems.each(function(index,elm){if(is_custom_format&&$(elm).data('enableCustomMask')){$(elm).inputmask({mask:_.call_phone_mask,showMaskOnHover:false,autoUnmask:false,onKeyDown:function onKeyDown(){$(this).trigger('_input');}});}else{$(elm).inputmasks(mask_opts);}
$(elm).on("blur.inputmasks",function(){if($(this).val()===this.inputmask.maskset._buffer.join('')){$(this).val('');}});$(elm).addClass('js-mask-phone-inited');if($(elm).val()){$(elm).oneFirst('keypress keydown',function(){if(!validatePhone($(elm))){$(elm).trigger('paste');}});$(elm).prop('defaultValue',$(elm).val());}});});$.ceFormValidator('registerValidator',{class_name:'cm-mask-phone-label',message:_.tr('error_validator_phone_mask'),func:function func(id){return validatePhone($('#'+id));}});}else if(is_any_digits){$.ceFormValidator('registerValidator',{class_name:'cm-mask-phone-label',message:_.tr('error_validator_phone'),func:function func(elm_id,elm,lbl){return $.is.blank(elm.val())||$.is.phone(elm.val());}});}});function validatePhone($input){if($.is.blank($input.val())||!$input.hasClass('js-mask-phone-inited')){return true;}
var mask_is_valid=false;if(is_custom_format&&$input.data('enableCustomMask')){mask_is_valid=_toRegExp(_.call_phone_mask).test($input.val());}else{mask_list.forEach(function(mask){mask_is_valid=mask_is_valid||_toRegExp(mask.mask).test($input.val());});}
return mask_is_valid&&$input.inputmask("isComplete");function _toRegExp(mask){var _convertedMask=mask.str_replace('#','.').str_replace('+','\\+').str_replace('(','\\(').str_replace(')','\\)').str_replace('9','[0-9]').str_replace('\\[0-9]','9');return new RegExp(_convertedMask);}}
function loadPhoneMasks(){var oldHashOfAvailableCountries=window.localStorage.getItem('availableCountriesHash'),newHashOfAvailableCountries=_.hash_of_available_countries,oldHashPhoneMasks=window.localStorage.getItem('phoneMasksHash'),newHashPhonesMasks=_.hash_of_phone_masks,rawPhoneMasks=window.localStorage.getItem('phoneMasks'),phoneMasks,d=$.Deferred();if(rawPhoneMasks&&oldHashPhoneMasks===newHashPhonesMasks){phoneMasks=JSON.parse(rawPhoneMasks);}
if(!phoneMasks||newHashOfAvailableCountries!==undefined&&oldHashOfAvailableCountries!==newHashOfAvailableCountries){$.ceAjax('request',fn_url('phone_masks.get_masks'),{method:'get',caching:false,data:{},callback:function callback(response){if(!response||!response.phone_mask_codes){return;}
$.ceEvent('trigger','ce.phone_masks.masks_loaded',[response]);phoneMasks=Object.keys(response.phone_mask_codes).map(function(key){return response.phone_mask_codes[key];});window.localStorage.setItem('phoneMasksHash',newHashPhonesMasks);window.localStorage.setItem('phoneMasks',JSON.stringify(phoneMasks));d.resolve(phoneMasks);},repeat_on_error:false,hidden:true,pre_processing:function pre_processing(response){if(response.force_redirection){delete response.force_redirection;}
return false;},error_callback:function error_callback(){d.reject();}});window.localStorage.setItem('availableCountriesHash',newHashOfAvailableCountries);}else{d.resolve(phoneMasks);}
return d.promise();}})(Tygh,Tygh.$);(function(_,$){var regex_all=new RegExp("<script[^>\xA7]*>([\x01-\uFFFF]*?)</script>",'img');$.ceEvent('on','ce.commoninit',function(context){var $elems=$('.cm-gdpr-agreement-label',context);if(!$elems.length){return;}
$elems.each(function(){var $agreementLabel=$(this);var $block=$agreementLabel.closest('[data-ca-gdpr-agreement]');var $targetElem=$($agreementLabel.data('caGdprTargetElem'));if(!$targetElem.length||$targetElem.data('caIsInitedGdprTargetElem')){return;}
$targetElem.on('focus',function(){$block.removeClass('hidden');});$targetElem.data('caIsInitedGdprTargetElem',true);});});$.ceEvent('on','ce.ajaxdone',function(elms,scripts,params,data,responseText){loadConsentsScriptFromAjax(data);});$('document').ready(function(){if(typeof cookieConfig!=='undefined'&&cookieConfig.services.length){cookieConfig.callback=function(consent,service){$.ceEvent('trigger','ce.gdpr_cookie_global_init',[consent,service]);};cookieConfig.services.forEach(function(serviceItem){serviceItem.callback=function(consent,service){$.ceEvent('trigger','ce.gdpr_cookie_init_'+service.name,[consent,service]);};serviceItem.onAccept=function(handlerOpts){$.ceEvent('trigger','ce.gdpr_cookie_on_accept_'+handlerOpts.service.name,[handlerOpts]);};serviceItem.onDecline=function(handlerOpts){$.ceEvent('trigger','ce.gdpr_cookie_on_decline_'+handlerOpts.service.name,[handlerOpts]);};});var normilizedConfig=normalizeTranslations(cookieConfig);klaro.setup(normilizedConfig);setTimeout(function(){return $.ceEvent('trigger','ce.gdpr_cookie_init',[$(_.doc)]);},1000);}});var normalizeTranslations=function normalizeTranslations(config){config.translations.zz=addLangvar(config.translations.zz);config.services.forEach(function(service){service.translations.zz=addLangvar(service.translations.zz);});return config;};var addLangvar=function addLangvar(translationSchema){for(var key in translationSchema){if(key==='privacyPolicyUrl'){continue;}
if(typeof translationSchema[key]==='string'){translationSchema[key]=_.tr(translationSchema[key]);}else{translationSchema[key]=addLangvar(translationSchema[key]);}}
return translationSchema;};function loadConsentsScriptFromAjax(data){if(!data.html){return;}
for(var k in data.html){matches=data.html[k].match(regex_all);if(matches===null||!matches.length){continue;}
ext_scripts=$(matches.join('\n')).filter('.cm-ajax-skip-load[type="text/plain"][data-type="application/javascript"][data-src]');if(!ext_scripts.length){continue;}
for(var i=0;i<ext_scripts.length;i++){if(!klaro.getManager().states[ext_scripts.eq(i).data('name')]){continue;}
$.getScript(ext_scripts.eq(i).prop('src'));}}}})(Tygh,Tygh.$);(function(_,$){$(document).on('click','.cm-ls-close-popup',function(){var parent_form=$(this).parents('form');$box=parent_form.find('.live-search-box.cm-popup-box');if($box.length>0){$box.hide();}});$(_.doc).on('click','.cm-ls-load-more',function(){var target_id=$(this).data('caTargetId');var link_href=$(this).data('caHref');var page=$(this).data('caPage');var total_pages=$(this).data('caTotalPages');var input_id=$(this).data('caInputId');var load_btn=$(this);var loader_id='#cp_ls_ajax_loader'+input_id;$(loader_id).show();$.ceAjax('request',link_href,{data:{page:page,load_more:true},hidden:true,callback:function(content){$(loader_id).hide();if(page<total_pages){load_btn.data('caPage',page+1);}else{load_btn.hide();load_btn.siblings('a.cp-ls-view-all').addClass('cp-ls-full');}
if(content.text){$(content.text).children().appendTo('#'+target_id);}}});});$.ceEvent('on','ce.ajaxdone',function(elms,scripts,params,response_data,response_text){if(response_data.highlight){var searchArray=response_data.highlight.split(' ');$('.live-search-box.cm-popup-box').highlight(searchArray,{element:'span',className:'live-match-higthlight'});}});$.ceEvent('on','ce.commoninit',function(context){$('.search-input, .ty-search-block__input',context).on('input propertychange click',function(action){if($(this).parents('.cp-live-search-overlay').length>0){return false;}
if(action.type=='click'){var parent_form=$(this).closest('form');var popup_elem=parent_form.find('.live-search-box.cm-popup-box');if(popup_elem.length>0){popup_elem.show();}
return true;}
id_class=$(this).attr('id');var id=id_class.replace("search_input","");ls_go_search($(this),id);});$('.search-input, .ty-search-block__input',context).attr('autocomplete','off');});var typed;$(document).ready(function(){var elem=$('#search_input');if(typeof ls_search_motivation!='undefined'&&ls_search_motivation.length!=0&&elem.length&&elem.attr('value')==''){elem.removeClass('cm-hint');elem.val('');elem.attr('name','q');var title=elem.attr('title');if(title.length>0){elem.attr('placeholder',title);}
typed=new Typed('#search_input',{'strings':ls_search_motivation,'stringsElement':null,'backSpeed':100,'typeSpeed':200,'smartBackspace':false,'startDelay':1000,'backDelay':2000,'loop':true,'loopCount':Infinity,'attr':'placeholder','contentType':null,'bindInputFocusEvents':true,});}});$(document).on('focus','#search_input',function(context){if(typeof typed!='undefined'){typed.destroy();}});})(Tygh,Tygh.$);function ls_go_search(elm,id){if(elm.val().length>=letters_to_start){day=new Date;ls_cur_time=day.getTime();var loader_id='#cp_ls_ajax_loader'+id;$(loader_id).show();setTimeout(function(){day=new Date;now=day.getTime();differ=now-ls_cur_time;if(differ>=ls_search_delay-1){$.ceAjax('request',fn_url('products.cp_live_search'),{data:{q:elm.val(),search_input_id:id,company_id:elm.attr('data-company')},method:'get',result_ids:'live_reload_box'+id,hidden:true,force_exec:true,callback:function(){$(loader_id).hide();}});}},ls_search_delay);}}
function fill_live_input(elm,val){var input=$(elm).parents('.ty-search-block').find('input[type="text"].ty-search-block__input');input.val(val);input.trigger('input');}
jQuery.extend({highlight:function(node,re,nodeName,className){if(node.nodeType===3){var match=node.data.match(re);if(match){var highlight=document.createElement(nodeName||'span');highlight.className=className||'highlight';var wordNode=node.splitText(match.index);wordNode.splitText(match[0].length);var wordClone=wordNode.cloneNode(true);highlight.appendChild(wordClone);wordNode.parentNode.replaceChild(highlight,wordNode);return 1;}}else if((node.nodeType===1&&node.childNodes)&&!/(script|style)/i.test(node.tagName)&&!(node.tagName===nodeName.toUpperCase()&&node.className===className)){for(var i=0;i<node.childNodes.length;i++){i+=jQuery.highlight(node.childNodes[i],re,nodeName,className);}}
return 0;}});jQuery.fn.unhighlight=function(options){var settings={className:'highlight',element:'span'};jQuery.extend(settings,options);return this.find(settings.element+"."+settings.className).each(function(){var parent=this.parentNode;parent.replaceChild(this.firstChild,this);parent.normalize();}).end();};jQuery.fn.highlight=function(words,options){var settings={className:'highlight',element:'span',caseSensitive:false,wordsOnly:false};jQuery.extend(settings,options);if(words.constructor===String){words=[words];}
words=jQuery.grep(words,function(word,i){return word!='';});words=jQuery.map(words,function(word,i){return word.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");});if(words.length==0){return this;};var flag=settings.caseSensitive?"":"i";var pattern="("+words.join("|")+")";if(settings.wordsOnly){pattern="\\b"+pattern+"\\b";}
var re=new RegExp(pattern,flag);return this.each(function(){jQuery.highlight(this,re,settings.element,settings.className);});};(function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Typed=e():t.Typed=e()})(this,function(){return function(t){function e(n){if(s[n])return s[n].exports;var i=s[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var s={};return e.m=t,e.c=s,e.p="",e(0)}([function(t,e,s){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var s=0;s<e.length;s++){var n=e[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,s,n){return s&&t(e.prototype,s),n&&t(e,n),e}}(),r=s(1),o=s(3),a=function(){function t(e,s){n(this,t),r.initializer.load(this,s,e),this.begin()}return i(t,[{key:"toggle",value:function(){this.pause.status?this.start():this.stop()}},{key:"stop",value:function(){this.typingComplete||this.pause.status||(this.toggleBlinking(!0),this.pause.status=!0,this.options.onStop(this.arrayPos,this))}},{key:"start",value:function(){this.typingComplete||this.pause.status&&(this.pause.status=!1,this.pause.typewrite?this.typewrite(this.pause.curString,this.pause.curStrPos):this.backspace(this.pause.curString,this.pause.curStrPos),this.options.onStart(this.arrayPos,this))}},{key:"destroy",value:function(){this.reset(!1),this.options.onDestroy(this)}},{key:"reset",value:function(){var t=arguments.length<=0||void 0===arguments[0]||arguments[0];clearInterval(this.timeout),this.replaceText(""),this.cursor&&this.cursor.parentNode&&(this.cursor.parentNode.removeChild(this.cursor),this.cursor=null),this.strPos=0,this.arrayPos=0,this.curLoop=0,t&&(this.insertCursor(),this.options.onReset(this),this.begin())}},{key:"begin",value:function(){var t=this;this.typingComplete=!1,this.shuffleStringsIfNeeded(this),this.insertCursor(),this.bindInputFocusEvents&&this.bindFocusEvents(),this.timeout=setTimeout(function(){t.currentElContent&&0!==t.currentElContent.length?t.backspace(t.currentElContent,t.currentElContent.length):t.typewrite(t.strings[t.sequence[t.arrayPos]],t.strPos)},this.startDelay)}},{key:"typewrite",value:function(t,e){var s=this;this.fadeOut&&this.el.classList.contains(this.fadeOutClass)&&(this.el.classList.remove(this.fadeOutClass),this.cursor&&this.cursor.classList.remove(this.fadeOutClass));var n=this.humanizer(this.typeSpeed),i=1;return this.pause.status===!0?void this.setPauseStatus(t,e,!0):void(this.timeout=setTimeout(function(){e=o.htmlParser.typeHtmlChars(t,e,s);var n=0,r=t.substr(e);if("^"===r.charAt(0)&&/^\^\d+/.test(r)){var a=1;r=/\d+/.exec(r)[0],a+=r.length,n=parseInt(r),s.temporaryPause=!0,s.options.onTypingPaused(s.arrayPos,s),t=t.substring(0,e)+t.substring(e+a),s.toggleBlinking(!0)}if("`"===r.charAt(0)){for(;"`"!==t.substr(e+i).charAt(0)&&(i++,!(e+i>t.length)););var u=t.substring(0,e),l=t.substring(u.length+1,e+i),c=t.substring(e+i+1);t=u+l+c,i--}s.timeout=setTimeout(function(){s.toggleBlinking(!1),e===t.length?s.doneTyping(t,e):s.keepTyping(t,e,i),s.temporaryPause&&(s.temporaryPause=!1,s.options.onTypingResumed(s.arrayPos,s))},n)},n))}},{key:"keepTyping",value:function(t,e,s){0===e&&(this.toggleBlinking(!1),this.options.preStringTyped(this.arrayPos,this)),e+=s;var n=t.substr(0,e);this.replaceText(n),this.typewrite(t,e)}},{key:"doneTyping",value:function(t,e){var s=this;this.options.onStringTyped(this.arrayPos,this),this.toggleBlinking(!0),this.arrayPos===this.strings.length-1&&(this.complete(),this.loop===!1||this.curLoop===this.loopCount)||(this.timeout=setTimeout(function(){s.backspace(t,e)},this.backDelay))}},{key:"backspace",value:function(t,e){var s=this;if(this.pause.status===!0)return void this.setPauseStatus(t,e,!0);if(this.fadeOut)return this.initFadeOut();this.toggleBlinking(!1);var n=this.humanizer(this.backSpeed);this.timeout=setTimeout(function(){e=o.htmlParser.backSpaceHtmlChars(t,e,s);var n=t.substr(0,e);if(s.replaceText(n),s.smartBackspace){var i=s.strings[s.arrayPos+1];i&&n===i.substr(0,e)?s.stopNum=e:s.stopNum=0}e>s.stopNum?(e--,s.backspace(t,e)):e<=s.stopNum&&(s.arrayPos++,s.arrayPos===s.strings.length?(s.arrayPos=0,s.options.onLastStringBackspaced(),s.shuffleStringsIfNeeded(),s.begin()):s.typewrite(s.strings[s.sequence[s.arrayPos]],e))},n)}},{key:"complete",value:function(){this.options.onComplete(this),this.loop?this.curLoop++:this.typingComplete=!0}},{key:"setPauseStatus",value:function(t,e,s){this.pause.typewrite=s,this.pause.curString=t,this.pause.curStrPos=e}},{key:"toggleBlinking",value:function(t){this.cursor&&(this.pause.status||this.cursorBlinking!==t&&(this.cursorBlinking=t,t?this.cursor.classList.add("typed-cursor--blink"):this.cursor.classList.remove("typed-cursor--blink")))}},{key:"humanizer",value:function(t){return Math.round(Math.random()*t/2)+t}},{key:"shuffleStringsIfNeeded",value:function(){this.shuffle&&(this.sequence=this.sequence.sort(function(){return Math.random()-.5}))}},{key:"initFadeOut",value:function(){var t=this;return this.el.className+=" "+this.fadeOutClass,this.cursor&&(this.cursor.className+=" "+this.fadeOutClass),setTimeout(function(){t.arrayPos++,t.replaceText(""),t.strings.length>t.arrayPos?t.typewrite(t.strings[t.sequence[t.arrayPos]],0):(t.typewrite(t.strings[0],0),t.arrayPos=0)},this.fadeOutDelay)}},{key:"replaceText",value:function(t){this.attr?this.el.setAttribute(this.attr,t):this.isInput?this.el.value=t:"html"===this.contentType?this.el.innerHTML=t:this.el.textContent=t}},{key:"bindFocusEvents",value:function(){var t=this;this.isInput&&(this.el.addEventListener("focus",function(e){t.stop()}),this.el.addEventListener("blur",function(e){t.el.value&&0!==t.el.value.length||t.start()}))}},{key:"insertCursor",value:function(){this.showCursor&&(this.cursor||(this.cursor=document.createElement("span"),this.cursor.className="typed-cursor",this.cursor.innerHTML=this.cursorChar,this.el.parentNode&&this.el.parentNode.insertBefore(this.cursor,this.el.nextSibling)))}}]),t}();e["default"]=a,t.exports=e["default"]},function(t,e,s){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},o=function(){function t(t,e){for(var s=0;s<e.length;s++){var n=e[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,s,n){return s&&t(e.prototype,s),n&&t(e,n),e}}(),a=s(2),u=n(a),l=function(){function t(){i(this,t)}return o(t,[{key:"load",value:function(t,e,s){if("string"==typeof s?t.el=document.querySelector(s):t.el=s,t.options=r({},u["default"],e),t.isInput="input"===t.el.tagName.toLowerCase(),t.attr=t.options.attr,t.bindInputFocusEvents=t.options.bindInputFocusEvents,t.showCursor=!t.isInput&&t.options.showCursor,t.cursorChar=t.options.cursorChar,t.cursorBlinking=!0,t.elContent=t.attr?t.el.getAttribute(t.attr):t.el.textContent,t.contentType=t.options.contentType,t.typeSpeed=t.options.typeSpeed,t.startDelay=t.options.startDelay,t.backSpeed=t.options.backSpeed,t.smartBackspace=t.options.smartBackspace,t.backDelay=t.options.backDelay,t.fadeOut=t.options.fadeOut,t.fadeOutClass=t.options.fadeOutClass,t.fadeOutDelay=t.options.fadeOutDelay,t.isPaused=!1,t.strings=t.options.strings.map(function(t){return t.trim()}),"string"==typeof t.options.stringsElement?t.stringsElement=document.querySelector(t.options.stringsElement):t.stringsElement=t.options.stringsElement,t.stringsElement){t.strings=[],t.stringsElement.style.display="none";var n=Array.prototype.slice.apply(t.stringsElement.children),i=n.length;if(i)for(var o=0;o<i;o+=1){var a=n[o];t.strings.push(a.innerHTML.trim())}}t.strPos=0,t.arrayPos=0,t.stopNum=0,t.loop=t.options.loop,t.loopCount=t.options.loopCount,t.curLoop=0,t.shuffle=t.options.shuffle,t.sequence=[],t.pause={status:!1,typewrite:!0,curString:"",curStrPos:0},t.typingComplete=!1;for(var o in t.strings)t.sequence[o]=o;t.currentElContent=this.getCurrentElContent(t),t.autoInsertCss=t.options.autoInsertCss,this.appendAnimationCss(t)}},{key:"getCurrentElContent",value:function(t){var e="";return e=t.attr?t.el.getAttribute(t.attr):t.isInput?t.el.value:"html"===t.contentType?t.el.innerHTML:t.el.textContent}},{key:"appendAnimationCss",value:function(t){var e="data-typed-js-css";if(t.autoInsertCss&&(t.showCursor||t.fadeOut)&&!document.querySelector("["+e+"]")){var s=document.createElement("style");s.type="text/css",s.setAttribute(e,!0);var n="";t.showCursor&&(n+="\n        .typed-cursor{\n          opacity: 1;\n        }\n        .typed-cursor.typed-cursor--blink{\n          animation: typedjsBlink 0.7s infinite;\n          -webkit-animation: typedjsBlink 0.7s infinite;\n                  animation: typedjsBlink 0.7s infinite;\n        }\n        @keyframes typedjsBlink{\n          50% { opacity: 0.0; }\n        }\n        @-webkit-keyframes typedjsBlink{\n          0% { opacity: 1; }\n          50% { opacity: 0.0; }\n          100% { opacity: 1; }\n        }\n      "),t.fadeOut&&(n+="\n        .typed-fade-out{\n          opacity: 0;\n          transition: opacity .25s;\n        }\n        .typed-cursor.typed-cursor--blink.typed-fade-out{\n          -webkit-animation: 0;\n          animation: 0;\n        }\n      "),0!==s.length&&(s.innerHTML=n,document.body.appendChild(s))}}}]),t}();e["default"]=l;var c=new l;e.initializer=c},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s={strings:["These are the default values...","You know what you should do?","Use your own!","Have a great day!"],stringsElement:null,typeSpeed:0,startDelay:0,backSpeed:0,smartBackspace:!0,shuffle:!1,backDelay:700,fadeOut:!1,fadeOutClass:"typed-fade-out",fadeOutDelay:500,loop:!1,loopCount:1/0,showCursor:!0,cursorChar:"|",autoInsertCss:!0,attr:null,bindInputFocusEvents:!1,contentType:"html",onComplete:function(t){},preStringTyped:function(t,e){},onStringTyped:function(t,e){},onLastStringBackspaced:function(t){},onTypingPaused:function(t,e){},onTypingResumed:function(t,e){},onReset:function(t){},onStop:function(t,e){},onStart:function(t,e){},onDestroy:function(t){}};e["default"]=s,t.exports=e["default"]},function(t,e){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var s=0;s<e.length;s++){var n=e[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,s,n){return s&&t(e.prototype,s),n&&t(e,n),e}}(),i=function(){function t(){s(this,t)}return n(t,[{key:"typeHtmlChars",value:function(t,e,s){if("html"!==s.contentType)return e;var n=t.substr(e).charAt(0);if("<"===n||"&"===n){var i="";for(i="<"===n?">":";";t.substr(e+1).charAt(0)!==i&&(e++,!(e+1>t.length)););e++}return e}},{key:"backSpaceHtmlChars",value:function(t,e,s){if("html"!==s.contentType)return e;var n=t.substr(e).charAt(0);if(">"===n||";"===n){var i="";for(i=">"===n?"<":"&";t.substr(e-1).charAt(0)!==i&&(e--,!(e<0)););e--}return e}}]),t}();e["default"]=i;var r=new i;e.htmlParser=r}])});(function(_,$){var isCheckoutScriptLoaded,validationLoop,isPlaceOrderAllowed,orderId;var methods={setSubmitButtonId:function(buttonId){var newButtonId=buttonId+'_'+Date.now();var $button=$('#'+buttonId);$button.attr('id',newButtonId);return newButtonId;},getOrderPlacementRequest:function($paymentForm){var formData={is_ajax:1,custom_paypal_button:1};var fields=$paymentForm.serializeArray();for(var i in fields){formData[fields[i].name]=fields[i].value;}
formData.result_ids=null;return formData;},setupPaymentForm:function(params){params=params||{};params.payment_form=params.payment_form||null;params.submit_button_id=params.submit_button_id||'';params.style=params.style||{};params.style.layout=params.style.layout||'vertical';params.style.color=params.style.color||'gold';params.style.height=params.style.height||40;params.style.shape=params.style.shape||'rect';params.style.label=params.style.label||'pay';params.style.tagline=params.style.tagline||false;methods.stopValidation();methods.createPaymentButtonsContainer(params.submit_button_id);paypal.Buttons({style:params.style,onInit:function(data,actions){methods.forbidOrderPlacement(actions);methods.startValidation(params.payment_form,actions);},onClick:function(data,actions){params.payment_form.ceFormValidator('checkFields',false);},createOrder:function(data,actions){var deferredOrder=$.Deferred();orderId=null;$.ceAjax('request',fn_url('checkout.place_order'),{data:methods.getOrderPlacementRequest(params.payment_form),method:'post',hidden:true,caching:false,callback:function(res){if(res.error){deferredOrder.reject(res);return;}
if(res.order_id_in_paypal){orderId=res.order_id;deferredOrder.resolve(res);return;}
deferredOrder.reject({error:''});}});return deferredOrder.promise().then(function(success){return success.order_id_in_paypal;},function(fail){new Error(fail.error);});},onApprove:function(data,actions){$.toggleStatusBox('show');var redirectUrl=fn_url('payment_notification.return'+'?order_id='+orderId+'&order_id_in_paypal='+data.orderID+'&payment=paypal_checkout');actions.redirect(redirectUrl);}}).render('#'+params.submit_button_id+'_container').catch(()=>{});},getSmartButtonsLoadOptions:function($payment){return{clientId:$payment.data('caPaypalCheckoutClientId'),currency:$payment.data('caPaypalCheckoutCurrency'),disableFunding:$payment.data('caPaypalCheckoutDisableFunding'),debug:$payment.data('caPaypalCheckoutDebug')};},getSmartButtonsLoadUrl:function(options){var url='https://www.paypal.com/sdk/js'+'?client-id='+options.clientId+'&components=buttons'+'&currency='+options.currency+'&debug='+(options.debug?'true':'false')+'&intent=capture'+'&commit=true'+'&integration-date=2022-10-10';if(options.disableFunding){url+='&disable-funding='+options.disableFunding;}
return url;},init:function($payment){var $payment_form=$payment.closest('form');var submitButtonId=methods.setSubmitButtonId($payment.data('caPaypalCheckoutButton')),$submitButton=$('#'+submitButtonId);$submitButton.addClass('hidden');var checkoutScriptLoadCallback=function(){isCheckoutScriptLoaded=true;methods.setupWindowClosedErrorHandler(window);methods.setupPaymentForm({payment_form:$payment_form,submit_button_id:submitButtonId,style:{layout:$payment.data('caPaypalCheckoutStyleLayout'),color:$payment.data('caPaypalCheckoutStyleColor'),height:$payment.data('caPaypalCheckoutStyleHeight'),shape:$payment.data('caPaypalCheckoutStyleShape'),label:$payment.data('caPaypalCheckoutStyleLabel'),tagline:$payment.data('caPaypalCheckoutStyleTagline')}});};if(isCheckoutScriptLoaded){checkoutScriptLoadCallback();}else{var options=methods.getSmartButtonsLoadOptions($payment),url=methods.getSmartButtonsLoadUrl(options);methods.loadScript(url,checkoutScriptLoadCallback);}},forbidOrderPlacement(actions){isPlaceOrderAllowed=false;actions.disable();},allowOrderPlacement(actions){isPlaceOrderAllowed=true;actions.enable();},startValidation($paymentForm,actions){validationLoop=setInterval(function(){var formIsValid=$paymentForm.ceFormValidator('checkFields',true);if(formIsValid&&!isPlaceOrderAllowed){methods.allowOrderPlacement(actions);}else if(!formIsValid&&isPlaceOrderAllowed){methods.forbidOrderPlacement(actions);}},300);},stopValidation(){if(validationLoop){clearInterval(validationLoop);}},createPaymentButtonsContainer(submitButtonId){$('<div class="ty-paypal-checkout-buttons-container" id="'+submitButtonId+'_container"></div>').insertAfter($('#'+submitButtonId));},setupWindowClosedErrorHandler(window){window.onerror=function(message,source,lineno,colno,error){console.log(message,source,lineno,colno,error);};},loadScript(url,checkoutScriptLoadCallback){var checkoutScript=_.doc.createElement('script');checkoutScript.setAttribute('src',url);checkoutScript.setAttribute('data-partner-attribution-id','CSCART_PPC');checkoutScript.onload=checkoutScriptLoadCallback;_.doc.head.appendChild(checkoutScript);}};$.extend({cePaypalCheckout:function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1));}else{$.error('ty.paypalCheckout: method '+method+' does not exist');}}});$.ceEvent('on','ce.commoninit',function(context){if(_.embedded){return;}
var isCheckoutButtonLoaded=!!$('[name="dispatch[checkout.place_order]"]',context).length;if(!isCheckoutButtonLoaded){return;}
var $payment=$('[data-ca-paypal-checkout]');if(!$payment.length){return;}
$.cePaypalCheckout('init',$payment);});})(Tygh,Tygh.$);(function(_,$){var is_paypal_script_loaded;var methods={set_submit_button_id:function set_submit_button_id(button_id){var button_id_new=button_id+'_'+Date.now();var button=$('#'+button_id);button.attr('id',button_id_new);return button_id_new;},get_token_request:function get_token_request(payment_form){var form_data={in_context_order:1};var fields=payment_form.serializeArray();for(var i in fields){form_data[fields[i].name]=fields[i].value;}
form_data.result_ids=null;return form_data;},set_window_close_error_handler:function set_window_close_error_handler(){window.onerror=function(e){$.redirect(_.current_url);};},setup_payment_form:function setup_payment_form(params){params=params||{};params.merchat_id=params.merchat_id||'';params.environment=params.environment||'sandbox';params.payment_form=params.payment_form||null;params.submit_button_id=params.submit_button_id||'';paypal.checkout.setup(params.merchat_id,{environment:params.environment,buttons:[{button:params.submit_button_id,condition:function condition(){return $.ceFormValidator('check',{form:params.payment_form});},click:function click(e){e.preventDefault();var form_data=methods.get_token_request(params.payment_form);paypal.checkout.initXO();$.ceAjax('request',fn_url('checkout.place_order'),{method:'post',data:form_data,callback:function callback(response){try{if(response.token){var url=paypal.checkout.urlPrefix+response.token+'&useraction=commit';paypal.checkout.startFlow(url);}
if(response.error){paypal.checkout.closeFlow();}}catch(ex){paypal.checkout.initXO();}},hidden:true,cache:false});}}]});},init:function init(jelm){var payment_form=jelm.closest('form');var submit_button_id=methods.set_submit_button_id(jelm.data('caPaypalButton'));methods.set_window_close_error_handler();var paypal_script_load_callback=function paypal_script_load_callback(){is_paypal_script_loaded=true;var paypal_presence_checker=setInterval(function(){if(typeof paypal!=='undefined'){clearInterval(paypal_presence_checker);methods.setup_payment_form({merchant_id:jelm.data('caPaypalMerchantId'),environment:jelm.data('caPaypalEnvironment'),payment_form:payment_form,submit_button_id:submit_button_id});}},300);};if(is_paypal_script_loaded){paypal_script_load_callback();}else{$.getScript('//www.paypalobjects.com/api/checkout.min.js',paypal_script_load_callback);}}};$.extend({cePaypalInContextCheckout:function cePaypalInContextCheckout(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1));}else{$.error('ty.paypalInContextCheckout: method '+method+' does not exist');}}});$.ceEvent('on','ce.commoninit',function(){if(_.embedded){return;}
var jelm=$('[data-ca-paypal-in-context-checkout]');if(jelm.length){$.cePaypalInContextCheckout('init',jelm);}});})(Tygh,Tygh.$);(function(_,$){var i={length:0},valid_vat_required=false,old_vat='';$(document).bind('ajaxComplete',function(e,res,params){if(i.length&&res.responseText&&res.responseText.substring(0,1)=='{'){var response=JSON.parse(res.responseText);if(response.notifications){$.ceNotification('showMany',response.notifications);}
if(response.needs_reload){location.reload();return;}
if(response.vat_note){i.after(response.vat_note);}
if(response.vies_notif_error){i.addClass('cm-failed-field');}
if(valid_vat_required&&!response.eu_vat_incomplete){if(!response.vies_valid){i.addClass('cm-failed-field');$('#litecheckout_place_order').prop('disabled',true).addClass('disabled');}else{$('#litecheckout_place_order').prop('disabled',false).removeClass('disabled');}}
$('#litecheckout_intracom_vat_old').remove();old_vat=i.val();}});$.ceEvent('on','ce.commoninit',function(context){var newi=$('#litecheckout_intracom_vat',context);if(newi.length){i=newi;old_vat=i.val();valid_vat_required=i.data('valid_vat_required');var vies_valid=i.data('vies_valid');if(valid_vat_required&&!vies_valid){$('#litecheckout_place_order').prop('disabled',true).addClass('disabled');}
i.on('change',function(e){i.removeClass('cm-failed-field');i.parent().find('.help-inline').remove();i.after('<input type="hidden" name="user_data[intracom_vat_old]" id="litecheckout_intracom_vat_old" data-ca-lite-checkout-field="user_data.intracom_vat_old" value="'+old_vat+'">');});}});})(Tygh,Tygh.$);(function(_,$){$(document).ready(function(){$(_.doc).on('click','.cm-news-subscribe',function(e){var elms=$(this).parents('.subscription-container').find('.cm-news-subscribe');var params='';var all_mailing_lists='';if(elms.length>0){elms.each(function(){if($(this).prop('name').length>0){if($(this).prop('checked')){params+=$(this).prop('name')+'='+$(this).val()+'&';}else{all_mailing_lists+='all_mailing_lists'+'='+$(this).val()+'&';}}});}
if(!params){params='mailing_lists=';}
if(!all_mailing_lists){params+='&all_mailing_lists=';}else{all_mailing_lists='&'+all_mailing_lists;params+=all_mailing_lists;}
$.ceAjax('request',fn_url('checkout.subscribe_customer?'+params),{method:'post',result_ids:'subsciption*'});});});$.ceEvent('on','ce.commoninit',function(context){var $newsletter_togglers=$('[data-ca-lite-checkout-element="newsletter-toggler"]',context);if(!$newsletter_togglers.length){return;}
$newsletter_togglers.on('change',function(){var $checkbox=$(this);$.ceLiteCheckout('updateCustomerInfo',function(data){if(data.user_data.email){var connected_checkbox_id=$checkbox.data('caTargetId');$('#'+connected_checkbox_id).trigger('click');}},false);});});})(Tygh,Tygh.$);(function(_,$){$.ceEvent('on','ce.pd_change_view',function(){fn_close_visible_video_panel();});$(document).ready(function(){if($('.product-video-popup').length){$(window).resize(function(e){var popups=$('.product-video-popup:visible');if(popups.length){popups.each(function(){fn_show_video_panel($(this),false);});}});if($('.cm-thumbnails-mini').length){$('.cm-thumbnails-mini:not(.video-thumb)').on('click',function(){fn_close_visible_video_panel();});}
if($('.cm-close-video').length){$('.cm-close-video').on('click',function(){fn_close_visible_video_panel();if($('.side-th').length){$('.side-th').removeClass('current-view');}});}}});}(Tygh,Tygh.$));function fn_show_video_panel(popup,th){if(product_mode!='sticker'){cur_view=-1;}
if(th){fn_close_visible_video_panel();}
var _cnvs=$('#pd_canvas').length?$('#pd_canvas'):$('.ty-product-img'),offset=_cnvs.offset();if(!popup.parent().is('body')){$('body').prepend(popup);}
popup.width(_cnvs.outerWidth());popup.height(_cnvs.outerHeight());popup.css('top',offset.top);popup.css('left',offset.left);$('.cm-close-video',popup).css('display',$('#pd_canvas').length&&product_mode=='sticker'?'block':'none');popup.show();if(th){if($('.side-th').length){$('.side-th').removeClass('current-view');$(th).addClass('current-view');}else{$('.cm-thumbnails-mini').removeClass('active');$(th).addClass('active');}}}
function fn_close_visible_video_panel(){var popups=$('.product-video-popup:visible');if(popups.length){popups.each(function(){var self=$(this),v=$('video',self);self.hide();if(v.length){v.get(0).pause();}else{$('body').prepend($(this));}});}}(function(_,$){window.onRecaptchaV2Loaded=function(){_.onRecaptchaV2Loaded();};window.onRecaptchaV3Loaded=function(){_.onRecaptchaV3Loaded();};var pluginName="ceRecaptcha";$.extend(_,{recaptchaV2Loaded:false,recaptchaV3Loaded:false,recaptchaV3Token:'',recaptchaV2InitQueue:[],onRecaptchaV2Loaded:function onRecaptchaV2Loaded(){this.recaptchaV2Loaded=true;if(this.recaptchaV2InitQueue.length){$.each(this.recaptchaV2InitQueue,function(a,b){$(this).ceRecaptcha();});}},onRecaptchaV3Loaded:function onRecaptchaV3Loaded(){this.recaptchaV3Loaded=true;grecaptcha.execute(_.google_recaptcha_v3_site_key,{action:'google_recaptcha'}).then(function(token){if(token){$('.cm-recaptcha-v3').val(token);_.recaptchaV3Token=token;var req={};req[_.google_recaptcha_v3_token_param]=token;req['validate_token']=true;$.ceAjax('request',fn_url('antibot.valid_recaptcha'),{method:'POST',caching:false,hidden:true,data:req});}});}});$.ceEvent('on','ce.commoninit',function(context){var recaptchaV3=$(context).find('.cm-recaptcha-v3');var recaptchaV2=$(context).find('.cm-recaptcha');if(recaptchaV3.length>0){if(_.recaptchaV3Loaded===false){$.getScript('https://www.google.com/recaptcha/api.js?onload=onRecaptchaV3Loaded&render='+_.google_recaptcha_v3_site_key);}else{$(recaptchaV3).val(_.recaptchaV3Token);}}
if(recaptchaV2.length>0){if(_.recaptchaV2Loaded===false){$.getScript('https://www.google.com/recaptcha/api.js?onload=onRecaptchaV2Loaded&render=explicit');}
$.ceFormValidator('registerValidator',{class_name:'cm-recaptcha','func':function func(recaptcha_container_id,$container,$label){var recaptcha=$.data($container[0],"plugin_"+pluginName);if(recaptcha instanceof ReCaptcha){return recaptcha.checkIsValidationPassed();}
return true;},message:_.tr('error_validator_recaptcha')});$('.cm-recaptcha:not(label)',context).ceRecaptcha();}});function ReCaptcha(element,options){this.$el=$(element);this.$input=null;this.settings=$.extend({},_.recaptcha_settings,options);this.grecaptcha=null;this.isValidationPassed=null;}
$.extend(ReCaptcha.prototype,{init:function init(grecaptcha){this.grecaptcha=grecaptcha;this.isValidationPassed=false;this.render();},render:function render(){var self=this;grecaptcha.render(this.$el[0],{sitekey:this.settings.site_key,theme:this.settings.theme,size:this.settings.size,callback:function callback(response){self.isValidationPassed=true;$.ceEvent('trigger','ce.image_verification.passed',[response,self.$input]);},'expired-callback':function expiredCallback(){self.isValidationPassed=false;$.ceEvent('trigger','ce.image_verification.failed',[self.$input]);}});this.$input=this.$el.find('[name="'+_.google_recaptcha_v2_token_param+'"]');$.ceEvent('trigger','ce.image_verification.ready',[_.google_recaptcha_v2_token_param,this.$input]);if($.ceDialog('inside_dialog',{jelm:this.$input})){$.ceDialog('reload_parent',{jelm:this.$input});}},checkIsValidationPassed:function checkIsValidationPassed(){return this.isValidationPassed;}});$.fn[pluginName]=function(options){var self=this,createPluginInstances=function createPluginInstances(){return self.each(function(){var recaptcha,$el=$(this),el_id=$el.attr('id');if(!el_id){return;}
if(_.recaptchaV2Loaded){if(!$.data(this,"plugin_"+pluginName)){recaptcha=new ReCaptcha(this,options);recaptcha.init(window.grecaptcha);$.data(this,"plugin_"+pluginName,recaptcha);}}else{_.recaptchaV2InitQueue.push($el);}});};if(this.length){return createPluginInstances();}
return this;};})(Tygh,Tygh.$);!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(V){"use strict";V.ui=V.ui||{};V.ui.version="1.13.0";var n,i=0,a=Array.prototype.hasOwnProperty,r=Array.prototype.slice;V.cleanData=(n=V.cleanData,function(t){for(var e,i,s=0;null!=(i=t[s]);s++)(e=V._data(i,"events"))&&e.remove&&V(i).triggerHandler("remove");n(t)}),V.widget=function(t,i,e){var s,n,o,a={},r=t.split(".")[0],l=r+"-"+(t=t.split(".")[1]);return e||(e=i,i=V.Widget),Array.isArray(e)&&(e=V.extend.apply(null,[{}].concat(e))),V.expr.pseudos[l.toLowerCase()]=function(t){return!!V.data(t,l)},V[r]=V[r]||{},s=V[r][t],n=V[r][t]=function(t,e){if(!this._createWidget)return new n(t,e);arguments.length&&this._createWidget(t,e)},V.extend(n,s,{version:e.version,_proto:V.extend({},e),_childConstructors:[]}),(o=new i).options=V.widget.extend({},o.options),V.each(e,function(e,s){function n(){return i.prototype[e].apply(this,arguments)}function o(t){return i.prototype[e].apply(this,t)}a[e]="function"==typeof s?function(){var t,e=this._super,i=this._superApply;return this._super=n,this._superApply=o,t=s.apply(this,arguments),this._super=e,this._superApply=i,t}:s}),n.prototype=V.widget.extend(o,{widgetEventPrefix:s&&o.widgetEventPrefix||t},a,{constructor:n,namespace:r,widgetName:t,widgetFullName:l}),s?(V.each(s._childConstructors,function(t,e){var i=e.prototype;V.widget(i.namespace+"."+i.widgetName,n,e._proto)}),delete s._childConstructors):i._childConstructors.push(n),V.widget.bridge(t,n),n},V.widget.extend=function(t){for(var e,i,s=r.call(arguments,1),n=0,o=s.length;n<o;n++)for(e in s[n])i=s[n][e],a.call(s[n],e)&&void 0!==i&&(V.isPlainObject(i)?t[e]=V.isPlainObject(t[e])?V.widget.extend({},t[e],i):V.widget.extend({},i):t[e]=i);return t},V.widget.bridge=function(o,e){var a=e.prototype.widgetFullName||o;V.fn[o]=function(i){var t="string"==typeof i,s=r.call(arguments,1),n=this;return t?this.length||"instance"!==i?this.each(function(){var t,e=V.data(this,a);return"instance"===i?(n=e,!1):e?"function"!=typeof e[i]||"_"===i.charAt(0)?V.error("no such method '"+i+"' for "+o+" widget instance"):(t=e[i].apply(e,s))!==e&&void 0!==t?(n=t&&t.jquery?n.pushStack(t.get()):t,!1):void 0:V.error("cannot call methods on "+o+" prior to initialization; attempted to call method '"+i+"'")}):n=void 0:(s.length&&(i=V.widget.extend.apply(null,[i].concat(s))),this.each(function(){var t=V.data(this,a);t?(t.option(i||{}),t._init&&t._init()):V.data(this,a,new e(i,this))})),n}},V.Widget=function(){},V.Widget._childConstructors=[],V.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=V(e||this.defaultElement||this)[0],this.element=V(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=V(),this.hoverable=V(),this.focusable=V(),this.classesElementLookup={},e!==this&&(V.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=V(e.style?e.ownerDocument:e.document||e),this.window=V(this.document[0].defaultView||this.document[0].parentWindow)),this.options=V.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:V.noop,_create:V.noop,_init:V.noop,destroy:function(){var i=this;this._destroy(),V.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:V.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return V.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t]=V.widget.extend({},this.options[t]),n=0;n<i.length-1;n++)s[i[n]]=s[i[n]]||{},s=s[i[n]];if(t=i.pop(),1===arguments.length)return void 0===s[t]?null:s[t];s[t]=e}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=e}return this._setOptions(o),this},_setOptions:function(t){for(var e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(t){var e,i,s;for(e in t)s=this.classesElementLookup[e],t[e]!==this.options.classes[e]&&s&&s.length&&(i=V(s.get()),this._removeClass(s,e),i.addClass(this._classes({element:i,keys:e,classes:t,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(n){var o=[],a=this;function t(t,e){for(var i,s=0;s<t.length;s++)i=a.classesElementLookup[t[s]]||V(),i=n.add?(n.element.each(function(t,e){V.map(a.classesElementLookup,function(t){return t}).some(function(t){return t.is(e)})||a._on(V(e),{remove:"_untrackClassesElement"})}),V(V.uniqueSort(i.get().concat(n.element.get())))):V(i.not(n.element).get()),a.classesElementLookup[t[s]]=i,o.push(t[s]),e&&n.classes[t[s]]&&o.push(n.classes[t[s]])}return(n=V.extend({element:this.element,classes:this.options.classes||{}},n)).keys&&t(n.keys.match(/\S+/g)||[],!0),n.extra&&t(n.extra.match(/\S+/g)||[]),o.join(" ")},_untrackClassesElement:function(i){var s=this;V.each(s.classesElementLookup,function(t,e){-1!==V.inArray(i.target,e)&&(s.classesElementLookup[t]=V(e.not(i.target).get()))}),this._off(V(i.target))},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){var n="string"==typeof t||null===t,i={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s="boolean"==typeof s?s:i};return i.element.toggleClass(this._classes(i),s),this},_on:function(n,o,t){var a,r=this;"boolean"!=typeof n&&(t=o,o=n,n=!1),t?(o=a=V(o),this.bindings=this.bindings.add(o)):(t=o,o=this.element,a=this.widget()),V.each(t,function(t,e){function i(){if(n||!0!==r.options.disabled&&!V(this).hasClass("ui-state-disabled"))return("string"==typeof e?r[e]:e).apply(r,arguments)}"string"!=typeof e&&(i.guid=e.guid=e.guid||i.guid||V.guid++);var s=t.match(/^([\w:-]*)\s*(.*)$/),t=s[1]+r.eventNamespace,s=s[2];s?a.on(t,s,i):o.on(t,i)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.off(e),this.bindings=V(this.bindings.not(t).get()),this.focusable=V(this.focusable.not(t).get()),this.hoverable=V(this.hoverable.not(t).get())},_delay:function(t,e){var i=this;return setTimeout(function(){return("string"==typeof t?i[t]:t).apply(i,arguments)},e||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){this._addClass(V(t.currentTarget),null,"ui-state-hover")},mouseleave:function(t){this._removeClass(V(t.currentTarget),null,"ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){this._addClass(V(t.currentTarget),null,"ui-state-focus")},focusout:function(t){this._removeClass(V(t.currentTarget),null,"ui-state-focus")}})},_trigger:function(t,e,i){var s,n,o=this.options[t];if(i=i||{},(e=V.Event(e)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),e.target=this.element[0],n=e.originalEvent)for(s in n)s in e||(e[s]=n[s]);return this.element.trigger(e,i),!("function"==typeof o&&!1===o.apply(this.element[0],[e].concat(i))||e.isDefaultPrevented())}},V.each({show:"fadeIn",hide:"fadeOut"},function(o,a){V.Widget.prototype["_"+o]=function(e,t,i){var s,n=(t="string"==typeof t?{effect:t}:t)?!0!==t&&"number"!=typeof t&&t.effect||a:o;"number"==typeof(t=t||{})?t={duration:t}:!0===t&&(t={}),s=!V.isEmptyObject(t),t.complete=i,t.delay&&e.delay(t.delay),s&&V.effects&&V.effects.effect[n]?e[o](t):n!==o&&e[n]?e[n](t.duration,t.easing,i):e.queue(function(t){V(this)[o](),i&&i.call(e[0]),t()})}});var s,x,k,o,l,h,c,u,C;V.widget;function D(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function I(t,e){return parseInt(V.css(t,e),10)||0}function T(t){return null!=t&&t===t.window}x=Math.max,k=Math.abs,o=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,C=V.fn.position,V.position={scrollbarWidth:function(){if(void 0!==s)return s;var t,e=V("<div style='display:block;position:absolute;width:200px;height:200px;overflow:hidden;'><div style='height:300px;width:auto;'></div></div>"),i=e.children()[0];return V("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),s=t-i},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.width<t.element[0].scrollWidth;return{width:"scroll"===i||"auto"===i&&t.height<t.element[0].scrollHeight?V.position.scrollbarWidth():0,height:e?V.position.scrollbarWidth():0}},getWithinInfo:function(t){var e=V(t||window),i=T(e[0]),s=!!e[0]&&9===e[0].nodeType;return{element:e,isWindow:i,isDocument:s,offset:!i&&!s?V(t).offset():{left:0,top:0},scrollLeft:e.scrollLeft(),scrollTop:e.scrollTop(),width:e.outerWidth(),height:e.outerHeight()}}},V.fn.position=function(u){if(!u||!u.of)return C.apply(this,arguments);var d,p,f,g,m,t,_="string"==typeof(u=V.extend({},u)).of?V(document).find(u.of):V(u.of),v=V.position.getWithinInfo(u.within),b=V.position.getScrollInfo(v),y=(u.collision||"flip").split(" "),w={},e=9===(t=(e=_)[0]).nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:T(t)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:t.preventDefault?{width:0,height:0,offset:{top:t.pageY,left:t.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()};return _[0].preventDefault&&(u.at="left top"),p=e.width,f=e.height,m=V.extend({},g=e.offset),V.each(["my","at"],function(){var t,e,i=(u[this]||"").split(" ");(i=1===i.length?o.test(i[0])?i.concat(["center"]):l.test(i[0])?["center"].concat(i):["center","center"]:i)[0]=o.test(i[0])?i[0]:"center",i[1]=l.test(i[1])?i[1]:"center",t=h.exec(i[0]),e=h.exec(i[1]),w[this]=[t?t[0]:0,e?e[0]:0],u[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===y.length&&(y[1]=y[0]),"right"===u.at[0]?m.left+=p:"center"===u.at[0]&&(m.left+=p/2),"bottom"===u.at[1]?m.top+=f:"center"===u.at[1]&&(m.top+=f/2),d=D(w.at,p,f),m.left+=d[0],m.top+=d[1],this.each(function(){var i,t,a=V(this),r=a.outerWidth(),l=a.outerHeight(),e=I(this,"marginLeft"),s=I(this,"marginTop"),n=r+e+I(this,"marginRight")+b.width,o=l+s+I(this,"marginBottom")+b.height,h=V.extend({},m),c=D(w.my,a.outerWidth(),a.outerHeight());"right"===u.my[0]?h.left-=r:"center"===u.my[0]&&(h.left-=r/2),"bottom"===u.my[1]?h.top-=l:"center"===u.my[1]&&(h.top-=l/2),h.left+=c[0],h.top+=c[1],i={marginLeft:e,marginTop:s},V.each(["left","top"],function(t,e){V.ui.position[y[t]]&&V.ui.position[y[t]][e](h,{targetWidth:p,targetHeight:f,elemWidth:r,elemHeight:l,collisionPosition:i,collisionWidth:n,collisionHeight:o,offset:[d[0]+c[0],d[1]+c[1]],my:u.my,at:u.at,within:v,elem:a})}),u.using&&(t=function(t){var e=g.left-h.left,i=e+p-r,s=g.top-h.top,n=s+f-l,o={target:{element:_,left:g.left,top:g.top,width:p,height:f},element:{element:a,left:h.left,top:h.top,width:r,height:l},horizontal:i<0?"left":0<e?"right":"center",vertical:n<0?"top":0<s?"bottom":"middle"};p<r&&k(e+i)<p&&(o.horizontal="center"),f<l&&k(s+n)<f&&(o.vertical="middle"),x(k(e),k(i))>x(k(s),k(n))?o.important="horizontal":o.important="vertical",u.using.call(this,t,o)}),a.offset(V.extend(h,{using:t}))})},V.ui.position={fit:{left:function(t,e){var i=e.within,s=i.isWindow?i.scrollLeft:i.offset.left,n=i.width,o=t.left-e.collisionPosition.marginLeft,a=s-o,r=o+e.collisionWidth-n-s;e.collisionWidth>n?0<a&&r<=0?(i=t.left+a+e.collisionWidth-n-s,t.left+=a-i):t.left=!(0<r&&a<=0)&&r<a?s+n-e.collisionWidth:s:0<a?t.left+=a:0<r?t.left-=r:t.left=x(t.left-o,t.left)},top:function(t,e){var i=e.within,s=i.isWindow?i.scrollTop:i.offset.top,n=e.within.height,o=t.top-e.collisionPosition.marginTop,a=s-o,r=o+e.collisionHeight-n-s;e.collisionHeight>n?0<a&&r<=0?(i=t.top+a+e.collisionHeight-n-s,t.top+=a-i):t.top=!(0<r&&a<=0)&&r<a?s+n-e.collisionHeight:s:0<a?t.top+=a:0<r?t.top-=r:t.top=x(t.top-o,t.top)}},flip:{left:function(t,e){var i=e.within,s=i.offset.left+i.scrollLeft,n=i.width,o=i.isWindow?i.scrollLeft:i.offset.left,a=t.left-e.collisionPosition.marginLeft,r=a-o,l=a+e.collisionWidth-n-o,h="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,i="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,a=-2*e.offset[0];r<0?((s=t.left+h+i+a+e.collisionWidth-n-s)<0||s<k(r))&&(t.left+=h+i+a):0<l&&(0<(o=t.left-e.collisionPosition.marginLeft+h+i+a-o)||k(o)<l)&&(t.left+=h+i+a)},top:function(t,e){var i=e.within,s=i.offset.top+i.scrollTop,n=i.height,o=i.isWindow?i.scrollTop:i.offset.top,a=t.top-e.collisionPosition.marginTop,r=a-o,l=a+e.collisionHeight-n-o,h="top"===e.my[1]?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,i="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,a=-2*e.offset[1];r<0?((s=t.top+h+i+a+e.collisionHeight-n-s)<0||s<k(r))&&(t.top+=h+i+a):0<l&&(0<(o=t.top-e.collisionPosition.marginTop+h+i+a-o)||k(o)<l)&&(t.top+=h+i+a)}},flipfit:{left:function(){V.ui.position.flip.left.apply(this,arguments),V.ui.position.fit.left.apply(this,arguments)},top:function(){V.ui.position.flip.top.apply(this,arguments),V.ui.position.fit.top.apply(this,arguments)}}};var t;V.ui.position,V.extend(V.expr.pseudos,{data:V.expr.createPseudo?V.expr.createPseudo(function(e){return function(t){return!!V.data(t,e)}}):function(t,e,i){return!!V.data(t,i[3])}}),V.fn.extend({disableSelection:(t="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.off(".ui-disableSelection")}});V.ui.focusable=function(t,e){var i,s,n,o,a=t.nodeName.toLowerCase();return"area"===a?(s=(i=t.parentNode).name,!(!t.href||!s||"map"!==i.nodeName.toLowerCase())&&(0<(s=V("img[usemap='#"+s+"']")).length&&s.is(":visible"))):(/^(input|select|textarea|button|object)$/.test(a)?(n=!t.disabled)&&(o=V(t).closest("fieldset")[0])&&(n=!o.disabled):n="a"===a&&t.href||e,n&&V(t).is(":visible")&&function(t){var e=t.css("visibility");for(;"inherit"===e;)t=t.parent(),e=t.css("visibility");return"visible"===e}(V(t)))},V.extend(V.expr.pseudos,{focusable:function(t){return V.ui.focusable(t,null!=V.attr(t,"tabindex"))}});var e,d;V.ui.focusable,V.fn._form=function(){return"string"==typeof this[0].form?this.closest("form"):V(this[0].form)},V.ui.formResetMixin={_formResetHandler:function(){var e=V(this);setTimeout(function(){var t=e.data("ui-form-reset-instances");V.each(t,function(){this.refresh()})})},_bindFormResetHandler:function(){var t;this.form=this.element._form(),this.form.length&&((t=this.form.data("ui-form-reset-instances")||[]).length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t))},_unbindFormResetHandler:function(){var t;this.form.length&&((t=this.form.data("ui-form-reset-instances")).splice(V.inArray(this,t),1),t.length?this.form.data("ui-form-reset-instances",t):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset"))}};V.expr.pseudos||(V.expr.pseudos=V.expr[":"]),V.uniqueSort||(V.uniqueSort=V.unique),V.escapeSelector||(e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,d=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},V.escapeSelector=function(t){return(t+"").replace(e,d)}),V.fn.even&&V.fn.odd||V.fn.extend({even:function(){return this.filter(function(t){return t%2==0})},odd:function(){return this.filter(function(t){return t%2==1})}});V.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},V.fn.labels=function(){var t,e,i;return this.length?this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(e=this.eq(0).parents("label"),(t=this.attr("id"))&&(i=(i=this.eq(0).parents().last()).add((i.length?i:this).siblings()),t="label[for='"+V.escapeSelector(t)+"']",e=e.add(i.find(t).addBack(t))),this.pushStack(e)):this.pushStack([])},V.fn.scrollParent=function(t){var e=this.css("position"),i="absolute"===e,s=t?/(auto|scroll|hidden)/:/(auto|scroll)/,t=this.parents().filter(function(){var t=V(this);return(!i||"static"!==t.css("position"))&&s.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==e&&t.length?t:V(this[0].ownerDocument||document)},V.extend(V.expr.pseudos,{tabbable:function(t){var e=V.attr(t,"tabindex"),i=null!=e;return(!i||0<=e)&&V.ui.focusable(t,i)}}),V.fn.extend({uniqueId:(p=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++p)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&V(this).removeAttr("id")})}}),V.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var p,f=!1;V(document).on("mouseup",function(){f=!1});V.widget("ui.mouse",{version:"1.13.0",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(t){if(!0===V.data(t.target,e.widgetName+".preventClickEvent"))return V.removeData(t.target,e.widgetName+".preventClickEvent"),t.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!f){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var e=this,i=1===t.which,s=!("string"!=typeof this.options.cancel||!t.target.nodeName)&&V(t.target).closest(this.options.cancel).length;return i&&!s&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=!1!==this._mouseStart(t),!this._mouseStarted)?(t.preventDefault(),!0):(!0===V.data(t.target,this.widgetName+".preventClickEvent")&&V.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return e._mouseMove(t)},this._mouseUpDelegate=function(t){return e._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),f=!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(V.ui.ie&&(!document.documentMode||document.documentMode<9)&&!t.button)return this._mouseUp(t);if(!t.which)if(t.originalEvent.altKey||t.originalEvent.ctrlKey||t.originalEvent.metaKey||t.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,t),this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&V.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,f=!1,t.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),V.ui.plugin={add:function(t,e,i){var s,n=V.ui[t].prototype;for(s in i)n.plugins[s]=n.plugins[s]||[],n.plugins[s].push([e,i[s]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;n<o.length;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},V.ui.safeActiveElement=function(e){var i;try{i=e.activeElement}catch(t){i=e.body}return i=!(i=i||e.body).nodeName?e.body:i},V.ui.safeBlur=function(t){t&&"body"!==t.nodeName.toLowerCase()&&V(t).trigger("blur")};V.widget("ui.draggable",V.ui.mouse,{version:"1.13.0",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){(this.helper||this.element).is(".ui-draggable-dragging")?this.destroyOnClear=!0:(this._removeHandleClassName(),this._mouseDestroy())},_mouseCapture:function(t){var e=this.options;return!(this.helper||e.disabled||0<V(t.target).closest(".ui-resizable-handle").length)&&(this.handle=this._getHandle(t),!!this.handle&&(this._blurActiveElement(t),this._blockFrames(!0===e.iframeFix?"iframe":e.iframeFix),!0))},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=V(this);return V("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var e=V.ui.safeActiveElement(this.document[0]);V(t.target).closest(e).length||V.ui.safeBlur(e)},_mouseStart:function(t){var e=this.options;return this.helper=this._createHelper(t),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),V.ui.ddmanager&&(V.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=0<this.helper.parents().filter(function(){return"fixed"===V(this).css("position")}).length,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this._setContainment(),!1===this._trigger("start",t)?(this._clear(),!1):(this._cacheHelperProportions(),V.ui.ddmanager&&!e.dropBehaviour&&V.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),V.ui.ddmanager&&V.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(t,e){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!e){e=this._uiHash();if(!1===this._trigger("drag",t,e))return this._mouseUp(new V.Event("mouseup",t)),!1;this.position=e.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",V.ui.ddmanager&&V.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var e=this,i=!1;return V.ui.ddmanager&&!this.options.dropBehaviour&&(i=V.ui.ddmanager.drop(this,t)),this.dropped&&(i=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!i||"valid"===this.options.revert&&i||!0===this.options.revert||"function"==typeof this.options.revert&&this.options.revert.call(this.element,i)?V(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){!1!==e._trigger("stop",t)&&e._clear()}):!1!==this._trigger("stop",t)&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),V.ui.ddmanager&&V.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.trigger("focus"),V.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new V.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(t){return!this.options.handle||!!V(t.target).closest(this.element.find(this.options.handle)).length},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(t){var e=this.options,i="function"==typeof e.helper,t=i?V(e.helper.apply(this.element[0],[t])):"clone"===e.helper?this.element.clone().removeAttr("id"):this.element;return t.parents("body").length||t.appendTo("parent"===e.appendTo?this.element[0].parentNode:e.appendTo),i&&t[0]===this.element[0]&&this._setPositionRelative(),t[0]===this.element[0]||/(fixed|absolute)/.test(t.css("position"))||t.css("position","absolute"),t},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),"left"in(t=Array.isArray(t)?{left:+t[0],top:+t[1]||0}:t)&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),e=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==e&&V.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),{top:(t=this._isRootNode(this.offsetParent[0])?{top:0,left:0}:t).top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,e,i,s=this.options,n=this.document[0];this.relativeContainer=null,s.containment?"window"!==s.containment?"document"!==s.containment?s.containment.constructor!==Array?("parent"===s.containment&&(s.containment=this.helper[0].parentNode),(i=(e=V(s.containment))[0])&&(t=/(scroll|auto)/.test(e.css("overflow")),this.containment=[(parseInt(e.css("borderLeftWidth"),10)||0)+(parseInt(e.css("paddingLeft"),10)||0),(parseInt(e.css("borderTopWidth"),10)||0)+(parseInt(e.css("paddingTop"),10)||0),(t?Math.max(i.scrollWidth,i.offsetWidth):i.offsetWidth)-(parseInt(e.css("borderRightWidth"),10)||0)-(parseInt(e.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(i.scrollHeight,i.offsetHeight):i.offsetHeight)-(parseInt(e.css("borderBottomWidth"),10)||0)-(parseInt(e.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=e)):this.containment=s.containment:this.containment=[0,0,V(n).width()-this.helperProportions.width-this.margins.left,(V(n).height()||n.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:this.containment=[V(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,V(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,V(window).scrollLeft()+V(window).width()-this.helperProportions.width-this.margins.left,V(window).scrollTop()+(V(window).height()||n.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:this.containment=null},_convertPositionTo:function(t,e){e=e||this.position;var i="absolute"===t?1:-1,t=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:t?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:t?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s=this.options,n=this._isRootNode(this.scrollParent[0]),o=t.pageX,a=t.pageY;return n&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(i=this.relativeContainer?(i=this.relativeContainer.offset(),[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]):this.containment,t.pageX-this.offset.click.left<i[0]&&(o=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(a=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(o=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(a=i[3]+this.offset.click.top)),s.grid&&(t=s.grid[1]?this.originalPageY+Math.round((a-this.originalPageY)/s.grid[1])*s.grid[1]:this.originalPageY,a=!i||t-this.offset.click.top>=i[1]||t-this.offset.click.top>i[3]?t:t-this.offset.click.top>=i[1]?t-s.grid[1]:t+s.grid[1],t=s.grid[0]?this.originalPageX+Math.round((o-this.originalPageX)/s.grid[0])*s.grid[0]:this.originalPageX,o=!i||t-this.offset.click.left>=i[0]||t-this.offset.click.left>i[2]?t:t-this.offset.click.left>=i[0]?t-s.grid[0]:t+s.grid[0]),"y"===s.axis&&(o=this.originalPageX),"x"===s.axis&&(a=this.originalPageY)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:n?0:this.offset.scroll.top),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:n?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(t,e,i){return i=i||this._uiHash(),V.ui.plugin.call(this,t,[e,i,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),i.offset=this.positionAbs),V.Widget.prototype._trigger.call(this,t,e,i)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),V.ui.plugin.add("draggable","connectToSortable",{start:function(e,t,i){var s=V.extend({},t,{item:i.element});i.sortables=[],V(i.options.connectToSortable).each(function(){var t=V(this).sortable("instance");t&&!t.options.disabled&&(i.sortables.push(t),t.refreshPositions(),t._trigger("activate",e,s))})},stop:function(e,t,i){var s=V.extend({},t,{item:i.element});i.cancelHelperRemoval=!1,V.each(i.sortables,function(){var t=this;t.isOver?(t.isOver=0,i.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,s))})},drag:function(i,s,n){V.each(n.sortables,function(){var t=!1,e=this;e.positionAbs=n.positionAbs,e.helperProportions=n.helperProportions,e.offset.click=n.offset.click,e._intersectsWith(e.containerCache)&&(t=!0,V.each(n.sortables,function(){return this.positionAbs=n.positionAbs,this.helperProportions=n.helperProportions,this.offset.click=n.offset.click,t=this!==e&&this._intersectsWith(this.containerCache)&&V.contains(e.element[0],this.element[0])?!1:t})),t?(e.isOver||(e.isOver=1,n._parent=s.helper.parent(),e.currentItem=s.helper.appendTo(e.element).data("ui-sortable-item",!0),e.options._helper=e.options.helper,e.options.helper=function(){return s.helper[0]},i.target=e.currentItem[0],e._mouseCapture(i,!0),e._mouseStart(i,!0,!0),e.offset.click.top=n.offset.click.top,e.offset.click.left=n.offset.click.left,e.offset.parent.left-=n.offset.parent.left-e.offset.parent.left,e.offset.parent.top-=n.offset.parent.top-e.offset.parent.top,n._trigger("toSortable",i),n.dropped=e.element,V.each(n.sortables,function(){this.refreshPositions()}),n.currentItem=n.element,e.fromOutside=n),e.currentItem&&(e._mouseDrag(i),s.position=e.position)):e.isOver&&(e.isOver=0,e.cancelHelperRemoval=!0,e.options._revert=e.options.revert,e.options.revert=!1,e._trigger("out",i,e._uiHash(e)),e._mouseStop(i,!0),e.options.revert=e.options._revert,e.options.helper=e.options._helper,e.placeholder&&e.placeholder.remove(),s.helper.appendTo(n._parent),n._refreshOffsets(i),s.position=n._generatePosition(i,!0),n._trigger("fromSortable",i),n.dropped=!1,V.each(n.sortables,function(){this.refreshPositions()}))})}}),V.ui.plugin.add("draggable","cursor",{start:function(t,e,i){var s=V("body"),i=i.options;s.css("cursor")&&(i._cursor=s.css("cursor")),s.css("cursor",i.cursor)},stop:function(t,e,i){i=i.options;i._cursor&&V("body").css("cursor",i._cursor)}}),V.ui.plugin.add("draggable","opacity",{start:function(t,e,i){e=V(e.helper),i=i.options;e.css("opacity")&&(i._opacity=e.css("opacity")),e.css("opacity",i.opacity)},stop:function(t,e,i){i=i.options;i._opacity&&V(e.helper).css("opacity",i._opacity)}}),V.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,e,i){var s=i.options,n=!1,o=i.scrollParentNotHidden[0],a=i.document[0];o!==a&&"HTML"!==o.tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+o.offsetHeight-t.pageY<s.scrollSensitivity?o.scrollTop=n=o.scrollTop+s.scrollSpeed:t.pageY-i.overflowOffset.top<s.scrollSensitivity&&(o.scrollTop=n=o.scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+o.offsetWidth-t.pageX<s.scrollSensitivity?o.scrollLeft=n=o.scrollLeft+s.scrollSpeed:t.pageX-i.overflowOffset.left<s.scrollSensitivity&&(o.scrollLeft=n=o.scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(t.pageY-V(a).scrollTop()<s.scrollSensitivity?n=V(a).scrollTop(V(a).scrollTop()-s.scrollSpeed):V(window).height()-(t.pageY-V(a).scrollTop())<s.scrollSensitivity&&(n=V(a).scrollTop(V(a).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(t.pageX-V(a).scrollLeft()<s.scrollSensitivity?n=V(a).scrollLeft(V(a).scrollLeft()-s.scrollSpeed):V(window).width()-(t.pageX-V(a).scrollLeft())<s.scrollSensitivity&&(n=V(a).scrollLeft(V(a).scrollLeft()+s.scrollSpeed)))),!1!==n&&V.ui.ddmanager&&!s.dropBehaviour&&V.ui.ddmanager.prepareOffsets(i,t)}}),V.ui.plugin.add("draggable","snap",{start:function(t,e,i){var s=i.options;i.snapElements=[],V(s.snap.constructor!==String?s.snap.items||":data(ui-draggable)":s.snap).each(function(){var t=V(this),e=t.offset();this!==i.element[0]&&i.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:e.top,left:e.left})})},drag:function(t,e,i){for(var s,n,o,a,r,l,h,c,u,d=i.options,p=d.snapTolerance,f=e.offset.left,g=f+i.helperProportions.width,m=e.offset.top,_=m+i.helperProportions.height,v=i.snapElements.length-1;0<=v;v--)l=(r=i.snapElements[v].left-i.margins.left)+i.snapElements[v].width,c=(h=i.snapElements[v].top-i.margins.top)+i.snapElements[v].height,g<r-p||l+p<f||_<h-p||c+p<m||!V.contains(i.snapElements[v].item.ownerDocument,i.snapElements[v].item)?(i.snapElements[v].snapping&&i.options.snap.release&&i.options.snap.release.call(i.element,t,V.extend(i._uiHash(),{snapItem:i.snapElements[v].item})),i.snapElements[v].snapping=!1):("inner"!==d.snapMode&&(s=Math.abs(h-_)<=p,n=Math.abs(c-m)<=p,o=Math.abs(r-g)<=p,a=Math.abs(l-f)<=p,s&&(e.position.top=i._convertPositionTo("relative",{top:h-i.helperProportions.height,left:0}).top),n&&(e.position.top=i._convertPositionTo("relative",{top:c,left:0}).top),o&&(e.position.left=i._convertPositionTo("relative",{top:0,left:r-i.helperProportions.width}).left),a&&(e.position.left=i._convertPositionTo("relative",{top:0,left:l}).left)),u=s||n||o||a,"outer"!==d.snapMode&&(s=Math.abs(h-m)<=p,n=Math.abs(c-_)<=p,o=Math.abs(r-f)<=p,a=Math.abs(l-g)<=p,s&&(e.position.top=i._convertPositionTo("relative",{top:h,left:0}).top),n&&(e.position.top=i._convertPositionTo("relative",{top:c-i.helperProportions.height,left:0}).top),o&&(e.position.left=i._convertPositionTo("relative",{top:0,left:r}).left),a&&(e.position.left=i._convertPositionTo("relative",{top:0,left:l-i.helperProportions.width}).left)),!i.snapElements[v].snapping&&(s||n||o||a||u)&&i.options.snap.snap&&i.options.snap.snap.call(i.element,t,V.extend(i._uiHash(),{snapItem:i.snapElements[v].item})),i.snapElements[v].snapping=s||n||o||a||u)}}),V.ui.plugin.add("draggable","stack",{start:function(t,e,i){var s,i=i.options,i=V.makeArray(V(i.stack)).sort(function(t,e){return(parseInt(V(t).css("zIndex"),10)||0)-(parseInt(V(e).css("zIndex"),10)||0)});i.length&&(s=parseInt(V(i[0]).css("zIndex"),10)||0,V(i).each(function(t){V(this).css("zIndex",s+t)}),this.css("zIndex",s+i.length))}}),V.ui.plugin.add("draggable","zIndex",{start:function(t,e,i){e=V(e.helper),i=i.options;e.css("zIndex")&&(i._zIndex=e.css("zIndex")),e.css("zIndex",i.zIndex)},stop:function(t,e,i){i=i.options;i._zIndex&&V(e.helper).css("zIndex",i._zIndex)}});V.ui.draggable;function g(t,e,i){return e<=t&&t<e+i}V.widget("ui.droppable",{version:"1.13.0",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,e=this.options,i=e.accept;this.isover=!1,this.isout=!0,this.accept="function"==typeof i?i:function(t){return t.is(i)},this.proportions=function(){if(!arguments.length)return t=t||{width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};t=arguments[0]},this._addToManager(e.scope),e.addClasses&&this._addClass("ui-droppable")},_addToManager:function(t){V.ui.ddmanager.droppables[t]=V.ui.ddmanager.droppables[t]||[],V.ui.ddmanager.droppables[t].push(this)},_splice:function(t){for(var e=0;e<t.length;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var t=V.ui.ddmanager.droppables[this.options.scope];this._splice(t)},_setOption:function(t,e){var i;"accept"===t?this.accept="function"==typeof e?e:function(t){return t.is(e)}:"scope"===t&&(i=V.ui.ddmanager.droppables[this.options.scope],this._splice(i),this._addToManager(e)),this._super(t,e)},_activate:function(t){var e=V.ui.ddmanager.current;this._addActiveClass(),e&&this._trigger("activate",t,this.ui(e))},_deactivate:function(t){var e=V.ui.ddmanager.current;this._removeActiveClass(),e&&this._trigger("deactivate",t,this.ui(e))},_over:function(t){var e=V.ui.ddmanager.current;e&&(e.currentItem||e.element)[0]!==this.element[0]&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this._addHoverClass(),this._trigger("over",t,this.ui(e)))},_out:function(t){var e=V.ui.ddmanager.current;e&&(e.currentItem||e.element)[0]!==this.element[0]&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this._removeHoverClass(),this._trigger("out",t,this.ui(e)))},_drop:function(e,t){var i=t||V.ui.ddmanager.current,s=!1;return!(!i||(i.currentItem||i.element)[0]===this.element[0])&&(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=V(this).droppable("instance");if(t.options.greedy&&!t.options.disabled&&t.options.scope===i.options.scope&&t.accept.call(t.element[0],i.currentItem||i.element)&&V.ui.intersect(i,V.extend(t,{offset:t.element.offset()}),t.options.tolerance,e))return!(s=!0)}),!s&&(!!this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(i)),this.element)))},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}}),V.ui.intersect=function(t,e,i,s){if(!e.offset)return!1;var n=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,a=n+t.helperProportions.width,r=o+t.helperProportions.height,l=e.offset.left,h=e.offset.top,c=l+e.proportions().width,u=h+e.proportions().height;switch(i){case"fit":return l<=n&&a<=c&&h<=o&&r<=u;case"intersect":return l<n+t.helperProportions.width/2&&a-t.helperProportions.width/2<c&&h<o+t.helperProportions.height/2&&r-t.helperProportions.height/2<u;case"pointer":return g(s.pageY,h,e.proportions().height)&&g(s.pageX,l,e.proportions().width);case"touch":return(h<=o&&o<=u||h<=r&&r<=u||o<h&&u<r)&&(l<=n&&n<=c||l<=a&&a<=c||n<l&&c<a);default:return!1}},!(V.ui.ddmanager={current:null,droppables:{default:[]},prepareOffsets:function(t,e){var i,s,n=V.ui.ddmanager.droppables[t.options.scope]||[],o=e?e.type:null,a=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();t:for(i=0;i<n.length;i++)if(!(n[i].options.disabled||t&&!n[i].accept.call(n[i].element[0],t.currentItem||t.element))){for(s=0;s<a.length;s++)if(a[s]===n[i].element[0]){n[i].proportions().height=0;continue t}n[i].visible="none"!==n[i].element.css("display"),n[i].visible&&("mousedown"===o&&n[i]._activate.call(n[i],e),n[i].offset=n[i].element.offset(),n[i].proportions({width:n[i].element[0].offsetWidth,height:n[i].element[0].offsetHeight}))}},drop:function(t,e){var i=!1;return V.each((V.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&V.ui.intersect(t,this,this.options.tolerance,e)&&(i=this._drop.call(this,e)||i),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,e)))}),i},dragStart:function(t,e){t.element.parentsUntil("body").on("scroll.droppable",function(){t.options.refreshPositions||V.ui.ddmanager.prepareOffsets(t,e)})},drag:function(n,o){n.options.refreshPositions&&V.ui.ddmanager.prepareOffsets(n,o),V.each(V.ui.ddmanager.droppables[n.options.scope]||[],function(){var t,e,i,s;this.options.disabled||this.greedyChild||!this.visible||(s=!(i=V.ui.intersect(n,this,this.options.tolerance,o))&&this.isover?"isout":i&&!this.isover?"isover":null)&&(this.options.greedy&&(e=this.options.scope,(i=this.element.parents(":data(ui-droppable)").filter(function(){return V(this).droppable("instance").options.scope===e})).length&&((t=V(i[0]).droppable("instance")).greedyChild="isover"===s)),t&&"isover"===s&&(t.isover=!1,t.isout=!0,t._out.call(t,o)),this[s]=!0,this["isout"===s?"isover":"isout"]=!1,this["isover"===s?"_over":"_out"].call(this,o),t&&"isout"===s&&(t.isout=!1,t.isover=!0,t._over.call(t,o)))})},dragStop:function(t,e){t.element.parentsUntil("body").off("scroll.droppable"),t.options.refreshPositions||V.ui.ddmanager.prepareOffsets(t,e)}})!==V.uiBackCompat&&V.widget("ui.droppable",V.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}});V.ui.droppable;V.widget("ui.resizable",V.ui.mouse,{version:"1.13.0",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(t,e){if("hidden"===V(t).css("overflow"))return!1;var i=e&&"left"===e?"scrollLeft":"scrollTop",e=!1;if(0<t[i])return!0;try{t[i]=1,e=0<t[i],t[i]=0}catch(t){}return e},_create:function(){var t,e=this.options,i=this;this._addClass("ui-resizable"),V.extend(this,{_aspectRatio:!!e.aspectRatio,aspectRatio:e.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:e.helper||e.ghost||e.animate?e.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(V("<div class='ui-wrapper'></div>").css({overflow:"hidden",position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,t={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(t),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(t),this._proportionallyResize()),this._setupHandles(),e.autoHide&&V(this.element).on("mouseenter",function(){e.disabled||(i._removeClass("ui-resizable-autohide"),i._handles.show())}).on("mouseleave",function(){e.disabled||i.resizing||(i._addClass("ui-resizable-autohide"),i._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy(),this._addedHandles.remove();function t(t){V(t).removeData("resizable").removeData("ui-resizable").off(".resizable")}var e;return this.elementIsWrapper&&(t(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),t(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;case"aspectRatio":this._aspectRatio=!!e}},_setupHandles:function(){var t,e,i,s,n,o=this.options,a=this;if(this.handles=o.handles||(V(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=V(),this._addedHandles=V(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),i=this.handles.split(","),this.handles={},e=0;e<i.length;e++)s="ui-resizable-"+(t=String.prototype.trim.call(i[e])),n=V("<div>"),this._addClass(n,"ui-resizable-handle "+s),n.css({zIndex:o.zIndex}),this.handles[t]=".ui-resizable-"+t,this.element.children(this.handles[t]).length||(this.element.append(n),this._addedHandles=this._addedHandles.add(n));this._renderAxis=function(t){var e,i,s;for(e in t=t||this.element,this.handles)this.handles[e].constructor===String?this.handles[e]=this.element.children(this.handles[e]).first().show():(this.handles[e].jquery||this.handles[e].nodeType)&&(this.handles[e]=V(this.handles[e]),this._on(this.handles[e],{mousedown:a._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(i=V(this.handles[e],this.element),s=/sw|ne|nw|se|n|s/.test(e)?i.outerHeight():i.outerWidth(),i=["padding",/ne|nw|n/.test(e)?"Top":/se|sw|s/.test(e)?"Bottom":/^e$/.test(e)?"Right":"Left"].join(""),t.css(i,s),this._proportionallyResize()),this._handles=this._handles.add(this.handles[e])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){a.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),a.axis=n&&n[1]?n[1]:"se")}),o.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._addedHandles.remove()},_mouseCapture:function(t){var e,i,s=!1;for(e in this.handles)(i=V(this.handles[e])[0])!==t.target&&!V.contains(i,t.target)||(s=!0);return!this.options.disabled&&s},_mouseStart:function(t){var e,i,s=this.options,n=this.element;return this.resizing=!0,this._renderProxy(),e=this._num(this.helper.css("left")),i=this._num(this.helper.css("top")),s.containment&&(e+=V(s.containment).scrollLeft()||0,i+=V(s.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:e,top:i},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:n.width(),height:n.height()},this.originalSize=this._helper?{width:n.outerWidth(),height:n.outerHeight()}:{width:n.width(),height:n.height()},this.sizeDiff={width:n.outerWidth()-n.width(),height:n.outerHeight()-n.height()},this.originalPosition={left:e,top:i},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof s.aspectRatio?s.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=V(".ui-resizable-"+this.axis).css("cursor"),V("body").css("cursor","auto"===s?this.axis+"-resize":s),this._addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var e=this.originalMousePosition,i=this.axis,s=t.pageX-e.left||0,e=t.pageY-e.top||0,i=this._change[i];return this._updatePrevProperties(),i&&(e=i.apply(this,[t,s,e]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(e=this._updateRatio(e,t)),e=this._respectSize(e,t),this._updateCache(e),this._propagate("resize",t),e=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),V.isEmptyObject(e)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges())),!1},_mouseStop:function(t){this.resizing=!1;var e,i,s,n=this.options,o=this;return this._helper&&(s=(e=(i=this._proportionallyResizeElements).length&&/textarea/i.test(i[0].nodeName))&&this._hasScroll(i[0],"left")?0:o.sizeDiff.height,i=e?0:o.sizeDiff.width,e={width:o.helper.width()-i,height:o.helper.height()-s},i=parseFloat(o.element.css("left"))+(o.position.left-o.originalPosition.left)||null,s=parseFloat(o.element.css("top"))+(o.position.top-o.originalPosition.top)||null,n.animate||this.element.css(V.extend(e,{top:s,left:i})),o.helper.height(o.size.height),o.helper.width(o.size.width),this._helper&&!n.animate&&this._proportionallyResize()),V("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s=this.options,n={minWidth:this._isNumber(s.minWidth)?s.minWidth:0,maxWidth:this._isNumber(s.maxWidth)?s.maxWidth:1/0,minHeight:this._isNumber(s.minHeight)?s.minHeight:0,maxHeight:this._isNumber(s.maxHeight)?s.maxHeight:1/0};(this._aspectRatio||t)&&(e=n.minHeight*this.aspectRatio,i=n.minWidth/this.aspectRatio,s=n.maxHeight*this.aspectRatio,t=n.maxWidth/this.aspectRatio,e>n.minWidth&&(n.minWidth=e),i>n.minHeight&&(n.minHeight=i),s<n.maxWidth&&(n.maxWidth=s),t<n.maxHeight&&(n.maxHeight=t)),this._vBoundaries=n},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidth<t.width,n=this._isNumber(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=this._isNumber(t.width)&&e.minWidth&&e.minWidth>t.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,l=this.originalPosition.top+this.originalSize.height,h=/sw|nw|w/.test(i),i=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&h&&(t.left=r-e.minWidth),s&&h&&(t.left=r-e.maxWidth),a&&i&&(t.top=l-e.minHeight),n&&i&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];e<4;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;e<this._proportionallyResizeElements.length;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,e=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||V("<div></div>").css({overflow:"hidden"}),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++e.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize;return{left:this.originalPosition.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize;return{top:this.originalPosition.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(t,e,i){return V.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},sw:function(t,e,i){return V.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,e,i]))},ne:function(t,e,i){return V.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},nw:function(t,e,i){return V.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,e,i]))}},_propagate:function(t,e){V.ui.plugin.call(this,t,[e,this.ui()]),"resize"!==t&&this._trigger(t,e,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),V.ui.plugin.add("resizable","animate",{stop:function(e){var i=V(this).resizable("instance"),t=i.options,s=i._proportionallyResizeElements,n=s.length&&/textarea/i.test(s[0].nodeName),o=n&&i._hasScroll(s[0],"left")?0:i.sizeDiff.height,a=n?0:i.sizeDiff.width,n={width:i.size.width-a,height:i.size.height-o},a=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,o=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(V.extend(n,o&&a?{top:o,left:a}:{}),{duration:t.animateDuration,easing:t.animateEasing,step:function(){var t={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};s&&s.length&&V(s[0]).css({width:t.width,height:t.height}),i._updateCache(t),i._propagate("resize",e)}})}}),V.ui.plugin.add("resizable","containment",{start:function(){var i,s,n=V(this).resizable("instance"),t=n.options,e=n.element,o=t.containment,a=o instanceof V?o.get(0):/parent/.test(o)?e.parent().get(0):o;a&&(n.containerElement=V(a),/document/.test(o)||o===document?(n.containerOffset={left:0,top:0},n.containerPosition={left:0,top:0},n.parentData={element:V(document),left:0,top:0,width:V(document).width(),height:V(document).height()||document.body.parentNode.scrollHeight}):(i=V(a),s=[],V(["Top","Right","Left","Bottom"]).each(function(t,e){s[t]=n._num(i.css("padding"+e))}),n.containerOffset=i.offset(),n.containerPosition=i.position(),n.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},t=n.containerOffset,e=n.containerSize.height,o=n.containerSize.width,o=n._hasScroll(a,"left")?a.scrollWidth:o,e=n._hasScroll(a)?a.scrollHeight:e,n.parentData={element:a,left:t.left,top:t.top,width:o,height:e}))},resize:function(t){var e=V(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.position,o=e._aspectRatio||t.shiftKey,a={top:0,left:0},r=e.containerElement,t=!0;r[0]!==document&&/static/.test(r.css("position"))&&(a=s),n.left<(e._helper?s.left:0)&&(e.size.width=e.size.width+(e._helper?e.position.left-s.left:e.position.left-a.left),o&&(e.size.height=e.size.width/e.aspectRatio,t=!1),e.position.left=i.helper?s.left:0),n.top<(e._helper?s.top:0)&&(e.size.height=e.size.height+(e._helper?e.position.top-s.top:e.position.top),o&&(e.size.width=e.size.height*e.aspectRatio,t=!1),e.position.top=e._helper?s.top:0),i=e.containerElement.get(0)===e.element.parent().get(0),n=/relative|absolute/.test(e.containerElement.css("position")),i&&n?(e.offset.left=e.parentData.left+e.position.left,e.offset.top=e.parentData.top+e.position.top):(e.offset.left=e.element.offset().left,e.offset.top=e.element.offset().top),n=Math.abs(e.sizeDiff.width+(e._helper?e.offset.left-a.left:e.offset.left-s.left)),s=Math.abs(e.sizeDiff.height+(e._helper?e.offset.top-a.top:e.offset.top-s.top)),n+e.size.width>=e.parentData.width&&(e.size.width=e.parentData.width-n,o&&(e.size.height=e.size.width/e.aspectRatio,t=!1)),s+e.size.height>=e.parentData.height&&(e.size.height=e.parentData.height-s,o&&(e.size.width=e.size.height*e.aspectRatio,t=!1)),t||(e.position.left=e.prevPosition.left,e.position.top=e.prevPosition.top,e.size.width=e.prevSize.width,e.size.height=e.prevSize.height)},stop:function(){var t=V(this).resizable("instance"),e=t.options,i=t.containerOffset,s=t.containerPosition,n=t.containerElement,o=V(t.helper),a=o.offset(),r=o.outerWidth()-t.sizeDiff.width,o=o.outerHeight()-t.sizeDiff.height;t._helper&&!e.animate&&/relative/.test(n.css("position"))&&V(this).css({left:a.left-s.left-i.left,width:r,height:o}),t._helper&&!e.animate&&/static/.test(n.css("position"))&&V(this).css({left:a.left-s.left-i.left,width:r,height:o})}}),V.ui.plugin.add("resizable","alsoResize",{start:function(){var t=V(this).resizable("instance").options;V(t.alsoResize).each(function(){var t=V(this);t.data("ui-resizable-alsoresize",{width:parseFloat(t.width()),height:parseFloat(t.height()),left:parseFloat(t.css("left")),top:parseFloat(t.css("top"))})})},resize:function(t,i){var e=V(this).resizable("instance"),s=e.options,n=e.originalSize,o=e.originalPosition,a={height:e.size.height-n.height||0,width:e.size.width-n.width||0,top:e.position.top-o.top||0,left:e.position.left-o.left||0};V(s.alsoResize).each(function(){var t=V(this),s=V(this).data("ui-resizable-alsoresize"),n={},e=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];V.each(e,function(t,e){var i=(s[e]||0)+(a[e]||0);i&&0<=i&&(n[e]=i||null)}),t.css(n)})},stop:function(){V(this).removeData("ui-resizable-alsoresize")}}),V.ui.plugin.add("resizable","ghost",{start:function(){var t=V(this).resizable("instance"),e=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}),t._addClass(t.ghost,"ui-resizable-ghost"),!1!==V.uiBackCompat&&"string"==typeof t.options.ghost&&t.ghost.addClass(this.options.ghost),t.ghost.appendTo(t.helper)},resize:function(){var t=V(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=V(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),V.ui.plugin.add("resizable","grid",{resize:function(){var t,e=V(this).resizable("instance"),i=e.options,s=e.size,n=e.originalSize,o=e.originalPosition,a=e.axis,r="number"==typeof i.grid?[i.grid,i.grid]:i.grid,l=r[0]||1,h=r[1]||1,c=Math.round((s.width-n.width)/l)*l,u=Math.round((s.height-n.height)/h)*h,d=n.width+c,p=n.height+u,f=i.maxWidth&&i.maxWidth<d,g=i.maxHeight&&i.maxHeight<p,m=i.minWidth&&i.minWidth>d,s=i.minHeight&&i.minHeight>p;i.grid=r,m&&(d+=l),s&&(p+=h),f&&(d-=l),g&&(p-=h),/^(se|s|e)$/.test(a)?(e.size.width=d,e.size.height=p):/^(ne)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.top=o.top-u):/^(sw)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.left=o.left-c):((p-h<=0||d-l<=0)&&(t=e._getPaddingPlusBorderDimensions(this)),0<p-h?(e.size.height=p,e.position.top=o.top-u):(p=h-t.height,e.size.height=p,e.position.top=o.top+n.height-p),0<d-l?(e.size.width=d,e.position.left=o.left-c):(d=l-t.width,e.size.width=d,e.position.left=o.left+n.width-d))}});V.ui.resizable,V.widget("ui.selectable",V.ui.mouse,{version:"1.13.0",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var i=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){i.elementPos=V(i.element[0]).offset(),i.selectees=V(i.options.filter,i.element[0]),i._addClass(i.selectees,"ui-selectee"),i.selectees.each(function(){var t=V(this),e=t.offset(),e={left:e.left-i.elementPos.left,top:e.top-i.elementPos.top};V.data(this,"selectable-item",{element:this,$element:t,left:e.left,top:e.top,right:e.left+t.outerWidth(),bottom:e.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=V("<div>"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(i){var s=this,t=this.options;this.opos=[i.pageX,i.pageY],this.elementPos=V(this.element[0]).offset(),this.options.disabled||(this.selectees=V(t.filter,this.element[0]),this._trigger("start",i),V(t.appendTo).append(this.helper),this.helper.css({left:i.pageX,top:i.pageY,width:0,height:0}),t.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var t=V.data(this,"selectable-item");t.startselected=!0,i.metaKey||i.ctrlKey||(s._removeClass(t.$element,"ui-selected"),t.selected=!1,s._addClass(t.$element,"ui-unselecting"),t.unselecting=!0,s._trigger("unselecting",i,{unselecting:t.element}))}),V(i.target).parents().addBack().each(function(){var t,e=V.data(this,"selectable-item");if(e)return t=!i.metaKey&&!i.ctrlKey||!e.$element.hasClass("ui-selected"),s._removeClass(e.$element,t?"ui-unselecting":"ui-selected")._addClass(e.$element,t?"ui-selecting":"ui-unselecting"),e.unselecting=!t,e.selecting=t,(e.selected=t)?s._trigger("selecting",i,{selecting:e.element}):s._trigger("unselecting",i,{unselecting:e.element}),!1}))},_mouseDrag:function(s){if(this.dragged=!0,!this.options.disabled){var t,n=this,o=this.options,a=this.opos[0],r=this.opos[1],l=s.pageX,h=s.pageY;return l<a&&(t=l,l=a,a=t),h<r&&(t=h,h=r,r=t),this.helper.css({left:a,top:r,width:l-a,height:h-r}),this.selectees.each(function(){var t=V.data(this,"selectable-item"),e=!1,i={};t&&t.element!==n.element[0]&&(i.left=t.left+n.elementPos.left,i.right=t.right+n.elementPos.left,i.top=t.top+n.elementPos.top,i.bottom=t.bottom+n.elementPos.top,"touch"===o.tolerance?e=!(i.left>l||i.right<a||i.top>h||i.bottom<r):"fit"===o.tolerance&&(e=i.left>a&&i.right<l&&i.top>r&&i.bottom<h),e?(t.selected&&(n._removeClass(t.$element,"ui-selected"),t.selected=!1),t.unselecting&&(n._removeClass(t.$element,"ui-unselecting"),t.unselecting=!1),t.selecting||(n._addClass(t.$element,"ui-selecting"),t.selecting=!0,n._trigger("selecting",s,{selecting:t.element}))):(t.selecting&&((s.metaKey||s.ctrlKey)&&t.startselected?(n._removeClass(t.$element,"ui-selecting"),t.selecting=!1,n._addClass(t.$element,"ui-selected"),t.selected=!0):(n._removeClass(t.$element,"ui-selecting"),t.selecting=!1,t.startselected&&(n._addClass(t.$element,"ui-unselecting"),t.unselecting=!0),n._trigger("unselecting",s,{unselecting:t.element}))),t.selected&&(s.metaKey||s.ctrlKey||t.startselected||(n._removeClass(t.$element,"ui-selected"),t.selected=!1,n._addClass(t.$element,"ui-unselecting"),t.unselecting=!0,n._trigger("unselecting",s,{unselecting:t.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,V(".ui-unselecting",this.element[0]).each(function(){var t=V.data(this,"selectable-item");i._removeClass(t.$element,"ui-unselecting"),t.unselecting=!1,t.startselected=!1,i._trigger("unselected",e,{unselected:t.element})}),V(".ui-selecting",this.element[0]).each(function(){var t=V.data(this,"selectable-item");i._removeClass(t.$element,"ui-selecting")._addClass(t.$element,"ui-selected"),t.selecting=!1,t.selected=!0,t.startselected=!0,i._trigger("selected",e,{selected:t.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),V.widget("ui.sortable",V.ui.mouse,{version:"1.13.0",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return e<=t&&t<e+i},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var t=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),V.each(this.items,function(){t._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;0<=t;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,e){var i=null,s=!1,n=this;return!this.reverting&&(!this.options.disabled&&"static"!==this.options.type&&(this._refreshItems(t),V(t.target).parents().each(function(){if(V.data(this,n.widgetName+"-item")===n)return i=V(this),!1}),!!(i=V.data(t.target,n.widgetName+"-item")===n?V(t.target):i)&&(!(this.options.handle&&!e&&(V(this.options.handle,i).find("*").addBack().each(function(){this===t.target&&(s=!0)}),!s))&&(this.currentItem=i,this._removeCurrentsFromItems(),!0))))},_mouseStart:function(t,e,i){var s,n,o=this.options;if((this.currentContainer=this).refreshPositions(),this.appendTo=V("parent"!==o.appendTo?o.appendTo:this.currentItem.parent()),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},V.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),this.scrollParent=this.placeholder.scrollParent(),V.extend(this.offset,{parent:this._getParentOffset()}),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(n=this.document.find("body"),this.storedCursor=n.css("cursor"),n.css("cursor",o.cursor),this.storedStylesheet=V("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(n)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!i)for(s=this.containers.length-1;0<=s;s--)this.containers[s]._trigger("activate",t,this._uiHash(this));return V.ui.ddmanager&&(V.ui.ddmanager.current=this),V.ui.ddmanager&&!o.dropBehaviour&&V.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this.helper.parent().is(this.appendTo)||(this.helper.detach().appendTo(this.appendTo),this.offset.parent=this._getParentOffset()),this.position=this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,this.lastPositionAbs=this.positionAbs=this._convertPositionTo("absolute"),this._mouseDrag(t),!0},_scroll:function(t){var e=this.options,i=!1;return this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<e.scrollSensitivity?this.scrollParent[0].scrollTop=i=this.scrollParent[0].scrollTop+e.scrollSpeed:t.pageY-this.overflowOffset.top<e.scrollSensitivity&&(this.scrollParent[0].scrollTop=i=this.scrollParent[0].scrollTop-e.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<e.scrollSensitivity?this.scrollParent[0].scrollLeft=i=this.scrollParent[0].scrollLeft+e.scrollSpeed:t.pageX-this.overflowOffset.left<e.scrollSensitivity&&(this.scrollParent[0].scrollLeft=i=this.scrollParent[0].scrollLeft-e.scrollSpeed)):(t.pageY-this.document.scrollTop()<e.scrollSensitivity?i=this.document.scrollTop(this.document.scrollTop()-e.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<e.scrollSensitivity&&(i=this.document.scrollTop(this.document.scrollTop()+e.scrollSpeed)),t.pageX-this.document.scrollLeft()<e.scrollSensitivity?i=this.document.scrollLeft(this.document.scrollLeft()-e.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<e.scrollSensitivity&&(i=this.document.scrollLeft(this.document.scrollLeft()+e.scrollSpeed))),i},_mouseDrag:function(t){var e,i,s,n,o=this.options;if(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),this._contactContainers(t),null!==this.innermostContainer)for(o.scroll&&!1!==this._scroll(t)&&(this._refreshItemPositions(!0),V.ui.ddmanager&&!o.dropBehaviour&&V.ui.ddmanager.prepareOffsets(this,t)),this.dragDirection={vertical:this._getDragVerticalDirection(),horizontal:this._getDragHorizontalDirection()},e=this.items.length-1;0<=e;e--)if(s=(i=this.items[e]).item[0],(n=this._intersectsWithPointer(i))&&i.instance===this.currentContainer&&!(s===this.currentItem[0]||this.placeholder[1===n?"next":"prev"]()[0]===s||V.contains(this.placeholder[0],s)||"semi-dynamic"===this.options.type&&V.contains(this.element[0],s))){if(this.direction=1===n?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;this._rearrange(t,i),this._trigger("change",t,this._uiHash());break}return V.ui.ddmanager&&V.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,e){var i,s,n,o;if(t)return V.ui.ddmanager&&!this.options.dropBehaviour&&V.ui.ddmanager.drop(this,t),this.options.revert?(s=(i=this).placeholder.offset(),o={},(n=this.options.axis)&&"x"!==n||(o.left=s.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),n&&"y"!==n||(o.top=s.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,V(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){i._clear(t)})):this._clear(t,e),!1},cancel:function(){if(this.dragging){this._mouseUp(new V.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var t=this.containers.length-1;0<=t;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),V.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?V(this.domPosition.prev).after(this.currentItem):V(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var t=this._getItemsAsjQuery(e&&e.connected),i=[];return e=e||{},V(t).each(function(){var t=(V(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);t&&i.push((e.key||t[1]+"[]")+"="+(e.key&&e.expression?t[1]:t[2]))}),!i.length&&e.key&&i.push(e.key+"="),i.join("&")},toArray:function(t){var e=this._getItemsAsjQuery(t&&t.connected),i=[];return t=t||{},e.each(function(){i.push(V(t.item||this).attr(t.attribute||"id")||"")}),i},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,l=r+t.height,h=this.offset.click.top,c=this.offset.click.left,h="x"===this.options.axis||r<s+h&&s+h<l,c="y"===this.options.axis||o<e+c&&e+c<a;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?h&&c:o<e+this.helperProportions.width/2&&i-this.helperProportions.width/2<a&&r<s+this.helperProportions.height/2&&n-this.helperProportions.height/2<l},_intersectsWithPointer:function(t){var e="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),t="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width);return!(!e||!t)&&(e=this.dragDirection.vertical,t=this.dragDirection.horizontal,this.floating?"right"===t||"down"===e?2:1:e&&("down"===e?2:1))},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this.dragDirection.vertical,t=this.dragDirection.horizontal;return this.floating&&t?"right"===t&&i||"left"===t&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!=t&&(0<t?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!=t&&(0<t?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(t){var e,i,s,n,o=[],a=[],r=this._connectWith();if(r&&t)for(e=r.length-1;0<=e;e--)for(i=(s=V(r[e],this.document[0])).length-1;0<=i;i--)(n=V.data(s[i],this.widgetFullName))&&n!==this&&!n.options.disabled&&a.push(["function"==typeof n.options.items?n.options.items.call(n.element):V(n.options.items,n.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),n]);function l(){o.push(this)}for(a.push(["function"==typeof this.options.items?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):V(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),e=a.length-1;0<=e;e--)a[e][0].each(l);return V(o)},_removeCurrentsFromItems:function(){var i=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=V.grep(this.items,function(t){for(var e=0;e<i.length;e++)if(i[e]===t.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var e,i,s,n,o,a,r,l,h=this.items,c=[["function"==typeof this.options.items?this.options.items.call(this.element[0],t,{item:this.currentItem}):V(this.options.items,this.element),this]],u=this._connectWith();if(u&&this.ready)for(e=u.length-1;0<=e;e--)for(i=(s=V(u[e],this.document[0])).length-1;0<=i;i--)(n=V.data(s[i],this.widgetFullName))&&n!==this&&!n.options.disabled&&(c.push(["function"==typeof n.options.items?n.options.items.call(n.element[0],t,{item:this.currentItem}):V(n.options.items,n.element),n]),this.containers.push(n));for(e=c.length-1;0<=e;e--)for(o=c[e][1],l=(a=c[e][i=0]).length;i<l;i++)(r=V(a[i])).data(this.widgetName+"-item",o),h.push({item:r,instance:o,width:0,height:0,left:0,top:0})},_refreshItemPositions:function(t){for(var e,i,s=this.items.length-1;0<=s;s--)e=this.items[s],this.currentContainer&&e.instance!==this.currentContainer&&e.item[0]!==this.currentItem[0]||(i=this.options.toleranceElement?V(this.options.toleranceElement,e.item):e.item,t||(e.width=i.outerWidth(),e.height=i.outerHeight()),i=i.offset(),e.left=i.left,e.top=i.top)},refreshPositions:function(t){var e,i;if(this.floating=!!this.items.length&&("x"===this.options.axis||this._isFloating(this.items[0].item)),null!==this.innermostContainer&&this._refreshItemPositions(t),this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(e=this.containers.length-1;0<=e;e--)i=this.containers[e].element.offset(),this.containers[e].containerCache.left=i.left,this.containers[e].containerCache.top=i.top,this.containers[e].containerCache.width=this.containers[e].element.outerWidth(),this.containers[e].containerCache.height=this.containers[e].element.outerHeight();return this},_createPlaceholder:function(i){var s,n,o=(i=i||this).options;o.placeholder&&o.placeholder.constructor!==String||(s=o.placeholder,n=i.currentItem[0].nodeName.toLowerCase(),o.placeholder={element:function(){var t=V("<"+n+">",i.document[0]);return i._addClass(t,"ui-sortable-placeholder",s||i.currentItem[0].className)._removeClass(t,"ui-sortable-helper"),"tbody"===n?i._createTrPlaceholder(i.currentItem.find("tr").eq(0),V("<tr>",i.document[0]).appendTo(t)):"tr"===n?i._createTrPlaceholder(i.currentItem,t):"img"===n&&t.attr("src",i.currentItem.attr("src")),s||t.css("visibility","hidden"),t},update:function(t,e){s&&!o.forcePlaceholderSize||(e.height()&&(!o.forcePlaceholderSize||"tbody"!==n&&"tr"!==n)||e.height(i.currentItem.innerHeight()-parseInt(i.currentItem.css("paddingTop")||0,10)-parseInt(i.currentItem.css("paddingBottom")||0,10)),e.width()||e.width(i.currentItem.innerWidth()-parseInt(i.currentItem.css("paddingLeft")||0,10)-parseInt(i.currentItem.css("paddingRight")||0,10)))}}),i.placeholder=V(o.placeholder.element.call(i.element,i.currentItem)),i.currentItem.after(i.placeholder),o.placeholder.update(i,i.placeholder)},_createTrPlaceholder:function(t,e){var i=this;t.children().each(function(){V("<td>&#160;</td>",i.document[0]).attr("colspan",V(this).attr("colspan")||1).appendTo(e)})},_contactContainers:function(t){for(var e,i,s,n,o,a,r,l,h,c=null,u=null,d=this.containers.length-1;0<=d;d--)V.contains(this.currentItem[0],this.containers[d].element[0])||(this._intersectsWith(this.containers[d].containerCache)?c&&V.contains(this.containers[d].element[0],c.element[0])||(c=this.containers[d],u=d):this.containers[d].containerCache.over&&(this.containers[d]._trigger("out",t,this._uiHash(this)),this.containers[d].containerCache.over=0));if(this.innermostContainer=c)if(1===this.containers.length)this.containers[u].containerCache.over||(this.containers[u]._trigger("over",t,this._uiHash(this)),this.containers[u].containerCache.over=1);else{for(i=1e4,s=null,n=(l=c.floating||this._isFloating(this.currentItem))?"left":"top",o=l?"width":"height",h=l?"pageX":"pageY",e=this.items.length-1;0<=e;e--)V.contains(this.containers[u].element[0],this.items[e].item[0])&&this.items[e].item[0]!==this.currentItem[0]&&(a=this.items[e].item.offset()[n],r=!1,t[h]-a>this.items[e][o]/2&&(r=!0),Math.abs(t[h]-a)<i&&(i=Math.abs(t[h]-a),s=this.items[e],this.direction=r?"up":"down"));(s||this.options.dropOnEmpty)&&(this.currentContainer!==this.containers[u]?(s?this._rearrange(t,s,null,!0):this._rearrange(t,null,this.containers[u].element,!0),this._trigger("change",t,this._uiHash()),this.containers[u]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[u],this.options.placeholder.update(this.currentContainer,this.placeholder),this.scrollParent=this.placeholder.scrollParent(),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this.containers[u]._trigger("over",t,this._uiHash(this)),this.containers[u].containerCache.over=1):this.currentContainer.containerCache.over||(this.containers[u]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1))}},_createHelper:function(t){var e=this.options,t="function"==typeof e.helper?V(e.helper.apply(this.element[0],[t,this.currentItem])):"clone"===e.helper?this.currentItem.clone():this.currentItem;return t.parents("body").length||this.appendTo[0].appendChild(t[0]),t[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),t[0].style.width&&!e.forceHelperSize||t.width(this.currentItem.width()),t[0].style.height&&!e.forceHelperSize||t.height(this.currentItem.height()),t},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),"left"in(t=Array.isArray(t)?{left:+t[0],top:+t[1]||0}:t)&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&V.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),{top:(t=this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&V.ui.ie?{top:0,left:0}:t).top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,e,i=this.options;"parent"===i.containment&&(i.containment=this.helper[0].parentNode),"document"!==i.containment&&"window"!==i.containment||(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===i.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===i.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(i.containment)||(t=V(i.containment)[0],e=V(i.containment).offset(),i="hidden"!==V(t).css("overflow"),this.containment=[e.left+(parseInt(V(t).css("borderLeftWidth"),10)||0)+(parseInt(V(t).css("paddingLeft"),10)||0)-this.margins.left,e.top+(parseInt(V(t).css("borderTopWidth"),10)||0)+(parseInt(V(t).css("paddingTop"),10)||0)-this.margins.top,e.left+(i?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(V(t).css("borderLeftWidth"),10)||0)-(parseInt(V(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,e.top+(i?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(V(t).css("borderTopWidth"),10)||0)-(parseInt(V(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,e){e=e||this.position;var i="absolute"===t?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&V.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,t=/(html|body)/i.test(s[0].tagName);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():t?0:s.scrollTop())*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():t?0:s.scrollLeft())*i}},_generatePosition:function(t){var e=this.options,i=t.pageX,s=t.pageY,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&V.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(i=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(s=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(i=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(s=this.containment[3]+this.offset.click.top)),e.grid&&(t=this.originalPageY+Math.round((s-this.originalPageY)/e.grid[1])*e.grid[1],s=!this.containment||t-this.offset.click.top>=this.containment[1]&&t-this.offset.click.top<=this.containment[3]?t:t-this.offset.click.top>=this.containment[1]?t-e.grid[1]:t+e.grid[1],t=this.originalPageX+Math.round((i-this.originalPageX)/e.grid[0])*e.grid[0],i=!this.containment||t-this.offset.click.left>=this.containment[0]&&t-this.offset.click.left<=this.containment[2]?t:t-this.offset.click.left>=this.containment[0]?t-e.grid[0]:t+e.grid[0])),{top:s-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop()),left:i-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)"auto"!==this._storedCSS[i]&&"static"!==this._storedCSS[i]||(this._storedCSS[i]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();function n(e,i,s){return function(t){s._trigger(e,t,i._uiHash(i))}}for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(s.push(function(t){this._trigger("remove",t,this._uiHash())}),s.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;0<=i;i--)e||s.push(n("deactivate",this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(n("out",this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(i=0;i<s.length;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){!1===V.Widget.prototype._trigger.apply(this,arguments)&&this.cancel()},_uiHash:function(t){var e=t||this;return{helper:e.helper,placeholder:e.placeholder||V([]),position:e.position,originalPosition:e.originalPosition,offset:e.positionAbs,item:e.currentItem,sender:t?t.element:null}}}),V.widget("ui.accordion",{version:"1.13.0",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:function(t){return t.find("> li > :first-child").add(t.find("> :not(li)").even())},heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=V(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),t.collapsible||!1!==t.active&&null!=t.active||(t.active=0),this._processPanels(),t.active<0&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():V()}},_createIcons:function(){var t,e=this.options.icons;e&&(t=V("<span>"),this._addClass(t,"ui-accordion-header-icon","ui-icon "+e.header),t.prependTo(this.headers),t=this.active.children(".ui-accordion-header-icon"),this._removeClass(t,e.header)._addClass(t,null,e.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){"active"!==t?("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||!1!==this.options.active||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons())):this._activate(e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var e=V.ui.keyCode,i=this.headers.length,s=this.headers.index(t.target),n=!1;switch(t.keyCode){case e.RIGHT:case e.DOWN:n=this.headers[(s+1)%i];break;case e.LEFT:case e.UP:n=this.headers[(s-1+i)%i];break;case e.SPACE:case e.ENTER:this._eventHandler(t);break;case e.HOME:n=this.headers[0];break;case e.END:n=this.headers[i-1]}n&&(V(t.target).attr("tabIndex",-1),V(n).attr("tabIndex",0),V(n).trigger("focus"),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===V.ui.keyCode.UP&&t.ctrlKey&&V(t.currentTarget).prev().trigger("focus")},refresh:function(){var t=this.options;this._processPanels(),!1===t.active&&!0===t.collapsible||!this.headers.length?(t.active=!1,this.active=V()):!1===t.active?this._activate(0):this.active.length&&!V.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=V()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;"function"==typeof this.options.header?this.headers=this.options.header(this.element):this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var i,t=this.options,e=t.heightStyle,s=this.element.parent();this.active=this._findActive(t.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var t=V(this),e=t.uniqueId().attr("id"),i=t.next(),s=i.uniqueId().attr("id");t.attr("aria-controls",s),i.attr("aria-labelledby",e)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(t.event),"fill"===e?(i=s.height(),this.element.siblings(":visible").each(function(){var t=V(this),e=t.css("position");"absolute"!==e&&"fixed"!==e&&(i-=t.outerHeight(!0))}),this.headers.each(function(){i-=V(this).outerHeight(!0)}),this.headers.next().each(function(){V(this).height(Math.max(0,i-V(this).innerHeight()+V(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.headers.next().each(function(){var t=V(this).is(":visible");t||V(this).show(),i=Math.max(i,V(this).css("height","").height()),t||V(this).hide()}).height(i))},_activate:function(t){t=this._findActive(t)[0];t!==this.active[0]&&(t=t||this.active[0],this._eventHandler({target:t,currentTarget:t,preventDefault:V.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):V()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&V.each(t.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var e=this.options,i=this.active,s=V(t.currentTarget),n=s[0]===i[0],o=n&&e.collapsible,a=o?V():s.next(),r=i.next(),a={oldHeader:i,oldPanel:r,newHeader:o?V():s,newPanel:a};t.preventDefault(),n&&!e.collapsible||!1===this._trigger("beforeActivate",t,a)||(e.active=!o&&this.headers.index(s),this.active=n?V():s,this._toggle(a),this._removeClass(i,"ui-accordion-header-active","ui-state-active"),e.icons&&(i=i.children(".ui-accordion-header-icon"),this._removeClass(i,null,e.icons.activeHeader)._addClass(i,null,e.icons.header)),n||(this._removeClass(s,"ui-accordion-header-collapsed")._addClass(s,"ui-accordion-header-active","ui-state-active"),e.icons&&(n=s.children(".ui-accordion-header-icon"),this._removeClass(n,null,e.icons.header)._addClass(n,null,e.icons.activeHeader)),this._addClass(s.next(),"ui-accordion-content-active")))},_toggle:function(t){var e=t.newPanel,i=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=e,this.prevHide=i,this.options.animate?this._animate(e,i,t):(i.hide(),e.show(),this._toggleComplete(t)),i.attr({"aria-hidden":"true"}),i.prev().attr({"aria-selected":"false","aria-expanded":"false"}),e.length&&i.length?i.prev().attr({tabIndex:-1,"aria-expanded":"false"}):e.length&&this.headers.filter(function(){return 0===parseInt(V(this).attr("tabIndex"),10)}).attr("tabIndex",-1),e.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,i,e){var s,n,o,a=this,r=0,l=t.css("box-sizing"),h=t.length&&(!i.length||t.index()<i.index()),c=this.options.animate||{},u=h&&c.down||c,h=function(){a._toggleComplete(e)};return n=(n="string"==typeof u?u:n)||u.easing||c.easing,o=(o="number"==typeof u?u:o)||u.duration||c.duration,i.length?t.length?(s=t.show().outerHeight(),i.animate(this.hideProps,{duration:o,easing:n,step:function(t,e){e.now=Math.round(t)}}),void t.hide().animate(this.showProps,{duration:o,easing:n,complete:h,step:function(t,e){e.now=Math.round(t),"height"!==e.prop?"content-box"===l&&(r+=e.now):"content"!==a.options.heightStyle&&(e.now=Math.round(s-i.outerHeight()-r),r=0)}})):i.animate(this.hideProps,o,n,h):t.animate(this.showProps,o,n,h)},_toggleComplete:function(t){var e=t.oldPanel,i=e.prev();this._removeClass(e,"ui-accordion-content-active"),this._removeClass(i,"ui-accordion-header-active")._addClass(i,"ui-accordion-header-collapsed"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}}),V.widget("ui.menu",{version:"1.13.0",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.lastMousePosition={x:null,y:null},this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault(),this._activateItem(t)},"click .ui-menu-item":function(t){var e=V(t.target),i=V(V.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&e.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),e.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&i.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":"_activateItem","mousemove .ui-menu-item":"_activateItem",mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this._menuItems().first();e||this.focus(t,i)},blur:function(t){this._delay(function(){V.contains(this.element[0],V.ui.safeActiveElement(this.document[0]))||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t,!0),this.mouseHandled=!1}})},_activateItem:function(t){var e,i;this.previousFilter||t.clientX===this.lastMousePosition.x&&t.clientY===this.lastMousePosition.y||(this.lastMousePosition={x:t.clientX,y:t.clientY},e=V(t.target).closest(".ui-menu-item"),i=V(t.currentTarget),e[0]===i[0]&&(i.is(".ui-state-active")||(this._removeClass(i.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(t,i))))},_destroy:function(){var t=this.element.find(".ui-menu-item").removeAttr("role aria-disabled").children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),t.children().each(function(){var t=V(this);t.data("ui-menu-submenu-caret")&&t.remove()})},_keydown:function(t){var e,i,s,n=!0;switch(t.keyCode){case V.ui.keyCode.PAGE_UP:this.previousPage(t);break;case V.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case V.ui.keyCode.HOME:this._move("first","first",t);break;case V.ui.keyCode.END:this._move("last","last",t);break;case V.ui.keyCode.UP:this.previous(t);break;case V.ui.keyCode.DOWN:this.next(t);break;case V.ui.keyCode.LEFT:this.collapse(t);break;case V.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case V.ui.keyCode.ENTER:case V.ui.keyCode.SPACE:this._activate(t);break;case V.ui.keyCode.ESCAPE:this.collapse(t);break;default:e=this.previousFilter||"",s=n=!1,i=96<=t.keyCode&&t.keyCode<=105?(t.keyCode-96).toString():String.fromCharCode(t.keyCode),clearTimeout(this.filterTimer),i===e?s=!0:i=e+i,e=this._filterMenuItems(i),(e=s&&-1!==e.index(this.active.next())?this.active.nextAll(".ui-menu-item"):e).length||(i=String.fromCharCode(t.keyCode),e=this._filterMenuItems(i)),e.length?(this.focus(t,e),this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}n&&t.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var t,e,s=this,n=this.options.icons.submenu,i=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),e=i.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=V(this),e=t.prev(),i=V("<span>").data("ui-menu-submenu-caret",!0);s._addClass(i,"ui-menu-icon","ui-icon "+n),e.attr("aria-haspopup","true").prepend(i),t.attr("aria-labelledby",e.attr("id"))}),this._addClass(e,"ui-menu","ui-widget ui-widget-content ui-front"),(t=i.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var t=V(this);s._isDivider(t)&&s._addClass(t,"ui-menu-divider","ui-widget-content")}),i=(e=t.not(".ui-menu-item, .ui-menu-divider")).children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(e,"ui-menu-item")._addClass(i,"ui-menu-item-wrapper"),t.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!V.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){var i;"icons"===t&&(i=this.element.find(".ui-menu-icon"),this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",String(t)),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),i=this.active.children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",i.attr("id")),i=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(t){var e,i,s;this._hasScroll()&&(i=parseFloat(V.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(V.css(this.activeMenu[0],"paddingTop"))||0,e=t.offset().top-this.activeMenu.offset().top-i-s,i=this.activeMenu.scrollTop(),s=this.activeMenu.height(),t=t.outerHeight(),e<0?this.activeMenu.scrollTop(i+e):s<e+t&&this.activeMenu.scrollTop(i+e-s+t))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(t){var e=V.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(e)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var t=i?this.element:V(e&&e.target).closest(this.element.find(".ui-menu"));t.length||(t=this.element),this._close(t),this.blur(e),this._removeClass(t.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=t},i?0:this.delay)},_close:function(t){(t=t||(this.active?this.active.parent():this.element)).find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(t){return!V(t.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this._menuItems(this.active.children(".ui-menu")).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_menuItems:function(t){return(t||this.element).find(this.options.items).filter(".ui-menu-item")},_move:function(t,e,i){var s;(s=this.active?"first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").last():this.active[t+"All"](".ui-menu-item").first():s)&&s.length&&this.active||(s=this._menuItems(this.activeMenu)[e]()),this.focus(i,s)},nextPage:function(t){var e,i,s;this.active?this.isLastItem()||(this._hasScroll()?(i=this.active.offset().top,s=this.element.innerHeight(),0===V.fn.jquery.indexOf("3.2.")&&(s+=this.element[0].offsetHeight-this.element.outerHeight()),this.active.nextAll(".ui-menu-item").each(function(){return(e=V(this)).offset().top-i-s<0}),this.focus(t,e)):this.focus(t,this._menuItems(this.activeMenu)[this.active?"last":"first"]())):this.next(t)},previousPage:function(t){var e,i,s;this.active?this.isFirstItem()||(this._hasScroll()?(i=this.active.offset().top,s=this.element.innerHeight(),0===V.fn.jquery.indexOf("3.2.")&&(s+=this.element[0].offsetHeight-this.element.outerHeight()),this.active.prevAll(".ui-menu-item").each(function(){return 0<(e=V(this)).offset().top-i+s}),this.focus(t,e)):this.focus(t,this._menuItems(this.activeMenu).first())):this.next(t)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||V(t.target).closest(".ui-menu-item");var e={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,e)},_filterMenuItems:function(t){var t=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),e=new RegExp("^"+t,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return e.test(String.prototype.trim.call(V(this).children(".ui-menu-item-wrapper").text()))})}});V.widget("ui.autocomplete",{version:"1.13.0",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var i,s,n,t=this.element[0].nodeName.toLowerCase(),e="textarea"===t,t="input"===t;this.isMultiLine=e||!t&&this._isContentEditable(this.element),this.valueMethod=this.element[e||t?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(t){if(this.element.prop("readOnly"))s=n=i=!0;else{s=n=i=!1;var e=V.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:i=!0,this._move("previousPage",t);break;case e.PAGE_DOWN:i=!0,this._move("nextPage",t);break;case e.UP:i=!0,this._keyEvent("previous",t);break;case e.DOWN:i=!0,this._keyEvent("next",t);break;case e.ENTER:this.menu.active&&(i=!0,t.preventDefault(),this.menu.select(t));break;case e.TAB:this.menu.active&&this.menu.select(t);break;case e.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(t),t.preventDefault());break;default:s=!0,this._searchTimeout(t)}}},keypress:function(t){if(i)return i=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||t.preventDefault());if(!s){var e=V.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:this._move("previousPage",t);break;case e.PAGE_DOWN:this._move("nextPage",t);break;case e.UP:this._keyEvent("previous",t);break;case e.DOWN:this._keyEvent("next",t)}}},input:function(t){if(n)return n=!1,void t.preventDefault();this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){clearTimeout(this.searching),this.close(t),this._change(t)}}),this._initSource(),this.menu=V("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().attr({unselectable:"on"}).menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault()},menufocus:function(t,e){var i;if(this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type)))return this.menu.blur(),void this.document.one("mousemove",function(){V(t.target).trigger(t.originalEvent)});i=e.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:i})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(i.value),(i=e.item.attr("aria-label")||i.value)&&String.prototype.trim.call(i).length&&(this.liveRegion.children().hide(),V("<div>").text(i).appendTo(this.liveRegion))},menuselect:function(t,e){var i=e.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==V.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",t,{item:i})&&this._value(i.value),this.term=this._value(),this.close(t),this.selectedItem=i}}),this.liveRegion=V("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(t){var e=this.menu.element[0];return t.target===this.element[0]||t.target===e||V.contains(e,t.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var t=this.options.appendTo;return t=!(t=!(t=t&&(t.jquery||t.nodeType?V(t):this.document.find(t).eq(0)))||!t[0]?this.element.closest(".ui-front, dialog"):t).length?this.document[0].body:t},_initSource:function(){var i,s,n=this;Array.isArray(this.options.source)?(i=this.options.source,this.source=function(t,e){e(V.ui.autocomplete.filter(i,t.term))}):"string"==typeof this.options.source?(s=this.options.source,this.source=function(t,e){n.xhr&&n.xhr.abort(),n.xhr=V.ajax({url:s,data:t,dataType:"json",success:function(t){e(t)},error:function(){e([])}})}):this.source=this.options.source},_searchTimeout:function(s){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),e=this.menu.element.is(":visible"),i=s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;t&&(e||i)||(this.selectedItem=null,this.search(null,s))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):!1!==this._trigger("search",e)?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")}.bind(this)},__response:function(t){t=t&&this._normalize(t),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:V.map(t,function(t){return"string"==typeof t?{label:t,value:t}:V.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var e=this.menu.element.empty();this._renderMenu(e,t),this.isNewMenu=!0,this.menu.refresh(),e.show(),this._resizeMenu(),e.position(V.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(i,t){var s=this;V.each(t,function(t,e){s._renderItemData(i,e)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(t,e){return V("<li>").append(V("<div>").text(e.label)).appendTo(t)},_move:function(t,e){if(this.menu.element.is(":visible"))return this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),void this.menu.blur()):void this.menu[t](e);this.search(null,e)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){this.isMultiLine&&!this.menu.element.is(":visible")||(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),V.extend(V.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,e){var i=new RegExp(V.ui.autocomplete.escapeRegex(e),"i");return V.grep(t,function(t){return i.test(t.label||t.value||t)})}}),V.widget("ui.autocomplete",V.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(1<t?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){this._superApply(arguments),this.options.disabled||this.cancelSearch||(t=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),V("<div>").text(t).appendTo(this.liveRegion))}});V.ui.autocomplete;var m=/ui-corner-([a-z]){2,6}/g;V.widget("ui.controlgroup",{version:"1.13.0",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var o=this,a=[];V.each(this.options.items,function(s,t){var e,n={};if(t)return"controlgroupLabel"===s?((e=o.element.find(t)).each(function(){var t=V(this);t.children(".ui-controlgroup-label-contents").length||t.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),o._addClass(e,null,"ui-widget ui-widget-content ui-state-default"),void(a=a.concat(e.get()))):void(V.fn[s]&&(n=o["_"+s+"Options"]?o["_"+s+"Options"]("middle"):{classes:{}},o.element.find(t).each(function(){var t=V(this),e=t[s]("instance"),i=V.widget.extend({},n);"button"===s&&t.parent(".ui-spinner").length||((e=e||t[s]()[s]("instance"))&&(i.classes=o._resolveClassesValues(i.classes,e)),t[s](i),i=t[s]("widget"),V.data(i[0],"ui-controlgroup-data",e||t[s]("instance")),a.push(i[0]))})))}),this.childWidgets=V(V.uniqueSort(a)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var t=V(this).data("ui-controlgroup-data");t&&t[e]&&t[e]()})},_updateCornerClass:function(t,e){e=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,"ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"),this._addClass(t,null,e)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],s},_spinnerOptions:function(t){t=this._buildSimpleOptions(t,"ui-spinner");return t.classes["ui-spinner-up"]="",t.classes["ui-spinner-down"]="",t},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e&&"auto",classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(i,s){var n={};return V.each(i,function(t){var e=s.options.classes[t]||"",e=String.prototype.trim.call(e.replace(m,""));n[t]=(e+" "+i[t]).replace(/\s+/g," ")}),n},_setOption:function(t,e){"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"!==t?this.refresh():this._callChildMethod(e?"disable":"enable")},refresh:function(){var n,o=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),n=this.childWidgets,(n=this.options.onlyVisible?n.filter(":visible"):n).length&&(V.each(["first","last"],function(t,e){var i,s=n[e]().data("ui-controlgroup-data");s&&o["_"+s.widgetName+"Options"]?((i=o["_"+s.widgetName+"Options"](1===n.length?"only":e)).classes=o._resolveClassesValues(i.classes,s),s.element[s.widgetName](i)):o._updateCornerClass(n[e](),e)}),this._callChildMethod("refresh"))}});V.widget("ui.checkboxradio",[V.ui.formResetMixin,{version:"1.13.0",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var t,e=this,i=this._super()||{};return this._readType(),t=this.element.labels(),this.label=V(t[t.length-1]),this.label.length||V.error("No label found for checkboxradio widget"),this.originalLabel="",this.label.contents().not(this.element[0]).each(function(){e.originalLabel+=3===this.nodeType?V(this).text():this.outerHTML}),this.originalLabel&&(i.label=this.originalLabel),null!=(t=this.element[0].disabled)&&(i.disabled=t),i},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var t=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===t&&/radio|checkbox/.test(this.type)||V.error("Can't create checkboxradio on element.nodeName="+t+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var t=this.element[0].name,e="input[name='"+V.escapeSelector(t)+"']";return t?(this.form.length?V(this.form[0].elements).filter(e):V(e).filter(function(){return 0===V(this)._form().length})).not(this.element):V([])},_toggleClasses:function(){var t=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",t)._toggleClass(this.icon,null,"ui-icon-blank",!t),"radio"===this.type&&this._getRadioGroup().each(function(){var t=V(this).checkboxradio("instance");t&&t._removeClass(t.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){if("label"!==t||e){if(this._super(t,e),"disabled"===t)return this._toggleClass(this.label,null,"ui-state-disabled",e),void(this.element[0].disabled=e);this.refresh()}},_updateIcon:function(t){var e="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=V("<span>"),this.iconSpace=V("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(e+=t?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,t?"ui-icon-blank":"ui-icon-check")):e+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",e),t||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),(t=this.iconSpace?t.not(this.iconSpace[0]):t).remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]);var _;V.ui.checkboxradio;V.widget("ui.button",{version:"1.13.0",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,e=this._super()||{};return this.isInput=this.element.is("input"),null!=(t=this.element[0].disabled)&&(e.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(t){t.keyCode===V.ui.keyCode.SPACE&&(t.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(t,e){var i="iconPosition"!==t,s=i?this.options.iconPosition:e,t="top"===s||"bottom"===s;this.icon?i&&this._removeClass(this.icon,null,this.options.icon):(this.icon=V("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),i&&this._addClass(this.icon,null,e),this._attachIcon(s),t?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=V("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(s))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var e=(void 0===t.showLabel?this.options:t).showLabel,i=(void 0===t.icon?this.options:t).icon;e||i||(t.showLabel=!0),this._super(t)},_setOption:function(t,e){"icon"===t&&(e?this._updateIcon(t,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===t&&this._updateIcon(t,e),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,e),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",e),(this.element[0].disabled=e)&&this.element.trigger("blur"))},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),!1!==V.uiBackCompat&&(V.widget("ui.button",V.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(t,e){"text"!==t?("showLabel"===t&&(this.options.text=e),"icon"===t&&(this.options.icons.primary=e),"icons"===t&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments)):this._super("showLabel",e)}}),V.fn.button=(_=V.fn.button,function(i){var t="string"==typeof i,s=Array.prototype.slice.call(arguments,1),n=this;return t?this.length||"instance"!==i?this.each(function(){var t=V(this).attr("type"),e=V.data(this,"ui-"+("checkbox"!==t&&"radio"!==t?"button":"checkboxradio"));return"instance"===i?(n=e,!1):e?"function"!=typeof e[i]||"_"===i.charAt(0)?V.error("no such method '"+i+"' for button widget instance"):(t=e[i].apply(e,s))!==e&&void 0!==t?(n=t&&t.jquery?n.pushStack(t.get()):t,!1):void 0:V.error("cannot call methods on button prior to initialization; attempted to call method '"+i+"'")}):n=void 0:(s.length&&(i=V.widget.extend.apply(null,[i].concat(s))),this.each(function(){var t=V(this).attr("type"),e="checkbox"!==t&&"radio"!==t?"button":"checkboxradio",t=V.data(this,"ui-"+e);t?(t.option(i||{}),t._init&&t._init()):"button"!=e?V(this).checkboxradio(V.extend({icon:!1},i)):_.call(V(this),i)})),n}),V.fn.buttonset=function(){return V.ui.controlgroup||V.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))});var v;V.ui.button;function b(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:"",selectMonthLabel:"Select month",selectYearLabel:"Select year"},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,onUpdateDatepicker:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},V.extend(this._defaults,this.regional[""]),this.regional.en=V.extend(!0,{},this.regional[""]),this.regional["en-US"]=V.extend(!0,{},this.regional.en),this.dpDiv=y(V("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function y(t){var e="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.on("mouseout",e,function(){V(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&V(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&V(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",e,w)}function w(){V.datepicker._isDisabledDatepicker((v.inline?v.dpDiv.parent():v.input)[0])||(V(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),V(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&V(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&V(this).addClass("ui-datepicker-next-hover"))}function P(t,e){for(var i in V.extend(t,e),e)null==e[i]&&(t[i]=e[i]);return t}V.extend(V.ui,{datepicker:{version:"1.13.0"}}),V.extend(b.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return P(this._defaults,t||{}),this},_attachDatepicker:function(t,e){var i,s=t.nodeName.toLowerCase(),n="div"===s||"span"===s;t.id||(this.uuid+=1,t.id="dp"+this.uuid),(i=this._newInst(V(t),n)).settings=V.extend({},e||{}),"input"===s?this._connectDatepicker(t,i):n&&this._inlineDatepicker(t,i)},_newInst:function(t,e){return{id:t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1"),input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:e,dpDiv:e?y(V("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,e){var i=V(t);e.append=V([]),e.trigger=V([]),i.hasClass(this.markerClassName)||(this._attachments(i,e),i.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(e),V.data(t,"datepicker",e),e.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,e){var i,s=this._get(e,"appendText"),n=this._get(e,"isRTL");e.append&&e.append.remove(),s&&(e.append=V("<span>").addClass(this._appendClass).text(s),t[n?"before":"after"](e.append)),t.off("focus",this._showDatepicker),e.trigger&&e.trigger.remove(),"focus"!==(i=this._get(e,"showOn"))&&"both"!==i||t.on("focus",this._showDatepicker),"button"!==i&&"both"!==i||(s=this._get(e,"buttonText"),i=this._get(e,"buttonImage"),this._get(e,"buttonImageOnly")?e.trigger=V("<img>").addClass(this._triggerClass).attr({src:i,alt:s,title:s}):(e.trigger=V("<button type='button'>").addClass(this._triggerClass),i?e.trigger.html(V("<img>").attr({src:i,alt:s,title:s})):e.trigger.text(s)),t[n?"before":"after"](e.trigger),e.trigger.on("click",function(){return V.datepicker._datepickerShowing&&V.datepicker._lastInput===t[0]?V.datepicker._hideDatepicker():(V.datepicker._datepickerShowing&&V.datepicker._lastInput!==t[0]&&V.datepicker._hideDatepicker(),V.datepicker._showDatepicker(t[0])),!1}))},_autoSize:function(t){var e,i,s,n,o,a;this._get(t,"autoSize")&&!t.inline&&(o=new Date(2009,11,20),(a=this._get(t,"dateFormat")).match(/[DM]/)&&(e=function(t){for(n=s=i=0;n<t.length;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length))},_inlineDatepicker:function(t,e){var i=V(t);i.hasClass(this.markerClassName)||(i.addClass(this.markerClassName).append(e.dpDiv),V.data(t,"datepicker",e),this._setDate(e,this._getDefaultDate(e),!0),this._updateDatepicker(e),this._updateAlternate(e),e.settings.disabled&&this._disableDatepicker(t),e.dpDiv.css("display","block"))},_dialogDatepicker:function(t,e,i,s,n){var o,a=this._dialogInst;return a||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=V("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.on("keydown",this._doKeyDown),V("body").append(this._dialogInput),(a=this._dialogInst=this._newInst(this._dialogInput,!1)).settings={},V.data(this._dialogInput[0],"datepicker",a)),P(a.settings,s||{}),e=e&&e.constructor===Date?this._formatDate(a,e):e,this._dialogInput.val(e),this._pos=n?n.length?n:[n.pageX,n.pageY]:null,this._pos||(o=document.documentElement.clientWidth,s=document.documentElement.clientHeight,e=document.documentElement.scrollLeft||document.body.scrollLeft,n=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[o/2-100+e,s/2-150+n]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),a.settings.onSelect=i,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),V.blockUI&&V.blockUI(this.dpDiv),V.data(this._dialogInput[0],"datepicker",a),this},_destroyDatepicker:function(t){var e,i=V(t),s=V.data(t,"datepicker");i.hasClass(this.markerClassName)&&(e=t.nodeName.toLowerCase(),V.removeData(t,"datepicker"),"input"===e?(s.append.remove(),s.trigger.remove(),i.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):"div"!==e&&"span"!==e||i.removeClass(this.markerClassName).empty(),v===s&&(v=null,this._curInst=null))},_enableDatepicker:function(e){var t,i=V(e),s=V.data(e,"datepicker");i.hasClass(this.markerClassName)&&("input"===(t=e.nodeName.toLowerCase())?(e.disabled=!1,s.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):"div"!==t&&"span"!==t||((i=i.children("."+this._inlineClass)).children().removeClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=V.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var t,i=V(e),s=V.data(e,"datepicker");i.hasClass(this.markerClassName)&&("input"===(t=e.nodeName.toLowerCase())?(e.disabled=!0,s.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):"div"!==t&&"span"!==t||((i=i.children("."+this._inlineClass)).children().addClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=V.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;e<this._disabledInputs.length;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(t){try{return V.data(t,"datepicker")}catch(t){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,e,i){var s,n,o=this._getInst(t);if(2===arguments.length&&"string"==typeof e)return"defaults"===e?V.extend({},V.datepicker._defaults):o?"all"===e?V.extend({},o.settings):this._get(o,e):null;s=e||{},"string"==typeof e&&((s={})[e]=i),o&&(this._curInst===o&&this._hideDatepicker(),n=this._getDateDatepicker(t,!0),e=this._getMinMaxDate(o,"min"),i=this._getMinMaxDate(o,"max"),P(o.settings,s),null!==e&&void 0!==s.dateFormat&&void 0===s.minDate&&(o.settings.minDate=this._formatDate(o,e)),null!==i&&void 0!==s.dateFormat&&void 0===s.maxDate&&(o.settings.maxDate=this._formatDate(o,i)),"disabled"in s&&(s.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(V(t),o),this._autoSize(o),this._setDate(o,n),this._updateAlternate(o),this._updateDatepicker(o))},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){t=this._getInst(t);t&&this._updateDatepicker(t)},_setDateDatepicker:function(t,e){t=this._getInst(t);t&&(this._setDate(t,e),this._updateDatepicker(t),this._updateAlternate(t))},_getDateDatepicker:function(t,e){t=this._getInst(t);return t&&!t.inline&&this._setDateFromField(t,e),t?this._getDate(t):null},_doKeyDown:function(t){var e,i,s=V.datepicker._getInst(t.target),n=!0,o=s.dpDiv.is(".ui-datepicker-rtl");if(s._keyEvent=!0,V.datepicker._datepickerShowing)switch(t.keyCode){case 9:V.datepicker._hideDatepicker(),n=!1;break;case 13:return(i=V("td."+V.datepicker._dayOverClass+":not(."+V.datepicker._currentClass+")",s.dpDiv))[0]&&V.datepicker._selectDay(t.target,s.selectedMonth,s.selectedYear,i[0]),(e=V.datepicker._get(s,"onSelect"))?(i=V.datepicker._formatDate(s),e.apply(s.input?s.input[0]:null,[i,s])):V.datepicker._hideDatepicker(),!1;case 27:V.datepicker._hideDatepicker();break;case 33:V.datepicker._adjustDate(t.target,t.ctrlKey?-V.datepicker._get(s,"stepBigMonths"):-V.datepicker._get(s,"stepMonths"),"M");break;case 34:V.datepicker._adjustDate(t.target,t.ctrlKey?+V.datepicker._get(s,"stepBigMonths"):+V.datepicker._get(s,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&V.datepicker._clearDate(t.target),n=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&V.datepicker._gotoToday(t.target),n=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,o?1:-1,"D"),n=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&V.datepicker._adjustDate(t.target,t.ctrlKey?-V.datepicker._get(s,"stepBigMonths"):-V.datepicker._get(s,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,-7,"D"),n=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,o?-1:1,"D"),n=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&V.datepicker._adjustDate(t.target,t.ctrlKey?+V.datepicker._get(s,"stepBigMonths"):+V.datepicker._get(s,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,7,"D"),n=t.ctrlKey||t.metaKey;break;default:n=!1}else 36===t.keyCode&&t.ctrlKey?V.datepicker._showDatepicker(this):n=!1;n&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var e,i=V.datepicker._getInst(t.target);if(V.datepicker._get(i,"constrainInput"))return e=V.datepicker._possibleChars(V.datepicker._get(i,"dateFormat")),i=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||i<" "||!e||-1<e.indexOf(i)},_doKeyUp:function(t){t=V.datepicker._getInst(t.target);if(t.input.val()!==t.lastVal)try{V.datepicker.parseDate(V.datepicker._get(t,"dateFormat"),t.input?t.input.val():null,V.datepicker._getFormatConfig(t))&&(V.datepicker._setDateFromField(t),V.datepicker._updateAlternate(t),V.datepicker._updateDatepicker(t))}catch(t){}return!0},_showDatepicker:function(t){var e,i,s,n;"input"!==(t=t.target||t).nodeName.toLowerCase()&&(t=V("input",t.parentNode)[0]),V.datepicker._isDisabledDatepicker(t)||V.datepicker._lastInput===t||(n=V.datepicker._getInst(t),V.datepicker._curInst&&V.datepicker._curInst!==n&&(V.datepicker._curInst.dpDiv.stop(!0,!0),n&&V.datepicker._datepickerShowing&&V.datepicker._hideDatepicker(V.datepicker._curInst.input[0])),!1!==(i=(s=V.datepicker._get(n,"beforeShow"))?s.apply(t,[t,n]):{})&&(P(n.settings,i),n.lastVal=null,V.datepicker._lastInput=t,V.datepicker._setDateFromField(n),V.datepicker._inDialog&&(t.value=""),V.datepicker._pos||(V.datepicker._pos=V.datepicker._findPos(t),V.datepicker._pos[1]+=t.offsetHeight),e=!1,V(t).parents().each(function(){return!(e|="fixed"===V(this).css("position"))}),s={left:V.datepicker._pos[0],top:V.datepicker._pos[1]},V.datepicker._pos=null,n.dpDiv.empty(),n.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),V.datepicker._updateDatepicker(n),s=V.datepicker._checkOffset(n,s,e),n.dpDiv.css({position:V.datepicker._inDialog&&V.blockUI?"static":e?"fixed":"absolute",display:"none",left:s.left+"px",top:s.top+"px"}),n.inline||(i=V.datepicker._get(n,"showAnim"),s=V.datepicker._get(n,"duration"),n.dpDiv.css("z-index",function(t){for(var e,i;t.length&&t[0]!==document;){if(("absolute"===(e=t.css("position"))||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}(V(t))+1),V.datepicker._datepickerShowing=!0,V.effects&&V.effects.effect[i]?n.dpDiv.show(i,V.datepicker._get(n,"showOptions"),s):n.dpDiv[i||"show"](i?s:null),V.datepicker._shouldFocusInput(n)&&n.input.trigger("focus"),V.datepicker._curInst=n)))},_updateDatepicker:function(t){this.maxRows=4,(v=t).dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var e,i=this._getNumberOfMonths(t),s=i[1],n=t.dpDiv.find("."+this._dayOverClass+" a"),o=V.datepicker._get(t,"onUpdateDatepicker");0<n.length&&w.apply(n.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),1<s&&t.dpDiv.addClass("ui-datepicker-multi-"+s).css("width",17*s+"em"),t.dpDiv[(1!==i[0]||1!==i[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===V.datepicker._curInst&&V.datepicker._datepickerShowing&&V.datepicker._shouldFocusInput(t)&&t.input.trigger("focus"),t.yearshtml&&(e=t.yearshtml,setTimeout(function(){e===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year").first().replaceWith(t.yearshtml),e=t.yearshtml=null},0)),o&&o.apply(t.input?t.input[0]:null,[t])},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(t,e,i){var s=t.dpDiv.outerWidth(),n=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,a=t.input?t.input.outerHeight():0,r=document.documentElement.clientWidth+(i?0:V(document).scrollLeft()),l=document.documentElement.clientHeight+(i?0:V(document).scrollTop());return e.left-=this._get(t,"isRTL")?s-o:0,e.left-=i&&e.left===t.input.offset().left?V(document).scrollLeft():0,e.top-=i&&e.top===t.input.offset().top+a?V(document).scrollTop():0,e.left-=Math.min(e.left,e.left+s>r&&s<r?Math.abs(e.left+s-r):0),e.top-=Math.min(e.top,e.top+n>l&&n<l?Math.abs(n+a):0),e},_findPos:function(t){for(var e=this._getInst(t),i=this._get(e,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||V.expr.pseudos.hidden(t));)t=t[i?"previousSibling":"nextSibling"];return[(e=V(t).offset()).left,e.top]},_hideDatepicker:function(t){var e,i,s=this._curInst;!s||t&&s!==V.data(t,"datepicker")||this._datepickerShowing&&(e=this._get(s,"showAnim"),i=this._get(s,"duration"),t=function(){V.datepicker._tidyDialog(s)},V.effects&&(V.effects.effect[e]||V.effects[e])?s.dpDiv.hide(e,V.datepicker._get(s,"showOptions"),i,t):s.dpDiv["slideDown"===e?"slideUp":"fadeIn"===e?"fadeOut":"hide"](e?i:null,t),e||t(),this._datepickerShowing=!1,(t=this._get(s,"onClose"))&&t.apply(s.input?s.input[0]:null,[s.input?s.input.val():"",s]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),V.blockUI&&(V.unblockUI(),V("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(t){var e;V.datepicker._curInst&&(e=V(t.target),t=V.datepicker._getInst(e[0]),(e[0].id===V.datepicker._mainDivId||0!==e.parents("#"+V.datepicker._mainDivId).length||e.hasClass(V.datepicker.markerClassName)||e.closest("."+V.datepicker._triggerClass).length||!V.datepicker._datepickerShowing||V.datepicker._inDialog&&V.blockUI)&&(!e.hasClass(V.datepicker.markerClassName)||V.datepicker._curInst===t)||V.datepicker._hideDatepicker())},_adjustDate:function(t,e,i){var s=V(t),t=this._getInst(s[0]);this._isDisabledDatepicker(s[0])||(this._adjustInstDate(t,e,i),this._updateDatepicker(t))},_gotoToday:function(t){var e=V(t),i=this._getInst(e[0]);this._get(i,"gotoCurrent")&&i.currentDay?(i.selectedDay=i.currentDay,i.drawMonth=i.selectedMonth=i.currentMonth,i.drawYear=i.selectedYear=i.currentYear):(t=new Date,i.selectedDay=t.getDate(),i.drawMonth=i.selectedMonth=t.getMonth(),i.drawYear=i.selectedYear=t.getFullYear()),this._notifyChange(i),this._adjustDate(e)},_selectMonthYear:function(t,e,i){var s=V(t),t=this._getInst(s[0]);t["selected"+("M"===i?"Month":"Year")]=t["draw"+("M"===i?"Month":"Year")]=parseInt(e.options[e.selectedIndex].value,10),this._notifyChange(t),this._adjustDate(s)},_selectDay:function(t,e,i,s){var n=V(t);V(s).hasClass(this._unselectableClass)||this._isDisabledDatepicker(n[0])||((n=this._getInst(n[0])).selectedDay=n.currentDay=parseInt(V("a",s).attr("data-date")),n.selectedMonth=n.currentMonth=e,n.selectedYear=n.currentYear=i,this._selectDate(t,this._formatDate(n,n.currentDay,n.currentMonth,n.currentYear)))},_clearDate:function(t){t=V(t);this._selectDate(t,"")},_selectDate:function(t,e){var i=V(t),t=this._getInst(i[0]);e=null!=e?e:this._formatDate(t),t.input&&t.input.val(e),this._updateAlternate(t),(i=this._get(t,"onSelect"))?i.apply(t.input?t.input[0]:null,[e,t]):t.input&&t.input.trigger("change"),t.inline?this._updateDatepicker(t):(this._hideDatepicker(),this._lastInput=t.input[0],"object"!=typeof t.input[0]&&t.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(t){var e,i,s=this._get(t,"altField");s&&(e=this._get(t,"altFormat")||this._get(t,"dateFormat"),i=this._getDate(t),t=this.formatDate(e,i,this._getFormatConfig(t)),V(document).find(s).val(t))},noWeekends:function(t){t=t.getDay();return[0<t&&t<6,""]},iso8601Week:function(t){var e=new Date(t.getTime());return e.setDate(e.getDate()+4-(e.getDay()||7)),t=e.getTime(),e.setMonth(0),e.setDate(1),Math.floor(Math.round((t-e)/864e5)/7)+1},parseDate:function(e,n,t){if(null==e||null==n)throw"Invalid arguments";if(""===(n="object"==typeof n?n.toString():n+""))return null;for(var i,s,o,a=0,r=(t?t.shortYearCutoff:null)||this._defaults.shortYearCutoff,r="string"!=typeof r?r:(new Date).getFullYear()%100+parseInt(r,10),l=(t?t.dayNamesShort:null)||this._defaults.dayNamesShort,h=(t?t.dayNames:null)||this._defaults.dayNames,c=(t?t.monthNamesShort:null)||this._defaults.monthNamesShort,u=(t?t.monthNames:null)||this._defaults.monthNames,d=-1,p=-1,f=-1,g=-1,m=!1,_=function(t){t=w+1<e.length&&e.charAt(w+1)===t;return t&&w++,t},v=function(t){var e=_(t),e="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,e=new RegExp("^\\d{"+("y"===t?e:1)+","+e+"}"),e=n.substring(a).match(e);if(!e)throw"Missing number at position "+a;return a+=e[0].length,parseInt(e[0],10)},b=function(t,e,i){var s=-1,e=V.map(_(t)?i:e,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(V.each(e,function(t,e){var i=e[1];if(n.substr(a,i.length).toLowerCase()===i.toLowerCase())return s=e[0],a+=i.length,!1}),-1!==s)return s+1;throw"Unknown name at position "+a},y=function(){if(n.charAt(a)!==e.charAt(w))throw"Unexpected literal at position "+a;a++},w=0;w<e.length;w++)if(m)"'"!==e.charAt(w)||_("'")?y():m=!1;else switch(e.charAt(w)){case"d":f=v("d");break;case"D":b("D",l,h);break;case"o":g=v("o");break;case"m":p=v("m");break;case"M":p=b("M",c,u);break;case"y":d=v("y");break;case"@":d=(o=new Date(v("@"))).getFullYear(),p=o.getMonth()+1,f=o.getDate();break;case"!":d=(o=new Date((v("!")-this._ticksTo1970)/1e4)).getFullYear(),p=o.getMonth()+1,f=o.getDate();break;case"'":_("'")?y():m=!0;break;default:y()}if(a<n.length&&(s=n.substr(a),!/^\s+/.test(s)))throw"Extra/unparsed characters found in date: "+s;if(-1===d?d=(new Date).getFullYear():d<100&&(d+=(new Date).getFullYear()-(new Date).getFullYear()%100+(d<=r?0:-100)),-1<g)for(p=1,f=g;;){if(f<=(i=this._getDaysInMonth(d,p-1)))break;p++,f-=i}if((o=this._daylightSavingAdjust(new Date(d,p-1,f))).getFullYear()!==d||o.getMonth()+1!==p||o.getDate()!==f)throw"Invalid date";return o},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*60*60*1e7,formatDate:function(e,t,i){if(!t)return"";function s(t,e,i){var s=""+e;if(c(t))for(;s.length<i;)s="0"+s;return s}function n(t,e,i,s){return(c(t)?s:i)[e]}var o,a=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,r=(i?i.dayNames:null)||this._defaults.dayNames,l=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,h=(i?i.monthNames:null)||this._defaults.monthNames,c=function(t){t=o+1<e.length&&e.charAt(o+1)===t;return t&&o++,t},u="",d=!1;if(t)for(o=0;o<e.length;o++)if(d)"'"!==e.charAt(o)||c("'")?u+=e.charAt(o):d=!1;else switch(e.charAt(o)){case"d":u+=s("d",t.getDate(),2);break;case"D":u+=n("D",t.getDay(),a,r);break;case"o":u+=s("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=s("m",t.getMonth()+1,2);break;case"M":u+=n("M",t.getMonth(),l,h);break;case"y":u+=c("y")?t.getFullYear():(t.getFullYear()%100<10?"0":"")+t.getFullYear()%100;break;case"@":u+=t.getTime();break;case"!":u+=1e4*t.getTime()+this._ticksTo1970;break;case"'":c("'")?u+="'":d=!0;break;default:u+=e.charAt(o)}return u},_possibleChars:function(e){for(var t="",i=!1,s=function(t){t=n+1<e.length&&e.charAt(n+1)===t;return t&&n++,t},n=0;n<e.length;n++)if(i)"'"!==e.charAt(n)||s("'")?t+=e.charAt(n):i=!1;else switch(e.charAt(n)){case"d":case"m":case"y":case"@":t+="0123456789";break;case"D":case"M":return null;case"'":s("'")?t+="'":i=!0;break;default:t+=e.charAt(n)}return t},_get:function(t,e){return(void 0!==t.settings[e]?t.settings:this._defaults)[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(t){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(r,t,e){var i,s,t=null==t||""===t?e:"string"==typeof t?function(t){try{return V.datepicker.parseDate(V.datepicker._get(r,"dateFormat"),t,V.datepicker._getFormatConfig(r))}catch(t){}for(var e=(t.toLowerCase().match(/^c/)?V.datepicker._getDate(r):null)||new Date,i=e.getFullYear(),s=e.getMonth(),n=e.getDate(),o=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,a=o.exec(t);a;){switch(a[2]||"d"){case"d":case"D":n+=parseInt(a[1],10);break;case"w":case"W":n+=7*parseInt(a[1],10);break;case"m":case"M":s+=parseInt(a[1],10),n=Math.min(n,V.datepicker._getDaysInMonth(i,s));break;case"y":case"Y":i+=parseInt(a[1],10),n=Math.min(n,V.datepicker._getDaysInMonth(i,s))}a=o.exec(t)}return new Date(i,s,n)}(t):"number"==typeof t?isNaN(t)?e:(i=t,(s=new Date).setDate(s.getDate()+i),s):new Date(t.getTime());return(t=t&&"Invalid Date"===t.toString()?e:t)&&(t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0)),this._daylightSavingAdjust(t)},_daylightSavingAdjust:function(t){return t?(t.setHours(12<t.getHours()?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,e=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=e.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=e.getMonth(),t.drawYear=t.selectedYear=t.currentYear=e.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){return!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay))},_attachHandlers:function(t){var e=this._get(t,"stepMonths"),i="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){V.datepicker._adjustDate(i,-e,"M")},next:function(){V.datepicker._adjustDate(i,+e,"M")},hide:function(){V.datepicker._hideDatepicker()},today:function(){V.datepicker._gotoToday(i)},selectDay:function(){return V.datepicker._selectDay(i,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return V.datepicker._selectMonthYear(i,this,"M"),!1},selectYear:function(){return V.datepicker._selectMonthYear(i,this,"Y"),!1}};V(this).on(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,l,h,c,u,d,p,f,g,m,_,v,b,y,w,x,k,C,D,I,T,P,M,S,H,z,A=new Date,O=this._daylightSavingAdjust(new Date(A.getFullYear(),A.getMonth(),A.getDate())),N=this._get(t,"isRTL"),E=this._get(t,"showButtonPanel"),W=this._get(t,"hideIfNoPrevNext"),F=this._get(t,"navigationAsDateFormat"),L=this._getNumberOfMonths(t),R=this._get(t,"showCurrentAtPos"),A=this._get(t,"stepMonths"),Y=1!==L[0]||1!==L[1],B=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),j=this._getMinMaxDate(t,"min"),q=this._getMinMaxDate(t,"max"),K=t.drawMonth-R,U=t.drawYear;if(K<0&&(K+=12,U--),q)for(e=this._daylightSavingAdjust(new Date(q.getFullYear(),q.getMonth()-L[0]*L[1]+1,q.getDate())),e=j&&e<j?j:e;this._daylightSavingAdjust(new Date(U,K,1))>e;)--K<0&&(K=11,U--);for(t.drawMonth=K,t.drawYear=U,R=this._get(t,"prevText"),R=F?this.formatDate(R,this._daylightSavingAdjust(new Date(U,K-A,1)),this._getFormatConfig(t)):R,i=this._canAdjustMonth(t,-1,U,K)?V("<a>").attr({class:"ui-datepicker-prev ui-corner-all","data-handler":"prev","data-event":"click",title:R}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(N?"e":"w")).text(R))[0].outerHTML:W?"":V("<a>").attr({class:"ui-datepicker-prev ui-corner-all ui-state-disabled",title:R}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(N?"e":"w")).text(R))[0].outerHTML,R=this._get(t,"nextText"),R=F?this.formatDate(R,this._daylightSavingAdjust(new Date(U,K+A,1)),this._getFormatConfig(t)):R,s=this._canAdjustMonth(t,1,U,K)?V("<a>").attr({class:"ui-datepicker-next ui-corner-all","data-handler":"next","data-event":"click",title:R}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(N?"w":"e")).text(R))[0].outerHTML:W?"":V("<a>").attr({class:"ui-datepicker-next ui-corner-all ui-state-disabled",title:R}).append(V("<span>").attr("class","ui-icon ui-icon-circle-triangle-"+(N?"w":"e")).text(R))[0].outerHTML,A=this._get(t,"currentText"),W=this._get(t,"gotoCurrent")&&t.currentDay?B:O,A=F?this.formatDate(A,W,this._getFormatConfig(t)):A,R="",t.inline||(R=V("<button>").attr({type:"button",class:"ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all","data-handler":"hide","data-event":"click"}).text(this._get(t,"closeText"))[0].outerHTML),F="",E&&(F=V("<div class='ui-datepicker-buttonpane ui-widget-content'>").append(N?R:"").append(this._isInRange(t,W)?V("<button>").attr({type:"button",class:"ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all","data-handler":"today","data-event":"click"}).text(A):"").append(N?"":R)[0].outerHTML),n=parseInt(this._get(t,"firstDay"),10),n=isNaN(n)?0:n,o=this._get(t,"showWeek"),a=this._get(t,"dayNames"),r=this._get(t,"dayNamesMin"),l=this._get(t,"monthNames"),h=this._get(t,"monthNamesShort"),c=this._get(t,"beforeShowDay"),u=this._get(t,"showOtherMonths"),d=this._get(t,"selectOtherMonths"),p=this._getDefaultDate(t),f="",m=0;m<L[0];m++){for(_="",this.maxRows=4,v=0;v<L[1];v++){if(b=this._daylightSavingAdjust(new Date(U,K,t.selectedDay)),y=" ui-corner-all",w="",Y){if(w+="<div class='ui-datepicker-group",1<L[1])switch(v){case 0:w+=" ui-datepicker-group-first",y=" ui-corner-"+(N?"right":"left");break;case L[1]-1:w+=" ui-datepicker-group-last",y=" ui-corner-"+(N?"left":"right");break;default:w+=" ui-datepicker-group-middle",y=""}w+="'>"}for(w+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+y+"'>"+(/all|left/.test(y)&&0===m?N?s:i:"")+(/all|right/.test(y)&&0===m?N?i:s:"")+this._generateMonthYearHeader(t,K,U,j,q,0<m||0<v,l,h)+"</div><table class='ui-datepicker-calendar'><thead><tr>",x=o?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",g=0;g<7;g++)x+="<th scope='col'"+(5<=(g+n+6)%7?" class='ui-datepicker-week-end'":"")+"><span title='"+a[k=(g+n)%7]+"'>"+r[k]+"</span></th>";for(w+=x+"</tr></thead><tbody>",D=this._getDaysInMonth(U,K),U===t.selectedYear&&K===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,D)),C=(this._getFirstDayOfMonth(U,K)-n+7)%7,D=Math.ceil((C+D)/7),I=Y&&this.maxRows>D?this.maxRows:D,this.maxRows=I,T=this._daylightSavingAdjust(new Date(U,K,1-C)),P=0;P<I;P++){for(w+="<tr>",M=o?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(T)+"</td>":"",g=0;g<7;g++)S=c?c.apply(t.input?t.input[0]:null,[T]):[!0,""],z=(H=T.getMonth()!==K)&&!d||!S[0]||j&&T<j||q&&q<T,M+="<td class='"+(5<=(g+n+6)%7?" ui-datepicker-week-end":"")+(H?" ui-datepicker-other-month":"")+(T.getTime()===b.getTime()&&K===t.selectedMonth&&t._keyEvent||p.getTime()===T.getTime()&&p.getTime()===b.getTime()?" "+this._dayOverClass:"")+(z?" "+this._unselectableClass+" ui-state-disabled":"")+(H&&!u?"":" "+S[1]+(T.getTime()===B.getTime()?" "+this._currentClass:"")+(T.getTime()===O.getTime()?" ui-datepicker-today":""))+"'"+(H&&!u||!S[2]?"":" title='"+S[2].replace(/'/g,"&#39;")+"'")+(z?"":" data-handler='selectDay' data-event='click' data-month='"+T.getMonth()+"' data-year='"+T.getFullYear()+"'")+">"+(H&&!u?"&#xa0;":z?"<span class='ui-state-default'>"+T.getDate()+"</span>":"<a class='ui-state-default"+(T.getTime()===O.getTime()?" ui-state-highlight":"")+(T.getTime()===B.getTime()?" ui-state-active":"")+(H?" ui-priority-secondary":"")+"' href='#' aria-current='"+(T.getTime()===B.getTime()?"true":"false")+"' data-date='"+T.getDate()+"'>"+T.getDate()+"</a>")+"</td>",T.setDate(T.getDate()+1),T=this._daylightSavingAdjust(T);w+=M+"</tr>"}11<++K&&(K=0,U++),_+=w+="</tbody></table>"+(Y?"</div>"+(0<L[0]&&v===L[1]-1?"<div class='ui-datepicker-row-break'></div>":""):"")}f+=_}return f+=F,t._keyEvent=!1,f},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var l,h,c,u,d,p,f=this._get(t,"changeMonth"),g=this._get(t,"changeYear"),m=this._get(t,"showMonthAfterYear"),_=this._get(t,"selectMonthLabel"),v=this._get(t,"selectYearLabel"),b="<div class='ui-datepicker-title'>",y="";if(o||!f)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(l=s&&s.getFullYear()===i,h=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' aria-label='"+_+"' data-handler='selectMonth' data-event='change'>",c=0;c<12;c++)(!l||c>=s.getMonth())&&(!h||c<=n.getMonth())&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(m||(b+=y+(!o&&f&&g?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",o||!g)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(a=this._get(t,"yearRange").split(":"),u=(new Date).getFullYear(),d=(_=function(t){t=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?u+parseInt(t,10):parseInt(t,10);return isNaN(t)?u:t})(a[0]),p=Math.max(d,_(a[1]||"")),d=s?Math.max(d,s.getFullYear()):d,p=n?Math.min(p,n.getFullYear()):p,t.yearshtml+="<select class='ui-datepicker-year' aria-label='"+v+"' data-handler='selectYear' data-event='change'>";d<=p;d++)t.yearshtml+="<option value='"+d+"'"+(d===i?" selected='selected'":"")+">"+d+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),m&&(b+=(!o&&f&&g?"":"&#xa0;")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),e=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),e=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,e)));t.selectedDay=e.getDate(),t.drawMonth=t.selectedMonth=e.getMonth(),t.drawYear=t.selectedYear=e.getFullYear(),"M"!==i&&"Y"!==i||this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),t=this._getMinMaxDate(t,"max"),e=i&&e<i?i:e;return t&&t<e?t:e},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){t=this._get(t,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),n=this._daylightSavingAdjust(new Date(i,s+(e<0?e:n[0]*n[1]),1));return e<0&&n.setDate(this._getDaysInMonth(n.getFullYear(),n.getMonth())),this._isInRange(t,n)},_isInRange:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=null,o=null,a=this._get(t,"yearRange");return a&&(t=a.split(":"),a=(new Date).getFullYear(),n=parseInt(t[0],10),o=parseInt(t[1],10),t[0].match(/[+\-].*/)&&(n+=a),t[1].match(/[+\-].*/)&&(o+=a)),(!i||e.getTime()>=i.getTime())&&(!s||e.getTime()<=s.getTime())&&(!n||e.getFullYear()>=n)&&(!o||e.getFullYear()<=o)},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return{shortYearCutoff:e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);e=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),e,this._getFormatConfig(t))}}),V.fn.datepicker=function(t){if(!this.length)return this;V.datepicker.initialized||(V(document).on("mousedown",V.datepicker._checkExternalClick),V.datepicker.initialized=!0),0===V("#"+V.datepicker._mainDivId).length&&V("body").append(V.datepicker.dpDiv);var e=Array.prototype.slice.call(arguments,1);return"string"==typeof t&&("isDisabled"===t||"getDate"===t||"widget"===t)||"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?V.datepicker["_"+t+"Datepicker"].apply(V.datepicker,[this[0]].concat(e)):this.each(function(){"string"==typeof t?V.datepicker["_"+t+"Datepicker"].apply(V.datepicker,[this].concat(e)):V.datepicker._attachDatepicker(this,t)})},V.datepicker=new b,V.datepicker.initialized=!1,V.datepicker.uuid=(new Date).getTime(),V.datepicker.version="1.13.0";V.datepicker;V.widget("ui.dialog",{version:"1.13.0",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var e=V(this).css(t).offset().top;e<0&&V(this).css("top",t.top-e)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&V.fn.draggable&&this._makeDraggable(),this.options.resizable&&V.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?V(t):this.document.find(t||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),(t=e.parent.children().eq(e.index)).length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog},disable:V.noop,enable:V.noop,close:function(t){var e=this;this._isOpen&&!1!==this._trigger("beforeClose",t)&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||V.ui.safeBlur(V.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){e._trigger("close",t)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,e){var i=!1,s=this.uiDialog.siblings(".ui-front:visible").map(function(){return+V(this).css("z-index")}).get(),s=Math.max.apply(null,s);return s>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",s+1),i=!0),i&&!e&&this._trigger("focus",t),i},open:function(){var t=this;this._isOpen?this._moveToTop()&&this._focusTabbable():(this._isOpen=!0,this.opener=V(V.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"))},_focusTabbable:function(){var t=this._focusedElement;(t=!(t=!(t=!(t=!(t=t||this.element.find("[autofocus]")).length?this.element.find(":tabbable"):t).length?this.uiDialogButtonPane.find(":tabbable"):t).length?this.uiDialogTitlebarClose.filter(":tabbable"):t).length?this.uiDialog:t).eq(0).trigger("focus")},_restoreTabbableFocus:function(){var t=V.ui.safeActiveElement(this.document[0]);this.uiDialog[0]===t||V.contains(this.uiDialog[0],t)||this._focusTabbable()},_keepFocus:function(t){t.preventDefault(),this._restoreTabbableFocus(),this._delay(this._restoreTabbableFocus)},_createWrapper:function(){this.uiDialog=V("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===V.ui.keyCode.ESCAPE)return t.preventDefault(),void this.close(t);var e,i,s;t.keyCode!==V.ui.keyCode.TAB||t.isDefaultPrevented()||(e=this.uiDialog.find(":tabbable"),i=e.first(),s=e.last(),t.target!==s[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==i[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){s.trigger("focus")}),t.preventDefault()):(this._delay(function(){i.trigger("focus")}),t.preventDefault()))},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=V("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(t){V(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=V("<button type='button'></button>").button({label:V("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),t=V("<span>").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(t,"ui-dialog-title"),this._title(t),this.uiDialogTitlebar.prependTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(t){this.options.title?t.text(this.options.title):t.html("&#160;")},_createButtonPane:function(){this.uiDialogButtonPane=V("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=V("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var s=this,t=this.options.buttons;this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),V.isEmptyObject(t)||Array.isArray(t)&&!t.length?this._removeClass(this.uiDialog,"ui-dialog-buttons"):(V.each(t,function(t,e){var i;e=V.extend({type:"button"},e="function"==typeof e?{click:e,text:t}:e),i=e.click,t={icon:e.icon,iconPosition:e.iconPosition,showLabel:e.showLabel,icons:e.icons,text:e.text},delete e.click,delete e.icon,delete e.iconPosition,delete e.showLabel,delete e.icons,"boolean"==typeof e.text&&delete e.text,V("<button></button>",e).button(t).appendTo(s.uiButtonSet).on("click",function(){i.apply(s.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog))},_makeDraggable:function(){var n=this,o=this.options;function a(t){return{position:t.position,offset:t.offset}}this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(t,e){n._addClass(V(this),"ui-dialog-dragging"),n._blockFrames(),n._trigger("dragStart",t,a(e))},drag:function(t,e){n._trigger("drag",t,a(e))},stop:function(t,e){var i=e.offset.left-n.document.scrollLeft(),s=e.offset.top-n.document.scrollTop();o.position={my:"left top",at:"left"+(0<=i?"+":"")+i+" top"+(0<=s?"+":"")+s,of:n.window},n._removeClass(V(this),"ui-dialog-dragging"),n._unblockFrames(),n._trigger("dragStop",t,a(e))}})},_makeResizable:function(){var n=this,o=this.options,t=o.resizable,e=this.uiDialog.css("position"),t="string"==typeof t?t:"n,e,s,w,se,sw,ne,nw";function a(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:o.maxWidth,maxHeight:o.maxHeight,minWidth:o.minWidth,minHeight:this._minHeight(),handles:t,start:function(t,e){n._addClass(V(this),"ui-dialog-resizing"),n._blockFrames(),n._trigger("resizeStart",t,a(e))},resize:function(t,e){n._trigger("resize",t,a(e))},stop:function(t,e){var i=n.uiDialog.offset(),s=i.left-n.document.scrollLeft(),i=i.top-n.document.scrollTop();o.height=n.uiDialog.height(),o.width=n.uiDialog.width(),o.position={my:"left top",at:"left"+(0<=s?"+":"")+s+" top"+(0<=i?"+":"")+i,of:n.window},n._removeClass(V(this),"ui-dialog-resizing"),n._unblockFrames(),n._trigger("resizeStop",t,a(e))}}).css("position",e)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=V(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),e=V.inArray(this,t);-1!==e&&t.splice(e,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||this.document.data("ui-dialog-instances",t=[]),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,n={};V.each(t,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(t,e){var i,s=this.uiDialog;"disabled"!==t&&(this._super(t,e),"appendTo"===t&&this.uiDialog.appendTo(this._appendTo()),"buttons"===t&&this._createButtons(),"closeText"===t&&this.uiDialogTitlebarClose.button({label:V("<a>").text(""+this.options.closeText).html()}),"draggable"===t&&((i=s.is(":data(ui-draggable)"))&&!e&&s.draggable("destroy"),!i&&e&&this._makeDraggable()),"position"===t&&this._position(),"resizable"===t&&((i=s.is(":data(ui-resizable)"))&&!e&&s.resizable("destroy"),i&&"string"==typeof e&&s.resizable("option","handles",e),i||!1===e||this._makeResizable()),"title"===t&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=V(this);return V("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return!!V(t.target).closest(".ui-dialog").length||!!V(t.target).closest(".ui-datepicker").length},_createOverlay:function(){var i,s;this.options.modal&&(i=V.fn.jquery.substring(0,4),s=!0,this._delay(function(){s=!1}),this.document.data("ui-dialog-overlays")||this.document.on("focusin.ui-dialog",function(t){var e;s||((e=this._trackingInstances()[0])._allowInteraction(t)||(t.preventDefault(),e._focusTabbable(),"3.4."!==i&&"3.5."!==i||e._delay(e._restoreTabbableFocus)))}.bind(this)),this.overlay=V("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1))},_destroyOverlay:function(){var t;this.options.modal&&this.overlay&&((t=this.document.data("ui-dialog-overlays")-1)?this.document.data("ui-dialog-overlays",t):(this.document.off("focusin.ui-dialog"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null)}}),!1!==V.uiBackCompat&&V.widget("ui.dialog",V.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(t,e){"dialogClass"===t&&this.uiDialog.removeClass(this.options.dialogClass).addClass(e),this._superApply(arguments)}});V.ui.dialog,V.widget("ui.progressbar",{version:"1.13.0",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=V("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(t){if(void 0===t)return this.options.value;this.options.value=this._constrainedValue(t),this._refreshValue()},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=!1===t,"number"!=typeof t&&(t=0),!this.indeterminate&&Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,e=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).width(e.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,t===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=V("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),V.widget("ui.selectmenu",[V.ui.formResetMixin,{version:"1.13.0",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:function(){var t=this.element.uniqueId().attr("id");this.ids={element:t,button:t+"-button",menu:t+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=V()},_drawButton:function(){var t,e=this,i=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:function(t){this.button.trigger("focus"),t.preventDefault()}}),this.element.hide(),this.button=V("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),t=V("<span>").appendTo(this.button),this._addClass(t,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(i).appendTo(this.button),!1!==this.options.width&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){e._rendered||e._refreshMenu()})},_drawMenu:function(){var i=this;this.menu=V("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=V("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(t,e){t.preventDefault(),i._setSelection(),i._select(e.item.data("ui-selectmenu-item"),t)},focus:function(t,e){e=e.item.data("ui-selectmenu-item");null!=i.focusIndex&&e.index!==i.focusIndex&&(i._trigger("focus",t,{item:e}),i.isOpen||i._select(e,t)),i.focusIndex=e.index,i.button.attr("aria-activedescendant",i.menuItems.eq(e.index).attr("id"))}}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),null===this.options.width&&this._resizeButton()},_refreshMenu:function(){var t=this.element.find("option");this.menu.empty(),this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,t.length&&(t=this._getSelectedItem(),this.menuInstance.focus(null,t),this._setAria(t.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(t){this.options.disabled||(this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",t)))},_position:function(){this.menuWrap.position(V.extend({of:this.button},this.options.position))},close:function(t){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",t))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(t){var e=V("<span>");return this._setText(e,t.label),this._addClass(e,"ui-selectmenu-text"),e},_renderMenu:function(s,t){var n=this,o="";V.each(t,function(t,e){var i;e.optgroup!==o&&(i=V("<li>",{text:e.optgroup}),n._addClass(i,"ui-selectmenu-optgroup","ui-menu-divider"+(e.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),i.appendTo(s),o=e.optgroup),n._renderItemData(s,e)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-selectmenu-item",e)},_renderItem:function(t,e){var i=V("<li>"),s=V("<div>",{title:e.element.attr("title")});return e.disabled&&this._addClass(i,null,"ui-state-disabled"),this._setText(s,e.label),i.append(s).appendTo(t)},_setText:function(t,e){e?t.text(e):t.html("&#160;")},_move:function(t,e){var i,s=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex).parent("li"):(i=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),s+=":not(.ui-state-disabled)"),(s="first"===t||"last"===t?i["first"===t?"prevAll":"nextAll"](s).eq(-1):i[t+"All"](s).eq(0)).length&&this.menuInstance.focus(e,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},_toggle:function(t){this[this.isOpen?"close":"open"](t)},_setSelection:function(){var t;this.range&&(window.getSelection?((t=window.getSelection()).removeAllRanges(),t.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(t){this.isOpen&&(V(t.target).closest(".ui-selectmenu-menu, #"+V.escapeSelector(this.ids.button)).length||this.close(t))}},_buttonEvents:{mousedown:function(){var t;window.getSelection?(t=window.getSelection()).rangeCount&&(this.range=t.getRangeAt(0)):this.range=document.selection.createRange()},click:function(t){this._setSelection(),this._toggle(t)},keydown:function(t){var e=!0;switch(t.keyCode){case V.ui.keyCode.TAB:case V.ui.keyCode.ESCAPE:this.close(t),e=!1;break;case V.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case V.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case V.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case V.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case V.ui.keyCode.LEFT:this._move("prev",t);break;case V.ui.keyCode.RIGHT:this._move("next",t);break;case V.ui.keyCode.HOME:case V.ui.keyCode.PAGE_UP:this._move("first",t);break;case V.ui.keyCode.END:case V.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),e=!1}e&&t.preventDefault()}},_selectFocusedItem:function(t){var e=this.menuItems.eq(this.focusIndex).parent("li");e.hasClass("ui-state-disabled")||this._select(e.data("ui-selectmenu-item"),t)},_select:function(t,e){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=t.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(t)),this._setAria(t),this._trigger("select",e,{item:t}),t.index!==i&&this._trigger("change",e,{item:t}),this.close(e)},_setAria:function(t){t=this.menuItems.eq(t.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(t,e){var i;"icons"===t&&(i=this.button.find("span.ui-icon"),this._removeClass(i,null,this.options.icons.button)._addClass(i,null,e.button)),this._super(t,e),"appendTo"===t&&this.menuWrap.appendTo(this._appendTo()),"width"===t&&this._resizeButton()},_setOptionDisabled:function(t){this._super(t),this.menuInstance.option("disabled",t),this.button.attr("aria-disabled",t),this._toggleClass(this.button,null,"ui-state-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},_appendTo:function(){var t=this.options.appendTo;return t=!(t=!(t=t&&(t.jquery||t.nodeType?V(t):this.document.find(t).eq(0)))||!t[0]?this.element.closest(".ui-front, dialog"):t).length?this.document[0].body:t},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var t=this.options.width;!1!==t?(null===t&&(t=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(t)):this.button.css("width","")},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){var t=this._super();return t.disabled=this.element.prop("disabled"),t},_parseOptions:function(t){var i=this,s=[];t.each(function(t,e){e.hidden||s.push(i._parseOption(V(e),t))}),this.items=s},_parseOption:function(t,e){var i=t.parent("optgroup");return{element:t,index:e,value:t.val(),label:t.text(),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||t.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)}}]),V.widget("ui.slider",V.ui.mouse,{version:"1.13.0",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,e=this.options,i=this.element.find(".ui-slider-handle"),s=[],n=e.values&&e.values.length||1;for(i.length>n&&(i.slice(n).remove(),i=i.slice(0,n)),t=i.length;t<n;t++)s.push("<span tabindex='0'></span>");this.handles=i.add(V(s.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(t){V(this).data("ui-slider-handle-index",t).attr("tabIndex",0)})},_createRange:function(){var t=this.options;t.range?(!0===t.range&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:Array.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=V("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),"min"!==t.range&&"max"!==t.range||this._addClass(this.range,"ui-slider-range-"+t.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(t){var i,s,n,o,e,a,r=this,l=this.options;return!l.disabled&&(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),a={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(a),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var e=Math.abs(i-r.values(t));(e<s||s===e&&(t===r._lastChangedValue||r.values(t)===l.min))&&(s=e,n=V(this),o=t)}),!1!==this._start(t,o)&&(this._mouseSliding=!0,this._handleIndex=o,this._addClass(n,null,"ui-state-active"),n.trigger("focus"),e=n.offset(),a=!V(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=a?{left:0,top:0}:{left:t.pageX-e.left-n.width()/2,top:t.pageY-e.top-n.height()/2-(parseInt(n.css("borderTopWidth"),10)||0)-(parseInt(n.css("borderBottomWidth"),10)||0)+(parseInt(n.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,i),this._animateOff=!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},e=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,e),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,t="horizontal"===this.orientation?(e=this.elementSize.width,t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),t=t/e;return(t=1<t?1:t)<0&&(t=0),"vertical"===this.orientation&&(t=1-t),e=this._valueMax()-this._valueMin(),e=this._valueMin()+t*e,this._trimAlignValue(e)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n=this.value(),o=this.values();this._hasMultipleValues()&&(s=this.values(e?0:1),n=this.values(e),2===this.options.values.length&&!0===this.options.range&&(i=0===e?Math.min(s,i):Math.max(s,i)),o[e]=i),i!==n&&!1!==this._trigger("slide",t,this._uiHash(e,i,o))&&(this._hasMultipleValues()?this.values(e,i):this.value(i))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),void this._change(null,0)):this._value()},values:function(t,e){var i,s,n;if(1<arguments.length)return this.options.values[t]=this._trimAlignValue(e),this._refreshValue(),void this._change(null,t);if(!arguments.length)return this._values();if(!Array.isArray(t))return this._hasMultipleValues()?this._values(t):this.value();for(i=this.options.values,s=t,n=0;n<i.length;n+=1)i[n]=this._trimAlignValue(s[n]),this._change(null,n);this._refreshValue()},_setOption:function(t,e){var i,s=0;switch("range"===t&&!0===this.options.range&&("min"===e?(this.options.value=this._values(0),this.options.values=null):"max"===e&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),Array.isArray(this.options.values)&&(s=this.options.values.length),this._super(t,e),t){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(e),this.handles.css("horizontal"===e?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),i=s-1;0<=i;i--)this._change(null,i);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i;if(arguments.length)return t=this.options.values[t],t=this._trimAlignValue(t);if(this._hasMultipleValues()){for(e=this.options.values.slice(),i=0;i<e.length;i+=1)e[i]=this._trimAlignValue(e[i]);return e}return[]},_trimAlignValue:function(t){if(t<=this._valueMin())return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=0<this.options.step?this.options.step:1,i=(t-this._valueMin())%e,t=t-i;return 2*Math.abs(i)>=e&&(t+=0<i?e:-e),parseFloat(t.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step;(t=Math.round((t-e)/i)*i+e)>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return t=null!==this.options.min?Math.max(t,this._precisionOf(this.options.min)):t},_precisionOf:function(t){var e=t.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,t,s,n,o=this.options.range,a=this.options,r=this,l=!this._animateOff&&a.animate,h={};this._hasMultipleValues()?this.handles.each(function(t){i=(r.values(t)-r._valueMin())/(r._valueMax()-r._valueMin())*100,h["horizontal"===r.orientation?"left":"bottom"]=i+"%",V(this).stop(1,1)[l?"animate":"css"](h,a.animate),!0===r.options.range&&("horizontal"===r.orientation?(0===t&&r.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},a.animate),1===t&&r.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:a.animate})):(0===t&&r.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},a.animate),1===t&&r.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:a.animate}))),e=i}):(t=this.value(),s=this._valueMin(),n=this._valueMax(),i=n!==s?(t-s)/(n-s)*100:0,h["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](h,a.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},a.animate),"max"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:100-i+"%"},a.animate),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},a.animate),"max"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:100-i+"%"},a.animate))},_handleEvents:{keydown:function(t){var e,i,s,n=V(t.target).data("ui-slider-handle-index");switch(t.keyCode){case V.ui.keyCode.HOME:case V.ui.keyCode.END:case V.ui.keyCode.PAGE_UP:case V.ui.keyCode.PAGE_DOWN:case V.ui.keyCode.UP:case V.ui.keyCode.RIGHT:case V.ui.keyCode.DOWN:case V.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(V(t.target),null,"ui-state-active"),!1===this._start(t,n)))return}switch(s=this.options.step,e=i=this._hasMultipleValues()?this.values(n):this.value(),t.keyCode){case V.ui.keyCode.HOME:i=this._valueMin();break;case V.ui.keyCode.END:i=this._valueMax();break;case V.ui.keyCode.PAGE_UP:i=this._trimAlignValue(e+(this._valueMax()-this._valueMin())/this.numPages);break;case V.ui.keyCode.PAGE_DOWN:i=this._trimAlignValue(e-(this._valueMax()-this._valueMin())/this.numPages);break;case V.ui.keyCode.UP:case V.ui.keyCode.RIGHT:if(e===this._valueMax())return;i=this._trimAlignValue(e+s);break;case V.ui.keyCode.DOWN:case V.ui.keyCode.LEFT:if(e===this._valueMin())return;i=this._trimAlignValue(e-s)}this._slide(t,n,i)},keyup:function(t){var e=V(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,e),this._change(t,e),this._removeClass(V(t.target),null,"ui-state-active"))}}});function M(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}V.widget("ui.spinner",{version:"1.13.0",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var s=this._super(),n=this.element;return V.each(["min","max","step"],function(t,e){var i=n.attr(e);null!=i&&i.length&&(s[e]=i)}),s},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){this.cancelBlur?delete this.cancelBlur:(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t))},mousewheel:function(t,e){var i=V.ui.safeActiveElement(this.document[0]);if(this.element[0]===i&&e){if(!this.spinning&&!this._start(t))return!1;this._spin((0<e?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(t){var e;function i(){this.element[0]===V.ui.safeActiveElement(this.document[0])||(this.element.trigger("focus"),this.previous=e,this._delay(function(){this.previous=e}))}e=this.element[0]===V.ui.safeActiveElement(this.document[0])?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),!1!==this._start(t)&&this._repeat(null,V(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){if(V(t.currentTarget).hasClass("ui-state-active"))return!1!==this._start(t)&&void this._repeat(null,V(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&0<this.uiSpinner.height()&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(t){var e=this.options,i=V.ui.keyCode;switch(t.keyCode){case i.UP:return this._repeat(null,1,t),!0;case i.DOWN:return this._repeat(null,-1,t),!0;case i.PAGE_UP:return this._repeat(null,e.page,t),!0;case i.PAGE_DOWN:return this._repeat(null,-e.page,t),!0}return!1},_start:function(t){return!(!this.spinning&&!1===this._trigger("start",t))&&(this.counter||(this.counter=1),this.spinning=!0)},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&!1===this._trigger("spin",e,{value:i})||(this._value(i),this.counter++)},_increment:function(t){var e=this.options.incremental;return e?"function"==typeof e?e(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return t=null!==this.options.min?Math.max(t,this._precisionOf(this.options.min)):t},_precisionOf:function(t){var e=t.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_adjustValue:function(t){var e=this.options,i=null!==e.min?e.min:0,s=t-i;return t=i+Math.round(s/e.step)*e.step,t=parseFloat(t.toFixed(this._precision())),null!==e.max&&t>e.max?e.max:null!==e.min&&t<e.min?e.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i;if("culture"===t||"numberFormat"===t)return i=this._parse(this.element.val()),this.options[t]=e,void this.element.val(this._format(i));"max"!==t&&"min"!==t&&"step"!==t||"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(i=this.buttons.first().find(".ui-icon"),this._removeClass(i,null,this.options.icons.up),this._addClass(i,null,e.up),i=this.buttons.last().find(".ui-icon"),this._removeClass(i,null,this.options.icons.down),this._addClass(i,null,e.down)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:M(function(t){this._super(t)}),_parse:function(t){return""===(t="string"==typeof t&&""!==t?window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t:t)||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null!==t&&t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&null!==(i=this._parse(t))&&(e||(i=this._adjustValue(i)),t=this._format(i)),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:M(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:M(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:M(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:M(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){if(!arguments.length)return this._parse(this.element.val());M(this._value).call(this,t)},widget:function(){return this.uiSpinner}}),!1!==V.uiBackCompat&&V.widget("ui.spinner",V.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}});var S;V.ui.spinner;V.widget("ui.tabs",{version:"1.13.0",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:(S=/#.*$/,function(t){var e=t.href.replace(S,""),i=location.href.replace(S,"");try{e=decodeURIComponent(e)}catch(t){}try{i=decodeURIComponent(i)}catch(t){}return 1<t.hash.length&&e===i}),_create:function(){var e=this,t=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,t.collapsible),this._processTabs(),t.active=this._initialActive(),Array.isArray(t.disabled)&&(t.disabled=V.uniqueSort(t.disabled.concat(V.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),!1!==this.options.active&&this.anchors.length?this.active=this._findActive(t.active):this.active=V(),this._refresh(),this.active.length&&this.load(t.active)},_initialActive:function(){var i=this.options.active,t=this.options.collapsible,s=location.hash.substring(1);return null===i&&(s&&this.tabs.each(function(t,e){if(V(e).attr("aria-controls")===s)return i=t,!1}),null!==(i=null===i?this.tabs.index(this.tabs.filter(".ui-tabs-active")):i)&&-1!==i||(i=!!this.tabs.length&&0)),!1!==i&&-1===(i=this.tabs.index(this.tabs.eq(i)))&&(i=!t&&0),i=!t&&!1===i&&this.anchors.length?0:i},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):V()}},_tabKeydown:function(t){var e=V(V.ui.safeActiveElement(this.document[0])).closest("li"),i=this.tabs.index(e),s=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case V.ui.keyCode.RIGHT:case V.ui.keyCode.DOWN:i++;break;case V.ui.keyCode.UP:case V.ui.keyCode.LEFT:s=!1,i--;break;case V.ui.keyCode.END:i=this.anchors.length-1;break;case V.ui.keyCode.HOME:i=0;break;case V.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),void this._activate(i);case V.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),void this._activate(i!==this.options.active&&i);default:return}t.preventDefault(),clearTimeout(this.activating),i=this._focusNextTab(i,s),t.ctrlKey||t.metaKey||(e.attr("aria-selected","false"),this.tabs.eq(i).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",i)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===V.ui.keyCode.UP&&(t.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(t){return t.altKey&&t.keyCode===V.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===V.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,e){var i=this.tabs.length-1;for(;-1!==V.inArray(t=(t=i<t?0:t)<0?i:t,this.options.disabled);)t=e?t+1:t-1;return t},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){"active"!==t?(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||!1!==this.options.active||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e)):this._activate(e)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,e=this.tablist.children(":has(a[href])");t.disabled=V.map(e.filter(".ui-state-disabled"),function(t){return e.index(t)}),this._processTabs(),!1!==t.active&&this.anchors.length?this.active.length&&!V.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=V()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=V()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var l=this,t=this.tabs,e=this.anchors,i=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(t){V(this).is(".ui-state-disabled")&&t.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){V(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return V("a",this)[0]}).attr({tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=V(),this.anchors.each(function(t,e){var i,s,n,o=V(e).uniqueId().attr("id"),a=V(e).closest("li"),r=a.attr("aria-controls");l._isLocal(e)?(n=(i=e.hash).substring(1),s=l.element.find(l._sanitizeSelector(i))):(n=a.attr("aria-controls")||V({}).uniqueId()[0].id,(s=l.element.find(i="#"+n)).length||(s=l._createPanel(n)).insertAfter(l.panels[t-1]||l.tablist),s.attr("aria-live","polite")),s.length&&(l.panels=l.panels.add(s)),r&&a.data("ui-tabs-aria-controls",r),a.attr({"aria-controls":n,"aria-labelledby":o}),s.attr("aria-labelledby",o)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),t&&(this._off(t.not(this.tabs)),this._off(e.not(this.anchors)),this._off(i.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(t){return V("<div>").attr("id",t).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(t){var e,i;for(Array.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1),i=0;e=this.tabs[i];i++)e=V(e),!0===t||-1!==V.inArray(i,t)?(e.attr("aria-disabled","true"),this._addClass(e,null,"ui-state-disabled")):(e.removeAttr("aria-disabled"),this._removeClass(e,null,"ui-state-disabled"));this.options.disabled=t,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!0===t)},_setupEvents:function(t){var i={};t&&V.each(t.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,e=this.element.parent();"fill"===t?(i=e.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=V(this),e=t.css("position");"absolute"!==e&&"fixed"!==e&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=V(this).outerHeight(!0)}),this.panels.each(function(){V(this).height(Math.max(0,i-V(this).innerHeight()+V(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,V(this).height("").height())}).height(i))},_eventHandler:function(t){var e=this.options,i=this.active,s=V(t.currentTarget).closest("li"),n=s[0]===i[0],o=n&&e.collapsible,a=o?V():this._getPanelForTab(s),r=i.length?this._getPanelForTab(i):V(),i={oldTab:i,oldPanel:r,newTab:o?V():s,newPanel:a};t.preventDefault(),s.hasClass("ui-state-disabled")||s.hasClass("ui-tabs-loading")||this.running||n&&!e.collapsible||!1===this._trigger("beforeActivate",t,i)||(e.active=!o&&this.tabs.index(s),this.active=n?V():s,this.xhr&&this.xhr.abort(),r.length||a.length||V.error("jQuery UI Tabs: Mismatching fragment identifier."),a.length&&this.load(this.tabs.index(s),t),this._toggle(t,i))},_toggle:function(t,e){var i=this,s=e.newPanel,n=e.oldPanel;function o(){i.running=!1,i._trigger("activate",t,e)}function a(){i._addClass(e.newTab.closest("li"),"ui-tabs-active","ui-state-active"),s.length&&i.options.show?i._show(s,i.options.show,o):(s.show(),o())}this.running=!0,n.length&&this.options.hide?this._hide(n,this.options.hide,function(){i._removeClass(e.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),a()}):(this._removeClass(e.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n.hide(),a()),n.attr("aria-hidden","true"),e.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),s.length&&n.length?e.oldTab.attr("tabIndex",-1):s.length&&this.tabs.filter(function(){return 0===V(this).attr("tabIndex")}).attr("tabIndex",-1),s.attr("aria-hidden","false"),e.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var t=this._findActive(t);t[0]!==this.active[0]&&(t=(t=!t.length?this.active:t).find(".ui-tabs-anchor")[0],this._eventHandler({target:t,currentTarget:t,preventDefault:V.noop}))},_findActive:function(t){return!1===t?V():this.tabs.eq(t)},_getIndex:function(t){return t="string"==typeof t?this.anchors.index(this.anchors.filter("[href$='"+V.escapeSelector(t)+"']")):t},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){V.data(this,"ui-tabs-destroy")?V(this).remove():V(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var t=V(this),e=t.data("ui-tabs-aria-controls");e?t.attr("aria-controls",e).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var t=this.options.disabled;!1!==t&&(t=void 0!==i&&(i=this._getIndex(i),Array.isArray(t)?V.map(t,function(t){return t!==i?t:null}):V.map(this.tabs,function(t,e){return e!==i?e:null})),this._setOptionDisabled(t))},disable:function(t){var e=this.options.disabled;if(!0!==e){if(void 0===t)e=!0;else{if(t=this._getIndex(t),-1!==V.inArray(t,e))return;e=Array.isArray(e)?V.merge([t],e).sort():[t]}this._setOptionDisabled(e)}},load:function(t,s){t=this._getIndex(t);function n(t,e){"abort"===e&&o.panels.stop(!1,!0),o._removeClass(i,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===o.xhr&&delete o.xhr}var o=this,i=this.tabs.eq(t),t=i.find(".ui-tabs-anchor"),a=this._getPanelForTab(i),r={tab:i,panel:a};this._isLocal(t[0])||(this.xhr=V.ajax(this._ajaxSettings(t,s,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(i,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,i){setTimeout(function(){a.html(t),o._trigger("load",s,r),n(i,e)},1)}).fail(function(t,e){setTimeout(function(){n(t,e)},1)})))},_ajaxSettings:function(t,i,s){var n=this;return{url:t.attr("href").replace(/#.*$/,""),beforeSend:function(t,e){return n._trigger("beforeLoad",i,V.extend({jqXHR:t,ajaxSettings:e},s))}}},_getPanelForTab:function(t){t=V(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+t))}}),!1!==V.uiBackCompat&&V.widget("ui.tabs",V.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}});V.ui.tabs;V.widget("ui.tooltip",{version:"1.13.0",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var t=V(this).attr("title");return V("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(t,e){var i=(t.attr("aria-describedby")||"").split(/\s+/);i.push(e),t.data("ui-tooltip-id",e).attr("aria-describedby",String.prototype.trim.call(i.join(" ")))},_removeDescribedBy:function(t){var e=t.data("ui-tooltip-id"),i=(t.attr("aria-describedby")||"").split(/\s+/),e=V.inArray(e,i);-1!==e&&i.splice(e,1),t.removeData("ui-tooltip-id"),(i=String.prototype.trim.call(i.join(" ")))?t.attr("aria-describedby",i):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=V("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=V([])},_setOption:function(t,e){var i=this;this._super(t,e),"content"===t&&V.each(this.tooltips,function(t,e){i._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var s=this;V.each(this.tooltips,function(t,e){var i=V.Event("blur");i.target=i.currentTarget=e.element[0],s.close(i,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var t=V(this);if(t.is("[title]"))return t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")}))},_enable:function(){this.disabledTitles.each(function(){var t=V(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))}),this.disabledTitles=V([])},open:function(t){var i=this,e=V(t?t.target:this.element).closest(this.options.items);e.length&&!e.data("ui-tooltip-id")&&(e.attr("title")&&e.data("ui-tooltip-title",e.attr("title")),e.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&e.parents().each(function(){var t,e=V(this);e.data("ui-tooltip-open")&&((t=V.Event("blur")).target=t.currentTarget=this,i.close(t,!0)),e.attr("title")&&(e.uniqueId(),i.parents[this.id]={element:this,title:e.attr("title")},e.attr("title",""))}),this._registerCloseHandlers(t,e),this._updateContent(e,t))},_updateContent:function(e,i){var t=this.options.content,s=this,n=i?i.type:null;if("string"==typeof t||t.nodeType||t.jquery)return this._open(i,e,t);(t=t.call(e[0],function(t){s._delay(function(){e.data("ui-tooltip-open")&&(i&&(i.type=n),this._open(i,e,t))})}))&&this._open(i,e,t)},_open:function(t,e,i){var s,n,o,a=V.extend({},this.options.position);function r(t){a.of=t,n.is(":hidden")||n.position(a)}i&&((s=this._find(e))?s.tooltip.find(".ui-tooltip-content").html(i):(e.is("[title]")&&(t&&"mouseover"===t.type?e.attr("title",""):e.removeAttr("title")),s=this._tooltip(e),n=s.tooltip,this._addDescribedBy(e,n.attr("id")),n.find(".ui-tooltip-content").html(i),this.liveRegion.children().hide(),(i=V("<div>").html(n.find(".ui-tooltip-content").html())).removeAttr("name").find("[name]").removeAttr("name"),i.removeAttr("id").find("[id]").removeAttr("id"),i.appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:r}),r(t)):n.position(V.extend({of:e},this.options.position)),n.hide(),this._show(n,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(o=this.delayedShow=setInterval(function(){n.is(":visible")&&(r(a.of),clearInterval(o))},13)),this._trigger("open",t,{tooltip:n})))},_registerCloseHandlers:function(t,e){var i={keyup:function(t){t.keyCode===V.ui.keyCode.ESCAPE&&((t=V.Event(t)).currentTarget=e[0],this.close(t,!0))}};e[0]!==this.element[0]&&(i.remove=function(){this._removeTooltip(this._find(e).tooltip)}),t&&"mouseover"!==t.type||(i.mouseleave="close"),t&&"focusin"!==t.type||(i.focusout="close"),this._on(!0,e,i)},close:function(t){var e,i=this,s=V(t?t.currentTarget:this.element),n=this._find(s);n?(e=n.tooltip,n.closing||(clearInterval(this.delayedShow),s.data("ui-tooltip-title")&&!s.attr("title")&&s.attr("title",s.data("ui-tooltip-title")),this._removeDescribedBy(s),n.hiding=!0,e.stop(!0),this._hide(e,this.options.hide,function(){i._removeTooltip(V(this))}),s.removeData("ui-tooltip-open"),this._off(s,"mouseleave focusout keyup"),s[0]!==this.element[0]&&this._off(s,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&V.each(this.parents,function(t,e){V(e.element).attr("title",e.title),delete i.parents[t]}),n.closing=!0,this._trigger("close",t,{tooltip:e}),n.hiding||(n.closing=!1))):s.removeData("ui-tooltip-open")},_tooltip:function(t){var e=V("<div>").attr("role","tooltip"),i=V("<div>").appendTo(e),s=e.uniqueId().attr("id");return this._addClass(i,"ui-tooltip-content"),this._addClass(e,"ui-tooltip","ui-widget ui-widget-content"),e.appendTo(this._appendTo(t)),this.tooltips[s]={element:t,tooltip:e}},_find:function(t){t=t.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(t){clearInterval(this.delayedShow),t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){t=t.closest(".ui-front, dialog");return t=!t.length?this.document[0].body:t},_destroy:function(){var s=this;V.each(this.tooltips,function(t,e){var i=V.Event("blur"),e=e.element;i.target=i.currentTarget=e[0],s.close(i,!0),V("#"+t).remove(),e.data("ui-tooltip-title")&&(e.attr("title")||e.attr("title",e.data("ui-tooltip-title")),e.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),!1!==V.uiBackCompat&&V.widget("ui.tooltip",V.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}});V.ui.tooltip;var H=V,z={},A=z.toString,O=/^([\-+])=\s*(\d+\.?\d*)/,N=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),t[4]?(parseInt(t[4],16)/255).toFixed(2):1]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),t[4]?(parseInt(t[4]+t[4],16)/255).toFixed(2):1]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],E=H.Color=function(t,e,i,s){return new H.Color.fn.parse(t,e,i,s)},W={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},F={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},L=E.support={},R=H("<p>")[0],Y=H.each;function B(t){return null==t?t+"":"object"==typeof t?z[A.call(t)]||"object":typeof t}function j(t,e,i){var s=F[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:Math.min(s.max,Math.max(0,t)))}function q(s){var n=E(),o=n._rgba=[];return s=s.toLowerCase(),Y(N,function(t,e){var i=e.re.exec(s),i=i&&e.parse(i),e=e.space||"rgba";if(i)return i=n[e](i),n[W[e].cache]=i[W[e].cache],o=n._rgba=i._rgba,!1}),o.length?("0,0,0,0"===o.join()&&H.extend(o,st.transparent),n):st[s]}function K(t,e,i){return 6*(i=(i+1)%1)<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}R.style.cssText="background-color:rgba(1,1,1,.5)",L.rgba=-1<R.style.backgroundColor.indexOf("rgba"),Y(W,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),H.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(t,e){z["[object "+e+"]"]=e.toLowerCase()}),(E.fn=H.extend(E.prototype,{parse:function(n,t,e,i){if(void 0===n)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=H(n).css(t),t=void 0);var o=this,s=B(n),a=this._rgba=[];return void 0!==t&&(n=[n,t,e,i],s="array"),"string"===s?this.parse(q(n)||st._default):"array"===s?(Y(W.rgba.props,function(t,e){a[e.idx]=j(n[e.idx],e)}),this):"object"===s?(Y(W,n instanceof E?function(t,e){n[e.cache]&&(o[e.cache]=n[e.cache].slice())}:function(t,i){var s=i.cache;Y(i.props,function(t,e){if(!o[s]&&i.to){if("alpha"===t||null==n[t])return;o[s]=i.to(o._rgba)}o[s][e.idx]=j(n[t],e,!0)}),o[s]&&H.inArray(null,o[s].slice(0,3))<0&&(null==o[s][3]&&(o[s][3]=1),i.from&&(o._rgba=i.from(o[s])))}),this):void 0},is:function(t){var n=E(t),o=!0,a=this;return Y(W,function(t,e){var i,s=n[e.cache];return s&&(i=a[e.cache]||e.to&&e.to(a._rgba)||[],Y(e.props,function(t,e){if(null!=s[e.idx])return o=s[e.idx]===i[e.idx]})),o}),o},_space:function(){var i=[],s=this;return Y(W,function(t,e){s[e.cache]&&i.push(t)}),i.pop()},transition:function(t,a){var e=(h=E(t))._space(),i=W[e],t=0===this.alpha()?E("transparent"):this,r=t[i.cache]||i.to(t._rgba),l=r.slice(),h=h[i.cache];return Y(i.props,function(t,e){var i=e.idx,s=r[i],n=h[i],o=F[e.type]||{};null!==n&&(null===s?l[i]=n:(o.mod&&(n-s>o.mod/2?s+=o.mod:s-n>o.mod/2&&(s-=o.mod)),l[i]=j((n-s)*a+s,e)))}),this[e](l)},blend:function(t){if(1===this._rgba[3])return this;var e=this._rgba.slice(),i=e.pop(),s=E(t)._rgba;return E(H.map(e,function(t,e){return(1-i)*s[e]+i*t}))},toRgbaString:function(){var t="rgba(",e=H.map(this._rgba,function(t,e){return null!=t?t:2<e?1:0});return 1===e[3]&&(e.pop(),t="rgb("),t+e.join()+")"},toHslaString:function(){var t="hsla(",e=H.map(this.hsla(),function(t,e){return null==t&&(t=2<e?1:0),t=e&&e<3?Math.round(100*t)+"%":t});return 1===e[3]&&(e.pop(),t="hsl("),t+e.join()+")"},toHexString:function(t){var e=this._rgba.slice(),i=e.pop();return t&&e.push(~~(255*i)),"#"+H.map(e,function(t){return 1===(t=(t||0).toString(16)).length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}})).parse.prototype=E.fn,W.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/255,i=t[1]/255,s=t[2]/255,n=t[3],o=Math.max(e,i,s),a=Math.min(e,i,s),r=o-a,l=o+a,t=.5*l,i=a===o?0:e===o?60*(i-s)/r+360:i===o?60*(s-e)/r+120:60*(e-i)/r+240,l=0==r?0:t<=.5?r/l:r/(2-l);return[Math.round(i)%360,l,t,null==n?1:n]},W.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],t=t[3],i=s<=.5?s*(1+i):s+i-s*i,s=2*s-i;return[Math.round(255*K(s,i,e+1/3)),Math.round(255*K(s,i,e)),Math.round(255*K(s,i,e-1/3)),t]},Y(W,function(l,t){var e=t.props,o=t.cache,a=t.to,r=t.from;E.fn[l]=function(t){if(a&&!this[o]&&(this[o]=a(this._rgba)),void 0===t)return this[o].slice();var i=B(t),s="array"===i||"object"===i?t:arguments,n=this[o].slice();return Y(e,function(t,e){t=s["object"===i?t:e.idx];null==t&&(t=n[e.idx]),n[e.idx]=j(t,e)}),r?((t=E(r(n)))[o]=n,t):E(n)},Y(e,function(a,r){E.fn[a]||(E.fn[a]=function(t){var e,i=B(t),s="alpha"===a?this._hsla?"hsla":"rgba":l,n=this[s](),o=n[r.idx];return"undefined"===i?o:("function"===i&&(i=B(t=t.call(this,o))),null==t&&r.empty?this:("string"===i&&(e=O.exec(t))&&(t=o+parseFloat(e[2])*("+"===e[1]?1:-1)),n[r.idx]=t,this[s](n)))})})}),(E.hook=function(t){t=t.split(" ");Y(t,function(t,o){H.cssHooks[o]={set:function(t,e){var i,s,n="";if("transparent"!==e&&("string"!==B(e)||(i=q(e)))){if(e=E(i||e),!L.rgba&&1!==e._rgba[3]){for(s="backgroundColor"===o?t.parentNode:t;(""===n||"transparent"===n)&&s&&s.style;)try{n=H.css(s,"backgroundColor"),s=s.parentNode}catch(t){}e=e.blend(n&&"transparent"!==n?n:"_default")}e=e.toRgbaString()}try{t.style[o]=e}catch(t){}}},H.fx.step[o]=function(t){t.colorInit||(t.start=E(t.elem,o),t.end=E(t.end),t.colorInit=!0),H.cssHooks[o].set(t.elem,t.start.transition(t.end,t.pos))}})})("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor"),H.cssHooks.borderColor={expand:function(i){var s={};return Y(["Top","Right","Bottom","Left"],function(t,e){s["border"+e+"Color"]=i}),s}};var U,X,$,G,Q,J,Z,tt,et,it,st=H.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"},nt="ui-effects-",ot="ui-effects-style",at="ui-effects-animated";function rt(t){var e,i,s=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,n={};if(s&&s.length&&s[0]&&s[s[0]])for(i=s.length;i--;)"string"==typeof s[e=s[i]]&&(n[e.replace(/-([\da-z])/gi,function(t,e){return e.toUpperCase()})]=s[e]);else for(e in s)"string"==typeof s[e]&&(n[e]=s[e]);return n}function lt(t,e,i,s){return t={effect:t=V.isPlainObject(t)?(e=t).effect:t},"function"==typeof(e=null==e?{}:e)&&(s=e,i=null,e={}),"number"!=typeof e&&!V.fx.speeds[e]||(s=i,i=e,e={}),"function"==typeof i&&(s=i,i=null),e&&V.extend(t,e),i=i||e.duration,t.duration=V.fx.off?0:"number"==typeof i?i:i in V.fx.speeds?V.fx.speeds[i]:V.fx.speeds._default,t.complete=s||e.complete,t}function ht(t){return!t||"number"==typeof t||V.fx.speeds[t]||("string"==typeof t&&!V.effects.effect[t]||("function"==typeof t||"object"==typeof t&&!t.effect))}function ct(t,e){var i=e.outerWidth(),e=e.outerHeight(),t=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/.exec(t)||["",0,i,e,0];return{top:parseFloat(t[1])||0,right:"auto"===t[2]?i:parseFloat(t[2]),bottom:"auto"===t[3]?e:parseFloat(t[3]),left:parseFloat(t[4])||0}}V.effects={effect:{}},G=["add","remove","toggle"],Q={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1},V.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,e){V.fx.step[e]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(H.style(t.elem,e,t.end),t.setAttr=!0)}}),V.fn.addBack||(V.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),V.effects.animateClass=function(n,t,e,i){var o=V.speed(t,e,i);return this.queue(function(){var i=V(this),t=i.attr("class")||"",e=(e=o.children?i.find("*").addBack():i).map(function(){return{el:V(this),start:rt(this)}}),s=function(){V.each(G,function(t,e){n[e]&&i[e+"Class"](n[e])})};s(),e=e.map(function(){return this.end=rt(this.el[0]),this.diff=function(t,e){var i,s,n={};for(i in e)s=e[i],t[i]!==s&&(Q[i]||!V.fx.step[i]&&isNaN(parseFloat(s))||(n[i]=s));return n}(this.start,this.end),this}),i.attr("class",t),e=e.map(function(){var t=this,e=V.Deferred(),i=V.extend({},o,{queue:!1,complete:function(){e.resolve(t)}});return this.el.animate(this.diff,i),e.promise()}),V.when.apply(V,e.get()).done(function(){s(),V.each(arguments,function(){var e=this.el;V.each(this.diff,function(t){e.css(t,"")})}),o.complete.call(i[0])})})},V.fn.extend({addClass:($=V.fn.addClass,function(t,e,i,s){return e?V.effects.animateClass.call(this,{add:t},e,i,s):$.apply(this,arguments)}),removeClass:(X=V.fn.removeClass,function(t,e,i,s){return 1<arguments.length?V.effects.animateClass.call(this,{remove:t},e,i,s):X.apply(this,arguments)}),toggleClass:(U=V.fn.toggleClass,function(t,e,i,s,n){return"boolean"==typeof e||void 0===e?i?V.effects.animateClass.call(this,e?{add:t}:{remove:t},i,s,n):U.apply(this,arguments):V.effects.animateClass.call(this,{toggle:t},e,i,s)}),switchClass:function(t,e,i,s,n){return V.effects.animateClass.call(this,{add:e,remove:t},i,s,n)}}),V.expr&&V.expr.pseudos&&V.expr.pseudos.animated&&(V.expr.pseudos.animated=(J=V.expr.pseudos.animated,function(t){return!!V(t).data(at)||J(t)})),!1!==V.uiBackCompat&&V.extend(V.effects,{save:function(t,e){for(var i=0,s=e.length;i<s;i++)null!==e[i]&&t.data(nt+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;s<n;s++)null!==e[s]&&(i=t.data(nt+e[s]),t.css(e[s],i))},setMode:function(t,e){return e="toggle"===e?t.is(":hidden")?"show":"hide":e},createWrapper:function(i){if(i.parent().is(".ui-effects-wrapper"))return i.parent();var s={width:i.outerWidth(!0),height:i.outerHeight(!0),float:i.css("float")},t=V("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e={width:i.width(),height:i.height()},n=document.activeElement;try{n.id}catch(t){n=document.body}return i.wrap(t),i[0]!==n&&!V.contains(i[0],n)||V(n).trigger("focus"),t=i.parent(),"static"===i.css("position")?(t.css({position:"relative"}),i.css({position:"relative"})):(V.extend(s,{position:i.css("position"),zIndex:i.css("z-index")}),V.each(["top","left","bottom","right"],function(t,e){s[e]=i.css(e),isNaN(parseInt(s[e],10))&&(s[e]="auto")}),i.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),i.css(e),t.css(s).show()},removeWrapper:function(t){var e=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),t[0]!==e&&!V.contains(t[0],e)||V(e).trigger("focus")),t}}),V.extend(V.effects,{version:"1.13.0",define:function(t,e,i){return i||(i=e,e="effect"),V.effects.effect[t]=i,V.effects.effect[t].mode=e,i},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,e="vertical"!==i?(e||100)/100:1;return{height:t.height()*e,width:t.width()*s,outerHeight:t.outerHeight()*e,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();1<e&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(ot,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(ot)||"",t.removeData(ot)},mode:function(t,e){t=t.is(":hidden");return"toggle"===e&&(e=t?"show":"hide"),e=(t?"hide"===e:"show"===e)?"none":e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(t){var e,i=t.css("position"),s=t.position();return t.css({marginTop:t.css("marginTop"),marginBottom:t.css("marginBottom"),marginLeft:t.css("marginLeft"),marginRight:t.css("marginRight")}).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()),/^(static|relative)/.test(i)&&(i="absolute",e=V("<"+t[0].nodeName+">").insertAfter(t).css({display:/^(inline|ruby)/.test(t.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:t.css("marginTop"),marginBottom:t.css("marginBottom"),marginLeft:t.css("marginLeft"),marginRight:t.css("marginRight"),float:t.css("float")}).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).addClass("ui-effects-placeholder"),t.data(nt+"placeholder",e)),t.css({position:i,left:s.left,top:s.top}),e},removePlaceholder:function(t){var e=nt+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(t){V.effects.restoreStyle(t),V.effects.removePlaceholder(t)},setTransition:function(s,t,n,o){return o=o||{},V.each(t,function(t,e){var i=s.cssUnit(e);0<i[0]&&(o[e]=i[0]*n+i[1])}),o}}),V.fn.extend({effect:function(){function t(t){var e=V(this),i=V.effects.mode(e,r)||o;e.data(at,!0),l.push(i),o&&("show"===i||i===o&&"hide"===i)&&e.show(),o&&"none"===i||V.effects.saveStyle(e),"function"==typeof t&&t()}var s=lt.apply(this,arguments),n=V.effects.effect[s.effect],o=n.mode,e=s.queue,i=e||"fx",a=s.complete,r=s.mode,l=[];return V.fx.off||!n?r?this[r](s.duration,a):this.each(function(){a&&a.call(this)}):!1===e?this.each(t).each(h):this.queue(i,t).queue(i,h);function h(t){var e=V(this);function i(){"function"==typeof a&&a.call(e[0]),"function"==typeof t&&t()}s.mode=l.shift(),!1===V.uiBackCompat||o?"none"===s.mode?(e[r](),i()):n.call(e[0],s,function(){e.removeData(at),V.effects.cleanUp(e),"hide"===s.mode&&e.hide(),i()}):(e.is(":hidden")?"hide"===r:"show"===r)?(e[r](),i()):n.call(e[0],s,i)}},show:(et=V.fn.show,function(t){if(ht(t))return et.apply(this,arguments);t=lt.apply(this,arguments);return t.mode="show",this.effect.call(this,t)}),hide:(tt=V.fn.hide,function(t){if(ht(t))return tt.apply(this,arguments);t=lt.apply(this,arguments);return t.mode="hide",this.effect.call(this,t)}),toggle:(Z=V.fn.toggle,function(t){if(ht(t)||"boolean"==typeof t)return Z.apply(this,arguments);t=lt.apply(this,arguments);return t.mode="toggle",this.effect.call(this,t)}),cssUnit:function(t){var i=this.css(t),s=[];return V.each(["em","px","%","pt"],function(t,e){0<i.indexOf(e)&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):ct(this.css("clip"),this)},transfer:function(t,e){var i=V(this),s=V(t.to),n="fixed"===s.css("position"),o=V("body"),a=n?o.scrollTop():0,r=n?o.scrollLeft():0,o=s.offset(),o={top:o.top-a,left:o.left-r,height:s.innerHeight(),width:s.innerWidth()},s=i.offset(),l=V("<div class='ui-effects-transfer'></div>");l.appendTo("body").addClass(t.className).css({top:s.top-a,left:s.left-r,height:i.innerHeight(),width:i.innerWidth(),position:n?"fixed":"absolute"}).animate(o,t.duration,t.easing,function(){l.remove(),"function"==typeof e&&e()})}}),V.fx.step.clip=function(t){t.clipInit||(t.start=V(t.elem).cssClip(),"string"==typeof t.end&&(t.end=ct(t.end,t.elem)),t.clipInit=!0),V(t.elem).cssClip({top:t.pos*(t.end.top-t.start.top)+t.start.top,right:t.pos*(t.end.right-t.start.right)+t.start.right,bottom:t.pos*(t.end.bottom-t.start.bottom)+t.start.bottom,left:t.pos*(t.end.left-t.start.left)+t.start.left})},it={},V.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,t){it[t]=function(t){return Math.pow(t,e+2)}}),V.extend(it,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),V.each(it,function(t,e){V.easing["easeIn"+t]=e,V.easing["easeOut"+t]=function(t){return 1-e(1-t)},V.easing["easeInOut"+t]=function(t){return t<.5?e(2*t)/2:1-e(-2*t+2)/2}});R=V.effects,V.effects.define("blind","hide",function(t,e){var i={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},s=V(this),n=t.direction||"up",o=s.cssClip(),a={clip:V.extend({},o)},r=V.effects.createPlaceholder(s);a.clip[i[n][0]]=a.clip[i[n][1]],"show"===t.mode&&(s.cssClip(a.clip),r&&r.css(V.effects.clipToBox(a)),a.clip=o),r&&r.animate(V.effects.clipToBox(a),t.duration,t.easing),s.animate(a,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("bounce",function(t,e){var i,s,n=V(this),o=t.mode,a="hide"===o,r="show"===o,l=t.direction||"up",h=t.distance,c=t.times||5,o=2*c+(r||a?1:0),u=t.duration/o,d=t.easing,p="up"===l||"down"===l?"top":"left",f="up"===l||"left"===l,g=0,t=n.queue().length;for(V.effects.createPlaceholder(n),l=n.css(p),h=h||n["top"==p?"outerHeight":"outerWidth"]()/3,r&&((s={opacity:1})[p]=l,n.css("opacity",0).css(p,f?2*-h:2*h).animate(s,u,d)),a&&(h/=Math.pow(2,c-1)),(s={})[p]=l;g<c;g++)(i={})[p]=(f?"-=":"+=")+h,n.animate(i,u,d).animate(s,u,d),h=a?2*h:h/2;a&&((i={opacity:0})[p]=(f?"-=":"+=")+h,n.animate(i,u,d)),n.queue(e),V.effects.unshift(n,t,1+o)}),V.effects.define("clip","hide",function(t,e){var i={},s=V(this),n=t.direction||"vertical",o="both"===n,a=o||"horizontal"===n,o=o||"vertical"===n,n=s.cssClip();i.clip={top:o?(n.bottom-n.top)/2:n.top,right:a?(n.right-n.left)/2:n.right,bottom:o?(n.bottom-n.top)/2:n.bottom,left:a?(n.right-n.left)/2:n.left},V.effects.createPlaceholder(s),"show"===t.mode&&(s.cssClip(i.clip),i.clip=n),s.animate(i,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("drop","hide",function(t,e){var i=V(this),s="show"===t.mode,n=t.direction||"left",o="up"===n||"down"===n?"top":"left",a="up"===n||"left"===n?"-=":"+=",r="+="==a?"-=":"+=",l={opacity:0};V.effects.createPlaceholder(i),n=t.distance||i["top"==o?"outerHeight":"outerWidth"](!0)/2,l[o]=a+n,s&&(i.css(l),l[o]=r+n,l.opacity=1),i.animate(l,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("explode","hide",function(t,e){var i,s,n,o,a,r,l=t.pieces?Math.round(Math.sqrt(t.pieces)):3,h=l,c=V(this),u="show"===t.mode,d=c.show().css("visibility","hidden").offset(),p=Math.ceil(c.outerWidth()/h),f=Math.ceil(c.outerHeight()/l),g=[];function m(){g.push(this),g.length===l*h&&(c.css({visibility:"visible"}),V(g).remove(),e())}for(i=0;i<l;i++)for(o=d.top+i*f,r=i-(l-1)/2,s=0;s<h;s++)n=d.left+s*p,a=s-(h-1)/2,c.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-s*p,top:-i*f}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:p,height:f,left:n+(u?a*p:0),top:o+(u?r*f:0),opacity:u?0:1}).animate({left:n+(u?0:a*p),top:o+(u?0:r*f),opacity:u?1:0},t.duration||500,t.easing,m)}),V.effects.define("fade","toggle",function(t,e){var i="show"===t.mode;V(this).css("opacity",i?0:1).animate({opacity:i?1:0},{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("fold","hide",function(e,t){var i=V(this),s=e.mode,n="show"===s,o="hide"===s,a=e.size||15,r=/([0-9]+)%/.exec(a),l=!!e.horizFirst?["right","bottom"]:["bottom","right"],h=e.duration/2,c=V.effects.createPlaceholder(i),u=i.cssClip(),d={clip:V.extend({},u)},p={clip:V.extend({},u)},f=[u[l[0]],u[l[1]]],s=i.queue().length;r&&(a=parseInt(r[1],10)/100*f[o?0:1]),d.clip[l[0]]=a,p.clip[l[0]]=a,p.clip[l[1]]=0,n&&(i.cssClip(p.clip),c&&c.css(V.effects.clipToBox(p)),p.clip=u),i.queue(function(t){c&&c.animate(V.effects.clipToBox(d),h,e.easing).animate(V.effects.clipToBox(p),h,e.easing),t()}).animate(d,h,e.easing).animate(p,h,e.easing).queue(t),V.effects.unshift(i,s,4)}),V.effects.define("highlight","show",function(t,e){var i=V(this),s={backgroundColor:i.css("backgroundColor")};"hide"===t.mode&&(s.opacity=0),V.effects.saveStyle(i),i.css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(s,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("size",function(s,e){var n,i=V(this),t=["fontSize"],o=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],a=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],r=s.mode,l="effect"!==r,h=s.scale||"both",c=s.origin||["middle","center"],u=i.css("position"),d=i.position(),p=V.effects.scaledDimensions(i),f=s.from||p,g=s.to||V.effects.scaledDimensions(i,0);V.effects.createPlaceholder(i),"show"===r&&(r=f,f=g,g=r),n={from:{y:f.height/p.height,x:f.width/p.width},to:{y:g.height/p.height,x:g.width/p.width}},"box"!==h&&"both"!==h||(n.from.y!==n.to.y&&(f=V.effects.setTransition(i,o,n.from.y,f),g=V.effects.setTransition(i,o,n.to.y,g)),n.from.x!==n.to.x&&(f=V.effects.setTransition(i,a,n.from.x,f),g=V.effects.setTransition(i,a,n.to.x,g))),"content"!==h&&"both"!==h||n.from.y!==n.to.y&&(f=V.effects.setTransition(i,t,n.from.y,f),g=V.effects.setTransition(i,t,n.to.y,g)),c&&(c=V.effects.getBaseline(c,p),f.top=(p.outerHeight-f.outerHeight)*c.y+d.top,f.left=(p.outerWidth-f.outerWidth)*c.x+d.left,g.top=(p.outerHeight-g.outerHeight)*c.y+d.top,g.left=(p.outerWidth-g.outerWidth)*c.x+d.left),delete f.outerHeight,delete f.outerWidth,i.css(f),"content"!==h&&"both"!==h||(o=o.concat(["marginTop","marginBottom"]).concat(t),a=a.concat(["marginLeft","marginRight"]),i.find("*[width]").each(function(){var t=V(this),e=V.effects.scaledDimensions(t),i={height:e.height*n.from.y,width:e.width*n.from.x,outerHeight:e.outerHeight*n.from.y,outerWidth:e.outerWidth*n.from.x},e={height:e.height*n.to.y,width:e.width*n.to.x,outerHeight:e.height*n.to.y,outerWidth:e.width*n.to.x};n.from.y!==n.to.y&&(i=V.effects.setTransition(t,o,n.from.y,i),e=V.effects.setTransition(t,o,n.to.y,e)),n.from.x!==n.to.x&&(i=V.effects.setTransition(t,a,n.from.x,i),e=V.effects.setTransition(t,a,n.to.x,e)),l&&V.effects.saveStyle(t),t.css(i),t.animate(e,s.duration,s.easing,function(){l&&V.effects.restoreStyle(t)})})),i.animate(g,{queue:!1,duration:s.duration,easing:s.easing,complete:function(){var t=i.offset();0===g.opacity&&i.css("opacity",f.opacity),l||(i.css("position","static"===u?"relative":u).offset(t),V.effects.saveStyle(i)),e()}})}),V.effects.define("scale",function(t,e){var i=V(this),s=t.mode,s=parseInt(t.percent,10)||(0===parseInt(t.percent,10)||"effect"!==s?0:100),s=V.extend(!0,{from:V.effects.scaledDimensions(i),to:V.effects.scaledDimensions(i,s,t.direction||"both"),origin:t.origin||["middle","center"]},t);t.fade&&(s.from.opacity=1,s.to.opacity=0),V.effects.effect.size.call(this,s,e)}),V.effects.define("puff","hide",function(t,e){t=V.extend(!0,{},t,{fade:!0,percent:parseInt(t.percent,10)||150});V.effects.effect.scale.call(this,t,e)}),V.effects.define("pulsate","show",function(t,e){var i=V(this),s=t.mode,n="show"===s,o=2*(t.times||5)+(n||"hide"===s?1:0),a=t.duration/o,r=0,l=1,s=i.queue().length;for(!n&&i.is(":visible")||(i.css("opacity",0).show(),r=1);l<o;l++)i.animate({opacity:r},a,t.easing),r=1-r;i.animate({opacity:r},a,t.easing),i.queue(e),V.effects.unshift(i,s,1+o)}),V.effects.define("shake",function(t,e){var i=1,s=V(this),n=t.direction||"left",o=t.distance||20,a=t.times||3,r=2*a+1,l=Math.round(t.duration/r),h="up"===n||"down"===n?"top":"left",c="up"===n||"left"===n,u={},d={},p={},n=s.queue().length;for(V.effects.createPlaceholder(s),u[h]=(c?"-=":"+=")+o,d[h]=(c?"+=":"-=")+2*o,p[h]=(c?"-=":"+=")+2*o,s.animate(u,l,t.easing);i<a;i++)s.animate(d,l,t.easing).animate(p,l,t.easing);s.animate(d,l,t.easing).animate(u,l/2,t.easing).queue(e),V.effects.unshift(s,n,1+r)}),V.effects.define("slide","show",function(t,e){var i,s,n=V(this),o={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},a=t.mode,r=t.direction||"left",l="up"===r||"down"===r?"top":"left",h="up"===r||"left"===r,c=t.distance||n["top"==l?"outerHeight":"outerWidth"](!0),u={};V.effects.createPlaceholder(n),i=n.cssClip(),s=n.position()[l],u[l]=(h?-1:1)*c+s,u.clip=n.cssClip(),u.clip[o[r][1]]=u.clip[o[r][0]],"show"===a&&(n.cssClip(u.clip),n.css(l,u[l]),u.clip=i,u[l]=s),n.animate(u,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),!1!==V.uiBackCompat&&V.effects.define("transfer",function(t,e){V(this).transfer(t,e)})});var jsdom,virtualWindow,fabric=fabric||{version:"5.3.0"};function resizeCanvasIfNeeded(t){var e=t.targetCanvas,i=e.width,r=e.height,n=t.destinationWidth,t=t.destinationHeight;i===n&&r===t||(e.width=n,e.height=t)}function copyGLTo2DDrawImage(t,e){var t=t.canvas,e=e.targetCanvas,i=e.getContext("2d"),r=(i.translate(0,e.height),i.scale(1,-1),t.height-e.height);i.drawImage(t,0,r,e.width,e.height,0,0,e.width,e.height)}function copyGLTo2DPutImageData(t,e){var i=e.targetCanvas.getContext("2d"),r=e.destinationWidth,e=e.destinationHeight,n=r*e*4,s=new Uint8Array(this.imageBuffer,0,n),n=new Uint8ClampedArray(this.imageBuffer,0,n),t=(t.readPixels(0,0,r,e,t.RGBA,t.UNSIGNED_BYTE,s),new ImageData(n,r,e));i.putImageData(t,0,0)}"undefined"!=typeof exports?exports.fabric=fabric:"function"==typeof define&&define.amd&&define([],function(){return fabric}),"undefined"!=typeof document&&"undefined"!=typeof window?(document instanceof("undefined"!=typeof HTMLDocument?HTMLDocument:Document)?fabric.document=document:fabric.document=document.implementation.createHTMLDocument(""),fabric.window=window):(jsdom=require("jsdom"),virtualWindow=new jsdom.JSDOM(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"),{features:{FetchExternalResources:["img"]},resources:"usable"}).window,fabric.document=virtualWindow.document,fabric.jsdomImplForWrapper=require("jsdom/lib/jsdom/living/generated/utils").implForWrapper,fabric.nodeCanvas=require("jsdom/lib/jsdom/utils").Canvas,fabric.window=virtualWindow,DOMParser=fabric.window.DOMParser),fabric.isTouchSupported="ontouchstart"in fabric.window||"ontouchstart"in fabric.document||fabric.window&&fabric.window.navigator&&0<fabric.window.navigator.maxTouchPoints,fabric.isLikelyNode="undefined"!=typeof Buffer&&"undefined"==typeof window,fabric.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"],fabric.DPI=96,fabric.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",fabric.commaWsp="(?:\\s+,?\\s*|,\\s*)",fabric.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,fabric.reNonWord=/[ \n\.,;!\?\-]/,fabric.fontPaths={},fabric.iMatrix=[1,0,0,1,0,0],fabric.svgNS="http://www.w3.org/2000/svg",fabric.perfLimitSizeTotal=2097152,fabric.maxCacheSideLimit=4096,fabric.minCacheSideLimit=256,fabric.charWidthsCache={},fabric.textureSize=2048,fabric.disableStyleCopyPaste=!1,fabric.enableGLFiltering=!0,fabric.devicePixelRatio=fabric.window.devicePixelRatio||fabric.window.webkitDevicePixelRatio||fabric.window.mozDevicePixelRatio||1,fabric.browserShadowBlurConstant=1,fabric.arcToSegmentsCache={},fabric.boundsOfCurveCache={},fabric.cachesBoundsOfCurve=!0,fabric.forceGLPutImageData=!1,fabric.initFilterBackend=function(){return fabric.enableGLFiltering&&fabric.isWebglSupported&&fabric.isWebglSupported(fabric.textureSize)?(console.log("max texture size: "+fabric.maxTextureSize),new fabric.WebglFilterBackend({tileSize:fabric.textureSize})):fabric.Canvas2dFilterBackend?new fabric.Canvas2dFilterBackend:void 0},"undefined"!=typeof document&&"undefined"!=typeof window&&(window.fabric=fabric),function(){function r(t,e){this.__eventListeners[t]&&(t=this.__eventListeners[t],e?t[t.indexOf(e)]=!1:fabric.util.array.fill(t,!1))}function n(t,e){var i=function(){e.apply(this,arguments),this.off(t,i)}.bind(this);this.on(t,i)}fabric.Observable={fire:function(t,e){if(!this.__eventListeners)return this;var i=this.__eventListeners[t];if(!i)return this;for(var r=0,n=i.length;r<n;r++)i[r]&&i[r].call(this,e||{});return this.__eventListeners[t]=i.filter(function(t){return!1!==t}),this},on:function(t,e){if(this.__eventListeners||(this.__eventListeners={}),1===arguments.length)for(var i in t)this.on(i,t[i]);else this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e);return this},once:function(t,e){if(1===arguments.length)for(var i in t)n.call(this,i,t[i]);else n.call(this,t,e);return this},off:function(t,e){if(!this.__eventListeners)return this;if(0===arguments.length)for(t in this.__eventListeners)r.call(this,t);else if(1===arguments.length&&"object"==typeof arguments[0])for(var i in t)r.call(this,i,t[i]);else r.call(this,t,e);return this}}}(),fabric.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var t=0,e=arguments.length;t<e;t++)this._onObjectAdded(arguments[t]);return this.renderOnAddRemove&&this.requestRenderAll(),this},insertAt:function(t,e,i){var r=this._objects;return i?r[e]=t:r.splice(e,0,t),this._onObjectAdded&&this._onObjectAdded(t),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var t,e=this._objects,i=!1,r=0,n=arguments.length;r<n;r++)-1!==(t=e.indexOf(arguments[r]))&&(i=!0,e.splice(t,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[r]));return this.renderOnAddRemove&&i&&this.requestRenderAll(),this},forEachObject:function(t,e){for(var i=this.getObjects(),r=0,n=i.length;r<n;r++)t.call(e,i[r],r,i);return this},getObjects:function(e){return void 0===e?this._objects.concat():this._objects.filter(function(t){return t.type===e})},item:function(t){return this._objects[t]},isEmpty:function(){return 0===this._objects.length},size:function(){return this._objects.length},contains:function(e,t){return-1<this._objects.indexOf(e)||!!t&&this._objects.some(function(t){return"function"==typeof t.contains&&t.contains(e,!0)})},complexity:function(){return this._objects.reduce(function(t,e){return t+=e.complexity?e.complexity():0},0)}},fabric.CommonMethods={_setOptions:function(t){for(var e in t)this.set(e,t[e])},_initGradient:function(t,e){!t||!t.colorStops||t instanceof fabric.Gradient||this.set(e,new fabric.Gradient(t))},_initPattern:function(t,e,i){!t||!t.source||t instanceof fabric.Pattern?i&&i():this.set(e,new fabric.Pattern(t,i))},_setObject:function(t){for(var e in t)this._set(e,t[e])},set:function(t,e){return"object"==typeof t?this._setObject(t):this._set(t,e),this},_set:function(t,e){this[t]=e},toggle:function(t){var e=this.get(t);return"boolean"==typeof e&&this.set(t,!e),this},get:function(t){return this[t]}},function(s){var o=Math.sqrt,a=Math.atan2,c=Math.pow,h=Math.PI/180,i=Math.PI/2;fabric.util={cos:function(t){if(0===t)return 1;switch((t=t<0?-t:t)/i){case 1:case 3:return 0;case 2:return-1}return Math.cos(t)},sin:function(t){if(0===t)return 0;var e=t<0?-1:1;switch(t/i){case 1:return e;case 2:return 0;case 3:return-e}return Math.sin(t)},removeFromArray:function(t,e){e=t.indexOf(e);return-1!==e&&t.splice(e,1),t},getRandomInt:function(t,e){return Math.floor(Math.random()*(e-t+1))+t},degreesToRadians:function(t){return t*h},radiansToDegrees:function(t){return t/h},rotatePoint:function(t,e,i){t=new fabric.Point(t.x-e.x,t.y-e.y),t=fabric.util.rotateVector(t,i);return new fabric.Point(t.x,t.y).addEquals(e)},rotateVector:function(t,e){var i=fabric.util.sin(e),e=fabric.util.cos(e);return{x:t.x*e-t.y*i,y:t.x*i+t.y*e}},createVector:function(t,e){return new fabric.Point(e.x-t.x,e.y-t.y)},calcAngleBetweenVectors:function(t,e){return Math.acos((t.x*e.x+t.y*e.y)/(Math.hypot(t.x,t.y)*Math.hypot(e.x,e.y)))},getHatVector:function(t){return new fabric.Point(t.x,t.y).multiply(1/Math.hypot(t.x,t.y))},getBisector:function(t,e,i){e=fabric.util.createVector(t,e),t=fabric.util.createVector(t,i),i=fabric.util.calcAngleBetweenVectors(e,t),t=fabric.util.calcAngleBetweenVectors(fabric.util.rotateVector(e,i),t);return{vector:fabric.util.getHatVector(fabric.util.rotateVector(e,i*(0===t?1:-1)/2)),angle:i}},projectStrokeOnPoints:function(o,a,c){function h(t){var e=u/Math.hypot(t.x,t.y);return new fabric.Point(t.x*e*f.x,t.y*e*f.y)}var l=[],u=a.strokeWidth/2,f=a.strokeUniform?new fabric.Point(1/a.scaleX,1/a.scaleY):new fabric.Point(1,1);return o.length<=1||o.forEach(function(t,e){var i,r,t=new fabric.Point(t.x,t.y),e=(0===e?(s=o[e+1],n=c?h(fabric.util.createVector(s,t)).addEquals(t):o[o.length-1]):s=e===o.length-1?(n=o[e-1],c?h(fabric.util.createVector(n,t)).addEquals(t):o[0]):(n=o[e-1],o[e+1]),fabric.util.getBisector(t,n,s)),n=e.vector,s=e.angle;if("miter"===a.strokeLineJoin&&(i=-u/Math.sin(s/2),r=new fabric.Point(n.x*i*f.x,n.y*i*f.y),Math.hypot(r.x,r.y)/u<=a.strokeMiterLimit))return l.push(t.add(r)),void l.push(t.subtract(r));i=-u*Math.SQRT2,r=new fabric.Point(n.x*i*f.x,n.y*i*f.y),l.push(t.add(r)),l.push(t.subtract(r))}),l},transformPoint:function(t,e,i){return i?new fabric.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new fabric.Point(e[0]*t.x+e[2]*t.y+e[4],e[1]*t.x+e[3]*t.y+e[5])},makeBoundingBoxFromPoints:function(t,e){if(e)for(var i=0;i<t.length;i++)t[i]=fabric.util.transformPoint(t[i],e);var r=[t[0].x,t[1].x,t[2].x,t[3].x],n=fabric.util.array.min(r),r=fabric.util.array.max(r)-n,s=[t[0].y,t[1].y,t[2].y,t[3].y],o=fabric.util.array.min(s);return{left:n,top:o,width:r,height:fabric.util.array.max(s)-o}},invertTransform:function(t){var e=1/(t[0]*t[3]-t[1]*t[2]),e=[e*t[3],-e*t[1],-e*t[2],e*t[0]],t=fabric.util.transformPoint({x:t[4],y:t[5]},e,!0);return e[4]=-t.x,e[5]=-t.y,e},toFixed:function(t,e){return parseFloat(Number(t).toFixed(e))},parseUnit:function(t,e){var i=/\D{0,2}$/.exec(t),r=parseFloat(t);switch(e=e||fabric.Text.DEFAULT_SVG_FONT_SIZE,i[0]){case"mm":return r*fabric.DPI/25.4;case"cm":return r*fabric.DPI/2.54;case"in":return r*fabric.DPI;case"pt":return r*fabric.DPI/72;case"pc":return r*fabric.DPI/72*12;case"em":return r*e;default:return r}},falseFunction:function(){return!1},getKlass:function(t,e){return t=fabric.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),fabric.util.resolveNamespace(e)[t]},getSvgAttributes:function(t){var e=["instantiated_by_use","style","id","class"];switch(t){case"linearGradient":e=e.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);break;case"radialGradient":e=e.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);break;case"stop":e=e.concat(["offset","stop-color","stop-opacity"])}return e},resolveNamespace:function(t){if(!t)return fabric;for(var e=t.split("."),i=e.length,r=s||fabric.window,n=0;n<i;++n)r=r[e[n]];return r},loadImage:function(t,e,i,r){var n,s;t?((n=fabric.util.createImage()).onload=s=function(){e&&e.call(i,n,!1),n=n.onload=n.onerror=null},n.onerror=function(){fabric.log("Error loading "+n.src),e&&e.call(i,null,!0),n=n.onload=n.onerror=null},0!==t.indexOf("data")&&null!=r&&(n.crossOrigin=r),"data:image/svg"===t.substring(0,14)&&(n.onload=null,fabric.util.loadImageInDom(n,s)),n.src=t):e&&e.call(i,t)},loadImageInDom:function(t,e){var i=fabric.document.createElement("div");i.style.width=i.style.height="1px",i.style.left=i.style.top="-100%",i.style.position="absolute",i.appendChild(t),fabric.document.querySelector("body").appendChild(i),t.onload=function(){e(),i.parentNode.removeChild(i),i=null}},enlivenObjects:function(t,e,n,s){var o=[],i=0,r=(t=t||[]).length;function a(){++i===r&&e&&e(o.filter(function(t){return t}))}r?t.forEach(function(i,r){i&&i.type?fabric.util.getKlass(i.type,n).fromObject(i,function(t,e){e||(o[r]=t),s&&s(i,t,e),a()}):a()}):e&&e(o)},enlivenObjectEnlivables:function(e,n,t){var s=fabric.Object.ENLIVEN_PROPS.filter(function(t){return!!e[t]});fabric.util.enlivenObjects(s.map(function(t){return e[t]}),function(i){var r={};s.forEach(function(t,e){r[t]=i[e],n&&(n[t]=i[e])}),t&&t(r)})},enlivenPatterns:function(t,e){function i(){++n===s&&e&&e(r)}var r=[],n=0,s=(t=t||[]).length;s?t.forEach(function(t,e){t&&t.source?new fabric.Pattern(t,function(t){r[e]=t,i()}):(r[e]=t,i())}):e&&e(r)},groupSVGElements:function(t,e,i){return t&&1===t.length?(void 0!==i&&(t[0].sourcePath=i),t[0]):(e&&(e.width&&e.height?e.centerPoint={x:e.width/2,y:e.height/2}:(delete e.width,delete e.height)),t=new fabric.Group(t,e),void 0!==i&&(t.sourcePath=i),t)},populateWithProperties:function(t,e,i){if(i&&Array.isArray(i))for(var r=0,n=i.length;r<n;r++)i[r]in t&&(e[i[r]]=t[i[r]])},createCanvasElement:function(){return fabric.document.createElement("canvas")},copyCanvasElement:function(t){var e=fabric.util.createCanvasElement();return e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0),e},toDataURL:function(t,e,i){return t.toDataURL("image/"+e,i)},createImage:function(){return fabric.document.createElement("img")},multiplyTransformMatrices:function(t,e,i){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],i?0:t[0]*e[4]+t[2]*e[5]+t[4],i?0:t[1]*e[4]+t[3]*e[5]+t[5]]},qrDecompose:function(t){var e=a(t[1],t[0]),i=c(t[0],2)+c(t[1],2),r=o(i),n=(t[0]*t[3]-t[2]*t[1])/r,i=a(t[0]*t[2]+t[1]*t[3],i);return{angle:e/h,scaleX:r,scaleY:n,skewX:i/h,skewY:0,translateX:t[4],translateY:t[5]}},calcRotateMatrix:function(t){if(!t.angle)return fabric.iMatrix.concat();var t=fabric.util.degreesToRadians(t.angle),e=fabric.util.cos(t),t=fabric.util.sin(t);return[e,t,-t,e,0,0]},calcDimensionsMatrix:function(t){var e=void 0===t.scaleX?1:t.scaleX,i=void 0===t.scaleY?1:t.scaleY,e=[t.flipX?-e:e,0,0,t.flipY?-i:i,0,0],i=fabric.util.multiplyTransformMatrices,r=fabric.util.degreesToRadians;return t.skewX&&(e=i(e,[1,0,Math.tan(r(t.skewX)),1],!0)),e=t.skewY?i(e,[1,Math.tan(r(t.skewY)),0,1],!0):e},composeMatrix:function(t){var e=[1,0,0,1,t.translateX||0,t.translateY||0],i=fabric.util.multiplyTransformMatrices;return t.angle&&(e=i(e,fabric.util.calcRotateMatrix(t))),e=1!==t.scaleX||1!==t.scaleY||t.skewX||t.skewY||t.flipX||t.flipY?i(e,fabric.util.calcDimensionsMatrix(t)):e},resetObjectTransform:function(t){t.scaleX=1,t.scaleY=1,t.skewX=0,t.skewY=0,t.flipX=!1,t.flipY=!1,t.rotate(0)},saveObjectTransform:function(t){return{scaleX:t.scaleX,scaleY:t.scaleY,skewX:t.skewX,skewY:t.skewY,angle:t.angle,left:t.left,flipX:t.flipX,flipY:t.flipY,top:t.top}},isTransparent:function(t,e,i,r){0<r&&(r<e?e-=r:e=0,r<i?i-=r:i=0);for(var n=!0,s=t.getImageData(e,i,2*r||1,2*r||1),o=s.data.length,a=3;a<o&&!1!=(n=s.data[a]<=0);a+=4);return s=null,n},parsePreserveAspectRatioAttribute:function(t){var e,i="meet",t=t.split(" ");return t&&t.length&&("meet"!==(i=t.pop())&&"slice"!==i?(e=i,i="meet"):t.length&&(e=t.pop())),{meetOrSlice:i,alignX:"none"!==e?e.slice(1,4):"none",alignY:"none"!==e?e.slice(5,8):"none"}},clearFabricFontCache:function(t){(t=(t||"").toLowerCase())?fabric.charWidthsCache[t]&&delete fabric.charWidthsCache[t]:fabric.charWidthsCache={}},limitDimsByArea:function(t,e){t=Math.sqrt(e*t),e=Math.floor(e/t);return{x:Math.floor(t),y:e}},capValue:function(t,e,i){return Math.max(t,Math.min(e,i))},findScaleToFit:function(t,e){return Math.min(e.width/t.width,e.height/t.height)},findScaleToCover:function(t,e){return Math.max(e.width/t.width,e.height/t.height)},matrixToSVG:function(t){return"matrix("+t.map(function(t){return fabric.util.toFixed(t,fabric.Object.NUM_FRACTION_DIGITS)}).join(" ")+")"},removeTransformFromObject:function(t,e){e=fabric.util.invertTransform(e),e=fabric.util.multiplyTransformMatrices(e,t.calcOwnMatrix());fabric.util.applyTransformToObject(t,e)},addTransformToObject:function(t,e){fabric.util.applyTransformToObject(t,fabric.util.multiplyTransformMatrices(e,t.calcOwnMatrix()))},applyTransformToObject:function(t,e){var e=fabric.util.qrDecompose(e),i=new fabric.Point(e.translateX,e.translateY);t.flipX=!1,t.flipY=!1,t.set("scaleX",e.scaleX),t.set("scaleY",e.scaleY),t.skewX=e.skewX,t.skewY=e.skewY,t.angle=e.angle,t.setPositionByOrigin(i,"center","center")},sizeAfterTransform:function(t,e,i){t/=2,e/=2,t=[{x:-t,y:-e},{x:t,y:-e},{x:-t,y:e},{x:t,y:e}],e=fabric.util.calcDimensionsMatrix(i),i=fabric.util.makeBoundingBoxFromPoints(t,e);return{x:i.width,y:i.height}},mergeClipPaths:function(t,e){var i=t,r=e,e=(i.inverted&&!r.inverted&&(i=e,r=t),fabric.util.applyTransformToObject(r,fabric.util.multiplyTransformMatrices(fabric.util.invertTransform(i.calcTransformMatrix()),r.calcTransformMatrix())),i.inverted&&r.inverted);return e&&(i.inverted=r.inverted=!1),new fabric.Group([i],{clipPath:r,inverted:e})},hasStyleChanged:function(t,e,i){return i=i||!1,t.fill!==e.fill||t.stroke!==e.stroke||t.strokeWidth!==e.strokeWidth||t.fontSize!==e.fontSize||t.fontFamily!==e.fontFamily||t.fontWeight!==e.fontWeight||t.fontStyle!==e.fontStyle||t.textBackgroundColor!==e.textBackgroundColor||t.deltaY!==e.deltaY||i&&(t.overline!==e.overline||t.underline!==e.underline||t.linethrough!==e.linethrough)},stylesToArray:function(t,e){for(var t=fabric.util.object.clone(t,!0),i=e.split("\n"),r=-1,n={},s=[],o=0;o<i.length;o++)if(t[o])for(var a=0;a<i[o].length;a++){r++;var c=t[o][a];c&&0<Object.keys(c).length&&(fabric.util.hasStyleChanged(n,c,!0)?s.push({start:r,end:r+1,style:c}):s[s.length-1].end++),n=c||{}}else r+=i[o].length;return s},stylesFromArray:function(t,e){if(!Array.isArray(t))return t;for(var i=e.split("\n"),r=-1,n=0,s={},o=0;o<i.length;o++)for(var a=0;a<i[o].length;a++)r++,t[n]&&t[n].start<=r&&r<t[n].end&&(s[o]=s[o]||{},s[o][a]=Object.assign({},t[n].style),r===t[n].end-1&&n++);return s}}}("undefined"!=typeof exports?exports:this),function(){var w=Array.prototype.join,T={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},O={m:"l",M:"L"};function d(t,e,i,r,n,s,o){for(var a,c,h,l,u,f,d,g,p,m,v,b,y,_=Math.PI,o=o*_/180,x=fabric.util.sin(o),C=fabric.util.cos(o),S=0,T=0,o=-C*t*.5-x*e*.5,w=-C*e*.5+x*t*.5,O=(i=Math.abs(i))*i,P=(r=Math.abs(r))*r,L=w*w,R=o*o,k=O*P-O*L-P*R,E=0,j=(k<0?(i*=j=Math.sqrt(1-k/(O*P)),r*=j):E=(n===s?-1:1)*Math.sqrt(k/(O*L+P*R)),E*i*w/r),n=-E*r*o/i,B=C*j-x*n+.5*t,X=x*j+C*n+.5*e,A=H(1,0,(o-j)/i,(w-n)/r),k=H((o-j)/i,(w-n)/r,(-o-j)/i,(-w-n)/r),W=(0===s&&0<k?k-=2*_:1===s&&k<0&&(k+=2*_),Math.ceil(Math.abs(k/_*2))),D=[],M=k/W,Y=8/3*Math.sin(M/4)*Math.sin(M/4)/Math.sin(M/2),F=A+M,I=0;I<W;I++)D[I]=(a=A,c=F,h=C,l=x,u=i,f=r,d=B,g=X,p=Y,m=S,v=T,y=b=void 0,b=fabric.util.cos(a),a=fabric.util.sin(a),y=fabric.util.cos(c),c=fabric.util.sin(c),["C",m+p*(-h*u*a-l*f*b),v+p*(-l*u*a+h*f*b),(d=h*u*y-l*f*c+d)+p*(h*u*c+l*f*y),(g=l*u*y+h*f*c+g)+p*(l*u*c-h*f*y),d,g]),S=D[I][5],T=D[I][6],A=F,F+=M;return D}function H(t,e,i,r){e=Math.atan2(e,t),t=Math.atan2(r,i);return e<=t?t-e:2*Math.PI-(e-t)}function g(t,e,i,r){return Math.sqrt((i-t)*(i-t)+(r-e)*(r-e))}function p(t,e,i){for(var r,n={x:e,y:i},s=0,o=1;o<=100;o+=1)r=t(o/100),s+=g(n.x,n.y,r.x,r.y),n=r;return s}function h(t,e){for(var i,r,n,s=0,o=0,a=t.iterator,c={x:t.x,y:t.y},h=.01,t=t.angleFinder;o<e&&1e-4<h;)i=a(s),n=s,e<(r=g(c.x,c.y,i.x,i.y))+o?(s-=h,h/=2):(c=i,s+=h,o+=r);return i.angle=t(n),i}function l(t){for(var e,i,r,n,s=0,o=t.length,a=0,c=0,h=0,l=0,u=[],f=0;f<o;f++){switch(r={x:a,y:c,command:(e=t[f])[0]},e[0]){case"M":r.length=0,h=a=e[1],l=c=e[2];break;case"L":r.length=g(a,c,e[1],e[2]),a=e[1],c=e[2];break;case"C":i=function(n,s,o,a,c,h,l,u){return function(t){var e=t*t*t,i=3*t*t*(1-t),r=3*t*(1-t)*(1-t),t=(1-t)*(1-t)*(1-t);return{x:l*e+c*i+o*r+n*t,y:u*e+h*i+a*r+s*t}}}(a,c,e[1],e[2],e[3],e[4],e[5],e[6]),n=function(i,r,n,s,o,a,c,h){return function(t){var e=1-t;return Math.atan2(3*e*e*(s-r)+6*e*t*(a-s)+3*t*t*(h-a),3*e*e*(n-i)+6*e*t*(o-n)+3*t*t*(c-o))}}(a,c,e[1],e[2],e[3],e[4],e[5],e[6]),r.iterator=i,r.angleFinder=n,r.length=p(i,a,c),a=e[5],c=e[6];break;case"Q":i=function(r,n,s,o,a,c){return function(t){var e=t*t,i=2*t*(1-t),t=(1-t)*(1-t);return{x:a*e+s*i+r*t,y:c*e+o*i+n*t}}}(a,c,e[1],e[2],e[3],e[4]),n=function(i,r,n,s,o,a){return function(t){var e=1-t;return Math.atan2(2*e*(s-r)+2*t*(a-s),2*e*(n-i)+2*t*(o-n))}}(a,c,e[1],e[2],e[3],e[4]),r.iterator=i,r.angleFinder=n,r.length=p(i,a,c),a=e[3],c=e[4];break;case"Z":case"z":r.destX=h,r.destY=l,r.length=g(a,c,h,l),a=h,c=l}s+=r.length,u.push(r)}return u.push({length:s,x:a,y:c}),u}fabric.util.joinPath=function(t){return t.map(function(t){return t.join(" ")}).join(" ")},fabric.util.parsePath=function(t){var e,i,r,n,s=[],o=[],a=fabric.rePathCommand,c="[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",h="("+c+")"+fabric.commaWsp,l="([01])"+fabric.commaWsp+"?",u=new RegExp(h+"?"+h+"?"+h+l+l+h+"?("+c+")","g");if(!t||!t.match)return s;for(var f,d=0,g=(f=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi)).length;d<g;d++){n=(e=f[d]).slice(1).trim(),o.length=0;var p,m=e.charAt(0),v=[m];if("a"===m.toLowerCase())for(;p=u.exec(n);)for(var b=1;b<p.length;b++)o.push(p[b]);else for(;r=a.exec(n);)o.push(r[0]);for(var b=0,y=o.length;b<y;b++)i=parseFloat(o[b]),isNaN(i)||v.push(i);var _=T[m.toLowerCase()],x=O[m]||m;if(v.length-1>_)for(var C=1,S=v.length;C<S;C+=_)s.push([m].concat(v.slice(C,C+_))),m=x;else s.push(v)}return s},fabric.util.makePathSimpler=function(t){for(var e,i,r,n,s,o=0,a=0,c=t.length,h=0,l=0,u=[],f=0;f<c;++f){switch(i=!1,(e=t[f].slice(0))[0]){case"l":e[0]="L",e[1]+=o,e[2]+=a;case"L":o=e[1],a=e[2];break;case"h":e[1]+=o;case"H":e[0]="L",e[2]=a,o=e[1];break;case"v":e[1]+=a;case"V":e[0]="L",a=e[1],e[1]=o,e[2]=a;break;case"m":e[0]="M",e[1]+=o,e[2]+=a;case"M":o=e[1],a=e[2],h=e[1],l=e[2];break;case"c":e[0]="C",e[1]+=o,e[2]+=a,e[3]+=o,e[4]+=a,e[5]+=o,e[6]+=a;case"C":n=e[3],s=e[4],o=e[5],a=e[6];break;case"s":e[0]="S",e[1]+=o,e[2]+=a,e[3]+=o,e[4]+=a;case"S":s="C"===r?(n=2*o-n,2*a-s):(n=o,a),o=e[3],a=e[4],e[0]="C",e[5]=e[3],e[6]=e[4],e[3]=e[1],e[4]=e[2],e[1]=n,e[2]=s,n=e[3],s=e[4];break;case"q":e[0]="Q",e[1]+=o,e[2]+=a,e[3]+=o,e[4]+=a;case"Q":n=e[1],s=e[2],o=e[3],a=e[4];break;case"t":e[0]="T",e[1]+=o,e[2]+=a;case"T":s="Q"===r?(n=2*o-n,2*a-s):(n=o,a),e[0]="Q",o=e[1],a=e[2],e[1]=n,e[2]=s,e[3]=o,e[4]=a;break;case"a":e[0]="A",e[6]+=o,e[7]+=a;case"A":i=!0,u=u.concat(function(t,e,i){for(var r=i[1],n=i[2],s=i[3],o=i[4],a=i[5],c=d(i[6]-t,i[7]-e,r,n,o,a,s),h=0,l=c.length;h<l;h++)c[h][1]+=t,c[h][2]+=e,c[h][3]+=t,c[h][4]+=e,c[h][5]+=t,c[h][6]+=e;return c}(o,a,e)),o=e[6],a=e[7];break;case"z":case"Z":o=h,a=l}i||u.push(e),r=e[0]}return u},fabric.util.getSmoothPathFromPoints=function(t,e){var i,r,n=[],s=new fabric.Point(t[0].x,t[0].y),o=new fabric.Point(t[1].x,t[1].y),a=t.length,c=1,h=0,l=2<a;for(l&&(c=t[2].x<o.x?-1:t[2].x===o.x?0:1,h=t[2].y<o.y?-1:t[2].y===o.y?0:1),n.push(["M",s.x-c*(e=e||0),s.y-h*e]),i=1;i<a;i++)s.eq(o)||(r=s.midPointFrom(o),n.push(["Q",s.x,s.y,r.x,r.y])),s=t[i],i+1<t.length&&(o=t[i+1]);return l&&(c=s.x>t[i-2].x?1:s.x===t[i-2].x?0:-1,h=s.y>t[i-2].y?1:s.y===t[i-2].y?0:-1),n.push(["L",s.x+c*e,s.y+h*e]),n},fabric.util.getPathSegmentsInfo=l,fabric.util.getBoundsOfCurve=function(t,e,i,r,n,s,o,a){var c;if(fabric.cachesBoundsOfCurve&&(c=w.call(arguments),fabric.boundsOfCurveCache[c]))return fabric.boundsOfCurveCache[c];for(var h,l,u,f=Math.sqrt,d=Math.min,g=Math.max,p=Math.abs,m=[],v=[[],[]],b=6*t-12*i+6*n,y=-3*t+9*i-9*n+3*o,_=3*i-3*t,x=0;x<2;++x)0<x&&(b=6*e-12*r+6*s,y=-3*e+9*r-9*s+3*a,_=3*r-3*e),p(y)<1e-12?p(b)<1e-12||0<(h=-_/b)&&h<1&&m.push(h):(u=b*b-4*_*y)<0||(0<(l=(-b+(u=f(u)))/(2*y))&&l<1&&m.push(l),0<(l=(-b-u)/(2*y))&&l<1&&m.push(l));for(var C,S=m.length,T=S;S--;)h=m[S],v[0][S]=(C=1-h)*C*C*t+3*C*C*h*i+3*C*h*h*n+h*h*h*o,v[1][S]=C*C*C*e+3*C*C*h*r+3*C*h*h*s+h*h*h*a;return v[0][T]=t,v[1][T]=e,v[0][T+1]=o,v[1][T+1]=a,T=[{x:d.apply(null,v[0]),y:d.apply(null,v[1])},{x:g.apply(null,v[0]),y:g.apply(null,v[1])}],fabric.cachesBoundsOfCurve&&(fabric.boundsOfCurveCache[c]=T),T},fabric.util.getPointOnPath=function(t,e,i){i=i||l(t);for(var r=0;0<e-i[r].length&&r<i.length-2;)e-=i[r].length,r++;var n,s=i[r],o=e/s.length,a=s.command,c=t[r];switch(a){case"M":return{x:s.x,y:s.y,angle:0};case"Z":case"z":return(n=new fabric.Point(s.x,s.y).lerp(new fabric.Point(s.destX,s.destY),o)).angle=Math.atan2(s.destY-s.y,s.destX-s.x),n;case"L":return(n=new fabric.Point(s.x,s.y).lerp(new fabric.Point(c[1],c[2]),o)).angle=Math.atan2(c[2]-s.y,c[1]-s.x),n;case"C":case"Q":return h(s,e)}},fabric.util.transformPath=function(t,n,e){return e&&(n=fabric.util.multiplyTransformMatrices(n,[1,0,0,1,-e.x,-e.y])),t.map(function(t){for(var e=t.slice(0),i={},r=1;r<t.length-1;r+=2)i.x=t[r],i.y=t[r+1],i=fabric.util.transformPoint(i,n),e[r]=i.x,e[r+1]=i.y;return e})}}(),function(){var o=Array.prototype.slice;function i(t,e,i){if(t&&0!==t.length){var r=t.length-1,n=e?t[r][e]:t[r];if(e)for(;r--;)i(t[r][e],n)&&(n=t[r][e]);else for(;r--;)i(t[r],n)&&(n=t[r]);return n}}fabric.util.array={fill:function(t,e){for(var i=t.length;i--;)t[i]=e;return t},invoke:function(t,e){for(var i=o.call(arguments,2),r=[],n=0,s=t.length;n<s;n++)r[n]=i.length?t[n][e].apply(t[n],i):t[n][e].call(t[n]);return r},min:function(t,e){return i(t,e,function(t,e){return t<e})},max:function(t,e){return i(t,e,function(t,e){return e<=t})}}}(),function(){function o(t,e,i){if(i)if(!fabric.isLikelyNode&&e instanceof Element)t=e;else if(e instanceof Array){t=[];for(var r=0,n=e.length;r<n;r++)t[r]=o({},e[r],i)}else if(e&&"object"==typeof e)for(var s in e)"canvas"===s||"group"===s?t[s]=null:e.hasOwnProperty(s)&&(t[s]=o({},e[s],i));else t=e;else for(var s in e)t[s]=e[s];return t}fabric.util.object={extend:o,clone:function(t,e){return o({},t,e)}},fabric.util.object.extend(fabric.util,fabric.Observable)}(),fabric.util.string={camelize:function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},capitalize:function(t,e){return t.charAt(0).toUpperCase()+(e?t.slice(1):t.slice(1).toLowerCase())},escapeXml:function(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},graphemeSplit:function(t){for(var e,i=0,r=[],i=0;i<t.length;i++)!1!==(e=function(t,e){var i=t.charCodeAt(e);if(isNaN(i))return"";if(i<55296||57343<i)return t.charAt(e);if(55296<=i&&i<=56319){if(t.length<=e+1)throw"High surrogate without following low surrogate";i=t.charCodeAt(e+1);if(i<56320||57343<i)throw"High surrogate without following low surrogate";return t.charAt(e)+t.charAt(e+1)}if(0===e)throw"Low surrogate without preceding high surrogate";i=t.charCodeAt(e-1);if(i<55296||56319<i)throw"Low surrogate without preceding high surrogate";return!1}(t,i))&&r.push(e);return r}},function(){function s(){}var o=Array.prototype.slice,a=function(){for(var t in{toString:1})if("toString"===t)return!1;return!0}();function c(){}function h(t){for(var e=null,i=this;i.constructor.superclass;){var r=i.constructor.superclass.prototype[t];if(i[t]!==r){e=r;break}i=i.constructor.superclass.prototype}return e?1<arguments.length?e.apply(this,o.call(arguments,1)):e.call(this):console.log("tried to callSuper "+t+", method not found in prototype chain",this)}fabric.util.createClass=function(){var t=null,e=o.call(arguments,0);function i(){this.initialize.apply(this,arguments)}"function"==typeof e[0]&&(t=e.shift()),i.superclass=t,i.subclasses=[],t&&(c.prototype=t.prototype,i.prototype=new c,t.subclasses.push(i));for(var r=0,n=e.length;r<n;r++)!function(t,r,n){for(var e in r)e in t.prototype&&"function"==typeof t.prototype[e]&&-1<(r[e]+"").indexOf("callSuper")?t.prototype[e]=function(i){return function(){var t=this.constructor.superclass,e=(this.constructor.superclass=n,r[i].apply(this,arguments));if(this.constructor.superclass=t,"initialize"!==i)return e}}(e):t.prototype[e]=r[e],a&&(r.toString!==Object.prototype.toString&&(t.prototype.toString=r.toString),r.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=r.valueOf))}(i,e[r],t);return i.prototype.initialize||(i.prototype.initialize=s),(i.prototype.constructor=i).prototype.callSuper=h,i}}(),function(){var n=!!fabric.document.createElement("div").attachEvent,e=["touchstart","touchmove","touchend"];fabric.util.addListener=function(t,e,i,r){t&&t.addEventListener(e,i,!n&&r)},fabric.util.removeListener=function(t,e,i,r){t&&t.removeEventListener(e,i,!n&&r)},fabric.util.getPointer=function(t){var e=t.target,e=fabric.util.getScrollLeftTop(e),i=(i=(t=t).changedTouches)&&i[0]?i[0]:t;return{x:i.clientX+e.left,y:i.clientY+e.top}},fabric.util.isTouchEvent=function(t){return-1<e.indexOf(t.type)||"touch"===t.pointerType}}(),function(){var t=fabric.document.createElement("div"),e="string"==typeof t.style.opacity,t="string"==typeof t.style.filter,r=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,s=function(t){return t};e?s=function(t,e){return t.style.opacity=e,t}:t&&(s=function(t,e){var i=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(i.zoom=1),r.test(i.filter)?i.filter=i.filter.replace(r,e=.9999<=e?"":"alpha(opacity="+100*e+")"):i.filter+=" alpha(opacity="+100*e+")",t}),fabric.util.setStyle=function(t,e){var i,r,n=t.style;if(!n)return t;if("string"==typeof e)return t.style.cssText+=";"+e,-1<e.indexOf("opacity")?s(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(i in e)"opacity"===i?s(t,e[i]):(r="float"===i||"cssFloat"===i?void 0===n.styleFloat?"cssFloat":"styleFloat":i,n.setProperty(r,e[i]));return t}}(),function(){var e=Array.prototype.slice;var a,t,i,r=function(t){return e.call(t,0)};try{t=r(fabric.document.childNodes)instanceof Array}catch(t){}function n(t,e){var i,r=fabric.document.createElement(t);for(i in e)"class"===i?r.className=e[i]:"for"===i?r.htmlFor=e[i]:r.setAttribute(i,e[i]);return r}function c(t){for(var e=0,i=0,r=fabric.document.documentElement,n=fabric.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&((t=t.parentNode||t.host)===fabric.document?(e=n.scrollLeft||r.scrollLeft||0,i=n.scrollTop||r.scrollTop||0):(e+=t.scrollLeft||0,i+=t.scrollTop||0),1!==t.nodeType||"fixed"!==t.style.position););return{left:e,top:i}}t||(r=function(t){for(var e=new Array(t.length),i=t.length;i--;)e[i]=t[i];return e}),a=fabric.document.defaultView&&fabric.document.defaultView.getComputedStyle?function(t,e){t=fabric.document.defaultView.getComputedStyle(t,null);return t?t[e]:void 0}:function(t,e){var i=t.style[e];return i=!i&&t.currentStyle?t.currentStyle[e]:i},t=fabric.document.documentElement.style,i="userSelect"in t?"userSelect":"MozUserSelect"in t?"MozUserSelect":"WebkitUserSelect"in t?"WebkitUserSelect":"KhtmlUserSelect"in t?"KhtmlUserSelect":"",fabric.util.makeElementUnselectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=fabric.util.falseFunction),i?t.style[i]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t},fabric.util.makeElementSelectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=null),i?t.style[i]="":"string"==typeof t.unselectable&&(t.unselectable=""),t},fabric.util.setImageSmoothing=function(t,e){t.imageSmoothingEnabled=t.imageSmoothingEnabled||t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled||t.oImageSmoothingEnabled,t.imageSmoothingEnabled=e},fabric.util.getById=function(t){return"string"==typeof t?fabric.document.getElementById(t):t},fabric.util.toArray=r,fabric.util.addClass=function(t,e){t&&-1===(" "+t.className+" ").indexOf(" "+e+" ")&&(t.className+=(t.className?" ":"")+e)},fabric.util.makeElement=n,fabric.util.wrapElement=function(t,e,i){return"string"==typeof e&&(e=n(e,i)),t.parentNode&&t.parentNode.replaceChild(e,t),e.appendChild(t),e},fabric.util.getScrollLeftTop=c,fabric.util.getElementOffset=function(t){var e,i,r=t&&t.ownerDocument,n={left:0,top:0},s={left:0,top:0},o={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!r)return s;for(i in o)s[o[i]]+=parseInt(a(t,i),10)||0;return r=r.documentElement,void 0!==t.getBoundingClientRect&&(n=t.getBoundingClientRect()),e=c(t),{left:n.left+e.left-(r.clientLeft||0)+s.left,top:n.top+e.top-(r.clientTop||0)+s.top}},fabric.util.getNodeCanvas=function(t){return(t=fabric.jsdomImplForWrapper(t))._canvas||t._image},fabric.util.cleanUpJsdomNode=function(t){!fabric.isLikelyNode||(t=fabric.jsdomImplForWrapper(t))&&(t._image=null,t._canvas=null,t._currentSrc=null,t._attributes=null,t._classList=null)}}(),function(){function a(){}fabric.util.request=function(t,e){var i,r=(e=e||{}).method?e.method.toUpperCase():"GET",n=e.onComplete||function(){},s=new fabric.window.XMLHttpRequest,o=e.body||e.parameters;return s.onreadystatechange=function(){4===s.readyState&&(n(s),s.onreadystatechange=a)},"GET"===r&&(o=null,"string"==typeof e.parameters&&(i=t,e=e.parameters,t=i+(/\?/.test(i)?"&":"?")+e)),s.open(r,t,!0),"POST"!==r&&"PUT"!==r||s.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),s.send(o),s}}(),fabric.log=console.log,fabric.warn=console.warn,function(){var t=fabric.util.object.extend,i=fabric.util.object.clone,e=[];function r(){return!1}function n(t,e,i,r){return-i*Math.cos(t/r*(Math.PI/2))+i+e}fabric.util.object.extend(e,{cancelAll:function(){var t=this.splice(0);return t.forEach(function(t){t.cancel()}),t},cancelByCanvas:function(e){if(!e)return[];var t=this.filter(function(t){return"object"==typeof t.target&&t.target.canvas===e});return t.forEach(function(t){t.cancel()}),t},cancelByTarget:function(t){t=this.findAnimationsByTarget(t);return t.forEach(function(t){t.cancel()}),t},findAnimationIndex:function(t){return this.indexOf(this.findAnimation(t))},findAnimation:function(e){return this.find(function(t){return t.cancel===e})},findAnimationsByTarget:function(e){return e?this.filter(function(t){return t.target===e}):[]}});var s=fabric.window.requestAnimationFrame||fabric.window.webkitRequestAnimationFrame||fabric.window.mozRequestAnimationFrame||fabric.window.oRequestAnimationFrame||fabric.window.msRequestAnimationFrame||function(t){return fabric.window.setTimeout(t,1e3/60)},o=fabric.window.cancelAnimationFrame||fabric.window.clearTimeout;function _(){return s.apply(fabric.window,arguments)}fabric.util.animate=function(e){function v(){var t=fabric.runningAnimations.indexOf(y);return-1<t&&fabric.runningAnimations.splice(t,1)[0]}var b=!1,y=t(i(e=e||{}),{cancel:function(){return b=!0,v()},currentValue:"startValue"in e?e.startValue:0,completionRate:0,durationRate:0});return fabric.runningAnimations.push(y),_(function(t){var s,o=t||+new Date,a=e.duration||500,c=o+a,h=e.onChange||r,l=e.abort||r,u=e.onComplete||r,f=e.easing||n,d="startValue"in e&&0<e.startValue.length,g="startValue"in e?e.startValue:0,p="endValue"in e?e.endValue:100,m=e.byValue||(d?g.map(function(t,e){return p[e]-g[e]}):p-g);e.onStart&&e.onStart(),function t(e){s=e||+new Date;var i=c<s?a:s-o,e=i/a,r=d?g.map(function(t,e){return f(i,g[e],m[e],a)}):f(i,g,m,a),n=d?Math.abs((r[0]-g[0])/m[0]):Math.abs((r-g)/m);y.currentValue=d?r.slice():r,y.completionRate=n,y.durationRate=e,b||(l(r,n,e)?v():c<s?(y.currentValue=d?p.slice():p,y.completionRate=1,y.durationRate=1,h(d?p.slice():p,1,1),u(p,1,1),v()):(h(r,n,e),_(t)))}(o)}),y.cancel},fabric.util.requestAnimFrame=_,fabric.util.cancelAnimFrame=function(){return o.apply(fabric.window,arguments)},fabric.runningAnimations=e}(),function(){function a(t,e,i){var r="rgba("+parseInt(t[0]+i*(e[0]-t[0]),10)+","+parseInt(t[1]+i*(e[1]-t[1]),10)+","+parseInt(t[2]+i*(e[2]-t[2]),10);return r+(","+(t&&e?parseFloat(t[3]+i*(e[3]-t[3])):1))+")"}fabric.util.animateColor=function(t,e,i,n){var t=new fabric.Color(t).getSource(),r=new fabric.Color(e).getSource(),s=n.onComplete,o=n.onChange;return n=n||{},fabric.util.animate(fabric.util.object.extend(n,{duration:i||500,startValue:t,endValue:r,byValue:r,easing:function(t,e,i,r){return a(e,i,n.colorEasing?n.colorEasing(t,r):1-Math.cos(t/r*(Math.PI/2)))},onComplete:function(t,e,i){if(s)return s(a(r,r,0),e,i)},onChange:function(t,e,i){if(o){if(Array.isArray(t))return o(a(t,t,0),e,i);o(t,e,i)}}}))}}(),function(){function s(t,e,i,r){return r=t<Math.abs(e)?(t=e,i/4):0===e&&0===t?i/(2*Math.PI)*Math.asin(1):i/(2*Math.PI)*Math.asin(e/t),{a:t,c:e,p:i,s:r}}function o(t,e,i){return t.a*Math.pow(2,10*--e)*Math.sin((e*i-t.s)*(2*Math.PI)/t.p)}function n(t,e,i,r){return i-a(r-t,0,i,r)+e}function a(t,e,i,r){return(t/=r)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e}fabric.util.ease={easeInQuad:function(t,e,i,r){return i*(t/=r)*t+e},easeOutQuad:function(t,e,i,r){return-i*(t/=r)*(t-2)+e},easeInOutQuad:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,i,r){return i*(t/=r)*t*t+e},easeOutCubic:function(t,e,i,r){return i*((t=t/r-1)*t*t+1)+e},easeInOutCubic:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,i,r){return i*(t/=r)*t*t*t+e},easeOutQuart:function(t,e,i,r){return-i*((t=t/r-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,i,r){return i*(t/=r)*t*t*t*t+e},easeOutQuint:function(t,e,i,r){return i*((t=t/r-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,i,r){return-i*Math.cos(t/r*(Math.PI/2))+i+e},easeOutSine:function(t,e,i,r){return i*Math.sin(t/r*(Math.PI/2))+e},easeInOutSine:function(t,e,i,r){return-i/2*(Math.cos(Math.PI*t/r)-1)+e},easeInExpo:function(t,e,i,r){return 0===t?e:i*Math.pow(2,10*(t/r-1))+e},easeOutExpo:function(t,e,i,r){return t===r?e+i:i*(1-Math.pow(2,-10*t/r))+e},easeInOutExpo:function(t,e,i,r){return 0===t?e:t===r?e+i:(t/=r/2)<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(2-Math.pow(2,-10*--t))+e},easeInCirc:function(t,e,i,r){return-i*(Math.sqrt(1-(t/=r)*t)-1)+e},easeOutCirc:function(t,e,i,r){return i*Math.sqrt(1-(t=t/r-1)*t)+e},easeInOutCirc:function(t,e,i,r){return(t/=r/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(t,e,i,r){var n=0;return 0===t?e:1===(t/=r)?e+i:-o(s(i,i,n=n||.3*r,1.70158),t,r)+e},easeOutElastic:function(t,e,i,r){return 0===t?e:1===(t/=r)?e+i:(i=s(i,i,0||.3*r,1.70158)).a*Math.pow(2,-10*t)*Math.sin((t*r-i.s)*(2*Math.PI)/i.p)+i.c+e},easeInOutElastic:function(t,e,i,r){return 0===t?e:2===(t/=r/2)?e+i:(i=s(i,i,0||r*(.3*1.5),1.70158),t<1?-.5*o(i,t,r)+e:i.a*Math.pow(2,-10*--t)*Math.sin((t*r-i.s)*(2*Math.PI)/i.p)*.5+i.c+e)},easeInBack:function(t,e,i,r,n){return i*(t/=r)*t*(((n=void 0===n?1.70158:n)+1)*t-n)+e},easeOutBack:function(t,e,i,r,n){return i*((t=t/r-1)*t*(((n=void 0===n?1.70158:n)+1)*t+n)+1)+e},easeInOutBack:function(t,e,i,r,n){return void 0===n&&(n=1.70158),(t/=r/2)<1?i/2*(t*t*((1+(n*=1.525))*t-n))+e:i/2*((t-=2)*t*((1+(n*=1.525))*t+n)+2)+e},easeInBounce:n,easeOutBounce:a,easeInOutBounce:function(t,e,i,r){return t<r/2?.5*n(2*t,0,i,r)+e:.5*a(2*t-r,0,i,r)+.5*i+e}}}(),function(t){"use strict";var u,e,f,i,r,y=t.fabric||(t.fabric={}),g=y.util.object.extend,d=y.util.object.clone,p=y.util.toFixed,_=y.util.parseUnit,m=y.util.multiplyTransformMatrices,v={cx:"left",x:"left",r:"radius",cy:"top",y:"top",display:"visible",visibility:"visible",transform:"transformMatrix","fill-opacity":"fillOpacity","fill-rule":"fillRule","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","letter-spacing":"charSpacing","paint-order":"paintFirst","stroke-dasharray":"strokeDashArray","stroke-dashoffset":"strokeDashOffset","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"textAnchor",opacity:"opacity","clip-path":"clipPath","clip-rule":"clipRule","vector-effect":"strokeUniform","image-rendering":"imageSmoothing"},b={stroke:"strokeOpacity",fill:"fillOpacity"},x="font-size",C="clip-path";function n(t){return new RegExp("^("+t.join("|")+")\\b","i")}function S(t,e){for(var i,r=[],n=0,s=e.length;n<s;n++)i=e[n],i=t.getElementsByTagName(i),r=r.concat(Array.prototype.slice.call(i));return r}function T(t,e,i){t[i]=Math.tan(y.util.degreesToRadians(e[0]))}function w(t,e){var i,r={};for(i in y.cssRules[e])if(function(t,e){var i,r=!0;(i=s(t,e.pop()))&&e.length&&(r=function(t,e){var i,r=!0;for(;t.parentNode&&1===t.parentNode.nodeType&&e.length;)r&&(i=e.pop()),t=t.parentNode,r=s(t,i);return 0===e.length}(t,e));return i&&r&&0===e.length}(t,i.split(" ")))for(var n in y.cssRules[e][i])r[n]=y.cssRules[e][i][n];return r}function s(t,e){var i,r=t.nodeName,n=t.getAttribute("class"),t=t.getAttribute("id"),s=new RegExp("^"+r,"i");if(e=e.replace(s,""),t&&e.length&&(s=new RegExp("#"+t+"(?![a-zA-Z\\-]+)","i"),e=e.replace(s,"")),n&&e.length)for(i=(n=n.split(" ")).length;i--;)s=new RegExp("\\."+n[i]+"(?![a-zA-Z\\-]+)","i"),e=e.replace(s,"");return 0===e.length}function O(t,e){var i;if(i=t.getElementById?t.getElementById(e):i)return i;for(var r,n=t.getElementsByTagName("*"),s=0,o=n.length;s<o;s++)if(e===(r=n[s]).getAttribute("id"))return r}y.svgValidTagNamesRegEx=n(["path","circle","polygon","polyline","ellipse","rect","line","image","text"]),y.svgViewBoxElementsRegEx=n(["symbol","image","marker","pattern","view","svg"]),y.svgInvalidAncestorsRegEx=n(["pattern","defs","symbol","metadata","clipPath","mask","desc"]),y.svgValidParentsRegEx=n(["symbol","g","a","svg","clipPath","defs"]),y.cssRules={},y.gradientDefs={},y.clipPaths={},y.parseTransformAttribute=(u=y.iMatrix,t=y.reNum,e=y.commaWsp,f="(?:"+("(?:(matrix)\\s*\\(\\s*("+t+")"+e+"("+t+")"+e+"("+t+")"+e+"("+t+")"+e+"("+t+")"+e+"("+t+")\\s*\\))")+"|"+("(?:(translate)\\s*\\(\\s*("+t+")(?:"+e+"("+t+"))?\\s*\\))")+"|"+("(?:(scale)\\s*\\(\\s*("+t+")(?:"+e+"("+t+"))?\\s*\\))")+"|"+("(?:(rotate)\\s*\\(\\s*("+t+")(?:"+e+"("+t+")"+e+"("+t+"))?\\s*\\))")+"|"+("(?:(skewX)\\s*\\(\\s*("+t+")\\s*\\))")+"|"+("(?:(skewY)\\s*\\(\\s*("+t+")\\s*\\))")+")",i=new RegExp("^\\s*(?:"+("(?:"+f+"(?:"+e+"*"+f+")*)")+"?)\\s*$"),r=new RegExp(f,"g"),function(t){var h=u.concat(),l=[];if(!t||!i.test(t))return h;t.replace(r,function(t){var e,i,r,n,s,o,t=new RegExp(f).exec(t).filter(function(t){return!!t}),a=t[1],c=t.slice(2).map(parseFloat);switch(a){case"translate":o=c,(s=h)[4]=o[0],2===o.length&&(s[5]=o[1]);break;case"rotate":c[0]=y.util.degreesToRadians(c[0]),s=h,o=c,e=y.util.cos(o[0]),i=y.util.sin(o[0]),n=r=0,3===o.length&&(r=o[1],n=o[2]),s[0]=e,s[1]=i,s[2]=-i,s[3]=e,s[4]=r-(e*r-i*n),s[5]=n-(i*r+e*n);break;case"scale":i=h,e=(r=c)[0],r=2===r.length?r[1]:r[0],i[0]=e,i[3]=r;break;case"skewX":T(h,c,2);break;case"skewY":T(h,c,1);break;case"matrix":h=c}l.push(h.concat()),h=u.concat()});for(var e=l[0];1<l.length;)l.shift(),e=y.util.multiplyTransformMatrices(e,l[0]);return e});var P=new RegExp("^\\s*("+y.reNum+"+)\\s*,?\\s*("+y.reNum+"+)\\s*,?\\s*("+y.reNum+"+)\\s*,?\\s*("+y.reNum+"+)\\s*$");function k(t){if(!y.svgViewBoxElementsRegEx.test(t.nodeName))return{};var e,i,r,n=t.getAttribute("viewBox"),s=1,o=1,a=t.getAttribute("width"),c=t.getAttribute("height"),h=t.getAttribute("x")||0,l=t.getAttribute("y")||0,u=t.getAttribute("preserveAspectRatio")||"",f=!n||!(n=n.match(P)),d=!a||!c||"100%"===a||"100%"===c,g=f&&d,p={},m="",v=0,b=0;if(p.width=0,p.height=0,p.toBeParsed=g,f&&(h||l)&&t.parentNode&&"#document"!==t.parentNode.nodeName&&(m=" translate("+_(h)+" "+_(l)+") ",i=(t.getAttribute("transform")||"")+m,t.setAttribute("transform",i),t.removeAttribute("x"),t.removeAttribute("y")),g)return p;if(f)return p.width=_(a),p.height=_(c),p;if(g=-parseFloat(n[1]),f=-parseFloat(n[2]),e=parseFloat(n[3]),n=parseFloat(n[4]),p.minX=g,p.minY=f,p.viewBoxWidth=e,p.viewBoxHeight=n,d?(p.width=e,p.height=n):(p.width=_(a),p.height=_(c),s=p.width/e,o=p.height/n),"none"!==(u=y.util.parsePreserveAspectRatioAttribute(u)).alignX&&("meet"===u.meetOrSlice&&(o=s=o<s?o:s),"slice"===u.meetOrSlice&&(o=s=o<s?s:o),v=p.width-e*s,b=p.height-n*s,"Mid"===u.alignX&&(v/=2),"Mid"===u.alignY&&(b/=2),"Min"===u.alignX&&(v=0),"Min"===u.alignY&&(b=0)),1===s&&1===o&&0==g&&0==f&&0===h&&0===l)return p;if(i=(m=(h||l)&&"#document"!==t.parentNode.nodeName?" translate("+_(h)+" "+_(l)+") ":m)+" matrix("+s+" 0 0 "+o+" "+(g*s+v)+" "+(f*o+b)+") ","svg"===t.nodeName){for(r=t.ownerDocument.createElementNS(y.svgNS,"g");t.firstChild;)r.appendChild(t.firstChild);t.appendChild(r)}else(r=t).removeAttribute("x"),r.removeAttribute("y"),i=r.getAttribute("transform")+i;return r.setAttribute("transform",i),p}y.parseSVGDocument=function(t,i,e,r){if(t){!function(t){for(var e=S(t,["use","svg:use"]),i=0;e.length&&i<e.length;){var r=e[i],n=r.getAttribute("xlink:href")||r.getAttribute("href");if(null===n)return;var s,n=n.slice(1),o=r.getAttribute("x")||0,a=r.getAttribute("y")||0,c=O(t,n).cloneNode(!0),h=(c.getAttribute("transform")||"")+" translate("+o+", "+a+")",n=e.length,l=y.svgNS;if(k(c),/^svg$/i.test(c.nodeName)){for(var u,f=c.ownerDocument.createElementNS(l,"g"),d=0,g=(u=c.attributes).length;d<g;d++)s=u.item(d),f.setAttributeNS(l,s.nodeName,s.nodeValue);for(;c.firstChild;)f.appendChild(c.firstChild);c=f}for(d=0,g=(u=r.attributes).length;d<g;d++)"x"!==(s=u.item(d)).nodeName&&"y"!==s.nodeName&&"xlink:href"!==s.nodeName&&"href"!==s.nodeName&&("transform"===s.nodeName?h=s.nodeValue+" "+h:c.setAttribute(s.nodeName,s.nodeValue));c.setAttribute("transform",h),c.setAttribute("instantiated_by_use","1"),c.removeAttribute("id"),r.parentNode.replaceChild(c,r),e.length===n&&i++}}(t);var n=y.Object.__uid++,s=k(t),o=y.util.toArray(t.getElementsByTagName("*"));if(s.crossOrigin=r&&r.crossOrigin,s.svgUid=n,0===o.length&&y.isLikelyNode){for(var a=[],c=0,h=(o=t.selectNodes('//*[name(.)!="svg"]')).length;c<h;c++)a[c]=o[c];o=a}var l,u=o.filter(function(t){return k(t),y.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:",""))&&!function(t,e){for(;t=t&&t.parentNode;)if(t.nodeName&&e.test(t.nodeName.replace("svg:",""))&&!t.getAttribute("instantiated_by_use"))return 1}(t,y.svgInvalidAncestorsRegEx)});u&&u.length?(l={},o.filter(function(t){return"clipPath"===t.nodeName.replace("svg:","")}).forEach(function(t){var e=t.getAttribute("id");l[e]=y.util.toArray(t.getElementsByTagName("*")).filter(function(t){return y.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:",""))})}),y.gradientDefs[n]=y.getGradientDefs(t),y.cssRules[n]=y.getCSSRules(t),y.clipPaths[n]=l,y.parseElements(u,function(t,e){i&&(i(t,s,e,o),delete y.gradientDefs[n],delete y.cssRules[n],delete y.clipPaths[n])},d(s),e,r)):i&&i([],{})}};var o=new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+y.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+y.reNum+"))?\\s+(.*)");g(y,{parseFontDeclaration:function(t,e){var i,r,n,s,t=t.match(o);t&&(i=t[1],r=t[3],n=t[4],s=t[5],t=t[6],i&&(e.fontStyle=i),r&&(e.fontWeight=isNaN(parseFloat(r))?r:parseFloat(r)),n&&(e.fontSize=_(n)),t&&(e.fontFamily=t),s&&(e.lineHeight="normal"===s?1:s))},getGradientDefs:function(t){for(var e,i=S(t,["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"]),r=0,n={},r=i.length;r--;)(e=i[r]).getAttribute("xlink:href")&&!function t(e,i){var r="xlink:href",n=O(e,i.getAttribute(r).slice(1));if(n&&n.getAttribute(r)&&t(e,n),["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"].forEach(function(t){n&&!i.hasAttribute(t)&&n.hasAttribute(t)&&i.setAttribute(t,n.getAttribute(t))}),!i.children.length)for(var s=n.cloneNode(!0);s.firstChild;)i.appendChild(s.firstChild);i.removeAttribute(r)}(t,e),n[e.getAttribute("id")]=e;return n},parseAttributes:function(i,t,e){if(i){var r,n,s={},o=(void 0===e&&(e=i.getAttribute("svgUid")),i.parentNode&&y.svgValidParentsRegEx.test(i.parentNode.nodeName)&&(s=y.parseAttributes(i.parentNode,t,e)),t.reduce(function(t,e){return(r=i.getAttribute(e))&&(t[e]=r),t},{})),t=g(w(i,e),y.parseStyleAttribute(i)),o=g(o,t);t[C]&&i.setAttribute(C,t[C]),n=e=s.fontSize||y.Text.DEFAULT_SVG_FONT_SIZE,o[x]&&(o[x]=n=_(o[x],e));var a,c,h,l={};for(c in o)a=function(t,e,i,r){var n,s=Array.isArray(e);if("fill"!==t&&"stroke"!==t||"none"!==e){if("strokeUniform"===t)return"non-scaling-stroke"===e;if("strokeDashArray"===t)e="none"===e?null:e.replace(/,/g," ").split(/\s+/).map(parseFloat);else if("transformMatrix"===t)e=i&&i.transformMatrix?m(i.transformMatrix,y.parseTransformAttribute(e)):y.parseTransformAttribute(e);else if("visible"===t)e="none"!==e&&"hidden"!==e,i&&!1===i.visible&&(e=!1);else if("opacity"===t)e=parseFloat(e),i&&void 0!==i.opacity&&(e*=i.opacity);else if("textAnchor"===t)e="start"===e?"left":"end"===e?"right":"center";else if("charSpacing"===t)n=_(e,r)/r*1e3;else if("paintFirst"===t){var i=e.indexOf("fill"),o=e.indexOf("stroke"),e="fill";(-1<i&&-1<o&&o<i||-1===i&&-1<o)&&(e="stroke")}else{if("href"===t||"xlink:href"===t||"font"===t)return e;if("imageSmoothing"===t)return"optimizeQuality"===e;n=s?e.map(_):_(e,r)}}else e="";return!s&&isNaN(n)?e:n}(h=(h=c)in v?v[h]:h,o[c],s,n),l[h]=a;l&&l.font&&y.parseFontDeclaration(l.font,l);var u,t=g(s,l);if(y.svgValidParentsRegEx.test(i.nodeName))return t;var f,d=t;for(f in b)if(void 0!==d[b[f]]&&""!==d[f]){if(void 0===d[f]){if(!y.Object.prototype[f])continue;d[f]=y.Object.prototype[f]}0!==d[f].indexOf("url(")&&(u=new y.Color(d[f]),d[f]=u.setAlpha(p(u.getAlpha()*d[b[f]],2)).toRgba())}return d}},parseElements:function(t,e,i,r,n){new y.ElementsParser(t,e,i,r,n).parse()},parseStyleAttribute:function(t){var e,i,r,n={},t=t.getAttribute("style");if(!t)return n;if("string"==typeof t)e=n,t.replace(/;\s*$/,"").split(";").forEach(function(t){t=t.split(":");i=t[0].trim().toLowerCase(),r=t[1].trim(),e[i]=r});else{var s,o,a,c=t,h=n;for(a in c)void 0!==c[a]&&(s=a.toLowerCase(),o=c[a],h[s]=o)}return n},parsePointsAttribute:function(t){if(!t)return null;for(var e=[],i=0,r=(t=(t=t.replace(/,/g," ").trim()).split(/\s+/)).length;i<r;i+=2)e.push({x:parseFloat(t[i]),y:parseFloat(t[i+1])});return e},getCSSRules:function(t){for(var e=t.getElementsByTagName("style"),o={},a=0,c=e.length;a<c;a++){var i=e[a].textContent;""!==(i=i.replace(/\/\*[\s\S]*?\*\//g,"")).trim()&&i.split("}").filter(function(t){return t.trim()}).forEach(function(t){var e=t.split("{"),i={},r=e[1].trim().split(";").filter(function(t){return t.trim()});for(a=0,c=r.length;a<c;a++){var n=r[a].split(":"),s=n[0].trim(),n=n[1].trim();i[s]=n}(t=e[0].trim()).split(",").forEach(function(t){""!==(t=t.replace(/^svg/i,"").trim())&&(o[t]?y.util.object.extend(o[t],i):o[t]=y.util.object.clone(i))})})}return o},loadSVGFromURL:function(t,n,e,i){t=t.replace(/^\n\s*/,"").trim(),new y.util.request(t,{method:"get",onComplete:function(t){t=t.responseXML;if(!t||!t.documentElement)return n&&n(null),!1;y.parseSVGDocument(t.documentElement,function(t,e,i,r){n&&n(t,e,i,r)},e,i)}})},loadSVGFromString:function(t,n,e,i){t=(new y.window.DOMParser).parseFromString(t.trim(),"text/xml");y.parseSVGDocument(t.documentElement,function(t,e,i,r){n(t,e,i,r)},e,i)}})}("undefined"!=typeof exports?exports:this),fabric.ElementsParser=function(t,e,i,r,n,s){this.elements=t,this.callback=e,this.options=i,this.reviver=r,this.svgUid=i&&i.svgUid||0,this.parsingOptions=n,this.regexUrl=/^url\(['"]?#([^'"]+)['"]?\)/g,this.doc=s},function(t){t.parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},t.createObjects=function(){var i=this;this.elements.forEach(function(t,e){t.setAttribute("svgUid",i.svgUid),i.createObject(t,e)})},t.findTag=function(t){return fabric[fabric.util.string.capitalize(t.tagName.replace("svg:",""))]},t.createObject=function(t,e){var i=this.findTag(t);if(i&&i.fromElement)try{i.fromElement(t,this.createCallback(e,t),this.options)}catch(t){fabric.log(t)}else this.checkIfDone()},t.createCallback=function(i,r){var n=this;return function(t){var e;n.resolveGradient(t,r,"fill"),n.resolveGradient(t,r,"stroke"),t instanceof fabric.Image&&t._originalElement&&(e=t.parsePreserveAspectRatioAttribute(r)),t._removeTransformMatrix(e),n.resolveClipPath(t,r),n.reviver&&n.reviver(r,t),n.instances[i]=t,n.checkIfDone()}},t.extractPropertyDefinition=function(t,e,i){var t=t[e],e=this.regexUrl;if(e.test(t))return e.lastIndex=0,t=e.exec(t)[1],e.lastIndex=0,fabric[i][this.svgUid][t]},t.resolveGradient=function(t,e,i){var r=this.extractPropertyDefinition(t,i,"gradientDefs");r&&(e=e.getAttribute(i+"-opacity"),r=fabric.Gradient.fromElement(r,t,e,this.options),t.set(i,r))},t.createClipPathCallback=function(t,e){return function(t){t._removeTransformMatrix(),t.fillRule=t.clipRule,e.push(t)}},t.resolveClipPath=function(t,e){var i,r=this.extractPropertyDefinition(t,"clipPath","clipPaths");if(r){for(var n=[],s=fabric.util.invertTransform(t.calcTransformMatrix()),o=r[0].parentNode,a=e;a.parentNode&&a.getAttribute("clip-path")!==t.clipPath;)a=a.parentNode;a.parentNode.appendChild(o);for(var c=0;c<r.length;c++)i=r[c],this.findTag(i).fromElement(i,this.createClipPathCallback(t,n),this.options);r=1===n.length?n[0]:new fabric.Group(n),e=fabric.util.multiplyTransformMatrices(s,r.calcTransformMatrix()),r.clipPath&&this.resolveClipPath(r,a);o=fabric.util.qrDecompose(e);r.flipX=!1,r.flipY=!1,r.set("scaleX",o.scaleX),r.set("scaleY",o.scaleY),r.angle=o.angle,r.skewX=o.skewX,r.skewY=0,r.setPositionByOrigin({x:o.translateX,y:o.translateY},"center","center"),t.clipPath=r}else delete t.clipPath},t.checkIfDone=function(){0==--this.numElements&&(this.instances=this.instances.filter(function(t){return null!=t}),this.callback(this.instances,this.elements))}}(fabric.ElementsParser.prototype),function(t){"use strict";t=t.fabric||(t.fabric={});function i(t,e){this.x=t,this.y=e}t.Point?t.warn("fabric.Point is already defined"):(t.Point=i).prototype={type:"point",constructor:i,add:function(t){return new i(this.x+t.x,this.y+t.y)},addEquals:function(t){return this.x+=t.x,this.y+=t.y,this},scalarAdd:function(t){return new i(this.x+t,this.y+t)},scalarAddEquals:function(t){return this.x+=t,this.y+=t,this},subtract:function(t){return new i(this.x-t.x,this.y-t.y)},subtractEquals:function(t){return this.x-=t.x,this.y-=t.y,this},scalarSubtract:function(t){return new i(this.x-t,this.y-t)},scalarSubtractEquals:function(t){return this.x-=t,this.y-=t,this},multiply:function(t){return new i(this.x*t,this.y*t)},multiplyEquals:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return new i(this.x/t,this.y/t)},divideEquals:function(t){return this.x/=t,this.y/=t,this},eq:function(t){return this.x===t.x&&this.y===t.y},lt:function(t){return this.x<t.x&&this.y<t.y},lte:function(t){return this.x<=t.x&&this.y<=t.y},gt:function(t){return this.x>t.x&&this.y>t.y},gte:function(t){return this.x>=t.x&&this.y>=t.y},lerp:function(t,e){return void 0===e&&(e=.5),e=Math.max(Math.min(1,e),0),new i(this.x+(t.x-this.x)*e,this.y+(t.y-this.y)*e)},distanceFrom:function(t){var e=this.x-t.x,t=this.y-t.y;return Math.sqrt(e*e+t*t)},midPointFrom:function(t){return this.lerp(t)},min:function(t){return new i(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new i(Math.max(this.x,t.x),Math.max(this.y,t.y))},toString:function(){return this.x+","+this.y},setXY:function(t,e){return this.x=t,this.y=e,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setFromPoint:function(t){return this.x=t.x,this.y=t.y,this},swap:function(t){var e=this.x,i=this.y;this.x=t.x,this.y=t.y,t.x=e,t.y=i},clone:function(){return new i(this.x,this.y)}}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var a=t.fabric||(t.fabric={});function c(t){this.status=t,this.points=[]}a.Intersection?a.warn("fabric.Intersection is already defined"):(a.Intersection=c,a.Intersection.prototype={constructor:c,appendPoint:function(t){return this.points.push(t),this},appendPoints:function(t){return this.points=this.points.concat(t),this}},a.Intersection.intersectLineLine=function(t,e,i,r){var n,s=(r.x-i.x)*(t.y-i.y)-(r.y-i.y)*(t.x-i.x),o=(e.x-t.x)*(t.y-i.y)-(e.y-t.y)*(t.x-i.x),r=(r.y-i.y)*(e.x-t.x)-(r.x-i.x)*(e.y-t.y);return 0!=r?(i=o/r,0<=(r=s/r)&&r<=1&&0<=i&&i<=1?(n=new c("Intersection")).appendPoint(new a.Point(t.x+r*(e.x-t.x),t.y+r*(e.y-t.y))):n=new c):n=new c(0==s||0==o?"Coincident":"Parallel"),n},a.Intersection.intersectLinePolygon=function(t,e,i){for(var r,n,s=new c,o=i.length,a=0;a<o;a++)n=i[a],r=i[(a+1)%o],n=c.intersectLineLine(t,e,n,r),s.appendPoints(n.points);return 0<s.points.length&&(s.status="Intersection"),s},a.Intersection.intersectPolygonPolygon=function(t,e){for(var i=new c,r=t.length,n=0;n<r;n++){var s=t[n],o=t[(n+1)%r],s=c.intersectLinePolygon(s,o,e);i.appendPoints(s.points)}return 0<i.points.length&&(i.status="Intersection"),i},a.Intersection.intersectPolygonRectangle=function(t,e,i){var r=e.min(i),e=e.max(i),i=new a.Point(e.x,r.y),n=new a.Point(r.x,e.y),s=c.intersectLinePolygon(r,i,t),i=c.intersectLinePolygon(i,e,t),e=c.intersectLinePolygon(e,n,t),n=c.intersectLinePolygon(n,r,t),r=new c;return r.appendPoints(s.points),r.appendPoints(i.points),r.appendPoints(e.points),r.appendPoints(n.points),0<r.points.length&&(r.status="Intersection"),r})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var h=t.fabric||(t.fabric={});function a(t){t?this._tryParsingColor(t):this.setSource([0,0,0,1])}function c(t,e,i){return i<0&&(i+=1),1<i&&--i,i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}h.Color?h.warn("fabric.Color is already defined."):(h.Color=a,h.Color.prototype={_tryParsingColor:function(t){var e;(e=(e=(e=(e=(e="transparent"===(t=t in a.colorNameMap?a.colorNameMap[t]:t)?[255,255,255,0]:e)||a.sourceFromHex(t))||a.sourceFromRgb(t))||a.sourceFromHsl(t))||[0,0,0,1])&&this.setSource(e)},_rgbToHsl:function(t,e,i){var r,n=h.util.array.max([t/=255,e/=255,i/=255]),s=h.util.array.min([t,e,i]),o=(n+s)/2;if(n===s)r=c=0;else{var a=n-s,c=.5<o?a/(2-n-s):a/(n+s);switch(n){case t:r=(e-i)/a+(e<i?6:0);break;case e:r=(i-t)/a+2;break;case i:r=(t-e)/a+4}r/=6}return[Math.round(360*r),Math.round(100*c),Math.round(100*o)]},getSource:function(){return this._source},setSource:function(t){this._source=t},toRgb:function(){var t=this.getSource();return"rgb("+t[0]+","+t[1]+","+t[2]+")"},toRgba:function(){var t=this.getSource();return"rgba("+t[0]+","+t[1]+","+t[2]+","+t[3]+")"},toHsl:function(){var t=this.getSource(),t=this._rgbToHsl(t[0],t[1],t[2]);return"hsl("+t[0]+","+t[1]+"%,"+t[2]+"%)"},toHsla:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return"hsla("+e[0]+","+e[1]+"%,"+e[2]+"%,"+t[3]+")"},toHex:function(){var t,e=this.getSource(),i=e[0].toString(16);return i=1===i.length?"0"+i:i,t=1===(t=e[1].toString(16)).length?"0"+t:t,e=1===(e=e[2].toString(16)).length?"0"+e:e,i.toUpperCase()+t.toUpperCase()+e.toUpperCase()},toHexa:function(){var t=this.getSource(),t=Math.round(255*t[3]);return t=1===(t=t.toString(16)).length?"0"+t:t,this.toHex()+t.toUpperCase()},getAlpha:function(){return this.getSource()[3]},setAlpha:function(t){var e=this.getSource();return e[3]=t,this.setSource(e),this},toGrayscale:function(){var t=this.getSource(),e=parseInt((.3*t[0]+.59*t[1]+.11*t[2]).toFixed(0),10),t=t[3];return this.setSource([e,e,e,t]),this},toBlackWhite:function(t){var e=this.getSource(),i=(.3*e[0]+.59*e[1]+.11*e[2]).toFixed(0),e=e[3];return t=t||127,i=Number(i)<Number(t)?0:255,this.setSource([i,i,i,e]),this},overlayWith:function(t){t instanceof a||(t=new a(t));for(var e=[],i=this.getAlpha(),r=this.getSource(),n=t.getSource(),s=0;s<3;s++)e.push(Math.round(.5*r[s]+.5*n[s]));return e[3]=i,this.setSource(e),this}},h.Color.reRGBa=/^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*((?:\d*\.?\d+)?)\s*)?\)$/i,h.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i,h.Color.reHex=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,h.Color.colorNameMap={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#00FFFF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blue:"#0000FF",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#FF00FF",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#00FF00",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#FF0000",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFFFFF",whitesmoke:"#F5F5F5",yellow:"#FFFF00",yellowgreen:"#9ACD32"},h.Color.fromRgb=function(t){return a.fromSource(a.sourceFromRgb(t))},h.Color.sourceFromRgb=function(t){var e,i,r,t=t.match(a.reRGBa);if(t)return e=parseInt(t[1],10)/(/%$/.test(t[1])?100:1)*(/%$/.test(t[1])?255:1),i=parseInt(t[2],10)/(/%$/.test(t[2])?100:1)*(/%$/.test(t[2])?255:1),r=parseInt(t[3],10)/(/%$/.test(t[3])?100:1)*(/%$/.test(t[3])?255:1),[parseInt(e,10),parseInt(i,10),parseInt(r,10),t[4]?parseFloat(t[4]):1]},h.Color.fromRgba=a.fromRgb,h.Color.fromHsl=function(t){return a.fromSource(a.sourceFromHsl(t))},h.Color.sourceFromHsl=function(t){var e,i,r,n,s,o,t=t.match(a.reHSLa);if(t)return e=(parseFloat(t[1])%360+360)%360/360,r=parseFloat(t[2])/(/%$/.test(t[2])?100:1),i=parseFloat(t[3])/(/%$/.test(t[3])?100:1),0==r?n=s=o=i:(n=c(r=2*i-(i=i<=.5?i*(1+r):i+r-i*r),i,e+1/3),s=c(r,i,e),o=c(r,i,e-1/3)),[Math.round(255*n),Math.round(255*s),Math.round(255*o),t[4]?parseFloat(t[4]):1]},h.Color.fromHsla=a.fromHsl,h.Color.fromHex=function(t){return a.fromSource(a.sourceFromHex(t))},h.Color.sourceFromHex=function(t){var e,i,r,n,s;if(t.match(a.reHex))return e=3===(t=t.slice(t.indexOf("#")+1)).length||4===t.length,s=8===t.length||4===t.length,i=e?t.charAt(0)+t.charAt(0):t.substring(0,2),r=e?t.charAt(1)+t.charAt(1):t.substring(2,4),n=e?t.charAt(2)+t.charAt(2):t.substring(4,6),s=s?e?t.charAt(3)+t.charAt(3):t.substring(6,8):"FF",[parseInt(i,16),parseInt(r,16),parseInt(n,16),parseFloat((parseInt(s,16)/255).toFixed(2))]},h.Color.fromSource=function(t){var e=new a;return e.setSource(t),e})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var a=t.fabric||(t.fabric={}),n=["e","se","s","sw","w","nw","n","ne","e"],s=["ns","nesw","ew","nwse"],o={},c="left",h="top",l="right",u="bottom",f="center",d={top:u,bottom:h,left:l,right:c,center:f},g=a.util.radiansToDegrees,p=Math.sign||function(t){return(0<t)-(t<0)||+t};function m(t,e){t=t.angle+g(Math.atan2(e.y,e.x))+360;return Math.round(t%360/45)}function v(t,e){var i=e.transform.target,r=i.canvas,n=a.util.object.clone(e);n.target=i,r&&r.fire("object:"+t,n),i.fire(t,e)}function b(t,e){e=e.canvas,t=t[e.uniScaleKey];return e.uniformScaling&&!t||!e.uniformScaling&&t}function y(t){return t.originX===f&&t.originY===f}function _(t,e,i){var r=t.lockScalingX,t=t.lockScalingY;return!(!r||!t)||(!(e||!r&&!t||!i)||(!(!r||"x"!==e)||!(!t||"y"!==e)))}function x(t,e,i,r){return{e:t,transform:e,pointer:{x:i,y:r}}}function C(o){return function(t,e,i,r){var n=e.target,s=n.getCenterPoint(),s=n.translateToOriginPoint(s,e.originX,e.originY),t=o(t,e,i,r);return n.setPositionByOrigin(s,e.originX,e.originY),t}}function S(s,o){return function(t,e,i,r){var n=o(t,e,i,r);return n&&v(s,x(t,e,i,r)),n}}function T(t,e,i,r,n){var s=t.target,t=s.controls[t.corner],o=s.canvas.getZoom(),o=s.padding/o,s=s.toLocalPoint(new a.Point(r,n),e,i);return s.x>=o&&(s.x-=o),s.x<=-o&&(s.x+=o),s.y>=o&&(s.y-=o),s.y<=o&&(s.y+=o),s.x-=t.offsetX,s.y-=t.offsetY,s}function w(t){return t.flipX!==t.flipY}function O(t,e,i,r,n){0!==t[e]&&(e=n/t._getTransformedDimensions()[r]*t[i],t.set(i,e))}function P(t,e,i,r){var n,s=e.target,o=s._getTransformedDimensions(0,s.skewY),i=T(e,e.originX,e.originY,i,r),r=Math.abs(2*i.x)-o.x,i=s.skewX,r=(r<2?n=0:(n=g(Math.atan2(r/s.scaleX,o.y/s.scaleY)),e.originX===c&&e.originY===u&&(n=-n),e.originX===l&&e.originY===h&&(n=-n),w(s)&&(n=-n)),i!==n);return r&&(o=s._getTransformedDimensions().y,s.set("skewX",n),O(s,"skewY","scaleY","y",o)),r}function k(t,e,i,r){var n,s=e.target,o=s._getTransformedDimensions(s.skewX,0),i=T(e,e.originX,e.originY,i,r),r=Math.abs(2*i.y)-o.y,i=s.skewY,r=(r<2?n=0:(n=g(Math.atan2(r/s.scaleY,o.x/s.scaleX)),e.originX===c&&e.originY===u&&(n=-n),e.originX===l&&e.originY===h&&(n=-n),w(s)&&(n=-n)),i!==n);return r&&(o=s._getTransformedDimensions().x,s.set("skewY",n),O(s,"skewX","scaleX","x",o)),r}function E(t,e,i,r,n){var s=e.target,o=s.lockScalingX,a=s.lockScalingY,n=(n=n||{}).by,t=b(t,s),c=_(s,n,t),h=e.gestureScale;if(c)return!1;if(h)l=e.scaleX*h,u=e.scaleY*h;else{if(c=T(e,e.originX,e.originY,i,r),h="y"!==n?p(c.x):1,i="x"!==n?p(c.y):1,e.signX||(e.signX=h),e.signY||(e.signY=i),s.lockScalingFlip&&(e.signX!==h||e.signY!==i))return!1;var l,u,r=s._getTransformedDimensions();u=t&&!n?(t=Math.abs(c.x)+Math.abs(c.y),f=e.original,t=t/(Math.abs(r.x*f.scaleX/s.scaleX)+Math.abs(r.y*f.scaleY/s.scaleY)),l=f.scaleX*t,f.scaleY*t):(l=Math.abs(c.x*s.scaleX/r.x),Math.abs(c.y*s.scaleY/r.y)),y(e)&&(l*=2,u*=2),e.signX!==h&&"y"!==n&&(e.originX=d[e.originX],l*=-1,e.signX=h),e.signY!==i&&"x"!==n&&(e.originY=d[e.originY],u*=-1,e.signY=i)}var f=s.scaleX,t=s.scaleY;return n?("x"===n&&s.set("scaleX",l),"y"===n&&s.set("scaleY",u)):(o||s.set("scaleX",l),a||s.set("scaleY",u)),f!==s.scaleX||t!==s.scaleY}o.scaleCursorStyleHandler=function(t,e,i){var t=b(t,i),r="";return 0!==e.x&&0===e.y?r="x":0===e.x&&0!==e.y&&(r="y"),_(i,r,t)?"not-allowed":(r=m(i,e),n[r]+"-resize")},o.skewCursorStyleHandler=function(t,e,i){var r="not-allowed";return 0!==e.x&&i.lockSkewingY||0!==e.y&&i.lockSkewingX?r:(r=m(i,e)%4,s[r]+"-resize")},o.scaleSkewCursorStyleHandler=function(t,e,i){return t[i.canvas.altActionKey]?o.skewCursorStyleHandler(t,e,i):o.scaleCursorStyleHandler(t,e,i)},o.rotationWithSnapping=S("rotating",C(function(t,e,i,r){var n=e.target,s=n.translateToOriginPoint(n.getCenterPoint(),e.originX,e.originY);if(n.lockRotation)return!1;var o=Math.atan2(e.ey-s.y,e.ex-s.x),r=Math.atan2(r-s.y,i-s.x),i=g(r-o+e.theta);return 0<n.snapAngle&&(s=n.snapAngle,r=n.snapThreshold||s,o=Math.ceil(i/s)*s,e=Math.floor(i/s)*s,Math.abs(i-e)<r?i=e:Math.abs(i-o)<r&&(i=o)),i<0&&(i=360+i),s=n.angle!==(i%=360),n.angle=i,s})),o.scalingEqually=S("scaling",C(function(t,e,i,r){return E(t,e,i,r)})),o.scalingX=S("scaling",C(function(t,e,i,r){return E(t,e,i,r,{by:"x"})})),o.scalingY=S("scaling",C(function(t,e,i,r){return E(t,e,i,r,{by:"y"})})),o.scalingYOrSkewingX=function(t,e,i,r){return t[e.target.canvas.altActionKey]?o.skewHandlerX(t,e,i,r):o.scalingY(t,e,i,r)},o.scalingXOrSkewingY=function(t,e,i,r){return t[e.target.canvas.altActionKey]?o.skewHandlerY(t,e,i,r):o.scalingX(t,e,i,r)},o.changeWidth=S("resizing",C(function(t,e,i,r){var n=e.target,i=T(e,e.originX,e.originY,i,r),r=n.strokeWidth/(n.strokeUniform?n.scaleX:1),e=y(e)?2:1,s=n.width,i=Math.abs(i.x*e/n.scaleX)-r;return n.set("width",Math.max(i,0)),s!==i})),o.skewHandlerX=function(t,e,i,r){var n,s=e.target,o=s.skewX,a=e.originY;return!s.lockSkewingX&&(0===o?n=0<T(e,f,f,i,r).x?c:l:(0<o&&(n=a===h?c:l),o<0&&(n=a===h?l:c),w(s)&&(n=n===c?l:c)),e.originX=n,S("skewing",C(P))(t,e,i,r))},o.skewHandlerY=function(t,e,i,r){var n,s=e.target,o=s.skewY,a=e.originX;return!s.lockSkewingY&&(0===o?n=0<T(e,f,f,i,r).y?h:u:(0<o&&(n=a===c?h:u),o<0&&(n=a===c?u:h),w(s)&&(n=n===h?u:h)),e.originY=n,S("skewing",C(k))(t,e,i,r))},o.dragHandler=function(t,e,i,r){var n=e.target,s=i-e.offsetX,o=r-e.offsetY,a=!n.get("lockMovementX")&&n.left!==s,c=!n.get("lockMovementY")&&n.top!==o;return a&&n.set("left",s),c&&n.set("top",o),(a||c)&&v("moving",x(t,e,i,r)),a||c},o.scaleOrSkewActionName=function(t,e,i){return t=t[i.canvas.altActionKey],0===e.x?t?"skewX":"scaleY":0===e.y?t?"skewY":"scaleX":void 0},o.rotationStyleHandler=function(t,e,i){return i.lockRotation?"not-allowed":e.cursorStyle},o.fireEvent=v,o.wrapWithFixedAnchor=C,o.wrapWithFireEvent=S,o.getLocalPoint=T,a.controlsUtils=o}("undefined"!=typeof exports?exports:this),function(t){"use strict";var t=t.fabric||(t.fabric={}),u=t.util.degreesToRadians,t=t.controlsUtils;t.renderCircleControl=function(t,e,i,r,n){r=r||{};var s,o=this.sizeX||r.cornerSize||n.cornerSize,a=this.sizeY||r.cornerSize||n.cornerSize,c=(h=(void 0!==r.transparentCorners?r:n).transparentCorners)?"stroke":"fill",h=!h&&(r.cornerStrokeColor||n.cornerStrokeColor),l=e,u=i;t.save(),t.fillStyle=r.cornerColor||n.cornerColor,t.strokeStyle=r.cornerStrokeColor||n.cornerStrokeColor,a<o?(t.scale(1,a/(s=o)),u=i*o/a):o<a?(t.scale(o/(s=a),1),l=e*a/o):s=o,t.lineWidth=1,t.beginPath(),t.arc(l,u,s/2,0,2*Math.PI,!1),t[c](),h&&t.stroke(),t.restore()},t.renderSquareControl=function(t,e,i,r,n){r=r||{};var s=this.sizeX||r.cornerSize||n.cornerSize,o=this.sizeY||r.cornerSize||n.cornerSize,a=(c=(void 0!==r.transparentCorners?r:n).transparentCorners)?"stroke":"fill",c=!c&&(r.cornerStrokeColor||n.cornerStrokeColor),h=s/2,l=o/2;t.save(),t.fillStyle=r.cornerColor||n.cornerColor,t.strokeStyle=r.cornerStrokeColor||n.cornerStrokeColor,t.lineWidth=1,t.translate(e,i),t.rotate(u(n.angle)),t[a+"Rect"](-h,-l,s,o),c&&t.strokeRect(-h,-l,s,o),t.restore()}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var f=t.fabric||(t.fabric={});f.Control=function(t){for(var e in t)this[e]=t[e]},f.Control.prototype={visible:!0,actionName:"scale",angle:0,x:0,y:0,offsetX:0,offsetY:0,sizeX:null,sizeY:null,touchSizeX:null,touchSizeY:null,cursorStyle:"crosshair",withConnection:!1,actionHandler:function(){},mouseDownHandler:function(){},mouseUpHandler:function(){},getActionHandler:function(){return this.actionHandler},getMouseDownHandler:function(){return this.mouseDownHandler},getMouseUpHandler:function(){return this.mouseUpHandler},cursorStyleHandler:function(t,e){return e.cursorStyle},getActionName:function(t,e){return e.actionName},getVisibility:function(t,e){t=t._controlsVisibility;return t&&void 0!==t[e]?t[e]:this.visible},setVisibility:function(t){this.visible=t},positionHandler:function(t,e){return f.util.transformPoint({x:this.x*t.x+this.offsetX,y:this.y*t.y+this.offsetY},e)},calcCornerCoords:function(t,e,i,r,n){var s,o,a,c,h,l,u=n?this.touchSizeX:this.sizeX,n=n?this.touchSizeY:this.sizeY;return u&&n&&u!==n?(c=Math.atan2(n,u),h=Math.sqrt(u*u+n*n)/2,l=c-f.util.degreesToRadians(t),c=Math.PI/2-c-f.util.degreesToRadians(t),s=h*f.util.cos(l),o=h*f.util.sin(l),a=h*f.util.cos(c),c=h*f.util.sin(c)):(h=.7071067812*(u&&n?u:e),l=f.util.degreesToRadians(45-t),s=a=h*f.util.cos(l),o=c=h*f.util.sin(l)),{tl:{x:i-c,y:r-a},tr:{x:i+s,y:r-o},bl:{x:i-s,y:r+o},br:{x:i+c,y:r+a}}},render:function(t,e,i,r,n){("circle"===((r=r||{}).cornerStyle||n.cornerStyle)?f.controlsUtils.renderCircleControl:f.controlsUtils.renderSquareControl).call(this,t,e,i,r,n)}}}("undefined"!=typeof exports?exports:this),function(){var p=fabric.util.object.clone;fabric.Gradient=fabric.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:"pixels",type:"linear",initialize:function(e){(e=e||{}).coords||(e.coords={});var t,i=this;Object.keys(e).forEach(function(t){i[t]=e[t]}),this.id?this.id+="_"+fabric.Object.__uid++:this.id=fabric.Object.__uid++,t={x1:e.coords.x1||0,y1:e.coords.y1||0,x2:e.coords.x2||0,y2:e.coords.y2||0},"radial"===this.type&&(t.r1=e.coords.r1||0,t.r2=e.coords.r2||0),this.coords=t,this.colorStops=e.colorStops.slice()},addColorStop:function(t){for(var e in t){var i=new fabric.Color(t[e]);this.colorStops.push({offset:parseFloat(e),color:i.toRgb(),opacity:i.getAlpha()})}return this},toObject:function(t){var e={type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform&&this.gradientTransform.concat()};return fabric.util.populateWithProperties(this,e,t),e},toSVG:function(t,e){var i,r=p(this.coords,!0),e=e||{},n=p(this.colorStops,!0),s=r.r1>r.r2,o=(this.gradientTransform||fabric.iMatrix).concat(),a=-this.offsetX,c=-this.offsetY,h=!!e.additionalTransform,l="pixels"===this.gradientUnits?"userSpaceOnUse":"objectBoundingBox";if(n.sort(function(t,e){return t.offset-e.offset}),"objectBoundingBox"==l?(a/=t.width,c/=t.height):(a+=t.width/2,c+=t.height/2),"path"===t.type&&"percentage"!==this.gradientUnits&&(a-=t.pathOffset.x,c-=t.pathOffset.y),o[4]-=a,o[5]-=c,t='id="SVGID_'+this.id+'" gradientUnits="'+l+'"',t+=' gradientTransform="'+(h?e.additionalTransform+" ":"")+fabric.util.matrixToSVG(o)+'" ',"linear"===this.type?i=["<linearGradient ",t,' x1="',r.x1,'" y1="',r.y1,'" x2="',r.x2,'" y2="',r.y2,'">\n']:"radial"===this.type&&(i=["<radialGradient ",t,' cx="',s?r.x1:r.x2,'" cy="',s?r.y1:r.y2,'" r="',s?r.r1:r.r2,'" fx="',s?r.x2:r.x1,'" fy="',s?r.y2:r.y1,'">\n']),"radial"===this.type){if(s)for((n=n.concat()).reverse(),f=0,d=n.length;f<d;f++)n[f].offset=1-n[f].offset;a=Math.min(r.r1,r.r2);if(0<a)for(var u=a/Math.max(r.r1,r.r2),f=0,d=n.length;f<d;f++)n[f].offset+=u*(1-n[f].offset)}for(f=0,d=n.length;f<d;f++){var g=n[f];i.push("<stop ",'offset="',100*g.offset+"%",'" style="stop-color:',g.color,void 0!==g.opacity?";stop-opacity: "+g.opacity:";",'"/>\n')}return i.push("linear"===this.type?"</linearGradient>\n":"</radialGradient>\n"),i.join("")},toLive:function(t){var e,i,r,n=fabric.util.object.clone(this.coords);if(this.type){for("linear"===this.type?e=t.createLinearGradient(n.x1,n.y1,n.x2,n.y2):"radial"===this.type&&(e=t.createRadialGradient(n.x1,n.y1,n.r1,n.x2,n.y2,n.r2)),i=0,r=this.colorStops.length;i<r;i++){var s=this.colorStops[i].color,o=this.colorStops[i].opacity,a=this.colorStops[i].offset;void 0!==o&&(s=new fabric.Color(s).setAlpha(o).toRgba()),e.addColorStop(a,s)}return e}}}),fabric.util.object.extend(fabric.Gradient,{fromElement:function(t,e,i,r){for(var n,s,o,a,c,h,l,u=(u=parseFloat(i)/(/%$/.test(i)?100:1))<0?0:1<u?1:u,f=(isNaN(u)&&(u=1),t.getElementsByTagName("stop")),i="userSpaceOnUse"===t.getAttribute("gradientUnits")?"pixels":"percentage",d=t.getAttribute("gradientTransform")||"",g=[],p=0,m=0,v="linearGradient"===t.nodeName||"LINEARGRADIENT"===t.nodeName?(n="linear",{x1:(s=t).getAttribute("x1")||0,y1:s.getAttribute("y1")||0,x2:s.getAttribute("x2")||"100%",y2:s.getAttribute("y2")||0}):(n="radial",{x1:(s=t).getAttribute("fx")||s.getAttribute("cx")||"50%",y1:s.getAttribute("fy")||s.getAttribute("cy")||"50%",r1:0,x2:s.getAttribute("cx")||"50%",y2:s.getAttribute("cy")||"50%",r2:s.getAttribute("r")||"50%"}),b=f.length;b--;)g.push(function(t,e){var i,r,n,s=t.getAttribute("style"),o=t.getAttribute("offset")||0;if(o=(o=parseFloat(o)/(/%$/.test(o)?100:1))<0?0:1<o?1:o,s){var a=s.split(/\s*;\s*/);for(""===a[a.length-1]&&a.pop(),n=a.length;n--;){var c=a[n].split(/\s*:\s*/),h=c[0].trim(),c=c[1].trim();"stop-color"===h?i=c:"stop-opacity"===h&&(r=c)}}return i=i||t.getAttribute("stop-color")||"rgb(0,0,0)",r=r||t.getAttribute("stop-opacity"),s=(i=new fabric.Color(i)).getAlpha(),r=isNaN(parseFloat(r))?1:parseFloat(r),r*=s*e,{offset:o,color:i.toRgb(),opacity:r}}(f[b],u));return d=fabric.parseTransformAttribute(d),o=v,a=r,c=i,Object.keys(o).forEach(function(t){"Infinity"===(h=o[t])?l=1:"-Infinity"===h?l=0:(l=parseFloat(o[t],10),"string"==typeof h&&/^(\d+\.\d+)%|(\d+)%$/.test(h)&&(l*=.01,"pixels"===c&&("x1"!==t&&"x2"!==t&&"r2"!==t||(l*=a.viewBoxWidth||a.width),"y1"!==t&&"y2"!==t||(l*=a.viewBoxHeight||a.height)))),o[t]=l}),"pixels"==i&&(p=-e.left,m=-e.top),new fabric.Gradient({id:t.getAttribute("id"),type:n,coords:v,colorStops:g,gradientUnits:i,gradientTransform:d,offsetX:p,offsetY:m})}})}(),function(){"use strict";var r=fabric.util.toFixed;fabric.Pattern=fabric.util.createClass({repeat:"repeat",offsetX:0,offsetY:0,crossOrigin:"",patternTransform:null,initialize:function(t,i){var r;t=t||{},this.id=fabric.Object.__uid++,this.setOptions(t),!t.source||t.source&&"string"!=typeof t.source?i&&i(this):((r=this).source=fabric.util.createImage(),fabric.util.loadImage(t.source,function(t,e){r.source=t,i&&i(r,e)},null,this.crossOrigin))},toObject:function(t){var e,i=fabric.Object.NUM_FRACTION_DIGITS;return"string"==typeof this.source.src?e=this.source.src:"object"==typeof this.source&&this.source.toDataURL&&(e=this.source.toDataURL()),e={type:"pattern",source:e,repeat:this.repeat,crossOrigin:this.crossOrigin,offsetX:r(this.offsetX,i),offsetY:r(this.offsetY,i),patternTransform:this.patternTransform?this.patternTransform.concat():null},fabric.util.populateWithProperties(this,e,t),e},toSVG:function(t){var e="function"==typeof this.source?this.source():this.source,i=e.width/t.width,r=e.height/t.height,n=this.offsetX/t.width,t=this.offsetY/t.height,s="";return"repeat-x"!==this.repeat&&"no-repeat"!==this.repeat||(r=1,t&&(r+=Math.abs(t))),"repeat-y"!==this.repeat&&"no-repeat"!==this.repeat||(i=1,n&&(i+=Math.abs(n))),e.src?s=e.src:e.toDataURL&&(s=e.toDataURL()),'<pattern id="SVGID_'+this.id+'" x="'+n+'" y="'+t+'" width="'+i+'" height="'+r+'">\n<image x="0" y="0" width="'+e.width+'" height="'+e.height+'" xlink:href="'+s+'"></image>\n</pattern>\n'},setOptions:function(t){for(var e in t)this[e]=t[e]},toLive:function(t){var e=this.source;if(!e)return"";if(void 0!==e.src){if(!e.complete)return"";if(0===e.naturalWidth||0===e.naturalHeight)return""}return t.createPattern(e,this.repeat)}})}(),function(t){"use strict";var o=t.fabric||(t.fabric={}),a=o.util.toFixed;o.Shadow?o.warn("fabric.Shadow is already defined."):(o.Shadow=o.util.createClass({color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,nonScaling:!1,initialize:function(t){for(var e in t="string"==typeof t?this._parseShadow(t):t)this[e]=t[e];this.id=o.Object.__uid++},_parseShadow:function(t){var t=t.trim(),e=o.Shadow.reOffsetsAndBlur.exec(t)||[];return{color:(t.replace(o.Shadow.reOffsetsAndBlur,"")||"rgb(0,0,0)").trim(),offsetX:parseFloat(e[1],10)||0,offsetY:parseFloat(e[2],10)||0,blur:parseFloat(e[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")},toSVG:function(t){var e=40,i=40,r=o.Object.NUM_FRACTION_DIGITS,n=o.util.rotateVector({x:this.offsetX,y:this.offsetY},o.util.degreesToRadians(-t.angle)),s=new o.Color(this.color);return t.width&&t.height&&(e=100*a((Math.abs(n.x)+this.blur)/t.width,r)+20,i=100*a((Math.abs(n.y)+this.blur)/t.height,r)+20),t.flipX&&(n.x*=-1),t.flipY&&(n.y*=-1),'<filter id="SVGID_'+this.id+'" y="-'+i+'%" height="'+(100+2*i)+'%" x="-'+e+'%" width="'+(100+2*e)+'%" >\n\t<feGaussianBlur in="SourceAlpha" stdDeviation="'+a(this.blur?this.blur/2:0,r)+'"></feGaussianBlur>\n\t<feOffset dx="'+a(n.x,r)+'" dy="'+a(n.y,r)+'" result="oBlur" ></feOffset>\n\t<feFlood flood-color="'+s.toRgb()+'" flood-opacity="'+s.getAlpha()+'"/>\n\t<feComposite in2="oBlur" operator="in" />\n\t<feMerge>\n\t\t<feMergeNode></feMergeNode>\n\t\t<feMergeNode in="SourceGraphic"></feMergeNode>\n\t</feMerge>\n</filter>\n'},toObject:function(){if(this.includeDefaultValues)return{color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY,affectStroke:this.affectStroke,nonScaling:this.nonScaling};var e={},i=o.Shadow.prototype;return["color","blur","offsetX","offsetY","affectStroke","nonScaling"].forEach(function(t){this[t]!==i[t]&&(e[t]=this[t])},this),e}}),o.Shadow.reOffsetsAndBlur=/(?:\s|^)(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(\d+(?:\.\d*)?(?:px)?)?(?:\s?|$)(?:$|\s)/)}("undefined"!=typeof exports?exports:this),function(){"use strict";var n,t,h,a,s,o,i,r,e;fabric.StaticCanvas?fabric.warn("fabric.StaticCanvas is already defined."):(n=fabric.util.object.extend,t=fabric.util.getElementOffset,h=fabric.util.removeFromArray,a=fabric.util.toFixed,s=fabric.util.transformPoint,o=fabric.util.invertTransform,i=fabric.util.getNodeCanvas,r=fabric.util.createCanvasElement,e=new Error("Could not initialize `canvas` element"),fabric.StaticCanvas=fabric.util.createClass(fabric.CommonMethods,{initialize:function(t,e){e=e||{},this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(t,e)},backgroundColor:"",backgroundImage:null,overlayColor:"",overlayImage:null,includeDefaultValues:!0,stateful:!1,renderOnAddRemove:!0,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:fabric.iMatrix.concat(),backgroundVpt:!0,overlayVpt:!0,enableRetinaScaling:!0,vptCoords:{},skipOffscreen:!0,clipPath:void 0,_initStatic:function(t,e){var i=this.requestRenderAllBound;this._objects=[],this._createLowerCanvas(t),this._initOptions(e),this.interactive||this._initRetinaScaling(),e.overlayImage&&this.setOverlayImage(e.overlayImage,i),e.backgroundImage&&this.setBackgroundImage(e.backgroundImage,i),e.backgroundColor&&this.setBackgroundColor(e.backgroundColor,i),e.overlayColor&&this.setOverlayColor(e.overlayColor,i),this.calcOffset()},_isRetinaScaling:function(){return 1<fabric.devicePixelRatio&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?Math.max(1,fabric.devicePixelRatio):1},_initRetinaScaling:function(){var t;this._isRetinaScaling()&&(t=fabric.devicePixelRatio,this.__initRetinaScaling(t,this.lowerCanvasEl,this.contextContainer),this.upperCanvasEl&&this.__initRetinaScaling(t,this.upperCanvasEl,this.contextTop))},__initRetinaScaling:function(t,e,i){e.setAttribute("width",this.width*t),e.setAttribute("height",this.height*t),i.scale(t,t)},calcOffset:function(){return this._offset=t(this.lowerCanvasEl),this},setOverlayImage:function(t,e,i){return this.__setBgOverlayImage("overlayImage",t,e,i)},setBackgroundImage:function(t,e,i){return this.__setBgOverlayImage("backgroundImage",t,e,i)},setOverlayColor:function(t,e){return this.__setBgOverlayColor("overlayColor",t,e)},setBackgroundColor:function(t,e){return this.__setBgOverlayColor("backgroundColor",t,e)},__setBgOverlayImage:function(r,t,n,s){return"string"==typeof t?fabric.util.loadImage(t,function(t,e){var i;t&&(i=new fabric.Image(t,s),(this[r]=i).canvas=this),n&&n(t,e)},this,s&&s.crossOrigin):(s&&t.setOptions(s),(this[r]=t)&&(t.canvas=this),n&&n(t,!1)),this},__setBgOverlayColor:function(t,e,i){return this[t]=e,this._initGradient(e,t),this._initPattern(e,t,i),this},_createCanvasElement:function(){var t=r();if(!t)throw e;if(t.style||(t.style={}),void 0===t.getContext)throw e;return t},_initOptions:function(t){var e=this.lowerCanvasEl;this._setOptions(t),this.width=this.width||parseInt(e.width,10)||0,this.height=this.height||parseInt(e.height,10)||0,this.lowerCanvasEl.style&&(e.width=this.width,e.height=this.height,e.style.width=this.width+"px",e.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(t){t&&t.getContext?this.lowerCanvasEl=t:this.lowerCanvasEl=fabric.util.getById(t)||this._createCanvasElement(),fabric.util.addClass(this.lowerCanvasEl,"lower-canvas"),this._originalCanvasStyle=this.lowerCanvasEl.style,this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl),this.contextContainer=this.lowerCanvasEl.getContext("2d")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(t,e){return this.setDimensions({width:t},e)},setHeight:function(t,e){return this.setDimensions({height:t},e)},setDimensions:function(t,e){var i,r;for(r in e=e||{},t)i=t[r],e.cssOnly||(this._setBackstoreDimension(r,t[r]),i+="px",this.hasLostContext=!0),e.backstoreOnly||this._setCssDimension(r,i);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(this.contextTop),this._initRetinaScaling(),this.calcOffset(),e.cssOnly||this.requestRenderAll(),this},_setBackstoreDimension:function(t,e){return this.lowerCanvasEl[t]=e,this.upperCanvasEl&&(this.upperCanvasEl[t]=e),this.cacheCanvasEl&&(this.cacheCanvasEl[t]=e),this[t]=e,this},_setCssDimension:function(t,e){return this.lowerCanvasEl.style[t]=e,this.upperCanvasEl&&(this.upperCanvasEl.style[t]=e),this.wrapperEl&&(this.wrapperEl.style[t]=e),this},getZoom:function(){return this.viewportTransform[0]},setViewportTransform:function(t){var e,i,r,n=this._activeObject,s=this.backgroundImage,o=this.overlayImage;for(this.viewportTransform=t,i=0,r=this._objects.length;i<r;i++)(e=this._objects[i]).group||e.setCoords(!0);return n&&n.setCoords(),s&&s.setCoords(!0),o&&o.setCoords(!0),this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll(),this},zoomToPoint:function(t,e){var i=t,r=this.viewportTransform.slice(0),e=(t=s(t,o(this.viewportTransform)),r[0]=e,r[3]=e,s(t,r));return r[4]+=i.x-e.x,r[5]+=i.y-e.y,this.setViewportTransform(r)},setZoom:function(t){return this.zoomToPoint(new fabric.Point(0,0),t),this},absolutePan:function(t){var e=this.viewportTransform.slice(0);return e[4]=-t.x,e[5]=-t.y,this.setViewportTransform(e)},relativePan:function(t){return this.absolutePan(new fabric.Point(-t.x-this.viewportTransform[4],-t.y-this.viewportTransform[5]))},getElement:function(){return this.lowerCanvasEl},_onObjectAdded:function(t){this.stateful&&t.setupState(),t._set("canvas",this),t.setCoords(),this.fire("object:added",{target:t}),t.fire("added")},_onObjectRemoved:function(t){this.fire("object:removed",{target:t}),t.fire("removed"),delete t.canvas},clearContext:function(t){return t.clearRect(0,0,this.width,this.height),this},getContext:function(){return this.contextContainer},clear:function(){return this.remove.apply(this,this.getObjects()),this.backgroundImage=null,this.overlayImage=null,this.backgroundColor="",this.overlayColor="",this._hasITextHandlers&&(this.off("mouse:up",this._mouseUpITextHandler),this._iTextInstances=null,this._hasITextHandlers=!1),this.clearContext(this.contextContainer),this.fire("canvas:cleared"),this.renderOnAddRemove&&this.requestRenderAll(),this},renderAll:function(){var t=this.contextContainer;return this.renderCanvas(t,this._objects),this},renderAndReset:function(){this.isRendering=0,this.renderAll()},requestRenderAll:function(){return this.isRendering||(this.isRendering=fabric.util.requestAnimFrame(this.renderAndResetBound)),this},calcViewportBoundaries:function(){var t={},e=this.width,i=this.height,r=o(this.viewportTransform);return t.tl=s({x:0,y:0},r),t.br=s({x:e,y:i},r),t.tr=new fabric.Point(t.br.x,t.tl.y),t.bl=new fabric.Point(t.tl.x,t.br.y),this.vptCoords=t},cancelRequestedRender:function(){this.isRendering&&(fabric.util.cancelAnimFrame(this.isRendering),this.isRendering=0)},renderCanvas:function(t,e){var i=this.viewportTransform,r=this.clipPath;this.cancelRequestedRender(),this.calcViewportBoundaries(),this.clearContext(t),fabric.util.setImageSmoothing(t,this.imageSmoothingEnabled),this.fire("before:render",{ctx:t}),this._renderBackground(t),t.save(),t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),this._renderObjects(t,e),t.restore(),!this.controlsAboveOverlay&&this.interactive&&this.drawControls(t),r&&(r.canvas=this,r.shouldCache(),r._transformDone=!0,r.renderCache({forClipping:!0}),this.drawClipPathOnCanvas(t)),this._renderOverlay(t),this.controlsAboveOverlay&&this.interactive&&this.drawControls(t),this.fire("after:render",{ctx:t})},drawClipPathOnCanvas:function(t){var e=this.viewportTransform,i=this.clipPath;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t.globalCompositeOperation="destination-in",i.transform(t),t.scale(1/i.zoomX,1/i.zoomY),t.drawImage(i._cacheCanvas,-i.cacheTranslationX,-i.cacheTranslationY),t.restore()},_renderObjects:function(t,e){for(var i=0,r=e.length;i<r;++i)e[i]&&e[i].render(t)},_renderBackgroundOrOverlay:function(t,e){var i=this[e+"Color"],r=this[e+"Image"],n=this.viewportTransform,e=this[e+"Vpt"];(i||r)&&(i&&(t.save(),t.beginPath(),t.moveTo(0,0),t.lineTo(this.width,0),t.lineTo(this.width,this.height),t.lineTo(0,this.height),t.closePath(),t.fillStyle=i.toLive?i.toLive(t,this):i,e&&t.transform(n[0],n[1],n[2],n[3],n[4],n[5]),t.transform(1,0,0,1,i.offsetX||0,i.offsetY||0),(i=i.gradientTransform||i.patternTransform)&&t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),t.fill(),t.restore()),r&&(t.save(),e&&t.transform(n[0],n[1],n[2],n[3],n[4],n[5]),r.render(t),t.restore()))},_renderBackground:function(t){this._renderBackgroundOrOverlay(t,"background")},_renderOverlay:function(t){this._renderBackgroundOrOverlay(t,"overlay")},getCenter:function(){return{top:this.height/2,left:this.width/2}},getCenterPoint:function(){return new fabric.Point(this.width/2,this.height/2)},centerObjectH:function(t){return this._centerObject(t,new fabric.Point(this.getCenterPoint().x,t.getCenterPoint().y))},centerObjectV:function(t){return this._centerObject(t,new fabric.Point(t.getCenterPoint().x,this.getCenterPoint().y))},centerObject:function(t){var e=this.getCenterPoint();return this._centerObject(t,e)},viewportCenterObject:function(t){var e=this.getVpCenter();return this._centerObject(t,e)},viewportCenterObjectH:function(t){var e=this.getVpCenter();return this._centerObject(t,new fabric.Point(e.x,t.getCenterPoint().y)),this},viewportCenterObjectV:function(t){var e=this.getVpCenter();return this._centerObject(t,new fabric.Point(t.getCenterPoint().x,e.y))},getVpCenter:function(){var t=this.getCenterPoint(),e=o(this.viewportTransform);return s(t,e)},_centerObject:function(t,e){return t.setPositionByOrigin(e,"center","center"),t.setCoords(),this.renderOnAddRemove&&this.requestRenderAll(),this},toDatalessJSON:function(t){return this.toDatalessObject(t)},toObject:function(t){return this._toObjectMethod("toObject",t)},toDatalessObject:function(t){return this._toObjectMethod("toDatalessObject",t)},_toObjectMethod:function(t,e){var i=this.clipPath,r={version:fabric.version,objects:this._toObjects(t,e)};return i&&!i.excludeFromExport&&(r.clipPath=this._toObject(this.clipPath,t,e)),n(r,this.__serializeBgOverlay(t,e)),fabric.util.populateWithProperties(this,r,e),r},_toObjects:function(e,i){return this._objects.filter(function(t){return!t.excludeFromExport}).map(function(t){return this._toObject(t,e,i)},this)},_toObject:function(t,e,i){this.includeDefaultValues||(r=t.includeDefaultValues,t.includeDefaultValues=!1);var r,e=t[e](i);return this.includeDefaultValues||(t.includeDefaultValues=r),e},__serializeBgOverlay:function(t,e){var i={},r=this.backgroundImage,n=this.overlayImage,s=this.backgroundColor,o=this.overlayColor;return s&&s.toObject?s.excludeFromExport||(i.background=s.toObject(e)):s&&(i.background=s),o&&o.toObject?o.excludeFromExport||(i.overlay=o.toObject(e)):o&&(i.overlay=o),r&&!r.excludeFromExport&&(i.backgroundImage=this._toObject(r,t,e)),n&&!n.excludeFromExport&&(i.overlayImage=this._toObject(n,t,e)),i},svgViewportTransformation:!0,toSVG:function(t,e){(t=t||{}).reviver=e;var i=[];return this._setSVGPreamble(i,t),this._setSVGHeader(i,t),this.clipPath&&i.push('<g clip-path="url(#'+this.clipPath.clipPathId+')" >\n'),this._setSVGBgOverlayColor(i,"background"),this._setSVGBgOverlayImage(i,"backgroundImage",e),this._setSVGObjects(i,e),this.clipPath&&i.push("</g>\n"),this._setSVGBgOverlayColor(i,"overlay"),this._setSVGBgOverlayImage(i,"overlayImage",e),i.push("</svg>"),i.join("")},_setSVGPreamble:function(t,e){e.suppressPreamble||t.push('<?xml version="1.0" encoding="',e.encoding||"UTF-8",'" standalone="no" ?>\n','<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ','"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')},_setSVGHeader:function(t,e){var i,r=e.width||this.width,n=e.height||this.height,s='viewBox="0 0 '+this.width+" "+this.height+'" ',o=fabric.Object.NUM_FRACTION_DIGITS;e.viewBox?s='viewBox="'+e.viewBox.x+" "+e.viewBox.y+" "+e.viewBox.width+" "+e.viewBox.height+'" ':this.svgViewportTransformation&&(i=this.viewportTransform,s='viewBox="'+a(-i[4]/i[0],o)+" "+a(-i[5]/i[3],o)+" "+a(this.width/i[0],o)+" "+a(this.height/i[3],o)+'" '),t.push("<svg ",'xmlns="http://www.w3.org/2000/svg" ','xmlns:xlink="http://www.w3.org/1999/xlink" ','version="1.1" ','width="',r,'" ','height="',n,'" ',s,'xml:space="preserve">\n',"<desc>Created with Fabric.js ",fabric.version,"</desc>\n","<defs>\n",this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),this.createSVGClipPathMarkup(e),"</defs>\n")},createSVGClipPathMarkup:function(t){var e=this.clipPath;return e?(e.clipPathId="CLIPPATH_"+fabric.Object.__uid++,'<clipPath id="'+e.clipPathId+'" >\n'+this.clipPath.toClipPathSVG(t.reviver)+"</clipPath>\n"):""},createSVGRefElementsMarkup:function(){var n=this;return["background","overlay"].map(function(t){var e,i,r=n[t+"Color"];if(r&&r.toLive)return t=n[t+"Vpt"],e=n.viewportTransform,i={width:n.width/(t?e[0]:1),height:n.height/(t?e[3]:1)},r.toSVG(i,{additionalTransform:t?fabric.util.matrixToSVG(e):""})}).join("")},createSVGFontFacesMarkup:function(){var t,e,i,r,n,s,o,a,c,h="",l={},u=fabric.fontPaths,f=[];for(this._objects.forEach(function t(e){f.push(e),e._objects&&e._objects.forEach(t)}),o=0,a=f.length;o<a;o++)if(e=(t=f[o]).fontFamily,-1!==t.type.indexOf("text")&&!l[e]&&u[e]&&(l[e]=!0,t.styles))for(n in i=t.styles)for(s in r=i[n])!l[e=r[s].fontFamily]&&u[e]&&(l[e]=!0);for(c in l)h+=["\t\t@font-face {\n","\t\t\tfont-family: '",c,"';\n","\t\t\tsrc: url('",u[c],"');\n","\t\t}\n"].join("");return h=h&&['\t<style type="text/css">',"<![CDATA[\n",h,"]]>","</style>\n"].join("")},_setSVGObjects:function(t,e){for(var i,r=this._objects,n=0,s=r.length;n<s;n++)(i=r[n]).excludeFromExport||this._setSVGObject(t,i,e)},_setSVGObject:function(t,e,i){t.push(e.toSVG(i))},_setSVGBgOverlayImage:function(t,e,i){this[e]&&!this[e].excludeFromExport&&this[e].toSVG&&t.push(this[e].toSVG(i))},_setSVGBgOverlayColor:function(t,e){var i,r=this[e+"Color"],n=this.viewportTransform,s=this.width,o=this.height;r&&(r.toLive?(i=r.repeat,n=fabric.util.invertTransform(n),e=this[e+"Vpt"]?fabric.util.matrixToSVG(n):"",t.push('<rect transform="'+e+" translate(",s/2,",",o/2,')"',' x="',r.offsetX-s/2,'" y="',r.offsetY-o/2,'" ','width="',"repeat-y"===i||"no-repeat"===i?r.source.width:s,'" height="',"repeat-x"===i||"no-repeat"===i?r.source.height:o,'" fill="url(#SVGID_'+r.id+')"',"></rect>\n")):t.push('<rect x="0" y="0" width="100%" height="100%" ','fill="',r,'"',"></rect>\n"))},sendToBack:function(t){if(!t)return this;var e,i,r,n=this._activeObject;if(t===n&&"activeSelection"===t.type)for(e=(r=n._objects).length;e--;)i=r[e],h(this._objects,i),this._objects.unshift(i);else h(this._objects,t),this._objects.unshift(t);return this.renderOnAddRemove&&this.requestRenderAll(),this},bringToFront:function(t){if(!t)return this;var e,i,r,n=this._activeObject;if(t===n&&"activeSelection"===t.type)for(r=n._objects,e=0;e<r.length;e++)i=r[e],h(this._objects,i),this._objects.push(i);else h(this._objects,t),this._objects.push(t);return this.renderOnAddRemove&&this.requestRenderAll(),this},sendBackwards:function(t,e){if(!t)return this;var i,r,n,s,o,a=this._activeObject,c=0;if(t===a&&"activeSelection"===t.type)for(o=a._objects,i=0;i<o.length;i++)r=o[i],0+c<(n=this._objects.indexOf(r))&&(s=n-1,h(this._objects,r),this._objects.splice(s,0,r)),c++;else 0!==(n=this._objects.indexOf(t))&&(s=this._findNewLowerIndex(t,n,e),h(this._objects,t),this._objects.splice(s,0,t));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewLowerIndex:function(t,e,i){var r,n;if(i){for(n=(r=e)-1;0<=n;--n)if(t.intersectsWithObject(this._objects[n])||t.isContainedWithinObject(this._objects[n])||this._objects[n].isContainedWithinObject(t)){r=n;break}}else r=e-1;return r},bringForward:function(t,e){if(!t)return this;var i,r,n,s,o,a=this._activeObject,c=0;if(t===a&&"activeSelection"===t.type)for(i=(o=a._objects).length;i--;)r=o[i],(n=this._objects.indexOf(r))<this._objects.length-1-c&&(s=n+1,h(this._objects,r),this._objects.splice(s,0,r)),c++;else(n=this._objects.indexOf(t))!==this._objects.length-1&&(s=this._findNewUpperIndex(t,n,e),h(this._objects,t),this._objects.splice(s,0,t));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewUpperIndex:function(t,e,i){var r,n,s;if(i){for(n=(r=e)+1,s=this._objects.length;n<s;++n)if(t.intersectsWithObject(this._objects[n])||t.isContainedWithinObject(this._objects[n])||this._objects[n].isContainedWithinObject(t)){r=n;break}}else r=e+1;return r},moveTo:function(t,e){return h(this._objects,t),this._objects.splice(e,0,t),this.renderOnAddRemove&&this.requestRenderAll()},dispose:function(){return this.isRendering&&(fabric.util.cancelAnimFrame(this.isRendering),this.isRendering=0),this.forEachObject(function(t){t.dispose&&t.dispose()}),this._objects=[],this.backgroundImage&&this.backgroundImage.dispose&&this.backgroundImage.dispose(),this.backgroundImage=null,this.overlayImage&&this.overlayImage.dispose&&this.overlayImage.dispose(),this.overlayImage=null,this._iTextInstances=null,this.contextContainer=null,this.lowerCanvasEl.classList.remove("lower-canvas"),fabric.util.setStyle(this.lowerCanvasEl,this._originalCanvasStyle),delete this._originalCanvasStyle,this.lowerCanvasEl.setAttribute("width",this.width),this.lowerCanvasEl.setAttribute("height",this.height),fabric.util.cleanUpJsdomNode(this.lowerCanvasEl),this.lowerCanvasEl=void 0,this},toString:function(){return"#<fabric.Canvas ("+this.complexity()+"): { objects: "+this._objects.length+" }>"}}),n(fabric.StaticCanvas.prototype,fabric.Observable),n(fabric.StaticCanvas.prototype,fabric.Collection),n(fabric.StaticCanvas.prototype,fabric.DataURLExporter),n(fabric.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',supports:function(t){var e=r();if(!e||!e.getContext)return null;e=e.getContext("2d");return!e||"setLineDash"!==t?null:void 0!==e.setLineDash}}),fabric.StaticCanvas.prototype.toJSON=fabric.StaticCanvas.prototype.toObject,fabric.isLikelyNode&&(fabric.StaticCanvas.prototype.createPNGStream=function(){var t=i(this.lowerCanvasEl);return t&&t.createPNGStream()},fabric.StaticCanvas.prototype.createJPEGStream=function(t){var e=i(this.lowerCanvasEl);return e&&e.createJPEGStream(t)}))}(),fabric.BaseBrush=fabric.util.createClass({color:"rgb(0, 0, 0)",width:1,shadow:null,strokeLineCap:"round",strokeLineJoin:"round",strokeMiterLimit:10,strokeDashArray:null,limitedToCanvasSize:!1,_setBrushStyles:function(t){t.strokeStyle=this.color,t.lineWidth=this.width,t.lineCap=this.strokeLineCap,t.miterLimit=this.strokeMiterLimit,t.lineJoin=this.strokeLineJoin,t.setLineDash(this.strokeDashArray||[])},_saveAndTransform:function(t){var e=this.canvas.viewportTransform;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5])},_setShadow:function(){var t,e,i,r;this.shadow&&(t=this.canvas,e=this.shadow,i=t.contextTop,r=t.getZoom(),t&&t._isRetinaScaling()&&(r*=fabric.devicePixelRatio),i.shadowColor=e.color,i.shadowBlur=e.blur*r,i.shadowOffsetX=e.offsetX*r,i.shadowOffsetY=e.offsetY*r)},needsFullRender:function(){return new fabric.Color(this.color).getAlpha()<1||!!this.shadow},_resetShadow:function(){var t=this.canvas.contextTop;t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0},_isOutSideCanvas:function(t){return t.x<0||t.x>this.canvas.getWidth()||t.y<0||t.y>this.canvas.getHeight()}}),fabric.PencilBrush=fabric.util.createClass(fabric.BaseBrush,{decimate:.4,drawStraightLine:!1,straightLineKey:"shiftKey",initialize:function(t){this.canvas=t,this._points=[]},needsFullRender:function(){return this.callSuper("needsFullRender")||this._hasStraightLine},_drawSegment:function(t,e,i){i=e.midPointFrom(i);return t.quadraticCurveTo(e.x,e.y,i.x,i.y),i},onMouseDown:function(t,e){this.canvas._isMainEvent(e.e)&&(this.drawStraightLine=e.e[this.straightLineKey],this._prepareForDrawing(t),this._captureDrawingPath(t),this._render())},onMouseMove:function(t,e){var i;this.canvas._isMainEvent(e.e)&&(this.drawStraightLine=e.e[this.straightLineKey],!0===this.limitedToCanvasSize&&this._isOutSideCanvas(t)||this._captureDrawingPath(t)&&1<this._points.length&&(this.needsFullRender()?(this.canvas.clearContext(this.canvas.contextTop),this._render()):(t=(e=this._points).length,i=this.canvas.contextTop,this._saveAndTransform(i),this.oldEnd&&(i.beginPath(),i.moveTo(this.oldEnd.x,this.oldEnd.y)),this.oldEnd=this._drawSegment(i,e[t-2],e[t-1],!0),i.stroke(),i.restore())))},onMouseUp:function(t){return!this.canvas._isMainEvent(t.e)||(this.drawStraightLine=!1,this.oldEnd=void 0,this._finalizeAndAddPath(),!1)},_prepareForDrawing:function(t){t=new fabric.Point(t.x,t.y);this._reset(),this._addPoint(t),this.canvas.contextTop.moveTo(t.x,t.y)},_addPoint:function(t){return!(1<this._points.length&&t.eq(this._points[this._points.length-1]))&&(this.drawStraightLine&&1<this._points.length&&(this._hasStraightLine=!0,this._points.pop()),this._points.push(t),!0)},_reset:function(){this._points=[],this._setBrushStyles(this.canvas.contextTop),this._setShadow(),this._hasStraightLine=!1},_captureDrawingPath:function(t){t=new fabric.Point(t.x,t.y);return this._addPoint(t)},_render:function(t){var e,i,r,n=this._points[0],s=this._points[1];for(t=t||this.canvas.contextTop,this._saveAndTransform(t),t.beginPath(),2===this._points.length&&n.x===s.x&&n.y===s.y&&(r=this.width/1e3,n=new fabric.Point(n.x,n.y),s=new fabric.Point(s.x,s.y),n.x-=r,s.x+=r),t.moveTo(n.x,n.y),e=1,i=this._points.length;e<i;e++)this._drawSegment(t,n,s),n=this._points[e],s=this._points[e+1];t.lineTo(n.x,n.y),t.stroke(),t.restore()},convertPointsToSVGPath:function(t){var e=this.width/1e3;return fabric.util.getSmoothPathFromPoints(t,e)},_isEmptySVGPath:function(t){return"M 0 0 Q 0 0 0 0 L 0 0"===fabric.util.joinPath(t)},createPath:function(t){t=new fabric.Path(t,{fill:null,stroke:this.color,strokeWidth:this.width,strokeLineCap:this.strokeLineCap,strokeMiterLimit:this.strokeMiterLimit,strokeLineJoin:this.strokeLineJoin,strokeDashArray:this.strokeDashArray});return this.shadow&&(this.shadow.affectStroke=!0,t.shadow=new fabric.Shadow(this.shadow)),t},decimatePoints:function(t,e){if(t.length<=2)return t;for(var i=this.canvas.getZoom(),r=Math.pow(e/i,2),n=t.length-1,s=t[0],o=[s],a=1;a<n-1;a++)r<=Math.pow(s.x-t[a].x,2)+Math.pow(s.y-t[a].y,2)&&(s=t[a],o.push(s));return o.push(t[n]),o},_finalizeAndAddPath:function(){this.canvas.contextTop.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate));var t=this.convertPointsToSVGPath(this._points);this._isEmptySVGPath(t)?this.canvas.requestRenderAll():(t=this.createPath(t),this.canvas.clearContext(this.canvas.contextTop),this.canvas.fire("before:path:created",{path:t}),this.canvas.add(t),this.canvas.requestRenderAll(),t.setCoords(),this._resetShadow(),this.canvas.fire("path:created",{path:t}))}}),fabric.CircleBrush=fabric.util.createClass(fabric.BaseBrush,{width:10,initialize:function(t){this.canvas=t,this.points=[]},drawDot:function(t){var t=this.addPoint(t),e=this.canvas.contextTop;this._saveAndTransform(e),this.dot(e,t),e.restore()},dot:function(t,e){t.fillStyle=e.fill,t.beginPath(),t.arc(e.x,e.y,e.radius,0,2*Math.PI,!1),t.closePath(),t.fill()},onMouseDown:function(t){this.points.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.drawDot(t)},_render:function(){var t,e,i=this.canvas.contextTop,r=this.points;for(this._saveAndTransform(i),t=0,e=r.length;t<e;t++)this.dot(i,r[t]);i.restore()},onMouseMove:function(t){!0===this.limitedToCanvasSize&&this._isOutSideCanvas(t)||(this.needsFullRender()?(this.canvas.clearContext(this.canvas.contextTop),this.addPoint(t),this._render()):this.drawDot(t))},onMouseUp:function(){for(var t=this.canvas.renderOnAddRemove,e=(this.canvas.renderOnAddRemove=!1,[]),i=0,r=this.points.length;i<r;i++){var n=this.points[i],n=new fabric.Circle({radius:n.radius,left:n.x,top:n.y,originX:"center",originY:"center",fill:n.fill});this.shadow&&(n.shadow=new fabric.Shadow(this.shadow)),e.push(n)}var s=new fabric.Group(e);s.canvas=this.canvas,this.canvas.fire("before:path:created",{path:s}),this.canvas.add(s),this.canvas.fire("path:created",{path:s}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=t,this.canvas.requestRenderAll()},addPoint:function(t){var t=new fabric.Point(t.x,t.y),e=fabric.util.getRandomInt(Math.max(0,this.width-20),this.width+20)/2,i=new fabric.Color(this.color).setAlpha(fabric.util.getRandomInt(0,100)/100).toRgba();return t.radius=e,t.fill=i,this.points.push(t),t}}),fabric.SprayBrush=fabric.util.createClass(fabric.BaseBrush,{width:10,density:20,dotWidth:1,dotWidthVariance:1,randomOpacity:!1,optimizeOverlapping:!0,initialize:function(t){this.canvas=t,this.sprayChunks=[]},onMouseDown:function(t){this.sprayChunks.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.addSprayChunk(t),this.render(this.sprayChunkPoints)},onMouseMove:function(t){!0===this.limitedToCanvasSize&&this._isOutSideCanvas(t)||(this.addSprayChunk(t),this.render(this.sprayChunkPoints))},onMouseUp:function(){for(var t=this.canvas.renderOnAddRemove,e=(this.canvas.renderOnAddRemove=!1,[]),i=0,r=this.sprayChunks.length;i<r;i++)for(var n=this.sprayChunks[i],s=0,o=n.length;s<o;s++){var a=new fabric.Rect({width:n[s].width,height:n[s].width,left:n[s].x+1,top:n[s].y+1,originX:"center",originY:"center",fill:this.color});e.push(a)}this.optimizeOverlapping&&(e=this._getOptimizedRects(e));var c=new fabric.Group(e);this.shadow&&c.set("shadow",new fabric.Shadow(this.shadow)),this.canvas.fire("before:path:created",{path:c}),this.canvas.add(c),this.canvas.fire("path:created",{path:c}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=t,this.canvas.requestRenderAll()},_getOptimizedRects:function(t){for(var e,i={},r=0,n=t.length;r<n;r++)i[e=t[r].left+""+t[r].top]||(i[e]=t[r]);var s=[];for(e in i)s.push(i[e]);return s},render:function(t){var e,i,r=this.canvas.contextTop;for(r.fillStyle=this.color,this._saveAndTransform(r),e=0,i=t.length;e<i;e++){var n=t[e];void 0!==n.opacity&&(r.globalAlpha=n.opacity),r.fillRect(n.x,n.y,n.width,n.width)}r.restore()},_render:function(){var t,e,i=this.canvas.contextTop;for(i.fillStyle=this.color,this._saveAndTransform(i),t=0,e=this.sprayChunks.length;t<e;t++)this.render(this.sprayChunks[t]);i.restore()},addSprayChunk:function(t){this.sprayChunkPoints=[];for(var e=this.width/2,i=0;i<this.density;i++){var r=fabric.util.getRandomInt(t.x-e,t.x+e),n=fabric.util.getRandomInt(t.y-e,t.y+e),s=this.dotWidthVariance?fabric.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):this.dotWidth,r=new fabric.Point(r,n);r.width=s,this.randomOpacity&&(r.opacity=fabric.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(r)}this.sprayChunks.push(this.sprayChunkPoints)}}),fabric.PatternBrush=fabric.util.createClass(fabric.PencilBrush,{getPatternSrc:function(){var t=fabric.util.createCanvasElement(),e=t.getContext("2d");return t.width=t.height=25,e.fillStyle=this.color,e.beginPath(),e.arc(10,10,10,0,2*Math.PI,!1),e.closePath(),e.fill(),t},getPatternSrcFunction:function(){return String(this.getPatternSrc).replace("this.color",'"'+this.color+'"')},getPattern:function(t){return t.createPattern(this.source||this.getPatternSrc(),"repeat")},_setBrushStyles:function(t){this.callSuper("_setBrushStyles",t),t.strokeStyle=this.getPattern(t)},createPath:function(t){var t=this.callSuper("createPath",t),e=t._getLeftTopCoords().scalarAdd(t.strokeWidth/2);return t.stroke=new fabric.Pattern({source:this.source||this.getPatternSrcFunction(),offsetX:-e.x,offsetY:-e.y}),t}}),function(){var t,o=fabric.util.getPointer,c=fabric.util.degreesToRadians,h=fabric.util.isTouchEvent;for(t in fabric.Canvas=fabric.util.createClass(fabric.StaticCanvas,{initialize:function(t,e){e=e||{},this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(t,e),this._initInteractive(),this._createCacheCanvas()},uniformScaling:!0,uniScaleKey:"shiftKey",centeredScaling:!1,centeredRotation:!1,centeredKey:"altKey",altActionKey:"shiftKey",interactive:!0,selection:!0,selectionKey:"shiftKey",altSelectionKey:null,selectionColor:"rgba(100, 100, 255, 0.3)",selectionDashArray:[],selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,selectionFullyContained:!1,hoverCursor:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",notAllowedCursor:"not-allowed",containerClass:"canvas-container",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,isDrawingMode:!1,preserveObjectStacking:!1,snapAngle:0,snapThreshold:null,stopContextMenu:!1,fireRightClick:!1,fireMiddleClick:!1,targets:[],enablePointerEvents:!1,_hoveredTarget:null,_hoveredTargets:[],_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this._initWrapperElement(),this._createUpperCanvas(),this._initEventListeners(),this._initRetinaScaling(),this.freeDrawingBrush=fabric.PencilBrush&&new fabric.PencilBrush(this),this.calcOffset()},_chooseObjectsToRender:function(){var t,e=this.getActiveObjects();if(0<e.length&&!this.preserveObjectStacking){for(var i=[],r=[],n=0,s=this._objects.length;n<s;n++)t=this._objects[n],(-1===e.indexOf(t)?i:r).push(t);1<e.length&&(this._activeObject._objects=r),i.push.apply(i,r)}else i=this._objects;return i},renderAll:function(){!this.contextTopDirty||this._groupSelector||this.isDrawingMode||(this.clearContext(this.contextTop),this.contextTopDirty=!1),this.hasLostContext&&(this.renderTopLayer(this.contextTop),this.hasLostContext=!1);var t=this.contextContainer;return this.renderCanvas(t,this._chooseObjectsToRender()),this},renderTopLayer:function(t){t.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(t),this.contextTopDirty=!0),t.restore()},renderTop:function(){var t=this.contextTop;return this.clearContext(t),this.renderTopLayer(t),this.fire("after:render"),this},_normalizePointer:function(t,e){t=t.calcTransformMatrix(),t=fabric.util.invertTransform(t),e=this.restorePointerVpt(e);return fabric.util.transformPoint(e,t)},isTargetTransparent:function(t,e,i){if(t.shouldCache()&&t._cacheCanvas&&t!==this._activeObject)return n=this._normalizePointer(t,{x:e,y:i}),r=Math.max(t.cacheTranslationX+n.x*t.zoomX,0),n=Math.max(t.cacheTranslationY+n.y*t.zoomY,0),fabric.util.isTransparent(t._cacheContext,Math.round(r),Math.round(n),this.targetFindTolerance);var r=this.contextCache,n=t.selectionBackgroundColor,s=this.viewportTransform;return t.selectionBackgroundColor="",this.clearContext(r),r.save(),r.transform(s[0],s[1],s[2],s[3],s[4],s[5]),t.render(r),r.restore(),t.selectionBackgroundColor=n,fabric.util.isTransparent(r,e,i,this.targetFindTolerance)},_isSelectionKeyPressed:function(e){return Array.isArray(this.selectionKey)?!!this.selectionKey.find(function(t){return!0===e[t]}):e[this.selectionKey]},_shouldClearSelection:function(t,e){var i=this.getActiveObjects(),r=this._activeObject;return!e||r&&1<i.length&&-1===i.indexOf(e)&&r!==e&&!this._isSelectionKeyPressed(t)||e&&!e.evented||e&&!e.selectable&&r&&r!==e},_shouldCenterTransform:function(t,e,i){var r;if(t)return"scale"===e||"scaleX"===e||"scaleY"===e||"resizing"===e?r=this.centeredScaling||t.centeredScaling:"rotate"===e&&(r=this.centeredRotation||t.centeredRotation),r?!i:i},_getOriginFromCorner:function(t,e){t={x:t.originX,y:t.originY};return"ml"===e||"tl"===e||"bl"===e?t.x="right":"mr"!==e&&"tr"!==e&&"br"!==e||(t.x="left"),"tl"===e||"mt"===e||"tr"===e?t.y="bottom":"bl"!==e&&"mb"!==e&&"br"!==e||(t.y="top"),t},_getActionFromCorner:function(t,e,i,r){if(!e||!t)return"drag";t=r.controls[e];return t.getActionName(i,t,r)},_setupCurrentTransform:function(t,e,i){var r,n,s,o,a;e&&(r=this.getPointer(t),n=e.__corner,a=e.controls[n],a=i&&n?a.getActionHandler(t,e,a):fabric.controlsUtils.dragHandler,i=this._getActionFromCorner(i,n,t,e),s=this._getOriginFromCorner(e,n),o=t[this.centeredKey],a={target:e,action:i,actionHandler:a,corner:n,scaleX:e.scaleX,scaleY:e.scaleY,skewX:e.skewX,skewY:e.skewY,offsetX:r.x-e.left,offsetY:r.y-e.top,originX:s.x,originY:s.y,ex:r.x,ey:r.y,lastX:r.x,lastY:r.y,theta:c(e.angle),width:e.width*e.scaleX,shiftKey:t.shiftKey,altKey:o,original:fabric.util.saveObjectTransform(e)},this._shouldCenterTransform(e,i,o)&&(a.originX="center",a.originY="center"),a.original.originX=s.x,a.original.originY=s.y,this._currentTransform=a,this._beforeTransform(t))},setCursor:function(t){this.upperCanvasEl.style.cursor=t},_drawSelection:function(t){var e=this._groupSelector,i=new fabric.Point(e.ex,e.ey),i=fabric.util.transformPoint(i,this.viewportTransform),e=new fabric.Point(e.ex+e.left,e.ey+e.top),e=fabric.util.transformPoint(e,this.viewportTransform),r=Math.min(i.x,e.x),n=Math.min(i.y,e.y),s=Math.max(i.x,e.x),i=Math.max(i.y,e.y),e=this.selectionLineWidth/2;this.selectionColor&&(t.fillStyle=this.selectionColor,t.fillRect(r,n,s-r,i-n)),this.selectionLineWidth&&this.selectionBorderColor&&(t.lineWidth=this.selectionLineWidth,t.strokeStyle=this.selectionBorderColor,r+=e,n+=e,s-=e,i-=e,fabric.Object.prototype._setLineDash.call(this,t,this.selectionDashArray),t.strokeRect(r,n,s-r,i-n))},findTarget:function(t,e){if(!this.skipTargetFind){var i,r,n=this.getPointer(t,!0),s=this._activeObject,o=this.getActiveObjects(),a=h(t),c=1<o.length&&!e||1===o.length;if(this.targets=[],c&&s._findTargetCorner(n,a))return s;if(1<o.length&&!e&&s===this._searchPossibleTargets([s],n))return s;if(1===o.length&&s===this._searchPossibleTargets([s],n)){if(!this.preserveObjectStacking)return s;i=s,r=this.targets,this.targets=[]}c=this._searchPossibleTargets(this._objects,n);return t[this.altSelectionKey]&&c&&i&&c!==i&&(c=i,this.targets=r),c}},_checkTarget:function(t,e,i){if(e&&e.visible&&e.evented&&e.containsPoint(t))return!((this.perPixelTargetFind||e.perPixelTargetFind)&&!e.isEditing)||(!this.isTargetTransparent(e,i.x,i.y)||void 0)},_searchPossibleTargets:function(t,e){for(var i,r=t.length;r--;){var n=t[r],s=n.group?this._normalizePointer(n.group,e):e;if(this._checkTarget(s,n,e)){(i=t[r]).subTargetCheck&&i instanceof fabric.Group&&(s=this._searchPossibleTargets(i._objects,e))&&this.targets.push(s);break}}return i},restorePointerVpt:function(t){return fabric.util.transformPoint(t,fabric.util.invertTransform(this.viewportTransform))},getPointer:function(t,e){if(this._absolutePointer&&!e)return this._absolutePointer;if(this._pointer&&e)return this._pointer;var t=o(t),i=this.upperCanvasEl,r=i.getBoundingClientRect(),n=r.width||0,s=r.height||0,r=(n&&s||("top"in r&&"bottom"in r&&(s=Math.abs(r.top-r.bottom)),"right"in r&&"left"in r&&(n=Math.abs(r.right-r.left))),this.calcOffset(),t.x=t.x-this._offset.left,t.y=t.y-this._offset.top,e||(t=this.restorePointerVpt(t)),this.getRetinaScaling());return 1!==r&&(t.x/=r,t.y/=r),e=0===n||0===s?{width:1,height:1}:{width:i.width/n,height:i.height/s},{x:t.x*e.width,y:t.y*e.height}},_createUpperCanvas:function(){var t=this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/,""),e=this.lowerCanvasEl,i=this.upperCanvasEl;i?i.className="":(i=this._createCanvasElement(),this.upperCanvasEl=i),fabric.util.addClass(i,"upper-canvas "+t),this.wrapperEl.appendChild(i),this._copyCanvasStyle(e,i),this._applyCanvasStyle(i),this.contextTop=i.getContext("2d")},getTopContext:function(){return this.contextTop},_createCacheCanvas:function(){this.cacheCanvasEl=this._createCanvasElement(),this.cacheCanvasEl.setAttribute("width",this.width),this.cacheCanvasEl.setAttribute("height",this.height),this.contextCache=this.cacheCanvasEl.getContext("2d")},_initWrapperElement:function(){this.wrapperEl=fabric.util.wrapElement(this.lowerCanvasEl,"div",{class:this.containerClass}),fabric.util.setStyle(this.wrapperEl,{width:this.width+"px",height:this.height+"px",position:"relative"}),fabric.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(t){var e=this.width||t.width,i=this.height||t.height;fabric.util.setStyle(t,{position:"absolute",width:e+"px",height:i+"px",left:0,top:0,"touch-action":this.allowTouchScrolling?"manipulation":"none","-ms-touch-action":this.allowTouchScrolling?"manipulation":"none"}),t.width=e,t.height=i,fabric.util.makeElementUnselectable(t)},_copyCanvasStyle:function(t,e){e.style.cssText=t.style.cssText},getSelectionContext:function(){return this.contextTop},getSelectionElement:function(){return this.upperCanvasEl},getActiveObject:function(){return this._activeObject},getActiveObjects:function(){var t=this._activeObject;return t?"activeSelection"===t.type&&t._objects?t._objects.slice(0):[t]:[]},_onObjectRemoved:function(t){t===this._activeObject&&(this.fire("before:selection:cleared",{target:t}),this._discardActiveObject(),this.fire("selection:cleared",{target:t}),t.fire("deselected")),t===this._hoveredTarget&&(this._hoveredTarget=null,this._hoveredTargets=[]),this.callSuper("_onObjectRemoved",t)},_fireSelectionEvents:function(e,i){var r=!1,n=this.getActiveObjects(),s=[],o=[];e.forEach(function(t){-1===n.indexOf(t)&&(r=!0,t.fire("deselected",{e:i,target:t}),o.push(t))}),n.forEach(function(t){-1===e.indexOf(t)&&(r=!0,t.fire("selected",{e:i,target:t}),s.push(t))}),0<e.length&&0<n.length?r&&this.fire("selection:updated",{e:i,selected:s,deselected:o}):0<n.length?this.fire("selection:created",{e:i,selected:s}):0<e.length&&this.fire("selection:cleared",{e:i,deselected:o})},setActiveObject:function(t,e){var i=this.getActiveObjects();return this._setActiveObject(t,e),this._fireSelectionEvents(i,e),this},_setActiveObject:function(t,e){return this._activeObject!==t&&(!!this._discardActiveObject(e,t)&&(!t.onSelect({e:e})&&(this._activeObject=t,!0)))},_discardActiveObject:function(t,e){var i=this._activeObject;if(i){if(i.onDeselect({e:t,object:e}))return!1;this._activeObject=null}return!0},discardActiveObject:function(t){var e=this.getActiveObjects(),i=this.getActiveObject();return e.length&&this.fire("before:selection:cleared",{target:i,e:t}),this._discardActiveObject(t),this._fireSelectionEvents(e,t),this},dispose:function(){var t=this.wrapperEl;return this.removeListeners(),t.removeChild(this.upperCanvasEl),t.removeChild(this.lowerCanvasEl),this.contextCache=null,this.contextTop=null,["upperCanvasEl","cacheCanvasEl"].forEach(function(t){fabric.util.cleanUpJsdomNode(this[t]),this[t]=void 0}.bind(this)),t.parentNode&&t.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,fabric.StaticCanvas.prototype.dispose.call(this),this},clear:function(){return this.discardActiveObject(),this.clearContext(this.contextTop),this.callSuper("clear")},drawControls:function(t){var e=this._activeObject;e&&e._renderControls(t)},_toObject:function(t,e,i){var r=this._realizeGroupTransformOnObject(t),e=this.callSuper("_toObject",t,e,i);return this._unwindGroupTransformOnObject(t,r),e},_realizeGroupTransformOnObject:function(e){var i;return e.group&&"activeSelection"===e.group.type&&this._activeObject===e.group?(i={},["angle","flipX","flipY","left","scaleX","scaleY","skewX","skewY","top"].forEach(function(t){i[t]=e[t]}),fabric.util.addTransformToObject(e,this._activeObject.calcOwnMatrix()),i):null},_unwindGroupTransformOnObject:function(t,e){e&&t.set(e)},_setSVGObject:function(t,e,i){var r=this._realizeGroupTransformOnObject(e);this.callSuper("_setSVGObject",t,e,i),this._unwindGroupTransformOnObject(e,r)},setViewportTransform:function(t){this.renderOnAddRemove&&this._activeObject&&this._activeObject.isEditing&&this._activeObject.clearContextTop(),fabric.StaticCanvas.prototype.setViewportTransform.call(this,t)}}),fabric.StaticCanvas)"prototype"!==t&&(fabric.Canvas[t]=fabric.StaticCanvas[t])}(),function(){var r=fabric.util.addListener,n=fabric.util.removeListener,s={passive:!1};function h(t,e){return t.button&&t.button===e-1}fabric.util.object.extend(fabric.Canvas.prototype,{mainTouchId:null,_initEventListeners:function(){this.removeListeners(),this._bindEvents(),this.addOrRemove(r,"add")},_getEventPrefix:function(){return this.enablePointerEvents?"pointer":"mouse"},addOrRemove:function(t,e){var i=this.upperCanvasEl,r=this._getEventPrefix();t(fabric.window,"resize",this._onResize),t(i,r+"down",this._onMouseDown),t(i,r+"move",this._onMouseMove,s),t(i,r+"out",this._onMouseOut),t(i,r+"enter",this._onMouseEnter),t(i,"wheel",this._onMouseWheel),t(i,"contextmenu",this._onContextMenu),t(i,"dblclick",this._onDoubleClick),t(i,"dragover",this._onDragOver),t(i,"dragenter",this._onDragEnter),t(i,"dragleave",this._onDragLeave),t(i,"drop",this._onDrop),this.enablePointerEvents||t(i,"touchstart",this._onTouchStart,s),"undefined"!=typeof eventjs&&e in eventjs&&(eventjs[e](i,"gesture",this._onGesture),eventjs[e](i,"drag",this._onDrag),eventjs[e](i,"orientation",this._onOrientationChange),eventjs[e](i,"shake",this._onShake),eventjs[e](i,"longpress",this._onLongPress))},removeListeners:function(){this.addOrRemove(n,"remove");var t=this._getEventPrefix();n(fabric.document,t+"up",this._onMouseUp),n(fabric.document,"touchend",this._onTouchEnd,s),n(fabric.document,t+"move",this._onMouseMove,s),n(fabric.document,"touchmove",this._onMouseMove,s)},_bindEvents:function(){this.eventsBound||(this._onMouseDown=this._onMouseDown.bind(this),this._onTouchStart=this._onTouchStart.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onResize=this._onResize.bind(this),this._onGesture=this._onGesture.bind(this),this._onDrag=this._onDrag.bind(this),this._onShake=this._onShake.bind(this),this._onLongPress=this._onLongPress.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onMouseWheel=this._onMouseWheel.bind(this),this._onMouseOut=this._onMouseOut.bind(this),this._onMouseEnter=this._onMouseEnter.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onDoubleClick=this._onDoubleClick.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDragEnter=this._simpleEventHandler.bind(this,"dragenter"),this._onDragLeave=this._simpleEventHandler.bind(this,"dragleave"),this._onDrop=this._onDrop.bind(this),this.eventsBound=!0)},_onGesture:function(t,e){this.__onTransformGesture&&this.__onTransformGesture(t,e)},_onDrag:function(t,e){this.__onDrag&&this.__onDrag(t,e)},_onMouseWheel:function(t){this.__onMouseWheel(t)},_onMouseOut:function(e){var i=this._hoveredTarget,r=(this.fire("mouse:out",{target:i,e:e}),this._hoveredTarget=null,i&&i.fire("mouseout",{e:e}),this);this._hoveredTargets.forEach(function(t){r.fire("mouse:out",{target:i,e:e}),t&&i.fire("mouseout",{e:e})}),this._hoveredTargets=[]},_onMouseEnter:function(t){this._currentTransform||this.findTarget(t)||(this.fire("mouse:over",{target:null,e:t}),this._hoveredTarget=null,this._hoveredTargets=[])},_onOrientationChange:function(t,e){this.__onOrientationChange&&this.__onOrientationChange(t,e)},_onShake:function(t,e){this.__onShake&&this.__onShake(t,e)},_onLongPress:function(t,e){this.__onLongPress&&this.__onLongPress(t,e)},_onDragOver:function(t){t.preventDefault();var e=this._simpleEventHandler("dragover",t);this._fireEnterLeaveEvents(e,t)},_onDrop:function(t){return this._simpleEventHandler("drop:before",t),this._simpleEventHandler("drop",t)},_onContextMenu:function(t){return this.stopContextMenu&&(t.stopPropagation(),t.preventDefault()),!1},_onDoubleClick:function(t){this._cacheTransformEventData(t),this._handleEvent(t,"dblclick"),this._resetTransformEventData(t)},getPointerId:function(t){var e=t.changedTouches;return e?e[0]&&e[0].identifier:this.enablePointerEvents?t.pointerId:-1},_isMainEvent:function(t){return!0===t.isPrimary||!1!==t.isPrimary&&("touchend"===t.type&&0===t.touches.length||(!t.changedTouches||t.changedTouches[0].identifier===this.mainTouchId))},_onTouchStart:function(t){t.preventDefault(),null===this.mainTouchId&&(this.mainTouchId=this.getPointerId(t)),this.__onMouseDown(t),this._resetTransformEventData();var t=this.upperCanvasEl,e=this._getEventPrefix();r(fabric.document,"touchend",this._onTouchEnd,s),r(fabric.document,"touchmove",this._onMouseMove,s),n(t,e+"down",this._onMouseDown)},_onMouseDown:function(t){this.__onMouseDown(t),this._resetTransformEventData();var t=this.upperCanvasEl,e=this._getEventPrefix();n(t,e+"move",this._onMouseMove,s),r(fabric.document,e+"up",this._onMouseUp),r(fabric.document,e+"move",this._onMouseMove,s)},_onTouchEnd:function(t){var e,i;0<t.touches.length||(this.__onMouseUp(t),this._resetTransformEventData(),this.mainTouchId=null,e=this._getEventPrefix(),n(fabric.document,"touchend",this._onTouchEnd,s),n(fabric.document,"touchmove",this._onMouseMove,s),(i=this)._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout(function(){r(i.upperCanvasEl,e+"down",i._onMouseDown),i._willAddMouseDown=0},400))},_onMouseUp:function(t){this.__onMouseUp(t),this._resetTransformEventData();var e=this.upperCanvasEl,i=this._getEventPrefix();this._isMainEvent(t)&&(n(fabric.document,i+"up",this._onMouseUp),n(fabric.document,i+"move",this._onMouseMove,s),r(e,i+"move",this._onMouseMove,s))},_onMouseMove:function(t){!this.allowTouchScrolling&&t.preventDefault&&t.preventDefault(),this.__onMouseMove(t)},_onResize:function(){this.calcOffset()},_shouldRender:function(t){var e=this._activeObject;return!!(!!e!=!!t||e&&t&&e!==t)||(e&&e.isEditing,!1)},__onMouseUp:function(t){var e,i,r,n,s,o=this._currentTransform,a=this._groupSelector,c=!1,a=!a||0===a.left&&0===a.top;if(this._cacheTransformEventData(t),e=this._target,this._handleEvent(t,"up:before"),h(t,3))this.fireRightClick&&this._handleEvent(t,"up",3,a);else{if(h(t,2))return this.fireMiddleClick&&this._handleEvent(t,"up",2,a),void this._resetTransformEventData();this.isDrawingMode&&this._isCurrentlyDrawing?this._onMouseUpInDrawingMode(t):this._isMainEvent(t)&&(o&&(this._finalizeCurrentTransform(t),c=o.actionPerformed),a||(r=e===this._activeObject,this._maybeGroupObjects(t),c=c||this._shouldRender(e)||!r&&e===this._activeObject),e&&(n=e._findTargetCorner(this.getPointer(t,!0),fabric.util.isTouchEvent(t)),e.selectable&&e!==this._activeObject&&"up"===e.activeOn?(this.setActiveObject(e,t),c=!0):(r=(i=e.controls[n])&&i.getMouseUpHandler(t,e,i))&&r(t,o,(s=this.getPointer(t)).x,s.y),e.isMoving=!1),!o||o.target===e&&o.corner===n||(n=(r=o.target&&o.target.controls[o.corner])&&r.getMouseUpHandler(t,e,i),s=s||this.getPointer(t),n&&n(t,o,s.x,s.y)),this._setCursorFromEvent(t,e),this._handleEvent(t,"up",1,a),this._groupSelector=null,this._currentTransform=null,e&&(e.__corner=0),c?this.requestRenderAll():a||this.renderTop())}},_simpleEventHandler:function(t,e){var i=this.findTarget(e),r=this.targets,n={e:e,target:i,subTargets:r};if(this.fire(t,n),i&&i.fire(t,n),!r)return i;for(var s=0;s<r.length;s++)r[s].fire(t,n);return i},_handleEvent:function(t,e,i,r){var n=this._target,s=this.targets||[],o={e:t,target:n,subTargets:s,button:i||1,isClick:r||!1,pointer:this._pointer,absolutePointer:this._absolutePointer,transform:this._currentTransform};"up"===e&&(o.currentTarget=this.findTarget(t),o.currentSubTargets=this.targets),this.fire("mouse:"+e,o),n&&n.fire("mouse"+e,o);for(var a=0;a<s.length;a++)s[a].fire("mouse"+e,o)},_finalizeCurrentTransform:function(t){var e=this._currentTransform,i=e.target,t={e:t,target:i,transform:e,action:e.action};i._scaling&&(i._scaling=!1),i.setCoords(),(e.actionPerformed||this.stateful&&i.hasStateChanged())&&this._fire("modified",t)},_onMouseDownInDrawingMode:function(t){this._isCurrentlyDrawing=!0,this.getActiveObject()&&this.discardActiveObject(t).requestRenderAll();var e=this.getPointer(t);this.freeDrawingBrush.onMouseDown(e,{e:t,pointer:e}),this._handleEvent(t,"down")},_onMouseMoveInDrawingMode:function(t){var e;this._isCurrentlyDrawing&&(e=this.getPointer(t),this.freeDrawingBrush.onMouseMove(e,{e:t,pointer:e})),this.setCursor(this.freeDrawingCursor),this._handleEvent(t,"move")},_onMouseUpInDrawingMode:function(t){var e=this.getPointer(t);this._isCurrentlyDrawing=this.freeDrawingBrush.onMouseUp({e:t,pointer:e}),this._handleEvent(t,"up")},__onMouseDown:function(t){this._cacheTransformEventData(t),this._handleEvent(t,"down:before");var e,i,r,n,s,o=this._target;h(t,3)?this.fireRightClick&&this._handleEvent(t,"down",3):h(t,2)?this.fireMiddleClick&&this._handleEvent(t,"down",2):this.isDrawingMode?this._onMouseDownInDrawingMode(t):this._isMainEvent(t)&&!this._currentTransform&&(n=this._pointer,this._previousPointer=n,e=this._shouldRender(o),i=this._shouldGroup(t,o),this._shouldClearSelection(t,o)?this.discardActiveObject(t):i&&(this._handleGrouping(t,o),o=this._activeObject),!this.selection||o&&(o.selectable||o.isEditing||o===this._activeObject)||(this._groupSelector={ex:this._absolutePointer.x,ey:this._absolutePointer.y,top:0,left:0}),o&&(r=o===this._activeObject,o.selectable&&"down"===o.activeOn&&this.setActiveObject(o,t),s=o._findTargetCorner(this.getPointer(t,!0),fabric.util.isTouchEvent(t)),o.__corner=s,o!==this._activeObject||!s&&i||(this._setupCurrentTransform(t,o,r),r=o.controls[s],n=this.getPointer(t),(s=r&&r.getMouseDownHandler(t,o,r))&&s(t,this._currentTransform,n.x,n.y))),this._handleEvent(t,"down"),(e||i)&&this.requestRenderAll())},_resetTransformEventData:function(){this._target=null,this._pointer=null,this._absolutePointer=null},_cacheTransformEventData:function(t){this._resetTransformEventData(),this._pointer=this.getPointer(t,!0),this._absolutePointer=this.restorePointerVpt(this._pointer),this._target=this._currentTransform?this._currentTransform.target:this.findTarget(t)||null},_beforeTransform:function(t){var e=this._currentTransform;this.stateful&&e.target.saveState(),this.fire("before:transform",{e:t,transform:e})},__onMouseMove:function(t){var e,i;this._handleEvent(t,"move:before"),this._cacheTransformEventData(t),this.isDrawingMode?this._onMouseMoveInDrawingMode(t):this._isMainEvent(t)&&((i=this._groupSelector)?(e=this._absolutePointer,i.left=e.x-i.ex,i.top=e.y-i.ey,this.renderTop()):this._currentTransform?this._transformObject(t):(e=this.findTarget(t)||null,this._setCursorFromEvent(t,e),this._fireOverOutEvents(e,t)),this._handleEvent(t,"move"),this._resetTransformEventData())},_fireOverOutEvents:function(t,e){var i=this._hoveredTarget,r=this._hoveredTargets,n=this.targets,s=Math.max(r.length,n.length);this.fireSyntheticInOutEvents(t,e,{oldTarget:i,evtOut:"mouseout",canvasEvtOut:"mouse:out",evtIn:"mouseover",canvasEvtIn:"mouse:over"});for(var o=0;o<s;o++)this.fireSyntheticInOutEvents(n[o],e,{oldTarget:r[o],evtOut:"mouseout",evtIn:"mouseover"});this._hoveredTarget=t,this._hoveredTargets=this.targets.concat()},_fireEnterLeaveEvents:function(t,e){var i=this._draggedoverTarget,r=this._hoveredTargets,n=this.targets,s=Math.max(r.length,n.length);this.fireSyntheticInOutEvents(t,e,{oldTarget:i,evtOut:"dragleave",evtIn:"dragenter"});for(var o=0;o<s;o++)this.fireSyntheticInOutEvents(n[o],e,{oldTarget:r[o],evtOut:"dragleave",evtIn:"dragenter"});this._draggedoverTarget=t},fireSyntheticInOutEvents:function(t,e,i){var r,n,s=i.oldTarget,o=s!==t,a=i.canvasEvtIn,c=i.canvasEvtOut;o&&(r={e:e,target:t,previousTarget:s},n={e:e,target:s,nextTarget:t}),e=t&&o,s&&o&&(c&&this.fire(c,n),s.fire(i.evtOut,n)),e&&(a&&this.fire(a,r),t.fire(i.evtIn,r))},__onMouseWheel:function(t){this._cacheTransformEventData(t),this._handleEvent(t,"wheel"),this._resetTransformEventData()},_transformObject:function(t){var e=this.getPointer(t),i=this._currentTransform;i.reset=!1,i.shiftKey=t.shiftKey,i.altKey=t[this.centeredKey],this._performTransformAction(t,i,e),i.actionPerformed&&this.requestRenderAll()},_performTransformAction:function(t,e,i){var r=i.x,i=i.y,n=e.action,s=!1,o=e.actionHandler;o&&(s=o(t,e,r,i)),"drag"===n&&s&&(e.target.isMoving=!0,this.setCursor(e.target.moveCursor||this.moveCursor)),e.actionPerformed=e.actionPerformed||s},_fire:fabric.controlsUtils.fireEvent,_setCursorFromEvent:function(t,e){if(!e)return this.setCursor(this.defaultCursor),!1;var i=e.hoverCursor||this.hoverCursor,r=this._activeObject&&"activeSelection"===this._activeObject.type?this._activeObject:null,r=(!r||!r.contains(e))&&e._findTargetCorner(this.getPointer(t,!0));r?this.setCursor(this.getCornerCursor(r,e,t)):(e.subTargetCheck&&this.targets.concat().reverse().map(function(t){i=t.hoverCursor||i}),this.setCursor(i))},getCornerCursor:function(t,e,i){t=e.controls[t];return t.cursorStyleHandler(i,t,e)}})}(),function(){var f=Math.min,d=Math.max;fabric.util.object.extend(fabric.Canvas.prototype,{_shouldGroup:function(t,e){var i=this._activeObject;return i&&this._isSelectionKeyPressed(t)&&e&&e.selectable&&this.selection&&(i!==e||"activeSelection"===i.type)&&!e.onSelect({e:t})},_handleGrouping:function(t,e){var i=this._activeObject;i.__corner||(e!==i||(e=this.findTarget(t,!0))&&e.selectable)&&(i&&"activeSelection"===i.type?this._updateActiveSelection(e,t):this._createActiveSelection(e,t))},_updateActiveSelection:function(t,e){var i=this._activeObject,r=i._objects.slice(0);i.contains(t)?(i.removeWithUpdate(t),this._hoveredTarget=t,this._hoveredTargets=this.targets.concat(),1===i.size()&&this._setActiveObject(i.item(0),e)):(i.addWithUpdate(t),this._hoveredTarget=i,this._hoveredTargets=this.targets.concat()),this._fireSelectionEvents(r,e)},_createActiveSelection:function(t,e){var i=this.getActiveObjects(),t=this._createGroup(t);this._hoveredTarget=t,this._setActiveObject(t,e),this._fireSelectionEvents(i,e)},_createGroup:function(t){var e=this._objects,e=e.indexOf(this._activeObject)<e.indexOf(t)?[this._activeObject,t]:[t,this._activeObject];return this._activeObject.isEditing&&this._activeObject.exitEditing(),new fabric.ActiveSelection(e,{canvas:this})},_groupSelectedObjects:function(t){var e=this._collectObjects(t);1===e.length?this.setActiveObject(e[0],t):1<e.length&&(e=new fabric.ActiveSelection(e.reverse(),{canvas:this}),this.setActiveObject(e,t))},_collectObjects:function(e){for(var t,i=[],r=this._groupSelector.ex,n=this._groupSelector.ey,s=r+this._groupSelector.left,o=n+this._groupSelector.top,a=new fabric.Point(f(r,s),f(n,o)),c=new fabric.Point(d(r,s),d(n,o)),h=!this.selectionFullyContained,l=r===s&&n===o,u=this._objects.length;u--&&!((t=this._objects[u])&&t.selectable&&t.visible&&(h&&t.intersectsWithRect(a,c,!0)||t.isContainedWithinRect(a,c,!0)||h&&t.containsPoint(a,null,!0)||h&&t.containsPoint(c,null,!0))&&(i.push(t),l)););return i=1<i.length?i.filter(function(t){return!t.onSelect({e:e})}):i},_maybeGroupObjects:function(t){this.selection&&this._groupSelector&&this._groupSelectedObjects(t),this.setCursor(this.defaultCursor),this._groupSelector=null}})}(),fabric.util.object.extend(fabric.StaticCanvas.prototype,{toDataURL:function(t){var e=(t=t||{}).format||"png",i=t.quality||1,r=(t.multiplier||1)*(t.enableRetinaScaling?this.getRetinaScaling():1),r=this.toCanvasElement(r,t);return fabric.util.toDataURL(r,e,i)},toCanvasElement:function(t,e){var i=((e=e||{}).width||this.width)*(t=t||1),r=(e.height||this.height)*t,n=this.getZoom(),s=this.width,o=this.height,n=n*t,a=this.viewportTransform,c=(a[4]-(e.left||0))*t,e=(a[5]-(e.top||0))*t,t=this.interactive,n=[n,0,0,n,c,e],c=this.enableRetinaScaling,e=fabric.util.createCanvasElement(),h=this.contextTop;return e.width=i,e.height=r,this.contextTop=null,this.enableRetinaScaling=!1,this.interactive=!1,this.viewportTransform=n,this.width=i,this.height=r,this.calcViewportBoundaries(),this.renderCanvas(e.getContext("2d"),this._objects),this.viewportTransform=a,this.width=s,this.height=o,this.calcViewportBoundaries(),this.interactive=t,this.enableRetinaScaling=c,this.contextTop=h,e}}),fabric.util.object.extend(fabric.StaticCanvas.prototype,{loadFromJSON:function(t,i,e){var r,n,s,o;if(t)return r="string"==typeof t?JSON.parse(t):fabric.util.object.clone(t),n=this,s=r.clipPath,o=this.renderOnAddRemove,this.renderOnAddRemove=!1,delete r.clipPath,this._enlivenObjects(r.objects,function(e){n.clear(),n._setBgOverlay(r,function(){s?n._enlivenObjects([s],function(t){n.clipPath=t[0],n.__setupCanvas.call(n,r,e,o,i)}):n.__setupCanvas.call(n,r,e,o,i)})},e),this},__setupCanvas:function(t,e,i,r){var n=this;e.forEach(function(t,e){n.insertAt(t,e)}),this.renderOnAddRemove=i,delete t.objects,delete t.backgroundImage,delete t.overlayImage,delete t.background,delete t.overlay,this._setOptions(t),this.renderAll(),r&&r()},_setBgOverlay:function(t,e){var i,r={backgroundColor:!1,overlayColor:!1,backgroundImage:!1,overlayImage:!1};t.backgroundImage||t.overlayImage||t.background||t.overlay?(this.__setBgOverlay("backgroundImage",t.backgroundImage,r,i=function(){r.backgroundImage&&r.overlayImage&&r.backgroundColor&&r.overlayColor&&e&&e()}),this.__setBgOverlay("overlayImage",t.overlayImage,r,i),this.__setBgOverlay("backgroundColor",t.background,r,i),this.__setBgOverlay("overlayColor",t.overlay,r,i)):e&&e()},__setBgOverlay:function(e,t,i,r){var n=this;if(!t)return i[e]=!0,void(r&&r());"backgroundImage"===e||"overlayImage"===e?fabric.util.enlivenObjects([t],function(t){n[e]=t[0],i[e]=!0,r&&r()}):this["set"+fabric.util.string.capitalize(e,!0)](t,function(){i[e]=!0,r&&r()})},_enlivenObjects:function(t,e,i){t&&0!==t.length?fabric.util.enlivenObjects(t,function(t){e&&e(t)},null,i):e&&e([])},_toDataURL:function(e,i){this.clone(function(t){i(t.toDataURL(e))})},_toDataURLWithMultiplier:function(e,i,r){this.clone(function(t){r(t.toDataURLWithMultiplier(e,i))})},clone:function(e,t){var i=JSON.stringify(this.toJSON(t));this.cloneWithoutData(function(t){t.loadFromJSON(i,function(){e&&e(t)})})},cloneWithoutData:function(t){var e=fabric.util.createCanvasElement(),i=(e.width=this.width,e.height=this.height,new fabric.Canvas(e));this.backgroundImage?(i.setBackgroundImage(this.backgroundImage.src,function(){i.renderAll(),t&&t(i)}),i.backgroundImageOpacity=this.backgroundImageOpacity,i.backgroundImageStretch=this.backgroundImageStretch):t&&t(i)}}),function(t){"use strict";var g=t.fabric||(t.fabric={}),t=g.util.object.extend,s=g.util.object.clone,i=g.util.toFixed,e=g.util.string.capitalize,o=g.util.degreesToRadians,r=!g.isLikelyNode;g.Object||(g.Object=g.util.createClass(g.CommonMethods,{type:"object",originX:"left",originY:"top",top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,skewX:0,skewY:0,cornerSize:13,touchCornerSize:24,transparentCorners:!0,hoverCursor:null,moveCursor:null,padding:0,borderColor:"rgb(178,204,255)",borderDashArray:null,cornerColor:"rgb(178,204,255)",cornerStrokeColor:null,cornerStyle:"rect",cornerDashArray:null,centeredScaling:!1,centeredRotation:!0,fill:"rgb(0,0,0)",fillRule:"nonzero",globalCompositeOperation:"source-over",backgroundColor:"",selectionBackgroundColor:"",stroke:null,strokeWidth:1,strokeDashArray:null,strokeDashOffset:0,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:4,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,minScaleLimit:0,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,perPixelTargetFind:!1,includeDefaultValues:!0,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,excludeFromExport:!1,objectCaching:r,statefullCache:!1,noScaleCache:!0,strokeUniform:!1,dirty:!0,__corner:0,paintFirst:"fill",activeOn:"down",stateProperties:"top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform".split(" "),cacheProperties:"fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath".split(" "),colorProperties:"fill stroke backgroundColor".split(" "),clipPath:void 0,inverted:!1,absolutePositioned:!1,initialize:function(t){t&&this.setOptions(t)},_createCacheCanvas:function(){this._cacheProperties={},this._cacheCanvas=g.util.createCanvasElement(),this._cacheContext=this._cacheCanvas.getContext("2d"),this._updateCacheCanvas(),this.dirty=!0},_limitCacheSize:function(t){var e=g.perfLimitSizeTotal,i=t.width,r=t.height,n=g.maxCacheSideLimit,s=g.minCacheSideLimit;if(i<=n&&r<=n&&i*r<=e)return i<s&&(t.width=s),r<s&&(t.height=s),t;var e=g.util.limitDimsByArea(i/r,e),o=g.util.capValue,a=o(s,e.x,n),o=o(s,e.y,n);return a<i&&(t.zoomX/=i/a,t.width=a,t.capped=!0),o<r&&(t.zoomY/=r/o,t.height=o,t.capped=!0),t},_getCacheCanvasDimensions:function(){var t=this.getTotalObjectScaling(),e=this._getTransformedDimensions(0,0),i=e.x*t.scaleX/this.scaleX,e=e.y*t.scaleY/this.scaleY;return{width:2+i,height:2+e,zoomX:t.scaleX,zoomY:t.scaleY,x:i,y:e}},_updateCacheCanvas:function(){var t=this.canvas;if(this.noScaleCache&&t&&t._currentTransform){var e=t._currentTransform.target,t=t._currentTransform.action;if(this===e&&t.slice&&"scale"===t.slice(0,5))return!1}var i,r,e=this._cacheCanvas,t=this._limitCacheSize(this._getCacheCanvasDimensions()),n=g.minCacheSideLimit,s=t.width,o=t.height,a=t.zoomX,c=t.zoomY,h=s!==this.cacheWidth||o!==this.cacheHeight,l=this.zoomX!==a||this.zoomY!==c,l=h||l,u=0,f=0,d=!1;return h&&(h=this._cacheCanvas.width,i=this._cacheCanvas.height,d=(r=h<s||i<o)||(s<.9*h||o<.9*i)&&n<h&&n<i,r&&!t.capped&&(n<s||n<o)&&(u=.1*s,f=.1*o)),this instanceof g.Text&&this.path&&(d=l=!0,u+=this.getHeightOfLine(0)*this.zoomX,f+=this.getHeightOfLine(0)*this.zoomY),!!l&&(d?(e.width=Math.ceil(s+u),e.height=Math.ceil(o+f)):(this._cacheContext.setTransform(1,0,0,1,0,0),this._cacheContext.clearRect(0,0,e.width,e.height)),h=t.x/2,i=t.y/2,this.cacheTranslationX=Math.round(e.width/2-h)+h,this.cacheTranslationY=Math.round(e.height/2-i)+i,this.cacheWidth=s,this.cacheHeight=o,this._cacheContext.translate(this.cacheTranslationX,this.cacheTranslationY),this._cacheContext.scale(a,c),this.zoomX=a,this.zoomY=c,!0)},setOptions:function(t){this._setOptions(t),this._initGradient(t.fill,"fill"),this._initGradient(t.stroke,"stroke"),this._initPattern(t.fill,"fill"),this._initPattern(t.stroke,"stroke")},transform:function(t){var e=this.group&&!this.group._transformDone||this.group&&this.canvas&&t===this.canvas.contextTop,e=this.calcTransformMatrix(!e);t.transform(e[0],e[1],e[2],e[3],e[4],e[5])},toObject:function(t){var e=g.Object.NUM_FRACTION_DIGITS,e={type:this.type,version:g.version,originX:this.originX,originY:this.originY,left:i(this.left,e),top:i(this.top,e),width:i(this.width,e),height:i(this.height,e),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:i(this.strokeWidth,e),strokeDashArray:this.strokeDashArray&&this.strokeDashArray.concat(),strokeLineCap:this.strokeLineCap,strokeDashOffset:this.strokeDashOffset,strokeLineJoin:this.strokeLineJoin,strokeUniform:this.strokeUniform,strokeMiterLimit:i(this.strokeMiterLimit,e),scaleX:i(this.scaleX,e),scaleY:i(this.scaleY,e),angle:i(this.angle,e),flipX:this.flipX,flipY:this.flipY,opacity:i(this.opacity,e),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,backgroundColor:this.backgroundColor,fillRule:this.fillRule,paintFirst:this.paintFirst,globalCompositeOperation:this.globalCompositeOperation,skewX:i(this.skewX,e),skewY:i(this.skewY,e)};return this.clipPath&&!this.clipPath.excludeFromExport&&(e.clipPath=this.clipPath.toObject(t),e.clipPath.inverted=this.clipPath.inverted,e.clipPath.absolutePositioned=this.clipPath.absolutePositioned),g.util.populateWithProperties(this,e,t),e=this.includeDefaultValues?e:this._removeDefaultValues(e)},toDatalessObject:function(t){return this.toObject(t)},_removeDefaultValues:function(e){var i=g.util.getKlass(e.type).prototype;return i.stateProperties.forEach(function(t){"left"!==t&&"top"!==t&&(e[t]===i[t]&&delete e[t],Array.isArray(e[t])&&Array.isArray(i[t])&&0===e[t].length&&0===i[t].length&&delete e[t])}),e},toString:function(){return"#<fabric."+e(this.type)+">"},getObjectScaling:function(){if(!this.group)return{scaleX:this.scaleX,scaleY:this.scaleY};var t=g.util.qrDecompose(this.calcTransformMatrix());return{scaleX:Math.abs(t.scaleX),scaleY:Math.abs(t.scaleY)}},getTotalObjectScaling:function(){var t,e,i=this.getObjectScaling(),r=i.scaleX,i=i.scaleY;return this.canvas&&(r*=(t=this.canvas.getZoom())*(e=this.canvas.getRetinaScaling()),i*=t*e),{scaleX:r,scaleY:i}},getObjectOpacity:function(){var t=this.opacity;return this.group&&(t*=this.group.getObjectOpacity()),t},_set:function(t,e){var i=this[t]!==e;return("scaleX"===t||"scaleY"===t)&&(e=this._constrainScale(e)),"scaleX"===t&&e<0?(this.flipX=!this.flipX,e*=-1):"scaleY"===t&&e<0?(this.flipY=!this.flipY,e*=-1):"shadow"!==t||!e||e instanceof g.Shadow?"dirty"===t&&this.group&&this.group.set("dirty",e):e=new g.Shadow(e),this[t]=e,i&&(e=this.group&&this.group.isOnACache(),-1<this.cacheProperties.indexOf(t)?(this.dirty=!0,e&&this.group.set("dirty",!0)):e&&-1<this.stateProperties.indexOf(t)&&this.group.set("dirty",!0)),this},setOnGroup:function(){},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:g.iMatrix.concat()},isNotVisible:function(){return 0===this.opacity||!this.width&&!this.height&&0===this.strokeWidth||!this.visible},render:function(t){this.isNotVisible()||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(t.save(),this._setupCompositeOperation(t),this.drawSelectionBackground(t),this.transform(t),this._setOpacity(t),this._setShadow(t,this),this.shouldCache()?(this.renderCache(),this.drawCacheOnCanvas(t)):(this._removeCacheCanvas(),this.dirty=!1,this.drawObject(t),this.objectCaching&&this.statefullCache&&this.saveState({propertySet:"cacheProperties"})),t.restore())},renderCache:function(t){t=t||{},this._cacheCanvas&&this._cacheContext||this._createCacheCanvas(),this.isCacheDirty()&&(this.statefullCache&&this.saveState({propertySet:"cacheProperties"}),this.drawObject(this._cacheContext,t.forClipping),this.dirty=!1)},_removeCacheCanvas:function(){this._cacheCanvas=null,this._cacheContext=null,this.cacheWidth=0,this.cacheHeight=0},hasStroke:function(){return this.stroke&&"transparent"!==this.stroke&&0!==this.strokeWidth},hasFill:function(){return this.fill&&"transparent"!==this.fill},needsItsOwnCache:function(){return!("stroke"!==this.paintFirst||!this.hasFill()||!this.hasStroke()||"object"!=typeof this.shadow)||!!this.clipPath},shouldCache:function(){return this.ownCaching=this.needsItsOwnCache()||this.objectCaching&&(!this.group||!this.group.isOnACache()),this.ownCaching},willDrawShadow:function(){return!!this.shadow&&(0!==this.shadow.offsetX||0!==this.shadow.offsetY)},drawClipPathOnCache:function(t,e){var i;t.save(),e.inverted?t.globalCompositeOperation="destination-out":t.globalCompositeOperation="destination-in",e.absolutePositioned&&(i=g.util.invertTransform(this.calcTransformMatrix()),t.transform(i[0],i[1],i[2],i[3],i[4],i[5])),e.transform(t),t.scale(1/e.zoomX,1/e.zoomY),t.drawImage(e._cacheCanvas,-e.cacheTranslationX,-e.cacheTranslationY),t.restore()},drawObject:function(t,e){var i=this.fill,r=this.stroke;e?(this.fill="black",this.stroke="",this._setClippingProperties(t)):this._renderBackground(t),this._render(t),this._drawClipPath(t,this.clipPath),this.fill=i,this.stroke=r},_drawClipPath:function(t,e){e&&(e.canvas=this.canvas,e.shouldCache(),e._transformDone=!0,e.renderCache({forClipping:!0}),this.drawClipPathOnCache(t,e))},drawCacheOnCanvas:function(t){t.scale(1/this.zoomX,1/this.zoomY),t.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)},isCacheDirty:function(t){return!this.isNotVisible()&&(!(!this._cacheCanvas||!this._cacheContext||t||!this._updateCacheCanvas())||!!(this.dirty||this.clipPath&&this.clipPath.absolutePositioned||this.statefullCache&&this.hasStateChanged("cacheProperties"))&&(this._cacheCanvas&&this._cacheContext&&!t&&(t=this.cacheWidth/this.zoomX,e=this.cacheHeight/this.zoomY,this._cacheContext.clearRect(-t/2,-e/2,t,e)),!0));var e},_renderBackground:function(t){var e;this.backgroundColor&&(e=this._getNonTransformedDimensions(),t.fillStyle=this.backgroundColor,t.fillRect(-e.x/2,-e.y/2,e.x,e.y),this._removeShadow(t))},_setOpacity:function(t){this.group&&!this.group._transformDone?t.globalAlpha=this.getObjectOpacity():t.globalAlpha*=this.opacity},_setStrokeStyles:function(t,e){var i=e.stroke;i&&(t.lineWidth=e.strokeWidth,t.lineCap=e.strokeLineCap,t.lineDashOffset=e.strokeDashOffset,t.lineJoin=e.strokeLineJoin,t.miterLimit=e.strokeMiterLimit,i.toLive?"percentage"===i.gradientUnits||i.gradientTransform||i.patternTransform?this._applyPatternForTransformedGradient(t,i):(t.strokeStyle=i.toLive(t,this),this._applyPatternGradientTransform(t,i)):t.strokeStyle=e.stroke)},_setFillStyles:function(t,e){var i=e.fill;i&&(i.toLive?(t.fillStyle=i.toLive(t,this),this._applyPatternGradientTransform(t,e.fill)):t.fillStyle=i)},_setClippingProperties:function(t){t.globalAlpha=1,t.strokeStyle="transparent",t.fillStyle="#000000"},_setLineDash:function(t,e){e&&0!==e.length&&(1&e.length&&e.push.apply(e,e),t.setLineDash(e))},_renderControls:function(t,e){var i=this.getViewportTransform(),r=this.calcTransformMatrix(),n=(void 0!==(e=e||{}).hasBorders?e:this).hasBorders,s=(void 0!==e.hasControls?e:this).hasControls,r=g.util.multiplyTransformMatrices(i,r),i=g.util.qrDecompose(r);t.save(),t.translate(i.translateX,i.translateY),t.lineWidth=+this.borderScaleFactor,this.group||(t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),this.flipX&&(i.angle-=180),t.rotate(o((this.group?i:this).angle)),e.forActiveSelection||this.group?n&&this.drawBordersInGroup(t,i,e):n&&this.drawBorders(t,e),s&&this.drawControls(t,e),t.restore()},_setShadow:function(t){var e,i,r,n,s;this.shadow&&(e=this.shadow,r=(i=this.canvas)&&i.viewportTransform[0]||1,n=i&&i.viewportTransform[3]||1,s=e.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),i&&i._isRetinaScaling()&&(r*=g.devicePixelRatio,n*=g.devicePixelRatio),t.shadowColor=e.color,t.shadowBlur=e.blur*g.browserShadowBlurConstant*(r+n)*(s.scaleX+s.scaleY)/4,t.shadowOffsetX=e.offsetX*r*s.scaleX,t.shadowOffsetY=e.offsetY*n*s.scaleY)},_removeShadow:function(t){this.shadow&&(t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0)},_applyPatternGradientTransform:function(t,e){if(!e||!e.toLive)return{offsetX:0,offsetY:0};var i=e.gradientTransform||e.patternTransform,r=-this.width/2+e.offsetX||0,n=-this.height/2+e.offsetY||0;return"percentage"===e.gradientUnits?t.transform(this.width,0,0,this.height,r,n):t.transform(1,0,0,1,r,n),i&&t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),{offsetX:r,offsetY:n}},_renderPaintInOrder:function(t){"stroke"===this.paintFirst?(this._renderStroke(t),this._renderFill(t)):(this._renderFill(t),this._renderStroke(t))},_render:function(){},_renderFill:function(t){this.fill&&(t.save(),this._setFillStyles(t,this),"evenodd"===this.fillRule?t.fill("evenodd"):t.fill(),t.restore())},_renderStroke:function(t){var e;this.stroke&&0!==this.strokeWidth&&(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this.strokeUniform&&this.group?(e=this.getObjectScaling(),t.scale(1/e.scaleX,1/e.scaleY)):this.strokeUniform&&t.scale(1/this.scaleX,1/this.scaleY),this._setLineDash(t,this.strokeDashArray),this._setStrokeStyles(t,this),t.stroke(),t.restore())},_applyPatternForTransformedGradient:function(t,e){var i,r=this._limitCacheSize(this._getCacheCanvasDimensions()),n=g.util.createCanvasElement(),s=this.canvas.getRetinaScaling(),o=r.x/this.scaleX/s,a=r.y/this.scaleY/s;n.width=o,n.height=a,(i=n.getContext("2d")).beginPath(),i.moveTo(0,0),i.lineTo(o,0),i.lineTo(o,a),i.lineTo(0,a),i.closePath(),i.translate(o/2,a/2),i.scale(r.zoomX/this.scaleX/s,r.zoomY/this.scaleY/s),this._applyPatternGradientTransform(i,e),i.fillStyle=e.toLive(t),i.fill(),t.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),t.scale(s*this.scaleX/r.zoomX,s*this.scaleY/r.zoomY),t.strokeStyle=i.createPattern(n,"no-repeat")},_findCenterFromElement:function(){return{x:this.left+this.width/2,y:this.top+this.height/2}},_assignTransformMatrixProps:function(){var t;this.transformMatrix&&(t=g.util.qrDecompose(this.transformMatrix),this.flipX=!1,this.flipY=!1,this.set("scaleX",t.scaleX),this.set("scaleY",t.scaleY),this.angle=t.angle,this.skewX=t.skewX,this.skewY=0)},_removeTransformMatrix:function(t){var e=this._findCenterFromElement();this.transformMatrix&&(this._assignTransformMatrixProps(),e=g.util.transformPoint(e,this.transformMatrix)),this.transformMatrix=null,t&&(this.scaleX*=t.scaleX,this.scaleY*=t.scaleY,this.cropX=t.cropX,this.cropY=t.cropY,e.x+=t.offsetLeft,e.y+=t.offsetTop,this.width=t.width,this.height=t.height),this.setPositionByOrigin(e,"center","center")},clone:function(t,e){e=this.toObject(e);this.constructor.fromObject?this.constructor.fromObject(e,t):g.Object._fromObject("Object",e,t)},cloneAsImage:function(t,e){e=this.toCanvasElement(e);return t&&t(new g.Image(e)),this},toCanvasElement:function(t){t=t||{};var e,i=g.util,r=i.saveObjectTransform(this),n=this.group,s=this.shadow,o=Math.abs,a=(t.multiplier||1)*(t.enableRetinaScaling?g.devicePixelRatio:1),i=(delete this.group,t.withoutTransform&&i.resetObjectTransform(this),t.withoutShadow&&(this.shadow=null),g.util.createCanvasElement()),c=this.getBoundingRect(!0,!0),h=this.shadow,l={x:0,y:0},o=(h&&(e=h.blur,u=h.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),l.x=2*Math.round(o(h.offsetX)+e)*o(u.scaleX),l.y=2*Math.round(o(h.offsetY)+e)*o(u.scaleY)),h=c.width+l.x,e=c.height+l.y,i.width=Math.ceil(h),i.height=Math.ceil(e),new g.StaticCanvas(i,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1})),u=("jpeg"===t.format&&(o.backgroundColor="#fff"),this.setPositionByOrigin(new g.Point(o.width/2,o.height/2),"center","center"),this.canvas),c=(o.add(this),o.toCanvasElement(a||1,t));return this.shadow=s,this.set("canvas",u),n&&(this.group=n),this.set(r).setCoords(),o._objects=[],o.dispose(),o=null,c},toDataURL:function(t){return g.util.toDataURL(this.toCanvasElement(t=t||{}),t.format||"png",t.quality||1)},isType:function(t){return 1<arguments.length?Array.from(arguments).includes(this.type):this.type===t},complexity:function(){return 1},toJSON:function(t){return this.toObject(t)},rotate:function(t){var e=("center"!==this.originX||"center"!==this.originY)&&this.centeredRotation;return e&&this._setOriginToCenter(),this.set("angle",t),e&&this._resetOrigin(),this},centerH:function(){return this.canvas&&this.canvas.centerObjectH(this),this},viewportCenterH:function(){return this.canvas&&this.canvas.viewportCenterObjectH(this),this},centerV:function(){return this.canvas&&this.canvas.centerObjectV(this),this},viewportCenterV:function(){return this.canvas&&this.canvas.viewportCenterObjectV(this),this},center:function(){return this.canvas&&this.canvas.centerObject(this),this},viewportCenter:function(){return this.canvas&&this.canvas.viewportCenterObject(this),this},getLocalPointer:function(t,e){e=e||this.canvas.getPointer(t);t=new g.Point(e.x,e.y),e=this._getLeftTopCoords();return{x:(t=this.angle?g.util.rotatePoint(t,e,o(-this.angle)):t).x-e.x,y:t.y-e.y}},_setupCompositeOperation:function(t){this.globalCompositeOperation&&(t.globalCompositeOperation=this.globalCompositeOperation)},dispose:function(){g.runningAnimations&&g.runningAnimations.cancelByTarget(this)}}),g.util.createAccessors&&g.util.createAccessors(g.Object),t(g.Object.prototype,g.Observable),g.Object.NUM_FRACTION_DIGITS=2,g.Object.ENLIVEN_PROPS=["clipPath"],g.Object._fromObject=function(t,e,i,r){var n=g[t];e=s(e,!0),g.util.enlivenPatterns([e.fill,e.stroke],function(t){void 0!==t[0]&&(e.fill=t[0]),void 0!==t[1]&&(e.stroke=t[1]),g.util.enlivenObjectEnlivables(e,e,function(){var t=r?new n(e[r],e):new n(e);i&&i(t)})})},g.Object.__uid=0)}("undefined"!=typeof exports?exports:this),function(){var s=fabric.util.degreesToRadians,a={left:-.5,center:0,right:.5},c={top:-.5,center:0,bottom:.5};fabric.util.object.extend(fabric.Object.prototype,{translateToGivenOrigin:function(t,e,i,r,n){var s=t.x,o=t.y;return"string"==typeof e?e=a[e]:e-=.5,"string"==typeof r?r=a[r]:r-=.5,"string"==typeof i?i=c[i]:i-=.5,"string"==typeof n?n=c[n]:n-=.5,n=n-i,((i=r-e)||n)&&(r=this._getTransformedDimensions(),s=t.x+i*r.x,o=t.y+n*r.y),new fabric.Point(s,o)},translateToCenterPoint:function(t,e,i){e=this.translateToGivenOrigin(t,e,i,"center","center");return this.angle?fabric.util.rotatePoint(e,t,s(this.angle)):e},translateToOriginPoint:function(t,e,i){e=this.translateToGivenOrigin(t,"center","center",e,i);return this.angle?fabric.util.rotatePoint(e,t,s(this.angle)):e},getCenterPoint:function(){var t=new fabric.Point(this.left,this.top);return this.translateToCenterPoint(t,this.originX,this.originY)},getPointByOrigin:function(t,e){var i=this.getCenterPoint();return this.translateToOriginPoint(i,t,e)},toLocalPoint:function(t,e,i){var r=this.getCenterPoint(),e=void 0!==e&&void 0!==i?this.translateToGivenOrigin(r,"center","center",e,i):new fabric.Point(this.left,this.top),i=new fabric.Point(t.x,t.y);return(i=this.angle?fabric.util.rotatePoint(i,r,-s(this.angle)):i).subtractEquals(e)},setPositionByOrigin:function(t,e,i){t=this.translateToCenterPoint(t,e,i),e=this.translateToOriginPoint(t,this.originX,this.originY);this.set("left",e.x),this.set("top",e.y)},adjustPosition:function(t){var e=s(this.angle),i=this.getScaledWidth(),r=fabric.util.cos(e)*i,e=fabric.util.sin(e)*i,i="string"==typeof this.originX?a[this.originX]:this.originX-.5,n="string"==typeof t?a[t]:t-.5;this.left+=r*(n-i),this.top+=e*(n-i),this.setCoords(),this.originX=t},_setOriginToCenter:function(){this._originalOriginX=this.originX,this._originalOriginY=this.originY;var t=this.getCenterPoint();this.originX="center",this.originY="center",this.left=t.x,this.top=t.y},_resetOrigin:function(){var t=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX,this.originY=this._originalOriginY,this.left=t.x,this.top=t.y,this._originalOriginX=null,this._originalOriginY=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),"left","top")}})}(),function(){var s=fabric.util,o=s.degreesToRadians,a=s.multiplyTransformMatrices,c=s.transformPoint;s.object.extend(fabric.Object.prototype,{oCoords:null,aCoords:null,lineCoords:null,ownMatrixCache:null,matrixCache:null,controls:{},_getCoords:function(t,e){return e?t?this.calcACoords():this.calcLineCoords():(this.aCoords&&this.lineCoords||this.setCoords(!0),t?this.aCoords:this.lineCoords)},getCoords:function(t,e){return t=this._getCoords(t,e),[new fabric.Point(t.tl.x,t.tl.y),new fabric.Point(t.tr.x,t.tr.y),new fabric.Point(t.br.x,t.br.y),new fabric.Point(t.bl.x,t.bl.y)]},intersectsWithRect:function(t,e,i,r){i=this.getCoords(i,r);return"Intersection"===fabric.Intersection.intersectPolygonRectangle(i,t,e).status},intersectsWithObject:function(t,e,i){return"Intersection"===fabric.Intersection.intersectPolygonPolygon(this.getCoords(e,i),t.getCoords(e,i)).status||t.isContainedWithinObject(this,e,i)||this.isContainedWithinObject(t,e,i)},isContainedWithinObject:function(t,e,i){for(var r=this.getCoords(e,i),i=e?t.aCoords:t.lineCoords,n=0,s=t._getImageLines(i);n<4;n++)if(!t.containsPoint(r[n],s))return!1;return!0},isContainedWithinRect:function(t,e,i,r){i=this.getBoundingRect(i,r);return i.left>=t.x&&i.left+i.width<=e.x&&i.top>=t.y&&i.top+i.height<=e.y},containsPoint:function(t,e,i,r){i=this._getCoords(i,r),e=e||this._getImageLines(i),r=this._findCrossPoints(t,e);return 0!==r&&r%2==1},isOnScreen:function(t){if(!this.canvas)return!1;var e=this.canvas.vptCoords.tl,i=this.canvas.vptCoords.br;return!!this.getCoords(!0,t).some(function(t){return t.x<=i.x&&t.x>=e.x&&t.y<=i.y&&t.y>=e.y})||(!!this.intersectsWithRect(e,i,!0,t)||this._containsCenterOfCanvas(e,i,t))},_containsCenterOfCanvas:function(t,e,i){t={x:(t.x+e.x)/2,y:(t.y+e.y)/2};return!!this.containsPoint(t,null,!0,i)},isPartiallyOnScreen:function(t){if(!this.canvas)return!1;var e=this.canvas.vptCoords.tl,i=this.canvas.vptCoords.br;return!!this.intersectsWithRect(e,i,!0,t)||this.getCoords(!0,t).every(function(t){return(t.x>=i.x||t.x<=e.x)&&(t.y>=i.y||t.y<=e.y)})&&this._containsCenterOfCanvas(e,i,t)},_getImageLines:function(t){return{topline:{o:t.tl,d:t.tr},rightline:{o:t.tr,d:t.br},bottomline:{o:t.br,d:t.bl},leftline:{o:t.bl,d:t.tl}}},_findCrossPoints:function(t,e){var i,r,n,s=0;for(n in e)if(!((r=e[n]).o.y<t.y&&r.d.y<t.y||r.o.y>=t.y&&r.d.y>=t.y||((r.o.x===r.d.x&&r.o.x>=t.x?r.o.x:(i=(r.d.y-r.o.y)/(r.d.x-r.o.x),-(t.y-0*t.x-(r.o.y-i*r.o.x))/(0-i)))>=t.x&&(s+=1),2!==s)))break;return s},getBoundingRect:function(t,e){t=this.getCoords(t,e);return s.makeBoundingBoxFromPoints(t)},getScaledWidth:function(){return this._getTransformedDimensions().x},getScaledHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(t){return Math.abs(t)<this.minScaleLimit?t<0?-this.minScaleLimit:this.minScaleLimit:0===t?1e-4:t},scale:function(t){return this._set("scaleX",t),this._set("scaleY",t),this.setCoords()},scaleToWidth:function(t,e){e=this.getBoundingRect(e).width/this.getScaledWidth();return this.scale(t/this.width/e)},scaleToHeight:function(t,e){e=this.getBoundingRect(e).height/this.getScaledHeight();return this.scale(t/this.height/e)},calcLineCoords:function(){var t=this.getViewportTransform(),e=this.padding,i=o(this.angle),r=s.cos(i)*e,i=s.sin(i)*e,n=r+i,r=r-i,i=this.calcACoords(),i={tl:c(i.tl,t),tr:c(i.tr,t),bl:c(i.bl,t),br:c(i.br,t)};return e&&(i.tl.x-=r,i.tl.y-=n,i.tr.x+=n,i.tr.y-=r,i.bl.x-=n,i.bl.y+=r,i.br.x+=r,i.br.y+=n),i},calcOCoords:function(){var t=this._calcRotateMatrix(),e=this._calcTranslateMatrix(),i=this.getViewportTransform(),e=a(i,e),r=a(e,t),r=a(r,[1/i[0],0,0,1/i[3],0,0]),n=this._calculateCurrentDimensions(),s={};return this.forEachControl(function(t,e,i){s[e]=t.positionHandler(n,r,i)}),s},calcACoords:function(){var t=this._calcRotateMatrix(),e=this._calcTranslateMatrix(),e=a(e,t),t=this._getTransformedDimensions(),i=t.x/2,t=t.y/2;return{tl:c({x:-i,y:-t},e),tr:c({x:i,y:-t},e),bl:c({x:-i,y:t},e),br:c({x:i,y:t},e)}},setCoords:function(t){return this.aCoords=this.calcACoords(),this.lineCoords=this.group?this.aCoords:this.calcLineCoords(),t||(this.oCoords=this.calcOCoords(),this._setCornerCoords&&this._setCornerCoords()),this},_calcRotateMatrix:function(){return s.calcRotateMatrix(this)},_calcTranslateMatrix:function(){var t=this.getCenterPoint();return[1,0,0,1,t.x,t.y]},transformMatrixKey:function(t){var e="_",i="";return(i=!t&&this.group?this.group.transformMatrixKey(t)+e:i)+this.top+e+this.left+e+this.scaleX+e+this.scaleY+e+this.skewX+e+this.skewY+e+this.angle+e+this.originX+e+this.originY+e+this.width+e+this.height+e+this.strokeWidth+this.flipX+this.flipY},calcTransformMatrix:function(t){var e=this.calcOwnMatrix();if(t||!this.group)return e;var t=this.transformMatrixKey(t),i=this.matrixCache||(this.matrixCache={});return i.key===t?i.value:(this.group&&(e=a(this.group.calcTransformMatrix(!1),e)),i.key=t,i.value=e)},calcOwnMatrix:function(){var t=this.transformMatrixKey(!0),e=this.ownMatrixCache||(this.ownMatrixCache={});if(e.key===t)return e.value;var i=this._calcTranslateMatrix(),i={angle:this.angle,translateX:i[4],translateY:i[5],scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY};return e.key=t,e.value=s.composeMatrix(i),e.value},_getNonTransformedDimensions:function(){var t=this.strokeWidth;return{x:this.width+t,y:this.height+t}},_getTransformedDimensions:function(t,e){void 0===t&&(t=this.skewX),void 0===e&&(e=this.skewY);var i,r=0===t&&0===e,n=this.strokeUniform?(i=this.width,this.height):(i=(n=this._getNonTransformedDimensions()).x,n.y);if(r)return this._finalizeDimensions(i*this.scaleX,n*this.scaleY);r=s.sizeAfterTransform(i,n,{scaleX:this.scaleX,scaleY:this.scaleY,skewX:t,skewY:e});return this._finalizeDimensions(r.x,r.y)},_finalizeDimensions:function(t,e){return this.strokeUniform?{x:t+this.strokeWidth,y:e+this.strokeWidth}:{x:t,y:e}},_calculateCurrentDimensions:function(){var t=this.getViewportTransform(),e=this._getTransformedDimensions();return c(e,t,!0).scalarAdd(2*this.padding)}})}(),fabric.util.object.extend(fabric.Object.prototype,{sendToBack:function(){return this.group?fabric.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas&&this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?fabric.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas&&this.canvas.bringToFront(this),this},sendBackwards:function(t){return this.group?fabric.StaticCanvas.prototype.sendBackwards.call(this.group,this,t):this.canvas&&this.canvas.sendBackwards(this,t),this},bringForward:function(t){return this.group?fabric.StaticCanvas.prototype.bringForward.call(this.group,this,t):this.canvas&&this.canvas.bringForward(this,t),this},moveTo:function(t){return this.group&&"activeSelection"!==this.group.type?fabric.StaticCanvas.prototype.moveTo.call(this.group,this,t):this.canvas&&this.canvas.moveTo(this,t),this}}),function(){function u(t,e){var i;return e?e.toLive?t+": url(#SVGID_"+e.id+"); ":(i=t+": "+(e=new fabric.Color(e)).toRgb()+"; ",1!==(e=e.getAlpha())&&(i+=t+"-opacity: "+e.toString()+"; "),i):t+": none; "}var i=fabric.util.toFixed;fabric.util.object.extend(fabric.Object.prototype,{getSvgStyles:function(t){var e=this.fillRule||"nonzero",i=this.strokeWidth||"0",r=this.strokeDashArray?this.strokeDashArray.join(" "):"none",n=this.strokeDashOffset||"0",s=this.strokeLineCap||"butt",o=this.strokeLineJoin||"miter",a=this.strokeMiterLimit||"4",c=void 0!==this.opacity?this.opacity:"1",h=this.visible?"":" visibility: hidden;",t=t?"":this.getSvgFilter(),l=u("fill",this.fill);return[u("stroke",this.stroke),"stroke-width: ",i,"; ","stroke-dasharray: ",r,"; ","stroke-linecap: ",s,"; ","stroke-dashoffset: ",n,"; ","stroke-linejoin: ",o,"; ","stroke-miterlimit: ",a,"; ",l,"fill-rule: ",e,"; ","opacity: ",c,";",t,h].join("")},getSvgSpanStyles:function(t,e){var i="; ",r=t.fontFamily?"font-family: "+(-1===t.fontFamily.indexOf("'")&&-1===t.fontFamily.indexOf('"')?"'"+t.fontFamily+"'":t.fontFamily)+i:"",n=t.strokeWidth?"stroke-width: "+t.strokeWidth+i:"",s=t.fontSize?"font-size: "+t.fontSize+"px"+i:"",o=t.fontStyle?"font-style: "+t.fontStyle+i:"",a=t.fontWeight?"font-weight: "+t.fontWeight+i:"",c=t.fill?u("fill",t.fill):"",h=t.stroke?u("stroke",t.stroke):"",l=this.getSvgTextDecoration(t);return[h,n,r,s,o,a,l=l&&"text-decoration: "+l+i,c,t.deltaY?"baseline-shift: "+-t.deltaY+"; ":"",e?"white-space: pre; ":""].join("")},getSvgTextDecoration:function(e){return["overline","underline","line-through"].filter(function(t){return e[t.replace("-","")]}).join(" ")},getSvgFilter:function(){return this.shadow?"filter: url(#SVGID_"+this.shadow.id+");":""},getSvgCommons:function(){return[this.id?'id="'+this.id+'" ':"",this.clipPath?'clip-path="url(#'+this.clipPath.clipPathId+')" ':""].join("")},getSvgTransform:function(t,e){t=t?this.calcTransformMatrix():this.calcOwnMatrix();return'transform="'+fabric.util.matrixToSVG(t)+(e||"")+'" '},_setSVGBg:function(t){var e;this.backgroundColor&&(e=fabric.Object.NUM_FRACTION_DIGITS,t.push("\t\t<rect ",this._getFillAttributes(this.backgroundColor),' x="',i(-this.width/2,e),'" y="',i(-this.height/2,e),'" width="',i(this.width,e),'" height="',i(this.height,e),'"></rect>\n'))},toSVG:function(t){return this._createBaseSVGMarkup(this._toSVG(t),{reviver:t})},toClipPathSVG:function(t){return"\t"+this._createBaseClipPathSVGMarkup(this._toSVG(t),{reviver:t})},_createBaseClipPathSVGMarkup:function(t,e){var i=(e=e||{}).reviver,e=e.additionalTransform||"",e=[this.getSvgTransform(!0,e),this.getSvgCommons()].join(""),r=t.indexOf("COMMON_PARTS");return t[r]=e,i?i(t.join("")):t.join("")},_createBaseSVGMarkup:function(t,e){var i,r=(e=e||{}).noStyle,n=e.reviver,s=r?"":'style="'+this.getSvgStyles()+'" ',o=e.withShadow?'style="'+this.getSvgFilter()+'" ':"",a=this.clipPath,c=this.strokeUniform?'vector-effect="non-scaling-stroke" ':"",h=a&&a.absolutePositioned,l=this.stroke,u=this.fill,f=this.shadow,d=[],g=t.indexOf("COMMON_PARTS"),e=e.additionalTransform;return a&&(a.clipPathId="CLIPPATH_"+fabric.Object.__uid++,i='<clipPath id="'+a.clipPathId+'" >\n'+a.toClipPathSVG(n)+"</clipPath>\n"),h&&d.push("<g ",o,this.getSvgCommons()," >\n"),d.push("<g ",this.getSvgTransform(!1),h?"":o+this.getSvgCommons()," >\n"),o=[s,c,r?"":this.addPaintOrder()," ",e?'transform="'+e+'" ':""].join(""),t[g]=o,u&&u.toLive&&d.push(u.toSVG(this)),l&&l.toLive&&d.push(l.toSVG(this)),f&&d.push(f.toSVG(this)),a&&d.push(i),d.push(t.join("")),d.push("</g>\n"),h&&d.push("</g>\n"),n?n(d.join("")):d.join("")},addPaintOrder:function(){return"fill"!==this.paintFirst?' paint-order="'+this.paintFirst+'" ':""}})}(),function(){var n=fabric.util.object.extend,r="stateProperties";function s(e,t,i){var r={};i.forEach(function(t){r[t]=e[t]}),n(e[t],r,!0)}fabric.util.object.extend(fabric.Object.prototype,{hasStateChanged:function(t){var e="_"+(t=t||r);return Object.keys(this[e]).length<this[t].length||!function t(e,i,r){if(e===i)return 1;if(Array.isArray(e)){if(Array.isArray(i)&&e.length===i.length){for(var n=0,s=e.length;n<s;n++)if(!t(e[n],i[n]))return;return 1}}else if(e&&"object"==typeof e){var o,a=Object.keys(e);if(i&&"object"==typeof i&&(r||a.length===Object.keys(i).length)){for(n=0,s=a.length;n<s;n++)if("canvas"!==(o=a[n])&&"group"!==o&&!t(e[o],i[o]))return;return 1}}}(this[e],this,!0)},saveState:function(t){var e=t&&t.propertySet||r,i="_"+e;return this[i]?(s(this,i,this[e]),t&&t.stateProperties&&s(this,i,t.stateProperties),this):this.setupState(t)},setupState:function(t){var e=(t=t||{}).propertySet||r;return this["_"+(t.propertySet=e)]={},this.saveState(t),this}})}(),function(){var n=fabric.util.degreesToRadians;fabric.util.object.extend(fabric.Object.prototype,{_findTargetCorner:function(t,e){if(!this.hasControls||this.group||!this.canvas||this.canvas._activeObject!==this)return!1;var i,r,n=t.x,s=t.y,o=Object.keys(this.oCoords),a=o.length-1;for(this.__corner=0;0<=a;a--)if(r=o[a],this.isControlVisible(r)&&(i=this._getImageLines(e?this.oCoords[r].touchCorner:this.oCoords[r].corner),0!==(i=this._findCrossPoints({x:n,y:s},i))&&i%2==1))return this.__corner=r;return!1},forEachControl:function(t){for(var e in this.controls)t(this.controls[e],e,this)},_setCornerCoords:function(){var t,e=this.oCoords;for(t in e){var i=this.controls[t];e[t].corner=i.calcCornerCoords(this.angle,this.cornerSize,e[t].x,e[t].y,!1),e[t].touchCorner=i.calcCornerCoords(this.angle,this.touchCornerSize,e[t].x,e[t].y,!0)}},drawSelectionBackground:function(t){if(!this.selectionBackgroundColor||this.canvas&&!this.canvas.interactive||this.canvas&&this.canvas._activeObject!==this)return this;t.save();var e=this.getCenterPoint(),i=this._calculateCurrentDimensions(),r=this.canvas.viewportTransform;return t.translate(e.x,e.y),t.scale(1/r[0],1/r[3]),t.rotate(n(this.angle)),t.fillStyle=this.selectionBackgroundColor,t.fillRect(-i.x/2,-i.y/2,i.x,i.y),t.restore(),this},drawBorders:function(r,t){t=t||{};var e=this._calculateCurrentDimensions(),i=this.borderScaleFactor,n=e.x+i,s=e.y+i,e=(void 0!==t.hasControls?t:this).hasControls,o=!1;return r.save(),r.strokeStyle=t.borderColor||this.borderColor,this._setLineDash(r,t.borderDashArray||this.borderDashArray),r.strokeRect(-n/2,-s/2,n,s),e&&(r.beginPath(),this.forEachControl(function(t,e,i){t.withConnection&&t.getVisibility(i,e)&&(o=!0,r.moveTo(t.x*n,t.y*s),r.lineTo(t.x*n+t.offsetX,t.y*s+t.offsetY))}),o&&r.stroke()),r.restore(),this},drawBordersInGroup:function(t,e,i){i=i||{};var r=fabric.util.sizeAfterTransform(this.width,this.height,e),n=this.strokeWidth,s=this.strokeUniform,o=this.borderScaleFactor,a=r.x+n*(s?this.canvas.getZoom():e.scaleX)+o,r=r.y+n*(s?this.canvas.getZoom():e.scaleY)+o;return t.save(),this._setLineDash(t,i.borderDashArray||this.borderDashArray),t.strokeStyle=i.borderColor||this.borderColor,t.strokeRect(-a/2,-r/2,a,r),t.restore(),this},drawControls:function(r,n){n=n||{},r.save();var s,o,t=this.canvas.getRetinaScaling();return r.setTransform(t,0,0,t,0,0),r.strokeStyle=r.fillStyle=n.cornerColor||this.cornerColor,this.transparentCorners||(r.strokeStyle=n.cornerStrokeColor||this.cornerStrokeColor),this._setLineDash(r,n.cornerDashArray||this.cornerDashArray),this.setCoords(),this.group&&(s=this.group.calcTransformMatrix()),this.forEachControl(function(t,e,i){o=i.oCoords[e],t.getVisibility(i,e)&&(s&&(o=fabric.util.transformPoint(o,s)),t.render(r,o.x,o.y,n,i))}),r.restore(),this},isControlVisible:function(t){return this.controls[t]&&this.controls[t].getVisibility(this,t)},setControlVisible:function(t,e){return this._controlsVisibility||(this._controlsVisibility={}),this._controlsVisibility[t]=e,this},setControlsVisibility:function(t){for(var e in t=t||{})this.setControlVisible(e,t[e]);return this},onDeselect:function(){},onSelect:function(){}})}(),fabric.util.object.extend(fabric.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(e,t){function i(){}var r=(t=t||{}).onComplete||i,n=t.onChange||i,s=this;return fabric.util.animate({target:this,startValue:e.left,endValue:this.getCenterPoint().x,duration:this.FX_DURATION,onChange:function(t){e.set("left",t),s.requestRenderAll(),n()},onComplete:function(){e.setCoords(),r()}})},fxCenterObjectV:function(e,t){function i(){}var r=(t=t||{}).onComplete||i,n=t.onChange||i,s=this;return fabric.util.animate({target:this,startValue:e.top,endValue:this.getCenterPoint().y,duration:this.FX_DURATION,onChange:function(t){e.set("top",t),s.requestRenderAll(),n()},onComplete:function(){e.setCoords(),r()}})},fxRemove:function(e,t){function i(){}var r=(t=t||{}).onComplete||i,n=t.onChange||i,s=this;return fabric.util.animate({target:this,startValue:e.opacity,endValue:0,duration:this.FX_DURATION,onChange:function(t){e.set("opacity",t),s.requestRenderAll(),n()},onComplete:function(){s.remove(e),r()}})}}),fabric.util.object.extend(fabric.Object.prototype,{animate:function(){if(arguments[0]&&"object"==typeof arguments[0]){var t,e,i=[],r=[];for(t in arguments[0])i.push(t);for(var n=0,s=i.length;n<s;n++)t=i[n],e=n!==s-1,r.push(this._animate(t,arguments[0][t],arguments[1],e));return r}return this._animate.apply(this,arguments)},_animate:function(r,t,n,s){var o,a=this,e=(t=t.toString(),n=n?fabric.util.object.clone(n):{},~r.indexOf(".")&&(o=r.split(".")),-1<a.colorProperties.indexOf(r)||o&&-1<a.colorProperties.indexOf(o[1])),i=o?this.get(o[0])[o[1]]:this.get(r),i=("from"in n||(n.from=i),e||(t=~t.indexOf("=")?i+parseFloat(t.replace("=","")):parseFloat(t)),{target:this,startValue:n.from,endValue:t,byValue:n.by,easing:n.easing,duration:n.duration,abort:n.abort&&function(t,e,i){return n.abort.call(a,t,e,i)},onChange:function(t,e,i){o?a[o[0]][o[1]]=t:a.set(r,t),s||n.onChange&&n.onChange(t,e,i)},onComplete:function(t,e,i){s||(a.setCoords(),n.onComplete&&n.onComplete(t,e,i))}});return e?fabric.util.animateColor(i.startValue,i.endValue,i.duration,i):fabric.util.animate(i)}}),function(t){"use strict";var n=t.fabric||(t.fabric={}),s=n.util.object.extend,r=n.util.object.clone,i={x1:1,x2:1,y1:1,y2:1};function e(t,e){var i=t.origin,r=t.axis1,n=t.axis2,s=t.dimension,o=e.nearest,a=e.center,c=e.farthest;return function(){switch(this.get(i)){case o:return Math.min(this.get(r),this.get(n));case a:return Math.min(this.get(r),this.get(n))+.5*this.get(s);case c:return Math.max(this.get(r),this.get(n))}}}n.Line?n.warn("fabric.Line is already defined"):(n.Line=n.util.createClass(n.Object,{type:"line",x1:0,y1:0,x2:0,y2:0,cacheProperties:n.Object.prototype.cacheProperties.concat("x1","x2","y1","y2"),initialize:function(t,e){t=t||[0,0,0,0],this.callSuper("initialize",e),this.set("x1",t[0]),this.set("y1",t[1]),this.set("x2",t[2]),this.set("y2",t[3]),this._setWidthHeight(e)},_setWidthHeight:function(t){t=t||{},this.width=Math.abs(this.x2-this.x1),this.height=Math.abs(this.y2-this.y1),this.left="left"in t?t.left:this._getLeftToOriginX(),this.top="top"in t?t.top:this._getTopToOriginY()},_set:function(t,e){return this.callSuper("_set",t,e),void 0!==i[t]&&this._setWidthHeight(),this},_getLeftToOriginX:e({origin:"originX",axis1:"x1",axis2:"x2",dimension:"width"},{nearest:"left",center:"center",farthest:"right"}),_getTopToOriginY:e({origin:"originY",axis1:"y1",axis2:"y2",dimension:"height"},{nearest:"top",center:"center",farthest:"bottom"}),_render:function(t){t.beginPath();var e=this.calcLinePoints(),e=(t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.lineWidth=this.strokeWidth,t.strokeStyle);t.strokeStyle=this.stroke||t.fillStyle,this.stroke&&this._renderStroke(t),t.strokeStyle=e},_findCenterFromElement:function(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}},toObject:function(t){return s(this.callSuper("toObject",t),this.calcLinePoints())},_getNonTransformedDimensions:function(){var t=this.callSuper("_getNonTransformedDimensions");return"butt"===this.strokeLineCap&&(0===this.width&&(t.y-=this.strokeWidth),0===this.height&&(t.x-=this.strokeWidth)),t},calcLinePoints:function(){var t=this.x1<=this.x2?-1:1,e=this.y1<=this.y2?-1:1,i=t*this.width*.5,r=e*this.height*.5;return{x1:i,x2:t*this.width*-.5,y1:r,y2:e*this.height*-.5}},_toSVG:function(){var t=this.calcLinePoints();return["<line ","COMMON_PARTS",'x1="',t.x1,'" y1="',t.y1,'" x2="',t.x2,'" y2="',t.y2,'" />\n']}}),n.Line.ATTRIBUTE_NAMES=n.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")),n.Line.fromElement=function(t,e,i){i=i||{};var t=n.parseAttributes(t,n.Line.ATTRIBUTE_NAMES),r=[t.x1||0,t.y1||0,t.x2||0,t.y2||0];e(new n.Line(r,s(t,i)))},n.Line.fromObject=function(t,e){var i=r(t,!0);i.points=[t.x1,t.y1,t.x2,t.y2],n.Object._fromObject("Line",i,function(t){delete t.points,e&&e(t)},"points")})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var n=t.fabric||(t.fabric={}),s=n.util.degreesToRadians;n.Circle?n.warn("fabric.Circle is already defined."):(n.Circle=n.util.createClass(n.Object,{type:"circle",radius:0,startAngle:0,endAngle:360,cacheProperties:n.Object.prototype.cacheProperties.concat("radius","startAngle","endAngle"),_set:function(t,e){return this.callSuper("_set",t,e),"radius"===t&&this.setRadius(e),this},toObject:function(t){return this.callSuper("toObject",["radius","startAngle","endAngle"].concat(t))},_toSVG:function(){var t,e,i,r=(this.endAngle-this.startAngle)%360;return 0==r?["<circle ","COMMON_PARTS",'cx="0" cy="0" ','r="',this.radius,'" />\n']:(t=s(this.startAngle),e=s(this.endAngle),i=this.radius,['<path d="M '+n.util.cos(t)*i+" "+n.util.sin(t)*i," A "+i+" "+i," 0 ",+(180<r?"1":"0")+" 1"," "+n.util.cos(e)*i+" "+n.util.sin(e)*i,'" ',"COMMON_PARTS"," />\n"])},_render:function(t){t.beginPath(),t.arc(0,0,this.radius,s(this.startAngle),s(this.endAngle),!1),this._renderPaintInOrder(t)},getRadiusX:function(){return this.get("radius")*this.get("scaleX")},getRadiusY:function(){return this.get("radius")*this.get("scaleY")},setRadius:function(t){return this.radius=t,this.set("width",2*t).set("height",2*t)}}),n.Circle.ATTRIBUTE_NAMES=n.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")),n.Circle.fromElement=function(t,e){var i,t=n.parseAttributes(t,n.Circle.ATTRIBUTE_NAMES);if(!("radius"in(i=t)&&0<=i.radius))throw new Error("value of `r` attribute is required and can not be negative");t.left=(t.left||0)-t.radius,t.top=(t.top||0)-t.radius,e(new n.Circle(t))},n.Circle.fromObject=function(t,e){n.Object._fromObject("Circle",t,e)})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var i=t.fabric||(t.fabric={});i.Triangle?i.warn("fabric.Triangle is already defined"):(i.Triangle=i.util.createClass(i.Object,{type:"triangle",width:100,height:100,_render:function(t){var e=this.width/2,i=this.height/2;t.beginPath(),t.moveTo(-e,i),t.lineTo(0,-i),t.lineTo(e,i),t.closePath(),this._renderPaintInOrder(t)},_toSVG:function(){var t=this.width/2,e=this.height/2;return["<polygon ","COMMON_PARTS",'points="',[-t+" "+e,"0 "+-e,t+" "+e].join(","),'" />']}}),i.Triangle.fromObject=function(t,e){return i.Object._fromObject("Triangle",t,e)})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var i=t.fabric||(t.fabric={}),e=2*Math.PI;i.Ellipse?i.warn("fabric.Ellipse is already defined."):(i.Ellipse=i.util.createClass(i.Object,{type:"ellipse",rx:0,ry:0,cacheProperties:i.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(t){this.callSuper("initialize",t),this.set("rx",t&&t.rx||0),this.set("ry",t&&t.ry||0)},_set:function(t,e){switch(this.callSuper("_set",t,e),t){case"rx":this.rx=e,this.set("width",2*e);break;case"ry":this.ry=e,this.set("height",2*e)}return this},getRx:function(){return this.get("rx")*this.get("scaleX")},getRy:function(){return this.get("ry")*this.get("scaleY")},toObject:function(t){return this.callSuper("toObject",["rx","ry"].concat(t))},_toSVG:function(){return["<ellipse ","COMMON_PARTS",'cx="0" cy="0" ','rx="',this.rx,'" ry="',this.ry,'" />\n']},_render:function(t){t.beginPath(),t.save(),t.transform(1,0,0,this.ry/this.rx,0,0),t.arc(0,0,this.rx,0,e,!1),t.restore(),this._renderPaintInOrder(t)}}),i.Ellipse.ATTRIBUTE_NAMES=i.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")),i.Ellipse.fromElement=function(t,e){t=i.parseAttributes(t,i.Ellipse.ATTRIBUTE_NAMES);t.left=(t.left||0)-t.rx,t.top=(t.top||0)-t.ry,e(new i.Ellipse(t))},i.Ellipse.fromObject=function(t,e){i.Object._fromObject("Ellipse",t,e)})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var r=t.fabric||(t.fabric={}),n=r.util.object.extend;r.Rect?r.warn("fabric.Rect is already defined"):(r.Rect=r.util.createClass(r.Object,{stateProperties:r.Object.prototype.stateProperties.concat("rx","ry"),type:"rect",rx:0,ry:0,cacheProperties:r.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(t){this.callSuper("initialize",t),this._initRxRy()},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(t){var e=this.rx?Math.min(this.rx,this.width/2):0,i=this.ry?Math.min(this.ry,this.height/2):0,r=this.width,n=this.height,s=-this.width/2,o=-this.height/2,a=0!==e||0!==i,c=.4477152502;t.beginPath(),t.moveTo(s+e,o),t.lineTo(s+r-e,o),a&&t.bezierCurveTo(s+r-c*e,o,s+r,o+c*i,s+r,o+i),t.lineTo(s+r,o+n-i),a&&t.bezierCurveTo(s+r,o+n-c*i,s+r-c*e,o+n,s+r-e,o+n),t.lineTo(s+e,o+n),a&&t.bezierCurveTo(s+c*e,o+n,s,o+n-c*i,s,o+n-i),t.lineTo(s,o+i),a&&t.bezierCurveTo(s,o+c*i,s+c*e,o,s+e,o),t.closePath(),this._renderPaintInOrder(t)},toObject:function(t){return this.callSuper("toObject",["rx","ry"].concat(t))},_toSVG:function(){return["<rect ","COMMON_PARTS",'x="',-this.width/2,'" y="',-this.height/2,'" rx="',this.rx,'" ry="',this.ry,'" width="',this.width,'" height="',this.height,'" />\n']}}),r.Rect.ATTRIBUTE_NAMES=r.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")),r.Rect.fromElement=function(t,e,i){if(!t)return e(null);i=i||{};t=r.parseAttributes(t,r.Rect.ATTRIBUTE_NAMES),t.left=t.left||0,t.top=t.top||0,t.height=t.height||0,t.width=t.width||0,i=new r.Rect(n(i?r.util.object.clone(i):{},t));i.visible=i.visible&&0<i.width&&0<i.height,e(i)},r.Rect.fromObject=function(t,e){return r.Object._fromObject("Rect",t,e)})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var o=t.fabric||(t.fabric={}),s=o.util.object.extend,r=o.util.array.min,n=o.util.array.max,a=o.util.toFixed,e=o.util.projectStrokeOnPoints;o.Polyline?o.warn("fabric.Polyline is already defined"):(o.Polyline=o.util.createClass(o.Object,{type:"polyline",points:null,exactBoundingBox:!1,cacheProperties:o.Object.prototype.cacheProperties.concat("points"),initialize:function(t,e){e=e||{},this.points=t||[],this.callSuper("initialize",e),this._setPositionDimensions(e)},_projectStrokeOnPoints:function(){return e(this.points,this,!0)},_setPositionDimensions:function(t){var e,i=this._calcDimensions(t),r=this.exactBoundingBox?this.strokeWidth:0;this.width=i.width-r,this.height=i.height-r,t.fromSVG||(e=this.translateToGivenOrigin({x:i.left-this.strokeWidth/2+r/2,y:i.top-this.strokeWidth/2+r/2},"left","top",this.originX,this.originY)),void 0===t.left&&(this.left=t.fromSVG?i.left:e.x),void 0===t.top&&(this.top=t.fromSVG?i.top:e.y),this.pathOffset={x:i.left+this.width/2+r/2,y:i.top+this.height/2+r/2}},_calcDimensions:function(){var t=this.exactBoundingBox?this._projectStrokeOnPoints():this.points,e=r(t,"x")||0,i=r(t,"y")||0;return{left:e,top:i,width:(n(t,"x")||0)-e,height:(n(t,"y")||0)-i}},toObject:function(t){return s(this.callSuper("toObject",t),{points:this.points.concat()})},_toSVG:function(){for(var t=[],e=this.pathOffset.x,i=this.pathOffset.y,r=o.Object.NUM_FRACTION_DIGITS,n=0,s=this.points.length;n<s;n++)t.push(a(this.points[n].x-e,r),",",a(this.points[n].y-i,r)," ");return["<"+this.type+" ","COMMON_PARTS",'points="',t.join(""),'" />\n']},commonRender:function(t){var e,i=this.points.length,r=this.pathOffset.x,n=this.pathOffset.y;if(!i||isNaN(this.points[i-1].y))return!1;t.beginPath(),t.moveTo(this.points[0].x-r,this.points[0].y-n);for(var s=0;s<i;s++)e=this.points[s],t.lineTo(e.x-r,e.y-n);return!0},_render:function(t){this.commonRender(t)&&this._renderPaintInOrder(t)},complexity:function(){return this.get("points").length}}),o.Polyline.ATTRIBUTE_NAMES=o.SHARED_ATTRIBUTES.concat(),o.Polyline.fromElementGenerator=function(n){return function(t,e,i){if(!t)return e(null);i=i||{};var r=o.parsePointsAttribute(t.getAttribute("points")),t=o.parseAttributes(t,o[n].ATTRIBUTE_NAMES);t.fromSVG=!0,e(new o[n](r,s(t,i)))}},o.Polyline.fromElement=o.Polyline.fromElementGenerator("Polyline"),o.Polyline.fromObject=function(t,e){return o.Object._fromObject("Polyline",t,e,"points")})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var i=t.fabric||(t.fabric={}),e=i.util.projectStrokeOnPoints;i.Polygon?i.warn("fabric.Polygon is already defined"):(i.Polygon=i.util.createClass(i.Polyline,{type:"polygon",_projectStrokeOnPoints:function(){return e(this.points,this)},_render:function(t){this.commonRender(t)&&(t.closePath(),this._renderPaintInOrder(t))}}),i.Polygon.ATTRIBUTE_NAMES=i.SHARED_ATTRIBUTES.concat(),i.Polygon.fromElement=i.Polyline.fromElementGenerator("Polygon"),i.Polygon.fromObject=function(t,e){i.Object._fromObject("Polygon",t,e,"points")})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var f=t.fabric||(t.fabric={}),d=f.util.array.min,g=f.util.array.max,r=f.util.object.extend,i=f.util.object.clone,e=f.util.toFixed;f.Path?f.warn("fabric.Path is already defined"):(f.Path=f.util.createClass(f.Object,{type:"path",path:null,cacheProperties:f.Object.prototype.cacheProperties.concat("path","fillRule"),stateProperties:f.Object.prototype.stateProperties.concat("path"),initialize:function(t,e){delete(e=i(e||{})).path,this.callSuper("initialize",e),this._setPath(t||[],e)},_setPath:function(t,e){this.path=f.util.makePathSimpler(Array.isArray(t)?t:f.util.parsePath(t)),f.Polyline.prototype._setPositionDimensions.call(this,e||{})},_renderPathCommands:function(t){var e,i=0,r=0,n=0,s=0,o=0,a=0,c=-this.pathOffset.x,h=-this.pathOffset.y;t.beginPath();for(var l=0,u=this.path.length;l<u;++l)switch((e=this.path[l])[0]){case"L":n=e[1],s=e[2],t.lineTo(n+c,s+h);break;case"M":i=n=e[1],r=s=e[2],t.moveTo(n+c,s+h);break;case"C":n=e[5],s=e[6],o=e[3],a=e[4],t.bezierCurveTo(e[1]+c,e[2]+h,o+c,a+h,n+c,s+h);break;case"Q":t.quadraticCurveTo(e[1]+c,e[2]+h,e[3]+c,e[4]+h),n=e[3],s=e[4],o=e[1],a=e[2];break;case"z":case"Z":n=i,s=r,t.closePath()}},_render:function(t){this._renderPathCommands(t),this._renderPaintInOrder(t)},toString:function(){return"#<fabric.Path ("+this.complexity()+'): { "top": '+this.top+', "left": '+this.left+" }>"},toObject:function(t){return r(this.callSuper("toObject",t),{path:this.path.map(function(t){return t.slice()})})},toDatalessObject:function(t){t=this.toObject(["sourcePath"].concat(t));return t.sourcePath&&delete t.path,t},_toSVG:function(){return["<path ","COMMON_PARTS",'d="',f.util.joinPath(this.path),'" stroke-linecap="round" ',"/>\n"]},_getOffsetTransform:function(){var t=f.Object.NUM_FRACTION_DIGITS;return" translate("+e(-this.pathOffset.x,t)+", "+e(-this.pathOffset.y,t)+")"},toClipPathSVG:function(t){var e=this._getOffsetTransform();return"\t"+this._createBaseClipPathSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})},toSVG:function(t){var e=this._getOffsetTransform();return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})},complexity:function(){return this.path.length},_calcDimensions:function(){for(var t,e,i=[],r=[],n=0,s=0,o=0,a=0,c=0,h=this.path.length;c<h;++c){switch((t=this.path[c])[0]){case"L":o=t[1],a=t[2],e=[];break;case"M":n=o=t[1],s=a=t[2],e=[];break;case"C":e=f.util.getBoundsOfCurve(o,a,t[1],t[2],t[3],t[4],t[5],t[6]),o=t[5],a=t[6];break;case"Q":e=f.util.getBoundsOfCurve(o,a,t[1],t[2],t[1],t[2],t[3],t[4]),o=t[3],a=t[4];break;case"z":case"Z":o=n,a=s}e.forEach(function(t){i.push(t.x),r.push(t.y)}),i.push(o),r.push(a)}var l=d(i)||0,u=d(r)||0;return{left:l,top:u,width:(g(i)||0)-l,height:(g(r)||0)-u}}}),f.Path.fromObject=function(i,r){var t;"string"==typeof i.sourcePath?(t=i.sourcePath,f.loadSVGFromURL(t,function(t){var e=t[0];e.setOptions(i),i.clipPath?f.util.enlivenObjects([i.clipPath],function(t){e.clipPath=t[0],r&&r(e)}):r&&r(e)})):f.Object._fromObject("Path",i,r,"path")},f.Path.ATTRIBUTE_NAMES=f.SHARED_ATTRIBUTES.concat(["d"]),f.Path.fromElement=function(t,e,i){t=f.parseAttributes(t,f.Path.ATTRIBUTE_NAMES);t.fromSVG=!0,e(new f.Path(t.d,r(t,i)))})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var o=t.fabric||(t.fabric={}),a=o.util.array.min,c=o.util.array.max;o.Group||(o.Group=o.util.createClass(o.Object,o.Collection,{type:"group",strokeWidth:0,subTargetCheck:!1,cacheProperties:[],useSetOnGroup:!1,initialize:function(t,e,i){e=e||{},this._objects=[],i&&this.callSuper("initialize",e),this._objects=t||[];for(var r=this._objects.length;r--;)this._objects[r].group=this;i?this._updateObjectsACoords():(t=e&&e.centerPoint,void 0!==e.originX&&(this.originX=e.originX),void 0!==e.originY&&(this.originY=e.originY),t||this._calcBounds(),this._updateObjectsCoords(t),delete e.centerPoint,this.callSuper("initialize",e)),this.setCoords()},_updateObjectsACoords:function(){for(var t=this._objects.length;t--;)this._objects[t].setCoords(!0)},_updateObjectsCoords:function(t){for(var t=t||this.getCenterPoint(),e=this._objects.length;e--;)this._updateObjectCoords(this._objects[e],t)},_updateObjectCoords:function(t,e){var i=t.left,r=t.top;t.set({left:i-e.x,top:r-e.y}),t.group=this,t.setCoords(!0)},toString:function(){return"#<fabric.Group: ("+this.complexity()+")>"},addWithUpdate:function(t){var e=!!this.group;return this._restoreObjectsState(),o.util.resetObjectTransform(this),t&&(e&&o.util.removeTransformFromObject(t,this.group.calcTransformMatrix()),this._objects.push(t),t.group=this,t._set("canvas",this.canvas)),this._calcBounds(),this._updateObjectsCoords(),this.dirty=!0,e?this.group.addWithUpdate():this.setCoords(),this},removeWithUpdate:function(t){return this._restoreObjectsState(),o.util.resetObjectTransform(this),this.remove(t),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},_onObjectAdded:function(t){this.dirty=!0,t.group=this,t._set("canvas",this.canvas)},_onObjectRemoved:function(t){this.dirty=!0,delete t.group},_set:function(t,e){var i=this._objects.length;if(this.useSetOnGroup)for(;i--;)this._objects[i].setOnGroup(t,e);if("canvas"===t)for(;i--;)this._objects[i]._set(t,e);o.Object.prototype._set.call(this,t,e)},toObject:function(r){var n=this.includeDefaultValues,t=this._objects.filter(function(t){return!t.excludeFromExport}).map(function(t){var e=t.includeDefaultValues,i=(t.includeDefaultValues=n,t.toObject(r));return t.includeDefaultValues=e,i}),e=o.Object.prototype.toObject.call(this,r);return e.objects=t,e},toDatalessObject:function(r){var n,t=this.sourcePath,e=(t=t||(n=this.includeDefaultValues,this._objects.map(function(t){var e=t.includeDefaultValues,i=(t.includeDefaultValues=n,t.toDatalessObject(r));return t.includeDefaultValues=e,i})),o.Object.prototype.toDatalessObject.call(this,r));return e.objects=t,e},render:function(t){this._transformDone=!0,this.callSuper("render",t),this._transformDone=!1},shouldCache:function(){var t=o.Object.prototype.shouldCache.call(this);if(t)for(var e=0,i=this._objects.length;e<i;e++)if(this._objects[e].willDrawShadow())return this.ownCaching=!1;return t},willDrawShadow:function(){if(o.Object.prototype.willDrawShadow.call(this))return!0;for(var t=0,e=this._objects.length;t<e;t++)if(this._objects[t].willDrawShadow())return!0;return!1},isOnACache:function(){return this.ownCaching||this.group&&this.group.isOnACache()},drawObject:function(t){for(var e=0,i=this._objects.length;e<i;e++)this._objects[e].render(t);this._drawClipPath(t,this.clipPath)},isCacheDirty:function(t){if(this.callSuper("isCacheDirty",t))return!0;if(!this.statefullCache)return!1;for(var e,i,r=0,n=this._objects.length;r<n;r++)if(this._objects[r].isCacheDirty(!0))return this._cacheCanvas&&(e=this.cacheWidth/this.zoomX,i=this.cacheHeight/this.zoomY,this._cacheContext.clearRect(-e/2,-i/2,e,i)),!0;return!1},_restoreObjectsState:function(){var e=this.calcOwnMatrix();return this._objects.forEach(function(t){o.util.addTransformToObject(t,e),delete t.group,t.setCoords()}),this},destroy:function(){return this._objects.forEach(function(t){t.set("dirty",!0)}),this._restoreObjectsState()},dispose:function(){this.callSuper("dispose"),this.forEachObject(function(t){t.dispose&&t.dispose()}),this._objects=[]},toActiveSelection:function(){var t,e,i,r;if(this.canvas)return t=this._objects,e=this.canvas,this._objects=[],i=this.toObject(),delete i.objects,r=new o.ActiveSelection([]),r.set(i),r.type="activeSelection",e.remove(this),t.forEach(function(t){t.group=r,t.dirty=!0,e.add(t)}),r.canvas=e,r._objects=t,(e._activeObject=r).setCoords(),r},ungroupOnCanvas:function(){return this._restoreObjectsState()},setObjectsCoords:function(){return this.forEachObject(function(t){t.setCoords(!0)}),this},_calcBounds:function(t){for(var e,i,r,n,s=[],o=[],a=["tr","br","bl","tl"],c=0,h=this._objects.length,l=a.length;c<h;++c){for(r=(e=this._objects[c]).calcACoords(),n=0;n<l;n++)s.push(r[i=a[n]].x),o.push(r[i].y);e.aCoords=r}this._getBounds(s,o,t)},_getBounds:function(t,e,i){var r=new o.Point(a(t),a(e)),t=new o.Point(c(t),c(e)),e=r.y||0,n=r.x||0,s=t.x-r.x||0,t=t.y-r.y||0;this.width=s,this.height=t,i||this.setPositionByOrigin({x:n,y:e},"left","top")},_toSVG:function(t){for(var e=["<g ","COMMON_PARTS"," >\n"],i=0,r=this._objects.length;i<r;i++)e.push("\t\t",this._objects[i].toSVG(t));return e.push("</g>\n"),e},getSvgStyles:function(){var t=void 0!==this.opacity&&1!==this.opacity?"opacity: "+this.opacity+";":"",e=this.visible?"":" visibility: hidden;";return[t,this.getSvgFilter(),e].join("")},toClipPathSVG:function(t){for(var e=[],i=0,r=this._objects.length;i<r;i++)e.push("\t",this._objects[i].toClipPathSVG(t));return this._createBaseClipPathSVGMarkup(e,{reviver:t})}}),o.Group.fromObject=function(i,r){var n=i.objects,s=o.util.object.clone(i,!0);delete s.objects,"string"==typeof n?o.loadSVGFromURL(n,function(t){var e=o.util.groupSVGElements(t,i,n),t=s.clipPath;delete s.clipPath,e.set(s),t?o.util.enlivenObjects([t],function(t){e.clipPath=t[0],r&&r(e)}):r&&r(e)}):o.util.enlivenObjects(n,function(t){o.util.enlivenObjectEnlivables(i,s,function(){r&&r(new o.Group(t,s,!0))})})})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var r=t.fabric||(t.fabric={});r.ActiveSelection||(r.ActiveSelection=r.util.createClass(r.Group,{type:"activeSelection",initialize:function(t,e){e=e||{},this._objects=t||[];for(var i=this._objects.length;i--;)this._objects[i].group=this;e.originX&&(this.originX=e.originX),e.originY&&(this.originY=e.originY),this._calcBounds(),this._updateObjectsCoords(),r.Object.prototype.initialize.call(this,e),this.setCoords()},toGroup:function(){var t=this._objects.concat(),e=(this._objects=[],r.Object.prototype.toObject.call(this)),i=new r.Group([]);if(delete e.type,i.set(e),t.forEach(function(t){t.canvas.remove(t),t.group=i}),i._objects=t,!this.canvas)return i;e=this.canvas;return e.add(i),(e._activeObject=i).setCoords(),i},onDeselect:function(){return this.destroy(),!1},toString:function(){return"#<fabric.ActiveSelection: ("+this.complexity()+")>"},shouldCache:function(){return!1},isOnACache:function(){return!1},_renderControls:function(t,e,i){t.save(),t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,this.callSuper("_renderControls",t,e),void 0===(i=i||{}).hasControls&&(i.hasControls=!1),i.forActiveSelection=!0;for(var r=0,n=this._objects.length;r<n;r++)this._objects[r]._renderControls(t,i);t.restore()}}),r.ActiveSelection.fromObject=function(e,i){r.util.enlivenObjects(e.objects,function(t){delete e.objects,i&&i(new r.ActiveSelection(t,e,!0))})})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var r=fabric.util.object.extend;t.fabric||(t.fabric={}),t.fabric.Image?fabric.warn("fabric.Image is already defined."):(fabric.Image=fabric.util.createClass(fabric.Object,{type:"image",strokeWidth:0,srcFromAttribute:!1,_lastScaleX:1,_lastScaleY:1,_filterScalingX:1,_filterScalingY:1,minimumScaleTrigger:.5,stateProperties:fabric.Object.prototype.stateProperties.concat("cropX","cropY"),cacheProperties:fabric.Object.prototype.cacheProperties.concat("cropX","cropY"),cacheKey:"",cropX:0,cropY:0,imageSmoothing:!0,initialize:function(t,e){e=e||{},this.filters=[],this.cacheKey="texture"+fabric.Object.__uid++,this.callSuper("initialize",e),this._initElement(t,e)},getElement:function(){return this._element||{}},setElement:function(t,e){return this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._element=t,this._originalElement=t,this._initConfig(e),0!==this.filters.length&&this.applyFilters(),this.resizeFilter&&this.applyResizeFilters(),this},removeTexture:function(t){var e=fabric.filterBackend;e&&e.evictCachesForKey&&e.evictCachesForKey(t)},dispose:function(){this.callSuper("dispose"),this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._cacheContext=void 0,["_originalElement","_element","_filteredEl","_cacheCanvas"].forEach(function(t){fabric.util.cleanUpJsdomNode(this[t]),this[t]=void 0}.bind(this))},getCrossOrigin:function(){return this._originalElement&&(this._originalElement.crossOrigin||null)},getOriginalSize:function(){var t=this.getElement();return{width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}},_stroke:function(t){var e,i;this.stroke&&0!==this.strokeWidth&&(e=this.width/2,i=this.height/2,t.beginPath(),t.moveTo(-e,-i),t.lineTo(e,-i),t.lineTo(e,i),t.lineTo(-e,i),t.lineTo(-e,-i),t.closePath())},toObject:function(t){var e=[],t=(this.filters.forEach(function(t){t&&e.push(t.toObject())}),r(this.callSuper("toObject",["cropX","cropY"].concat(t)),{src:this.getSrc(),crossOrigin:this.getCrossOrigin(),filters:e}));return this.resizeFilter&&(t.resizeFilter=this.resizeFilter.toObject()),t},hasCrop:function(){return this.cropX||this.cropY||this.width<this._element.width||this.height<this._element.height},_toSVG:function(){var t,e,i=[],r=[],n=this._element,s=-this.width/2,o=-this.height/2,a="",c="";return n?(this.hasCrop()&&(e=fabric.Object.__uid++,i.push('<clipPath id="imageCrop_'+e+'">\n','\t<rect x="'+s+'" y="'+o+'" width="'+this.width+'" height="'+this.height+'" />\n',"</clipPath>\n"),a=' clip-path="url(#imageCrop_'+e+')" '),this.imageSmoothing||(c='" image-rendering="optimizeSpeed'),r.push("\t<image ","COMMON_PARTS",'xlink:href="',this.getSvgSrc(!0),'" x="',s-this.cropX,'" y="',o-this.cropY,'" width="',n.width||n.naturalWidth,'" height="',n.height||n.height,c,'"',a,"></image>\n"),(this.stroke||this.strokeDashArray)&&(e=this.fill,this.fill=null,t=["\t<rect ",'x="',s,'" y="',o,'" width="',this.width,'" height="',this.height,'" style="',this.getSvgStyles(),'"/>\n'],this.fill=e),"fill"!==this.paintFirst?i.concat(t,r):i.concat(r,t)):[]},getSrc:function(t){t=t?this._element:this._originalElement;return t?t.toDataURL?t.toDataURL():this.srcFromAttribute?t.getAttribute("src"):t.src:this.src||""},setSrc:function(t,i,r){return fabric.util.loadImage(t,function(t,e){this.setElement(t,r),this._setWidthHeight(),i&&i(this,e)},this,r&&r.crossOrigin),this},toString:function(){return'#<fabric.Image: { src: "'+this.getSrc()+'" }>'},applyResizeFilters:function(){var t=this.resizeFilter,e=this.minimumScaleTrigger,i=this.getTotalObjectScaling(),r=i.scaleX,i=i.scaleY,n=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!t||e<r&&e<i)return this._element=n,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=r,void(this._lastScaleY=i);fabric.filterBackend||(fabric.filterBackend=fabric.initFilterBackend());var e=fabric.util.createCanvasElement(),s=this._filteredEl?this.cacheKey+"_filtered":this.cacheKey,o=n.width,a=n.height;e.width=o,e.height=a,this._element=e,this._lastScaleX=t.scaleX=r,this._lastScaleY=t.scaleY=i,fabric.filterBackend.applyFilters([t],n,o,a,this._element,s),this._filterScalingX=e.width/this._originalElement.width,this._filterScalingY=e.height/this._originalElement.height},applyFilters:function(t){if(t=(t=t||this.filters||[]).filter(function(t){return t&&!t.isNeutralState()}),this.set("dirty",!0),this.removeTexture(this.cacheKey+"_filtered"),0===t.length)return this._element=this._originalElement,this._filteredEl=null,this._filterScalingX=1,this._filterScalingY=1,this;var e,i=this._originalElement,r=i.naturalWidth||i.width,i=i.naturalHeight||i.height;return this._element===this._originalElement?((e=fabric.util.createCanvasElement()).width=r,e.height=i,this._element=e,this._filteredEl=e):(this._element=this._filteredEl,this._filteredEl.getContext("2d").clearRect(0,0,r,i),this._lastScaleX=1,this._lastScaleY=1),fabric.filterBackend||(fabric.filterBackend=fabric.initFilterBackend()),fabric.filterBackend.applyFilters(t,this._originalElement,r,i,this._element,this.cacheKey),this._originalElement.width===this._element.width&&this._originalElement.height===this._element.height||(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height),this},_render:function(t){fabric.util.setImageSmoothing(t,this.imageSmoothing),!0!==this.isMoving&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(t),this._renderPaintInOrder(t)},drawCacheOnCanvas:function(t){fabric.util.setImageSmoothing(t,this.imageSmoothing),fabric.Object.prototype.drawCacheOnCanvas.call(this,t)},shouldCache:function(){return this.needsItsOwnCache()},_renderFill:function(t){var e,i,r,n,s,o,a,c,h,l,u,f,d,g,p,m=this._element;m&&(e=this._filterScalingX,i=this._filterScalingY,g=this.width,r=this.height,n=Math.min,s=(o=Math.max)(this.cropX,0),o=o(this.cropY,0),p=m.naturalWidth||m.width,a=m.naturalHeight||m.height,h=o*i,l=n(g*e,p-(c=s*e)),u=n(r*i,a-h),f=-g/2,d=-r/2,g=n(g,p/e-s),p=n(r,a/i-o),m&&t.drawImage(m,c,h,l,u,f,d,g,p))},_needsResize:function(){var t=this.getTotalObjectScaling();return t.scaleX!==this._lastScaleX||t.scaleY!==this._lastScaleY},_resetWidthHeight:function(){this.set(this.getOriginalSize())},_initElement:function(t,e){this.setElement(fabric.util.getById(t),e),fabric.util.addClass(this.getElement(),fabric.Image.CSS_CANVAS)},_initConfig:function(t){this.setOptions(t=t||{}),this._setWidthHeight(t)},_initFilters:function(t,e){t&&t.length?fabric.util.enlivenObjects(t,function(t){e&&e(t)},"fabric.Image.filters"):e&&e()},_setWidthHeight:function(t){t=t||{};var e=this.getElement();this.width=t.width||e.naturalWidth||e.width||0,this.height=t.height||e.naturalHeight||e.height||0},parsePreserveAspectRatioAttribute:function(){var t,e=fabric.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio||""),i=this._element.width,r=this._element.height,n=1,s=1,o=0,a=0,c=0,h=0,l=this.width,u=this.height,f={width:l,height:u};return!e||"none"===e.alignX&&"none"===e.alignY?(n=l/i,s=u/r):("meet"===e.meetOrSlice&&(t=(l-i*(n=s=fabric.util.findScaleToFit(this._element,f)))/2,"Min"===e.alignX&&(o=-t),"Max"===e.alignX&&(o=t),t=(u-r*s)/2,"Min"===e.alignY&&(a=-t),"Max"===e.alignY&&(a=t)),"slice"===e.meetOrSlice&&(t=i-l/(n=s=fabric.util.findScaleToCover(this._element,f)),"Mid"===e.alignX&&(c=t/2),"Max"===e.alignX&&(c=t),t=r-u/s,"Mid"===e.alignY&&(h=t/2),"Max"===e.alignY&&(h=t),i=l/n,r=u/s)),{width:i,height:r,scaleX:n,scaleY:s,offsetLeft:o,offsetTop:a,cropX:c,cropY:h}}}),fabric.Image.CSS_CANVAS="canvas-img",fabric.Image.prototype.getSvgSrc=fabric.Image.prototype.getSrc,fabric.Image.fromObject=function(t,i){var r=fabric.util.object.clone(t);fabric.util.loadImage(r.src,function(e,t){t?i&&i(null,!0):fabric.Image.prototype._initFilters.call(r,r.filters,function(t){r.filters=t||[],fabric.Image.prototype._initFilters.call(r,[r.resizeFilter],function(t){r.resizeFilter=t[0],fabric.util.enlivenObjectEnlivables(r,r,function(){var t=new fabric.Image(e,r);i(t,!1)})})})},null,r.crossOrigin)},fabric.Image.fromURL=function(t,i,r){fabric.util.loadImage(t,function(t,e){i&&i(new fabric.Image(t,r),e)},null,r&&r.crossOrigin)},fabric.Image.ATTRIBUTE_NAMES=fabric.SHARED_ATTRIBUTES.concat("x y width height preserveAspectRatio xlink:href crossOrigin image-rendering".split(" ")),fabric.Image.fromElement=function(t,e,i){t=fabric.parseAttributes(t,fabric.Image.ATTRIBUTE_NAMES);fabric.Image.fromURL(t["xlink:href"],e,r(i?fabric.util.object.clone(i):{},t))})}("undefined"!=typeof exports?exports:this),fabric.util.object.extend(fabric.Object.prototype,{_getAngleValueForStraighten:function(){var t=this.angle%360;return 0<t?90*Math.round((t-1)/90):90*Math.round(t/90)},straighten:function(){return this.rotate(this._getAngleValueForStraighten())},fxStraighten:function(t){function e(){}var i=(t=t||{}).onComplete||e,r=t.onChange||e,n=this;return fabric.util.animate({target:this,startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(t){n.rotate(t),r()},onComplete:function(){n.setCoords(),i()}})}}),fabric.util.object.extend(fabric.StaticCanvas.prototype,{straightenObject:function(t){return t.straighten(),this.requestRenderAll(),this},fxStraightenObject:function(t){return t.fxStraighten({onChange:this.requestRenderAllBound})}}),function(){"use strict";function t(t){t&&t.tileSize&&(this.tileSize=t.tileSize),this.setupGLContext(this.tileSize,this.tileSize),this.captureGPUInfo()}fabric.isWebglSupported=function(t){if(fabric.isLikelyNode)return!1;t=t||fabric.WebglFilterBackend.prototype.tileSize;var e,i,r,n=document.createElement("canvas"),s=n.getContext("webgl")||n.getContext("experimental-webgl"),n=!1;if(s){fabric.maxTextureSize=s.getParameter(s.MAX_TEXTURE_SIZE);for(var n=fabric.maxTextureSize>=t,o=["highp","mediump","lowp"],a=0;a<3;a++)if(r=void 0,i="precision "+(i=o[a])+" float;\nvoid main(){}",r=(e=s).createShader(e.FRAGMENT_SHADER),e.shaderSource(r,i),e.compileShader(r),!!e.getShaderParameter(r,e.COMPILE_STATUS)){fabric.webGlPrecision=o[a];break}}return this.isSupported=n},(fabric.WebglFilterBackend=t).prototype={tileSize:2048,resources:{},setupGLContext:function(t,e){this.dispose(),this.createWebGLCanvas(t,e),this.aPosition=new Float32Array([0,0,0,1,1,0,1,1]),this.chooseFastestCopyGLTo2DMethod(t,e)},chooseFastestCopyGLTo2DMethod:function(t,e){var i=void 0!==window.performance;try{new ImageData(1,1),s=!0}catch(t){s=!1}var r="undefined"!=typeof ArrayBuffer,n="undefined"!=typeof Uint8ClampedArray;if(i&&s&&r&&n){var i=fabric.util.createCanvasElement(),s=new ArrayBuffer(t*e*4);if(fabric.forceGLPutImageData)return this.imageBuffer=s,void(this.copyGLTo2D=copyGLTo2DPutImageData);r={imageBuffer:s,destinationWidth:t,destinationHeight:e,targetCanvas:i};i.width=t,i.height=e,n=window.performance.now(),copyGLTo2DDrawImage.call(r,this.gl,r),t=window.performance.now()-n,n=window.performance.now(),copyGLTo2DPutImageData.call(r,this.gl,r),window.performance.now()-n<t?(this.imageBuffer=s,this.copyGLTo2D=copyGLTo2DPutImageData):this.copyGLTo2D=copyGLTo2DDrawImage}},createWebGLCanvas:function(t,e){var i=fabric.util.createCanvasElement(),t=(i.width=t,i.height=e,{alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1}),e=i.getContext("webgl",t);(e=e||i.getContext("experimental-webgl",t))&&(e.clearColor(0,0,0,0),this.canvas=i,this.gl=e)},applyFilters:function(t,e,i,r,n,s){var o,a=this.gl,c=(s&&(o=this.getCachedTexture(s,e)),{originalWidth:e.width||e.originalWidth,originalHeight:e.height||e.originalHeight,sourceWidth:i,sourceHeight:r,destinationWidth:i,destinationHeight:r,context:a,sourceTexture:this.createTexture(a,i,r,!o&&e),targetTexture:this.createTexture(a,i,r),originalTexture:o||this.createTexture(a,i,r,!o&&e),passes:t.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:n}),s=a.createFramebuffer();return a.bindFramebuffer(a.FRAMEBUFFER,s),t.forEach(function(t){t&&t.applyTo(c)}),resizeCanvasIfNeeded(c),this.copyGLTo2D(a,c),a.bindTexture(a.TEXTURE_2D,null),a.deleteTexture(c.sourceTexture),a.deleteTexture(c.targetTexture),a.deleteFramebuffer(s),n.getContext("2d").setTransform(1,0,0,1,0,0),c},dispose:function(){this.canvas&&(this.canvas=null,this.gl=null),this.clearWebGLCaches()},clearWebGLCaches:function(){this.programCache={},this.textureCache={}},createTexture:function(t,e,i,r,n){var s=t.createTexture();return t.bindTexture(t.TEXTURE_2D,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n||t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n||t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),r?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,i,0,t.RGBA,t.UNSIGNED_BYTE,null),s},getCachedTexture:function(t,e){return this.textureCache[t]||(e=this.createTexture(this.gl,e.width,e.height,e),this.textureCache[t]=e)},evictCachesForKey:function(t){this.textureCache[t]&&(this.gl.deleteTexture(this.textureCache[t]),delete this.textureCache[t])},copyGLTo2D:copyGLTo2DDrawImage,captureGPUInfo:function(){if(this.gpuInfo)return this.gpuInfo;var t=this.gl,e={renderer:"",vendor:""};if(!t)return e;var i,r=t.getExtension("WEBGL_debug_renderer_info");return r&&(i=t.getParameter(r.UNMASKED_RENDERER_WEBGL),t=t.getParameter(r.UNMASKED_VENDOR_WEBGL),i&&(e.renderer=i.toLowerCase()),t&&(e.vendor=t.toLowerCase())),this.gpuInfo=e}}}(),function(){"use strict";function t(){}function e(){}(fabric.Canvas2dFilterBackend=e).prototype={evictCachesForKey:t,dispose:t,clearWebGLCaches:t,resources:{},applyFilters:function(t,e,i,r,n){var s=n.getContext("2d");s.drawImage(e,0,0,i,r);var o={sourceWidth:i,sourceHeight:r,imageData:s.getImageData(0,0,i,r),originalEl:e,originalImageData:s.getImageData(0,0,i,r),canvasEl:n,ctx:s,filterBackend:this};return t.forEach(function(t){t.applyTo(o)}),o.imageData.width===i&&o.imageData.height===r||(n.width=o.imageData.width,n.height=o.imageData.height),s.putImageData(o.imageData,0,0),o}}}(),fabric.Image=fabric.Image||{},fabric.Image.filters=fabric.Image.filters||{},fabric.Image.filters.BaseFilter=fabric.util.createClass({type:"BaseFilter",vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvoid main() {\nvTexCoord = aPosition;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nuniform sampler2D uTexture;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\n}",initialize:function(t){t&&this.setOptions(t)},setOptions:function(t){for(var e in t)this[e]=t[e]},createProgram:function(t,e,i){e=e||this.fragmentSource,i=i||this.vertexSource,"highp"!==fabric.webGlPrecision&&(e=e.replace(/precision highp float/g,"precision "+fabric.webGlPrecision+" float"));var r=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(r,i),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS))throw new Error("Vertex shader compile error for "+this.type+": "+t.getShaderInfoLog(r));i=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(i,e),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS))throw new Error("Fragment shader compile error for "+this.type+": "+t.getShaderInfoLog(i));e=t.createProgram();if(t.attachShader(e,r),t.attachShader(e,i),t.linkProgram(e),!t.getProgramParameter(e,t.LINK_STATUS))throw new Error('Shader link error for "${this.type}" '+t.getProgramInfoLog(e));r=this.getAttributeLocations(t,e),i=this.getUniformLocations(t,e)||{};return i.uStepW=t.getUniformLocation(e,"uStepW"),i.uStepH=t.getUniformLocation(e,"uStepH"),{program:e,attributeLocations:r,uniformLocations:i}},getAttributeLocations:function(t,e){return{aPosition:t.getAttribLocation(e,"aPosition")}},getUniformLocations:function(){return{}},sendAttributeData:function(t,e,i){var e=e.aPosition,r=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,r),t.enableVertexAttribArray(e),t.vertexAttribPointer(e,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,i,t.STATIC_DRAW)},_setupFrameBuffer:function(t){var e,i,r=t.context;1<t.passes?(e=t.destinationWidth,i=t.destinationHeight,t.sourceWidth===e&&t.sourceHeight===i||(r.deleteTexture(t.targetTexture),t.targetTexture=t.filterBackend.createTexture(r,e,i)),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t.targetTexture,0)):(r.bindFramebuffer(r.FRAMEBUFFER,null),r.finish())},_swapTextures:function(t){t.passes--,t.pass++;var e=t.targetTexture;t.targetTexture=t.sourceTexture,t.sourceTexture=e},isNeutralState:function(){var t=this.mainParameter,e=fabric.Image.filters[this.type].prototype;if(t){if(Array.isArray(e[t])){for(var i=e[t].length;i--;)if(this[t][i]!==e[t][i])return!1;return!0}return e[t]===this[t]}return!1},applyTo:function(t){t.webgl?(this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)},retrieveShader:function(t){return t.programCache.hasOwnProperty(this.type)||(t.programCache[this.type]=this.createProgram(t.context)),t.programCache[this.type]},applyToWebGL:function(t){var e=t.context,i=this.retrieveShader(t);0===t.pass&&t.originalTexture?e.bindTexture(e.TEXTURE_2D,t.originalTexture):e.bindTexture(e.TEXTURE_2D,t.sourceTexture),e.useProgram(i.program),this.sendAttributeData(e,i.attributeLocations,t.aPosition),e.uniform1f(i.uniformLocations.uStepW,1/t.sourceWidth),e.uniform1f(i.uniformLocations.uStepH,1/t.sourceHeight),this.sendUniformData(e,i.uniformLocations),e.viewport(0,0,t.destinationWidth,t.destinationHeight),e.drawArrays(e.TRIANGLE_STRIP,0,4)},bindAdditionalTexture:function(t,e,i){t.activeTexture(i),t.bindTexture(t.TEXTURE_2D,e),t.activeTexture(t.TEXTURE0)},unbindAdditionalTexture:function(t,e){t.activeTexture(e),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE0)},getMainParameter:function(){return this[this.mainParameter]},setMainParameter:function(t){this[this.mainParameter]=t},sendUniformData:function(){},createHelpLayer:function(t){var e;t.helpLayer||((e=document.createElement("canvas")).width=t.sourceWidth,e.height=t.sourceHeight,t.helpLayer=e)},toObject:function(){var t={type:this.type},e=this.mainParameter;return e&&(t[e]=this[e]),t},toJSON:function(){return this.toObject()}}),fabric.Image.filters.BaseFilter.fromObject=function(t,e){t=new fabric.Image.filters[t.type](t);return e&&e(t),t},function(t){"use strict";var t=t.fabric||(t.fabric={}),e=t.Image.filters,i=t.util.createClass;e.ColorMatrix=i(e.BaseFilter,{type:"ColorMatrix",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nuniform mat4 uColorMatrix;\nuniform vec4 uConstants;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor *= uColorMatrix;\ncolor += uConstants;\ngl_FragColor = color;\n}",matrix:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],mainParameter:"matrix",colorsOnly:!0,initialize:function(t){this.callSuper("initialize",t),this.matrix=this.matrix.slice(0)},applyTo2d:function(t){for(var e,i,r,n,s=t.imageData.data,o=s.length,a=this.matrix,c=this.colorsOnly,h=0;h<o;h+=4)e=s[h],i=s[h+1],r=s[h+2],c?(s[h]=e*a[0]+i*a[1]+r*a[2]+255*a[4],s[h+1]=e*a[5]+i*a[6]+r*a[7]+255*a[9],s[h+2]=e*a[10]+i*a[11]+r*a[12]+255*a[14]):(n=s[h+3],s[h]=e*a[0]+i*a[1]+r*a[2]+n*a[3]+255*a[4],s[h+1]=e*a[5]+i*a[6]+r*a[7]+n*a[8]+255*a[9],s[h+2]=e*a[10]+i*a[11]+r*a[12]+n*a[13]+255*a[14],s[h+3]=e*a[15]+i*a[16]+r*a[17]+n*a[18]+255*a[19])},getUniformLocations:function(t,e){return{uColorMatrix:t.getUniformLocation(e,"uColorMatrix"),uConstants:t.getUniformLocation(e,"uConstants")}},sendUniformData:function(t,e){var i=this.matrix,r=[i[0],i[1],i[2],i[3],i[5],i[6],i[7],i[8],i[10],i[11],i[12],i[13],i[15],i[16],i[17],i[18]],i=[i[4],i[9],i[14],i[19]];t.uniformMatrix4fv(e.uColorMatrix,!1,r),t.uniform4fv(e.uConstants,i)}}),t.Image.filters.ColorMatrix.fromObject=t.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var t=t.fabric||(t.fabric={}),e=t.Image.filters,i=t.util.createClass;e.Brightness=i(e.BaseFilter,{type:"Brightness",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uBrightness;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor.rgb += uBrightness;\ngl_FragColor = color;\n}",brightness:0,mainParameter:"brightness",applyTo2d:function(t){if(0!==this.brightness)for(var e=t.imageData.data,i=e.length,r=Math.round(255*this.brightness),n=0;n<i;n+=4)e[n]=e[n]+r,e[n+1]=e[n+1]+r,e[n+2]=e[n+2]+r},getUniformLocations:function(t,e){return{uBrightness:t.getUniformLocation(e,"uBrightness")}},sendUniformData:function(t,e){t.uniform1f(e.uBrightness,this.brightness)}}),t.Image.filters.Brightness.fromObject=t.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var t=t.fabric||(t.fabric={}),e=t.util.object.extend,i=t.Image.filters,r=t.util.createClass;i.Convolute=r(i.BaseFilter,{type:"Convolute",opaque:!1,matrix:[0,0,0,0,1,0,0,0,0],fragmentSource:{Convolute_3_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[9];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 3.0; h+=1.0) {\nfor (float w = 0.0; w < 3.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_3_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[9];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 3.0; h+=1.0) {\nfor (float w = 0.0; w < 3.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_5_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[25];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 5.0; h+=1.0) {\nfor (float w = 0.0; w < 5.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_5_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[25];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 5.0; h+=1.0) {\nfor (float w = 0.0; w < 5.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_7_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[49];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 7.0; h+=1.0) {\nfor (float w = 0.0; w < 7.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_7_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[49];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 7.0; h+=1.0) {\nfor (float w = 0.0; w < 7.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_9_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[81];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 9.0; h+=1.0) {\nfor (float w = 0.0; w < 9.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_9_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[81];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 9.0; h+=1.0) {\nfor (float w = 0.0; w < 9.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}"},retrieveShader:function(t){var e=Math.sqrt(this.matrix.length),e=this.type+"_"+e+"_"+(this.opaque?1:0),i=this.fragmentSource[e];return t.programCache.hasOwnProperty(e)||(t.programCache[e]=this.createProgram(t.context,i)),t.programCache[e]},applyTo2d:function(t){for(var e,i,r,n,s,o,a,c,h,l,u,f=t.imageData,d=f.data,g=this.matrix,p=Math.round(Math.sqrt(g.length)),m=Math.floor(p/2),v=f.width,b=f.height,f=t.ctx.createImageData(v,b),y=f.data,_=this.opaque?1:0,x=0;x<b;x++)for(h=0;h<v;h++){for(s=4*(x*v+h),u=n=r=i=e=0;u<p;u++)for(l=0;l<p;l++)o=h+l-m,(a=x+u-m)<0||b<=a||o<0||v<=o||(c=g[u*p+l],e+=d[a=4*(a*v+o)]*c,i+=d[1+a]*c,r+=d[2+a]*c,_||(n+=d[3+a]*c));y[s]=e,y[1+s]=i,y[2+s]=r,y[3+s]=_?d[3+s]:n}t.imageData=f},getUniformLocations:function(t,e){return{uMatrix:t.getUniformLocation(e,"uMatrix"),uOpaque:t.getUniformLocation(e,"uOpaque"),uHalfSize:t.getUniformLocation(e,"uHalfSize"),uSize:t.getUniformLocation(e,"uSize")}},sendUniformData:function(t,e){t.uniform1fv(e.uMatrix,this.matrix)},toObject:function(){return e(this.callSuper("toObject"),{opaque:this.opaque,matrix:this.matrix})}}),t.Image.filters.Convolute.fromObject=t.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var t=t.fabric||(t.fabric={}),e=t.Image.filters,i=t.util.createClass;e.Grayscale=i(e.BaseFilter,{type:"Grayscale",fragmentSource:{average:"precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat average = (color.r + color.b + color.g) / 3.0;\ngl_FragColor = vec4(average, average, average, color.a);\n}",lightness:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;\ngl_FragColor = vec4(average, average, average, col.a);\n}",luminosity:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;\ngl_FragColor = vec4(average, average, average, col.a);\n}"},mode:"average",mainParameter:"mode",applyTo2d:function(t){for(var e,i=t.imageData.data,r=i.length,n=this.mode,s=0;s<r;s+=4)"average"===n?e=(i[s]+i[s+1]+i[s+2])/3:"lightness"===n?e=(Math.min(i[s],i[s+1],i[s+2])+Math.max(i[s],i[s+1],i[s+2]))/2:"luminosity"===n&&(e=.21*i[s]+.72*i[s+1]+.07*i[s+2]),i[s]=e,i[s+1]=e,i[s+2]=e},retrieveShader:function(t){var e,i=this.type+"_"+this.mode;return t.programCache.hasOwnProperty(i)||(e=this.fragmentSource[this.mode],t.programCache[i]=this.createProgram(t.context,e)),t.programCache[i]},getUniformLocations:function(t,e){return{uMode:t.getUniformLocation(e,"uMode")}},sendUniformData:function(t,e){t.uniform1i(e.uMode,1)},isNeutralState:function(){return!1}}),t.Image.filters.Grayscale.fromObject=t.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var t=t.fabric||(t.fabric={}),e=t.Image.filters,i=t.util.createClass;e.Invert=i(e.BaseFilter,{type:"Invert",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uInvert;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nif (uInvert == 1) {\ngl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a);\n} else {\ngl_FragColor = color;\n}\n}",invert:!0,mainParameter:"invert",applyTo2d:function(t){for(var e=t.imageData.data,i=e.length,r=0;r<i;r+=4)e[r]=255-e[r],e[r+1]=255-e[r+1],e[r+2]=255-e[r+2]},isNeutralState:function(){return!this.invert},getUniformLocations:function(t,e){return{uInvert:t.getUniformLocation(e,"uInvert")}},sendUniformData:function(t,e){t.uniform1i(e.uInvert,this.invert)}}),t.Image.filters.Invert.fromObject=t.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var t=t.fabric||(t.fabric={}),e=t.util.object.extend,i=t.Image.filters,r=t.util.createClass;i.Noise=r(i.BaseFilter,{type:"Noise",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uStepH;\nuniform float uNoise;\nuniform float uSeed;\nvarying vec2 vTexCoord;\nfloat rand(vec2 co, float seed, float vScale) {\nreturn fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0);\n}\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise;\ngl_FragColor = color;\n}",mainParameter:"noise",noise:0,applyTo2d:function(t){if(0!==this.noise)for(var e,i=t.imageData.data,r=(i.length,this.noise),n=0,s=i.length;n<s;n+=4)e=(.5-Math.random())*r,i[n]+=e,i[n+1]+=e,i[n+2]+=e},getUniformLocations:function(t,e){return{uNoise:t.getUniformLocation(e,"uNoise"),uSeed:t.getUniformLocation(e,"uSeed")}},sendUniformData:function(t,e){t.uniform1f(e.uNoise,this.noise/255),t.uniform1f(e.uSeed,Math.random())},toObject:function(){return e(this.callSuper("toObject"),{noise:this.noise})}}),t.Image.filters.Noise.fromObject=t.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var t=t.fabric||(t.fabric={}),e=t.Image.filters,i=t.util.createClass;e.Pixelate=i(e.BaseFilter,{type:"Pixelate",blocksize:4,mainParameter:"blocksize",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uBlocksize;\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nfloat blockW = uBlocksize * uStepW;\nfloat blockH = uBlocksize * uStepW;\nint posX = int(vTexCoord.x / blockW);\nint posY = int(vTexCoord.y / blockH);\nfloat fposX = float(posX);\nfloat fposY = float(posY);\nvec2 squareCoords = vec2(fposX * blockW, fposY * blockH);\nvec4 color = texture2D(uTexture, squareCoords);\ngl_FragColor = color;\n}",applyTo2d:function(t){for(var e,i,r,n,s,o,a,c,h,l,t=t.imageData,u=t.data,f=t.height,d=t.width,g=0;g<f;g+=this.blocksize)for(i=0;i<d;i+=this.blocksize)for(r=u[e=4*g*d+4*i],n=u[1+e],s=u[2+e],o=u[3+e],h=Math.min(g+this.blocksize,f),l=Math.min(i+this.blocksize,d),a=g;a<h;a++)for(c=i;c<l;c++)u[e=4*a*d+4*c]=r,u[1+e]=n,u[2+e]=s,u[3+e]=o},isNeutralState:function(){return 1===this.blocksize},getUniformLocations:function(t,e){return{uBlocksize:t.getUniformLocation(e,"uBlocksize"),uStepW:t.getUniformLocation(e,"uStepW"),uStepH:t.getUniformLocation(e,"uStepH")}},sendUniformData:function(t,e){t.uniform1f(e.uBlocksize,this.blocksize)}}),t.Image.filters.Pixelate.fromObject=t.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var h=t.fabric||(t.fabric={}),e=h.util.object.extend,t=h.Image.filters,i=h.util.createClass;t.RemoveColor=i(t.BaseFilter,{type:"RemoveColor",color:"#FFFFFF",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uLow;\nuniform vec4 uHigh;\nvarying vec2 vTexCoord;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\nif(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {\ngl_FragColor.a = 0.0;\n}\n}",distance:.02,useAlpha:!1,applyTo2d:function(t){for(var e,i,r,n=t.imageData.data,t=255*this.distance,s=new h.Color(this.color).getSource(),o=[s[0]-t,s[1]-t,s[2]-t],a=[s[0]+t,s[1]+t,s[2]+t],c=0;c<n.length;c+=4)e=n[c],i=n[c+1],r=n[c+2],o[0]<e&&o[1]<i&&o[2]<r&&e<a[0]&&i<a[1]&&r<a[2]&&(n[c+3]=0)},getUniformLocations:function(t,e){return{uLow:t.getUniformLocation(e,"uLow"),uHigh:t.getUniformLocation(e,"uHigh")}},sendUniformData:function(t,e){var i=new h.Color(this.color).getSource(),r=parseFloat(this.distance),n=[0+i[0]/255-r,0+i[1]/255-r,0+i[2]/255-r,1],i=[i[0]/255+r,i[1]/255+r,i[2]/255+r,1];t.uniform4fv(e.uLow,n),t.uniform4fv(e.uHigh,i)},toObject:function(){return e(this.callSuper("toObject"),{color:this.color,distance:this.distance})}}),h.Image.filters.RemoveColor.fromObject=h.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e,i=t.fabric||(t.fabric={}),r=i.Image.filters,n=i.util.createClass,s={Brownie:[.5997,.34553,-.27082,0,.186,-.0377,.86095,.15059,0,-.1449,.24113,-.07441,.44972,0,-.02965,0,0,0,1,0],Vintage:[.62793,.32021,-.03965,0,.03784,.02578,.64411,.03259,0,.02926,.0466,-.08512,.52416,0,.02023,0,0,0,1,0],Kodachrome:[1.12855,-.39673,-.03992,0,.24991,-.16404,1.08352,-.05498,0,.09698,-.16786,-.56034,1.60148,0,.13972,0,0,0,1,0],Technicolor:[1.91252,-.85453,-.09155,0,.04624,-.30878,1.76589,-.10601,0,-.27589,-.2311,-.75018,1.84759,0,.12137,0,0,0,1,0],Polaroid:[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],Sepia:[.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0],BlackWhite:[1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,0,0,0,1,0]};for(e in s)r[e]=n(r.ColorMatrix,{type:e,matrix:s[e],mainParameter:!1,colorsOnly:!0}),i.Image.filters[e].fromObject=i.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var u=t.fabric,t=u.Image.filters,e=u.util.createClass;t.BlendColor=e(t.BaseFilter,{type:"BlendColor",color:"#F95C63",mode:"multiply",alpha:1,fragmentSource:{multiply:"gl_FragColor.rgb *= uColor.rgb;\n",screen:"gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);\n",add:"gl_FragColor.rgb += uColor.rgb;\n",diff:"gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);\n",subtract:"gl_FragColor.rgb -= uColor.rgb;\n",lighten:"gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);\n",darken:"gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);\n",exclusion:"gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);\n",overlay:"if (uColor.r < 0.5) {\ngl_FragColor.r *= 2.0 * uColor.r;\n} else {\ngl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);\n}\nif (uColor.g < 0.5) {\ngl_FragColor.g *= 2.0 * uColor.g;\n} else {\ngl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);\n}\nif (uColor.b < 0.5) {\ngl_FragColor.b *= 2.0 * uColor.b;\n} else {\ngl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);\n}\n",tint:"gl_FragColor.rgb *= (1.0 - uColor.a);\ngl_FragColor.rgb += uColor.rgb;\n"},buildSource:function(t){return"precision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ngl_FragColor = color;\nif (color.a > 0.0) {\n"+this.fragmentSource[t]+"}\n}"},retrieveShader:function(t){var e,i=this.type+"_"+this.mode;return t.programCache.hasOwnProperty(i)||(e=this.buildSource(this.mode),t.programCache[i]=this.createProgram(t.context,e)),t.programCache[i]},applyTo2d:function(t){for(var e,i,r,n=t.imageData.data,s=n.length,o=1-this.alpha,t=new u.Color(this.color).getSource(),a=t[0]*this.alpha,c=t[1]*this.alpha,h=t[2]*this.alpha,l=0;l<s;l+=4)switch(e=n[l],i=n[l+1],r=n[l+2],this.mode){case"multiply":n[l]=e*a/255,n[l+1]=i*c/255,n[l+2]=r*h/255;break;case"screen":n[l]=255-(255-e)*(255-a)/255,n[l+1]=255-(255-i)*(255-c)/255,n[l+2]=255-(255-r)*(255-h)/255;break;case"add":n[l]=e+a,n[l+1]=i+c,n[l+2]=r+h;break;case"diff":case"difference":n[l]=Math.abs(e-a),n[l+1]=Math.abs(i-c),n[l+2]=Math.abs(r-h);break;case"subtract":n[l]=e-a,n[l+1]=i-c,n[l+2]=r-h;break;case"darken":n[l]=Math.min(e,a),n[l+1]=Math.min(i,c),n[l+2]=Math.min(r,h);break;case"lighten":n[l]=Math.max(e,a),n[l+1]=Math.max(i,c),n[l+2]=Math.max(r,h);break;case"overlay":n[l]=a<128?2*e*a/255:255-2*(255-e)*(255-a)/255,n[l+1]=c<128?2*i*c/255:255-2*(255-i)*(255-c)/255,n[l+2]=h<128?2*r*h/255:255-2*(255-r)*(255-h)/255;break;case"exclusion":n[l]=a+e-2*a*e/255,n[l+1]=c+i-2*c*i/255,n[l+2]=h+r-2*h*r/255;break;case"tint":n[l]=a+e*o,n[l+1]=c+i*o,n[l+2]=h+r*o}},getUniformLocations:function(t,e){return{uColor:t.getUniformLocation(e,"uColor")}},sendUniformData:function(t,e){var i=new u.Color(this.color).getSource();i[0]=this.alpha*i[0]/255,i[1]=this.alpha*i[1]/255,i[2]=this.alpha*i[2]/255,i[3]=this.alpha,t.uniform4fv(e.uColor,i)},toObject:function(){return{type:this.type,color:this.color,mode:this.mode,alpha:this.alpha}}}),u.Image.filters.BlendColor.fromObject=u.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var v=t.fabric,t=v.Image.filters,e=v.util.createClass;t.BlendImage=e(t.BaseFilter,{type:"BlendImage",image:null,mode:"multiply",alpha:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:{multiply:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec4 color2 = texture2D(uImage, vTexCoord2);\ncolor.rgba *= color2.rgba;\ngl_FragColor = color;\n}",mask:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec4 color2 = texture2D(uImage, vTexCoord2);\ncolor.a = color2.a;\ngl_FragColor = color;\n}"},retrieveShader:function(t){var e=this.type+"_"+this.mode,i=this.fragmentSource[this.mode];return t.programCache.hasOwnProperty(e)||(t.programCache[e]=this.createProgram(t.context,i)),t.programCache[e]},applyToWebGL:function(t){var e=t.context,i=this.createTexture(t.filterBackend,this.image);this.bindAdditionalTexture(e,i,e.TEXTURE1),this.callSuper("applyToWebGL",t),this.unbindAdditionalTexture(e,e.TEXTURE1)},createTexture:function(t,e){return t.getCachedTexture(e.cacheKey,e._element)},calculateMatrix:function(){var t=this.image,e=t._element.width,i=t._element.height;return[1/t.scaleX,0,0,0,1/t.scaleY,0,-t.left/e,-t.top/i,1]},applyTo2d:function(t){var e,i,r,n,s,o,a,c,h,l=t.imageData,t=t.filterBackend.resources,u=l.data,f=u.length,d=l.width,l=l.height,g=this.image;t.blendImage||(t.blendImage=v.util.createCanvasElement()),h=(t=t.blendImage).getContext("2d"),t.width!==d||t.height!==l?(t.width=d,t.height=l):h.clearRect(0,0,d,l),h.setTransform(g.scaleX,0,0,g.scaleY,g.left,g.top),h.drawImage(g._element,0,0,d,l);for(var p=h.getImageData(0,0,d,l).data,m=0;m<f;m+=4)switch(s=u[m],o=u[m+1],a=u[m+2],c=u[m+3],e=p[m],i=p[m+1],r=p[m+2],n=p[m+3],this.mode){case"multiply":u[m]=s*e/255,u[m+1]=o*i/255,u[m+2]=a*r/255,u[m+3]=c*n/255;break;case"mask":u[m+3]=n}},getUniformLocations:function(t,e){return{uTransformMatrix:t.getUniformLocation(e,"uTransformMatrix"),uImage:t.getUniformLocation(e,"uImage")}},sendUniformData:function(t,e){var i=this.calculateMatrix();t.uniform1i(e.uImage,1),t.uniformMatrix3fv(e.uTransformMatrix,!1,i)},toObject:function(){return{type:this.type,image:this.image&&this.image.toObject(),mode:this.mode,alpha:this.alpha}}}),v.Image.filters.BlendImage.fromObject=function(i,r){v.Image.fromObject(i.image,function(t){var e=v.util.object.clone(i);e.image=t,r(new v.Image.filters.BlendImage(e))})}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var m=t.fabric||(t.fabric={}),j=Math.pow,A=Math.floor,D=Math.sqrt,M=Math.abs,o=Math.round,r=Math.sin,F=Math.ceil,t=m.Image.filters,e=m.util.createClass;t.Resize=e(t.BaseFilter,{type:"Resize",resizeType:"hermite",scaleX:1,scaleY:1,lanczosLobes:3,getUniformLocations:function(t,e){return{uDelta:t.getUniformLocation(e,"uDelta"),uTaps:t.getUniformLocation(e,"uTaps")}},sendUniformData:function(t,e){t.uniform2fv(e.uDelta,this.horizontal?[1/this.width,0]:[0,1/this.height]),t.uniform1fv(e.uTaps,this.taps)},retrieveShader:function(t){var e=this.getFilterWindow(),i=this.type+"_"+e;return t.programCache.hasOwnProperty(i)||(e=this.generateShader(e),t.programCache[i]=this.createProgram(t.context,e)),t.programCache[i]},getFilterWindow:function(){var t=this.tempScale;return Math.ceil(this.lanczosLobes/t)},getTaps:function(){for(var t=this.lanczosCreate(this.lanczosLobes),e=this.tempScale,i=this.getFilterWindow(),r=new Array(i),n=1;n<=i;n++)r[n-1]=t(n*e);return r},generateShader:function(t){for(var e=new Array(t),i=this.fragmentSourceTOP,r=1;r<=t;r++)e[r-1]=r+".0 * uDelta";return i=(i=i+("uniform float uTaps["+t+"];\n")+"void main() {\n")+"  vec4 color = texture2D(uTexture, vTexCoord);\n"+"  float sum = 1.0;\n",e.forEach(function(t,e){i=(i+="  color += texture2D(uTexture, vTexCoord + "+t+") * uTaps["+e+"];\n")+"  color += texture2D(uTexture, vTexCoord - "+t+") * uTaps["+e+"];\n  sum += 2.0 * uTaps["+e+"];\n"}),i=i+"  gl_FragColor = color / sum;\n"+"}"},fragmentSourceTOP:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\n",applyTo:function(t){t.webgl?(t.passes++,this.width=t.sourceWidth,this.horizontal=!0,this.dW=Math.round(this.width*this.scaleX),this.dH=t.sourceHeight,this.tempScale=this.dW/this.width,this.taps=this.getTaps(),t.destinationWidth=this.dW,this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t),t.sourceWidth=t.destinationWidth,this.height=t.sourceHeight,this.horizontal=!1,this.dH=Math.round(this.height*this.scaleY),this.tempScale=this.dH/this.height,this.taps=this.getTaps(),t.destinationHeight=this.dH,this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t),t.sourceHeight=t.destinationHeight):this.applyTo2d(t)},isNeutralState:function(){return 1===this.scaleX&&1===this.scaleY},lanczosCreate:function(i){return function(t){if(i<=t||t<=-i)return 0;if(t<1.1920929e-7&&-1.1920929e-7<t)return 1;var e=(t*=Math.PI)/i;return r(t)/t*r(e)/e}},applyTo2d:function(t){var e,i=t.imageData,r=this.scaleX,n=this.scaleY,s=(this.rcpScaleX=1/r,this.rcpScaleY=1/n,i.width),i=i.height,r=o(s*r),n=o(i*n);"sliceHack"===this.resizeType?e=this.sliceByTwo(t,s,i,r,n):"hermite"===this.resizeType?e=this.hermiteFastResize(t,s,i,r,n):"bilinear"===this.resizeType?e=this.bilinearFiltering(t,s,i,r,n):"lanczos"===this.resizeType&&(e=this.lanczosResize(t,s,i,r,n)),t.imageData=e},sliceByTwo:function(t,e,i,r,n){var s,o,t=t.imageData,a=!1,c=!1,h=.5*e,l=.5*i,u=m.filterBackend.resources,f=0,d=0,g=e,p=0;for(u.sliceByTwo||(u.sliceByTwo=document.createElement("canvas")),((s=u.sliceByTwo).width<1.5*e||s.height<i)&&(s.width=1.5*e,s.height=i),(o=s.getContext("2d")).clearRect(0,0,1.5*e,i),o.putImageData(t,0,0),r=A(r),n=A(n);!a||!c;)i=l,r<A(.5*(e=h))?h=A(.5*h):(h=r,a=!0),n<A(.5*l)?l=A(.5*l):(l=n,c=!0),o.drawImage(s,f,d,e,i,g,p,h,l),f=g,d=p,p+=l;return o.getImageData(f,d,r,n)},lanczosResize:function(t,d,g,p,m){var v=t.imageData.data,b=t.ctx.createImageData(p,m),y=b.data,_=this.lanczosCreate(this.lanczosLobes),x=this.rcpScaleX,C=this.rcpScaleY,S=2/this.rcpScaleX,T=2/this.rcpScaleY,w=F(x*this.lanczosLobes/2),O=F(C*this.lanczosLobes/2),P={},k={},E={};return function t(e){var i,r,n,s,o,a,c,h,l,u;for(k.x=(e+.5)*x,E.x=A(k.x),i=0;i<m;i++){for(k.y=(i+.5)*C,E.y=A(k.y),h=c=a=o=s=0,r=E.x-w;r<=E.x+w;r++)if(!(r<0||d<=r)){l=A(1e3*M(r-k.x)),P[l]||(P[l]={});for(var f=E.y-O;f<=E.y+O;f++)f<0||g<=f||(u=A(1e3*M(f-k.y)),P[l][u]||(P[l][u]=_(D(j(l*S,2)+j(u*T,2))/1e3)),0<(u=P[l][u])&&(s+=u,o+=u*v[n=4*(f*d+r)],a+=u*v[n+1],c+=u*v[n+2],h+=u*v[n+3]))}y[n=4*(i*p+e)]=o/s,y[n+1]=a/s,y[n+2]=c/s,y[n+3]=h/s}return++e<p?t(e):b}(0)},bilinearFiltering:function(t,e,i,r,n){for(var s,o,a,c,h,l,u,f,d,g,p,m=0,v=this.rcpScaleX,b=this.rcpScaleY,y=4*(e-1),_=t.imageData.data,t=t.ctx.createImageData(r,n),x=t.data,C=0;C<n;C++)for(u=0;u<r;u++)for(f=v*u-(h=A(v*u)),d=b*C-(l=A(b*C)),p=4*(l*e+h),g=0;g<4;g++)s=_[p+g],o=_[4+p+g],a=_[p+y+g],c=_[p+y+4+g],x[m++]=s*(1-f)*(1-d)+o*f*(1-d)+a*d*(1-f)+c*f*d;return t},hermiteFastResize:function(t,e,i,r,n){for(var s=this.rcpScaleX,o=this.rcpScaleY,a=F(s/2),c=F(o/2),h=t.imageData.data,t=t.ctx.createImageData(r,n),l=t.data,u=0;u<n;u++)for(var f=0;f<r;f++){for(var d=4*(f+u*r),g=0,p=0,m=0,v=0,b=0,y=0,_=0,x=(u+.5)*o,C=A(u*o);C<(u+1)*o;C++)for(var S=M(x-(C+.5))/c,T=(f+.5)*s,w=S*S,O=A(f*s);O<(f+1)*s;O++){var P=M(T-(O+.5))/a,k=D(w+P*P);1<k&&k<-1||0<(g=2*k*k*k-3*k*k+1)&&(_+=g*h[3+(P=4*(O+C*e))],m+=g,v+=(g=h[3+P]<255?g*h[3+P]/250:g)*h[P],b+=g*h[1+P],y+=g*h[2+P],p+=g)}l[d]=v/p,l[1+d]=b/p,l[2+d]=y/p,l[3+d]=_/m}return t},toObject:function(){return{type:this.type,scaleX:this.scaleX,scaleY:this.scaleY,resizeType:this.resizeType,lanczosLobes:this.lanczosLobes}}}),m.Image.filters.Resize.fromObject=m.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var t=t.fabric||(t.fabric={}),e=t.Image.filters,i=t.util.createClass;e.Contrast=i(e.BaseFilter,{type:"Contrast",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uContrast;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));\ncolor.rgb = contrastF * (color.rgb - 0.5) + 0.5;\ngl_FragColor = color;\n}",contrast:0,mainParameter:"contrast",applyTo2d:function(t){if(0!==this.contrast)for(var e=t.imageData.data,i=e.length,t=Math.floor(255*this.contrast),r=259*(t+255)/(255*(259-t)),n=0;n<i;n+=4)e[n]=r*(e[n]-128)+128,e[n+1]=r*(e[n+1]-128)+128,e[n+2]=r*(e[n+2]-128)+128},getUniformLocations:function(t,e){return{uContrast:t.getUniformLocation(e,"uContrast")}},sendUniformData:function(t,e){t.uniform1f(e.uContrast,this.contrast)}}),t.Image.filters.Contrast.fromObject=t.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var t=t.fabric||(t.fabric={}),e=t.Image.filters,i=t.util.createClass;e.Saturation=i(e.BaseFilter,{type:"Saturation",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uSaturation;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat rgMax = max(color.r, color.g);\nfloat rgbMax = max(rgMax, color.b);\ncolor.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;\ncolor.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;\ncolor.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;\ngl_FragColor = color;\n}",saturation:0,mainParameter:"saturation",applyTo2d:function(t){if(0!==this.saturation)for(var e,i=t.imageData.data,r=i.length,n=-this.saturation,s=0;s<r;s+=4)e=Math.max(i[s],i[s+1],i[s+2]),i[s]+=e!==i[s]?(e-i[s])*n:0,i[s+1]+=e!==i[s+1]?(e-i[s+1])*n:0,i[s+2]+=e!==i[s+2]?(e-i[s+2])*n:0},getUniformLocations:function(t,e){return{uSaturation:t.getUniformLocation(e,"uSaturation")}},sendUniformData:function(t,e){t.uniform1f(e.uSaturation,-this.saturation)}}),t.Image.filters.Saturation.fromObject=t.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var t=t.fabric||(t.fabric={}),e=t.Image.filters,i=t.util.createClass;e.Vibrance=i(e.BaseFilter,{type:"Vibrance",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uVibrance;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat max = max(color.r, max(color.g, color.b));\nfloat avg = (color.r + color.g + color.b) / 3.0;\nfloat amt = (abs(max - avg) * 2.0) * uVibrance;\ncolor.r += max != color.r ? (max - color.r) * amt : 0.00;\ncolor.g += max != color.g ? (max - color.g) * amt : 0.00;\ncolor.b += max != color.b ? (max - color.b) * amt : 0.00;\ngl_FragColor = color;\n}",vibrance:0,mainParameter:"vibrance",applyTo2d:function(t){if(0!==this.vibrance)for(var e,i,r=t.imageData.data,n=r.length,s=-this.vibrance,o=0;o<n;o+=4)e=Math.max(r[o],r[o+1],r[o+2]),i=(r[o]+r[o+1]+r[o+2])/3,i=2*Math.abs(e-i)/255*s,r[o]+=e!==r[o]?(e-r[o])*i:0,r[o+1]+=e!==r[o+1]?(e-r[o+1])*i:0,r[o+2]+=e!==r[o+2]?(e-r[o+2])*i:0},getUniformLocations:function(t,e){return{uVibrance:t.getUniformLocation(e,"uVibrance")}},sendUniformData:function(t,e){t.uniform1f(e.uVibrance,-this.vibrance)}}),t.Image.filters.Vibrance.fromObject=t.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var d=t.fabric||(t.fabric={}),t=d.Image.filters,e=d.util.createClass;t.Blur=e(t.BaseFilter,{type:"Blur",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\nconst float nSamples = 15.0;\nvec3 v3offset = vec3(12.9898, 78.233, 151.7182);\nfloat random(vec3 scale) {\nreturn fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);\n}\nvoid main() {\nvec4 color = vec4(0.0);\nfloat total = 0.0;\nfloat offset = random(v3offset);\nfor (float t = -nSamples; t <= nSamples; t++) {\nfloat percent = (t + offset - 0.5) / nSamples;\nfloat weight = 1.0 - abs(percent);\ncolor += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;\ntotal += weight;\n}\ngl_FragColor = color / total;\n}",blur:0,mainParameter:"blur",applyTo:function(t){t.webgl?(this.aspectRatio=t.sourceWidth/t.sourceHeight,t.passes++,this._setupFrameBuffer(t),this.horizontal=!0,this.applyToWebGL(t),this._swapTextures(t),this._setupFrameBuffer(t),this.horizontal=!1,this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)},applyTo2d:function(t){t.imageData=this.simpleBlur(t)},simpleBlur:function(t){var e,i,r,n,s,o,a=t.filterBackend.resources,c=t.imageData.width,h=t.imageData.height,l=(a.blurLayer1||(a.blurLayer1=d.util.createCanvasElement(),a.blurLayer2=d.util.createCanvasElement()),e=a.blurLayer1,i=a.blurLayer2,e.width===c&&e.height===h||(i.width=e.width=c,i.height=e.height=h),e.getContext("2d")),u=i.getContext("2d"),f=.06*this.blur*.5;for(l.putImageData(t.imageData,0,0),u.clearRect(0,0,c,h),o=-15;o<=15;o++)s=f*(n=o/15)*c+(r=(Math.random()-.5)/4),u.globalAlpha=1-Math.abs(n),u.drawImage(e,s,r),l.drawImage(i,0,0),u.globalAlpha=1,u.clearRect(0,0,i.width,i.height);for(o=-15;o<=15;o++)s=f*(n=o/15)*h+(r=(Math.random()-.5)/4),u.globalAlpha=1-Math.abs(n),u.drawImage(e,r,s),l.drawImage(i,0,0),u.globalAlpha=1,u.clearRect(0,0,i.width,i.height);t.ctx.drawImage(e,0,0);a=t.ctx.getImageData(0,0,e.width,e.height);return l.globalAlpha=1,l.clearRect(0,0,e.width,e.height),a},getUniformLocations:function(t,e){return{delta:t.getUniformLocation(e,"uDelta")}},sendUniformData:function(t,e){var i=this.chooseRightDelta();t.uniform2fv(e.delta,i)},chooseRightDelta:function(){var t=1,e=[0,0];return this.horizontal?1<this.aspectRatio&&(t=1/this.aspectRatio):this.aspectRatio<1&&(t=this.aspectRatio),t=t*this.blur*.12,this.horizontal?e[0]=t:e[1]=t,e}}),t.Blur.fromObject=d.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var t=t.fabric||(t.fabric={}),e=t.Image.filters,i=t.util.createClass;e.Gamma=i(e.BaseFilter,{type:"Gamma",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec3 uGamma;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec3 correction = (1.0 / uGamma);\ncolor.r = pow(color.r, correction.r);\ncolor.g = pow(color.g, correction.g);\ncolor.b = pow(color.b, correction.b);\ngl_FragColor = color;\ngl_FragColor.rgb *= color.a;\n}",gamma:[1,1,1],mainParameter:"gamma",initialize:function(t){this.gamma=[1,1,1],e.BaseFilter.prototype.initialize.call(this,t)},applyTo2d:function(t){var e,i=t.imageData.data,t=this.gamma,r=i.length,n=1/t[0],s=1/t[1],o=1/t[2];for(this.rVals||(this.rVals=new Uint8Array(256),this.gVals=new Uint8Array(256),this.bVals=new Uint8Array(256)),e=0,r=256;e<r;e++)this.rVals[e]=255*Math.pow(e/255,n),this.gVals[e]=255*Math.pow(e/255,s),this.bVals[e]=255*Math.pow(e/255,o);for(e=0,r=i.length;e<r;e+=4)i[e]=this.rVals[i[e]],i[e+1]=this.gVals[i[e+1]],i[e+2]=this.bVals[i[e+2]]},getUniformLocations:function(t,e){return{uGamma:t.getUniformLocation(e,"uGamma")}},sendUniformData:function(t,e){t.uniform3fv(e.uGamma,this.gamma)}}),t.Image.filters.Gamma.fromObject=t.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var i=t.fabric||(t.fabric={}),t=i.Image.filters,e=i.util.createClass;t.Composed=e(t.BaseFilter,{type:"Composed",subFilters:[],initialize:function(t){this.callSuper("initialize",t),this.subFilters=this.subFilters.slice(0)},applyTo:function(e){e.passes+=this.subFilters.length-1,this.subFilters.forEach(function(t){t.applyTo(e)})},toObject:function(){return i.util.object.extend(this.callSuper("toObject"),{subFilters:this.subFilters.map(function(t){return t.toObject()})})},isNeutralState:function(){return!this.subFilters.some(function(t){return!t.isNeutralState()})}}),i.Image.filters.Composed.fromObject=function(t,e){t=(t.subFilters||[]).map(function(t){return new i.Image.filters[t.type](t)}),t=new i.Image.filters.Composed({subFilters:t});return e&&e(t),t}}("undefined"!=typeof exports?exports:this),function(t){"use strict";var r=t.fabric||(t.fabric={}),e=r.Image.filters,t=r.util.createClass;e.HueRotation=t(e.ColorMatrix,{type:"HueRotation",rotation:0,mainParameter:"rotation",calculateMatrix:function(){var t=this.rotation*Math.PI,e=r.util.cos(t),t=r.util.sin(t),t=Math.sqrt(1/3)*t,i=1-e;this.matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],this.matrix[0]=e+i/3,this.matrix[1]=1/3*i-t,this.matrix[2]=1/3*i+t,this.matrix[5]=1/3*i+t,this.matrix[6]=e+1/3*i,this.matrix[7]=1/3*i-t,this.matrix[10]=1/3*i-t,this.matrix[11]=1/3*i+t,this.matrix[12]=e+1/3*i},isNeutralState:function(t){return this.calculateMatrix(),e.BaseFilter.prototype.isNeutralState.call(this,t)},applyTo:function(t){this.calculateMatrix(),e.BaseFilter.prototype.applyTo.call(this,t)}}),r.Image.filters.HueRotation.fromObject=r.Image.filters.BaseFilter.fromObject}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e,x=t.fabric||(t.fabric={}),o=x.util.object.clone;x.Text?x.warn("fabric.Text is already defined"):(e="fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide pathAlign".split(" "),x.Text=x.util.createClass(x.Object,{_dimensionAffectingProps:["fontSize","fontWeight","fontFamily","fontStyle","lineHeight","text","charSpacing","textAlign","styles","path","pathStartOffset","pathSide","pathAlign"],_reNewline:/\r?\n/,_reSpacesAndTabs:/[ \t\r]/g,_reSpaceAndTab:/[ \t\r]/,_reWords:/\S+/g,type:"text",fontSize:40,fontWeight:"normal",fontFamily:"Times New Roman",underline:!1,overline:!1,linethrough:!1,textAlign:"left",fontStyle:"normal",lineHeight:1.16,superscript:{size:.6,baseline:-.35},subscript:{size:.6,baseline:.11},textBackgroundColor:"",stateProperties:x.Object.prototype.stateProperties.concat(e),cacheProperties:x.Object.prototype.cacheProperties.concat(e),stroke:null,shadow:null,path:null,pathStartOffset:0,pathSide:"left",pathAlign:"baseline",_fontSizeFraction:.222,offsets:{underline:.1,linethrough:-.315,overline:-.88},_fontSizeMult:1.13,charSpacing:0,styles:null,_measuringContext:null,deltaY:0,direction:"ltr",_styleProperties:["stroke","strokeWidth","fill","fontFamily","fontSize","fontWeight","fontStyle","underline","overline","linethrough","deltaY","textBackgroundColor"],__charBounds:[],CACHE_FONT_SIZE:400,MIN_TEXT_WIDTH:2,initialize:function(t,e){this.styles=e&&e.styles||{},this.text=t,this.__skipDimension=!0,this.callSuper("initialize",e),this.path&&this.setPathInfo(),this.__skipDimension=!1,this.initDimensions(),this.setCoords(),this.setupState({propertySet:"_dimensionAffectingProps"})},setPathInfo:function(){var t=this.path;t&&(t.segmentsInfo=x.util.getPathSegmentsInfo(t.path))},getMeasuringContext:function(){return x._measuringContext||(x._measuringContext=this.canvas&&this.canvas.contextCache||x.util.createCanvasElement().getContext("2d")),x._measuringContext},_splitText:function(){var t=this._splitTextIntoLines(this.text);return this.textLines=t.lines,this._textLines=t.graphemeLines,this._unwrappedTextLines=t._unwrappedLines,this._text=t.graphemeText,t},initDimensions:function(){this.__skipDimension||(this._splitText(),this._clearCache(),this.path?(this.width=this.path.width,this.height=this.path.height):(this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.height=this.calcTextHeight()),-1!==this.textAlign.indexOf("justify")&&this.enlargeSpaces(),this.saveState({propertySet:"_dimensionAffectingProps"}))},enlargeSpaces:function(){for(var t,e,i,r,n,s=0,o=this._textLines.length;s<o;s++)if(("justify"===this.textAlign||s!==o-1&&!this.isEndOfWrapping(s))&&(e=0,i=this._textLines[s],(t=this.getLineWidth(s))<this.width&&(n=this.textLines[s].match(this._reSpacesAndTabs))))for(var a=n.length,c=(this.width-t)/a,h=0,l=i.length;h<=l;h++)r=this.__charBounds[s][h],this._reSpaceAndTab.test(i[h])?(r.width+=c,r.kernedWidth+=c,r.left+=e,e+=c):r.left+=e},isEndOfWrapping:function(t){return t===this._textLines.length-1},missingNewlineOffset:function(){return 1},toString:function(){return"#<fabric.Text ("+this.complexity()+'): { "text": "'+this.text+'", "fontFamily": "'+this.fontFamily+'" }>'},_getCacheCanvasDimensions:function(){var t=this.callSuper("_getCacheCanvasDimensions"),e=this.fontSize;return t.width+=e*t.zoomX,t.height+=e*t.zoomY,t},_render:function(t){var e=this.path;e&&!e.isNotVisible()&&e._render(t),this._setTextStyles(t),this._renderTextLinesBackground(t),this._renderTextDecoration(t,"underline"),this._renderText(t),this._renderTextDecoration(t,"overline"),this._renderTextDecoration(t,"linethrough")},_renderText:function(t){"stroke"===this.paintFirst?(this._renderTextStroke(t),this._renderTextFill(t)):(this._renderTextFill(t),this._renderTextStroke(t))},_setTextStyles:function(t,e,i){if(t.textBaseline="alphabetical",this.path)switch(this.pathAlign){case"center":t.textBaseline="middle";break;case"ascender":t.textBaseline="top";break;case"descender":t.textBaseline="bottom"}t.font=this._getFontDeclaration(e,i)},calcTextWidth:function(){for(var t=this.getLineWidth(0),e=1,i=this._textLines.length;e<i;e++){var r=this.getLineWidth(e);t<r&&(t=r)}return t},_renderTextLine:function(t,e,i,r,n,s){this._renderChars(t,e,i,r,n,s)},_renderTextLinesBackground:function(t){if(this.textBackgroundColor||this.styleHas("textBackgroundColor")){for(var e,i,r,n,s=t.fillStyle,o=this._getLeftOffset(),a=this._getTopOffset(),c=0,h=0,l=this.path,u=0,f=this._textLines.length;u<f;u++)if(e=this.getHeightOfLine(u),this.textBackgroundColor||this.styleHas("textBackgroundColor",u)){for(var d=this._textLines[u],g=this._getLineLeftOffset(u),h=0,c=0,p=this.getValueOfPropertyAt(u,0,"textBackgroundColor"),m=0,v=d.length;m<v;m++)i=this.__charBounds[u][m],r=this.getValueOfPropertyAt(u,m,"textBackgroundColor"),l?(t.save(),t.translate(i.renderLeft,i.renderTop),t.rotate(i.angle),(t.fillStyle=r)&&t.fillRect(-i.width/2,-e/this.lineHeight*(1-this._fontSizeFraction),i.width,e/this.lineHeight),t.restore()):r!==p?(n=o+g+c,"rtl"===this.direction&&(n=this.width-n-h),(t.fillStyle=p)&&t.fillRect(n,a,h,e/this.lineHeight),c=i.left,h=i.width,p=r):h+=i.kernedWidth;r&&!l&&(n=o+g+c,"rtl"===this.direction&&(n=this.width-n-h),t.fillStyle=r,t.fillRect(n,a,h,e/this.lineHeight)),a+=e}else a+=e;t.fillStyle=s,this._removeShadow(t)}},getFontCache:function(t){var e=t.fontFamily.toLowerCase(),e=(x.charWidthsCache[e]||(x.charWidthsCache[e]={}),x.charWidthsCache[e]),t=t.fontStyle.toLowerCase()+"_"+(t.fontWeight+"").toLowerCase();return e[t]||(e[t]={}),e[t]},_measureChar:function(t,e,i,r){var n,s,o,a,c,h=this.getFontCache(e),l=i+t,r=this._getFontDeclaration(e)===this._getFontDeclaration(r),u=e.fontSize/this.CACHE_FONT_SIZE;return i&&void 0!==h[i]&&(o=h[i]),void 0!==h[t]&&(a=n=h[t]),r&&void 0!==h[l]&&(a=(s=h[l])-o),void 0!==n&&void 0!==o&&void 0!==s||(c=this.getMeasuringContext(),this._setTextStyles(c,e,!0)),void 0===n&&(a=n=c.measureText(t).width,h[t]=n),void 0===o&&r&&i&&(o=c.measureText(i).width,h[i]=o),r&&void 0===s&&(s=c.measureText(l).width,a=(h[l]=s)-o),{width:n*u,kernedWidth:a*u}},getHeightOfChar:function(t,e){return this.getValueOfPropertyAt(t,e,"fontSize")},measureLine:function(t){t=this._measureLine(t);return 0!==this.charSpacing&&(t.width-=this._getWidthOfCharSpacing()),t.width<0&&(t.width=0),t},_measureLine:function(t){var e,i,r,n,s,o,a=0,c=this._textLines[t],h=new Array(c.length),l=0,u=this.path,f="right"===this.pathSide;for(this.__charBounds[t]=h,e=0;e<c.length;e++)i=c[e],n=this._getGraphemeBox(i,t,e,r),a+=(h[e]=n).kernedWidth,r=i;if(h[e]={left:n?n.left+n.width:0,width:0,kernedWidth:0,height:this.fontSize},u){switch(o=u.segmentsInfo[u.segmentsInfo.length-1].length,(s=x.util.getPointOnPath(u.path,0,u.segmentsInfo)).x+=u.pathOffset.x,s.y+=u.pathOffset.y,this.textAlign){case"left":l=f?o-a:0;break;case"center":l=(o-a)/2;break;case"right":l=f?0:o-a}for(l+=this.pathStartOffset*(f?-1:1),e=f?c.length-1:0;f?0<=e:e<c.length;f?e--:e++)n=h[e],o<l?l%=o:l<0&&(l+=o),this._setGraphemeOnPath(l,n,s),l+=n.kernedWidth}return{width:a,numOfSpaces:0}},_setGraphemeOnPath:function(t,e,i){var t=t+e.kernedWidth/2,r=this.path,t=x.util.getPointOnPath(r.path,t,r.segmentsInfo);e.renderLeft=t.x-i.x,e.renderTop=t.y-i.y,e.angle=t.angle+("right"===this.pathSide?Math.PI:0)},_getGraphemeBox:function(t,e,i,r,n){var s=this.getCompleteStyleDeclaration(e,i),o=r?this.getCompleteStyleDeclaration(e,i-1):{},t=this._measureChar(t,s,r,o),r=t.kernedWidth,o=t.width,a=(0!==this.charSpacing&&(o+=a=this._getWidthOfCharSpacing(),r+=a),{width:o,left:0,height:s.fontSize,kernedWidth:r,deltaY:s.deltaY});return 0<i&&!n&&(o=this.__charBounds[e][i-1],a.left=o.left+o.width+t.kernedWidth-t.width),a},getHeightOfLine:function(t){if(this.__lineHeights[t])return this.__lineHeights[t];for(var e=this._textLines[t],i=this.getHeightOfChar(t,0),r=1,n=e.length;r<n;r++)i=Math.max(this.getHeightOfChar(t,r),i);return this.__lineHeights[t]=i*this.lineHeight*this._fontSizeMult},calcTextHeight:function(){for(var t,e=0,i=0,r=this._textLines.length;i<r;i++)t=this.getHeightOfLine(i),e+=i===r-1?t/this.lineHeight:t;return e},_getLeftOffset:function(){return"ltr"===this.direction?-this.width/2:this.width/2},_getTopOffset:function(){return-this.height/2},_renderTextCommon:function(t,e){t.save();for(var i=0,r=this._getLeftOffset(),n=this._getTopOffset(),s=0,o=this._textLines.length;s<o;s++){var a=this.getHeightOfLine(s),c=a/this.lineHeight,h=this._getLineLeftOffset(s);this._renderTextLine(e,t,this._textLines[s],r+h,n+i+c,s),i+=a}t.restore()},_renderTextFill:function(t){(this.fill||this.styleHas("fill"))&&this._renderTextCommon(t,"fillText")},_renderTextStroke:function(t){(this.stroke&&0!==this.strokeWidth||!this.isEmptyStyles())&&(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this._setLineDash(t,this.strokeDashArray),t.beginPath(),this._renderTextCommon(t,"strokeText"),t.closePath(),t.restore())},_renderChars:function(t,e,i,r,n,s){var o,a,c,h,l=this.getHeightOfLine(s),u=-1!==this.textAlign.indexOf("justify"),f="",d=0,g=this.path,p=!u&&0===this.charSpacing&&this.isEmptyStyles(s)&&!g,m="ltr"===this.direction,v="ltr"===this.direction?1:-1,b=e.canvas.getAttribute("dir");if(e.save(),b!==this.direction&&(e.canvas.setAttribute("dir",m?"ltr":"rtl"),e.direction=m?"ltr":"rtl",e.textAlign=m?"left":"right"),n-=l*this._fontSizeFraction/this.lineHeight,p)return this._renderChar(t,e,s,0,i.join(""),r,n,l),void e.restore();for(var y=0,_=i.length-1;y<=_;y++)h=y===_||this.charSpacing||g,f+=i[y],c=this.__charBounds[s][y],0===d?(r+=v*(c.kernedWidth-c.width),d+=c.width):d+=c.kernedWidth,(h=u&&!h&&this._reSpaceAndTab.test(i[y])?!0:h)||(o=o||this.getCompleteStyleDeclaration(s,y),a=this.getCompleteStyleDeclaration(s,y+1),h=x.util.hasStyleChanged(o,a,!1)),h&&(g?(e.save(),e.translate(c.renderLeft,c.renderTop),e.rotate(c.angle),this._renderChar(t,e,s,y,f,-d/2,0,l),e.restore()):(h=r,this._renderChar(t,e,s,y,f,h,n,l)),f="",o=a,r+=v*d,d=0);e.restore()},_applyPatternGradientTransformText:function(t){var e,i=x.util.createCanvasElement(),r=this.width+this.strokeWidth,n=this.height+this.strokeWidth;return i.width=r,i.height=n,(e=i.getContext("2d")).beginPath(),e.moveTo(0,0),e.lineTo(r,0),e.lineTo(r,n),e.lineTo(0,n),e.closePath(),e.translate(r/2,n/2),e.fillStyle=t.toLive(e),this._applyPatternGradientTransform(e,t),e.fill(),e.createPattern(i,"no-repeat")},handleFiller:function(t,e,i){var r,n;return i.toLive?"percentage"===i.gradientUnits||i.gradientTransform||i.patternTransform?(r=-this.width/2,n=-this.height/2,t.translate(r,n),t[e]=this._applyPatternGradientTransformText(i),{offsetX:r,offsetY:n}):(t[e]=i.toLive(t,this),this._applyPatternGradientTransform(t,i)):(t[e]=i,{offsetX:0,offsetY:0})},_setStrokeStyles:function(t,e){return t.lineWidth=e.strokeWidth,t.lineCap=this.strokeLineCap,t.lineDashOffset=this.strokeDashOffset,t.lineJoin=this.strokeLineJoin,t.miterLimit=this.strokeMiterLimit,this.handleFiller(t,"strokeStyle",e.stroke)},_setFillStyles:function(t,e){return this.handleFiller(t,"fillStyle",e.fill)},_renderChar:function(t,e,i,r,n,s,o){var a,c,h=this._getStyleDeclaration(i,r),i=this.getCompleteStyleDeclaration(i,r),r="fillText"===t&&i.fill,t="strokeText"===t&&i.stroke&&i.strokeWidth;(t||r)&&(e.save(),r&&(a=this._setFillStyles(e,i)),t&&(c=this._setStrokeStyles(e,i)),e.font=this._getFontDeclaration(i),h&&h.textBackgroundColor&&this._removeShadow(e),h&&h.deltaY&&(o+=h.deltaY),r&&e.fillText(n,s-a.offsetX,o-a.offsetY),t&&e.strokeText(n,s-c.offsetX,o-c.offsetY),e.restore())},setSuperscript:function(t,e){return this._setScript(t,e,this.superscript)},setSubscript:function(t,e){return this._setScript(t,e,this.subscript)},_setScript:function(t,e,i){var r=this.get2DCursorLocation(t,!0),n=this.getValueOfPropertyAt(r.lineIndex,r.charIndex,"fontSize"),r=this.getValueOfPropertyAt(r.lineIndex,r.charIndex,"deltaY"),r={fontSize:n*i.size,deltaY:r+n*i.baseline};return this.setSelectionStyles(r,t,e),this},_getLineLeftOffset:function(t){var e=this.getLineWidth(t),e=this.width-e,i=this.textAlign,r=this.direction,n=0,t=this.isEndOfWrapping(t);return"justify"===i||"justify-center"===i&&!t||"justify-right"===i&&!t||"justify-left"===i&&!t?0:("center"===i&&(n=e/2),"right"===i&&(n=e),"justify-center"===i&&(n=e/2),"justify-right"===i&&(n=e),"rtl"===r&&(n-=e),n)},_clearCache:function(){this.__lineWidths=[],this.__lineHeights=[],this.__charBounds=[]},_shouldClearDimensionCache:function(){var t=this._forceClearCache;return(t=t||this.hasStateChanged("_dimensionAffectingProps"))&&(this.dirty=!0,this._forceClearCache=!1),t},getLineWidth:function(t){if(void 0!==this.__lineWidths[t])return this.__lineWidths[t];var e=this.measureLine(t).width;return this.__lineWidths[t]=e},_getWidthOfCharSpacing:function(){return 0!==this.charSpacing?this.fontSize*this.charSpacing/1e3:0},getValueOfPropertyAt:function(t,e,i){t=this._getStyleDeclaration(t,e);return(t&&void 0!==t[i]?t:this)[i]},_renderTextDecoration:function(t,e){if(this[e]||this.styleHas(e)){for(var i,r=this._getLeftOffset(),n=this._getTopOffset(),s=this.path,o=this._getWidthOfCharSpacing(),a=this.offsets[e],c=0,h=this._textLines.length;c<h;c++)if(i=this.getHeightOfLine(c),this[e]||this.styleHas(e,c)){for(var l=this._textLines[c],u=i/this.lineHeight,f=this._getLineLeftOffset(c),d=0,g=0,p=this.getValueOfPropertyAt(c,0,e),m=this.getValueOfPropertyAt(c,0,"fill"),v=n+u*(1-this._fontSizeFraction),b=this.getHeightOfChar(c,0),y=this.getValueOfPropertyAt(c,0,"deltaY"),_=0,x=l.length;_<x;_++){var C=this.__charBounds[c][_],S=this.getValueOfPropertyAt(c,_,e),T=this.getValueOfPropertyAt(c,_,"fill"),w=this.getHeightOfChar(c,_),O=this.getValueOfPropertyAt(c,_,"deltaY");s&&S&&T?(t.save(),t.fillStyle=m,t.translate(C.renderLeft,C.renderTop),t.rotate(C.angle),t.fillRect(-C.kernedWidth/2,a*w+O,C.kernedWidth,this.fontSize/15),t.restore()):(S!==p||T!==m||w!==b||O!==y)&&0<g?(P=r+f+d,"rtl"===this.direction&&(P=this.width-P-g),p&&m&&(t.fillStyle=m,t.fillRect(P,v+a*b+y,g,this.fontSize/15)),d=C.left,g=C.width,p=S,m=T,b=w,y=O):g+=C.kernedWidth}var P=r+f+d;"rtl"===this.direction&&(P=this.width-P-g),t.fillStyle=T,S&&T&&t.fillRect(P,v+a*b+y,g-o,this.fontSize/15),n+=i}else n+=i;this._removeShadow(t)}},_getFontDeclaration:function(t,e){var t=t||this,i=this.fontFamily,r=-1<x.Text.genericFonts.indexOf(i.toLowerCase()),i=void 0===i||-1<i.indexOf("'")||-1<i.indexOf(",")||-1<i.indexOf('"')||r?t.fontFamily:'"'+t.fontFamily+'"';return[x.isLikelyNode?t.fontWeight:t.fontStyle,x.isLikelyNode?t.fontStyle:t.fontWeight,e?this.CACHE_FONT_SIZE+"px":t.fontSize+"px",i].join(" ")},render:function(t){!this.visible||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._shouldClearDimensionCache()&&this.initDimensions(),this.callSuper("render",t))},_splitTextIntoLines:function(t){for(var e=t.split(this._reNewline),i=new Array(e.length),r=["\n"],n=[],s=0;s<e.length;s++)i[s]=x.util.string.graphemeSplit(e[s]),n=n.concat(i[s],r);return n.pop(),{_unwrappedLines:i,lines:e,graphemeText:n,graphemeLines:i}},toObject:function(t){t=e.concat(t),t=this.callSuper("toObject",t);return t.styles=x.util.stylesToArray(this.styles,this.text),t.path&&(t.path=this.path.toObject()),t},set:function(t,e){this.callSuper("set",t,e);var i=!1,r=!1;if("object"==typeof t)for(var n in t)"path"===n&&this.setPathInfo(),i=i||-1!==this._dimensionAffectingProps.indexOf(n),r=r||"path"===n;else i=-1!==this._dimensionAffectingProps.indexOf(t),r="path"===t;return r&&this.setPathInfo(),i&&(this.initDimensions(),this.setCoords()),this},complexity:function(){return 1}}),x.Text.ATTRIBUTE_NAMES=x.SHARED_ATTRIBUTES.concat("x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor".split(" ")),x.Text.DEFAULT_SVG_FONT_SIZE=16,x.Text.fromElement=function(t,e,i){if(!t)return e(null);var r=x.parseAttributes(t,x.Text.ATTRIBUTE_NAMES),n=r.textAnchor||"left",s=((i=x.util.object.extend(i?o(i):{},r)).top=i.top||0,i.left=i.left||0,r.textDecoration&&(-1!==(s=r.textDecoration).indexOf("underline")&&(i.underline=!0),-1!==s.indexOf("overline")&&(i.overline=!0),-1!==s.indexOf("line-through")&&(i.linethrough=!0),delete i.textDecoration),"dx"in r&&(i.left+=r.dx),"dy"in r&&(i.top+=r.dy),"fontSize"in i||(i.fontSize=x.Text.DEFAULT_SVG_FONT_SIZE),""),r=("textContent"in t?s=t.textContent:"firstChild"in t&&null!==t.firstChild&&"data"in t.firstChild&&null!==t.firstChild.data&&(s=t.firstChild.data),s=s.replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," "),i.strokeWidth),t=(i.strokeWidth=0,new x.Text(s,i)),s=t.getScaledHeight()/t.height,i=((t.height+t.strokeWidth)*t.lineHeight-t.height)*s,s=t.getScaledHeight()+i,i=0;"center"===n&&(i=t.getScaledWidth()/2),"right"===n&&(i=t.getScaledWidth()),t.set({left:t.left-i,top:t.top-(s-t.fontSize*(.07+t._fontSizeFraction))/t.lineHeight,strokeWidth:void 0!==r?r:1}),e(t)},x.Text.fromObject=function(t,i){var e=o(t),r=t.path;return delete e.path,x.Object._fromObject("Text",e,function(e){e.styles=x.util.stylesFromArray(t.styles,t.text),r?x.Object._fromObject("Path",r,function(t){e.set("path",t),i(e)},"path"):i(e)},"text")},x.Text.genericFonts=["sans-serif","serif","cursive","fantasy","monospace"],x.util.createAccessors&&x.util.createAccessors(x.Text))}("undefined"!=typeof exports?exports:this),fabric.util.object.extend(fabric.Text.prototype,{isEmptyStyles:function(t){if(!this.styles)return!0;if(void 0!==t&&!this.styles[t])return!0;var e,i=void 0===t?this.styles:{line:this.styles[t]};for(e in i)for(var r in i[e])for(var n in i[e][r])return!1;return!0},styleHas:function(t,e){if(!this.styles||!t||""===t)return!1;if(void 0!==e&&!this.styles[e])return!1;var i,r=void 0===e?this.styles:{0:this.styles[e]};for(i in r)for(var n in r[i])if(void 0!==r[i][n][t])return!0;return!1},cleanStyle:function(t){if(!this.styles||!t||""===t)return!1;var e,i,r,n,s=this.styles,o=0,a=!0,c=0;for(r in s){for(var h in e=0,s[r])o++,(n=s[r][h]).hasOwnProperty(t)?(i?n[t]!==i&&(a=!1):i=n[t],n[t]===this[t]&&delete n[t]):a=!1,0!==Object.keys(n).length?e++:delete s[r][h];0===e&&delete s[r]}for(var l=0;l<this._textLines.length;l++)c+=this._textLines[l].length;a&&o===c&&(this[t]=i,this.removeStyle(t))},removeStyle:function(t){if(this.styles&&t&&""!==t){var e,i,r,n=this.styles;for(i in n){for(r in e=n[i])delete e[r][t],0===Object.keys(e[r]).length&&delete e[r];0===Object.keys(e).length&&delete n[i]}}},_extendStyles:function(t,e){t=this.get2DCursorLocation(t);this._getLineStyle(t.lineIndex)||this._setLineStyle(t.lineIndex),this._getStyleDeclaration(t.lineIndex,t.charIndex)||this._setStyleDeclaration(t.lineIndex,t.charIndex,{}),fabric.util.object.extend(this._getStyleDeclaration(t.lineIndex,t.charIndex),e)},get2DCursorLocation:function(t,e){void 0===t&&(t=this.selectionStart);for(var i=e?this._unwrappedTextLines:this._textLines,r=i.length,n=0;n<r;n++){if(t<=i[n].length)return{lineIndex:n,charIndex:t};t-=i[n].length+this.missingNewlineOffset(n)}return{lineIndex:n-1,charIndex:i[n-1].length<t?i[n-1].length:t}},getSelectionStyles:function(t,e,i){void 0===t&&(t=this.selectionStart||0),void 0===e&&(e=this.selectionEnd||t);for(var r=[],n=t;n<e;n++)r.push(this.getStyleAtPosition(n,i));return r},getStyleAtPosition:function(t,e){t=this.get2DCursorLocation(t);return(e?this.getCompleteStyleDeclaration(t.lineIndex,t.charIndex):this._getStyleDeclaration(t.lineIndex,t.charIndex))||{}},setSelectionStyles:function(t,e,i){void 0===e&&(e=this.selectionStart||0),void 0===i&&(i=this.selectionEnd||e);for(var r=e;r<i;r++)this._extendStyles(r,t);return this._forceClearCache=!0,this},_getStyleDeclaration:function(t,e){t=this.styles&&this.styles[t];return t?t[e]:null},getCompleteStyleDeclaration:function(t,e){for(var i,r=this._getStyleDeclaration(t,e)||{},n={},s=0;s<this._styleProperties.length;s++)n[i=this._styleProperties[s]]=(void 0===r[i]?this:r)[i];return n},_setStyleDeclaration:function(t,e,i){this.styles[t][e]=i},_deleteStyleDeclaration:function(t,e){delete this.styles[t][e]},_getLineStyle:function(t){return!!this.styles[t]},_setLineStyle:function(t){this.styles[t]={}},_deleteLineStyle:function(t){delete this.styles[t]}}),function(){function o(t){t.textDecoration&&(-1<t.textDecoration.indexOf("underline")&&(t.underline=!0),-1<t.textDecoration.indexOf("line-through")&&(t.linethrough=!0),-1<t.textDecoration.indexOf("overline")&&(t.overline=!0),delete t.textDecoration)}fabric.IText=fabric.util.createClass(fabric.Text,fabric.Observable,{type:"i-text",selectionStart:0,selectionEnd:0,selectionColor:"rgba(17,119,255,0.3)",isEditing:!1,editable:!0,editingBorderColor:"rgba(102,153,255,0.25)",cursorWidth:2,cursorColor:"",cursorDelay:1e3,cursorDuration:600,caching:!0,hiddenTextareaContainer:null,_reSpace:/\s|\n/,_currentCursorOpacity:0,_selectionDirection:null,_abortCursorAnimation:!1,__widthOfSpace:[],inCompositionMode:!1,initialize:function(t,e){this.callSuper("initialize",t,e),this.initBehavior()},setSelectionStart:function(t){t=Math.max(t,0),this._updateAndFire("selectionStart",t)},setSelectionEnd:function(t){t=Math.min(t,this.text.length),this._updateAndFire("selectionEnd",t)},_updateAndFire:function(t,e){this[t]!==e&&(this._fireSelectionChanged(),this[t]=e),this._updateTextarea()},_fireSelectionChanged:function(){this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})},initDimensions:function(){this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this.callSuper("initDimensions")},render:function(t){this.clearContextTop(),this.callSuper("render",t),this.cursorOffsetCache={},this.renderCursorOrSelection()},_render:function(t){this.callSuper("_render",t)},clearContextTop:function(t){var e,i;this.isEditing&&this.canvas&&this.canvas.contextTop&&(e=this.canvas.contextTop,i=this.canvas.viewportTransform,e.save(),e.transform(i[0],i[1],i[2],i[3],i[4],i[5]),this.transform(e),this._clearTextArea(e),t||e.restore())},renderCursorOrSelection:function(){var t,e;this.isEditing&&this.canvas&&this.canvas.contextTop&&(t=this._getCursorBoundaries(),e=this.canvas.contextTop,this.clearContextTop(!0),this.selectionStart===this.selectionEnd?this.renderCursor(t,e):this.renderSelection(t,e),e.restore())},_clearTextArea:function(t){var e=this.width+4,i=this.height+4;t.clearRect(-e/2,-i/2,e,i)},_getCursorBoundaries:function(t){void 0===t&&(t=this.selectionStart);var e=this._getLeftOffset(),i=this._getTopOffset(),t=this._getCursorBoundariesOffsets(t);return{left:e,top:i,leftOffset:t.left,topOffset:t.top}},_getCursorBoundariesOffsets:function(t){if(this.cursorOffsetCache&&"top"in this.cursorOffsetCache)return this.cursorOffsetCache;for(var e=0,i=0,t=this.get2DCursorLocation(t),r=t.charIndex,n=t.lineIndex,s=0;s<n;s++)e+=this.getHeightOfLine(s);var t=this._getLineLeftOffset(n),o=this.__charBounds[n][r];return o&&(i=o.left),0!==this.charSpacing&&r===this._textLines[n].length&&(i-=this._getWidthOfCharSpacing()),o={top:e,left:t+(0<i?i:0)},"rtl"===this.direction&&(o.left*=-1),this.cursorOffsetCache=o,this.cursorOffsetCache},renderCursor:function(t,e){var i=this.get2DCursorLocation(),r=i.lineIndex,i=0<i.charIndex?i.charIndex-1:0,n=this.getValueOfPropertyAt(r,i,"fontSize"),s=this.scaleX*this.canvas.getZoom(),s=this.cursorWidth/s,o=t.topOffset,a=this.getValueOfPropertyAt(r,i,"deltaY");o+=(1-this._fontSizeFraction)*this.getHeightOfLine(r)/this.lineHeight-n*(1-this._fontSizeFraction),this.inCompositionMode&&this.renderSelection(t,e),e.fillStyle=this.cursorColor||this.getValueOfPropertyAt(r,i,"fill"),e.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,e.fillRect(t.left+t.leftOffset-s/2,o+t.top+a,s,n)},renderSelection:function(t,e){for(var i=(this.inCompositionMode?this.hiddenTextarea:this).selectionStart,r=(this.inCompositionMode?this.hiddenTextarea:this).selectionEnd,n=-1!==this.textAlign.indexOf("justify"),i=this.get2DCursorLocation(i),r=this.get2DCursorLocation(r),s=i.lineIndex,o=r.lineIndex,a=i.charIndex<0?0:i.charIndex,c=r.charIndex<0?0:r.charIndex,h=s;h<=o;h++){var l,u=this._getLineLeftOffset(h)||0,f=this.getHeightOfLine(h),d=0,g=0,u=(h===s&&(d=this.__charBounds[s][a].left),s<=h&&h<o?g=n&&!this.isEndOfWrapping(h)?this.width:this.getLineWidth(h)||5:h===o&&(g=0===c?this.__charBounds[o][c].left:(l=this._getWidthOfCharSpacing(),this.__charBounds[o][c-1].left+this.__charBounds[o][c-1].width-l)),l=f,(this.lineHeight<1||h===o&&1<this.lineHeight)&&(f/=this.lineHeight),t.left+u+d),g=g-d,d=f,p=0;this.inCompositionMode?(e.fillStyle=this.compositionColor||"black",d=1,p=f):e.fillStyle=this.selectionColor,"rtl"===this.direction&&(u=this.width-u-g),e.fillRect(u,t.top+t.topOffset+p,g,d),t.topOffset+=l}},getCurrentCharFontSize:function(){var t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,"fontSize")},getCurrentCharColor:function(){var t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,"fill")},_getCurrentCharIndex:function(){var t=this.get2DCursorLocation(this.selectionStart,!0),e=0<t.charIndex?t.charIndex-1:0;return{l:t.lineIndex,c:e}}}),fabric.IText.fromObject=function(t,e){var i=fabric.util.stylesFromArray(t.styles,t.text),r=Object.assign({},t,{styles:i});if(o(r),r.styles)for(var n in r.styles)for(var s in r.styles[n])o(r.styles[n][s]);fabric.Object._fromObject("IText",r,e,"text")}}(),function(){var u=fabric.util.object.clone;fabric.util.object.extend(fabric.IText.prototype,{initBehavior:function(){this.initAddedHandler(),this.initRemovedHandler(),this.initCursorSelectionHandlers(),this.initDoubleClickSimulation(),this.mouseMoveHandler=this.mouseMoveHandler.bind(this)},onDeselect:function(){this.isEditing&&this.exitEditing(),this.selected=!1},initAddedHandler:function(){var e=this;this.on("added",function(){var t=e.canvas;t&&(t._hasITextHandlers||(t._hasITextHandlers=!0,e._initCanvasHandlers(t)),t._iTextInstances=t._iTextInstances||[],t._iTextInstances.push(e))})},initRemovedHandler:function(){var e=this;this.on("removed",function(){var t=e.canvas;t&&(t._iTextInstances=t._iTextInstances||[],fabric.util.removeFromArray(t._iTextInstances,e),0===t._iTextInstances.length&&(t._hasITextHandlers=!1,e._removeCanvasHandlers(t)))})},_initCanvasHandlers:function(t){t._mouseUpITextHandler=function(){t._iTextInstances&&t._iTextInstances.forEach(function(t){t.__isMousedown=!1})},t.on("mouse:up",t._mouseUpITextHandler)},_removeCanvasHandlers:function(t){t.off("mouse:up",t._mouseUpITextHandler)},_tick:function(){this._currentTickState=this._animateCursor(this,1,this.cursorDuration,"_onTickComplete")},_animateCursor:function(t,e,i,r){var n={isAborted:!1,abort:function(){this.isAborted=!0}};return t.animate("_currentCursorOpacity",e,{duration:i,onComplete:function(){n.isAborted||t[r]()},onChange:function(){t.canvas&&t.selectionStart===t.selectionEnd&&t.renderCursorOrSelection()},abort:function(){return n.isAborted}}),n},_onTickComplete:function(){var t=this;this._cursorTimeout1&&clearTimeout(this._cursorTimeout1),this._cursorTimeout1=setTimeout(function(){t._currentTickCompleteState=t._animateCursor(t,0,this.cursorDuration/2,"_tick")},100)},initDelayedCursor:function(t){var e=this,t=t?0:this.cursorDelay;this.abortCursorAnimation(),this._currentCursorOpacity=1,this._cursorTimeout2=setTimeout(function(){e._tick()},t)},abortCursorAnimation:function(){var t=this._currentTickState||this._currentTickCompleteState,e=this.canvas;this._currentTickState&&this._currentTickState.abort(),this._currentTickCompleteState&&this._currentTickCompleteState.abort(),clearTimeout(this._cursorTimeout1),clearTimeout(this._cursorTimeout2),this._currentCursorOpacity=0,t&&e&&e.clearContext(e.contextTop||e.contextContainer)},selectAll:function(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this},getSelectedText:function(){return this._text.slice(this.selectionStart,this.selectionEnd).join("")},findWordBoundaryLeft:function(t){var e=0,i=t-1;if(this._reSpace.test(this._text[i]))for(;this._reSpace.test(this._text[i]);)e++,i--;for(;/\S/.test(this._text[i])&&-1<i;)e++,i--;return t-e},findWordBoundaryRight:function(t){var e=0,i=t;if(this._reSpace.test(this._text[i]))for(;this._reSpace.test(this._text[i]);)e++,i++;for(;/\S/.test(this._text[i])&&i<this._text.length;)e++,i++;return t+e},findLineBoundaryLeft:function(t){for(var e=0,i=t-1;!/\n/.test(this._text[i])&&-1<i;)e++,i--;return t-e},findLineBoundaryRight:function(t){for(var e=0,i=t;!/\n/.test(this._text[i])&&i<this._text.length;)e++,i++;return t+e},searchWordBoundary:function(t,e){for(var i=this._text,r=this._reSpace.test(i[t])?t-1:t,n=i[r],s=fabric.reNonWord;!s.test(n)&&0<r&&r<i.length;)n=i[r+=e];return s.test(n)&&(r+=1===e?0:1),r},selectWord:function(t){t=t||this.selectionStart;var e=this.searchWordBoundary(t,-1),t=this.searchWordBoundary(t,1);this.selectionStart=e,this.selectionEnd=t,this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()},selectLine:function(t){t=t||this.selectionStart;var e=this.findLineBoundaryLeft(t),t=this.findLineBoundaryRight(t);return this.selectionStart=e,this.selectionEnd=t,this._fireSelectionChanged(),this._updateTextarea(),this},enterEditing:function(t){if(!this.isEditing&&this.editable)return this.canvas&&(this.canvas.calcOffset(),this.exitEditingOnOthers(this.canvas)),this.isEditing=!0,this.initHiddenTextarea(t),this.hiddenTextarea.focus(),this.hiddenTextarea.value=this.text,this._updateTextarea(),this._saveEditingProps(),this._setEditingProps(),this._textBeforeEdit=this.text,this._tick(),this.fire("editing:entered"),this._fireSelectionChanged(),this.canvas&&(this.canvas.fire("text:editing:entered",{target:this}),this.initMouseMoveHandler(),this.canvas.requestRenderAll()),this},exitEditingOnOthers:function(t){t._iTextInstances&&t._iTextInstances.forEach(function(t){t.selected=!1,t.isEditing&&t.exitEditing()})},initMouseMoveHandler:function(){this.canvas.on("mouse:move",this.mouseMoveHandler)},mouseMoveHandler:function(t){var e,i;this.__isMousedown&&this.isEditing&&(document.activeElement!==this.hiddenTextarea&&this.hiddenTextarea.focus(),t=this.getSelectionStartFromPointer(t.e),e=this.selectionStart,i=this.selectionEnd,(t===this.__selectionStartOnMouseDown&&e!==i||e!==t&&i!==t)&&(t>this.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=t):(this.selectionStart=t,this.selectionEnd=this.__selectionStartOnMouseDown),this.selectionStart===e&&this.selectionEnd===i||(this.restartCursorIfNeeded(),this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection())))},_setEditingProps:function(){this.hoverCursor="text",this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor="text"),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0},fromStringToGraphemeSelection:function(t,e,i){var r=i.slice(0,t),r=fabric.util.string.graphemeSplit(r).length;if(t===e)return{selectionStart:r,selectionEnd:r};i=i.slice(t,e);return{selectionStart:r,selectionEnd:r+fabric.util.string.graphemeSplit(i).length}},fromGraphemeToStringSelection:function(t,e,i){var r=i.slice(0,t).join("").length;return t===e?{selectionStart:r,selectionEnd:r}:{selectionStart:r,selectionEnd:r+i.slice(t,e).join("").length}},_updateTextarea:function(){var t;this.cursorOffsetCache={},this.hiddenTextarea&&(this.inCompositionMode||(t=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text),this.hiddenTextarea.selectionStart=t.selectionStart,this.hiddenTextarea.selectionEnd=t.selectionEnd),this.updateTextareaPosition())},updateFromTextArea:function(){var t;this.hiddenTextarea&&(this.cursorOffsetCache={},this.text=this.hiddenTextarea.value,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),t=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),this.selectionEnd=this.selectionStart=t.selectionEnd,this.inCompositionMode||(this.selectionStart=t.selectionStart),this.updateTextareaPosition())},updateTextareaPosition:function(){var t;this.selectionStart===this.selectionEnd&&(t=this._calcTextareaPosition(),this.hiddenTextarea.style.left=t.left,this.hiddenTextarea.style.top=t.top)},_calcTextareaPosition:function(){if(!this.canvas)return{x:1,y:1};var t=this.inCompositionMode?this.compositionStart:this.selectionStart,e=this._getCursorBoundaries(t),t=this.get2DCursorLocation(t),i=t.lineIndex,t=t.charIndex,i=this.getValueOfPropertyAt(i,t,"fontSize")*this.lineHeight,t=e.leftOffset,r=this.calcTransformMatrix(),t={x:e.left+t,y:e.top+e.topOffset+i},e=this.canvas.getRetinaScaling(),n=this.canvas.upperCanvasEl,s=n.width/e,e=n.height/e,o=s-i,a=e-i,s=n.clientWidth/s,n=n.clientHeight/e,t=fabric.util.transformPoint(t,r);return(t=fabric.util.transformPoint(t,this.canvas.viewportTransform)).x*=s,t.y*=n,t.x<0&&(t.x=0),t.x>o&&(t.x=o),t.y<0&&(t.y=0),t.y>a&&(t.y=a),t.x+=this.canvas._offset.left,t.y+=this.canvas._offset.top,{left:t.x+"px",top:t.y+"px",fontSize:i+"px",charHeight:i}},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){this._savedProps&&(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor))},exitEditing:function(){var t=this._textBeforeEdit!==this.text,e=this.hiddenTextarea;return this.selected=!1,this.isEditing=!1,this.selectionEnd=this.selectionStart,e&&(e.blur&&e.blur(),e.parentNode&&e.parentNode.removeChild(e)),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this.fire("editing:exited"),t&&this.fire("modified"),this.canvas&&(this.canvas.off("mouse:move",this.mouseMoveHandler),this.canvas.fire("text:editing:exited",{target:this}),t&&this.canvas.fire("object:modified",{target:this})),this},_removeExtraneousStyles:function(){for(var t in this.styles)this._textLines[t]||delete this.styles[t]},removeStyleFromTo:function(t,e){var t=this.get2DCursorLocation(t,!0),e=this.get2DCursorLocation(e,!0),i=t.lineIndex,r=t.charIndex,n=e.lineIndex,s=e.charIndex;if(i!==n){if(this.styles[i])for(l=r;l<this._unwrappedTextLines[i].length;l++)delete this.styles[i][l];if(this.styles[n])for(l=s;l<this._unwrappedTextLines[n].length;l++)(c=this.styles[n][l])&&(this.styles[i]||(this.styles[i]={}),this.styles[i][r+l-s]=c);for(l=i+1;l<=n;l++)delete this.styles[l];this.shiftLineStyles(n,i-n)}else if(this.styles[i]){for(var o,a,c=this.styles[i],h=s-r,l=r;l<s;l++)delete c[l];for(a in this.styles[i])s<=(o=parseInt(a,10))&&(c[o-h]=c[a],delete c[a])}},shiftLineStyles:function(t,e){var i,r=u(this.styles);for(i in this.styles){var n=parseInt(i,10);t<n&&(this.styles[n+e]=r[n],r[n-e]||delete this.styles[n])}},restartCursorIfNeeded:function(){this._currentTickState&&!this._currentTickState.isAborted&&this._currentTickCompleteState&&!this._currentTickCompleteState.isAborted||this.initDelayedCursor()},insertNewlineStyleObject:function(t,e,i,r){var n,s,o={},a=!1,c=this._unwrappedTextLines[t].length===e;for(s in this.shiftLineStyles(t,i=i||1),this.styles[t]&&(n=this.styles[t][0===e?e:e-1]),this.styles[t]){var h=parseInt(s,10);e<=h&&(a=!0,o[h-e]=this.styles[t][s],c&&0===e||delete this.styles[t][s])}var l=!1;for(a&&!c&&(this.styles[t+i]=o,l=!0),l&&i--;0<i;)r&&r[i-1]?this.styles[t+i]={0:u(r[i-1])}:n?this.styles[t+i]={0:u(n)}:delete this.styles[t+i],i--;this._forceClearCache=!0},insertCharStyleObject:function(t,e,i,r){this.styles||(this.styles={});var n,s=this.styles[t],o=s?u(s):{};for(n in i=i||1,o){var a=parseInt(n,10);e<=a&&(s[a+i]=o[a],o[a-i]||delete s[a])}if(this._forceClearCache=!0,r)for(;i--;)Object.keys(r[i]).length&&(this.styles[t]||(this.styles[t]={}),this.styles[t][e+i]=u(r[i]));else if(s)for(var c=s[e?e-1:1];c&&i--;)this.styles[t][e+i]=u(c)},insertNewStyleBlock:function(t,e,i){for(var r=this.get2DCursorLocation(e,!0),n=[0],s=0,o=0;o<t.length;o++)"\n"===t[o]?n[++s]=0:n[s]++;0<n[0]&&(this.insertCharStyleObject(r.lineIndex,r.charIndex,n[0],i),i=i&&i.slice(n[0]+1)),s&&this.insertNewlineStyleObject(r.lineIndex,r.charIndex+n[0],s);for(o=1;o<s;o++)0<n[o]?this.insertCharStyleObject(r.lineIndex+o,0,n[o],i):i&&this.styles[r.lineIndex+o]&&i[0]&&(this.styles[r.lineIndex+o][0]=i[0]),i=i&&i.slice(n[o]+1);0<n[o]&&this.insertCharStyleObject(r.lineIndex+o,0,n[o],i)},setSelectionStartEndWithShift:function(t,e,i){i<=t?(e===t?this._selectionDirection="left":"right"===this._selectionDirection&&(this._selectionDirection="left",this.selectionEnd=t),this.selectionStart=i):t<i&&i<e?"right"===this._selectionDirection?this.selectionEnd=i:this.selectionStart=i:(e===t?this._selectionDirection="right":"left"===this._selectionDirection&&(this._selectionDirection="right",this.selectionStart=e),this.selectionEnd=i)},setSelectionInBoundaries:function(){var t=this.text.length;this.selectionStart>t?this.selectionStart=t:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>t?this.selectionEnd=t:this.selectionEnd<0&&(this.selectionEnd=0)}})}(),fabric.util.object.extend(fabric.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(t){var e;this.canvas&&(this.__newClickTime=+new Date,e=t.pointer,this.isTripleClick(e)&&(this.fire("tripleclick",t),this._stopEvent(t.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=e,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected)},isTripleClick:function(t){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===t.x&&this.__lastPointer.y===t.y},_stopEvent:function(t){t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(t){this.isEditing&&this.selectWord(this.getSelectionStartFromPointer(t.e))},tripleClickHandler:function(t){this.isEditing&&this.selectLine(this.getSelectionStartFromPointer(t.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.e.button||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(t.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.e.button||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(t){if(this.__isMousedown=!1,!(!this.editable||this.group||t.transform&&t.transform.actionPerformed||t.e.button&&1!==t.e.button)){if(this.canvas){var e=this.canvas._activeObject;if(e&&e!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(t.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(t){var e=this.getSelectionStartFromPointer(t),i=this.selectionStart,r=this.selectionEnd;t.shiftKey?this.setSelectionStartEndWithShift(i,r,e):(this.selectionStart=e,this.selectionEnd=e),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(t){for(var e=this.getLocalPointer(t),i=0,r=0,n=0,s=0,o=0,a=0,c=this._textLines.length;a<c&&n<=e.y;a++)n+=this.getHeightOfLine(a)*this.scaleY,0<(o=a)&&(s+=this._textLines[a-1].length+this.missingNewlineOffset(a-1));r=this._getLineLeftOffset(o)*this.scaleX,t=this._textLines[o],"rtl"===this.direction&&(e.x=this.width*this.scaleX-e.x+r);for(var h=0,l=t.length;h<l&&(i=r,(r+=this.__charBounds[o][h].kernedWidth*this.scaleX)<=e.x);h++)s++;return this._getNewSelectionStartFromOffset(e,i,r,s,l)},_getNewSelectionStartFromOffset:function(t,e,i,r,n){e=t.x-e,i-=t.x,t=r+(e<i||i<0?0:1);return t=(t=this.flipX?n-t:t)>this._text.length?this._text.length:t}}),fabric.util.object.extend(fabric.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=fabric.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.setAttribute("autocorrect","off"),this.hiddenTextarea.setAttribute("autocomplete","off"),this.hiddenTextarea.setAttribute("spellcheck","false"),this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea",""),this.hiddenTextarea.setAttribute("wrap","off");var t=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+t.top+"; left: "+t.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding-top: "+t.fontSize+";",(this.hiddenTextareaContainer||fabric.document.body).appendChild(this.hiddenTextarea),fabric.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),fabric.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),fabric.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),fabric.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),fabric.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),fabric.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),fabric.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),fabric.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),fabric.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(fabric.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},keysMapRtl:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorLeft",36:"moveCursorRight",37:"moveCursorRight",38:"moveCursorUp",39:"moveCursorLeft",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(t){if(this.isEditing){var e="rtl"===this.direction?this.keysMapRtl:this.keysMap;if(t.keyCode in e)this[e[t.keyCode]](t);else{if(!(t.keyCode in this.ctrlKeysMapDown&&(t.ctrlKey||t.metaKey)))return;this[this.ctrlKeysMapDown[t.keyCode]](t)}t.stopImmediatePropagation(),t.preventDefault(),33<=t.keyCode&&t.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(t){!this.isEditing||this._copyDone||this.inCompositionMode?this._copyDone=!1:t.keyCode in this.ctrlKeysMapUp&&(t.ctrlKey||t.metaKey)&&(this[this.ctrlKeysMapUp[t.keyCode]](t),t.stopImmediatePropagation(),t.preventDefault(),this.canvas&&this.canvas.requestRenderAll())},onInput:function(t){var e=this.fromPaste;if(this.fromPaste=!1,t&&t.stopPropagation(),this.isEditing){var i,r,n,t=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,s=this._text.length,o=t.length,a=o-s,c=this.selectionStart,h=this.selectionEnd,l=c!==h;if(""===this.hiddenTextarea.value)return this.styles={},this.updateFromTextArea(),this.fire("changed"),void(this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll()));var u=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),f=c>u.selectionStart;l?(i=this._text.slice(c,h),a+=h-c):o<s&&(i=f?this._text.slice(h+a,h):this._text.slice(c,c-a)),o=t.slice(u.selectionEnd-a,u.selectionEnd),i&&i.length&&(o.length&&(r=this.getSelectionStyles(c,c+1,!1),r=o.map(function(){return r[0]})),s=l?(n=c,h):f?(n=h-i.length,h):(n=h)+i.length,this.removeStyleFromTo(n,s)),o.length&&(e&&o.join("")===fabric.copiedText&&!fabric.disableStyleCopyPaste&&(r=fabric.copiedTextStyle),this.insertNewStyleBlock(o,c,r)),this.updateFromTextArea(),this.fire("changed"),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll())}},onCompositionStart:function(){this.inCompositionMode=!0},onCompositionEnd:function(){this.inCompositionMode=!1},onCompositionUpdate:function(t){this.compositionStart=t.target.selectionStart,this.compositionEnd=t.target.selectionEnd,this.updateTextareaPosition()},copy:function(){this.selectionStart!==this.selectionEnd&&(fabric.copiedText=this.getSelectedText(),fabric.disableStyleCopyPaste?fabric.copiedTextStyle=null:fabric.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0)},paste:function(){this.fromPaste=!0},_getClipboardData:function(t){return t&&t.clipboardData||fabric.window.clipboardData},_getWidthBeforeCursor:function(t,e){var i=this._getLineLeftOffset(t);return 0<e&&(i+=(t=this.__charBounds[t][e-1]).left+t.width),i},getDownCursorOffset:function(t,e){var e=this._getSelectionForOffset(t,e),i=this.get2DCursorLocation(e),r=i.lineIndex;if(r===this._textLines.length-1||t.metaKey||34===t.keyCode)return this._text.length-e;t=i.charIndex,e=this._getWidthBeforeCursor(r,t),i=this._getIndexOnLine(r+1,e);return this._textLines[r].slice(t).length+i+1+this.missingNewlineOffset(r)},_getSelectionForOffset:function(t,e){return t.shiftKey&&this.selectionStart!==this.selectionEnd&&e?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(t,e){var e=this._getSelectionForOffset(t,e),i=this.get2DCursorLocation(e),r=i.lineIndex;if(0===r||t.metaKey||33===t.keyCode)return-e;t=i.charIndex,e=this._getWidthBeforeCursor(r,t),i=this._getIndexOnLine(r-1,e),e=this._textLines[r].slice(0,t),t=this.missingNewlineOffset(r-1);return-this._textLines[r-1].length+i-e.length+(1-t)},_getIndexOnLine:function(t,e){for(var i=this._textLines[t],r=this._getLineLeftOffset(t),n=0,s=0,o=i.length;s<o;s++)if(e<(r+=h=this.__charBounds[t][s].width)){var a=!0,c=r,h=Math.abs(r-h-e),n=Math.abs(c-e)<h?s:s-1;break}return n=a?n:i.length-1},moveCursorDown:function(t){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",t)},moveCursorUp:function(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorUpOrDown("Up",t)},_moveCursorUpOrDown:function(t,e){t=this["get"+t+"CursorOffset"](e,"right"===this._selectionDirection);e.shiftKey?this.moveCursorWithShift(t):this.moveCursorWithoutShift(t),0!==t&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(t){var e="left"===this._selectionDirection?this.selectionStart+t:this.selectionEnd+t;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,e),0!==t},moveCursorWithoutShift:function(t){return t<0?(this.selectionStart+=t,this.selectionEnd=this.selectionStart):(this.selectionEnd+=t,this.selectionStart=this.selectionEnd),0!==t},moveCursorLeft:function(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorLeftOrRight("Left",t)},_move:function(t,e,i){var r;if(t.altKey)r=this["findWordBoundary"+i](this[e]);else{if(!t.metaKey&&35!==t.keyCode&&36!==t.keyCode)return this[e]+="Left"===i?-1:1,!0;r=this["findLineBoundary"+i](this[e])}if(void 0!==r&&this[e]!==r)return this[e]=r,!0},_moveLeft:function(t,e){return this._move(t,e,"Left")},_moveRight:function(t,e){return this._move(t,e,"Right")},moveCursorLeftWithoutShift:function(t){var e=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&0!==this.selectionStart&&(e=this._moveLeft(t,"selectionStart")),this.selectionEnd=this.selectionStart,e},moveCursorLeftWithShift:function(t){return"right"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveLeft(t,"selectionEnd"):0!==this.selectionStart?(this._selectionDirection="left",this._moveLeft(t,"selectionStart")):void 0},moveCursorRight:function(t){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",t)},_moveCursorLeftOrRight:function(t,e){t="moveCursor"+t+"With";this._currentCursorOpacity=1,e.shiftKey?t+="Shift":t+="outShift",this[t](e)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(t){return"left"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveRight(t,"selectionStart"):this.selectionEnd!==this._text.length?(this._selectionDirection="right",this._moveRight(t,"selectionEnd")):void 0},moveCursorRightWithoutShift:function(t){var e=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(e=this._moveRight(t,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,e},removeChars:function(t,e){this.removeStyleFromTo(t,e=void 0===e?t+1:e),this._text.splice(t,e-t),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(t,e,i,r){i<(r=void 0===r?i:r)&&this.removeStyleFromTo(i,r);t=fabric.util.string.graphemeSplit(t);this.insertNewStyleBlock(t,i,e),this._text=[].concat(this._text.slice(0,i),t,this._text.slice(r)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var a=fabric.util.toFixed,c=/  +/g;fabric.util.object.extend(fabric.Text.prototype,{_toSVG:function(){var t=this._getSVGLeftTopOffsets(),t=this._getSVGTextAndBg(t.textTop,t.textLeft);return this._wrapSVGTextAndBg(t)},toSVG:function(t){return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(t){var e=this.getSvgTextDecoration(this);return[t.textBgRects.join(""),'\t\t<text xml:space="preserve" ',this.fontFamily?'font-family="'+this.fontFamily.replace(/"/g,"'")+'" ':"",this.fontSize?'font-size="'+this.fontSize+'" ':"",this.fontStyle?'font-style="'+this.fontStyle+'" ':"",this.fontWeight?'font-weight="'+this.fontWeight+'" ':"",e?'text-decoration="'+e+'" ':"",'style="',this.getSvgStyles(!0),'"',this.addPaintOrder()," >",t.textSpans.join(""),"</text>\n"]},_getSVGTextAndBg:function(t,e){var i,r=[],n=[],s=t;this._setSVGBg(n);for(var o=0,a=this._textLines.length;o<a;o++)i=this._getLineLeftOffset(o),(this.textBackgroundColor||this.styleHas("textBackgroundColor",o))&&this._setSVGTextLineBg(n,o,e+i,s),this._setSVGTextLineText(r,o,e+i,s),s+=this.getHeightOfLine(o);return{textSpans:r,textBgRects:n}},_createTextCharSpan:function(t,e,i,r){var n=t!==t.trim()||t.match(c),n=this.getSvgSpanStyles(e,n),n=n?'style="'+n+'"':"",e=e.deltaY,s="",o=fabric.Object.NUM_FRACTION_DIGITS;return e&&(s=' dy="'+a(e,o)+'" '),['<tspan x="',a(i,o),'" y="',a(r,o),'" ',s,n,">",fabric.util.string.escapeXml(t),"</tspan>"].join("")},_setSVGTextLineText:function(t,e,i,r){var n,s,o,a,c=this.getHeightOfLine(e),h=-1!==this.textAlign.indexOf("justify"),l="",u=0,f=this._textLines[e];r+=c*(1-this._fontSizeFraction)/this.lineHeight;for(var d=0,g=f.length-1;d<=g;d++)a=d===g||this.charSpacing,l+=f[d],o=this.__charBounds[e][d],0===u?(i+=o.kernedWidth-o.width,u+=o.width):u+=o.kernedWidth,(a=h&&!a&&this._reSpaceAndTab.test(f[d])?!0:a)||(n=n||this.getCompleteStyleDeclaration(e,d),s=this.getCompleteStyleDeclaration(e,d+1),a=fabric.util.hasStyleChanged(n,s,!0)),a&&(o=this._getStyleDeclaration(e,d)||{},t.push(this._createTextCharSpan(l,o,i,r)),l="",n=s,i+=u,u=0)},_pushTextBgRect:function(t,e,i,r,n,s){var o=fabric.Object.NUM_FRACTION_DIGITS;t.push("\t\t<rect ",this._getFillAttributes(e),' x="',a(i,o),'" y="',a(r,o),'" width="',a(n,o),'" height="',a(s,o),'"></rect>\n')},_setSVGTextLineBg:function(t,e,i,r){for(var n,s,o=this._textLines[e],a=this.getHeightOfLine(e)/this.lineHeight,c=0,h=0,l=this.getValueOfPropertyAt(e,0,"textBackgroundColor"),u=0,f=o.length;u<f;u++)n=this.__charBounds[e][u],(s=this.getValueOfPropertyAt(e,u,"textBackgroundColor"))!==l?(l&&this._pushTextBgRect(t,l,i+h,r,c,a),h=n.left,c=n.width,l=s):c+=n.kernedWidth;s&&this._pushTextBgRect(t,s,i+h,r,c,a)},_getFillAttributes:function(t){var e=t&&"string"==typeof t?new fabric.Color(t):"";return e&&e.getSource()&&1!==e.getAlpha()?'opacity="'+e.getAlpha()+'" fill="'+e.setAlpha(1).toRgb()+'"':'fill="'+t+'"'},_getSVGLineTopOffset:function(t){for(var e,i=0,r=0;r<t;r++)i+=this.getHeightOfLine(r);return e=this.getHeightOfLine(r),{lineTop:i,offset:(this._fontSizeMult-this._fontSizeFraction)*e/(this.lineHeight*this._fontSizeMult)}},getSvgStyles:function(t){return fabric.Object.prototype.getSvgStyles.call(this,t)+" white-space: pre;"}})}(),function(t){"use strict";var b=t.fabric||(t.fabric={});b.Textbox=b.util.createClass(b.IText,b.Observable,{type:"textbox",minWidth:20,dynamicMinWidth:2,__cachedLines:null,lockScalingFlip:!0,noScaleCache:!1,_dimensionAffectingProps:b.Text.prototype._dimensionAffectingProps.concat("width"),_wordJoiners:/[ \t\r]/,splitByGrapheme:!1,initDimensions:function(){this.__skipDimension||(this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set("width",this.dynamicMinWidth),-1!==this.textAlign.indexOf("justify")&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},_generateStyleMap:function(t){for(var e=0,i=0,r=0,n={},s=0;s<t.graphemeLines.length;s++)"\n"===t.graphemeText[r]&&0<s?(i=0,r++,e++):!this.splitByGrapheme&&this._reSpaceAndTab.test(t.graphemeText[r])&&0<s&&(i++,r++),n[s]={line:e,offset:i},r+=t.graphemeLines[s].length,i+=t.graphemeLines[s].length;return n},styleHas:function(t,e){var i;return this._styleMap&&!this.isWrapping&&(i=this._styleMap[e])&&(e=i.line),b.Text.prototype.styleHas.call(this,t,e)},isEmptyStyles:function(t){if(!this.styles)return!0;var e,i,r,n=0,s=!1,o=this._styleMap[t],a=this._styleMap[t+1];for(r in o&&(t=o.line,n=o.offset),a&&(s=a.line===t,e=a.offset),i=void 0===t?this.styles:{line:this.styles[t]})for(var c in i[r])if(n<=c&&(!s||c<e))for(var h in i[r][c])return!1;return!0},_getStyleDeclaration:function(t,e){if(this._styleMap&&!this.isWrapping){var i=this._styleMap[t];if(!i)return null;t=i.line,e=i.offset+e}return this.callSuper("_getStyleDeclaration",t,e)},_setStyleDeclaration:function(t,e,i){var r=this._styleMap[t];t=r.line,e=r.offset+e,this.styles[t][e]=i},_deleteStyleDeclaration:function(t,e){var i=this._styleMap[t];t=i.line,e=i.offset+e,delete this.styles[t][e]},_getLineStyle:function(t){t=this._styleMap[t];return!!this.styles[t.line]},_setLineStyle:function(t){t=this._styleMap[t];this.styles[t.line]={}},_wrapText:function(t,e){var i,r=[];for(this.isWrapping=!0,i=0;i<t.length;i++)r=r.concat(this._wrapLine(t[i],i,e));return this.isWrapping=!1,r},_measureWord:function(t,e,i){var r,n=0;i=i||0;for(var s=0,o=t.length;s<o;s++)n+=this._getGraphemeBox(t[s],e,s+i,r,!0).kernedWidth,r=t[s];return n},_wrapLine:function(t,e,i,r){var n,s,o=0,a=this.splitByGrapheme,c=[],h=[],l=a?b.util.string.graphemeSplit(t):t.split(this._wordJoiners),u=0,f=a?"":" ",d=0,g=0,p=!0,m=this._getWidthOfCharSpacing(),r=r||0;0===l.length&&l.push([]),i-=r;for(var v=0;v<l.length;v++)n=a?l[v]:b.util.string.graphemeSplit(l[v]),s=this._measureWord(n,e,u),u+=n.length,i<(o+=d+s-m)&&!p?(c.push(h),h=[],o=s,p=!0):o+=m,p||a||h.push(f),h=h.concat(n),d=a?0:this._measureWord([f],e,u),u++,p=!1,g<s&&(g=s);return v&&c.push(h),g+r>this.dynamicMinWidth&&(this.dynamicMinWidth=g-m+r),c},isEndOfWrapping:function(t){return!this._styleMap[t+1]||this._styleMap[t+1].line!==this._styleMap[t].line},missingNewlineOffset:function(t){return!this.splitByGrapheme||this.isEndOfWrapping(t)?1:0},_splitTextIntoLines:function(t){for(var t=b.Text.prototype._splitTextIntoLines.call(this,t),e=this._wrapText(t.lines,this.width),i=new Array(e.length),r=0;r<e.length;r++)i[r]=e[r].join("");return t.lines=i,t.graphemeLines=e,t},getMinWidth:function(){return Math.max(this.minWidth,this.dynamicMinWidth)},_removeExtraneousStyles:function(){var t,e={};for(t in this._styleMap)this._textLines[t]&&(e[this._styleMap[t].line]=1);for(t in this.styles)e[t]||delete this.styles[t]},toObject:function(t){return this.callSuper("toObject",["minWidth","splitByGrapheme"].concat(t))}}),b.Textbox.fromObject=function(t,e){var i=b.util.stylesFromArray(t.styles,t.text),t=Object.assign({},t,{styles:i});return b.Object._fromObject("Textbox",t,e,"text")}}("undefined"!=typeof exports?exports:this),function(){var t=fabric.controlsUtils,e=t.scaleSkewCursorStyleHandler,i=t.scaleCursorStyleHandler,r=t.scalingEqually,n=t.scalingYOrSkewingX,s=t.scalingXOrSkewingY,o=t.scaleOrSkewActionName,a=fabric.Object.prototype.controls;a.ml=new fabric.Control({x:-.5,y:0,cursorStyleHandler:e,actionHandler:s,getActionName:o}),a.mr=new fabric.Control({x:.5,y:0,cursorStyleHandler:e,actionHandler:s,getActionName:o}),a.mb=new fabric.Control({x:0,y:.5,cursorStyleHandler:e,actionHandler:n,getActionName:o}),a.mt=new fabric.Control({x:0,y:-.5,cursorStyleHandler:e,actionHandler:n,getActionName:o}),a.tl=new fabric.Control({x:-.5,y:-.5,cursorStyleHandler:i,actionHandler:r}),a.tr=new fabric.Control({x:.5,y:-.5,cursorStyleHandler:i,actionHandler:r}),a.bl=new fabric.Control({x:-.5,y:.5,cursorStyleHandler:i,actionHandler:r}),a.br=new fabric.Control({x:.5,y:.5,cursorStyleHandler:i,actionHandler:r}),a.mtr=new fabric.Control({x:0,y:-.5,actionHandler:t.rotationWithSnapping,cursorStyleHandler:t.rotationStyleHandler,offsetY:-40,withConnection:!0,actionName:"rotate"}),fabric.Textbox&&((s=fabric.Textbox.prototype.controls={}).mtr=a.mtr,s.tr=a.tr,s.br=a.br,s.tl=a.tl,s.bl=a.bl,s.mt=a.mt,s.mb=a.mb,s.mr=new fabric.Control({x:.5,y:0,actionHandler:t.changeWidth,cursorStyleHandler:e,actionName:"resizing"}),s.ml=new fabric.Control({x:-.5,y:0,actionHandler:t.changeWidth,cursorStyleHandler:e,actionName:"resizing"}))}();(function(global){"use strict";var fabric=global.fabric||(global.fabric={}),extend=fabric.util.object.extend,clone=fabric.util.object.clone;if(fabric.CurvedText){fabric.warn('fabric.CurvedText is already defined');return;}
var stateProperties=fabric.Text.prototype.stateProperties.concat();stateProperties.push('radius','spacing','reverse');var _dimensionAffectingProps=[];var delegatedProperties={};delegatedProperties['backgroundColor']=true;delegatedProperties['textBackgroundColor']=true;delegatedProperties['textDecoration']=true;delegatedProperties['stroke']=true;delegatedProperties['strokeWidth']=true;delegatedProperties['shadow']=true;delegatedProperties['fontWeight']=true;delegatedProperties['fontStyle']=true;delegatedProperties['fontFamily']=true;delegatedProperties['fill']=true;delegatedProperties['lineHeight']=true;delegatedProperties['fontSize']=true;delegatedProperties['padding']=true;delegatedProperties['underline']=true;delegatedProperties['charSpacing']=true;delegatedProperties['styles']=true;fabric.CurvedText=fabric.util.createClass(fabric.Text,{type:'curvedText',radius:50,spacing:20,reverse:false,stateProperties:stateProperties,delegatedProperties:delegatedProperties,_dimensionAffectingProps:_dimensionAffectingProps,_isRendering:0,complexity:function(){this.callSuper('complexity');},initialize:function(text,options){this.styles=options?(options.styles||{}):{};this.letters=new fabric.Group([],{selectable:false,padding:0});this.__skipDimension=true;this.callSuper('initialize',text,options);this.__skipDimension=false;this.setText(text);this._render();},setText:function(text){if(this.letters){while(text.length!==0&&this.letters.size()>=text.length){this.letters.remove(this.letters.item(this.letters.size()-1));}
for(var i=0;i<text.length;i++){if(this.letters.item(i)===undefined){var letter=new fabric.Text(text[i]);letter.objectCaching=false;this.letters.add(letter);}else{this.letters.item(i).set('text',text[i]);}}}
this.text=text;this._render();},_initDimensions:function(ctx){if(this.__skipDimension){return;}
if(!ctx){ctx=this.getMeasuringContext();}
this._splitText();this._clearCache();this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH;this.height=this.calcTextHeight();this._render(ctx);},_render:function(ctx){var renderingCode=fabric.util.getRandomInt(100,999);this._isRendering=renderingCode;if(this.letters){var curAngle=0,angleRadians=0,align=0,textWidth=0,space=parseInt(this.spacing),len=this.text.length;for(var i=0;i<len;i++){textWidth+=this.letters.item(i).width+space;}
textWidth-=space;if(this.get('textAlign')==='right'){curAngle=90-(((textWidth/2)/this.radius)/(Math.PI/180));}else if(this.get('textAlign')==='left'){curAngle=-90-(((textWidth/2)/this.radius)/(Math.PI/180));}else{curAngle=-(((textWidth/2)/this.radius)/(Math.PI/180));}
if(this.reverse)
curAngle=-curAngle;var width=0,multiplier=this.reverse?-1:1,thisLetterAngle=0,lastLetterAngle=0;for(var i=0;i<len;i++){if(renderingCode!==this._isRendering)
return;for(var key in this.delegatedProperties){this.letters.item(i).set(key,this.get(key));}
this.letters.item(i).set('left',(width));this.letters.item(i).set('top',(0));this.letters.item(i).rotate(0);this.letters.item(i).set('padding',0);thisLetterAngle=((this.letters.item(i).width+space)/this.radius)/(Math.PI/180);curAngle=multiplier*((multiplier*curAngle)+lastLetterAngle);angleRadians=curAngle*(Math.PI/180);lastLetterAngle=thisLetterAngle;this.letters.item(i).rotate(curAngle);this.letters.item(i).set('top',multiplier*-1*(Math.cos(angleRadians)*this.radius));this.letters.item(i).set('left',multiplier*(Math.sin(angleRadians)*this.radius));this.letters.item(i).set('padding',0);this.letters.item(i).set('selectable',false);}
this.letters.set('scaleX',1);this.letters.set('scaleY',1);this.letters.set('angle',0);this.letters._calcBounds();this.letters._updateObjectsCoords();this.width=this.letters.width;this.height=this.letters.height;this.letters.left=-(this.width / 2);this.letters.top=-(this.height / 2);}},render:function(ctx){if(!this.visible){return;}
if(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()){return;}
ctx.save();this.transform(ctx);this.clipTo&&fabric.util.clipContext(this,ctx);this._initDimensions();var len=this.letters.size();for(var i=0;i<len;i++){var obj=this.letters.item(i);if(!obj.visible){continue;}
obj.render(ctx);}
this.clipTo&&ctx.restore();ctx.restore();this.setCoords();},_set:function(key,value){this.callSuper('_set',key,value);if(this.letters){if(key=='text'){this.setText(value);}else if(this.letters.size()){this._render();}
if(key!='flipX'&&key!='flipY'){this.letters.set(key,value);}
this._initDimensions();this.setCoords();}},toObject:function(propertiesToInclude){var object=extend(this.callSuper('toObject',propertiesToInclude),{radius:this.radius,spacing:this.spacing,reverse:this.reverse});if(!this.includeDefaultValues){this._removeDefaultValues(object);}
return object;},toString:function(){return'#<fabric.CurvedText ('+this.complexity()+'): { "text": "'+this.text+'", "fontFamily": "'+this.fontFamily+'", "radius": "'+this.radius+'", "spacing": "'+this.spacing+'", "reverse": "'+this.reverse+'" }>';},toSVG:function(reviver){var markup=[];var markup=['<g ',this.getSvgTransform(),'>'];if(this.letters){for(var i=0,len=this.letters.size();i<len;i++){markup.push(this.letters.item(i).toSVG(reviver));}}
markup.push('</g>');return reviver?reviver(markup.join('')):markup.join('');}});fabric.CurvedText.fromObject=function(object,callback){return fabric.Object._fromObject('CurvedText',object,callback,'text');};fabric.util.createAccessors&&fabric.util.createAccessors(fabric.CurvedText);fabric.CurvedText.async=false;})(typeof exports!=='undefined'?exports:this);var _txt_base_obj='text',_txt_obj_types=['text','curvedText'],_txt_obj_type='Text',pd_init_done=false,pd_cur_design_data,shapes_cache={},canvas_disabled=false;$(window).on('load',function(){if(typeof(product_views)=='undefined'){return;}
var _data={'txt_base_obj':_txt_base_obj,'txt_obj_types':_txt_obj_types,'txt_obj_type':_txt_obj_type};$.ceEvent('trigger','ce.pd_window_load',[_data]);_txt_base_obj=_data.txt_base_obj;_txt_obj_types=_data.txt_obj_types;_txt_obj_type=_data.txt_obj_type;$.widget('custom.iconselectmenu',$.ui.selectmenu,{_renderItem:function(ul,item){var li=$('<li>'),wrapper=$('<div>',{style:item.element.attr('data-style'),text:item.label,'class':item.element.attr('data-class'),'title':item.element.attr('data-title')});return li.append(wrapper).appendTo(ul);}});if(mobile_mode){(function(){var addListener=fabric.util.addListener,removeListener=fabric.util.removeListener,addEventOptions={passive:false};fabric.util.object.extend(fabric.Canvas.prototype,{_onTouchStart:function(e){if(this.mainTouchId===null){this.mainTouchId=this.getPointerId(e);}
this.__onMouseDown(e);this._resetTransformEventData();var canvasElement=this.upperCanvasEl,eventTypePrefix=this._getEventPrefix();addListener(fabric.document,'touchend',this._onTouchEnd,addEventOptions);addListener(fabric.document,'touchmove',this._onMouseMove,addEventOptions);removeListener(canvasElement,eventTypePrefix+'down',this._onMouseDown);}});})();}
fn_init_pd();});function fn_init_pd(){if(typeof(product_views)=='undefined'||Tygh.area!='A'&&pd_init_done==true){return;}
$('button',$('#pd_tabs')).button();$('select',$('#pd_tabs')).iconselectmenu({appendTo:'#pd_tabs'});$('#text_style').buttonset();$('#art_panel_filter').buttonset();$('#photo_panel_filter').buttonset();if(tool_settings.cp_art!=1){$('#art_panel_colors').buttonset();}
if(pd_location=='U'){$('#canvas_lock').buttonset();$('body').prepend($('#secondary_images_panel'));}
if(pd_location=='C'){$('body').prepend($('#pd_tooltip'));}
fn_init_mobile_view();if(Tygh.area=='A'&&$('#content_product_designer').length>0){(function(_,$){$.ceEvent('on','ce.tab.show',function(){if($('#content_product_designer').is(':visible')&&!$('#content_product_designer').data('displayed')){fn_pd_update_layout();$('#content_product_designer').data('displayed',true);}});setTimeout(function(){$.ceEvent('trigger','ce.tab.show');},100);}(Tygh,Tygh.$));}
$.ceEvent('on','dispatch_event_pre',function(e,jelm,processed){if(e.type=='keydown'){var char_code=(e.which)?e.which:e.keyCode;var obj=cnvs.getActiveObject();if(obj){var arrows=[37,38,39,40];if(jQuery.inArray(char_code,arrows)!==-1&&!jelm.is('textarea')&&!jelm.is('input')){if(char_code==37){obj.set('left',obj.left-1);}else if(char_code==38){obj.set('top',obj.top-1);}else if(char_code==39){obj.set('left',obj.left+1);}else if(char_code==40){obj.set('top',obj.top+1);}
obj.setCoords();obj.fire('modified');cnvs.requestRenderAll();processed.status=true;processed.to_return=false;}}}});pd_init_done=true;}
function fn_init_mobile_view(){$('#canvas_img').on('load',function(){$(this).data('loaded',true);fn_pd_reposition_canvas_image($(this));});cnvs=new fabric.Canvas('main_canvas');cnvs.preserveObjectStacking=true;cnvs.controlsAboveOverlay=true;cnvs.bordersCanvas=cnvs._createCanvasElement();$(cnvs.lowerCanvasEl).after($(cnvs.bordersCanvas));if(product_mode=='sticker'){cnvs.bgCanvas=cnvs._createCanvasElement();$(cnvs.lowerCanvasEl).before($(cnvs.bgCanvas));}
fn_pd_update_layout();if(mobile_mode){var tmf=function(e){e.preventDefault();};cnvs.on('mouse:down',function(evt){var obj=cnvs.getActiveObject();if(obj){$('*').bind('touchmove',tmf);}});cnvs.on('mouse:up',function(evt){$('*').unbind('touchmove',tmf);});cnvs.selection=false;cnvs.allowTouchScrolling=true;tool_settings.hide_sizes_tooltip=1;$('canvas').css('touch-action','manipulation');}
cnvs.on('object:added',function(evt){var item=evt.target;item.lockScalingFlip=true;item.objectCaching=false;if(!item.uid){item.set('uid','_'+Math.random().toString(36).substr(2,9));}
if(jQuery.inArray(item.type,_txt_obj_types)!==-1){item.on('selected',fn_select_text);item.on('changed',fn_update_price);item.lineHeight=item.line_height?item.line_height:(tool_settings.line_height?tool_settings.line_height:1.16);if(item.textDecoration&&item.textDecoration=='underline'){item.set('underline',true);}
var res=item.fontFamily.split('_');fn_pd_change_font(res[1],function(){if(item.fontFamily!=font_name_prefix+res[1]){item.set('fontFamily',font_name_prefix+res[1]);item.canvas.requestRenderAll();}
var _data={'obj':item,'allow':true};$.ceEvent('trigger','ce.pd_change_font_on_text_addition',[_data]);if(_data.allow){item.loaded=true;}});}else if(item.type=='image'||item.type=='group'){item.on('selected',fn_select_art);if(item.type=='image'&&item.photo_id){item.on('scaling',fn_pd_check_photo_resolution);item.on('modified',fn_pd_set_photo_dimension);}}else if(item.type=='qr-code'){item.on('selected',fn_select_qrcode);}
if(tool_settings.hide_sizes_tooltip!=1){var setCoords=item.setCoords.bind(item);item.on({moving:setCoords,scaling:setCoords,rotating:setCoords});}
item.setControlsVisibility({tl:tool_settings.size==1,tr:tool_settings.rotation==1,br:tool_settings.size==1,bl:true,ml:false,mt:false,mr:false,mb:false,mtr:false,width_label:false,height_label:false});$.ceEvent('trigger','ce.canvas_object_added',[item]);cnvs.requestRenderAll();});cnvs.on('selection:created',function(evt){var selection=cnvs.getActiveObject();if(selection.type==='activeSelection'){selection.setControlsVisibility({tl:tool_settings.size==1,tr:tool_settings.rotation==1,br:tool_settings.size==1,bl:true,ml:false,mt:false,mr:false,mb:false,mtr:false,width_label:false,height_label:false});}});cnvs.on('selection:cleared',restore_default_textbox_state);if(tool_settings.hide_sizes_tooltip!=1){cnvs.on('object:scaling',function(evt){$('#pd_tooltip').show();var item=evt.target,offset=cnvs.calcOffset(),diff=10,tooltip_data=fn_pd_get_size_price_text(item);$('#pd_tooltip_size').html(tooltip_data[0]);$('#sec_pd_tooltip_price').html(tooltip_data[1]);$('#pd_tooltip').css({top:offset._offset.top+item.oCoords.br.y+diff,left:offset._offset.left+item.oCoords.br.x+diff});});cnvs.on('mouse:up',function(evt){$('#pd_tooltip').hide();});if(tool_settings.show_prices==1){$('#pd_tooltip_price_holder').show();}}
var _data={'cnvs':cnvs};$.ceEvent('trigger','ce.pd_init_view',[_data]);if(typeof(fn_pd_ext_update_layout)=='function'){fn_pd_ext_update_layout();}
if(product_views.length){fn_change_view(0);}else{cart_id=0;}
if(product_selected_options){fn_change_product_images_by_options();}
$('#text_font').on('iconselectmenuchange',function(){var obj=cnvs.getActiveObject();if(obj&&jQuery.inArray(obj.type,_txt_obj_types)!==-1){var font_id=$('#text_font').val(),font_name=fn_get_font_name(font_id);obj.set('text',fn_change_capitalize($('#text_font').val(),obj.text));$('#text_panel_area').val(obj.text);fn_pd_change_font(font_id,function(){obj.font_id=font_id;obj.font=font_name;obj.set('fontFamily',font_name_prefix+font_id);cnvs.requestRenderAll();$.ceEvent('trigger','ce.pd_font_changed_by_control',[obj]);});}});$('#text_bold').change(function(){var obj=cnvs.getActiveObject();if(obj&&jQuery.inArray(obj.type,_txt_obj_types)!==-1){obj.set('fontWeight',this.checked?'bold':'normal');cnvs.requestRenderAll();}});$('#text_italic').change(function(){var obj=cnvs.getActiveObject();if(obj&&jQuery.inArray(obj.type,_txt_obj_types)!==-1){obj.set('fontStyle',this.checked?'italic':'normal');cnvs.requestRenderAll();}});$('#text_underline').change(function(){var obj=cnvs.getActiveObject();if(obj&&jQuery.inArray(obj.type,_txt_obj_types)!==-1){obj.set('underline',this.checked);cnvs.requestRenderAll();}});$('input[name=text_align]').change(function(){var obj=cnvs.getActiveObject();if(obj&&(obj.type==_txt_base_obj)){obj.set('textAlign',this.value);cnvs.requestRenderAll();}});if($('#line_spacing').length>0){$('#line_spacing').slider({step:0.01,min:0.62,max:2.5,range:'min',slide:function(event,ui){var obj=cnvs.getActiveObject();if(obj&&obj.type==_txt_base_obj){obj.lineHeight=ui.value;cnvs.requestRenderAll();}}});}
if($('#arc_radius').length>0){$('#arc_radius').slider({step:5,min:-1000,max:1000,value:-1000,range:'min',slide:function(event,ui){fn_pd_apply_arc_radius(ui.value);}});$('#arc_spacing').slider({step:0.1,min:0,max:50,range:'min',slide:function(event,ui){var obj=cnvs.getActiveObject();if(obj&&obj.type=='curvedText'){obj.set('spacing',ui.value);cnvs.requestRenderAll();}}});}
$('#allow_category_id').on('iconselectmenuchange',function(){var id=$(this).val(),w=tool_settings.art_th_w,h=tool_settings.art_th_h;$('.thumb-item',$('#arts_list')).remove();for(var i in cliparts_data){if(id==cliparts_data[i].parent_id){$('<div class="thumb-item" rel="'+cliparts_data[i].clipart_id+'" rev="'+cliparts_data[i].file_path+'" pd_clipart="'+cliparts_data[i].clipart+'" style="background-image: url(\''+fn_url('product_designer.get_clipart_file?clipart_id='+cliparts_data[i].clipart_id+'&w='+w+'&h='+h)+'\'); width: '+w+'px; height: '+h+'px;" onclick="fn_pd_add_art(this);"></div>').insertBefore($('div:last',$('#arts_list')));}}});if(!tool_settings.allow_category_id){$('#allow_category_id').trigger('iconselectmenuchange');}
cnvs.on('after:render',function(e){fn_update_price();});if(pd_location=='C'||pd_location=='O'){$('#fileupload').fileupload({add:function(e,data){var jqXHR=data.submit();$.ceEvent('trigger','ce.pd_fileupload_add',[data]);$('#progress').show();},progress:function(e,data){$('#progress .bar').css('width',parseInt(data.loaded / data.total*100,10)+'%');},done:function(e,data){var result=$.parseJSON(data.result);fn_pd_hide_progress_bar();if(result.msg&&result.msg=='success'){var new_th=$('<div id="pdph'+result.id+'" class="thumb-item" rel="'+result.id+'" pd_photo="'+result.photo+'" data-pd-image-x="'+result.image_x+'" data-pd-image-y="'+result.image_y+'" style="background-image: url(\''+fn_url('product_designer.generate_thumbnail?w='+tool_settings.art_th_w+'&photo_id='+result.id)+'\'); width: '+tool_settings.art_th_w+'px; height: '+tool_settings.art_th_h+'px;" onclick="return fn_pd_add_photo(this, event);" title="'+result.photo+'"><span class="edit-tools" style="width: '+(tool_settings.art_th_w-3)+'px;">'+(pd_location=='C'?'<a title="'+_lvars.delete_text+'")}"><i class="fa fa-remove" onclick="return fn_pd_delete_photo('+result.id+', event);"></i></a>':'')+'</span></div>');var ph_panel;if(mobile_mode){ph_panel=$('.thumbs-holder',$('#photo_list_holder'));}
if(!mobile_mode||ph_panel.length==0){ph_panel=$('.thumbs-holder',$('#content_upload_photo_panel'));}
ph_panel.prepend(new_th);$.ceEvent('trigger','ce.pd_fileupload_done',[new_th,result]);if(tool_settings.show_photo_help==1){fn_show_popup_dialog(_lvars.notice,_lvars.upload_photo_help,_lvars.ok);}}else if(result.error){$.ceNotification('show',{type:'E',title:_lvars.error,message:result.msg,message_state:'I'});}},fail:function(e,data){fn_pd_hide_progress_bar();$.ceNotification('show',{type:'E',title:_lvars.error,message:_lvars.file_transfer_failed,message_state:'I'});}});}
$('#popup_dialog').dialog({resizable:false,maxHeight:550,modal:true,autoOpen:false,closeOnEscape:false,maxWidth:750});if(!mobile_mode){$('#text_panel_area').on('keyup change',function(){$(this).val(fn_change_capitalize($('#text_font').val(),$(this).val()));var obj=cnvs.getActiveObject();if(obj&&jQuery.inArray(obj.type,_txt_obj_types)!==-1){var _data={'allow':true,'obj':obj,'txt':$(this).val()};$.ceEvent('trigger','ce.pd_set_new_text_value',[_data]);if(_data['allow']){obj.set('text',_data['txt']);cnvs.requestRenderAll();}}});$('#qr_panel_area').on('keyup change',function(){var obj=cnvs.getActiveObject();if(obj&&obj.type=='qr-code'){fn_generate_qrcode(obj,$(this).val(),obj.fill,obj.bg_fill,obj.color_value,obj.color,obj.bg_color_value,obj.bg_color,);obj.qr_text=$(this).val();cnvs.requestRenderAll();}});}
if(pd_location!='U'){$.ceEvent('trigger','ce.pd_init_view_data');}
$('#text_panel_area').on('focus',function(e){if($(this).val()==_lvars.type_text){$(this).val('');}});if((pd_location=='C'||pd_location=='O')&&product_mode=='sticker'){$('#sticker_width').keyup(function(){var elm=$(this);clearTimeout(elm.data('_timer'));elm.data('_timer',setTimeout(function(){fn_pd_update_sticker(elm);},mobile_mode?1000:500));});$('#sticker_height').keyup(function(){var elm=$(this);clearTimeout(elm.data('_timer'));elm.data('_timer',setTimeout(function(){fn_pd_update_sticker(elm);},mobile_mode?1000:500));});}
$(window).resize(function(){fn_pd_reposition_tools_panel();});if(cart_id==0){$('#main_page').css('visibility','visible');}
_data={'cnvs':cnvs};$.ceEvent('trigger','ce.pd_init_view_post',[_data]);$.ceEvent('on','ce.update_canvas_design_callback',function(data,params){if(data.pd_data){fn_pd_restore_design(data.pd_data);}});$.ceEvent('on','ce.ajaxlink.done.update_canvas_design_callback',function(evt,data){if(evt.pd_data||data.pd_data){fn_pd_restore_design(evt.pd_data?evt.pd_data:data.pd_data);}});}
function fn_pd_hide_progress_bar(){$('#progress').hide();$('#progress .bar').css('width','0%');$.ceEvent('trigger','ce.pd_fileupload_progress_hide');}
function fn_pd_apply_arc_radius(value){value=Number(value);var obj=cnvs.getActiveObject(),minr=30,maxr=1000,minv=Math.log(minr),maxv=Math.log(maxr),scale=(maxv-minv)/(maxr-minr);_tmp=value+(value>0?minr:-minr),_val=(value>0?1:-1)*Math.exp(minv+scale*(Math.abs(_tmp)-minr))+(value>0?0:minr);if(obj&&value!=0&&/text/.test(obj.type)){var default_text=obj.text,props=obj.toObject();delete props['type'];props['textAlign']='center';props['radius']=_val;props['spacing']=0;var textSample=new fabric.CurvedText(default_text,props);cnvs.remove(obj);cnvs.add(textSample).requestRenderAll();cnvs.setActiveObject(textSample);}else if(obj&&Math.abs(value)==1000&&obj.type=='curvedText'){var default_text=obj.text,props=obj.toObject();delete props['type'];var textSample=new fabric[_txt_obj_type](default_text,props);cnvs.remove(obj);cnvs.add(textSample).requestRenderAll();cnvs.setActiveObject(textSample);}
obj=cnvs.getActiveObject();if(obj&&obj.type=='curvedText'){obj.set('radius',_val);cnvs.requestRenderAll();}}
function fn_change_capitalize(font_id,text){for(var _id in fonts_data){if(fonts_data[_id].font_id==font_id){if(fonts_data[_id].capitalize=='Y'){return text.toUpperCase();}
return text;}}}
function restore_default_textbox_state(){$('textarea',$('#text_edit_panel')).val(_lvars.type_text);$('#text_panel_area').val(_lvars.type_text);}
function fn_pd_reposition_tools_panel(){var tools_panel_paddings=$('#pd_tools').outerWidth(true)-$('#pd_tools').width();var canvas_paddings=$('#pd_canvas').length?$('#pd_canvas').outerWidth(true)-$('#pd_canvas').width():0;$('#pd_tools').css('width',($('#main_page').width()-($('#pd_canvas').length?$('#pd_canvas').width():view_width)-tools_panel_paddings-canvas_paddings-2)+'px');}
function fn_pd_update_layout(){var cnw=view_width,cnh=view_height;if(mobile_mode){var cnvs_size=fn_calc_obj_size($('#pd_canvas').width(),view_height,view_width,view_height);cnw=cnvs_size.w;cnh=cnvs_size.h;}
cnvs.setWidth(cnw);cnvs.setHeight(cnh);cnvs.setDimensions({width:view_width,height:view_height},{backstoreOnly:true});cnvs._copyCanvasStyle(cnvs.lowerCanvasEl,cnvs.bordersCanvas);cnvs._applyCanvasStyle(cnvs.bordersCanvas);cnvs.bordersCanvas.width=cnvs.lowerCanvasEl.width;cnvs.bordersCanvas.height=cnvs.lowerCanvasEl.height;if(product_mode=='sticker'){cnvs._copyCanvasStyle(cnvs.lowerCanvasEl,cnvs.bgCanvas);cnvs._applyCanvasStyle(cnvs.bgCanvas);cnvs.bgCanvas.width=cnvs.lowerCanvasEl.width;cnvs.bgCanvas.height=cnvs.lowerCanvasEl.height;}
fn_pd_reposition_tools_panel();if(mobile_mode){$(cnvs.bordersCanvas).css({'width':cnw,'height':cnh});if(product_mode=='sticker'){$(cnvs.bgCanvas).css({'width':cnw,'height':cnh});}}
fn_pd_reposition_canvas_image($('#canvas_img'));if(cur_view!=-1){fn_apply_clip_area(masks[cur_view],false);}}
function fn_pd_reposition_canvas_image(img){img.css('width','auto');img.css('height','auto');var c_holder=$('#main_canvas').parent(),new_size=fn_calc_obj_size(c_holder.width(),c_holder.height(),img.get(0).width,img.get(0).height),c_holder_offset=c_holder.position();img.css('width',new_size.w+'px');img.css('height',new_size.h+'px');img.css('top',(c_holder_offset.top+(c_holder.height()-new_size.h)/ 2)+'px');img.css('left',(c_holder_offset.left+(c_holder.width()-new_size.w)/ 2)+'px');if(img.data('loaded')){img.show();}}
function fn_update_price(update_delay){if(pd_location!='C'||!pd_obj_loaded){return;}
if(!update_delay){update_delay=1700;}
clearTimeout(update_price_timer);update_price_timer=setTimeout(fn_send_update_price_request,update_delay);}
function fn_send_update_price_request(){fn_calculate_design_data();fn_change_options(mproduct_id,mproduct_id,0);$.ceEvent('trigger','ce.pd_update_price_post');}
function fn_calculate_design_data(){mviews[cur_view]=cnvs.toJSON();var char_count=0,art_ids='',lines=0,squares='',qr_squares='',s_obj,numcolors=[],used_colors=[],filled_sides='',ind={},_data={};$.ceEvent('trigger','ce.pd_calculate_design_data_pre',[_data]);for(var c_name in mviews){var filled=false;if(mviews[c_name].objects.length>0){for(var sign_name in mviews[c_name].objects){s_obj=mviews[c_name].objects[sign_name];if(jQuery.inArray(s_obj.type,_txt_obj_types)!==-1){if(text_price.type=='per_character'&&text_price.value>0){char_count+=s_obj.text.length;}else if(text_price.type=='per_line'){if(s_obj.text.length>0){lines+=s_obj.text.split('\n').length;}}else if(text_price.type=='per_centimeter'){lines+=fn_px_to_real(s_obj.width*s_obj.scaleX)*fn_px_to_real(s_obj.height*s_obj.scaleY);}
var _tmp={'lines':lines,'numcolors':numcolors}
$.ceEvent('trigger','ce.pd_calculate_design_data_texts',[s_obj,_tmp,text_price]);lines=_tmp.lines;numcolors=_tmp.numcolors;numcolors.push(rgb2hex(s_obj.fill));filled=true;}else if((s_obj.type=='image'&&s_obj.clipart_id!=0)||s_obj.type=='group'){var c_id=s_obj.clipart_id;for(var art in cliparts_data){if(cliparts_data[art].clipart_id==c_id){art_ids+=(art_ids==''?'':',')+c_id+'_'+fn_px_to_real(s_obj.width*s_obj.scaleX)+':'+fn_px_to_real(s_obj.height*s_obj.scaleY);break;}}
if(s_obj.type=='group'){if(s_obj.objects.length){for(var i=0;i<s_obj.objects.length;i++){if(s_obj.objects[i].fill){numcolors.push(rgb2hex(s_obj.objects[i].fill));}
if(s_obj.objects[i].stroke&&s_obj.objects[i].strokeWidth){numcolors.push(rgb2hex(s_obj.objects[i].stroke));}}}}
filled=true;}else if(s_obj.type=='image'&&s_obj.photo_id!=0&&s_obj.photo_id!=undefined){filled=true;squares+=(squares==''?'':',')+fn_px_to_real(s_obj.width*s_obj.scaleX)+':'+fn_px_to_real(s_obj.height*s_obj.scaleY);$.ceEvent('trigger','ce.pd_calculate_design_data_objects',[s_obj,numcolors]);}else if(s_obj.type=='qr-code'){filled=true;qr_squares+=(qr_squares==''?'':',')+fn_px_to_real(s_obj.width*s_obj.scaleX)+':'+fn_px_to_real(s_obj.height*s_obj.scaleY);}}
used_colors=used_colors.concat(numcolors);if(filled){filled_sides+=(filled_sides==''?'':',')+product_views[c_name].id;$.ceEvent('trigger','ce.pd_calculate_design_data_side',[_data,numcolors]);}}}
var sticker_sq=0;if(product_mode=='sticker'&&product_views[cur_view].canvas.shapes.length>0){var _sizes=typeof(masks[cur_view][0].real_width)!=='undefined'?masks[cur_view][0]:fn_pd_get_sticker_size(masks[cur_view]);sticker_sq=_sizes.real_width+':'+_sizes.real_height;}
numcolors=getUniqueArray(numcolors);$('#no_cache_holder').attr('name','yes_cache');$('#char_count').val(char_count);$('#art_ids').val(art_ids);$('#lines').val(lines);$('#photos').val(squares);$('#square').val(sticker_sq);$('#qrs').val(qr_squares);$('#numcolors').val(numcolors.length);$('#used_colors').val(getUniqueArray(used_colors).join(','));$('#numsides').val(filled_sides);$.ceEvent('trigger','ce.pd_calculate_design_data_post',[_data]);}
function fn_pd_get_sticker_size(_masks){var max_val=100000000;var result={min_x:max_val,max_x:0,min_y:max_val,max_y:0};for(var item in _masks){result.min_x=_masks[item].left>result.min_x?result.min_x:_masks[item].left;result.max_x=_masks[item].left+_masks[item].width*_masks[item].scaleX>result.max_x?_masks[item].left+_masks[item].width*_masks[item].scaleX:result.max_x;result.min_y=_masks[item].top>result.min_y?result.min_y:_masks[item].top;result.max_y=_masks[item].top+_masks[item].height*_masks[item].scaleY>result.max_y?_masks[item].top+_masks[item].height*_masks[item].scaleY:result.max_y;}
if(result.min_x==max_val){result.min_x=0;}
if(result.min_y==max_val){result.min_y=0;}
result.width=result.max_x-result.min_x;result.real_width=fn_px_to_real(result.width);result.height=result.max_y-result.min_y;result.real_height=fn_px_to_real(result.height);return result;}
function fn_pd_get_size_price_text(sign){var w=fn_px_to_real(sign.width*sign.scaleX),h=fn_px_to_real(sign.height*sign.scaleY),result=[w+_lvars[length_unit]+' x '+h+_lvars[length_unit]],_data={'cond':true};$.ceEvent('trigger','ce.pd_get_size_price_text',[_data]);if(pd_location=='C'&&tool_settings.show_prices==1&&_data['cond']){var delit=length_unit=='mm'?100:1;var s_obj;var c_name;var props;var sign_name;result[1]=$.formatNum(0);mviews[cur_view]=cnvs.toJSON();if(sign.type=='image'&&sign.photo_id!=0&&sign.photo_id!=undefined){if(photo_price.type=='per_size'){var mval;for(var ln in photo_price.value){if(mval){if(Number(mval.to)<Number(photo_price.value[ln].to)){mval=photo_price.value[ln];}}else{mval=photo_price.value[ln];}
if(w>Number(photo_price.value[ln].from)&&w<=Number(photo_price.value[ln].to)){mval=photo_price.value[ln];break;}}
if(mval.free!=undefined||photo_price.first_price!=undefined&&Number(photo_price.first_price)>0){var total_items=0,total_pos=0,items_in_group=0,pos_in_group=0;for(var c_name in mviews){if(mviews[c_name].objects.length>0){for(var sign_name in mviews[c_name].objects){s_obj=mviews[c_name].objects[sign_name];if(s_obj.type=='image'&&s_obj.photo_id!=0&&s_obj.photo_id!=undefined){var _sw=fn_px_to_real(s_obj.width*s_obj.scaleX);total_items+=1;if(_sw>Number(mval.from)&&_sw<=Number(mval.to)){items_in_group+=1;if(s_obj.uid==sign.uid){pos_in_group=items_in_group;total_pos=total_items;}}}}}}
var ph_price=photo_price.first_price!=undefined&&(total_items==1||total_items>1&&total_pos==1)?Number(photo_price.first_price):(mval.price!=undefined?Number(mval.price):0);result[1]=$.formatNum(mval.free==undefined?ph_price:(items_in_group==1||items_in_group>1&&pos_in_group==1?0:(mval.price!=undefined?Number(mval.price):0)));}else{result[1]=$.formatNum(mval.price!=undefined?Number(mval.price):0);}}else if(photo_price.type=='per_item'){var items=0;var price=0;for(var c_name in mviews){if(mviews[c_name].objects.length>0){for(var sign_name in mviews[c_name].objects){s_obj=mviews[c_name].objects[sign_name];if(s_obj.type=='image'&&s_obj.photo_id!=0&&s_obj.photo_id!=undefined){items+=1;if(s_obj.uid==sign.uid){for(var ph in photo_price.value){if(photo_price.value[ph].item==items||photo_price.value[ph].item=='other'){price=photo_price.value[ph].price;break;}}}}}
if(price>0){break;}}}
result[1]=$.formatNum(price);}else{result[1]=$.formatNum(photo_price.value*w*h / delit);}}else if(sign.type=='qr-code'){if(tool_settings.qr_price.type=='per_size'){var mval;for(var ln in tool_settings.qr_price.value){if(mval){if(Number(mval.to)<Number(tool_settings.qr_price.value[ln].to)){mval=tool_settings.qr_price.value[ln];}}else{mval=tool_settings.qr_price.value[ln];}
if(w>Number(tool_settings.qr_price.value[ln].from)&&w<=Number(tool_settings.qr_price.value[ln].to)){mval=tool_settings.qr_price.value[ln];break;}}
result[1]=$.formatNum(mval.price!=undefined?Number(mval.price):0);}else if(tool_settings.qr_price.type=='per_item'){var items=0;var price=0;for(var c_name in mviews){if(mviews[c_name].objects.length>0){for(var sign_name in mviews[c_name].objects){s_obj=mviews[c_name].objects[sign_name];if(s_obj.type=='qr-code'){items+=1;if(s_obj.uid==sign.uid){for(var ph in tool_settings.qr_price.value){if(tool_settings.qr_price.value[ph].item==items||tool_settings.qr_price.value[ph].item=='other'){price=tool_settings.qr_price.value[ph].price;break;}}}}}
if(price>0){break;}}}
result[1]=$.formatNum(price);}else{result[1]=$.formatNum(tool_settings.qr_price.value*w*h / delit);}}else if((sign.type=='image'&&sign.clipart_id!=0)||sign.type=='group'){var c_id=sign.clipart_id;var price=0;for(var art in cliparts_data){if(cliparts_data[art].clipart_id==c_id){if(cliparts_data[art].price>0){if(cliparts_data[art].price_type=='U'){price=cliparts_data[art].price;}else{price=cliparts_data[art].price*w*h / delit;}}
break;}}
result[1]=$.formatNum(price);}else if(jQuery.inArray(sign.type,_txt_obj_types)!==-1){if(text_price.type=='per_character'&&text_price.value>0){result[1]=$.formatNum(sign.text.length*text_price.value);}else if(text_price.type=='per_centimeter'){result[1]=$.formatNum(text_price.value*w*h / delit);}else if(text_price.type=="per_line"){if(sign.text.length>0){var lines=0;var line_cost=0;for(var c_name in mviews){if(mviews[c_name].objects.length>0){for(var sign_name in mviews[c_name].objects){s_obj=mviews[c_name].objects[sign_name];if(jQuery.inArray(s_obj.type,_txt_obj_types)!==-1){var price=0;for(var i=lines;i<lines+sign.text.split('\n').length;i++){if(text_price.value[i]!=undefined){line_cost=parseFloat(text_price.value[i].price);}
price+=line_cost;}
var _tmp={'price':price}
$.ceEvent('trigger','ce.pd_get_size_price_text_per_line_price',[s_obj,sign,_tmp]);price=_tmp.price;if(s_obj.uid==sign.uid){result[1]=$.formatNum(price);break;}
if(s_obj.text.length>0){lines+=s_obj.text.split('\n').length;}
_tmp={'lines':lines}
$.ceEvent('trigger','ce.pd_get_size_price_text_per_line',[s_obj,_tmp]);lines=_tmp.lines;}}}}}else{result[1]=$.formatNum(0);}}}}
return result;}
function fn_pd_check_colors(color,color_name){if(tool_settings.limit_colors==0||pd_location=='U'){return color;}
var notifications=[],cur_color,sign,color_vals=[];color_vals.push(color);$.ceEvent('trigger','ce.pd_check_colors',[color,color_vals,notifications]);color_vals=getUniqueArray(color_vals);for(var item in mviews){var _data={'cond':true};$.ceEvent('trigger','ce.pd_check_colors_side',[_data,item]);if(_data['cond']&&mviews[item].objects.length>0){var _objects=cur_view==item?cnvs.getObjects():mviews[item].objects;for(var id in _objects){sign=cur_view==item?cnvs.item(id):_objects[id];if(jQuery.inArray(sign.type,_txt_obj_types)!==-1){cur_color=rgb2hex(sign.fill);if(color_vals.length==tool_settings.limit_colors){if(color_vals.indexOf(cur_color)==-1){if(cur_view==item){sign.set('fill','#'+color);}else{sign.fill='#'+color;}
sign.color_value=parseInt(color,16);sign.color=color_name;cnvs.requestRenderAll();}}else{color_vals.push(cur_color);color_vals=getUniqueArray(color_vals);}
var _data={'color_vals':color_vals};$.ceEvent('trigger','ce.pd_check_colors_text_item',[_data,sign,color,color_name]);color_vals=_data['color_vals'];}else if(sign.type=='group'){var sign_objects=cur_view==item?sign._objects:sign.objects;if(sign_objects.length){for(var i=0;i<sign_objects.length;i++){if(sign_objects[i].fill){cur_color=rgb2hex(sign_objects[i].fill);if(color_vals.length==tool_settings.limit_colors){if(color_vals.indexOf(cur_color)==-1){if(cur_view==item){sign_objects[i].set('fill','#'+color);}else{sign_objects[i].fill='#'+color;}
cnvs.requestRenderAll();fn_pd_update_art_panel_colors(cur_color,color);}}else{color_vals.push(cur_color);color_vals=getUniqueArray(color_vals);}}
if(sign_objects[i].stroke&&sign_objects[i].strokeWidth){cur_color=rgb2hex(sign_objects[i].stroke);if(color_vals.length==tool_settings.limit_colors){if(color_vals.indexOf(cur_color)==-1){if(cur_view==item){sign_objects[i].set('stroke','#'+color);}else{sign_objects[i].stroke='#'+color;}
cnvs.requestRenderAll();fn_pd_update_art_panel_colors(cur_color,color);}}else{color_vals.push(cur_color);color_vals=getUniqueArray(color_vals);}}}}}}}}
if(notifications.length){$.ceNotification('showMany',notifications);}
var cur_obj=cnvs.getActiveObject();if(cur_obj){if(jQuery.inArray(cur_obj.type,_txt_obj_types)!==-1){cur_obj.fire('select');}}
fn_update_price();return color;}
function fn_pd_update_art_panel_colors(cur_color,color){if(tool_settings.cp_art!=1){$('.fa',$('#art_panel_colors')).each(function(){if($(this).attr('pd_color_value')==cur_color){$(this).css('color','#'+color).attr('pd_color_value',color).attr('pd_color','');}});}}
function fn_px_to_real(len){return fn_pd_round(len*unit_per_px,length_unit=='mm'?100:10000);}
function getUniqueArray(sourceArray){var uniqueArray=[];for(var a=0;a<sourceArray.length;a++){var found=false;for(var b=0;b<uniqueArray.length;b++){if(sourceArray[a]==uniqueArray[b]){found=true;break;}}
if(found==false){uniqueArray.push(sourceArray[a]);}}
return uniqueArray;}
function fn_pre_change_options(product_id,option_id,variant_id,obj_id,color){product_selected_options[option_id]=variant_id;fn_change_product_images_by_options();}
function fn_change_product_images_by_options(){for(var i=0;i<product_views.length;i++){var true_image,img_id=0;if(product_views[i].image_options){for(var j=0;j<product_views[i].image_options.length;j++){true_image=true;for(var id in product_views[i].image_options[j]){true_image=true_image&&(product_views[i].image_options[j][id]==0||product_selected_options[id]&&product_views[i].image_options[j][id]==product_selected_options[id]);}
if(true_image){img_id=j;break;}}}
if(product_views[i].image_id){$('#side_th_'+i).attr('src',fn_url('product_designer.generate_thumbnail?image_id='+product_views[i].image_id[img_id]+'&w=80'));if(cur_view==i){fn_change_canvas_image(i,img_id);}}
$.ceEvent('trigger','ce.pd_change_product_images_by_options',[i,img_id]);}}
function fn_change_canvas_image(view,image){var _src=fn_url('product_designer.generate_thumbnail?image_id='+product_views[view].image_id[image]+'&w='+view_width+'&h='+view_height);if(_src!=$('#canvas_img').attr('src')){$('#canvas_img').hide();if(typeof(product_views[view].image_id[image])!='undefined'){$('#canvas_img').data('loaded',false);$('#canvas_img').attr('src',_src);}}}
function fn_change_view(view_id){if(cur_view==view_id){return;}
$.ceEvent('trigger','ce.pd_change_view',[view_id]);$('.side-th').removeClass('current-view');$('.side-th').eq(view_id).addClass('current-view');if(cur_view!=-1){fn_save_view_state(true);}
if(product_mode=='sticker'&&cur_view==-1){if(product_views[view_id].sticker!=undefined){product_views[view_id].canvas.bg_color_value=product_views[view_id].sticker.bg_color_value;product_views[view_id].canvas.bg_color=product_views[view_id].sticker.bg_color;}}
cnvs.clear();cur_view=view_id;if(mviews[cur_view]){fn_restore_signs_from_json(mviews[cur_view]);}else{masks[cur_view]=fn_pd_create_mask_data();}
if(mviews[cur_view]==undefined){if(product_views[cur_view].objects){fn_restore_signs_from_json({objects:product_views[cur_view].objects||product_views[cur_view].signs.objects});}else if(cart_id>0){cart_id=0;fn_change_view(0);$('#main_page').css('visibility','visible');}}
if(product_mode=='sticker'&&cur_view==0){var bcol=product_views[view_id].canvas.bg_color_value;if(tool_settings.cp_sticker==1){if($('#background_color').spectrum){$('#background_color').spectrum('set',bcol);}else{$('#background_color').val(bcol);}
$('#background_color').attr('pd_color_value',bcol.substring(1,7));}else{fn_set_palette_active_color($('#background_color'),rgb2hex(bcol));}}
if(masks[cur_view]){fn_apply_clip_area(masks[cur_view],false);}
if(product_mode=='sticker'&&tool_settings.change_sticker==1){if(product_views[view_id].sticker!=undefined){$('#sticker_width').val(product_views[view_id].sticker.real_width);$('#sticker_height').val(product_views[view_id].sticker.real_height);fn_pd_sticker_size_changer();}else{var _sizes=fn_pd_get_sticker_size(masks[cur_view]);$('#sticker_width').val(_sizes.real_width);$('#sticker_height').val(_sizes.real_height);if(masks[cur_view]){for(var item in masks[cur_view]){var m=masks[cur_view][item];m.real_width=_sizes.real_width;m.real_height=_sizes.real_height;}}}
fn_update_price();}
fn_change_product_images_by_options();$.ceEvent('trigger','ce.pd_change_view_post',[view_id]);if(typeof(fn_ext_change_view)=='function'){fn_ext_change_view();}}
function fn_pd_create_mask_data(){var _c_conf=product_views[cur_view].canvas,shapes=_c_conf.shapes,cur_mask={},first=true,stroke_color=_c_conf.border_color?fn_pd_hex_to_rgba(fn_int_to_color(_c_conf.border_color),_c_conf.border_alpha!=null&&_c_conf.border_alpha!=''?Number(_c_conf.border_alpha):1):'#000';for(var i in shapes){var rect={width:Number(shapes[i].conf.width),height:Number(shapes[i].conf.height),left:Number(shapes[i].conf.x),top:Number(shapes[i].conf.y),angle:Number(shapes[i].conf.rotation),evented:false,selectable:false,rx:Number(shapes[i].conf.round),ry:Number(shapes[i].conf.round),scaleX:shapes[i].conf.scale_x?shapes[i].conf.scale_x:1,scaleY:shapes[i].conf.scale_y?shapes[i].conf.scale_y:1,fill:product_mode=='sticker'?_c_conf.bg_color_value:'rgba(0,0,0,0)',stroke:stroke_color,firstInGroup:first,lastInGroup:false,_ind:i};if(shapes[i].conf.type=='custom_shape'){rect.shape=shapes[i].conf.shape||'';}
$.ceEvent('trigger','ce.pd_create_mask_data',[rect,shapes[i]]);cur_mask[i]=rect;first=false;}
if(cur_mask[i]){cur_mask[i].lastInGroup=true;}
return cur_mask;}
function fn_pd_hex_to_rgba(hex,alpha){if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)){var c=hex.substring(1).split('');if(c.length==3){c=[c[0],c[0],c[1],c[1],c[2],c[2]];}
c='0x'+c.join('');return'rgba('+[(c>>16)&255,(c>>8)&255,c&255].join(',')+', '+alpha+')';}
throw new Error('Bad Hex');}
function fn_prepare_objects_for_mask(alpha,del_border_obj){var _rem=[];for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.type=='rect'||item.type=='path'||item.type=='group'&&!item.clipart_id){if(del_border_obj){item.off('removed');_rem.push(item);}}else{item.set('opacity',alpha);}}
if(del_border_obj&&_rem.length){for(var id in _rem){cnvs.remove(_rem[id]);}}}
function fn_apply_clip_area(clip_data,transp,selected_obj){$.ceEvent('trigger','ce.pd_apply_clip_area_pre',[clip_data,transp,selected_obj]);if(!selected_obj){selected_obj=cnvs.getActiveObject();}
cnvs.discardActiveObject();fn_prepare_objects_for_mask(0,true);var _ctx=cnvs.bordersCanvas.getContext('2d');_ctx.clearRect(0,0,cnvs.bordersCanvas.width,cnvs.bordersCanvas.height);if(product_mode=='sticker'){var bg_ctx=cnvs.bgCanvas.getContext('2d');bg_ctx.clearRect(0,0,cnvs.bgCanvas.width,cnvs.bgCanvas.height);}
cnvs.clipPath=null;cnvs.renderAll();var g=[];for(var i in clip_data){clip_data[i].opacity=0;if(clip_data[i].shape){var shape=clip_data[i].shape;if(shapes_cache[shape]){var sh=fn_pd_copy_mask_data(shapes_cache[shape],1);fn_set_shape_properties(sh,clip_data[i],true);g.push(sh);}else{fabric.loadSVGFromURL(shapes_dir+shape,function(objects,options){$.toggleStatusBox('hide');shapes_cache[shape]=fabric.util.groupSVGElements(objects,options);fn_apply_clip_area(clip_data,transp,selected_obj);});}
break;}else{var rect=new fabric.Rect(clip_data[i]);rect.opacity=1;rect.set('fill','#fff');g.push(rect);}}
var b_alpha=product_views[cur_view].canvas.border_alpha!=null&&product_views[cur_view].canvas.border_alpha!=''?Number(product_views[cur_view].canvas.border_alpha):1;if(!transp){for(var i in clip_data){var _data={'alpha':b_alpha,'mask_data':clip_data[i],'border_rendering':true};$.ceEvent('trigger','ce.pd_apply_clip_area',[_data]);b_alpha=_data.alpha;var conf=fn_pd_copy_mask_data(clip_data[i],b_alpha);if(clip_data[i].shape){var shape=conf.shape;if(shapes_cache[shape]){var sh=shapes_cache[shape];fn_set_shape_properties(sh,conf);if(product_mode=='sticker'){sh.set('fill',null);}
cnvs.add(sh);cnvs.renderAll();}else{fabric.loadSVGFromURL(shapes_dir+shape,function(objects,options){$.toggleStatusBox('hide');shapes_cache[shape]=fabric.util.groupSVGElements(objects,options);fn_apply_clip_area(clip_data,transp,selected_obj);$.ceEvent('trigger','ce.pd_shaped_border_drawn');});}
break;}else{if(product_mode=='sticker'){conf.fill=null;}
cnvs.add(new fabric.Rect(conf));cnvs.renderAll();}}
_ctx.drawImage(cnvs.lowerCanvasEl,0,0,cnvs.lowerCanvasEl.width,cnvs.lowerCanvasEl.height);if(product_mode=='sticker'){fn_prepare_objects_for_mask(0,true);for(var i in clip_data){var _data={'alpha':b_alpha,'mask_data':clip_data[i],'border_rendering':false};$.ceEvent('trigger','ce.pd_apply_clip_area',[_data]);b_alpha=_data.alpha;var conf=fn_pd_copy_mask_data(clip_data[i],b_alpha);if(clip_data[i].shape){var shape=conf.shape;if(shapes_cache[shape]){var sh=shapes_cache[shape];fn_set_shape_properties(sh,conf);sh.set('stroke',null);cnvs.add(sh);cnvs.renderAll();}
break;}else{conf.stroke=null;cnvs.add(new fabric.Rect(conf));cnvs.renderAll();}}
bg_ctx.drawImage(cnvs.lowerCanvasEl,0,0,cnvs.lowerCanvasEl.width,cnvs.lowerCanvasEl.height);}}
fn_prepare_objects_for_mask(1,true);cnvs.clipPath=new fabric.Group(g);cnvs.renderAll();if(pd_location=='U'&&!product_views[cur_view].canvas.lock){for(var i in clip_data){var rect=new fabric.Rect(fn_pd_copy_mask_data(clip_data[i],0));if(clip_data[i].shape){rect.shape=clip_data[i].shape;}
var _data={'alpha':b_alpha,'mask_data':clip_data[i]};$.ceEvent('trigger','ce.pd_apply_clip_area',[_data]);b_alpha=_data.alpha;rect.orig_opacity=b_alpha;rect.fill=null;cnvs.add(rect);cnvs.renderAll();if(clip_data[i].shape){break;}}}
if(selected_obj){for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(selected_obj.uid==item.uid){setTimeout(function(){item.off('selected');if(item.type=='rect'){item.on('selected',fn_pd_select_mask);cnvs.setActiveObject(item);}else if(item.type=='image'||item.type=='group'||jQuery.inArray(item.type,_txt_obj_types)!==-1){cnvs.setActiveObject(item);item.on('selected',jQuery.inArray(item.type,_txt_obj_types)!==-1?fn_select_text:fn_select_art);}
cnvs.renderAll();},10);break;}}}
$.ceEvent('trigger','ce.pd_apply_clip_area_done',[clip_data,transp,selected_obj]);}
function fn_set_shape_properties(sh,conf,visible){sh.left=conf.left;sh.top=conf.top;var sc=Math.min(conf.width / sh.width,conf.height / sh.height);sh.scaleX=sh.scaleY=sc;conf.width=sc*sh.width;conf.height=sc*sh.height;sh.angle=conf.angle;if(visible!=undefined){sh.opacity=1;sh.set('fill','#fff');sh.set('stroke','#fff');}else{sh.opacity=conf.opacity;sh.set('fill',conf.fill);sh.set('stroke',conf.stroke);}}
function fn_pd_copy_mask_data(clip_data,opacity){var mask_data={};for(var attr in clip_data){mask_data[attr]=clip_data[attr];}
mask_data.firstInGroup=true;mask_data.lastInGroup=true;if(opacity!=undefined){mask_data.opacity=opacity;}
return mask_data;}
var pd_obj_loaded_timeout=10000,pd_obj_loaded_counter,pd_obj_loaded=false;function fn_check_pd_objects_loaded(func){var loaded=true,_objects=cnvs.getObjects();for(var id in _objects){if(_objects[id].type=='image'&&!_objects[id].getElement()||jQuery.inArray(_objects[id].type,_txt_obj_types)!==-1&&!_objects[id].loaded){loaded=false;break;}}
var _data={'loaded':loaded};$.ceEvent('trigger','ce.check_pd_objects_loaded',[_data]);pd_obj_loaded_counter=pd_obj_loaded_counter-100;if(_data['loaded']==false&&pd_obj_loaded_counter>0){setTimeout(fn_check_pd_objects_loaded,100,func);}else{func();}}
function fn_restore_signs_from_json(json){cnvs.loadFromJSON(json,function(){if(cart_id||typeof(pd_design_id)!='undefined'&&pd_design_id>0){pd_obj_loaded_counter=pd_obj_loaded_timeout;if(cur_view<product_views.length-1){fn_check_pd_objects_loaded(function(){fn_change_view(cur_view+1);});}else{fn_check_pd_objects_loaded(function(){pd_obj_loaded=true;cart_id=0;pd_design_id=0;fn_change_view(0);$('#main_page').css('visibility','visible');});}}else{pd_obj_loaded=true;}},function(o,obj){if(obj&&obj.type=='image'){if(obj.filters.length){obj.applyFilters();}
var img=obj.getElement(),w=obj.width,h=obj.height;if(Tygh.area=='A'||w>img.width){obj.set('width',img.width);obj.set('height',img.height);obj.set('scaleX',obj.scaleX*w / img.width);obj.set('scaleY',obj.scaleY*h / img.height);}
cnvs.requestRenderAll();}});}
function fn_save_view_state(hide){var _objects=cnvs.getObjects();for(var id in _objects){if(_objects[id].type=='image'&&!_objects[id].getElement()){cnvs.remove(_objects[id]);}}
cnvs.discardActiveObject();fn_apply_clip_area(masks[cur_view],true);mviews[cur_view]=cnvs.toJSON();mviews_th[cur_view]={name:'canvas'+cur_view,thumb:cnvs.toDataURL('png')};if(typeof(hide)=='undefined'){fn_apply_clip_area(masks[cur_view]);}}
function fn_pd_add_to_cart(evt,skip_options){fn_save_view_state();var res=true;for(var i=0;i<product_views.length;i++){if(mviews[i]&&mviews[i].objects.length){res=false;}}
if(res){$.ceNotification('show',{type:'E',title:_lvars.error,message:_lvars.empty_design_error,message_state:'I'});evt.returnValue=false;return false;}
var _data={'result':res,'skip_options':skip_options,'evt':evt};$.ceEvent('trigger','ce.pd_pre_add_to_cart',[_data]);if(_data['result']){evt.returnValue=false;return false;}
for(var id in mviews){if(mviews[id].objects.length==0){delete mviews[id];delete mviews_th[id];}else{mviews[id].id=product_views[id].id;mviews[id].masks=masks[id];if(product_mode=='sticker'){var _sizes=typeof(masks[id][0].real_width)!=='undefined'?masks[id][0]:fn_pd_get_sticker_size(masks[id]);mviews[id].sticker={'bg_color_value':product_views[id].canvas.bg_color_value,'bg_color':product_views[id].canvas.bg_color,'real_width':_sizes.real_width,'real_height':_sizes.real_height,'ratio':unit_per_px};}
var true_image,img_id=0;for(var j=0;j<product_views[id].image_options.length;j++){true_image=true;for(var x in product_views[id].image_options[j]){true_image=true_image&&(product_views[id].image_options[j][x]==0||product_selected_options[x]&&product_views[id].image_options[j][x]==product_selected_options[x]);}
if(true_image){img_id=j;break;}}
mviews[id].bg_img_id=product_views[id].image_id[img_id];mviews[id].mobile_device=mobile_mode;}}
var _data={'mviews':mviews};$.ceEvent('trigger','ce.pd_post_add_to_cart',[_data]);mviews=_data['mviews'];$('#design_data').val(JSON.stringify(mviews));$('#th_result').val(JSON.stringify(mviews_th));evt.returnValue=true;return true;}
function fn_pd_save_design(evt,obj){if(tool_settings.number_of_designs>0&&pd_total_saved_designs>=tool_settings.number_of_designs){$.ceNotification('show',{type:'E',title:_lvars.error,message:_lvars.number_of_designs_error,message_state:'I'});$(obj).removeClass('cm-submit');evt.returnValue=false;return false;}
var res=fn_pd_add_to_cart(evt,true);if(res){$(obj).addClass('cm-submit');}else{$(obj).removeClass('cm-submit');}
evt.returnValue=res;return res;}
function fn_pd_ajaxpost_form(frm,elm){if(frm.save_result){pd_saved_designs=frm.save_result.saved_designs;pd_total_saved_designs=parseInt(frm.save_result.total_saved_designs);if(tool_settings.allow_save_pc&&mviews_th[cur_view]){fn_show_popup_dialog(_lvars.alert,_lvars.design_saved_on_page,_lvars.ok,function(){$('<a target="blank" href="'+fn_url('product_designer.get_design?design_id='+frm.save_result.design_id+'&w='+view_width+'&pos='+(cur_view+1)+'&file_name=design.png')+'"></a>').click();},_lvars.cancel);}else if(pd_total_saved_designs>0){fn_pd_show_saved_designs_popup();}}}
function fn_pd_show_saved_designs_popup(){var th=pd_auth_user_id!=pd_user_id?'<p>'+_lvars.login_to_save_designs+'</p>':'';for(var i in pd_saved_designs){th+='<a class="cm-ajax thumb-item" data-ca-event="ce.update_canvas_design_callback" data-ca-event-name="update_canvas_design_callback" href="'+fn_url('product_designer.get_saved_design?design_id='+pd_saved_designs[i].id+'&product_id='+mproduct_id)+'" onclick="fn_pd_close_dialog();" style="background-image: url(\''+fn_url('product_designer.get_design?design_id='+pd_saved_designs[i].id+'&w=150&pos='+pd_saved_designs[i].pos)+'\');"></a>';}
th+='<div style="clear: both;"></div>';fn_show_popup_dialog(_lvars.saved_designs,th);}
function fn_pd_close_dialog(){$('#popup_dialog').dialog('close');}
function fn_pd_restore_design(data){product_views=data.views;cur_view=-1;mviews={};mviews_th={};cnvs.clear();fn_change_view(0);}
function fn_pd_reset_design(){var _data={'restore_orig':false};$.ceEvent('trigger','ce.pd_reset_design',[_data]);fn_show_popup_dialog(_lvars.alert,_lvars.clear_design_notice,_lvars.ok,function(){if(!_data.restore_orig){for(var i in product_views){product_views[i].objects={};}}
cur_view=-1;mviews={};mviews_th={};cnvs.clear();fn_change_view(0);},_lvars.cancel);}
function fn_pd_canvas_no_exist(type){if(!product_views[cur_view]||product_views[cur_view].canvas.shapes.length==0||canvas_disabled){$.ceNotification('show',{type:'E',title:_lvars.error,message:pd_location=='U'&&type?_lvars['canvas_before_'+type]:_lvars.canvas_not_specified,message_state:'I'});return true;}
return false;}
function fn_pd_add_art(obj){var _data={'allow':true,'art_obj':obj};$.ceEvent('trigger','ce.pd_add_art',[_data]);if(!_data.allow){return;}
if(fn_pd_canvas_no_exist('art')){return;}
if(fn_pd_check_items_count('art')){return;}
$.toggleStatusBox('show');var name=$(obj).attr('rev');if(name.toLowerCase().indexOf('.svg')>0){fabric.loadSVGFromURL(fn_url('product_designer.get_clipart_file?clipart_id='+$(obj).attr('rel')+'&w='+view_width+'&h='+view_height+'&design_element=Y'),function(objects,options){$.toggleStatusBox('hide');var img=fabric.util.groupSVGElements(objects,options);img.clipart_id=$(obj).attr('rel');img.clipart=$(obj).attr('pd_clipart');fn_add_object_to_canvas(img);$.ceEvent('trigger','ce.pd_add_art_post',[img]);var art_colors=$('.cm-art-color',$('#art_color'));if(art_colors.length){mviews[cur_view]=cnvs.toJSON();$.ceEvent('trigger','ce.pd_add_svg_art',[art_colors,img]);fn_pd_check_colors(rgb2hex(art_colors.eq(0).css('background-color')),'');}});}else{fabric.Image.fromURL(fn_url('product_designer.get_clipart_file?clipart_id='+$(obj).attr('rel')+'&w='+view_width+'&h='+view_height+'&design_element=Y'),function(img){$.toggleStatusBox('hide');img.clipart_id=$(obj).attr('rel');img.clipart=$(obj).attr('pd_clipart');fn_add_object_to_canvas(img);$.ceEvent('trigger','ce.pd_add_art_post',[img]);});}}
function fn_generate_qrcode(im,txt,fill,bg,color_value,color,bg_color_value,bg_color){var qrcode=new QRCode({content:txt||' ',padding:2,width:256,height:256,color:fill,background:bg,ecl:'M',join:true});fabric.loadSVGFromString(qrcode.svg(),function(objects,options){var img=fabric.util.groupSVGElementsQrCode(objects,options);img.qr_text=txt;img.fill=fill;img.color_value=color_value;img.color=color;img.bg_fill=bg;img.bg_color_value=bg_color_value;img.bg_color=bg_color;if(im){var ind=cnvs.getObjects().indexOf(im);img.scaleX=im.scaleX;img.scaleY=im.scaleY;img.top=im.top;img.left=im.left;cnvs.add(img);cnvs.setActiveObject(img);cnvs.moveTo(img,ind);cnvs.remove(im);cnvs.requestRenderAll();}else{fn_add_object_to_canvas(img);}});}
function fn_add_qrcode(){if(fn_pd_canvas_no_exist()){return;}
var _data={'color_obj':tool_settings.cp_qrcode!=1?$('a.active',$('#qr_color')):$('#qr_color'),'background_obj':tool_settings.cp_qrcode!=1?$('a.active',$('#qr_bg_color')):$('#qr_bg_color')};$.ceEvent('trigger','ce.pd_add_qr_code_post',[_data]);fn_generate_qrcode(null,$('#qr_panel_area').val(),_data.color_obj.length?'#'+_data.color_obj.attr('pd_color_value'):'#ffffff',_data.background_obj.length?'#'+_data.background_obj.attr('pd_color_value'):'#000000',_data.color_obj.length?parseInt(_data.color_obj.attr('pd_color_value'),16):0,_data.color_obj.length?_data.color_obj.attr('pd_color'):'',_data.background_obj.length?parseInt(_data.background_obj.attr('pd_color_value'),16):0,_data.background_obj.length?_data.background_obj.attr('pd_color'):'');}
function fn_pd_change_qrcode_color(color,color_name,is_background){var obj=cnvs.getActiveObject();if(obj&&obj.type=='qr-code'){fn_generate_qrcode(obj,obj.qr_text,is_background?obj.fill:'#'+color,is_background?'#'+color:obj.bg_fill,is_background?obj.color_value:parseInt(color,16),is_background?obj.color:color_name,is_background?parseInt(color,16):obj.bg_color_value,is_background?color_name:obj.bg_color);}
fn_pd_check_colors(color,color_name);if(tool_settings.cp_qrcode!=1){if(is_background){fn_set_palette_active_color($('#qr_bg_color'),color);}else{fn_set_palette_active_color($('#qr_color'),color);}}}
function fn_select_qrcode(options){$('#qr_panel_area').val(this.qr_text);if(tool_settings.cp_qrcode!=1){fn_set_palette_active_color($('#qr_color'),rgb2hex(this.fill));fn_set_palette_active_color($('#qr_bg_color'),rgb2hex(this.bg_fill));}else{$('#qr_color').spectrum('set',this.fill);$('#qr_color').attr('pd_color_value',this.fill.substring(1,7));$('#qr_bg_color').spectrum('set',this.bg_fill);$('#qr_bg_color').attr('pd_color_value',this.bg_fill.substring(1,7));}
fn_open_panel('add_qrcode_panel',this,30);}
function fn_start_update_qrcode(add_new){if(add_new!=undefined){cnvs.discardActiveObject();}
var obj=cnvs.getActiveObject();$('textarea',$('#qrcode_edit_panel')).val(obj&&obj.type=='qr-code'?obj.qr_text:'');fn_switch_popup($('#add_qrcode_panel'),$('#qrcode_edit_panel'));}
function fn_update_qrcode(apply){if(apply){var obj=cnvs.getActiveObject();if(obj&&obj.type=='qr-code'){fn_generate_qrcode(obj,$('textarea',$('#qrcode_edit_panel')).val(),obj.fill,obj.bg_fill,obj.color_value,obj.color,obj.bg_color_value,obj.bg_color,);fn_update_price();}else{if(mobile_mode){fn_add_qrcode();}}}
fn_switch_popup($('#qrcode_edit_panel'),$('#add_qrcode_panel'));}
function fn_pd_delete_photo(photo_id,evt){var show_notice=false;mviews[cur_view]=cnvs.toJSON();var restore=false;for(var c_name in mviews){if(mviews[c_name].objects.length>0){for(var sign_name in mviews[c_name].objects){var s_obj=mviews[c_name].objects[sign_name];if(s_obj.type=='image'&&s_obj.photo_id==photo_id){show_notice=true;}}}}
if(show_notice){$.ceNotification('show',{type:'W',title:_lvars.notice,message:_lvars.remove_from_canvas,message_state:'I'});}else{if(confirm(fn_strip_tags(Tygh.tr('text_are_you_sure_to_proceed')))===true){$.ceAjax('request',fn_url('product_designer.delete_photo'),{method:'post',data:{photo_id:photo_id},callback:function(result){if(result.id){$('#pdph'+result.id).remove();}}});}}
evt.returnValue=false;return false;}
function fn_pd_add_photo(obj,evt){if($(evt.target).hasClass('fa-remove')){evt.returnValue=false;return false;}
var _data={'allow':true,'photo_obj':obj};$.ceEvent('trigger','ce.pd_add_photo',[_data]);if(!_data.allow){return;}
if(fn_pd_canvas_no_exist()){return;}
if(fn_pd_check_items_count('photo')){return;}
_data.allow=true;$.ceEvent('trigger','ce.pd_add_photo_post',[_data,obj]);if(_data.allow){fn_pd_attach_photo(obj);}}
function fn_pd_attach_photo(obj){$.toggleStatusBox('show');var uid='';if(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&pd_user_id){uid='&_uid='+pd_user_id;}
fabric.Image.fromURL(fn_url('product_designer.get_user_photo?id='+$(obj).attr('rel')+'&w='+view_width+'&h='+view_height+uid),function(img){$.toggleStatusBox('hide');img.photo_id=$(obj).attr('rel');img.photo=$(obj).attr('pd_photo')||'';img.image_x=$(obj).attr('data-pd-image-x')||0;img.image_y=$(obj).attr('data-pd-image-y')||0;fn_add_object_to_canvas(img);$.ceEvent('trigger','ce.pd_add_photo_complete',[img]);});}
function fn_pd_set_photo_dimension(){if(tool_settings.enable_checking_resolution==1){$.ceEvent('trigger','ce.pd_set_photo_dimension',[this]);var box=$('#error_box');if(box.length&&box.is(':visible')){this.scale((length_unit=='mm'?25.4:1)/ tool_settings.max_photo_dpi / unit_per_px);box.css('display','none');}}}
function fn_pd_check_photo_resolution(){if(tool_settings.enable_checking_resolution==1){if(Math.abs(this.width*this.scaleX)>Math.abs(this.width / unit_per_px*(length_unit=='mm'?25.4:1)/ tool_settings.max_photo_dpi)||Math.abs(this.height*this.scaleY)>Math.abs(this.height / unit_per_px*(length_unit=='mm'?25.4:1)/ tool_settings.max_photo_dpi)){fn_pd_error_box(true,_lvars.photo_cannot_scaled);}else{fn_pd_error_box(false);}
$.ceEvent('trigger','ce.pd_check_photo_resolution',[this]);}}
function fn_pd_error_box(show,txt){var box=$('#error_box'),_trg=$('.canvas-holder');if(!box.length){$('<div class="error-box" id="error_box"><span></span></div>').prependTo(_trg);}
if(box.is(':visible')){if(!show){box.css('display','none');}}else{if(show){$('span',box).html(txt?txt:'');box.css('display','block');box.css('left',((_trg.width()-box.width())/ 2)+'px');}}}
function fn_pd_check_items_count(type){var objs=cnvs.getObjects();if(tool_settings['limit_'+type]>0&&objs.length>0){var cnt=0,sign;for(var _id in cnvs.getObjects()){sign=cnvs.item(_id);if(sign){if(type=='photo'&&sign.type=='image'&&sign.photo_id||type=='art'&&(sign.type=='image'&&sign.clipart_id||sign.type=='group')){cnt++;}}}
if(cnt>=tool_settings['limit_'+type]){$.ceNotification('show',{type:'W',title:_lvars.warning,message:type=='photo'?_lvars.can_not_add_more_photos:_lvars.can_not_add_more_cliparts,message_state:'I'});return true;}}
return false;}
function fn_show_popup_dialog(header,text,click_1_text,click_1,click_2_text,click_2,w){var pp=$('#popup_dialog');$('.dl-text',pp).html(text).css('display',text==''?'none':'block');pp.dialog('option','title',header);var _btns={};if(click_1_text||click_1){_btns[click_1_text]=function(){if(click_1){click_1();}
$(this).dialog('close');}}
if(click_2_text||click_2){_btns[click_2_text]=function(){if(click_2){click_2();}
$(this).dialog('close');}}
pp.dialog('option','buttons',_btns);pp.dialog('option','dialogClass',click_1_text?'no-close':'');pp.dialog('option','width',w?w:300);pp.dialog({open:function(event,ui){$(event.target).css('overflow','auto');}});pp.dialog('open');}
function fn_get_font_name(font_id){var font_name='';for(var _id in fonts_data){if(fonts_data[_id].font_id==font_id){font_name=fonts_data[_id].label;}}
return font_name;}
function fn_add_text(txt){var _data={'allow':true,'txt':txt};$.ceEvent('trigger','ce.pd_add_text',[_data]);if(!_data.allow){return;}
if(fn_pd_canvas_no_exist('text')){return;}
txt=$('#text_panel_area').val();if(txt==''){return;}
var font_id=$('#text_font').val();var font_name=fn_get_font_name(font_id);fn_pd_change_font(font_id,function(){var clr_obj=tool_settings.cp_font!=1?$('a.active',$('#text_color')):$('#text_color');var _data={'color_obj':clr_obj,'additional_options':{}};$.ceEvent('trigger','ce.pd_add_text_post',[_data]);var txt_opts={fontFamily:font_name_prefix+font_id,fill:_data.color_obj.length?'#'+_data.color_obj.attr('pd_color_value'):'#000000',color:_data.color_obj.length?_data.color_obj.attr('pd_color'):'',color_value:_data.color_obj.length?parseInt(_data.color_obj.attr('pd_color_value'),16):0,font_id:font_id,font:font_name};for(var id in _data.additional_options){txt_opts[id]=_data.additional_options[id];}
var obj=new fabric[_txt_obj_type](txt,txt_opts);_data.allow_addition=true;$.ceEvent('trigger','ce.pd_add_text_to_canvas',[obj,_data]);if(_data.allow_addition){fn_add_object_to_canvas(obj);if(_data.color_obj.length){fn_pd_check_colors(_data.color_obj.attr('pd_color_value'),_data.color_obj.attr('pd_color'));}else{fn_pd_check_colors('000000','');}}});}
function fn_start_update_text(add_new){if(add_new!=undefined){cnvs.discardActiveObject();}
var obj=cnvs.getActiveObject();$('textarea',$('#text_edit_panel')).val(obj&&jQuery.inArray(obj.type,_txt_obj_types)!==-1?obj.text:_lvars.type_text);fn_switch_popup($('#add_text_panel'),$('#text_edit_panel'));}
function fn_update_text(apply){var obj=cnvs.getActiveObject();if(apply){if(obj&&jQuery.inArray(obj.type,_txt_obj_types)!==-1){obj.set('text',$('textarea',$('#text_edit_panel')).val());cnvs.requestRenderAll();fn_update_price();}else{if(mobile_mode){fn_add_text($('textarea',$('#text_edit_panel')).val());}}}
fn_switch_popup($('#text_edit_panel'),$('#add_text_panel'));}
function fn_pd_change_font(font_id,func){$.toggleStatusBox('show');if(!fonts_cache[font_name_prefix+font_id]){$('head').append('<style type="text/css">'+'@font-face {'+'    font-family: "'+font_name_prefix+font_id+'";'+'    src: url("'+fn_url('product_designer.get_font_file?font_id='+font_id)+'");'+'}'+'</style>');fonts_cache[font_name_prefix+font_id]=true;}
var observer=new FontFaceObserver(font_name_prefix+font_id,{});observer.load(null,15000).then(function(){setTimeout(function(){$.toggleStatusBox('hide');func();},200);},function(){$.toggleStatusBox('hide');$.ceNotification('show',{type:'E',title:_lvars.error,message:_lvars.unable_load_font,message_state:'I'});});}
function fn_select_text(options){var res=this.fontFamily.split('_'),obj=cnvs.getActiveObject();if(obj.type=='curvedText'){var minr=30,maxr=1000,minv=Math.log(minr),maxv=Math.log(maxr),scale=(maxv-minv)/(maxr-minr);_tmp=obj.get('radius'),_val=(_tmp>0?1:-1)*(Math.log(Math.abs(_tmp))-minv)/ scale+minr-(_tmp>0?0:minr);}
$('#text_panel_area').val(this.text);$('#text_font').val(res[1]).iconselectmenu('refresh');$('#text_bold').prop('checked',this.fontWeight=='bold').button('refresh');$('#text_italic').prop('checked',this.fontStyle=='italic').button('refresh');$('#text_underline').prop('checked',this.underline===true||this.textDecoration=='underline').button('refresh');$('#text_left').prop('checked',this.textAlign=='left').button('refresh');$('#text_center').prop('checked',this.textAlign=='center').button('refresh');$('#text_right').prop('checked',this.textAlign=='right').button('refresh');if(tool_settings.cp_font!=1){fn_set_palette_active_color($('#text_color'),rgb2hex(this.fill));}
$('#line_spacing').slider('option','value',this.lineHeight);$('#arc_radius').slider('option','value',obj.type=='curvedText'?_val:-1000);$('#arc_spacing').slider('option','value',obj.type=='curvedText'?obj.get('spacing'):0);if(tool_settings.cp_font==1){$('#text_color').spectrum('set',this.fill);$('#text_color').attr('pd_color_value',this.fill.substring(1,7));}
fn_open_panel('add_text_panel',this,30);$.ceEvent('trigger','ce.pd_select_text',[this]);}
function fn_select_art(options){restore_default_textbox_state();var clrs=$('#art_panel_color');if(pd_location!='U'){clrs.hide();}
var filt=$('#art_panel_filter').hide();$.ceEvent('trigger','ce.pd_select_art',[this]);if(this.type=='group'){var _clrs=$('#art_panel_colors');_clrs.empty();if(this._objects.length){var all_colors=[];for(var i=0;i<this._objects.length;i++){if(this._objects[i].fill){if(this._objects[i].orig_color==undefined){this._objects[i].orig_color=rgb2hex(this._objects[i].fill);}
all_colors.push(this._objects[i].orig_color);}
if(this._objects[i].stroke&&this._objects[i].strokeWidth){if(this._objects[i].orig_stroke==undefined){this._objects[i].orig_stroke=rgb2hex(this._objects[i].stroke);}
all_colors.push(this._objects[i].orig_stroke);}}
all_colors=getUniqueArray(all_colors);for(i=0;i<all_colors.length;i++){var cur_color='';for(var j=0;j<this._objects.length;j++){if(this._objects[j].orig_color==all_colors[i]||this._objects[j].orig_stroke==all_colors[i]){cur_color=rgb2hex(this._objects[j].orig_color==all_colors[i]?this._objects[j].fill:this._objects[j].stroke);break;}}
if(tool_settings.cp_art==1){var elm=$('<div class="colorpicker"><input type="text" name="art_colors" value="#'+cur_color+'" class="cm-colorpicker" pd_color_value="'+cur_color+'" pd_color="" pd_orig_color="'+all_colors[i]+'" /></div>').appendTo(_clrs);$('.cm-colorpicker',elm).ceColorpicker();$('.cm-colorpicker',elm).on('change',function(){cur_art_color=$(this).attr('pd_orig_color');fn_pd_change_art_color(this.value.substring(1,7),'');});}else{var elm=$('<input type="radio" name="art_colors" id="art_colors'+i+'" value=""/><label for="art_colors'+i+'"><i class="fa fa-square fa-lg" style="color: #'+cur_color+';" pd_color_value="'+cur_color+'" pd_color="" pd_orig_color="'+all_colors[i]+'"></i></label>').appendTo(_clrs);elm.on('click',function(){if($(this).is('label')){fn_set_palette_active_color($('#art_color'),rgb2hex($('.fa',this).eq(0).attr('pd_color_value')));cur_art_color=$('.fa',this).eq(0).attr('pd_orig_color');}});}}
if(tool_settings.cp_art!=1){_clrs.buttonset('refresh');$('label',_clrs).eq(0).click();}
clrs.show();}}else{if(this.type=='image'&&this.photo_id){$('#bgremoval').prop('checked',this.filters[0]?true:false);$.ceEvent('trigger','ce.pd_select_art_post',[this]);}
filt.show();}
if(this.type=='image'&&this.photo_id){fn_open_panel('upload_photo_panel',this,30);}else{fn_open_panel('add_art_panel',this,30);}}
function fn_pd_change_filter(ind){var obj=cnvs.getActiveObject();if(obj&&obj.type=='image'){var uid='';if(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&pd_user_id){uid='&_uid='+pd_user_id;}
var url=obj.photo_id?fn_url('product_designer.get_user_photo?id='+obj.photo_id+'&w='+view_width+'&h='+view_height+uid):fn_url('product_designer.get_clipart_file?clipart_id='+obj.clipart_id+'&w='+view_width+'&h='+view_height+'&design_element=Y');if(ind!=0){url+='&filter='+ind;}
if(obj.getSrc()!=url){$.toggleStatusBox('show');fabric.util.loadImage(url,function(img){obj.setElement(img);cnvs.requestRenderAll();$.toggleStatusBox('hide');});}}}
function fn_pd_remove_bg(cb){var obj=cnvs.getActiveObject();if(obj&&obj.type=='image'){if($(cb).is(':checked')){var f=fabric.Image.filters;obj.filters[0]=new f.RemoveColor({color:'#fff',distance:0.07});}else{obj.filters[0]=null;}
obj.applyFilters();cnvs.requestRenderAll();}}
function fn_pd_change_art_color(color,color_name){var obj=cnvs.getActiveObject();if(obj&&obj.type=='group'&&obj._objects.length){for(var i=0;i<obj._objects.length;i++){if(obj._objects[i].orig_color!=undefined&&obj._objects[i].orig_color==cur_art_color){obj._objects[i].set('fill','#'+color);fn_pd_check_colors(color,'');}
if(obj._objects[i].orig_stroke!=undefined&&obj._objects[i].orig_stroke==cur_art_color){obj._objects[i].set('stroke','#'+color);fn_pd_check_colors(color,'');}}
cnvs.requestRenderAll();}
if(tool_settings.cp_art==1){$('.cm-colorpicker',$('#art_panel_color')).each(function(index){if($(this).attr('pd_orig_color')==cur_art_color){$(this).attr('pd_color_value',color).attr('pd_color',color_name);}});}else{$('.fa',$('#art_panel_color')).each(function(index){if($(this).attr('pd_orig_color')==cur_art_color){$(this).css('color','#'+color);$(this).attr('pd_color_value',color).attr('pd_color',color_name);}});fn_set_palette_active_color($('#art_color'),color);}}
function rgb2hex(rgb){if(typeof(rgb)=='object'&&rgb.colorStops&&rgb.colorStops[0]){rgb=rgb.colorStops[0].color;}
var _data={'rgb':rgb};$.ceEvent('trigger','ce.pd_rgb2hex',[_data]);rgb=_data.rgb;_rgb=rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);return(_rgb&&_rgb.length===4)?('0'+parseInt(_rgb[1],10).toString(16)).slice(-2)+
('0'+parseInt(_rgb[2],10).toString(16)).slice(-2)+
('0'+parseInt(_rgb[3],10).toString(16)).slice(-2):(''+rgb).str_replace('#','');}
function fn_open_panel(name,obj,diff){if($('#content_'+name).hasClass('hidden')){$('#'+name).click();}}
function fn_pd_toggle_panel(name,popup){if($('#'+name).is(':visible')){$('#'+name).hide();}else{$('.pd-panel').hide();if(popup==undefined){$('#'+name).show();}else{$('#'+popup).popup('open',{'transition':'pop'});}}}
function fn_pd_get_popup_coord(popup,obj,diff,trans){var opt={};var offset=$('.canvas-container').offset(),w=parseInt($('.canvas-container').css('width')),h=parseInt($('.canvas-container').css('height'));if(trans){opt.transition=trans;}
opt.x=offset.left+(obj.left+(obj.width*obj.scaleX)/2)*w / view_width;opt.y=offset.top+(obj.top+obj.height*obj.scaleY)*h / view_height+popup.height()/ 2+diff;return opt;}
function fn_add_object_to_canvas(obj){var cur_mask=new fabric.Rect(masks[cur_view][0]),bound=cur_mask.getBoundingRect(),_scale=Math.min(bound.width / obj.width,bound.height / obj.height);if(tool_settings.enable_checking_resolution==1&&obj.type=='image'&&obj.photo_id){_scale=Math.min(_scale,(length_unit=='mm'?25.4:1)/ tool_settings.max_photo_dpi / unit_per_px);}
obj.scaleX=obj.scaleY=_scale;obj.top=bound.top+(bound.height-obj.height*obj.scaleY)/ 2;obj.left=bound.left+(bound.width-obj.width*obj.scaleX)/ 2;cnvs.add(obj);$.ceEvent('trigger','ce.pd_add_object_to_canvas',[obj]);cnvs.setActiveObject(obj);cnvs.requestRenderAll();fn_update_price();$.ceEvent('trigger','ce.pd_add_object_to_canvas_post',[obj]);return bound;}
function fn_pd_change_text_color(color,color_name){var obj=cnvs.getActiveObject();if(obj){obj.set('fill','#'+color);obj.color_value=parseInt(color,16);obj.color=color_name;cnvs.requestRenderAll();}
fn_pd_check_colors(color,color_name);if(tool_settings.cp_font!=1){fn_set_palette_active_color($('#text_color'),color);}}
function fn_pd_change_text_font(font_id){$('#text_font').val(font_id).change();fn_switch_popup($('#fonts_panel'),$('#add_text_panel'));}
function fn_set_palette_active_color(obj,color){$('a',obj).removeClass('active').each(function(){if(rgb2hex($(this).css('color'))==color){$(this).addClass('active');}});var _data={'obj':obj,'color':color};$.ceEvent('trigger','ce.pd_set_palette_active_color',[_data]);}
function fn_pd_change_order(order){var obj=cnvs.getActiveObject();if(obj){if(order=='front'){obj.bringForward();}else{obj.sendBackwards();}}
$.ceEvent('trigger','ce.pd_object_stacking_changed',[obj]);}
function fn_pd_change_align(val){var obj=cnvs.getActiveObject();if(obj){var cur_mask=new fabric.Rect(masks[cur_view][0]),bound=cur_mask.getBoundingRect();if(val=='hor'||val=='cent'){obj.set('left',bound.left+bound.width / 2-(obj.oCoords.br.x-obj.oCoords.tl.x)/ 2);}
if(val=='vert'||val=='cent'){obj.set('top',bound.top+bound.height / 2-(obj.oCoords.br.y-obj.oCoords.tl.y)/ 2);}
obj.setCoords();cnvs.requestRenderAll();if(typeof(fn_pd_ext_change_align)=='function'){fn_pd_ext_change_align(obj,val);}}}
function fn_pd_change_flip(val){var obj=cnvs.getActiveObject();if(obj){if(val=='hor'){obj.flipX=!obj.flipX;}else{obj.flipY=!obj.flipY;}
cnvs.requestRenderAll();}}
function fn_switch_popup(src_obj,dest_obj,_opts,onswitched){$('.pd-panel').hide();var afterClose=function(){var opts=_opts?_opts:{};var obj=cnvs.getActiveObject();if(obj){var _pcoord=fn_pd_get_popup_coord(dest_obj,obj,30);opts.x=_pcoord.x;opts.y=_pcoord.y;}
if(dest_obj.hasClass('ui-popup')){dest_obj.popup('open',opts);}else{dest_obj.show();}
if(src_obj.hasClass('ui-popup')){src_obj.off('popupafterclose',afterClose);}
if(onswitched&&typeof onswitched==='function'){onswitched();}};if(src_obj.hasClass('ui-popup')){src_obj.on('popupafterclose',afterClose);src_obj.popup('close');}else{src_obj.hide();afterClose();}}
function fn_int_to_color(val){if((''+val).indexOf('#')>-1){return val;}
val=Number(val).toString(16);while(val.length<6){val='0'+val;}
return'#'+val;}
function fn_calc_obj_size(w,h,cw,ch){var dw=w,dh=h;if(w*ch / cw>dh){w=cw*dh / ch;}
h=(ch / cw)*w;if(h*cw / ch>dw){h=ch*dw / cw;}
w=(cw / ch)*h;return{w:w,h:h};}
function fn_pd_url(url){var index_script=Tygh.area=='A'&&customer_index_script?customer_index_script:Tygh.index_script;var index_url=Tygh.current_location+'/'+index_script;var components=Tygh.$.parseUrl(url);if(url==''){url=index_url;}else if(components.file!=index_script){if(url.indexOf('?')==0){url=index_url+url;}else{url=index_url+'?dispatch='+url.replace('?','&');}}
return url;}
function fn_pd_change_background_color(color,name){if(cur_view>-1){product_views[cur_view].canvas.bg_color_value='#'+color;product_views[cur_view].canvas.bg_color=name;for(var item in masks[cur_view]){masks[cur_view][item].fill='#'+color;}
fn_apply_clip_area(masks[cur_view],false);}
if(tool_settings.cp_sticker!=1){fn_set_palette_active_color($('#background_color'),color);}}
function fn_pd_update_sticker(inp){var m=fn_pd_get_sticker_size(masks[cur_view]),_unit_per_px=unit_per_px;fn_pd_sticker_size_changer(inp);var sh=fn_pd_get_sticker_size(masks[cur_view]),sx=sh.width / m.width,sy=sh.height / m.height;for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.type!='rect'){if(!masks[cur_view][0].shape){sx=sy=_unit_per_px / unit_per_px;}
item.set('left',sh.min_x+(item.left-m.min_x)*sx);item.set('top',sh.min_y+(item.top-m.min_y)*sy);item.set('scaleX',item.scaleX*sx);item.set('scaleY',item.scaleY*sy);}}
cnvs.renderAll();}
function fn_pd_sticker_size_changer(inp){if(product_mode=='sticker'&&product_views[cur_view].canvas.shapes.length>0&&masks[cur_view]){var data={w:Number($('#sticker_width').val()),h:Number($('#sticker_height').val()),m:{top:1,left:1,right:1,bottom:1},max_w:Number(tool_settings.max_sticker_width),min_w:Number(tool_settings.min_sticker_width),max_h:Number(tool_settings.max_sticker_height),min_h:Number(tool_settings.min_sticker_height),inp:inp||null}
$.ceEvent('trigger','ce.pd_sticker_size_changer',[data]);if(data.max_w<data.w||data.min_w>data.w){data.w=data.max_w<data.w?data.max_w:data.min_w;$('#sticker_width').val(data.w);}
if(data.max_h<data.h||data.min_h>data.h){data.h=data.max_h<data.h?data.max_h:data.min_h;$('#sticker_height').val(data.h);}
if(inp!=undefined&&masks[cur_view][0].shape){if(inp.prop('id')=='sticker_width'){var h=data.h*data.w / masks[cur_view][0].real_width;if(data.max_h<h||data.min_h>h){var _h=data.max_h<h?data.max_h:data.min_h;data.w=data.w*_h / h;$('#sticker_width').val(fn_pd_round(data.w,10));h=_h;}
data.h=h;$('#sticker_height').val(fn_pd_round(data.h,10));}else{var w=data.w*data.h / masks[cur_view][0].real_height;if(data.max_w<w||data.min_w>w){var _w=data.max_w<w?data.max_w:data.min_w;data.h=data.h*_w / w;$('#sticker_height').val(fn_pd_round(data.h,10));w=_w;}
data.w=w;$('#sticker_width').val(fn_pd_round(data.w,10));}}
unit_per_px=Math.max(Math.min(data.w,data.max_w)/(view_width-data.m.left-data.m.right),Math.min(data.h,data.max_h)/(view_height-data.m.top-data.m.bottom));var _sizes=fn_pd_get_sticker_size(masks[cur_view]),w_scale=Math.max(Math.min(data.w,data.max_w),data.min_w)/ _sizes.real_width,h_scale=Math.max(Math.min(data.h,data.max_h),data.min_h)/ _sizes.real_height;for(var item in masks[cur_view]){var m=masks[cur_view][item];m.width=m.width*m.scaleX*w_scale;m.left=(m.left*m.scaleX-_sizes.min_x)*w_scale+(view_width-data.m.left-data.m.right-_sizes.width*w_scale)/ 2+data.m.left;m.height=m.height*m.scaleY*h_scale;m.top=(m.top*m.scaleY-_sizes.min_y)*h_scale+(view_height-data.m.top-data.m.bottom-_sizes.height*h_scale)/ 2+data.m.top;m.real_width=fn_pd_round(data.w,10);m.real_height=fn_pd_round(data.h,10);}
$('#sticker_width').val(m.real_width);$('#sticker_height').val(m.real_height);fn_apply_clip_area(masks[cur_view],false);fn_update_price();return[w_scale,h_scale];}
return[1,1];}
function fn_pd_round(val,precision){return Math.round(val*precision)/ precision;}
fabric.util.loadImage=function(url,callback,context,crossOrigin){_url=$.parseUrl(url);if(_url.query){url=fn_pd_url('')+'?'+_url.query;}
if(!url){callback&&callback.call(context,url);return;}
var img=fabric.util.createImage();var onLoadCallback=function(){callback&&callback.call(context,img,false);img=img.onload=img.onerror=null;};img.onload=onLoadCallback;img.onerror=function(){fabric.log('Error loading '+img.src);callback&&callback.call(context,null,true);img=img.onload=img.onerror=null;};if(url.indexOf('data')!==0&&crossOrigin!==undefined&&crossOrigin!==null){img.crossOrigin=crossOrigin;}
if(url.substring(0,14)==='data:image/svg'){img.onload=null;fabric.util.loadImageInDom(img,onLoadCallback);}
img.src=url;};fabric.Object.prototype.set({borderColor:'#000000',cornerColor:'#000000',objectCaching:true,});fabric.Object.prototype.controls.bl=new fabric.Control({x:-0.5,y:0.5,actionName:'delete',cursorStyle:'pointer',mouseUpHandler:function(e,target,control){cnvs.remove(target.target);},render:fn_pd_set_obj_cursor,cornerSize:16});fabric.Object.prototype.controls.tl=new fabric.Control({x:-0.5,y:-0.5,actionName:'scale',actionHandler:fabric.controlsUtils.scalingEqually,cursorStyle:'pointer',render:fn_pd_set_obj_cursor,cornerSize:16});fabric.Object.prototype.controls.br=new fabric.Control({x:0.5,y:0.5,actionName:'scale',actionHandler:fabric.controlsUtils.scalingEqually,cursorStyle:'pointer',render:fn_pd_set_obj_cursor,cornerSize:16});fabric.Object.prototype.controls.tr=new fabric.Control({x:0.5,y:-0.5,actionName:'rotate',actionHandler:fabric.controlsUtils.rotationWithSnapping,cursorStyle:'crosshair',render:fn_pd_set_obj_cursor,cornerSize:16});fabric.Object.prototype.controls.mt=new fabric.Control({x:0,y:-0.5,actionName:'skewX',actionHandler:fabric.controlsUtils.scalingYOrSkewingX,cursorStyle:'pointer',render:fn_pd_set_obj_cursor,cornerSize:16});fabric.Object.prototype.controls.mb=new fabric.Control({x:0,y:0.5,actionName:'skewX',actionHandler:fabric.controlsUtils.scalingYOrSkewingX,cursorStyle:'pointer',render:fn_pd_set_obj_cursor,cornerSize:16});fabric.Object.prototype.controls.ml=new fabric.Control({x:-0.5,y:0,actionName:'skewY',actionHandler:fabric.controlsUtils.scalingXOrSkewingY,cursorStyle:'pointer',render:fn_pd_set_obj_cursor,cornerSize:16});fabric.Object.prototype.controls.mr=new fabric.Control({x:0.5,y:0,actionName:'skewY',actionHandler:fabric.controlsUtils.scalingXOrSkewingY,cursorStyle:'pointer',render:fn_pd_set_obj_cursor,cornerSize:16});function fn_pd_set_obj_cursor(ctx,left,top,styleOverride,fabricObject){var size=this.cornerSize
img=this.actionName=='delete'?trash_icon:(this.actionName=='rotate'?rotate_icon:resize_icon);ctx.save();ctx.translate(left,top);ctx.rotate(fabric.util.degreesToRadians(fabricObject.angle+(this.actionName=='skewX'?45:(this.actionName=='skewY'?-45:0))));ctx.drawImage(img,-size/2,-size/2,size,size);ctx.restore();}
fabric.Object.prototype.controls.width_label=new fabric.Control({x:0,y:-0.5,offsetX:16,offsetY:-8,actionName:'width_label',cursorStyle:'default',render:fn_pd_set_label_cursors,cornerSize:1});fabric.Object.prototype.controls.height_label=new fabric.Control({x:0.5,y:0,offsetX:8,offsetY:20,actionName:'height_label',cursorStyle:'default',render:fn_pd_set_label_cursors,cornerSize:1});function fn_pd_set_label_cursors(ctx,left,top,styleOverride,fabricObject){if(fabricObject.type=='rect'&&pd_location=='U'&&fabricObject.isControlVisible('mt')){var txt=fn_pd_round(unit_per_px*(this.actionName=='width_label'?fabricObject.width*fabricObject.scaleX:fabricObject.height*fabricObject.scaleY),100)+_lvars[length_unit];ctx.save();ctx.translate(left,top);ctx.rotate(fabric.util.degreesToRadians(fabricObject.angle));ctx.font='12px Arial';ctx.shadowColor='Black';ctx.shadowBlur=3;ctx.strokeStyle='Black';ctx.lineWidth=0.2;ctx.fillStyle='White';ctx.strokeText(txt,0,0);ctx.fillText(txt,0,0);ctx.restore();}}
fabric.Object.prototype.toObject=(function(toObject){return function(){return fabric.util.object.extend(toObject.call(this),{scaleX:this.scaleX,scaleY:this.scaleY,color_value:this.color_value||0,color:this.color||'',img_colors:this.img_colors||[],photo_id:this.photo_id||0,photo:this.photo||'',image_x:this.image_x||0,image_y:this.image_y||0,clipart_id:this.clipart_id||0,clipart:this.clipart||'',orig_color:this.orig_color||'',orig_stroke:this.orig_stroke||'',transformMatrix:this.transformMatrix||null,uid:this.uid||0,text:this.text||''});};})(fabric.Object.prototype.toObject);fabric.Text.prototype.toObject=(function(toObject){return function(){return fabric.util.object.extend(toObject.call(this),{fontFamily:this.fontFamily||'',textAlign:this.textAlign||'left',fontWeight:this.fontWeight||'normal',fontStyle:this.fontStyle||'normal',fontSize:this.fontSize||40,underline:this.underline||false,line_height:this.lineHeight||(tool_settings.line_height?tool_settings.line_height:1.16),font:this.font||'',font_id:this.font_id||0});};})(fabric.Text.prototype.toObject);fabric.Rect.prototype.toObject=(function(toObject){return function(){return fabric.util.object.extend(toObject.call(this),{shape:this.shape||''});};})(fabric.Rect.prototype.toObject);(function(_,$){function _switchTab(tab_id,show){var id_obj=$('#content_'+tab_id);if(show){id_obj.css('max-height',$('#pd_canvas').height()+'px');id_obj.removeClass('hidden');$.ceEvent('trigger','pd.tab.show',[tab_id]);}else{id_obj.addClass('hidden');}
return true;}
$.ceEvent('on','ce.pd_init_view',function(data){if(mobile_mode){$('#text_orientation').buttonset();$('.pd-tabs li').on('click',function(e){var elm=$(this),ul=elm.parent(),active_id=$('li.active:first',ul).prop('id');$('li',ul).each(function(){var self=$(this);self.removeClass('active');_switchTab(self.prop('id'),false);});if(elm.prop('id')&&active_id!=elm.prop('id')){elm.addClass('active');_switchTab(elm.prop('id'),true);}else if(elm.hasClass('parent')){$('li',$('#content_'+elm.prop('id'))).each(function(){var self=$(this);self.removeClass('active');_switchTab(self.prop('id'),false);});}
e.preventDefault();return true;});$.ceEvent('on','pd.tab.show',function(tab_id){if(tab_id=='font_settings'){fn_scroll_to_elm_list($('#fonts_menu .active').parent(),$('#fonts_menu'));}else if(tab_id=='add_art_panel'||tab_id=='upload_photo_panel'){var obj=cnvs.getActiveObject();if(obj&&jQuery.inArray(obj.type,_txt_obj_types)!==-1){cnvs.discardActiveObject();}}});cnvs.on('selection:cleared',function(evt){$('#content_add_text_panel').addClass('hidden');$('#content_add_text_panel li').each(function(){var self=$(this);self.removeClass('active');_switchTab(self.prop('id'),false);});$('#add_text_panel').removeClass('active');});$.ceEvent('on','ce.pd_add_photo_complete',function(img){$('#upload_photo_panel').click();});$.ceEvent('on','ce.pd_add_text_post',function(data){$('#add_text_panel').click();});$.ceEvent('on','ce.pd_add_art_post',function(data){$('#add_art_panel').click();});}});$.ceEvent('on','ce.pd_select_text',function(){if(mobile_mode){var elm=$('#font_'+$('#text_font').val());$('#fonts_menu a').removeClass('active');$('a',elm).addClass('active');fn_scroll_to_elm_list(elm,$('#fonts_menu'));}});}(Tygh,Tygh.$));function fn_pd_change_selected_font(font_id){$('#text_font').val(font_id).trigger('iconselectmenuchange');$('#fonts_menu a').removeClass('active');$('#font_'+font_id+' a').addClass('active');}
function fn_scroll_to_elm_list(elm,obj){elm_offset=elm.offset().top;if(elm_offset<0){elm_offset=obj.scrollTop()-Math.abs(elm_offset)-obj.offset().top;}else{elm_offset=obj.scrollTop()+Math.abs(elm_offset)-obj.offset().top;}
obj.scrollTop(elm_offset);}
fabric.textureSize=4096;fabric.util.groupSVGElementsQrCode=function(elements,options,path){var object;if(elements&&elements.length===1){if(typeof path!=='undefined'){elements[0].sourcePath=path;}
return elements[0];}
if(options){if(options.width&&options.height){options.centerPoint={x:options.width / 2,y:options.height / 2};}
else{delete options.width;delete options.height;}}
object=new fabric.QrCode(elements,options);if(typeof path!=='undefined'){object.sourcePath=path;}
return object;}
fabric.QrCode=fabric.util.createClass(fabric.Group,{type:'qr-code',toObject:function(){return fabric.util.object.extend(this.callSuper('toObject'),{qr_text:this.qr_text||'',fill:this.fill||'#000000',color:this.color||'',color_value:this.color_value||0,bg_fill:this.bg_fill||'#ffffff',bg_color:this.bg_color||'',bg_color_value:this.bg_color_value||0});},});fabric.QrCode.fromObject=function(object,callback){var objects=object.objects,options=fabric.util.object.clone(object,true);delete options.objects;if(typeof objects==='string'){fabric.loadSVGFromURL(objects,function(elements){var group=fabric.util.groupSVGElementsQrCode(elements,object,objects);var clipPath=options.clipPath;delete options.clipPath;group.set(options);if(clipPath){fabric.util.enlivenObjects([clipPath],function(elivenedObjects){group.clipPath=elivenedObjects[0];callback&&callback(group);});}
else{callback&&callback(group);}});return;}
fabric.util.enlivenObjects(objects,function(enlivenedObjects){fabric.util.enlivenObjectEnlivables(object,options,function(){callback&&callback(new fabric.QrCode(enlivenedObjects,options,true));});});};fabric.PathGroup={};fabric.PathGroup.fromObject=function(object,callback){var originalPaths=object.paths;delete object.paths;if(typeof originalPaths==='string'){fabric.loadSVGFromURL(originalPaths,function(elements){var pathUrl=originalPaths;var group=fabric.util.groupSVGElements(elements,object,pathUrl);group.type='group';object.paths=originalPaths;callback(group);});}
else{fabric.util.enlivenObjects(originalPaths,function(enlivenedObjects){enlivenedObjects.forEach(function(obj){obj._removeTransformMatrix();})
var group=new fabric.Group(enlivenedObjects,object);group.type='group';object.paths=originalPaths;callback(group);});}};(function(global){'use strict';var fabric=global.fabric||(global.fabric={}),extend=fabric.util.object.extend,filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.RemoveWhite=createClass(filters.BaseFilter,{type:'RemoveWhite',color:'#FFFFFF',fragmentSource:'precision highp float;\n'+'uniform sampler2D uTexture;\n'+'uniform vec4 uLow;\n'+'uniform vec4 uHigh;\n'+'varying vec2 vTexCoord;\n'+'void main() {\n'+'gl_FragColor = texture2D(uTexture, vTexCoord);\n'+'if(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {\n'+'gl_FragColor.a = 0.0;\n'+'}\n'+'}',distance:0.07,useAlpha:false,applyTo2d:function(options){var imageData=options.imageData,data=imageData.data,i,distance=this.distance*255,r,g,b,source=new fabric.Color(this.color).getSource(),lowC=[source[0]-distance,source[1]-distance,source[2]-distance,],highC=[source[0]+distance,source[1]+distance,source[2]+distance,];for(i=0;i<data.length;i+=4){r=data[i];g=data[i+1];b=data[i+2];if(r>lowC[0]&&g>lowC[1]&&b>lowC[2]&&r<highC[0]&&g<highC[1]&&b<highC[2]){data[i+3]=0;}}},getUniformLocations:function(gl,program){return{uLow:gl.getUniformLocation(program,'uLow'),uHigh:gl.getUniformLocation(program,'uHigh'),};},sendUniformData:function(gl,uniformLocations){var source=new fabric.Color(this.color).getSource(),distance=0.02,lowC=[0+source[0]/ 255-distance,0+source[1]/ 255-distance,0+source[2]/ 255-distance,1],highC=[source[0]/ 255+distance,source[1]/ 255+distance,source[2]/ 255+distance,1];gl.uniform4fv(uniformLocations.uLow,lowC);gl.uniform4fv(uniformLocations.uHigh,highC);},toObject:function(){return extend(this.callSuper('toObject'),{color:this.color,distance:this.distance});}});fabric.Image.filters.RemoveWhite.fromObject=fabric.Image.filters.BaseFilter.fromObject;})(typeof exports!=='undefined'?exports:this);(function(){'use strict';var f,g=[];function l(a){g.push(a);1==g.length&&f()}function m(){for(;g.length;)g[0](),g.shift()}f=function(){setTimeout(m)};function n(a){this.a=p;this.b=void 0;this.f=[];var b=this;try{a(function(a){q(b,a)},function(a){r(b,a)})}catch(c){r(b,c)}}var p=2;function t(a){return new n(function(b,c){c(a)})}function u(a){return new n(function(b){b(a)})}function q(a,b){if(a.a==p){if(b==a)throw new TypeError;var c=!1;try{var d=b&&b.then;if(null!=b&&"object"==typeof b&&"function"==typeof d){d.call(b,function(b){c||q(a,b);c=!0},function(b){c||r(a,b);c=!0});return}}catch(e){c||r(a,e);return}a.a=0;a.b=b;v(a)}}
function r(a,b){if(a.a==p){if(b==a)throw new TypeError;a.a=1;a.b=b;v(a)}}function v(a){l(function(){if(a.a!=p)for(;a.f.length;){var b=a.f.shift(),c=b[0],d=b[1],e=b[2],b=b[3];try{0==a.a?"function"==typeof c?e(c.call(void 0,a.b)):e(a.b):1==a.a&&("function"==typeof d?e(d.call(void 0,a.b)):b(a.b))}catch(h){b(h)}}})}n.prototype.g=function(a){return this.c(void 0,a)};n.prototype.c=function(a,b){var c=this;return new n(function(d,e){c.f.push([a,b,d,e]);v(c)})};function w(a){return new n(function(b,c){function d(c){return function(d){h[c]=d;e+=1;e==a.length&&b(h)}}var e=0,h=[];0==a.length&&b(h);for(var k=0;k<a.length;k+=1)u(a[k]).c(d(k),c)})}function x(a){return new n(function(b,c){for(var d=0;d<a.length;d+=1)u(a[d]).c(b,c)})};window.Promise||(window.Promise=n,window.Promise.resolve=u,window.Promise.reject=t,window.Promise.race=x,window.Promise.all=w,window.Promise.prototype.then=n.prototype.c,window.Promise.prototype["catch"]=n.prototype.g);}());(function(){function l(a,b){document.addEventListener?a.addEventListener("scroll",b,!1):a.attachEvent("scroll",b)}function m(a){document.body?a():document.addEventListener?document.addEventListener("DOMContentLoaded",function c(){document.removeEventListener("DOMContentLoaded",c);a()}):document.attachEvent("onreadystatechange",function k(){if("interactive"==document.readyState||"complete"==document.readyState)document.detachEvent("onreadystatechange",k),a()})};function r(a){this.a=document.createElement("div");this.a.setAttribute("aria-hidden","true");this.a.appendChild(document.createTextNode(a));this.b=document.createElement("span");this.c=document.createElement("span");this.h=document.createElement("span");this.f=document.createElement("span");this.g=-1;this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;";this.b.appendChild(this.h);this.c.appendChild(this.f);this.a.appendChild(this.b);this.a.appendChild(this.c)}
function t(a,b){a.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+b+";"}function y(a){var b=a.a.offsetWidth,c=b+100;a.f.style.width=c+"px";a.c.scrollLeft=c;a.b.scrollLeft=a.b.scrollWidth+100;return a.g!==b?(a.g=b,!0):!1}function z(a,b){function c(){var a=k;y(a)&&a.a.parentNode&&b(a.g)}var k=a;l(a.b,c);l(a.c,c);y(a)};function A(a,b){var c=b||{};this.family=a;this.style=c.style||"normal";this.weight=c.weight||"normal";this.stretch=c.stretch||"normal"}var B=null,C=null,E=null,F=null;function G(){if(null===C)if(J()&&/Apple/.test(window.navigator.vendor)){var a=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent);C=!!a&&603>parseInt(a[1],10)}else C=!1;return C}function J(){null===F&&(F=!!document.fonts);return F}
function K(){if(null===E){var a=document.createElement("div");try{a.style.font="condensed 100px sans-serif"}catch(b){}E=""!==a.style.font}return E}function L(a,b){return[a.style,a.weight,K()?a.stretch:"","100px",b].join(" ")}
A.prototype.load=function(a,b){var c=this,k=a||"BESbswy",q=0,D=b||3E3,H=(new Date).getTime();return new Promise(function(a,b){if(J()&&!G()){var M=new Promise(function(a,b){function e(){(new Date).getTime()-H>=D?b():document.fonts.load(L(c,'"'+c.family+'"'),k).then(function(c){1<=c.length?a():setTimeout(e,25)},function(){b()})}e()}),N=new Promise(function(a,c){q=setTimeout(c,D)});Promise.race([N,M]).then(function(){clearTimeout(q);a(c)},function(){b(c)})}else m(function(){function u(){var b;if(b=-1!=f&&-1!=g||-1!=f&&-1!=h||-1!=g&&-1!=h)(b=f!=g&&f!=h&&g!=h)||(null===B&&(b=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),B=!!b&&(536>parseInt(b[1],10)||536===parseInt(b[1],10)&&11>=parseInt(b[2],10))),b=B&&(f==v&&g==v&&h==v||f==w&&g==w&&h==w||f==x&&g==x&&h==x)),b=!b;b&&(d.parentNode&&d.parentNode.removeChild(d),clearTimeout(q),a(c))}function I(){if((new Date).getTime()-H>=D)d.parentNode&&d.parentNode.removeChild(d),b(c);else{var a=document.hidden;if(!0===a||void 0===a)f=e.a.offsetWidth,g=n.a.offsetWidth,h=p.a.offsetWidth,u();q=setTimeout(I,50)}}var e=new r(k),n=new r(k),p=new r(k),f=-1,g=-1,h=-1,v=-1,w=-1,x=-1,d=document.createElement("div");d.dir="ltr";t(e,L(c,"sans-serif"));t(n,L(c,"serif"));t(p,L(c,"monospace"));d.appendChild(e.a);d.appendChild(n.a);d.appendChild(p.a);document.body.appendChild(d);v=e.a.offsetWidth;w=n.a.offsetWidth;x=p.a.offsetWidth;I();z(e,function(a){f=a;u()});t(e,L(c,'"'+c.family+'",sans-serif'));z(n,function(a){g=a;u()});t(n,L(c,'"'+c.family+'",serif'));z(p,function(a){h=a;u()});t(p,L(c,'"'+c.family+'",monospace'))})})};"object"===typeof module?module.exports=A:(window.FontFaceObserver=A,window.FontFaceObserver.prototype.load=A.prototype.load);}());(function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeTo(c.fadeInSpeed,c.opacity,b):(this.getTip().show(),b())},function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeOut(c.fadeOutSpeed,b):(this.getTip().hide(),b())}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1];var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.on(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).on(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next(),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.off(p[0]).on(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.off(p[1]).on(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),e.tip||h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}})}a.fn.tooltip=function(b){var c=this.data("tooltip");if(c)return c;b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){c=new d(a(this),b),a(this).data("tooltip",c)});return b.api?c:this}})(jQuery);(function(a){var b=a.tools.tooltip;b.dynamic={conf:{classNames:"top right bottom left"}};function c(b){var c=a(window),d=c.width()+c.scrollLeft(),e=c.height()+c.scrollTop();return[b.offset().top<=c.scrollTop(),d<=b.offset().left+b.width(),e<=b.offset().top+b.height(),c.scrollLeft()>=b.offset().left]}function d(a){var b=a.length;while(b--)if(a[b])return!1;return!0}a.fn.dynamic=function(e){typeof e=="number"&&(e={speed:e}),e=a.extend({},b.dynamic.conf,e);var f=a.extend(!0,{},e),g=e.classNames.split(/\s/),h;this.each(function(){var b=a(this).tooltip().onBeforeShow(function(b,e){var i=this.getTip(),j=this.getConf();h||(h=[j.position[0],j.position[1],j.offset[0],j.offset[1],a.extend({},j)]),a.extend(j,h[4]),j.position=[h[0],h[1]],j.offset=[h[2],h[3]],i.css({visibility:"hidden",position:"absolute",top:e.top,left:e.left}).show();var k=a.extend(!0,{},f),l=c(i);if(!d(l)){l[2]&&(a.extend(j,k.top),j.position[0]="top",i.addClass(g[0])),l[3]&&(a.extend(j,k.right),j.position[1]="right",i.addClass(g[1])),l[0]&&(a.extend(j,k.bottom),j.position[0]="bottom",i.addClass(g[2])),l[1]&&(a.extend(j,k.left),j.position[1]="left",i.addClass(g[3]));if(l[0]||l[2])j.offset[0]*=-1;if(l[1]||l[3])j.offset[1]*=-1}i.css({visibility:"visible"}).hide()});b.onBeforeShow(function(){var a=this.getConf(),b=this.getTip();setTimeout(function(){a.position=[h[0],h[1]],a.offset=[h[2],h[3]]},0)}),b.onHide(function(){var a=this.getTip();a.removeClass(e.classNames)}),ret=b});return e.api?ret:this}})(jQuery);(function(a){var b=a.tools.tooltip;a.extend(b.conf,{direction:"up",bounce:!1,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!a.browser.msie});var c={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};b.addEffect("slide",function(a){var b=this.getConf(),d=this.getTip(),e=b.slideFade?{opacity:b.opacity}:{},f=c[b.direction]||c.up;e[f[1]]=f[0]+"="+b.slideOffset,b.slideFade&&d.css({opacity:0}),d.show().animate(e,b.slideInSpeed,a)},function(b){var d=this.getConf(),e=d.slideOffset,f=d.slideFade?{opacity:0}:{},g=c[d.direction]||c.up,h=""+g[0];d.bounce&&(h=h=="+"?"-":"+"),f[g[1]]=h+"="+e,this.getTip().animate(f,d.slideOutSpeed,function(){a(this).hide(),b.call()})})})(jQuery);(function(factory){'use strict';if(typeof define==='function'&&define.amd){define(['jquery','jquery.ui.widget'],factory);}else if(typeof exports==='object'){factory(require('jquery'),require('./vendor/jquery.ui.widget'));}else{factory(window.jQuery);}}(function($){'use strict';$.support.fileInput=!(new RegExp('(Android (1\\.[0156]|2\\.[01]))'+'|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)'+'|(w(eb)?OSBrowser)|(webOS)'+'|(Kindle/(1\\.0|2\\.[05]|3\\.0))').test(window.navigator.userAgent)||$('<input type="file">').prop('disabled'));$.support.xhrFileUpload=!!(window.ProgressEvent&&window.FileReader);$.support.xhrFormDataFileUpload=!!window.FormData;$.support.blobSlice=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice);function getDragHandler(type){var isDragOver=type==='dragover';return function(e){e.dataTransfer=e.originalEvent&&e.originalEvent.dataTransfer;var dataTransfer=e.dataTransfer;if(dataTransfer&&$.inArray('Files',dataTransfer.types)!==-1&&this._trigger(type,$.Event(type,{delegatedEvent:e}))!==false){e.preventDefault();if(isDragOver){dataTransfer.dropEffect='copy';}}};}
$.widget('blueimp.fileupload',{options:{dropZone:$(document),pasteZone:undefined,fileInput:undefined,replaceFileInput:true,paramName:undefined,singleFileUploads:true,limitMultiFileUploads:undefined,limitMultiFileUploadSize:undefined,limitMultiFileUploadSizeOverhead:512,sequentialUploads:false,limitConcurrentUploads:undefined,forceIframeTransport:false,redirect:undefined,redirectParamName:undefined,postMessage:undefined,multipart:true,maxChunkSize:undefined,uploadedBytes:undefined,recalculateProgress:true,progressInterval:100,bitrateInterval:500,autoUpload:true,messages:{uploadedBytes:'Uploaded bytes exceed file size'},i18n:function(message,context){message=this.messages[message]||message.toString();if(context){$.each(context,function(key,value){message=message.replace('{'+key+'}',value);});}
return message;},formData:function(form){return form.serializeArray();},add:function(e,data){if(e.isDefaultPrevented()){return false;}
if(data.autoUpload||(data.autoUpload!==false&&$(this).fileupload('option','autoUpload'))){data.process().done(function(){data.submit();});}},processData:false,contentType:false,cache:false,timeout:0},_specialOptions:['fileInput','dropZone','pasteZone','multipart','forceIframeTransport'],_blobSlice:$.support.blobSlice&&function(){var slice=this.slice||this.webkitSlice||this.mozSlice;return slice.apply(this,arguments);},_BitrateTimer:function(){this.timestamp=((Date.now)?Date.now():(new Date()).getTime());this.loaded=0;this.bitrate=0;this.getBitrate=function(now,loaded,interval){var timeDiff=now-this.timestamp;if(!this.bitrate||!interval||timeDiff>interval){this.bitrate=(loaded-this.loaded)*(1000 / timeDiff)*8;this.loaded=loaded;this.timestamp=now;}
return this.bitrate;};},_isXHRUpload:function(options){return!options.forceIframeTransport&&((!options.multipart&&$.support.xhrFileUpload)||$.support.xhrFormDataFileUpload);},_getFormData:function(options){var formData;if($.type(options.formData)==='function'){return options.formData(options.form);}
if($.isArray(options.formData)){return options.formData;}
if($.type(options.formData)==='object'){formData=[];$.each(options.formData,function(name,value){formData.push({name:name,value:value});});return formData;}
return[];},_getTotal:function(files){var total=0;$.each(files,function(index,file){total+=file.size||1;});return total;},_initProgressObject:function(obj){var progress={loaded:0,total:0,bitrate:0};if(obj._progress){$.extend(obj._progress,progress);}else{obj._progress=progress;}},_initResponseObject:function(obj){var prop;if(obj._response){for(prop in obj._response){if(obj._response.hasOwnProperty(prop)){delete obj._response[prop];}}}else{obj._response={};}},_onProgress:function(e,data){if(e.lengthComputable){var now=((Date.now)?Date.now():(new Date()).getTime()),loaded;if(data._time&&data.progressInterval&&(now-data._time<data.progressInterval)&&e.loaded!==e.total){return;}
data._time=now;loaded=Math.floor(e.loaded / e.total*(data.chunkSize||data._progress.total))+(data.uploadedBytes||0);this._progress.loaded+=(loaded-data._progress.loaded);this._progress.bitrate=this._bitrateTimer.getBitrate(now,this._progress.loaded,data.bitrateInterval);data._progress.loaded=data.loaded=loaded;data._progress.bitrate=data.bitrate=data._bitrateTimer.getBitrate(now,loaded,data.bitrateInterval);this._trigger('progress',$.Event('progress',{delegatedEvent:e}),data);this._trigger('progressall',$.Event('progressall',{delegatedEvent:e}),this._progress);}},_initProgressListener:function(options){var that=this,xhr=options.xhr?options.xhr():$.ajaxSettings.xhr();if(xhr.upload){$(xhr.upload).bind('progress',function(e){var oe=e.originalEvent;e.lengthComputable=oe.lengthComputable;e.loaded=oe.loaded;e.total=oe.total;that._onProgress(e,options);});options.xhr=function(){return xhr;};}},_isInstanceOf:function(type,obj){return Object.prototype.toString.call(obj)==='[object '+type+']';},_initXHRData:function(options){var that=this,formData,file=options.files[0],multipart=options.multipart||!$.support.xhrFileUpload,paramName=$.type(options.paramName)==='array'?options.paramName[0]:options.paramName;options.headers=$.extend({},options.headers);if(options.contentRange){options.headers['Content-Range']=options.contentRange;}
if(!multipart||options.blob||!this._isInstanceOf('File',file)){options.headers['Content-Disposition']='attachment; filename="'+
encodeURI(file.name)+'"';}
if(!multipart){options.contentType=file.type||'application/octet-stream';options.data=options.blob||file;}else if($.support.xhrFormDataFileUpload){if(options.postMessage){formData=this._getFormData(options);if(options.blob){formData.push({name:paramName,value:options.blob});}else{$.each(options.files,function(index,file){formData.push({name:($.type(options.paramName)==='array'&&options.paramName[index])||paramName,value:file});});}}else{if(that._isInstanceOf('FormData',options.formData)){formData=options.formData;}else{formData=new FormData();$.each(this._getFormData(options),function(index,field){formData.append(field.name,field.value);});}
if(options.blob){formData.append(paramName,options.blob,file.name);}else{$.each(options.files,function(index,file){if(that._isInstanceOf('File',file)||that._isInstanceOf('Blob',file)){formData.append(($.type(options.paramName)==='array'&&options.paramName[index])||paramName,file,file.uploadName||file.name);}});}}
options.data=formData;}
options.blob=null;},_initIframeSettings:function(options){var targetHost=$('<a></a>').prop('href',options.url).prop('host');options.dataType='iframe '+(options.dataType||'');options.formData=this._getFormData(options);if(options.redirect&&targetHost&&targetHost!==location.host){options.formData.push({name:options.redirectParamName||'redirect',value:options.redirect});}},_initDataSettings:function(options){if(this._isXHRUpload(options)){if(!this._chunkedUpload(options,true)){if(!options.data){this._initXHRData(options);}
this._initProgressListener(options);}
if(options.postMessage){options.dataType='postmessage '+(options.dataType||'');}}else{this._initIframeSettings(options);}},_getParamName:function(options){var fileInput=$(options.fileInput),paramName=options.paramName;if(!paramName){paramName=[];fileInput.each(function(){var input=$(this),name=input.prop('name')||'files[]',i=(input.prop('files')||[1]).length;while(i){paramName.push(name);i-=1;}});if(!paramName.length){paramName=[fileInput.prop('name')||'files[]'];}}else if(!$.isArray(paramName)){paramName=[paramName];}
return paramName;},_initFormSettings:function(options){if(!options.form||!options.form.length){options.form=$(options.fileInput.prop('form'));if(!options.form.length){options.form=$(this.options.fileInput.prop('form'));}}
options.paramName=this._getParamName(options);if(!options.url){options.url=options.form.prop('action')||location.href;}
options.type=(options.type||($.type(options.form.prop('method'))==='string'&&options.form.prop('method'))||'').toUpperCase();if(options.type!=='POST'&&options.type!=='PUT'&&options.type!=='PATCH'){options.type='POST';}
if(!options.formAcceptCharset){options.formAcceptCharset=options.form.attr('accept-charset');}},_getAJAXSettings:function(data){var options=$.extend({},this.options,data);this._initFormSettings(options);this._initDataSettings(options);return options;},_getDeferredState:function(deferred){if(deferred.state){return deferred.state();}
if(deferred.isResolved()){return'resolved';}
if(deferred.isRejected()){return'rejected';}
return'pending';},_enhancePromise:function(promise){promise.success=promise.done;promise.error=promise.fail;promise.complete=promise.always;return promise;},_getXHRPromise:function(resolveOrReject,context,args){var dfd=$.Deferred(),promise=dfd.promise();context=context||this.options.context||promise;if(resolveOrReject===true){dfd.resolveWith(context,args);}else if(resolveOrReject===false){dfd.rejectWith(context,args);}
promise.abort=dfd.promise;return this._enhancePromise(promise);},_addConvenienceMethods:function(e,data){var that=this,getPromise=function(args){return $.Deferred().resolveWith(that,args).promise();};data.process=function(resolveFunc,rejectFunc){if(resolveFunc||rejectFunc){data._processQueue=this._processQueue=(this._processQueue||getPromise([this])).pipe(function(){if(data.errorThrown){return $.Deferred().rejectWith(that,[data]).promise();}
return getPromise(arguments);}).pipe(resolveFunc,rejectFunc);}
return this._processQueue||getPromise([this]);};data.submit=function(){if(this.state()!=='pending'){data.jqXHR=this.jqXHR=(that._trigger('submit',$.Event('submit',{delegatedEvent:e}),this)!==false)&&that._onSend(e,this);}
return this.jqXHR||that._getXHRPromise();};data.abort=function(){if(this.jqXHR){return this.jqXHR.abort();}
this.errorThrown='abort';that._trigger('fail',null,this);return that._getXHRPromise(false);};data.state=function(){if(this.jqXHR){return that._getDeferredState(this.jqXHR);}
if(this._processQueue){return that._getDeferredState(this._processQueue);}};data.processing=function(){return!this.jqXHR&&this._processQueue&&that._getDeferredState(this._processQueue)==='pending';};data.progress=function(){return this._progress;};data.response=function(){return this._response;};},_getUploadedBytes:function(jqXHR){var range=jqXHR.getResponseHeader('Range'),parts=range&&range.split('-'),upperBytesPos=parts&&parts.length>1&&parseInt(parts[1],10);return upperBytesPos&&upperBytesPos+1;},_chunkedUpload:function(options,testOnly){options.uploadedBytes=options.uploadedBytes||0;var that=this,file=options.files[0],fs=file.size,ub=options.uploadedBytes,mcs=options.maxChunkSize||fs,slice=this._blobSlice,dfd=$.Deferred(),promise=dfd.promise(),jqXHR,upload;if(!(this._isXHRUpload(options)&&slice&&(ub||mcs<fs))||options.data){return false;}
if(testOnly){return true;}
if(ub>=fs){file.error=options.i18n('uploadedBytes');return this._getXHRPromise(false,options.context,[null,'error',file.error]);}
upload=function(){var o=$.extend({},options),currentLoaded=o._progress.loaded;o.blob=slice.call(file,ub,ub+mcs,file.type);o.chunkSize=o.blob.size;o.contentRange='bytes '+ub+'-'+
(ub+o.chunkSize-1)+'/'+fs;that._initXHRData(o);that._initProgressListener(o);jqXHR=((that._trigger('chunksend',null,o)!==false&&$.ajax(o))||that._getXHRPromise(false,o.context)).done(function(result,textStatus,jqXHR){ub=that._getUploadedBytes(jqXHR)||(ub+o.chunkSize);if(currentLoaded+o.chunkSize-o._progress.loaded){that._onProgress($.Event('progress',{lengthComputable:true,loaded:ub-o.uploadedBytes,total:ub-o.uploadedBytes}),o);}
options.uploadedBytes=o.uploadedBytes=ub;o.result=result;o.textStatus=textStatus;o.jqXHR=jqXHR;that._trigger('chunkdone',null,o);that._trigger('chunkalways',null,o);if(ub<fs){upload();}else{dfd.resolveWith(o.context,[result,textStatus,jqXHR]);}}).fail(function(jqXHR,textStatus,errorThrown){o.jqXHR=jqXHR;o.textStatus=textStatus;o.errorThrown=errorThrown;that._trigger('chunkfail',null,o);that._trigger('chunkalways',null,o);dfd.rejectWith(o.context,[jqXHR,textStatus,errorThrown]);});};this._enhancePromise(promise);promise.abort=function(){return jqXHR.abort();};upload();return promise;},_beforeSend:function(e,data){if(this._active===0){this._trigger('start');this._bitrateTimer=new this._BitrateTimer();this._progress.loaded=this._progress.total=0;this._progress.bitrate=0;}
this._initResponseObject(data);this._initProgressObject(data);data._progress.loaded=data.loaded=data.uploadedBytes||0;data._progress.total=data.total=this._getTotal(data.files)||1;data._progress.bitrate=data.bitrate=0;this._active+=1;this._progress.loaded+=data.loaded;this._progress.total+=data.total;},_onDone:function(result,textStatus,jqXHR,options){var total=options._progress.total,response=options._response;if(options._progress.loaded<total){this._onProgress($.Event('progress',{lengthComputable:true,loaded:total,total:total}),options);}
response.result=options.result=result;response.textStatus=options.textStatus=textStatus;response.jqXHR=options.jqXHR=jqXHR;this._trigger('done',null,options);},_onFail:function(jqXHR,textStatus,errorThrown,options){var response=options._response;if(options.recalculateProgress){this._progress.loaded-=options._progress.loaded;this._progress.total-=options._progress.total;}
response.jqXHR=options.jqXHR=jqXHR;response.textStatus=options.textStatus=textStatus;response.errorThrown=options.errorThrown=errorThrown;this._trigger('fail',null,options);},_onAlways:function(jqXHRorResult,textStatus,jqXHRorError,options){this._trigger('always',null,options);},_onSend:function(e,data){if(!data.submit){this._addConvenienceMethods(e,data);}
var that=this,jqXHR,aborted,slot,pipe,options=that._getAJAXSettings(data),send=function(){that._sending+=1;options._bitrateTimer=new that._BitrateTimer();jqXHR=jqXHR||(((aborted||that._trigger('send',$.Event('send',{delegatedEvent:e}),options)===false)&&that._getXHRPromise(false,options.context,aborted))||that._chunkedUpload(options)||$.ajax(options)).done(function(result,textStatus,jqXHR){that._onDone(result,textStatus,jqXHR,options);}).fail(function(jqXHR,textStatus,errorThrown){that._onFail(jqXHR,textStatus,errorThrown,options);}).always(function(jqXHRorResult,textStatus,jqXHRorError){that._onAlways(jqXHRorResult,textStatus,jqXHRorError,options);that._sending-=1;that._active-=1;if(options.limitConcurrentUploads&&options.limitConcurrentUploads>that._sending){var nextSlot=that._slots.shift();while(nextSlot){if(that._getDeferredState(nextSlot)==='pending'){nextSlot.resolve();break;}
nextSlot=that._slots.shift();}}
if(that._active===0){that._trigger('stop');}});return jqXHR;};this._beforeSend(e,options);if(this.options.sequentialUploads||(this.options.limitConcurrentUploads&&this.options.limitConcurrentUploads<=this._sending)){if(this.options.limitConcurrentUploads>1){slot=$.Deferred();this._slots.push(slot);pipe=slot.pipe(send);}else{this._sequence=this._sequence.pipe(send,send);pipe=this._sequence;}
pipe.abort=function(){aborted=[undefined,'abort','abort'];if(!jqXHR){if(slot){slot.rejectWith(options.context,aborted);}
return send();}
return jqXHR.abort();};return this._enhancePromise(pipe);}
return send();},_onAdd:function(e,data){var that=this,result=true,options=$.extend({},this.options,data),files=data.files,filesLength=files.length,limit=options.limitMultiFileUploads,limitSize=options.limitMultiFileUploadSize,overhead=options.limitMultiFileUploadSizeOverhead,batchSize=0,paramName=this._getParamName(options),paramNameSet,paramNameSlice,fileSet,i,j=0;if(limitSize&&(!filesLength||files[0].size===undefined)){limitSize=undefined;}
if(!(options.singleFileUploads||limit||limitSize)||!this._isXHRUpload(options)){fileSet=[files];paramNameSet=[paramName];}else if(!(options.singleFileUploads||limitSize)&&limit){fileSet=[];paramNameSet=[];for(i=0;i<filesLength;i+=limit){fileSet.push(files.slice(i,i+limit));paramNameSlice=paramName.slice(i,i+limit);if(!paramNameSlice.length){paramNameSlice=paramName;}
paramNameSet.push(paramNameSlice);}}else if(!options.singleFileUploads&&limitSize){fileSet=[];paramNameSet=[];for(i=0;i<filesLength;i=i+1){batchSize+=files[i].size+overhead;if(i+1===filesLength||((batchSize+files[i+1].size+overhead)>limitSize)||(limit&&i+1-j>=limit)){fileSet.push(files.slice(j,i+1));paramNameSlice=paramName.slice(j,i+1);if(!paramNameSlice.length){paramNameSlice=paramName;}
paramNameSet.push(paramNameSlice);j=i+1;batchSize=0;}}}else{paramNameSet=paramName;}
data.originalFiles=files;$.each(fileSet||files,function(index,element){var newData=$.extend({},data);newData.files=fileSet?element:[element];newData.paramName=paramNameSet[index];that._initResponseObject(newData);that._initProgressObject(newData);that._addConvenienceMethods(e,newData);result=that._trigger('add',$.Event('add',{delegatedEvent:e}),newData);return result;});return result;},_replaceFileInput:function(data){var input=data.fileInput,inputClone=input.clone(true);data.fileInputClone=inputClone;$('<form></form>').append(inputClone)[0].reset();input.after(inputClone).detach();$.cleanData(input.unbind('remove'));this.options.fileInput=this.options.fileInput.map(function(i,el){if(el===input[0]){return inputClone[0];}
return el;});if(input[0]===this.element[0]){this.element=inputClone;}},_handleFileTreeEntry:function(entry,path){var that=this,dfd=$.Deferred(),errorHandler=function(e){if(e&&!e.entry){e.entry=entry;}
dfd.resolve([e]);},successHandler=function(entries){that._handleFileTreeEntries(entries,path+entry.name+'/').done(function(files){dfd.resolve(files);}).fail(errorHandler);},readEntries=function(){dirReader.readEntries(function(results){if(!results.length){successHandler(entries);}else{entries=entries.concat(results);readEntries();}},errorHandler);},dirReader,entries=[];path=path||'';if(entry.isFile){if(entry._file){entry._file.relativePath=path;dfd.resolve(entry._file);}else{entry.file(function(file){file.relativePath=path;dfd.resolve(file);},errorHandler);}}else if(entry.isDirectory){dirReader=entry.createReader();readEntries();}else{dfd.resolve([]);}
return dfd.promise();},_handleFileTreeEntries:function(entries,path){var that=this;return $.when.apply($,$.map(entries,function(entry){return that._handleFileTreeEntry(entry,path);})).pipe(function(){return Array.prototype.concat.apply([],arguments);});},_getDroppedFiles:function(dataTransfer){dataTransfer=dataTransfer||{};var items=dataTransfer.items;if(items&&items.length&&(items[0].webkitGetAsEntry||items[0].getAsEntry)){return this._handleFileTreeEntries($.map(items,function(item){var entry;if(item.webkitGetAsEntry){entry=item.webkitGetAsEntry();if(entry){entry._file=item.getAsFile();}
return entry;}
return item.getAsEntry();}));}
return $.Deferred().resolve($.makeArray(dataTransfer.files)).promise();},_getSingleFileInputFiles:function(fileInput){fileInput=$(fileInput);var entries=fileInput.prop('webkitEntries')||fileInput.prop('entries'),files,value;if(entries&&entries.length){return this._handleFileTreeEntries(entries);}
files=$.makeArray(fileInput.prop('files'));if(!files.length){value=fileInput.prop('value');if(!value){return $.Deferred().resolve([]).promise();}
files=[{name:value.replace(/^.*\\/,'')}];}else if(files[0].name===undefined&&files[0].fileName){$.each(files,function(index,file){file.name=file.fileName;file.size=file.fileSize;});}
return $.Deferred().resolve(files).promise();},_getFileInputFiles:function(fileInput){if(!(fileInput instanceof $)||fileInput.length===1){return this._getSingleFileInputFiles(fileInput);}
return $.when.apply($,$.map(fileInput,this._getSingleFileInputFiles)).pipe(function(){return Array.prototype.concat.apply([],arguments);});},_onChange:function(e){var that=this,data={fileInput:$(e.target),form:$(e.target.form)};this._getFileInputFiles(data.fileInput).always(function(files){data.files=files;if(that.options.replaceFileInput){that._replaceFileInput(data);}
if(that._trigger('change',$.Event('change',{delegatedEvent:e}),data)!==false){that._onAdd(e,data);}});},_onPaste:function(e){var items=e.originalEvent&&e.originalEvent.clipboardData&&e.originalEvent.clipboardData.items,data={files:[]};if(items&&items.length){$.each(items,function(index,item){var file=item.getAsFile&&item.getAsFile();if(file){data.files.push(file);}});if(this._trigger('paste',$.Event('paste',{delegatedEvent:e}),data)!==false){this._onAdd(e,data);}}},_onDrop:function(e){e.dataTransfer=e.originalEvent&&e.originalEvent.dataTransfer;var that=this,dataTransfer=e.dataTransfer,data={};if(dataTransfer&&dataTransfer.files&&dataTransfer.files.length){e.preventDefault();this._getDroppedFiles(dataTransfer).always(function(files){data.files=files;if(that._trigger('drop',$.Event('drop',{delegatedEvent:e}),data)!==false){that._onAdd(e,data);}});}},_onDragOver:getDragHandler('dragover'),_onDragEnter:getDragHandler('dragenter'),_onDragLeave:getDragHandler('dragleave'),_initEventHandlers:function(){if(this._isXHRUpload(this.options)){this._on(this.options.dropZone,{dragover:this._onDragOver,drop:this._onDrop,dragenter:this._onDragEnter,dragleave:this._onDragLeave});this._on(this.options.pasteZone,{paste:this._onPaste});}
if($.support.fileInput){this._on(this.options.fileInput,{change:this._onChange});}},_destroyEventHandlers:function(){this._off(this.options.dropZone,'dragenter dragleave dragover drop');this._off(this.options.pasteZone,'paste');this._off(this.options.fileInput,'change');},_setOption:function(key,value){var reinit=$.inArray(key,this._specialOptions)!==-1;if(reinit){this._destroyEventHandlers();}
this._super(key,value);if(reinit){this._initSpecialOptions();this._initEventHandlers();}},_initSpecialOptions:function(){var options=this.options;if(options.fileInput===undefined){options.fileInput=this.element.is('input[type="file"]')?this.element:this.element.find('input[type="file"]');}else if(!(options.fileInput instanceof $)){options.fileInput=$(options.fileInput);}
if(!(options.dropZone instanceof $)){options.dropZone=$(options.dropZone);}
if(!(options.pasteZone instanceof $)){options.pasteZone=$(options.pasteZone);}},_getRegExp:function(str){var parts=str.split('/'),modifiers=parts.pop();parts.shift();return new RegExp(parts.join('/'),modifiers);},_isRegExpOption:function(key,value){return key!=='url'&&$.type(value)==='string'&&/^\/.*\/[igm]{0,3}$/.test(value);},_initDataAttributes:function(){var that=this,options=this.options,data=this.element.data();$.each(this.element[0].attributes,function(index,attr){var key=attr.name.toLowerCase(),value;if(/^data-/.test(key)){key=key.slice(5).replace(/-[a-z]/g,function(str){return str.charAt(1).toUpperCase();});value=data[key];if(that._isRegExpOption(key,value)){value=that._getRegExp(value);}
options[key]=value;}});},_create:function(){this._initDataAttributes();this._initSpecialOptions();this._slots=[];this._sequence=this._getXHRPromise(true);this._sending=this._active=0;this._initProgressObject(this);this._initEventHandlers();},active:function(){return this._active;},progress:function(){return this._progress;},add:function(data){var that=this;if(!data||this.options.disabled){return;}
if(data.fileInput&&!data.files){this._getFileInputFiles(data.fileInput).always(function(files){data.files=files;that._onAdd(null,data);});}else{data.files=$.makeArray(data.files);this._onAdd(null,data);}},send:function(data){if(data&&!this.options.disabled){if(data.fileInput&&!data.files){var that=this,dfd=$.Deferred(),promise=dfd.promise(),jqXHR,aborted;promise.abort=function(){aborted=true;if(jqXHR){return jqXHR.abort();}
dfd.reject(null,'abort','abort');return promise;};this._getFileInputFiles(data.fileInput).always(function(files){if(aborted){return;}
if(!files.length){dfd.reject();return;}
data.files=files;jqXHR=that._onSend(null,data);jqXHR.then(function(result,textStatus,jqXHR){dfd.resolve(result,textStatus,jqXHR);},function(jqXHR,textStatus,errorThrown){dfd.reject(jqXHR,textStatus,errorThrown);});});return this._enhancePromise(promise);}
data.files=$.makeArray(data.files);if(data.files.length){return this._onSend(null,data);}}
return this._getXHRPromise(false,data&&data.context);}});}));function QR8bitByte(t){this.mode=QRMode.MODE_8BIT_BYTE,this.data=t,this.parsedData=[];for(var e=0,r=this.data.length;e<r;e++){var o=[],n=this.data.charCodeAt(e);n>65536?(o[0]=240|(1835008&n)>>>18,o[1]=128|(258048&n)>>>12,o[2]=128|(4032&n)>>>6,o[3]=128|63&n):n>2048?(o[0]=224|(61440&n)>>>12,o[1]=128|(4032&n)>>>6,o[2]=128|63&n):n>128?(o[0]=192|(1984&n)>>>6,o[1]=128|63&n):o[0]=n,this.parsedData.push(o)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function QRCodeModel(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}QR8bitByte.prototype={getLength:function(t){return this.parsedData.length},write:function(t){for(var e=0,r=this.parsedData.length;e<r;e++)t.put(this.parsedData[e],8)}},QRCodeModel.prototype={addData:function(t){var e=new QR8bitByte(t);this.dataList.push(e),this.dataCache=null},isDark:function(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(t,e){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var o=0;o<this.moduleCount;o++)this.modules[r][o]=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),this.typeNumber>=7&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=QRCodeModel.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var o=-1;o<=7;o++)e+o<=-1||this.moduleCount<=e+o||(this.modules[t+r][e+o]=0<=r&&r<=6&&(0==o||6==o)||0<=o&&o<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=o&&o<=4)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var o=QRUtil.getLostPoint(this);(0==r||t>o)&&(t=o,e=r)}return e},createMovieClip:function(t,e,r){var o=t.createEmptyMovieClip(e,r);this.make();for(var n=0;n<this.modules.length;n++)for(var i=1*n,a=0;a<this.modules[n].length;a++){var s=1*a;this.modules[n][a]&&(o.beginFill(0,100),o.moveTo(s,i),o.lineTo(s+1,i),o.lineTo(s+1,i+1),o.lineTo(s,i+1),o.endFill())}return o},setupTimingPattern:function(){for(var t=8;t<this.moduleCount-8;t++)null==this.modules[t][6]&&(this.modules[t][6]=t%2==0);for(var e=8;e<this.moduleCount-8;e++)null==this.modules[6][e]&&(this.modules[6][e]=e%2==0)},setupPositionAdjustPattern:function(){for(var t=QRUtil.getPatternPosition(this.typeNumber),e=0;e<t.length;e++)for(var r=0;r<t.length;r++){var o=t[e],n=t[r];if(null==this.modules[o][n])for(var i=-2;i<=2;i++)for(var a=-2;a<=2;a++)this.modules[o+i][n+a]=-2==i||2==i||-2==a||2==a||0==i&&0==a}},setupTypeNumber:function(t){for(var e=QRUtil.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var o=!t&&1==(e>>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=o}for(r=0;r<18;r++){o=!t&&1==(e>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=o}},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,o=QRUtil.getBCHTypeInfo(r),n=0;n<15;n++){var i=!t&&1==(o>>n&1);n<6?this.modules[n][8]=i:n<8?this.modules[n+1][8]=i:this.modules[this.moduleCount-15+n][8]=i}for(n=0;n<15;n++){i=!t&&1==(o>>n&1);n<8?this.modules[8][this.moduleCount-n-1]=i:n<9?this.modules[8][15-n-1+1]=i:this.modules[8][15-n-1]=i}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,o=this.moduleCount-1,n=7,i=0,a=this.moduleCount-1;a>0;a-=2)for(6==a&&a--;;){for(var s=0;s<2;s++)if(null==this.modules[o][a-s]){var h=!1;i<t.length&&(h=1==(t[i]>>>n&1)),QRUtil.getMask(e,o,a-s)&&(h=!h),this.modules[o][a-s]=h,-1==--n&&(i++,n=7)}if((o+=r)<0||this.moduleCount<=o){o-=r,r=-r;break}}}},QRCodeModel.PAD0=236,QRCodeModel.PAD1=17,QRCodeModel.createData=function(t,e,r){for(var o=QRRSBlock.getRSBlocks(t,e),n=new QRBitBuffer,i=0;i<r.length;i++){var a=r[i];n.put(a.mode,4),n.put(a.getLength(),QRUtil.getLengthInBits(a.mode,t)),a.write(n)}var s=0;for(i=0;i<o.length;i++)s+=o[i].dataCount;if(n.getLengthInBits()>8*s)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+8*s+")");for(n.getLengthInBits()+4<=8*s&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(!1);for(;!(n.getLengthInBits()>=8*s||(n.put(QRCodeModel.PAD0,8),n.getLengthInBits()>=8*s));)n.put(QRCodeModel.PAD1,8);return QRCodeModel.createBytes(n,o)},QRCodeModel.createBytes=function(t,e){for(var r=0,o=0,n=0,i=new Array(e.length),a=new Array(e.length),s=0;s<e.length;s++){var h=e[s].dataCount,l=e[s].totalCount-h;o=Math.max(o,h),n=Math.max(n,l),i[s]=new Array(h);for(var u=0;u<i[s].length;u++)i[s][u]=255&t.buffer[u+r];r+=h;var g=QRUtil.getErrorCorrectPolynomial(l),d=new QRPolynomial(i[s],g.getLength()-1).mod(g);a[s]=new Array(g.getLength()-1);for(u=0;u<a[s].length;u++){var f=u+d.getLength()-a[s].length;a[s][u]=f>=0?d.get(f):0}}var c=0;for(u=0;u<e.length;u++)c+=e[u].totalCount;var R=new Array(c),p=0;for(u=0;u<o;u++)for(s=0;s<e.length;s++)u<i[s].length&&(R[p++]=i[s][u]);for(u=0;u<n;u++)for(s=0;s<e.length;s++)u<a[s].length&&(R[p++]=a[s][u]);return R};for(var QRMode={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},QRErrorCorrectLevel={L:1,M:0,Q:3,H:2},QRMaskPattern={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},QRUtil={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;QRUtil.getBCHDigit(e)-QRUtil.getBCHDigit(QRUtil.G15)>=0;)e^=QRUtil.G15<<QRUtil.getBCHDigit(e)-QRUtil.getBCHDigit(QRUtil.G15);return(t<<10|e)^QRUtil.G15_MASK},getBCHTypeNumber:function(t){for(var e=t<<12;QRUtil.getBCHDigit(e)-QRUtil.getBCHDigit(QRUtil.G18)>=0;)e^=QRUtil.G18<<QRUtil.getBCHDigit(e)-QRUtil.getBCHDigit(QRUtil.G18);return t<<12|e},getBCHDigit:function(t){for(var e=0;0!=t;)e++,t>>>=1;return e},getPatternPosition:function(t){return QRUtil.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case QRMaskPattern.PATTERN000:return(e+r)%2==0;case QRMaskPattern.PATTERN001:return e%2==0;case QRMaskPattern.PATTERN010:return r%3==0;case QRMaskPattern.PATTERN011:return(e+r)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case QRMaskPattern.PATTERN101:return e*r%2+e*r%3==0;case QRMaskPattern.PATTERN110:return(e*r%2+e*r%3)%2==0;case QRMaskPattern.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new QRPolynomial([1],0),r=0;r<t;r++)e=e.multiply(new QRPolynomial([1,QRMath.gexp(r)],0));return e},getLengthInBits:function(t,e){if(1<=e&&e<10)switch(t){case QRMode.MODE_NUMBER:return 10;case QRMode.MODE_ALPHA_NUM:return 9;case QRMode.MODE_8BIT_BYTE:case QRMode.MODE_KANJI:return 8;default:throw new Error("mode:"+t)}else if(e<27)switch(t){case QRMode.MODE_NUMBER:return 12;case QRMode.MODE_ALPHA_NUM:return 11;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 10;default:throw new Error("mode:"+t)}else{if(!(e<41))throw new Error("type:"+e);switch(t){case QRMode.MODE_NUMBER:return 14;case QRMode.MODE_ALPHA_NUM:return 13;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 12;default:throw new Error("mode:"+t)}}},getLostPoint:function(t){for(var e=t.getModuleCount(),r=0,o=0;o<e;o++)for(var n=0;n<e;n++){for(var i=0,a=t.isDark(o,n),s=-1;s<=1;s++)if(!(o+s<0||e<=o+s))for(var h=-1;h<=1;h++)n+h<0||e<=n+h||0==s&&0==h||a==t.isDark(o+s,n+h)&&i++;i>5&&(r+=3+i-5)}for(o=0;o<e-1;o++)for(n=0;n<e-1;n++){var l=0;t.isDark(o,n)&&l++,t.isDark(o+1,n)&&l++,t.isDark(o,n+1)&&l++,t.isDark(o+1,n+1)&&l++,0!=l&&4!=l||(r+=3)}for(o=0;o<e;o++)for(n=0;n<e-6;n++)t.isDark(o,n)&&!t.isDark(o,n+1)&&t.isDark(o,n+2)&&t.isDark(o,n+3)&&t.isDark(o,n+4)&&!t.isDark(o,n+5)&&t.isDark(o,n+6)&&(r+=40);for(n=0;n<e;n++)for(o=0;o<e-6;o++)t.isDark(o,n)&&!t.isDark(o+1,n)&&t.isDark(o+2,n)&&t.isDark(o+3,n)&&t.isDark(o+4,n)&&!t.isDark(o+5,n)&&t.isDark(o+6,n)&&(r+=40);var u=0;for(n=0;n<e;n++)for(o=0;o<e;o++)t.isDark(o,n)&&u++;return r+=10*(Math.abs(100*u/e/e-50)/5)}},QRMath={glog:function(t){if(t<1)throw new Error("glog("+t+")");return QRMath.LOG_TABLE[t]},gexp:function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return QRMath.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},i=0;i<8;i++)QRMath.EXP_TABLE[i]=1<<i;for(i=8;i<256;i++)QRMath.EXP_TABLE[i]=QRMath.EXP_TABLE[i-4]^QRMath.EXP_TABLE[i-5]^QRMath.EXP_TABLE[i-6]^QRMath.EXP_TABLE[i-8];for(i=0;i<255;i++)QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]]=i;function QRPolynomial(t,e){if(null==t.length)throw new Error(t.length+"/"+e);for(var r=0;r<t.length&&0==t[r];)r++;this.num=new Array(t.length-r+e);for(var o=0;o<t.length-r;o++)this.num[o]=t[o+r]}function QRRSBlock(t,e){this.totalCount=t,this.dataCount=e}function QRBitBuffer(){this.buffer=[],this.length=0}QRPolynomial.prototype={get:function(t){return this.num[t]},getLength:function(){return this.num.length},multiply:function(t){for(var e=new Array(this.getLength()+t.getLength()-1),r=0;r<this.getLength();r++)for(var o=0;o<t.getLength();o++)e[r+o]^=QRMath.gexp(QRMath.glog(this.get(r))+QRMath.glog(t.get(o)));return new QRPolynomial(e,0)},mod:function(t){if(this.getLength()-t.getLength()<0)return this;for(var e=QRMath.glog(this.get(0))-QRMath.glog(t.get(0)),r=new Array(this.getLength()),o=0;o<this.getLength();o++)r[o]=this.get(o);for(o=0;o<t.getLength();o++)r[o]^=QRMath.gexp(QRMath.glog(t.get(o))+e);return new QRPolynomial(r,0).mod(t)}},QRRSBlock.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]],QRRSBlock.getRSBlocks=function(t,e){var r=QRRSBlock.getRsBlockTable(t,e);if(null==r)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);for(var o=r.length/3,n=[],i=0;i<o;i++)for(var a=r[3*i+0],s=r[3*i+1],h=r[3*i+2],l=0;l<a;l++)n.push(new QRRSBlock(s,h));return n},QRRSBlock.getRsBlockTable=function(t,e){switch(e){case QRErrorCorrectLevel.L:return QRRSBlock.RS_BLOCK_TABLE[4*(t-1)+0];case QRErrorCorrectLevel.M:return QRRSBlock.RS_BLOCK_TABLE[4*(t-1)+1];case QRErrorCorrectLevel.Q:return QRRSBlock.RS_BLOCK_TABLE[4*(t-1)+2];case QRErrorCorrectLevel.H:return QRRSBlock.RS_BLOCK_TABLE[4*(t-1)+3];default:return}},QRBitBuffer.prototype={get:function(t){var e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(var r=0;r<e;r++)this.putBit(1==(t>>>e-r-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++}};var QRCodeLimitLength=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function QRCode(t){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M"},"string"==typeof t&&(t={content:t}),t)for(var e in t)this.options[e]=t[e];if("string"!=typeof this.options.content)throw new Error("Expected 'content' as string!");if(0===this.options.content.length)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0&&this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");var r=this.options.content,o=function(t,e){for(var r=function(t){var e=encodeURI(t).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return e.length+(e.length!=t?3:0)}(t),o=1,n=0,i=0,a=QRCodeLimitLength.length;i<=a;i++){var s=QRCodeLimitLength[i];if(!s)throw new Error("Content too long: expected "+n+" but got "+r);switch(e){case"L":n=s[0];break;case"M":n=s[1];break;case"Q":n=s[2];break;case"H":n=s[3];break;default:throw new Error("Unknwon error correction level: "+e)}if(r<=n)break;o++}if(o>QRCodeLimitLength.length)throw new Error("Content too long");return o}(r,this.options.ecl),n=function(t){switch(t){case"L":return QRErrorCorrectLevel.L;case"M":return QRErrorCorrectLevel.M;case"Q":return QRErrorCorrectLevel.Q;case"H":return QRErrorCorrectLevel.H;default:throw new Error("Unknwon error correction level: "+t)}}(this.options.ecl);this.qrcode=new QRCodeModel(o,n),this.qrcode.addData(r),this.qrcode.make()}QRCode.prototype.svg=function(t){var e=this.options||{},r=this.qrcode.modules;void 0===t&&(t={container:e.container||"svg"});for(var o=void 0===e.pretty||!!e.pretty,n=o?"  ":"",i=o?"\r\n":"",a=e.width,s=e.height,h=r.length,l=a/(h+2*e.padding),u=s/(h+2*e.padding),g=void 0!==e.join&&!!e.join,d=void 0!==e.swap&&!!e.swap,f=void 0===e.xmlDeclaration||!!e.xmlDeclaration,c=void 0!==e.predefined&&!!e.predefined,R=c?n+'<defs><path id="qrmodule" d="M0 0 h'+u+" v"+l+' H0 z" style="fill:'+e.color+';shape-rendering:crispEdges;" /></defs>'+i:"",p=n+'<rect x="0" y="0" width="'+a+'" height="'+s+'" style="fill:'+e.background+';shape-rendering:crispEdges;"/>'+i,m="",Q="",v=0;v<h;v++)for(var E=0;E<h;E++){if(r[E][v]){var M=E*l+e.padding*l,C=v*u+e.padding*u;if(d){var B=M;M=C,C=B}if(g){var w=l+M,L=u+C;M=Number.isInteger(M)?Number(M):M.toFixed(2),C=Number.isInteger(C)?Number(C):C.toFixed(2),w=Number.isInteger(w)?Number(w):w.toFixed(2),Q+="M"+M+","+C+" V"+(L=Number.isInteger(L)?Number(L):L.toFixed(2))+" H"+w+" V"+C+" H"+M+" Z "}else m+=c?n+'<use x="'+M.toString()+'" y="'+C.toString()+'" href="#qrmodule" />'+i:n+'<rect x="'+M.toString()+'" y="'+C.toString()+'" width="'+l+'" height="'+u+'" style="fill:'+e.color+';shape-rendering:crispEdges;"/>'+i}}g&&(m=n+'<path x="0" y="0" style="fill:'+e.color+';shape-rendering:crispEdges;" d="'+Q+'" />');var T="";switch(t.container){case"svg":f&&(T+='<?xml version="1.0" standalone="yes"?>'+i),T+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+a+'" height="'+s+'">'+i,T+=R+p+m,T+="</svg>";break;case"svg-viewbox":f&&(T+='<?xml version="1.0" standalone="yes"?>'+i),T+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 '+a+" "+s+'">'+i,T+=R+p+m,T+="</svg>";break;case"g":T+='<g width="'+a+'" height="'+s+'">'+i,T+=R+p+m,T+="</g>";break;default:T+=(R+p+m).replace(/^\s+/,"")}return T},QRCode.prototype.save=function(t,e){var r=this.svg();"function"!=typeof e&&(e=function(t,e){});try{require("fs").writeFile(t,r,e)}catch(t){e(t)}},"undefined"!=typeof module&&(module.exports=QRCode);var pd_guides={};(function(_,$){$.ceEvent('on','ce.pd_init_view_post',function(data){setTimeout(function(){if(pd_location!='U'){var _f=function(){pd_guides[cur_view]=fn_pd_create_guides_data(product_views[cur_view].canvas.guides);fn_draw_guides(cnvs,pd_guides[cur_view],false);}
$.ceEvent('on','ce.pd_apply_clip_area_done',function(){_f();});$.ceEvent('on','ce.pd_shaped_border_drawn',function(){_f();});_f();}},50);});}(Tygh,Tygh.$));function fn_pd_create_guides_data(guides){var cur_mask={};if(guides){for(var i in guides){var gdata=guides[i].conf,rect={width:Number(gdata.width),height:Number(gdata.height),left:Number(gdata.x),top:Number(gdata.y),angle:Number(gdata.rotation),evented:false,selectable:false,rx:Number(gdata.round),ry:Number(gdata.round),scaleX:gdata.scale_x?gdata.scale_x:1,scaleY:gdata.scale_y?gdata.scale_y:1,fill:false,stroke:typeof(fn_pd_hex_to_rgba)==='function'?fn_pd_hex_to_rgba('#'+rgb2hex(gdata.stroke_color),Number(gdata.alpha)):gdata.stroke_color,opacity:Number(gdata.alpha),is_guide:true,_ind:i};if(gdata.type=='custom_shape'){rect.shape=gdata.shape?gdata.shape:'';}
cur_mask[i]=rect;}}
return cur_mask;}
function fn_draw_guides(canvas_obj,clip_data,transp){if(!clip_data){return;}
canvas_obj.discardActiveObject();fn_prepare_objects_for_guides(canvas_obj,0,true);var _ctx=canvas_obj.bordersCanvas.getContext('2d');canvas_obj.renderAll();if(!transp){for(var i in clip_data){if(clip_data[i].shape){var conf=fn_pd_copy_mask_data(clip_data[i],1),shape_url=shapes_dir+conf.shape;if(shapes_cache[shape_url]){var sh=shapes_cache[shape_url];fn_set_shape_properties(sh,conf);sh.is_guide=true;canvas_obj.add(sh);canvas_obj.renderAll();}else{fabric.loadSVGFromURL(shape_url,function(objects,options){var sh=fabric.util.groupSVGElements(objects,options);shapes_cache[shape_url]=sh;fn_set_shape_properties(sh,conf);sh.is_guide=true;canvas_obj.add(sh);fn_prepare_objects_for_guides(canvas_obj,0,false);canvas_obj.renderAll();_ctx.drawImage(canvas_obj.lowerCanvasEl,0,0,canvas_obj.lowerCanvasEl.width,canvas_obj.lowerCanvasEl.height);sh.off('removed');canvas_obj.remove(sh);fn_prepare_objects_for_guides(canvas_obj,1,false);canvas_obj.renderAll();});}
break;}else{canvas_obj.add(new fabric.Rect(fn_pd_copy_mask_data(clip_data[i],1)));canvas_obj.renderAll();}}
_ctx.drawImage(canvas_obj.lowerCanvasEl,0,0,canvas_obj.lowerCanvasEl.width,canvas_obj.lowerCanvasEl.height);}
fn_prepare_objects_for_guides(canvas_obj,1,true);canvas_obj.renderAll();}
function fn_prepare_objects_for_guides(canvas_obj,alpha,del_border_obj){var _objects=canvas_obj.getObjects();for(var id in _objects){var item=_objects[id];if((item.type=='rect'||item.type=='path'||item.type=='group'&&!item.clipart_id)&&item.is_guide){if(del_border_obj){item.off('removed');canvas_obj.remove(item);}}else{item.set('opacity',alpha);}}}
fabric.Object.prototype.toObject=(function(toObject){return function(){return fabric.util.object.extend(toObject.call(this),{is_guide:this.is_guide||false});};})(fabric.Object.prototype.toObject);fabric.Object.prototype._createCacheCanvas=function(){this._cacheProperties={};this._cacheCanvas=fabric.util.createCanvasElement();this._cacheContext=this._cacheCanvas.getContext('2d',{willReadFrequently:true});this._updateCacheCanvas();this.dirty=true;};fabric.StaticCanvas.prototype._createLowerCanvas=function(canvasEl){if(canvasEl&&canvasEl.getContext){this.lowerCanvasEl=canvasEl;}
else{this.lowerCanvasEl=fabric.util.getById(canvasEl)||this._createCanvasElement();}
fabric.util.addClass(this.lowerCanvasEl,'lower-canvas');this._originalCanvasStyle=this.lowerCanvasEl.style;if(this.interactive){this._applyCanvasStyle(this.lowerCanvasEl);}
this.contextContainer=this.lowerCanvasEl.getContext('2d',{willReadFrequently:true});};var pd_adding_order=0;var variation_shapes_done=false;$(window).on('load',function(){if(typeof(product_views)=='undefined'){return;}
if(fn_pd_add_to_cart){var orig_fn_pd_add_to_cart=fn_pd_add_to_cart;fn_pd_add_to_cart=function(evt,skip_options){var res=true;for(var i=0;i<product_views.length;i++){if(mviews[i]&&mviews[i].objects.length){res=false;}}
if(res&&tool_settings.allow_without_design>0){$('#design_data').val('');$('#th_result').val('');evt.returnValue=true;return true;}
res=orig_fn_pd_add_to_cart(evt,skip_options);if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){for(var i in masks[cur_view]){fn_add_mask_controls(masks[cur_view][i]);break;}}
evt.returnValue=res;return res;};}});(function(_,$){$.ceEvent('on','ce.pd_init_view',function(data){$('body').prepend($('#phcolors_panel'));if(!mobile_mode){if(Tygh.area!='A'){if(tool_settings.cp_font!=1){$('#text_color').iconselectmenu({change:function(evt,ui){var opt=$('option:selected',this),clr=opt.attr('pd_color_value');fn_pd_change_text_color(clr,opt.attr('pd_color'));if($('#text_color-button .clr-sqr').length>0){$('#text_color-button .clr-sqr').css('background','#'+clr);}else{$('#text_color-button .ui-selectmenu-text').prepend('<span class="clr-sqr" style="background: #'+clr+';"></span>');}
if(opt.attr('data-bg-img')){$.ceNotification('show',{type:'N',title:_lvars.notice,message:_lvars.glitter_color_notification,message_state:'I'});fn_pd_set_color_pattern(opt.attr('data-bg-img'),clr);}}});$('#text_color-button .ui-selectmenu-text').prepend('<span class="clr-sqr" style="background: #'+$('#text_color option:selected').attr('pd_color_value')+';"></span>');}
if(tool_settings.cp_qrcode!=1){$('#qr_color').iconselectmenu({change:function(evt,ui){var opt=$('option:selected',this),clr=opt.attr('pd_color_value');fn_pd_change_qrcode_color(clr,opt.attr('pd_color'));if($('#qr_color-button .clr-sqr').length>0){$('#qr_color-button .clr-sqr').css('background','#'+clr);}else{$('#qr_color-button .ui-selectmenu-text').prepend('<span class="clr-sqr" style="background: #'+clr+';"></span>');}}});$('#qr_color-button .ui-selectmenu-text').prepend('<span class="clr-sqr" style="background: #'+$('#qr_color option:selected').attr('pd_color_value')+';"></span>');$('#qr_bg_color').iconselectmenu({change:function(evt,ui){var opt=$('option:selected',this),clr=opt.attr('pd_color_value');fn_pd_change_qrcode_color(clr,opt.attr('pd_color'),true);if($('#qr_bg_color-button .clr-sqr').length>0){$('#qr_bg_color-button .clr-sqr').css('background','#'+clr);}else{$('#qr_bg_color-button .ui-selectmenu-text').prepend('<span class="clr-sqr" style="background: #'+clr+';"></span>');}}});$('#qr_bg_color-button .ui-selectmenu-text').prepend('<span class="clr-sqr" style="background: #'+$('#qr_bg_color option:selected').attr('pd_color_value')+';"></span>');}
$.ceEvent('on','ce.tab.show',function(){var pd_canvas=$('#pd_canvas'),clr_panel=$('#true_color_panel');if($('#set_true_color').hasClass('active')){$('#content_set_color_panel').removeClass('hidden');if(clr_panel.length==0){pd_canvas.before('<div id="true_color_panel" class="hidden white-box"><img src="" /></div>');clr_panel=$('#true_color_panel');clr_panel.width(pd_canvas.width()).height(pd_canvas.height());clr_panel.css('padding-left',pd_canvas.css('padding-left'));clr_panel.css('padding-top',pd_canvas.css('padding-top'));clr_panel.css('padding-bottom',pd_canvas.css('padding-bottom'));clr_panel.css('padding-right',pd_canvas.css('padding-right'));clr_panel.css({'position':'absolute','text-align':'center','line-height':pd_canvas.height()+'px'});$('#content_set_color_panel .color-block-button').on('click',function(){var _src=$('img',$(this).parents('.color-block-border:first')).prop('src');if(_src){_src=fn_query_remove(_src,['w','h']);$('img',clr_panel).prop('src',_src+'&w='+view_width+'&h='+view_height);}});var cur_src=$('#content_set_color_panel .color-block-border.active img').prop('src');if(cur_src){cur_src=fn_query_remove(cur_src,['w','h']);$('img',clr_panel).prop('src',cur_src+'&w='+view_width+'&h='+view_height);}}
clr_panel.removeClass('hidden');pd_canvas.css('visibility','hidden');$('.product-sides').css('visibility','hidden');}else{clr_panel.addClass('hidden');pd_canvas.css('visibility','visible');$('.product-sides').css('visibility','visible');}});}}else{if(Tygh.area!='A'){if(tool_settings.cp_font!=1){$('#text_color a').click(function(evt){var opt=$(this),clr=opt.attr('pd_color_value');fn_pd_change_text_color(clr,opt.attr('pd_color'));if(opt.attr('data-bg-img')){$.ceNotification('show',{type:'N',title:_lvars.notice,message:_lvars.glitter_color_notification,message_state:'I'});fn_pd_set_color_pattern(opt.attr('data-bg-img'),clr);}});}
if(tool_settings.cp_qrcode!=1){$('#qr_color a').click(function(evt){var opt=$(this),clr=opt.attr('pd_color_value');fn_pd_change_qrcode_color(clr,opt.attr('pd_color'));});$('#qr_bg_color a').click(function(evt){var opt=$(this),clr=opt.attr('pd_color_value');fn_pd_change_qrcode_color(clr,opt.attr('pd_color'),true);});}}
$('#set_true_color').on('click',function(e){var _src=$('#content_set_color_panel .color-block-border.active .color-block-button').css('background-image').replace(/(?:^url\(["']?|["']?\)$)/g,'');if(_src!='none'){window.open(fn_query_remove(_src,['w','h']),'_blank');}});$('body').prepend($('.pd-popup'));cnvs.on('mouse:down',function(evt){var obj=cnvs.getActiveObject();if(!obj){if($('#add_design').length==0){if($('#add_text_panel').length>0){fn_start_update_text(true);}else if($('#upload_photo_panel').length>0&&!$('#content_upload_photo_panel').is(':visible')){$('#upload_photo_panel').click();}}else{if(Tygh.area!='A'&&!$('#content_add_design').is(':visible')){var jelm=$('#add_design');jelm.addClass('set-size-animated');setTimeout(function(){jelm.removeClass('set-size-animated');},2000);}}}});}
if(Tygh.area!='A'&&product_mode=='sticker'){cnvs.on('mouse:down',function(evt){if(mobile_mode){var jelm=$('a[data-ca-target-id=photo_list_holder]');jelm.addClass('btn-animation');setTimeout(function(){jelm.removeClass('btn-animation');},2000);}else{var obj=cnvs.getActiveObject();if(!obj&&$('#upload_photo_panel').length>0){$('a[data-ca-target-id=photo_list_holder]').click();}}});}
$(_.doc).on('click','.cm-notification-close',function(){if($(this).data('res_checked')!=true){fn_pd_image_check_agreements();}});if(tool_settings.embroidery_product==1&&tool_settings.auto_embroidery==0){}else{cnvs.on('mouse:up',function(evt){var obj=cnvs.getActiveObject();if(!obj&&Tygh.area!='A'&&!mobile_mode){fn_open_panel('add_text_panel',this,30);}});}
cnvs.on('object:added',function(evt){var item=evt.target;if(!(item.type=='rect'||item.type=='path'||item.type=='group'&&!item.clipart_id)){if(item.adding_order){pd_adding_order=Math.max(item.adding_order,pd_adding_order);}else{pd_adding_order++;item.adding_order=pd_adding_order;}}
item.on('selected',function(){var _this=this;if(_this.is_names_object||_this.is_numbers_object){if(_this.is_numbers_object){_this=fn_pd_get_names_object();}
$('#pd_names_values tbody tr:not(.hidden)').remove();if(_this.names_data&&_this.names_data.length>0){var _src=$('#pd_names_values tr:last'),_data=_this.names_data;for(var id=0;id<_data.length;id++){var obj=_src.clone().removeClass('hidden').insertBefore(_src);$('input,select',obj).each(function(){$(this).attr('name',$(this).attr('name').replace(/\[\d+\]/g,'['+(id+1)+']')).prop('disabled',false).removeClass('cm-disabled');$(this).val(_data[id][$(this).attr('mark')]);if($(this).is('select')){$(this).attr('id',$(this).attr('id').replace(/_\d+/g,'_'+(id+1)));$(this).iconselectmenu({appendTo:'#pd_tabs'});}});}}else{$('#pd_names_values a:first').click();}
if(_this.print_wish){$('#print_same_height').prop('checked',_this.print_wish=='height');$('#print_same_width').prop('checked',_this.print_wish=='width');$('#print_as_you_wish').prop('checked',_this.print_wish=='best');}
$('#pd_names_values').show();if(mobile_mode){$('#edit_text_but').hide();$('#edit_names_values').show().click();}}else{$('#pd_names_values').hide();if(mobile_mode){$('#edit_text_but').show();$('#edit_names_values').hide();}}});if(jQuery.inArray(item.type,_txt_obj_types)!==-1){if(item.is_names_object){$('#pd_add_names_but').hide();}
if(tool_settings.arc_text_only==1){item.on('selected',function(){fn_pd_show_arc_text_only_object_sizes();$('#pd_arc_text_size').css('visibility','visible');});cnvs.on('selection:cleared',function(){$('#pd_arc_text_size').css('visibility','hidden');});cnvs.on('object:scaling',function(evt){if(jQuery.inArray(evt.target.type,_txt_obj_types)!==-1){fn_pd_show_arc_text_only_object_sizes();}});if(tool_settings.letter_color_picker==1){if(item.letters&&item.letterFills){var load_pattern_fnc=function(url,color,ind,parent){fabric.util.loadImage(url,function(img){var ptn=new fabric.Pattern({source:img,repeat:'repeat'});ptn.pattern_fill=color;ptn.bg_img_url=img.src;parent.letterFills[ind]=ptn;cnvs.requestRenderAll();});}
var letters=item.letters.getObjects();for(var i=0;i<letters.length;i++){if(typeof(item.letterFills[i])=='object'&&item.letterFills[i]!=null){var p=item.letterFills[i];load_pattern_fnc(p.bg_img_url,p.pattern_fill,i,item);}}}
item.on('mouseup',function(evt){var trg=evt.target,trg_w=trg.width*trg.scaleX,trg_h=trg.height*trg.scaleY,objs=trg.letters.getObjects(),not_shown=true;for(var i=0;i<objs.length;i++){var item=objs[i],bb=item.getBoundingRect(),bb_l=bb.left*trg.scaleX,bb_t=bb.top*trg.scaleY,bb_w=bb.width*trg.scaleX,bb_h=bb.height*trg.scaleY;if(evt.pointer.x>trg.left+trg_w / 2+bb_l&&evt.pointer.x<trg.left+trg_w / 2+bb_l+bb_w&&evt.pointer.y>trg.top+trg_h / 2+bb_t&&evt.pointer.y<trg.top+trg_h / 2+bb_t+bb_h){var offset=$('#main_canvas').offset(),cw=$('#main_canvas').width(),pp=$('#pd_letter_color'),cr=mobile_mode?cw / view_width:1,ppw=pp.outerWidth(),_l=offset.left+(trg.left+trg_w / 2+bb_l+bb_w / 2)*cr-ppw / 2,_t=offset.top+(trg.top+trg_h / 2+bb_t+bb_h)*cr;pp.css({display:'block',left:_l,top:_t}).data('cur_letter',i);if(mobile_mode){var cp=$('.color-palette',pp),dp=(cp.outerWidth()-ppw)/ 2;if(_l-dp<offset.left){cp.css('left',offset.left-_l);}else if(_l+ppw+dp>offset.left+cw){$('.color-palette',pp).css('left',offset.left+cw-_l-ppw-dp*2);}else{cp.css('left',-dp);}}
$('#pd_letter_color a').removeClass('active').each(function(){if(rgb2hex($(this).attr('pd_color_value'))==rgb2hex(item.fill)){$(this).addClass('active');}});not_shown=false;break;}}
if(not_shown){$('#pd_letter_color').css('display','none');}});}}}
if(Tygh.area!='A'&&product_mode=='sticker'&&tool_settings.add_orig_size!=1&&tool_settings.contour_cut!=1){if(item.type=='image'&&item.photo_id){var update_size_ctrl=function(){$('#img_w').val(fn_pd_round(this.width*this.scaleX*unit_per_px,100));$('#img_h').val(fn_pd_round(this.height*this.scaleY*unit_per_px,100));};item.on('selected',update_size_ctrl);item.on('modified',update_size_ctrl);item.on('selected',function(){var obj=cnvs.getActiveObject(),cnt=0;for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.type=='image'&&item.photo_id==obj.photo_id){cnt++;}}
$('#clone_amount').val(cnt);});}}});if(Tygh.area!='A'&&product_mode=='sticker'&&tool_settings.add_orig_size!=1&&tool_settings.contour_cut!=1){$('#rearrange_objs').on('click',function(){var cur_mask=new fabric.Rect(masks[cur_view][0]),diff=5 / unit_per_px,bound_mask=cur_mask.getBoundingRect(),packer=new Packer(bound_mask.width-diff,bound_mask.height*1.2),blocks=[];for(var id in cnvs.getObjects()){var item=cnvs.item(id),bound=item.getBoundingRect();blocks.push({w:bound.width+diff,h:bound.height+diff,uid:item.uid});}
var sort={random:function(a,b){return Math.random()-0.5;},w:function(a,b){return b.w-a.w;},h:function(a,b){return b.h-a.h;},a:function(a,b){return b.area-a.area;},max:function(a,b){return Math.max(b.w,b.h)-Math.max(a.w,a.h);},min:function(a,b){return Math.min(b.w,b.h)-Math.min(a.w,a.h);},height:function(a,b){return sort.msort(a,b,['h','w']);},width:function(a,b){return sort.msort(a,b,['w','h']);},area:function(a,b){return sort.msort(a,b,['a','h','w']);},maxside:function(a,b){return sort.msort(a,b,['max','min','h','w']);},msort:function(a,b,criteria){var diff,n;for(n=0;n<criteria.length;n++){diff=sort[criteria[n]](a,b);if(diff!=0){return diff;}}
return 0;}};blocks.sort(sort.maxside);packer.fit(blocks);var all_fit=true;for(var n=0;n<blocks.length;n++){var block=blocks[n];if(block.fit){for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.uid==block.uid){item.left=block.fit.x+bound_mask.left+diff;item.top=block.fit.y+bound_mask.top+diff;item.setCoords();cnvs.requestRenderAll();break;}}}else{all_fit=false;}}
if(!all_fit){$.ceNotification('show',{type:'E',title:_lvars.error,message:_lvars.resize_photos_to_fit_all_square,message_state:'I'});}});$('#img_w').on('keyup',function(){var obj=cnvs.getActiveObject();if(obj.type=='image'&&obj.photo_id){var v=parseFloat($(this).val()),d=((isNaN(v)||!v)?1:v)/ unit_per_px;obj.scaleX=obj.scaleY=d / obj.width;obj.fire('modified');cnvs.requestRenderAll();}});$('#img_h').on('keyup',function(){var obj=cnvs.getActiveObject();if(obj.type=='image'&&obj.photo_id){var v=parseFloat($(this).val()),d=((isNaN(v)||!v)?1:v)/ unit_per_px;obj.scaleX=obj.scaleY=d / obj.height;obj.fire('modified');cnvs.requestRenderAll();}});$('#clone_amount').change(function(){var _obj=cnvs.getActiveObject();if(_obj&&_obj.type!=='activeSelection'){var amount=parseInt($('#clone_amount').val()),cnt=[];for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.type=='image'&&item.photo_id==_obj.photo_id){cnt.push(item.uid);}}
if(amount>cnt.length){_obj.clone(function(cloned_obj){cnvs.discardActiveObject();var left=cloned_obj.left+10,top=cloned_obj.top+10;cloned_obj.set({left:left,top:top,evented:true,uid:'_'+Math.random().toString(36).substr(2,9)});cnvs.add(cloned_obj);cnvs.setActiveObject(cloned_obj);cnvs.renderAll();});}else if(amount<cnt.length){for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.uid==cnt[cnt.length-1]){cnvs.remove(item);cnvs.requestRenderAll();break;}}
if(cnt.length>1){for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.uid==cnt[cnt.length-2]){cnvs.setActiveObject(item);cnvs.requestRenderAll();break;}}}}}});}
cnvs.on('selection:cleared',function(evt){$('#pd_names_values').hide();if(mobile_mode){$('#edit_text_but').show();$('#edit_names_values').hide();}
for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.is_names_object&&item.loaded&&(!item.names_data||item.names_data.length==0)){cnvs.remove(item);}}});cnvs.on('object:removed',function(evt){if(evt.target.is_numbers_object){$('.pd-number').val('');var _obj=fn_pd_get_names_object();if(_obj.names_data&&_obj.names_data.length>0){for(var id=0;id<_obj.names_data.length;id++){_obj.names_data[id]['number']='';}}}
if(evt.target.is_names_object){var _obj=fn_pd_get_names_object(true);if(_obj){cnvs.remove(_obj);}}
if(!fn_pd_get_names_object()){$('#pd_add_names_but').show();}});$('#pd_names_values table:first tr:last select').iconselectmenu('destroy');$('#pd_names_values').on('keyup',function(evt){clearTimeout($(this).data('_timer'));$(this).data('_timer',setTimeout(function(){fn_pd_update_names_data(evt);},350));});$('#pd_names_values').on('iconselectmenuchange change',function(evt){fn_pd_update_names_data(evt);});if(Tygh.area!='A'){$(_.doc).on('change','#content_set_size_panel .cm-amount',function(){var jelm=$('#add_to_cart_update_'+mproduct_id+' button i');if(!jelm.hasClass('cart-icon-animated')){jelm.addClass('cart-icon-animated');}});if(tool_settings.add_orig_size==1){var pd_fn_add_object_to_canvas=window['fn_add_object_to_canvas'];window['fn_add_object_to_canvas']=function(obj){if(obj.type=='image'&&obj.photo_id){var cur_mask=new fabric.Rect(masks[cur_view][0]),bound=cur_mask.getBoundingRect(),_scale=Number(obj.image_x)/ obj.width*(length_unit=='mm'?25.4:1)/ 300 / unit_per_px;if(bound.width<obj.width*_scale||bound.height<obj.height*_scale){$.ceNotification('show',{type:'E',title:_lvars.error,message:_lvars.photo_bigger_than_canvas,message_state:'I'});return bound;}
obj.scaleX=obj.scaleY=_scale;obj.top=bound.top+(bound.height-obj.height*obj.scaleY)/ 2;obj.left=bound.left+(bound.width-obj.width*obj.scaleX)/ 2;cnvs.add(obj);obj.setControlsVisibility({tl:false,tr:false,br:false});$.ceEvent('trigger','ce.pd_add_object_to_canvas',[obj]);cnvs.setActiveObject(obj);cnvs.requestRenderAll();fn_update_price();$.ceEvent('trigger','ce.pd_add_object_to_canvas_post',[obj]);return bound;}else{return pd_fn_add_object_to_canvas(obj);}}}}
if(tool_settings.arc_text_only==1&&tool_settings.letter_color_picker==1){fabric.CurvedText.prototype.get=function(property,i){if(property=='fill'&&typeof(this['letterFills'])!='undefined'&&this['letterFills'][i]!=null){return this['letterFills'][i];}
return this[property];}
fabric.CurvedText.prototype.hoverCursor='pointer';fabric.CurvedText.prototype._render=function(ctx){var renderingCode=fabric.util.getRandomInt(100,999);this._isRendering=renderingCode;if(this.letters){var curAngle=0,angleRadians=0,align=0,textWidth=0,space=parseInt(this.spacing),len=this.text.length;for(var i=0;i<len;i++){textWidth+=this.letters.item(i).width+space;}
textWidth-=space;if(this.get('textAlign')==='right'){curAngle=90-(((textWidth / 2)/ this.radius)/(Math.PI / 180));}else if(this.get('textAlign')==='left'){curAngle=-90-(((textWidth / 2)/ this.radius)/(Math.PI / 180));}else{curAngle=-(((textWidth / 2)/ this.radius)/(Math.PI / 180));}
if(this.reverse)
curAngle=-curAngle;var width=0,multiplier=this.reverse?-1:1,thisLetterAngle=0,lastLetterAngle=0;for(var i=0;i<len;i++){if(renderingCode!==this._isRendering)
return;for(var key in this.delegatedProperties){this.letters.item(i).set(key,this.get(key,i));}
this.letters.item(i).set('left',(width));this.letters.item(i).set('top',(0));this.letters.item(i).rotate(0);this.letters.item(i).set('padding',0);thisLetterAngle=((this.letters.item(i).width+space)/ this.radius)/(Math.PI / 180);curAngle=multiplier*((multiplier*curAngle)+lastLetterAngle);angleRadians=curAngle*(Math.PI / 180);lastLetterAngle=thisLetterAngle;this.letters.item(i).rotate(curAngle);this.letters.item(i).set('top',multiplier*-1*(Math.cos(angleRadians)*this.radius));this.letters.item(i).set('left',multiplier*(Math.sin(angleRadians)*this.radius));this.letters.item(i).set('padding',0);this.letters.item(i).set('selectable',false);}
this.letters.set('scaleX',1);this.letters.set('scaleY',1);this.letters.set('angle',0);this.letters._calcBounds();this.letters._updateObjectsCoords();this.width=this.letters.width;this.height=this.letters.height;this.letters.left=-(this.width / 2);this.letters.top=-(this.height / 2);}}
fabric.CurvedText.prototype.toObject=(function(toObject){return function(){return fabric.util.object.extend(toObject.call(this),{letterFills:this.letterFills||[]});};})(fabric.CurvedText.prototype.toObject);fabric.Pattern.prototype.toObject=(function(toObject){return function(){return fabric.util.object.extend(toObject.call(this),{bg_img_url:this.bg_img_url||''});};})(fabric.Pattern.prototype.toObject);var cp_html='<div class="letter-colors" id="pd_letter_color"><div class="color-palette clearfix">';$('#text_color '+(mobile_mode?'a':'option')).each(function(ind,elm){cp_html+='<a title="'+$(elm).attr(mobile_mode?'title':'pd_color')+'" style="'+$(elm).attr(mobile_mode?'style':'data-style')+'" pd_color_value="#'+$(elm).attr('pd_color_value')+'" '+($(elm).attr('data-bg-img')?'data-bg-img = "'+$(elm).attr('data-bg-img')+'"':'')+'></a>';});cp_html+='</div></div>';$('body').prepend(cp_html);$('#pd_letter_color a').on('click',function(){var obj=cnvs.getActiveObject(),color=$(this).attr('pd_color_value'),ind=$('#pd_letter_color').data('cur_letter');if($(this).attr('data-bg-img')){$.toggleStatusBox('show');fabric.util.loadImage($(this).attr('data-bg-img'),function(img){$.toggleStatusBox('hide');var ptn=new fabric.Pattern({source:img,repeat:'repeat'});ptn.pattern_fill=color;ptn.bg_img_url=img.src;obj.letterFills[ind]=ptn;cnvs.requestRenderAll();});}else{obj.letterFills[ind]=color;cnvs.requestRenderAll();}
$('#pd_letter_color a').removeClass('active');$(this).addClass('active');});cnvs.on('selection:cleared',function(evt){$('#pd_letter_color').css('display','none');});}
if(tool_settings.roman_date==1){$(_.doc).on('keydown','#roman_date_panel .rm-day,.rm-month,.rm-year',function(e){if(e.key==='Enter'||e.keyCode===13){e.returnValue=false;return false;}});$(_.doc).on('keyup change','#roman_date_panel .rm-day,.rm-month,.rm-year',function(){var p=$('#roman_date_panel'),err=false,d=Number($('.rm-day',p).val()),m=Number($('.rm-month',p).val()),y=Number($('.rm-year',p).val());$('.cm-value-decimal',p).removeClass('cm-failed-field');if(d>31||d<1){err='.rm-day';}
if(m>12||m<1){err='.rm-month';}
if(y>3999||y<1){err='.rm-year';}
if(err){$(err,p).addClass('cm-failed-field');return;}
var res=fn_pd_convert_to_roman_value(d);res+='.'+fn_pd_convert_to_roman_value(m);res+='.'+fn_pd_convert_to_roman_value(y);$('.rm-preview',p).text(res);$('#text_panel_area').val(res);if(!mobile_mode){var obj=cnvs.getActiveObject();if(obj&&jQuery.inArray(obj.type,_txt_obj_types)!==-1){obj.set('text',res);obj.roman_value=[d,m,y];cnvs.requestRenderAll();}}});cnvs.on('object:added',function(evt){var item=evt.target;if(jQuery.inArray(item.type,_txt_obj_types)!==-1){item.on('selected',function(){var p=$('#roman_date_panel');if(item.roman_value.length){$('.rm-day',p).val(item.roman_value[0]);$('.rm-month',p).val(item.roman_value[1]);$('.rm-year',p).val(item.roman_value[2]);}
$('.rm-preview',p).text(item.text);$('#text_panel_area').val(item.text);});}});cnvs.off('selection:cleared',restore_default_textbox_state);restore_default_textbox_state=function(){return;}
var f=window['fn_start_update_text'];fn_start_update_text=function(add_new){f(add_new);var obj=cnvs.getActiveObject();if(!obj){$('textarea',$('#text_edit_panel')).val($('#roman_date_panel .rm-preview').text());}}}
if(tool_settings.embroidery_text==1&&tool_settings.embroidery_text_outline==1||tool_settings.text_outline==1){if(!mobile_mode){if(Tygh.area!='A'){$('#text_outline').iconselectmenu({change:function(evt,ui){var opt=$('option:selected',this),clr=opt.attr('pd_color_value');fn_pd_change_text_outline_color(clr,opt.attr('pd_color'));if($('#text_outline-button .clr-sqr').length>0){$('#text_outline-button .clr-sqr').css('background','#'+clr);}else{$('#text_outline-button .ui-selectmenu-text').prepend('<span class="clr-sqr" style="background: #'+clr+';"></span>');}
if(opt.attr('data-bg-img')){$.ceNotification('show',{type:'N',title:_lvars.notice,message:_lvars.glitter_color_notification,message_state:'I'});fn_pd_set_color_pattern(opt.attr('data-bg-img'),clr,'stroke');}}});$('#text_outline-button .ui-selectmenu-text').prepend('<span class="clr-sqr" style="background: #'+$('#text_outline option:selected').attr('pd_color_value')+';"></span>');}}else{if(Tygh.area!='A'){$('#text_outline a').click(function(evt){var opt=$(this),clr=opt.attr('pd_color_value');fn_pd_change_text_outline_color(clr,opt.attr('pd_color'));if(opt.attr('data-bg-img')){$.ceNotification('show',{type:'N',title:_lvars.notice,message:_lvars.glitter_color_notification,message_state:'I'});fn_pd_set_color_pattern(opt.attr('data-bg-img'),clr,'stroke');}});}}}
if(tool_settings.embroidery_product==1&&tool_settings.auto_embroidery==0){$(_.doc).on('change','.cm-choose-embroidery-file',function(){var file=$(this).prop('files').item(0),row=$(this).parents('tr:first');$('.cm-embroidery-file',row).css('display','block').html('<span>'+file.name+'</span> <a class="ty-icon-cancel cm-remove-embroidery-selection"></a>');$('.embroidery-fileupload',row).css('display','none');$('.cm-make-embroidery-file',row).parent().css('display','none');});$(_.doc).on('click','.cm-remove-embroidery-selection',function(){var row=$(this).parents('tr:first');$('.embroidery-fileupload',row).css('display','block');$('.cm-make-embroidery-file',row).parent().css('display','block');$('.cm-choose-embroidery-file',row).val('');$(this).parent().empty();});$(_.doc).on('change','.cm-make-embroidery-file',function(){var row=$(this).parents('tr:first');$('.cm-embroidery-file',row).empty();$('.embroidery-fileupload',row).css('display',this.checked?'none':'block');$('.cm-choose-embroidery-file',row).val('');});}
if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){$('body').append('<div class="hidden"><canvas id="contour_canvas"></canvas></div>');window.contour_canvas=new fabric.Canvas('contour_canvas');contour_canvas.selection=false;contour_canvas.preserveObjectStacking=true;contour_canvas.on('object:added',function(evt){var item=evt.target;item.evented=false;item.selectable=false;item.objectCaching=false;item.canvas.requestRenderAll();});$('body').append('<div class="hidden"><canvas id="contour_preview_canvas"></canvas></div>');window.contour_preview_canvas=new fabric.Canvas('contour_preview_canvas');contour_preview_canvas.selection=false;contour_preview_canvas.preserveObjectStacking=true;contour_preview_canvas.setWidth(view_width);contour_preview_canvas.setHeight(view_height);contour_preview_canvas.on('object:added',function(evt){var item=evt.target;item.evented=false;item.selectable=false;item.objectCaching=false;item.canvas.requestRenderAll();});$(_.doc).on('click','.pd-set-contour',function(){var objs=cnvs.getObjects(),_clbk=function(){$('#sticker_layers .all').click();};for(var id in objs){if(cnvs.item(id).type!='rect'){cnvs.discardActiveObject();var type=$(this).data('caContour'),elms=0,img=null;for(var _id in objs){if(cnvs.item(_id).type!='rect'){elms++;if(cnvs.item(_id).type=='image'){img=cnvs.item(_id);}}}
$('.pd-set-contour').removeClass('active');$('.pd-set-contour.'+type).addClass('active');if(jQuery.inArray(type,['s','m','l'])!==-1){if(elms==1&&img){img.scaleX=img.scaleY=img.scaleX / 4;fn_update_contour_cut_ratio(img);}
var d={s:10,m:20,l:30}
fn_refresh_contour(d[type],_clbk);}else if(jQuery.inArray(type,['q','r','c'])!==-1){var bb=fn_get_objects_bounding_box(cnvs),v=fn_get_sticker_view_data();if(elms==1&&img){fn_update_contour_cut_ratio(img);}
fn_switch_contour(bb,v.w,v.h,bb.width,bb.height,0,0,1,type);delete masks[cur_view][0].dilate;_clbk();}
break;}}});$(_.doc).on('click','#sticker_layers div',function(){var obj=this.id?$(this):$('#sticker_layers .rect'),uid=obj.attr('id').replace('layer_','');$('#sticker_layers div').removeClass('active');$(this).addClass('active');for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(uid==item.uid){cnvs.setActiveObject(item);cnvs.renderAll();break;}}});if(mobile_mode){$.ceEvent('on','pd.tab.show',function(tab_id){if(tab_id=='upload_photo_panel'){var obj=cnvs.getActiveObject();if(!obj){var s=$($.browser.opera?'html':'html,body'),to=$('#content_upload_photo_panel .thumbs-holder'),pos=to.offset().top-s.prop('clientHeight')+to.prop('scrollHeight');if(pos>s.prop('scrollTop')){s.animate({scrollTop:pos},500);}}}});}}});$.ceEvent('on','ce.pd_object_stacking_changed',function(obj){if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){fn_refresh_contour_evented();}});$.ceEvent('on','ce.canvas_object_added',function(item){if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){item.on('selected',function(){fn_set_active_layer_preview(this);});cnvs.on('selection:cleared',function(evt){$('#sticker_layers div').removeClass('active');});if(item.type=='image'||item.type=='group'||item.type=='qr-code'||jQuery.inArray(item.type,_txt_obj_types)!==-1){_clbk=null;if(item.type=='image'){fn_update_contour_cut_ratio(item);_clbk=function(){$('#sticker_layers .all').click();};item.reset_selection=true;}
fn_refresh_contour_evented(null,_clbk);item.on('modified',fn_refresh_contour_evented);item.on('removed',fn_refresh_contour_evented);var cnt='';if(jQuery.inArray(item.type,_txt_obj_types)!==-1){cnt=item.text.slice(0,3);}else{var _img=item.toDataURL({format:'png',});cnt='<img src="'+_img+'" />';}
$('#sticker_layers .sticker-top-tools').before('<div id="layer_'+item.uid+'">'+cnt+'</div>');item.on('removed',function(){$('#layer_'+item.uid).remove();});}
if(item.type=='rect'){$('#sticker_layers .rect').remove();contour_preview_canvas.clear();var rect=fn_pd_copy_mask_data(masks[cur_view][0]);if(rect.shape||rect.shape_string){var shape=rect.shape;if(shapes_cache[shape]){var sh=fn_pd_copy_mask_data(shapes_cache[shape]);fn_set_shape_properties(sh,rect);sh.opacity=1;sh.strokeWidth=80;contour_preview_canvas.add(sh);}}else{rect=new fabric.Rect(rect);rect.opacity=1;rect.strokeWidth=4;contour_preview_canvas.add(rect);}
contour_preview_canvas.renderAll();var _img=contour_preview_canvas.toDataURL({format:'png',});$('#sticker_layers .sticker-top-tools').before('<div class="rect" id="layer_'+item.uid+'"><img src="'+_img+'" /></div>');item.evented=item.selectable=true;item.lockRotation=true;item.lockMovementX=item.lockMovementY=true;item.setControlsVisibility({tl:true,tr:false,br:true,bl:false});item.sendToBack();item.on('selected',function(evt){for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.type!='rect'){item.before_scale={left:item.left,top:item.top,scaleX:item.scaleX,scaleY:item.scaleY}}}});item.on('scaling',function(evt){$('#pd_tooltip').hide();cnvs.clipPath=this;var ctx=cnvs.bordersCanvas.getContext('2d'),bg_ctx=cnvs.bgCanvas.getContext('2d');ctx.clearRect(0,0,cnvs.bordersCanvas.width,cnvs.bordersCanvas.height);bg_ctx.clearRect(0,0,cnvs.bgCanvas.width,cnvs.bgCanvas.height);var conf=fn_pd_copy_mask_data(masks[cur_view][0],1);conf.width=this.width*this.scaleX;conf.height=this.height*this.scaleY;conf.left=this.left;conf.top=this.top;conf.scaleX=conf.scaleY=1;if(masks[cur_view][0].shape||masks[cur_view][0].shape_string){var sh=shapes_cache[conf.shape_string||(shapes_dir+conf.shape)];fn_set_shape_properties(sh,conf);}else{var sh=new fabric.Rect(conf);}
sh.set('fill',null);cnvs.add(sh);cnvs.renderAll();ctx.drawImage(cnvs.lowerCanvasEl,0,0,cnvs.lowerCanvasEl.width,cnvs.lowerCanvasEl.height);sh.set('fill',conf.fill);sh.set('stroke',null);cnvs.renderAll();bg_ctx.drawImage(cnvs.lowerCanvasEl,0,0,cnvs.lowerCanvasEl.width,cnvs.lowerCanvasEl.height);cnvs.remove(sh);fn_pd_draw_sticker_size_label(ctx,this,true);fn_pd_draw_sticker_size_label(ctx,this,false);$('#sticker_width').val(fn_pd_round(unit_per_px*this.width*this.scaleX,10));$('#sticker_height').val(fn_pd_round(unit_per_px*this.height*this.scaleY,10));var a=$('#sticker_layers .active.all');if(a.length){var t=evt.transform;for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.type!='rect'){item.set('left',t.target.left+(item.before_scale.left-t.original.left)*t.target.scaleX);item.set('top',t.target.top+(item.before_scale.top-t.original.top)*t.target.scaleY);item.set('scaleX',item.before_scale.scaleX*t.target.scaleX);item.set('scaleY',item.before_scale.scaleY*t.target.scaleY);}}}});item.on('modified',function(evt){if(evt.transform.action=='scale'){var m=fn_pd_copy_mask_data(masks[cur_view][0]),_unit_per_px=unit_per_px;fn_pd_sticker_size_changer();var sh=masks[cur_view][0],sx=sh.width / m.width,sy=sh.height / m.height,t=evt.transform,dx=dy=0;$('#sticker_width').val(sh.real_width);$('#sticker_height').val(sh.real_height);var a=$('#sticker_layers .active.all');for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.type!='rect'){if(a.length==0){sx=sy=_unit_per_px / unit_per_px;dx=t.original.left-t.target.left;dy=t.original.top-t.target.top;}
item.set('left',sh.left+(item.before_scale.left-m.left+dx)*sx);item.set('top',sh.top+(item.before_scale.top-m.top+dy)*sy);item.set('scaleX',item.before_scale.scaleX*sx);item.set('scaleY',item.before_scale.scaleY*sy);}}}});}}});$.ceEvent('on','ce.pd_sticker_size_changer',function(data){if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.type=='rect'){if(!data.inp){var w=unit_per_px*item.width*item.scaleX,h=unit_per_px*item.height*item.scaleX;if(data.max_h<h||data.min_h>h){var _h=data.max_h<h?data.max_h:data.min_h;w=w*_h / h;h=_h;}
if(data.max_w<w||data.min_w>w){var _w=data.max_w<w?data.max_w:data.min_w;h=h*_w / w;w=_w;}
data.w=w;data.h=h;}
break;}}
data.m={top:10,left:10,right:10,bottom:10};}});$.ceEvent('on','ce.pd_create_mask_data',function(rect,shape){if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){if(shape.conf.type=='custom_shape'){rect.shape_string=shape.conf.shape_string||'';}}});$.ceEvent('on','ce.pd_apply_clip_area',function(data){if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){data.alpha=data.border_rendering?0:1;if(data.border_rendering){var conf=fn_pd_copy_mask_data(data.mask_data,0.2),stroke=conf.stroke;if(conf.shape){var shape=conf.shape;if(shapes_cache[shape+'brd']){data.alpha=1;var cp=fn_pd_copy_mask_data(shapes_cache[shape],1);conf.opacity=1;fn_set_shape_properties(cp,conf);cp.set('fill','#000000');var g=new fabric.Group([cp]);g.absolutePositioned=true;var sh=fn_pd_copy_mask_data(shapes_cache[shape+'brd'],0.2);conf.opacity=0.2;conf.left-=6;conf.top-=6;conf.stroke='#ff00ff';fn_set_shape_properties(sh,conf);sh.set('fill',null);sh.strokeWidth=12;sh.strokeUniform=true;sh.clipPath=g;cnvs.add(sh);cnvs.renderAll();}}else{conf.fill=null;conf.width-=4;conf.height-=4;conf.strokeWidth=6;conf.strokeUniform=true;conf.stroke='#ff00ff';cnvs.add(new fabric.Rect(conf));conf.opacity=1;conf.width+=5;conf.height+=5;conf.strokeWidth=1;conf.stroke=stroke;cnvs.add(new fabric.Rect(conf));cnvs.renderAll();}}}});$.ceEvent('on','ce.pd_apply_clip_area_pre',function(clip_data,transp,selected_obj){if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){for(var i in clip_data){if(clip_data[i].shape_string&&!shapes_cache[clip_data[i].shape_string]){clip_data[i].shape=clip_data[i].shape_string;fabric.loadSVGFromString(clip_data[i].shape_string,function(objects,options){shapes_cache[clip_data[i].shape_string+'brd']=fabric.util.groupSVGElements(objects,options);});fabric.loadSVGFromString(clip_data[i].shape_string,function(objects,options){shapes_cache[clip_data[i].shape_string]=fabric.util.groupSVGElements(objects,options);fn_apply_clip_area(clip_data,transp,selected_obj);});return;}}
if(!selected_obj){selected_obj=cnvs.getActiveObject();if(selected_obj){selected_obj.is_all=$('#sticker_layers .active.all').length;}}}});$.ceEvent('on','ce.pd_apply_clip_area_done',function(clip_data,transp,selected_obj){if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){fn_pd_set_sticker_size_labels(clip_data);for(var i in clip_data){fn_add_mask_controls(clip_data[i]);break;}
if(selected_obj){for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(selected_obj.uid==item.uid){setTimeout(function(){item.on('selected',function(){fn_set_active_layer_preview(this);});},10);fn_set_active_layer_preview(item);break;}}
if(selected_obj.type=='rect'&&$('#sticker_layers .active.all').length==0){$('#sticker_layers .'+(selected_obj.is_all?'all':'rect')).addClass('active');setTimeout(function(){$('#sticker_layers .'+(selected_obj.is_all?'all':'rect')).click();},10);}}}});$.ceEvent('on','ce.pd_fileupload_add',function(){if(Tygh.area!='A'){var new_th=$('<div id="progress" class="thumb-item spinner" style="width: '+tool_settings.art_th_w+'px; height: '+tool_settings.art_th_h+'px;"></div>'),ph_panel;if(mobile_mode){ph_panel=$('.thumbs-holder',$('#photo_list_holder'));}
if(!mobile_mode||ph_panel.length==0){ph_panel=$('.thumbs-holder',$('#content_upload_photo_panel'));}
ph_panel.prepend(new_th);}});$.ceEvent('on','ce.pd_fileupload_done',function(new_th,result){if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&(tool_settings.contour_cut==1||mobile_mode)){$('#pdph'+result.id).click();}});$.ceEvent('on','ce.pd_fileupload_progress_hide',function(){if(Tygh.area!='A'){$('#progress').remove();}});$.ceEvent('on','ce.pd_add_object_to_canvas_post',function(obj){var jelm=$('#set_size_panel');if(Tygh.area!='A'&&jelm.data('btn_animated')!=true){jelm.data('btn_animated',true);jelm.addClass('set-size-animated');setTimeout(function(){jelm.removeClass('set-size-animated');},2000);}
if(obj.reset_selection){cnvs.discardActiveObject();}});$.ceEvent('on','ce.pd_set_palette_active_color',function(data){if(!mobile_mode&&Tygh.area!='A'&&data.obj.data('customIconselectmenu')){data.obj.val(data['color']).iconselectmenu('refresh');$('#'+data.obj.attr('id')+'-button .ui-selectmenu-text').prepend('<span class="clr-sqr" style="background: #'+data['color']+';"></span>');}});$.ceEvent('on','ce.pd_add_qr_code_post',function(data){if(!mobile_mode&&Tygh.area!='A'&&data['color_obj'].length==0){data['color_obj']=$('#qr_color option:selected');data['background_obj']=$('#qr_bg_color option:selected');}});$.ceEvent('on','ce.pd_add_text_post',function(data){if(!mobile_mode&&Tygh.area!='A'&&data['color_obj'].length==0){data['color_obj']=$('#text_color option:selected');}
if(mobile_mode){$('#add_design').click();}
if(tool_settings.embroidery_text==1&&tool_settings.embroidery_text_outline==1||tool_settings.text_outline==1){var clr_obj=tool_settings.cp_font!=1?$('a.active',$('#text_outline')):$('#text_outline');if(!mobile_mode&&Tygh.area!='A'&&clr_obj.length==0){clr_obj=$('#text_outline option:selected');}
if(clr_obj.length){if(tool_settings.embroidery_text==1){data.additional_options.embr_outline_color_value=parseInt(clr_obj.attr('pd_color_value'),16);data.additional_options.embr_outline_color=clr_obj.attr('pd_color');data.additional_options.outline='#'+clr_obj.attr('pd_color_value');data.additional_options.outlineWidth=$('#switch_border_clr').prop('checked')?0:3;}else{data.additional_options.stroke_color_value=parseInt(clr_obj.attr('pd_color_value'),16);data.additional_options.stroke_color=clr_obj.attr('pd_color');data.additional_options.stroke='#'+clr_obj.attr('pd_color_value');data.additional_options.strokeWidth=4.5;data.additional_options.paintFirst='stroke';data.additional_options.strokeLineJoin='round';}}}});$.ceEvent('on','ce.pd_add_text_to_canvas',function(obj,data){if(tool_settings.single_text_object==1&&$('#text_panel_area').data('text_addition_in_progress')){$('#text_panel_area').data('text_addition_in_progress',false);obj.set('text',fn_change_capitalize($('#text_font').val(),$('#text_panel_area').val()));}
if(tool_settings.roman_date==1){var p=$('#roman_date_panel');obj.roman_value=[$('.rm-day',p).val(),$('.rm-month',p).val(),$('.rm-year',p).val()];}
if(tool_settings.arc_text_only==1){data.allow_addition=false;var match_obj=fabric.util.object.clone(obj),w=Number(tool_settings.arc_text_letter_width),f=match_obj.fontSize;match_obj.set('text','w');if(fn_px_to_real(match_obj.width*match_obj.scaleX)>w){for(var i=f;i>=4;i--){match_obj.set('fontSize',i);if(fn_px_to_real(match_obj.width*match_obj.scaleX)<=w){for(var j=0;j<20;j++){match_obj.set('fontSize',match_obj.fontSize+0.05);if(fn_px_to_real(match_obj.width*match_obj.scaleX)>=w){break;}}
break;}}}else{for(var i=f;i<=200;i++){match_obj.set('fontSize',i);if(fn_px_to_real(match_obj.width*match_obj.scaleX)>=w){for(var j=0;j<20;j++){match_obj.set('fontSize',match_obj.fontSize-0.05);if(fn_px_to_real(match_obj.width*match_obj.scaleX)<=w){break;}}
break;}}}
obj.set('fontSize',match_obj.fontSize);cnvs.add(obj);$.ceEvent('trigger','ce.pd_add_object_to_canvas',[obj]);cnvs.setActiveObject(obj);cnvs.requestRenderAll();fn_update_price();$.ceEvent('trigger','ce.pd_add_object_to_canvas_post',[obj]);fn_pd_apply_arc_radius(-900);var cur_mask=new fabric.Rect(masks[cur_view][0]),bound=cur_mask.getBoundingRect();obj=cnvs.getActiveObject();if(tool_settings.letter_color_picker==1){obj.letterFills=[];}
var _scale=Math.min(bound.width / obj.width,bound.height / obj.height);if(_scale<1){obj.scaleX=obj.scaleY=_scale;}
obj.set('top',bound.top+(bound.height-obj.height*obj.scaleY)/ 2);obj.set('left',bound.left+(bound.width-obj.width*obj.scaleX)/ 2);fn_pd_show_arc_text_only_object_sizes();if(data.color_obj.length){fn_pd_check_colors(data.color_obj.attr('pd_color_value'),data.color_obj.attr('pd_color'));}else{fn_pd_check_colors('000000','');}}});$.ceEvent('on','ce.pd_add_art',function(data){$('.ui-dialog-titlebar-close',$(data.art_obj).parents('.ui-dialog:first')).click();});$.ceEvent('on','ce.pd_add_photo',function(data){$('.ui-dialog-titlebar-close',$(data.photo_obj).parents('.ui-dialog:first')).click();});$.ceEvent('on','dispatch_event_pre',function(e,jelm,processed){if(typeof(product_views)!='undefined'&&e.type=='keydown'){var char_code=(e.which)?e.which:e.keyCode;var obj=cnvs.getActiveObject();if(obj){var arrows=[37,38,39,40];if(jQuery.inArray(char_code,arrows)!==-1&&!jelm.is('textarea')&&!jelm.is('input')){if(char_code==37){obj.set('left',obj.left-1);}else if(char_code==38){obj.set('top',obj.top-1);}else if(char_code==39){obj.set('left',obj.left+1);}else if(char_code==40){obj.set('top',obj.top+1);}
cnvs.renderAll();processed.status=true;processed.to_return=false;}}
if(char_code==27){var _notification_container=$('.cm-notification-content-extended:visible');if(_notification_container.length){fn_pd_image_check_agreements();}}}});$.ceEvent('on','ce.pd_change_view_post',function(view_id){if(fn_pd_get_names_object()){$('#pd_add_names_but').hide();}else{$('#pd_add_names_but').show();}
if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){var type=$('.pd-set-contour.active').data('caContour');if(type=='s'||type=='m'||type=='l'){var d={s:10,m:20,l:30};masks[view_id][0].dilate=d[type];}else{setTimeout(function(){$('.pd-set-contour.active').click();},1000);}}});$.ceEvent('on','ce.pd_change_view',function(view_id){if(Tygh.area=='A'&&cur_view!=-1&&typeof(side_extra_data)!='undefined'){if(side_extra_data[cur_view]==undefined){side_extra_data[cur_view]=product_views[cur_view].extra_data?product_views[cur_view].extra_data:{};}
if(side_extra_data[view_id]){$('#extra_data_color').val(side_extra_data[view_id].color);$('#extra_data_pic').val(side_extra_data[view_id].pic);$('#extra_data_info').val(side_extra_data[view_id].info);}}
if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){if(cur_view==-1){$('.pd-set-contour').removeClass('active');if(product_views[view_id].sticker){$('.pd-set-contour.'+product_views[view_id].sticker.contour_mode).addClass('active');}else{$('.pd-set-contour:first').addClass('active');}}
if(product_views[view_id].sticker&&product_views[view_id].sticker.contour_mask){var _masks=product_views[view_id].sticker.contour_mask;for(var i in _masks){var c=product_views[view_id].canvas.shapes[i].conf,m=_masks[i];c.x=m.left;c.y=m.top;c.round=m.rx;c.rotation=m.angle;c.width=m.width;c.height=m.height;c.scale_x=m.scaleX;c.scale_y=m.scaleY;c.type=m.shape||m.shape_string?'custom_shape':'basic';c.shape=m.shape||'';c.shape_string=m.shape_string?m.shape_string.replace(/\$ldelim/g,'<').replace(/\$rdelim/g,'>'):'';}}}});$.ceEvent('on','ce.pd_init_view_post',function(data){$('#ph_colors').on('iconselectmenuchange',function(){fn_pd_rearange_phcolors(this);});if(tool_settings.single_text_object==1){var set_active_text_object=function(){var obj=cnvs.getActiveObject();if(!obj){for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(jQuery.inArray(item.type,_txt_obj_types)!==-1){obj=item;break;}}
if(obj){cnvs.setActiveObject(obj);cnvs.requestRenderAll();}}
return obj;}
$('#text_panel_area').on('keyup change',function(){var v=fn_change_capitalize($('#text_font').val(),$('#text_panel_area').val()),obj=set_active_text_object();if(obj){if(obj.text!=v){obj.set('text',v);$(this).val(v);}
var cur_mask=new fabric.Rect(masks[cur_view][0]),bound=cur_mask.getBoundingRect(),_scale=Math.min(bound.width / obj.width,bound.height / obj.height);if(_scale>1){_scale=1;}
obj.scaleX=obj.scaleY=_scale;if(obj.left+obj.width*obj.scaleX>bound.left+bound.width){obj.left=bound.left+bound.width-obj.width*obj.scaleX;}else if(obj.left<bound.left){obj.left=bound.left;}
cnvs.requestRenderAll();}else{if(!$(this).data('text_addition_in_progress')){fn_add_text('');$(this).data('text_addition_in_progress',true);}}});$('#text_font,#text_color').on('iconselectmenuchange',function(){var v=$(this).val(),obj=set_active_text_object();if(obj&&v!=$(this).val()){$(this).val(v).iconselectmenu('refresh');$(this).trigger('iconselectmenuchange');}});$('#text_bold,#text_italic,#text_underline,#text_left,#text_center,#text_right').change(function(){var v=this.checked,obj=set_active_text_object();if(obj&&v!=this.checked){$(this).prop('checked',v).button('refresh');$(this).change();}});cnvs.off('selection:cleared',restore_default_textbox_state);}});$.ceEvent('on','ce.pd_calculate_design_data_pre',function(data){if(tool_settings.printing_method==1||tool_settings.printing_method==3){data['side_numcolors']='';}});$.ceEvent('on','ce.pd_calculate_design_data_objects',function(s_obj,numcolors){if((tool_settings.printing_method==1||tool_settings.printing_method==3)&&s_obj.img_colors){for(var ind in s_obj.img_colors){numcolors.push(s_obj.img_colors[ind].color);}}});$.ceEvent('on','ce.pd_calculate_design_data_side',function(data,numcolors){if((tool_settings.printing_method==1||tool_settings.printing_method==3)&&numcolors.length>0){data['side_numcolors']+=(data['side_numcolors']==''?'':',')+getUniqueArray(numcolors).length;numcolors=[];}});$.ceEvent('on','ce.pd_calculate_design_data_texts',function(s_obj,data,text_price){if(text_price.type=='per_line'&&s_obj.is_numbers_object&&s_obj.text.length>0){data.lines-=s_obj.text.split('\n').length;}
if(tool_settings.embroidery_text==1&&tool_settings.embroidery_text_outline==1||tool_settings.text_outline==1){data.numcolors.push(rgb2hex(tool_settings.embroidery_text==1?s_obj.outline:s_obj.stroke));}});$.ceEvent('on','ce.pd_get_size_price_text_per_line',function(s_obj,data){if(s_obj.is_numbers_object&&s_obj.text.length>0){data.lines-=s_obj.text.split('\n').length;}});$.ceEvent('on','ce.pd_get_size_price_text_per_line_price',function(s_obj,sign,data){if(s_obj.uid==sign.uid&&s_obj.is_numbers_object){var numbers_price=parseFloat(tool_settings.numbers_price);data.price=numbers_price?numbers_price:0;}});$.ceEvent('on','ce.pd_calculate_design_data_post',function(data){if(tool_settings.printing_method==1||tool_settings.printing_method==3){$('#numcolors').val(data['side_numcolors']);}
$('#printing_method').val(tool_settings.printing_method);var numbers_price=parseFloat(tool_settings.numbers_price);if(numbers_price){for(var cn in mviews){if(mviews[cn].objects.length>0){for(var sn in mviews[cn].objects){var sign=mviews[cn].objects[sn];if(sign.is_names_object&&sign.names_data&&sign.names_data.length>0){var _data=sign.names_data;for(var id=0;id<_data.length;id++){if(_data[id]['number']!=''){$('#numbers_added').val(1);return;}}}}}}}
$('#numbers_added').val(0);if(tool_settings.first_line_or_photo_free==1){var first_obj=null,obj_pos=999999;for(var cn in mviews){if(mviews[cn].objects.length>0){for(var sn in mviews[cn].objects){var sign=mviews[cn].objects[sn],w=sign.type=='image'?fn_px_to_real(sign.width*sign.scaleX):0;if((sign.type=='image'&&sign.photo_id!=0&&sign.photo_id!=undefined&&photo_price.type=='per_size'&&w>Number(photo_price.value[0].from)&&w<=Number(photo_price.value[0].to)||jQuery.inArray(sign.type,_txt_obj_types)!==-1&&text_price.type=='per_line')&&obj_pos>sign.adding_order){obj_pos=sign.adding_order;first_obj=sign;}}}}
if(first_obj){if(jQuery.inArray(first_obj.type,_txt_obj_types)!==-1){if(first_obj.text.length>0){var lines=$('#lines').val();lines-=1;$('#lines').val(lines);}}else{var squares=$('#photos').val(),square=fn_px_to_real(first_obj.width*first_obj.scaleX)+':'+fn_px_to_real(first_obj.height*first_obj.scaleY),parts=squares.split(','),_idx=parts.indexOf(square);if(_idx>-1){parts.splice(_idx,1);$('#photos').val(parts.join(','));}}}}
if(tool_settings.embroidery_text==1&&tool_settings.embroidery_height_limit&&tool_settings.embroidery_height_inc){var lines=$('#lines').val(),h=0;for(var cn in mviews){if(mviews[cn].objects.length>0){for(var sn in mviews[cn].objects){var sign=mviews[cn].objects[sn];if(jQuery.inArray(sign.type,_txt_obj_types)!==-1){var _h=fn_px_to_real(sign.height*sign.scaleY)/ sign.text.split('\n').length;if(_h>h){h=_h;}}}}}
$('#lines').val(h+'x'+lines);}});$.ceEvent('on','ce.pd_get_size_price_text',function(data){if(tool_settings.printing_method==1||tool_settings.printing_method==3||tool_settings.first_line_or_photo_free==3){data['cond']=false;}});$.ceEvent('on','ce.pd_check_colors',function(color,color_vals,notifications){if(tool_settings.printing_method==1||tool_settings.printing_method==3){var items_text='',cur_color,sign;for(var _id in cnvs.getObjects()){sign=cnvs.item(_id);if(sign){if(sign.type=='image'&&sign.photo_id!=0&&sign.photo_id!=undefined&&sign.img_colors){var item_name='';for(var i=0;i<sign.img_colors.length;i++){cur_color=sign.img_colors[i].color;if(color_vals.length==tool_settings.limit_colors){if(color_vals.indexOf(cur_color)==-1){sign.img_colors[i].color=color;if(item_name==''){item_name=sign.photo;}}}else{color_vals.push(cur_color);color_vals=getUniqueArray(color_vals);}}
if(item_name!=''){items_text+='<br/>'+item_name;}}}}
if(items_text!=''){notifications.push({type:'W',title:_lvars.notice,message:_lvars.colors_changed+items_text});}}});$.ceEvent('on','ce.pd_check_colors_side',function(data,item){if(tool_settings.printing_method==1||tool_settings.printing_method==3){data['cond']=cur_view==item;}});$.ceEvent('on','ce.pd_init_view_data',function(){if(print_method=='Y'){if(tool_settings.printing_method==0){fn_show_popup_dialog(_lvars.printing_method,_lvars.choose_method,_lvars.screenprinting,function(){tool_settings.printing_method=1;if(tool_settings.limit_colors==0||tool_settings.limit_colors>6){tool_settings.limit_colors=6;}},_lvars.flex,function(){tool_settings.printing_method=2;});var pp=$('#popup_dialog');var _btns=pp.dialog('option','buttons');_btns[_lvars.tamponprint]=function(){tool_settings.printing_method=3;$(this).dialog('close');}
pp.dialog('option','buttons',_btns);}}else{tool_settings.printing_method=2;}
if(Tygh.area!='A'&&product_mode=='sewing'){var cur_opt=tool_settings.attach_to_option?tool_settings.attach_to_option:'';if(cur_opt!=''){if(cart_id){$('#set_size_panel').remove();$('#content_set_size_panel').css('display','none');if(!mobile_mode){$('.pd-tabs .pd-tab:first').click();}}else{$('#main_page > div').css('visibility','hidden');$('#set_size_panel').remove();$('#content_set_size_panel').css('display','none');$('body').append('<div class="hidden" id="pd_choose_sizes_popup"><div class="object-container"></div></div>');$('#pd_choose_sizes_popup .object-container').append($('#size_opt_'+mproduct_id+'_'+cur_opt));$('#pd_choose_sizes_popup').dialog({resizable:false,width:mobile_mode?'auto':500,modal:true,autoOpen:false,closeOnEscape:false,title:_lvars.choose_sizes,open:function(event,ui){$('.ui-dialog-titlebar-close',$(event.target).parent()).remove();},buttons:[{text:_lvars.customize_it,click:function(){var res=true,elms=$('#size_opt_'+mproduct_id+'_'+cur_opt+' input'),html='',selected_variants=[];for(var i=0;i<elms.length;i++){html+='<input type="hidden" name="'+elms.eq(i).prop('name')+'" value="'+elms.eq(i).val()+'" />';if(elms.eq(i).val()!=''&&elms.eq(i).val()!='0'){res=false;selected_variants.push(elms.eq(i).prop('id').split('_')[3]);}}
if(res){return false;}
var initial_view=product_views[0],_id;product_views=[];for(i=0;i<selected_variants.length;i++){product_views.push($.extend(true,{},initial_view));_id=0;for(var j=0;j<product_views[i].image_options.length;j++){if(product_views[i].image_options[j][cur_opt]&&product_views[i].image_options[j][cur_opt]==selected_variants[i]){_id=j;break;}}
if(_id>0){product_views[i].image_id[0]=product_views[i].image_id[_id];}
if(product_views[i].image_options[_id][cur_opt]){var _vr=product_views[i].image_options[_id][cur_opt];if(product_views[i].canvas.option_shapes[_vr]){product_views[i].canvas.shapes=product_views[i].canvas.option_shapes[_vr];}}
product_views[i].label=pd_product_options[cur_opt].variants[selected_variants[i]].variant_name;product_views[i].variant_id=selected_variants[i];}
var sides=$('#main_page .product-sides');sides.empty();for(i=0;i<product_views.length;i++){sides.append('<div class="side-th" onclick="fn_change_view('+i+');">'+'   <div>'+'       <img src="'+fn_url('product_designer.generate_thumbnail?image_id='+product_views[i].image_id[0]+'&w=80')+'" alt="" />'+'   </div>'+
(1?'   <span>'+product_views[i].label+'</span>':'')+'</div>');}
cur_view=-1;mviews={};mviews_th={};masks={};cnvs.clear();fn_change_view(0);$('#ba_opt_'+mproduct_id+'_'+cur_opt).append(html);$('#main_page > div').css('visibility','visible');if(!mobile_mode){$('.pd-tabs .pd-tab:first').click();}
$(this).dialog('close');},class:'ty-btn ty-btn__secondary'}]});$('#pd_choose_sizes_popup').dialog('open');}}}
if(tool_settings.text_outline==1){if($('#text_outline_width').length){$('#text_outline_width').slider({step:0.1,min:0.1,max:4.5,range:'min',slide:function(event,ui){var obj=cnvs.getActiveObject();if(obj&&jQuery.inArray(obj.type,_txt_obj_types)!==-1){obj.set('strokeWidth',ui.value);cnvs.requestRenderAll();}}});}}
if(Tygh.area!='A'&&!mobile_mode){$('#pd_tabs').css('height',$('#pd_canvas').outerHeight(true));}});$.ceEvent('on','ce.pd_pre_add_to_cart',function(data){if(Tygh.area!='A'&&product_mode=='sewing'){for(var i=0;i<product_views.length;i++){if(!mviews[i]||!mviews[i].objects.length){$.ceNotification('show',{type:'E',title:_lvars.error,message:_lvars.set_design_for_all_sizes_error,message_state:'I'});data.result=true;break;}}}
if(tool_settings.embroidery_product==1){if(tool_settings.auto_embroidery==1){for(var i=0;i<product_views.length;i++){if(mviews[i]&&mviews[i].objects.length){for(var j=0;j<mviews[i].objects.length;j++){var item=mviews[i].objects[j];if(item.type=='image'&&item.photo_id){mviews[i].objects[j].is_embroidery_request=true;}}}}}else{if($('#embroidery_files_panel').is(':visible')){var rows=$('#embroidery_files_panel .cm-file-item'),files=$('.cm-choose-embroidery-file',rows).filter(function(){return $(this).val()!=='';}),req=$('.cm-make-embroidery-file:checked',rows);if(rows.length==files.length+req.length){for(var i=0;i<product_views.length;i++){if(mviews[i]&&mviews[i].objects.length){for(var j=0;j<mviews[i].objects.length;j++){var item=mviews[i].objects[j];if(item.type=='image'&&item.photo_id){var f=$('input[name="file_embroidery_files['+item.uid+']"]',rows);if(f.length&&f.val()!==''){mviews[i].objects[j].embroidery_photo_file=f.prop('files').item(0).name;}else{f=$('input[name="make_embroidery_file['+item.uid+']"]:checked',rows);if(f.length){mviews[i].objects[j].is_embroidery_request=true;}}}}}}}else{data.result=true;$.ceNotification('show',{type:'E',title:_lvars.error,message:_lvars.embroidery_request_error,message_state:'I'});}}else{var a=$('<a class="cm-dialog-opener cm-dialog-auto-size"></a>'),params=$.ceDialog('get_params',a),d=$('#embroidery_files_panel'),items=$('.items',d),c=$('.cm-source-item',items),photo_ids=[];$('.cm-file-item',items).remove();for(var i=0;i<product_views.length;i++){if(mviews[i]&&mviews[i].objects.length){for(var j=0;j<mviews[i].objects.length;j++){var item=mviews[i].objects[j];if(item.type=='image'&&item.photo_id&&jQuery.inArray(item.photo_id,photo_ids)===-1){photo_ids.push(item.photo_id);var elm=c.clone();$('img',elm).attr('src',fn_url('product_designer.get_user_photo?id='+item.photo_id+'&w=100&h=100'));$('.cm-choose-embroidery-file',elm).attr('name','file_embroidery_files['+item.uid+']');$('.cm-embroidery-type',elm).attr('name','type_embroidery_files['+item.uid+']');$('.cm-make-embroidery-file',elm).attr('name','make_embroidery_file['+item.uid+']');elm.removeClass('hidden cm-source-item').addClass('cm-file-item').attr('data-uid',item.uid);items.append(elm);}}}}
if($('.cm-file-item',items).length){d.ceDialog('open',params);data.result=true;}}}}
if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){for(var i=0;i<product_views.length;i++){if(mviews[i]&&mviews[i].objects.length){var rcount=0;for(var j=0;j<mviews[i].objects.length;j++){if(mviews[i].objects[j].type=='rect'){rcount++;}}
if(rcount==mviews[i].objects.length){data.result=true;$.ceNotification('show',{type:'E',title:_lvars.error,message:_lvars.empty_design_error,message_state:'I'});break;}}}}
if(Tygh.area!='A'){for(var i=0;i<product_views.length;i++){if(product_views[i].side_required&&!(mviews[i]&&mviews[i].objects.length)){data.result=true;$.ceNotification('show',{type:'W',title:_lvars.warning,message:_lvars.side_requited+' '+product_views[i].label,message_state:'I'});break;}}}});$.ceEvent('on','ce.pd_add_photo_post',function(data,obj){if(tool_settings.printing_method==1||tool_settings.printing_method==3){data['allow']=false;var _fnc=function(){fn_show_popup_dialog(_lvars.notice,_lvars.full_color_notification,_lvars.continue_text,function(){fn_pd_attach_photo(obj);},_lvars.cancel);}
_fnc();}
if(tool_settings.crop_photo==1){data['allow']=false;if(!$('#photo_edit_dialog').length){$('body').prepend('<div id="photo_edit_dialog">'+'<div class="desc-text">'+_lvars.crop_description+'</div>'+'<img class="preview-img" src="" />'+'<div class="zoom"><img class="cm-z-out" src="'+pd_ext_images+'z_out.png" title="'+_lvars.zoom_out+'" /><img class="cm-z-in" src="'+pd_ext_images+'z_in.png" title="'+_lvars.zoom_in+'" /></div>'+'<img class="cm-pan-tool" src="'+pd_ext_images+'pan.png" title="'+_lvars.pan+'" />'+'<img class="cm-history-tool" src="'+pd_ext_images+'undo.png" title="'+_lvars.undo+'" />'+'<div class="photo-canvas"><canvas id="photo_edit_canvas"></canvas></div>'+'</div>');var _c=new fabric.Canvas('photo_edit_canvas');_c.selection=false;_c.on('path:created',function(e){if(e.path){var object=e.path;if(object.width>2&&object.height>2){var _history=$('#photo_edit_canvas').data('history');_history.push([object.path,object.left,object.top,this.freeDrawingBrush.width]);$('#photo_edit_canvas').data('history',_history);this.clipPath=fn_pd_create_clip_path_object(_history);}}});_c.on('mouse:up',function(){if(this.isDragging){this.setViewportTransform(this.viewportTransform);if(mobile_mode){this.lastPosX=this.lastPosY=null;}else{this.isDragging=false;}}else{var object=this.item(this.getObjects().length-1);if(object){this.remove(object);var _history=$('#photo_edit_canvas').data('history');if(_history.length==1){var _s=this.clipPath.getBoundingRect(),zoom=Math.min((this.getWidth()-40)/ _s.width,(this.getHeight()-40)/ _s.height);this.setZoom(zoom);var vpt=this.viewportTransform;vpt[4]=(this.getWidth()-_s.width*zoom)/ 2-_s.left*zoom;vpt[5]=(this.getHeight()-_s.height*zoom)/ 2-_s.top*zoom;this.setViewportTransform(this.viewportTransform);$('#photo_edit_dialog .cm-history-tool').css('display','block');this.freeDrawingBrush.width=20 / zoom;this.freeDrawingBrush.color='rgba(255, 108, 0, 0.5)';}}
$('#photo_edit_dialog .preview-img').css('display','none');}})
if(mobile_mode){_c.on('touch:drag',function(e){if(this.isDragging){if(e.e.touches){var touch=e.e.touches[0],vpt=this.viewportTransform,_x=touch.clientX,_y=touch.clientY;vpt[4]+=_x-(this.lastPosX?this.lastPosX:_x);vpt[5]+=_y-(this.lastPosY?this.lastPosY:_y);this.requestRenderAll();this.lastPosX=_x;this.lastPosY=_y;}}else{var _history=$('#photo_edit_canvas').data('history');if(_history.length==0&&e.self){var preview=this.toUpperDataURL({format:'png',left:e.self.x-25,top:e.self.y-25,width:50,height:50});$('#photo_edit_dialog .preview-img').css('display','block').attr('src',preview);}}});}else{_c.on('mouse:down',function(opt){if($('#photo_edit_dialog .cm-pan-tool').hasClass('dragging')){this.isDragging=true;this.lastPosX=opt.e.clientX;this.lastPosY=opt.e.clientY;}else{var _history=$('#photo_edit_canvas').data('history');if(_history.length==0){$('#photo_edit_dialog .preview-img').css('display','block');}}});_c.on('mouse:move',function(opt){if(this.isDragging){var vpt=this.viewportTransform,_x=opt.e.clientX,_y=opt.e.clientY;vpt[4]+=_x-this.lastPosX;vpt[5]+=_y-this.lastPosY;this.requestRenderAll();this.lastPosX=_x;this.lastPosY=_y;}else{var _history=$('#photo_edit_canvas').data('history');if(_history.length==0&&opt.pointer){var preview=this.toUpperDataURL({format:'png',left:opt.pointer.x-25,top:opt.pointer.y-25,width:50,height:50});$('#photo_edit_dialog .preview-img').attr('src',preview);}}});}
$('#photo_edit_dialog .cm-pan-tool').on('click',function(){var ph_cnvs=$('#photo_edit_canvas').data('fabric');if($(this).hasClass('dragging')){$(this).removeClass('dragging');ph_cnvs.isDrawingMode=true;var _history=$('#photo_edit_canvas').data('history');if(_history.length>0){$('#photo_edit_dialog .cm-history-tool').css('display','block');}
if(mobile_mode){ph_cnvs.isDragging=false;}}else{$(this).addClass('dragging');ph_cnvs.isDrawingMode=false;$('#photo_edit_dialog .cm-history-tool').css('display','none');if(mobile_mode){ph_cnvs.isDragging=true;}}});$('#photo_edit_canvas').data('fabric',_c);$('#photo_edit_dialog').dialog({resizable:false,modal:true,autoOpen:false,closeOnEscape:false,title:_lvars.edit_photo,width:mobile_mode?'100%':500,height:700,dialogClass:'crop-box'});$('#photo_edit_dialog .cm-z-in').on('click',function(){var ph_cnvs=$('#photo_edit_canvas').data('fabric');var zoom=ph_cnvs.getZoom();zoom+=0.02;if(zoom>20)zoom=20;ph_cnvs.zoomToPoint({x:ph_cnvs.width / 2,y:ph_cnvs.height / 2},zoom);var _history=$('#photo_edit_canvas').data('history');ph_cnvs.freeDrawingBrush.width=(_history.length>1?20:2)/ zoom;});$('#photo_edit_dialog .cm-z-out').on('click',function(){var ph_cnvs=$('#photo_edit_canvas').data('fabric');var zoom=ph_cnvs.getZoom();zoom-=0.02;if(zoom<0.01)zoom=0.01;ph_cnvs.zoomToPoint({x:ph_cnvs.width / 2,y:ph_cnvs.height / 2},zoom);var _history=$('#photo_edit_canvas').data('history');ph_cnvs.freeDrawingBrush.width=(_history.length>1?20:2)/ zoom;});$('#photo_edit_dialog .cm-history-tool').on('click',function(){var ph_cnvs=$('#photo_edit_canvas').data('fabric'),_history=$('#photo_edit_canvas').data('history');_history.pop();$('#photo_edit_canvas').data('history',_history);if(_history.length==0){fn_pd_reset_crop_box(ph_cnvs,$('#photo_edit_dialog'));}else{ph_cnvs.clipPath=fn_pd_create_clip_path_object(_history);ph_cnvs.requestRenderAll();}});}
$.toggleStatusBox('show');var _url='product_designer.get_user_photo?id='+$(obj).attr('rel')+'&w='+view_width+'&h='+view_height+((/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&pd_user_id)?'&_uid='+pd_user_id:'');fabric.Image.fromURL(fn_url(_url),function(img){$.toggleStatusBox('hide');img.photo_id=$(obj).attr('rel');img.photo=$(obj).attr('pd_photo')||'';img.image_x=$(obj).attr('data-pd-image-x')||0;img.image_y=$(obj).attr('data-pd-image-y')||0;var pp=$('#photo_edit_dialog'),_btns={};_btns[_lvars.done]=function(){$(this).dialog('close');var _history=$('#photo_edit_canvas').data('history');if(_history.length){$.toggleStatusBox('show');fabric.EditablePhoto.fromURL(fn_url(_url),function(_img){$.toggleStatusBox('hide');_img.photo_id=img.photo_id;_img.photo=img.photo;_img.image_x=img.image_x;_img.image_y=img.image_y;var msk=fn_pd_create_clip_path_object(_history),_sizes=msk.getBoundingRect(),source_img=_img.getElement();_sizes.orig_width=source_img.width;_sizes.orig_height=source_img.height;_img.crop_sizes=_sizes;_img.width=_sizes.width;_img.height=_sizes.height;msk.left=-_sizes.width / 2;msk.top=-_sizes.height / 2;_img.set('clipPath',msk);_img.clip_paths=_history;fn_add_object_to_canvas(_img);$.ceEvent('trigger','ce.pd_add_photo_complete',[_img]);});}else{fn_add_object_to_canvas(img);$.ceEvent('trigger','ce.pd_add_photo_complete',[img]);}}
$('#photo_edit_dialog .cm-pan-tool').removeClass('dragging');pp.dialog('option','buttons',_btns);pp.dialog('open');var ph_cnvs=$('#photo_edit_canvas').data('fabric');$('#photo_edit_canvas').data('history',[]);ph_cnvs.clear();ph_cnvs.setWidth(pp.width());ph_cnvs.setHeight(pp.height());ph_cnvs.backgroundImage=img;fn_pd_reset_crop_box(ph_cnvs,pp);});}});$.ceEvent('on','ce.pd_add_photo_complete',function(img){if(typeof(uploaded_image_size_limit)!='undefined'&&img.image_x<uploaded_image_size_limit&&img.image_y<uploaded_image_size_limit){$.ceNotification('show',{type:'I',title:_lvars.notice,message:'<div class="object-container">'+_lvars.image_size_check_warning+'<input type="checkbox" class="custom-checkbox" name="check_agreements" value="Y" id="pd_image_check_agreements" /><label for="pd_image_check_agreements"><del></del>'+_lvars.image_size_check_agreements+'</label><p><span class="button button-wrap-left"><span class="button button-wrap-right"><a class="cm-notification-close ty-btn ty-btn__primary" onclick="fn_pd_image_check_agreements(true, this);">'+_lvars.ok+'</a></span></span></p>'+'</div>',message_state:'S'});}
if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){var type=$('.pd-set-contour.active').data('caContour');if(type=='q'||type=='r'||type=='c'){$('.pd-set-contour.active').click();}}});$.ceEvent('on','ce.pd_set_photo_dimension',function(img){var box=$('#error_box');if(box.length&&box.is(':visible')){img.scale(Number(img.image_x)/ img.width*(length_unit=='mm'?25.4:1)/ tool_settings.max_photo_dpi / unit_per_px);box.css('display','none');}});$.ceEvent('on','ce.pd_check_photo_resolution',function(img){if(Math.abs(img.width*img.scaleX)>Math.abs(img.image_x / unit_per_px*(length_unit=='mm'?25.4:1)/ tool_settings.max_photo_dpi)||Math.abs(img.height*img.scaleY)>Math.abs(img.image_y / unit_per_px*(length_unit=='mm'?25.4:1)/ tool_settings.max_photo_dpi)){fn_pd_error_box(true,_lvars.photo_cannot_scaled);}else{fn_pd_error_box(false);}});$.ceEvent('on','ce.pd_post_add_to_cart',function(data){for(var id in data.mviews){data.mviews[id].low_res_ok=product_views[id].low_res_ok?product_views[id].low_res_ok:[];}
if(Tygh.area=='A'&&typeof(side_extra_data)!='undefined'){for(var id in data.mviews){data.mviews[id]['extra_data']=side_extra_data[id]?Object.assign({},side_extra_data[id]):{};}}
if(product_mode=='sewing'){for(var id in data.mviews){data.mviews[id].label=product_views[id].label?product_views[id].label:'';data.mviews[id].variant_id=product_views[id].variant_id?product_views[id].variant_id:0;}}
if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){for(var id in data.mviews){for(var i in data.mviews[id].objects){if(data.mviews[id].objects[i].type=='rect'){data.mviews[id].objects.splice(i,1);}}
if(masks[id]){data.mviews[id].sticker.contour_mask=[];var cm=data.mviews[id].sticker.contour_mask;for(var i in masks[id]){cm[i]=fn_pd_copy_mask_data(masks[id][i]);if(cm[i].shape_string){cm[i].shape_string=cm[i].shape_string.replace(/</g,'$ldelim').replace(/>/g,'$rdelim');}}
data.mviews[id].sticker.contour_mode=$('.pd-set-contour.active').data('caContour');}}}});$.ceEvent('on','ce.pd_select_art_post',function(obj){if(tool_settings.printing_method==1||tool_settings.printing_method==3){fn_pd_set_photo_colors_form();$('#panel_phcolors').show();}});$.ceEvent('on','ce.pd_select_art',function(){$('#panel_phcolors').hide();});$.ceEvent('on','ce.pd_select_text',function(obj){if(mobile_mode){var elm=$('#font_'+$('#text_font').val());$('#fonts_menu a').removeClass('active');$('a',elm).addClass('active');fn_scroll_to_elm_list(elm,$('#fonts_menu'));}
if(tool_settings.embroidery_text==1&&tool_settings.embroidery_text_outline==1||tool_settings.text_outline==1){var outline=tool_settings.embroidery_text==1?obj.outline:obj.stroke;if(tool_settings.cp_font!=1){fn_set_palette_active_color($('#text_outline'),rgb2hex(outline));}else{$('#text_outline').spectrum('set',outline);$('#text_outline').attr('pd_color_value',outline.substring(1,7));}
if(tool_settings.embroidery_text!=1){$('#text_outline_width').slider('option','value',obj.get('strokeWidth'));}}});$.ceEvent('on','ce.pd_check_colors_text_item',function(data,sign,color,color_name){if(tool_settings.embroidery_text==1&&tool_settings.embroidery_text_outline==1||tool_settings.text_outline==1){cur_color=rgb2hex(tool_settings.embroidery_text==1?sign.outline:sign.stroke);if(data.color_vals.length==tool_settings.limit_colors){if(data.color_vals.indexOf(cur_color)==-1){if(tool_settings.embroidery_text==1){sign.embr_outline_color_value=parseInt(color,16);sign.embr_outline_color=color_name;sign.set('outline','#'+color);}else{sign.stroke_color_value=parseInt(color,16);sign.stroke_color=color_name;sign.set('stroke','#'+color);}
cnvs.renderAll();}}else{data.color_vals.push(cur_color);data.color_vals=getUniqueArray(data.color_vals);}}});$.ceEvent('on','ce.pd_update_price_post',function(){var box=$('#pd_details_price');if(box.length){box.empty();if(pd_location=='C'&&tool_settings.show_prices==1&&tool_settings.printing_method!=1&&tool_settings.printing_method!=3){var s_obj;var c_name;var props;var sign;var delit=length_unit=='mm'?100:1;for(var cn in mviews){if(mviews[cn].objects.length>0){for(var sn in mviews[cn].objects){sign=mviews[cn].objects[sn];var w=fn_px_to_real(sign.width*sign.scaleX);var h=fn_px_to_real(sign.height*sign.scaleY);if(sign.type=='image'&&sign.photo_id!=0&&sign.photo_id!=undefined){if(photo_price.type=='per_size'){var mval;for(var ln in photo_price.value){if(mval){if(Number(mval.to)<Number(photo_price.value[ln].to)){mval=photo_price.value[ln];}}else{mval=photo_price.value[ln];}
if(w>Number(photo_price.value[ln].from)&&w<=Number(photo_price.value[ln].to)){mval=photo_price.value[ln];break;}}
if(mval.free!=undefined){var items=0,_pos=0;for(var c_name in mviews){if(mviews[c_name].objects.length>0){for(var sign_name in mviews[c_name].objects){s_obj=mviews[c_name].objects[sign_name];if(s_obj.type=='image'&&s_obj.photo_id!=0&&s_obj.photo_id!=undefined){var _sw=fn_px_to_real(s_obj.width*s_obj.scaleX);if(_sw>Number(mval.from)&&_sw<=Number(mval.to)||_sw>Number(mval.to)||_sw<=Number(mval.from)){mval=0;items+=1;if(s_obj.uid==sign.uid){_pos=items;}}}}}}
fn_pd_set_details_price_item(box,_lvars['photo']+' '+sign.photo,$.formatNum(items==1||items>1&&_pos==1?0:(mval.price!=undefined?mval.price:0)));}else{fn_pd_set_details_price_item(box,_lvars['photo']+' '+sign.photo,$.formatNum(mval.price!=undefined?mval.price:0));}}else if(photo_price.type=='per_item'){var items=0;var price=0;for(var c_name in mviews){if(mviews[c_name].objects.length>0){for(var sign_name in mviews[c_name].objects){s_obj=mviews[c_name].objects[sign_name];if(s_obj.type=='image'&&s_obj.photo_id!=0&&s_obj.photo_id!=undefined){items+=1;if(s_obj.uid==sign.uid){for(var ph in photo_price.value){if(photo_price.value[ph].item==items||photo_price.value[ph].item=='other'){price=photo_price.value[ph].price;break;}}}}}
if(price>0){break;}}}
fn_pd_set_details_price_item(box,_lvars['photo']+' '+sign.photo,$.formatNum(price));}else{fn_pd_set_details_price_item(box,_lvars['photo']+' '+sign.photo,$.formatNum(photo_price.value*w*h / delit));}}else if((sign.type=='image'&&sign.clipart_id!=0)||sign.type=='path-group'){var c_id=sign.clipart_id;var price=0;for(var art in cliparts_data){if(cliparts_data[art].clipart_id==c_id){if(cliparts_data[art].price>0){if(cliparts_data[art].price_type=='U'){price=cliparts_data[art].price;}else{price=cliparts_data[art].price*w*h / delit;}}
break;}}
fn_pd_set_details_price_item(box,_lvars['clipart']+' '+sign.clipart,$.formatNum(price));}else if(sign.type=='text'||sign.type=='curvedText'){var price=0,_name=_lvars['text'];if(text_price.type=='per_character'&&text_price.value>0){price=sign.text.length*text_price.value;}else if(text_price.type=='per_centimeter'){price=text_price.value*w*h / delit;}else if(text_price.type=="per_line"){if(sign.text.length>0){var lines=0,line_cost=0,_exit=false;for(var c_name in mviews){if(mviews[c_name].objects.length>0){for(var sign_name in mviews[c_name].objects){s_obj=mviews[c_name].objects[sign_name];if((s_obj.type=='text'||s_obj.type=='curvedText')&&!s_obj.is_numbers_object){for(var i=lines;i<lines+sign.text.split('\n').length;i++){if(text_price.value[i]!=undefined){line_cost=parseFloat(text_price.value[i].price);}
price+=line_cost;}
if(s_obj.uid==sign.uid){_name=sign.text.split('\n').length+' '+_lvars['multilines_text'];_exit=true;break;}
if(s_obj.text.length>0){lines+=s_obj.text.split('\n').length;}}}
if(_exit){break;}}}}else{price=0;}}
var numbers_price=parseFloat(tool_settings.numbers_price);if(numbers_price&&sign.is_numbers_object){price=numbers_price;}
fn_pd_set_details_price_item(box,_name,$.formatNum(price));}}}}}}});$.ceEvent('on','ce.pd_rgb2hex',function(data){if(data.rgb.pattern_fill){data.rgb=data.rgb.pattern_fill;}});$.ceEvent('on','ce.pd_add_object_to_canvas',function(obj){if(jQuery.inArray(obj.type,_txt_obj_types)!==-1){var opt=!mobile_mode?$('option:selected',$('#text_color')):$('#text_color a.active');if(opt.attr('data-bg-img')){fn_pd_set_color_pattern(opt.attr('data-bg-img'),opt.attr('pd_color_value'))}
if(tool_settings.text_outline==1){var opt=!mobile_mode?$('option:selected',$('#text_outline')):$('#text_outline a.active');if(opt.attr('data-bg-img')){fn_pd_set_color_pattern(opt.attr('data-bg-img'),opt.attr('pd_color_value'),'stroke')}}}});$.ceEvent('on','ce.pd_set_new_text_value',function(data){if(!data.obj.is_names_object&&!data.obj.is_numbers_object){if(tool_settings.letter_per_side==1){if(data.txt.length){data.txt=data.txt.charAt(0);$('#text_panel_area').val(data.txt);}}}else{data.allow=false;}
if((Tygh.area!='A'||pd_location!='U')&&product_mode=='sticker'&&tool_settings.contour_cut==1){$('#layer_'+data.obj.uid).text(data.txt.slice(0,3));}});$.ceEvent('on','ce.pd_add_text',function(data){if(tool_settings.letter_per_side==1){mviews[cur_view]=cnvs.toJSON();for(var c_name in mviews){if(mviews[c_name].objects.length>0){for(var sign_name in mviews[c_name].objects){var s_obj=mviews[c_name].objects[sign_name];if(jQuery.inArray(s_obj.type,_txt_obj_types)!==-1){data.allow=false;return;}}}}
data.txt=$('#text_panel_area').val();if(data.txt.length){data.txt=data.txt.charAt(0);$('#text_panel_area').val(data.txt);}}});}(Tygh,Tygh.$));function fn_update_contour_cut_ratio(img){var dpi=tool_settings.enable_checking_resolution==1?tool_settings.max_photo_dpi:300;unit_per_px=Number(img.image_x)/ Number(dpi)*(length_unit=='mm'?25.4:1)/ img.width / img.scaleX;if(tool_settings.enable_checking_resolution==1){for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.type=='image'&&item.photo_id){unit_per_px=Math.min(unit_per_px,Number(item.image_x)/ Number(dpi)*(length_unit=='mm'?25.4:1)/ item.width / item.scaleX);}}}}
function fn_pd_change_text_outline_color(color,color_name){var obj=cnvs.getActiveObject();if(obj){if(tool_settings.embroidery_text==1){obj.embr_outline_color_value=parseInt(color,16);obj.embr_outline_color=color_name;obj.set('outline','#'+color);}else{obj.stroke_color_value=parseInt(color,16);obj.stroke_color=color_name;obj.set('stroke','#'+color);}
cnvs.renderAll();}
fn_pd_check_colors(color,color_name);if(tool_settings.cp_font!=1){fn_set_palette_active_color($('#text_outline'),color);}}
function fn_pd_show_arc_text_only_object_sizes(){var obj=cnvs.getActiveObject();$('#pd_arc_text_size .cm-obj-width').text(Math.round(fn_px_to_real(obj.width*obj.scaleX))/ 10);$('#pd_arc_text_size .cm-obj-height').text(Math.round(fn_px_to_real(obj.height*obj.scaleY))/ 10);}
function fn_pd_set_color_pattern(url,color,prop){fabric.util.loadImage(url,function(img){var obj=cnvs.getActiveObject();if(obj&&jQuery.inArray(obj.type,_txt_obj_types)!==-1){var ptn=new fabric.Pattern({source:img,repeat:'repeat'});ptn.pattern_fill='#'+color;obj.set(prop?prop:'fill',ptn);}
cnvs.renderAll();});}
function fn_pd_change_selected_font(font_id){$('#text_font').val(font_id).trigger('iconselectmenuchange');$('#fonts_menu a').removeClass('active');$('#font_'+font_id+' a').addClass('active');}
function fn_scroll_to_elm_list(elm,obj){elm_offset=elm.offset().top;if(elm_offset<0){elm_offset=obj.scrollTop()-Math.abs(elm_offset)-obj.offset().top;}else{elm_offset=obj.scrollTop()+Math.abs(elm_offset)-obj.offset().top;}
obj.scrollTop(elm_offset);}
function fn_pd_set_details_price_item(box,obj_name,price){var tmpl=$('<div>'+$('#pd_details_price_template').html()+'</div>');$('span:first',tmpl).html(obj_name);$('span:last',tmpl).html(price);box.append(tmpl);}
function fn_pd_get_quote(evt,obj){var res=fn_pd_add_to_cart(evt);if(res){$(obj).addClass('cm-submit');}else{$(obj).removeClass('cm-submit');}
evt.returnValue=res;return res;}
function fn_pd_set_photo_colors_form(){var obj=cnvs.getActiveObject();if(obj&&obj.type=='image'&&obj.photo_id!=0&&obj.photo_id!=undefined){var phclr_items=$('.cm-photo-color',$('#panel_phcolors')).hide();$('input',phclr_items).val('');if(obj.img_colors&&obj.img_colors.length){$('#ph_colors').val(obj.img_colors.length).iconselectmenu('refresh');for(var i=0;i<obj.img_colors.length;i++){phclr_items.eq(i).show();$('.cm-photo-color-value',phclr_items.eq(i)).css({'background-color':'#'+obj.img_colors[i].color,'color':'#'+obj.img_colors[i].color});$('input',phclr_items.eq(i)).val(obj.img_colors[i].comment);}}else{fn_pd_rearange_phcolors($('#ph_colors').val(1).iconselectmenu('refresh'));}}}
function fn_pd_rearange_phcolors(obj){var phclr_item=$('.cm-photo-color-value:visible',$('#panel_phcolors'));if(phclr_item.length==0){phclr_item=$('.cm-photo-color-value',$('#panel_phcolors')).eq($(obj).val()-1);}else{phclr_item=phclr_item.last();}
$('.cm-photo-color',$('#panel_phcolors')).hide().each(function(ind){if(ind<$(obj).val()){$(this).show();}});fn_pd_update_photo_colors();if(phclr_item.length){fn_pd_check_colors(rgb2hex(phclr_item.css('color')),'');fn_pd_set_photo_colors_form();}
fn_reposition_popup();}
function fn_pd_photo_color(color){$('.cm-photo-color-value',$('#panel_phcolors')).eq($('#phcolors_panel').data('clr_num')-1).css({'background-color':'#'+color,'color':'#'+color});$('#phcolors_panel').hide();fn_pd_update_photo_colors();fn_pd_check_colors(color,'');fn_pd_set_photo_colors_form();}
function fn_pd_open_phcolors_panel(ind){var new_pos=$('a',$('#panel_phcolors')).eq(ind-1).offset();$('#phcolors_panel').css('top',new_pos.top+'px').css('left',new_pos.left+'px').show();$('#phcolors_panel').data('clr_num',ind);}
function fn_pd_update_photo_colors(){var obj=cnvs.getActiveObject();if(obj&&obj.type=='image'&&obj.photo_id!=0&&obj.photo_id!=undefined){var img_colors=[];var max_clrs=$('#ph_colors').val();$('.cm-photo-color',$('#panel_phcolors')).each(function(ind){if(ind<max_clrs){img_colors.push({'color':rgb2hex($('.cm-photo-color-value',this).css('color')),'comment':$('input',this).val()});}});obj.img_colors=img_colors;fn_update_price();}}
function fn_pd_image_check_agreements(is_ok,click_obj){var obj=cnvs.getActiveObject();if(obj){if($('#pd_image_check_agreements').is(':checked')&&is_ok){if(!product_views[cur_view].low_res_ok){product_views[cur_view].low_res_ok=[];}
product_views[cur_view].low_res_ok.push(obj.uid);}else{cnvs.remove(obj);}
if(click_obj){$(click_obj).data('res_checked',true);}}}
function fn_pd_add_names(numbers_text){if(fn_pd_canvas_no_exist('text')){return;}
if(cnvs.names_loading){return;}
cnvs.names_loading=true;var _is_num=typeof(numbers_text)=='string';if(fn_pd_get_names_object(_is_num)){return;}
var font_id=$('#text_font').val();var font_name=fn_get_font_name(font_id);fn_pd_change_font(font_id,function(){var clr_obj=tool_settings.cp_font!=1?$('a.active',$('#text_color')):$('#text_color');var _data={'color_obj':clr_obj,'additional_options':{}};$.ceEvent('trigger','ce.pd_add_text_post',[_data]);var txt_opts={fontFamily:font_name_prefix+font_id,fill:_data.color_obj.length?'#'+_data.color_obj.attr('pd_color_value'):'#000000',color:_data.color_obj.length?_data.color_obj.attr('pd_color'):'',color_value:_data.color_obj.length?parseInt(_data.color_obj.attr('pd_color_value'),16):0,font_id:font_id,font:font_name,is_names_object:_is_num?null:true,is_numbers_object:_is_num?true:null};for(var id in _data.additional_options){txt_opts[id]=_data.additional_options[id];}
var obj=new fabric[_txt_obj_type](_is_num?numbers_text:_lvars.name_text,txt_opts);var bbox=fn_add_object_to_canvas(obj);if(_is_num){}else{obj.set('top',bbox.top);if(_txt_obj_type=='EmbroideryText'&&obj.destinationArea){obj.destinationArea.height=obj.destinationArea.height / 2;}}
if(_data.color_obj.length){fn_pd_check_colors(_data.color_obj.attr('pd_color_value'),_data.color_obj.attr('pd_color'));}else{fn_pd_check_colors('000000','');}
cnvs.names_loading=false;if(cnvs.numbers_input){var _inp=$('input[name="'+cnvs.numbers_input+'"]');_inp.focus();_inp[0].setSelectionRange(_inp.val().length,_inp.val().length);cnvs.numbers_input=null;}});}
function fn_pd_pass_item(obj,add){var tbl=$(obj).parents('table:first'),_src=$('tr:last',tbl);if(add){var _obj=_src.clone().removeClass('hidden');$('input,select',_obj).prop('disabled',false).removeClass('cm-disabled');_obj.insertBefore(_src);}
var items=$('tbody tr:not(.hidden)',$(tbl));if(!add&&items.length>1){$(obj).parents('tr:first').remove();items=$('tbody tr:not(.hidden)',$(tbl));fn_pd_update_names_data();}
for(var id=0;id<items.length;id++){$('input,select',items.eq(id)).each(function(){$(this).attr('name',$(this).attr('name').replace(/\[\d+\]/g,'['+(id+1)+']'));if($(this).is('select')){$(this).attr('id',$(this).attr('id').replace(/_\d+/g,'_'+(id+1)));$(this).iconselectmenu({appendTo:'#pd_tabs'});}});}}
function fn_pd_get_names_object(check_numbers){for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(jQuery.inArray(item.type,_txt_obj_types)!==-1){if(check_numbers){if(item.is_numbers_object){return item;}}else if(item.is_names_object){return item;}}}
return false;}
function fn_pd_update_names_data(evt){var _val=[],_new_text='',_number_text='',_number_inp;$('#pd_names_values tbody tr:not(.hidden)').each(function(ind){var _inp=$('.pd-name',this),_name=_inp.val(),_n_inp=$('.pd-number',this),_number=_n_inp.val();if(ind==0&&evt&&evt.target==_inp.get(0)){_new_text=_name;}
if(_name!=''){var _sobj=$('select',this),_sopt=$('option:selected',_sobj);_val.push({'size':_sopt.text(),'variant':_sobj.val(),'option':_sopt.attr('opt_id'),'name':_name,'number':_number});}
if(_name!=''&&_number!=''){fn_update_price();if(_number_text==''){_number_text=_number;if(_n_inp.is(':focus')){_number_inp=_n_inp.attr('name');}}}});var obj=fn_pd_get_names_object();if(obj){obj.names_data=_val;obj.print_wish=$('input[name=print_wish]:checked').val();if(_new_text!=''){$('#text_panel_area').val(_new_text);obj.set('text',_new_text);cnvs.renderAll();}}
if(_number_text!=''){obj=fn_pd_get_names_object(true);if(obj){obj.set('text',_number_text);cnvs.renderAll();}else{fn_pd_add_names(_number_text);if(_number_inp!=''){cnvs.numbers_input=_number_inp;}}}
var _amounts={},ba_obj=$('input[name^="bulk_amount["]');mviews[cur_view]=cnvs.toJSON();for(var c_name in mviews){if(mviews[c_name].objects.length>0){for(var sign_name in mviews[c_name].objects){var s_obj=mviews[c_name].objects[sign_name];if(jQuery.inArray(s_obj.type,_txt_obj_types)!==-1&&s_obj.is_names_object&&s_obj.names_data.length>0){for(var n in s_obj.names_data){var inp_name=(ba_obj.length?'bulk_amount[':'product_data['+mproduct_id+'][bulk_amount][')+s_obj.names_data[n].option+']['+s_obj.names_data[n].variant+']';if(_amounts[inp_name]){_amounts[inp_name]++;}else{_amounts[inp_name]=1;}}}}}}
if(ba_obj.length){$('input[name^="bulk_amount["]').val('').keyup();}else{$('input[name^="product_data['+mproduct_id+'][bulk_amount]["]').val('').change();}
for(var amount in _amounts){$('input[name="'+amount+'"]').val(_amounts[amount]).trigger('keyup');}}
function fn_pd_convert_to_roman_value(v){var res='',n=Math.floor(v / 1000),i;if(n>0){for(i=0;i<n;i++){res+='M';}}
v=v%1000;if(v>0){if(v>=900){res+='CM';v-=900;}
n=Math.floor(v / 500);if(n>0){for(i=0;i<n;i++){res+='D';}}
v=v%500;if(v>0){n=Math.floor(v / 100);if(n>0){if(n==4){res+='CD';}else{for(i=0;i<n;i++){res+='C';}}}
v=v%100;if(v>0){if(v>=90){res+='XC';v-=90;}
n=Math.floor(v / 50);if(n>0){for(i=0;i<n;i++){res+='L';}}
v=v%50;if(v>0){n=Math.floor(v / 10);if(n>0){if(n==4){res+='XL';}else{for(i=0;i<n;i++){res+='X';}}}
v=v%10;if(v>0){if(v==9){res+='IX';}else{n=Math.floor(v / 5);if(n>0){for(i=0;i<n;i++){res+='V';}}
v=v%5;if(v>0){if(v==4){res+='IV';}else{for(i=0;i<v;i++){res+='I';}}}}}}}}}
return res;}
function fn_refresh_contour_evented(evt,clbk){if(masks[cur_view]&&masks[cur_view][0].dilate){for(var id in cnvs.getObjects()){if(cnvs.item(id).type!='rect'){fn_refresh_contour(masks[cur_view][0].dilate,clbk);break;}}}}
function fn_refresh_contour(dilate,clbk){contour_canvas.clear();var objs=cnvs.getObjects(),cnt=objs.length,bb=fn_get_objects_bounding_box(cnvs);contour_canvas.setWidth(Math.ceil(bb.width));contour_canvas.setHeight(Math.ceil(bb.height));for(var i=0;i<objs.length;i++){objs[i].clone(function(cloned){cloned.left-=bb.left;cloned.top-=bb.top;contour_canvas.add(cloned);cnt--;if(cnt==0){$.toggleStatusBox('show');var cloned=contour_canvas.getObjects();for(var j=0;j<objs.length;j++){for(var k=0;k<cloned.length;k++){if(objs[j].uid==cloned[k].uid){var ind=objs.indexOf(objs[j]);contour_canvas.moveTo(cloned[k],ind);}}}
contour_canvas.discardActiveObject();var v=fn_get_sticker_view_data(),mult=Math.min(v.w / bb.width,v.h / bb.height);$.ceAjax('request',fn_url('product_designer.get_contour'),{method:'post',data:{img:contour_canvas.toDataURL({format:'png',multiplier:mult}),dilate:dilate},callback:function(result){if(result.contour){if(product_views[cur_view].canvas.shapes.length>0){var safe_field=50,w=Number(result.width),h=Number(result.height),x=safe_field+Number(result.left),y=-bb.height*mult-safe_field+Number(result.top);fn_switch_contour(bb,v.w,v.h,w,h,x,y,mult,'shape',result.contour);masks[cur_view][0].dilate=dilate;if(clbk){clbk();}}}
$.toggleStatusBox('hide');}});}});}}
function fn_get_sticker_view_data(){var margin=[10,10,10,10],w=view_width-margin[1]-margin[3],h=view_height-margin[0]-margin[2];return{w:w,h:h};}
function fn_switch_contour(bb,vw,vh,w,h,x,y,mult,type,contour){var s=1;if(w>=vw||h>=vh){s=Math.min(vw / w,vh / h);}
var sh=masks[cur_view][0];sh.scaleX=sh.scaleY=1;sh.width=w*s;sh.height=h*s;if(type=='shape'){sh.shape_string=contour;sh.shape=contour;}else{delete sh.shape_string;delete sh.shape;if(type=='q'){sh.rx=sh.ry=0;}else if(type=='r'){sh.rx=sh.ry=Math.min(vw,vh)*0.1;}else if(type=='c'){sh.rx=vw;sh.ry=vh;}}
masks[cur_view]=[sh];for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.type=='rect'){cnvs.remove(item);break;}}
fn_add_mask_controls(sh);var new_scale=fn_pd_sticker_size_changer(),_s=mult*s*Math.min(new_scale[0],new_scale[1]),_u=10000;for(var id in cnvs.getObjects()){var item=cnvs.item(id);if(item.type!='rect'){item.set('left',sh.left+(item.left-bb.left)*_s+x*s);item.set('top',sh.top+(item.top-bb.top)*_s+y*s);item.set('scaleX',item.scaleX*_s);item.set('scaleY',item.scaleY*_s);item.setCoords();if(tool_settings.enable_checking_resolution==1&&item.type=='image'&&item.photo_id){_u=Math.min(_u,Number(item.image_x)/ Number(tool_settings.max_photo_dpi)*(length_unit=='mm'?25.4:1)/ item.width / item.scaleX);}}}
if(_u<unit_per_px){sh.real_width=fn_pd_round(sh.real_width*_u / unit_per_px,10);sh.real_height=fn_pd_round(sh.real_height*_u / unit_per_px,10);unit_per_px=_u;fn_apply_clip_area(masks[cur_view],false);fn_update_price();}
$('#sticker_width').val(sh.real_width);$('#sticker_height').val(sh.real_height);cnvs.renderAll();}
function fn_get_objects_bounding_box(canvas){var bb={left:5000,top:5000,width:0,height:0};canvas.forEachObject(function(obj){if(obj.type!='rect'){var _bb=obj.getBoundingRect(true,true);bb.left=Math.min(bb.left,_bb.left);bb.top=Math.min(bb.top,_bb.top);}});canvas.forEachObject(function(obj){if(obj.type!='rect'){var _bb=obj.getBoundingRect(true,true);bb.width=Math.max(bb.width,_bb.left+_bb.width-bb.left);bb.height=Math.max(bb.height,_bb.top+_bb.height-bb.top);}});return bb;}
function fn_pd_set_sticker_size_labels(mask_data){var sh=mask_data[0];if(sh){var ctx=cnvs.bordersCanvas.getContext('2d');fn_pd_draw_sticker_size_label(ctx,sh,true);fn_pd_draw_sticker_size_label(ctx,sh,false);}}
function fn_pd_draw_sticker_size_label(ctx,sh,hor){var sx=$('#main_canvas').prop('width')/ cnvs.width,sy=$('#main_canvas').prop('height')/ cnvs.height;ctx.save();if(hor){ctx.translate((sh.left+sh.width*sh.scaleX / 2)*sx,(sh.top-2)*sy);var txt=(typeof(sh.real_width)!=='undefined'?sh.real_width:fn_pd_round(unit_per_px*sh.width*sh.scaleX,10))+' '+_lvars[length_unit];}else{ctx.translate((sh.left+sh.width*sh.scaleX+2)*sx,(sh.top+sh.height*sh.scaleY / 2)*sy);ctx.rotate(Math.PI/2);var txt=(typeof(sh.real_height)!=='undefined'?sh.real_height:fn_pd_round(unit_per_px*sh.height*sh.scaleY,10))+' '+_lvars[length_unit];}
ctx.font=(11*sx)+'px Arial';ctx.strokeStyle='Black';ctx.lineWidth=0.5*sx;ctx.textAlign='center';ctx.fillText(txt,0,0);ctx.restore();}
function fn_add_mask_controls(mask_data){var rect=new fabric.Rect(fn_pd_copy_mask_data(mask_data,0));delete rect.real_width;delete rect.real_height;rect.fill=null;rect.stroke=null;rect.on('selected',function(e){var selection=cnvs.getActiveObject();if(selection.type==='activeSelection'){selection.removeWithUpdate(this);}});cnvs.add(rect);cnvs.renderAll();}
function fn_set_active_layer_preview(obj){if(obj.type=='rect'){if($('#sticker_layers .active.all').length){return;}}
$('#sticker_layers div').removeClass('active');$('#layer_'+obj.uid).addClass('active');}
fabric.Object.prototype.toObject=(function(toObject){return function(){return fabric.util.object.extend(toObject.call(this),{is_names_object:this.is_names_object||null,names_data:this.names_data||[],print_wish:this.print_wish||'height',is_numbers_object:this.is_numbers_object||null,adding_order:this.adding_order||null,roman_value:this.roman_value||[],stroke_color_value:this.stroke_color_value||'',stroke_color:this.stroke_color||'',is_embroidery_request:this.is_embroidery_request||false,embroidery_photo_file:this.embroidery_photo_file||null});};})(fabric.Object.prototype.toObject);fabric.Pattern.prototype.toObject=(function(toObject){return function(){return fabric.util.object.extend(toObject.call(this),{pattern_fill:this.pattern_fill||null});};})(fabric.Pattern.prototype.toObject);fabric.Object.prototype._createCacheCanvas=function(){this._cacheProperties={};this._cacheCanvas=fabric.util.createCanvasElement();this._cacheContext=this._cacheCanvas.getContext('2d',{willReadFrequently:true});this._updateCacheCanvas();this.dirty=true;};fabric.StaticCanvas.prototype._createLowerCanvas=function(canvasEl){if(canvasEl&&canvasEl.getContext){this.lowerCanvasEl=canvasEl;}
else{this.lowerCanvasEl=fabric.util.getById(canvasEl)||this._createCanvasElement();}
fabric.util.addClass(this.lowerCanvasEl,'lower-canvas');this._originalCanvasStyle=this.lowerCanvasEl.style;if(this.interactive){this._applyCanvasStyle(this.lowerCanvasEl);}
this.contextContainer=this.lowerCanvasEl.getContext('2d',{willReadFrequently:true});};(function(_,$){$.ceEvent('on','ce.commoninit',function(context){var color_boxes=context.find('.color-block-border');if(color_boxes.length){color_boxes.on('mouseover',function(){var offset=$(this).position();$('.preview-img',this).css('left',offset.left);$('.preview-img',this).css('top',offset.top);});}});}(Tygh,Tygh.$));(function($){var days=24*60*60,hours=60*60,minutes=60;$.fn.countdown=function(prop){var options=$.extend({callback:function(){},timestamp:0,lang_days:'days',lang_hours:'hours',lang_minutes:'minutes',lang_seconds:'seconds'},prop);var left,d,h,m,s,positions;init(this,options);positions=this.find('.position');(function tick(){left=Math.floor((options.timestamp-(new Date()))/ 1000);if(left<0){left=0;}
d=Math.floor(left / days);updateDuo(0,1,d);left-=d*days;h=Math.floor(left / hours);updateDuo(2,3,h);left-=h*hours;m=Math.floor(left / minutes);updateDuo(4,5,m);left-=m*minutes;s=left;updateDuo(6,7,s);options.callback(d,h,m,s);setTimeout(tick,1000);})();function updateDuo(minor,major,value){var val=Math.floor(value / 10)%10;if(minor==0&&val==0)positions.eq(minor).hide();switchDigit(positions.eq(minor),val);switchDigit(positions.eq(major),value%10);}
return this;};function init(elem,options){elem.addClass('countdownHolder');$.each(['Days','Hours','Minutes','Seconds'],function(i){var description;switch(this.toString()){case'Days':description=options.lang_days;break;case'Hours':description=':';break;case'Minutes':description=':';break;case'Seconds':description='';break;}
var html_append=''+'<div class="position">'+'<div class="digit static">0</div>'+'</div>'+'<div class="position">'+'<div class="digit static">0</div>'+'</div>'+'<div class="count-description">'+description+'</div>';$('<div class="count'+this+'">').html(html_append).appendTo(elem);});}
function switchDigit(position,number){var digit=position.find('.digit');if(digit.is(':animated')){return false;}
if(position.data('digit')==number){return false;}
position.data('digit',number);var replacement=$('<div>',{'class':'digit',css:{top:'-2.1em',opacity:0},html:number});digit.before(replacement).removeClass('static').animate({top:'2.5em',opacity:0},'fast',function(){digit.remove();});replacement.delay(100).animate({top:0,opacity:1},'fast',function(){replacement.addClass('static');});}})(jQuery);(function(_,$){'use strict';var ui=(function(){return{responsiveDeals:function(){var w=$(window).width();if(w<=767){$('.week-deal-box').each(function(){var grid=$(this).parents('.grid-list:first');if(!grid.hasClass('week-deal-grid')){if(!grid.next().hasClass('week-deal-grid')){grid.after('<div class="week-deal-grid grid-list"></div>');}
grid.next().prepend($(this).parents('.ty-column4:first'));}});}else{$('.week-deal-box').each(function(){var grid=$(this).parents('.week-deal-grid:first');if(grid.length){grid.prev().prepend($(this).parents('.ty-column4:first'));}});}
$('.week-deal-box').each(function(){$(w>575&&w<=767?'.ty-grid-list__item':'form',$(this).parents('.ty-column4:first')).prepend($(this));});}};})();$(document).ready(function(){$(window).resize(function(e){ui.responsiveDeals();});ui.responsiveDeals();});}(Tygh,Tygh.$));(function(_,$){'use strict';var ui=(function(){return{responsiveFilters:function(){if($(window).width()<=767){var fh=$('.ty-product-filters__wrapper').parent();$('#dropdown_mobile_filters div:first').addClass('cm-product-filters').attr('data-ca-target-id',fh.attr('data-ca-target-id')).attr('data-ca-base-url',fh.attr('data-ca-base-url')).append($('.ty-product-filters__wrapper'));$('.mobile-filters').show();}else{$('.product-filters .cm-product-filters').append($('.ty-product-filters__wrapper'));$('.mobile-filters').hide();}}};})();$(document).ready(function(){if($('.ty-product-filters__wrapper').length){$(window).resize(function(e){ui.responsiveFilters();});ui.responsiveFilters();$.ceEvent('on','ce.ajaxdone',function(elms,inline_scripts,params,data,text){for(var i=0;i<elms.length;i++){if(elms[i].hasClass('cm-product-filters')){ui.responsiveFilters();break;}}});}});$.ceEvent('on','ce.commoninit',function(context){var slider=context.find('.phones-slider');if(slider.length){var items=$('span',slider),paused=false,i=1;slider.on('mouseover',function(){paused=true;}).on('mouseout',function(){paused=false;});setInterval(function(){if(!paused){items.removeClass('vis').addClass('transp');items.eq(i).removeClass('transp').addClass('vis');i++;if(i>=items.length){i=0;}}},6400);}
$(_.doc).on('click','.cm-pr-click',function(e){var id=$(this).data('caUrlId');if(id&&$('#'+id).length){$(this).removeClass('cm-pr-click');$('#'+id).click();}});});}(Tygh,Tygh.$));(function($){'use strict';$.fn.sliderMenu=function(options){var settings=$.extend({back:''},options),elements={},methods={};methods.initMenu=function(element){var $menu=this.buildMenu(element.clone());element.replaceWith($menu);$($menu).on('click','a',function(event){elements.$container=$(this).closest('.slider-menu');elements.$parentItem=$(this).parent('li');elements.$parentMenu=elements.$parentItem.parent('ul');elements.$childMenu=$('> ul',elements.$parentItem);methods.clickHandler(event,$(this));});if($(window).width()>767&&$menu.is(':visible')){var active_item=$('.ty-menu__item-active',$menu);if(active_item.length&&active_item.last().hasClass('slider-menu-children')){for(var i=0;i<active_item.length;i++){$(active_item[i]).children('a').addClass('no-scroll').click();}}}};methods.buildMenu=function($menu){var $newMenu=$('<div>').addClass('slider-menu'),$nav=$('<nav>').attr({'role':'navigation','aria-label':'Menu','data-left':0});$('ul',$menu).prepend('<li><a class="slider-menu-back">'+settings.back+'</a>').parent().addClass('slider-menu-children');$nav.html($menu);$newMenu.html($nav);return $newMenu;};methods.clickHandler=function(event,$link){if(elements.$childMenu.length||$link.hasClass('slider-menu-back')){if(!$link.attr('href')){methods.slideController($link);}}};methods.slideController=function($link){elements.$parentMenu.removeClass('slider-menu-active');if($link.hasClass('slider-menu-back')){methods.slide($link,true);}else{methods.slide($link);}};methods.slide=function($link,back){var $nav=$('nav',elements.$container),$activeMenu=back?elements.$parentMenu.parent().parent():$('> ul',elements.$parentItem),currentLeft=back?parseInt($nav.attr('data-left'),10)+100:parseInt($nav.attr('data-left'),10)-100;$activeMenu.addClass('slider-menu-active').parents('ul').addClass('slider-menu-active');if(elements.$container.parents('.body-main-menu').length||elements.$container.parents('.top-main-menu').length){elements.$container.parent().css('width',$activeMenu.hasClass('parts-2')?'200%':($activeMenu.hasClass('parts-3')?'300%':($activeMenu.hasClass('parts-4')?'400%':'100%')));}
elements.$container.css('height',$activeMenu.outerHeight());setTimeout(function(){elements.$container.css('height',$activeMenu.outerHeight());},40);$nav.attr('data-left',currentLeft).css('left',currentLeft+'%');if($link.hasClass('no-scroll')){$link.removeClass('no-scroll')}else{$.scrollToElm($activeMenu);}};return $(this).each(function(){methods.initMenu($(this));});};}(jQuery));