PageSourceSearch

https://fire-soul.ru/wp-content/themes/ogonek-rest/leclick/reservation/js/all.in.one.js

js fire-soul.ru collected 2026-10-04 02:21:36 UTC 266,737 bytes, 1 lines download raw bytes

1!function(t){"function"==typeof define&&define.amd?define("picker",["jquery"],t):"object"==typeof exports?module.exports=t(require("jquery")):this.Picker=t(jQuery)}(function(t){function e(o,s,l,u){function h(){return e._.node("div",e._.node("div",e._.node("div",e._.node("div",_.component.nodes(b.open),x.box),x.wrap),x.frame),x.holder)}function f(){k.data(s,_).addClass(x.input).val(k.data("value")?_.get("select",y.format):o.value).on("focus."+b.id+" click."+b.id,v),y.editable||k.on("keydown."+b.id,function(t){var e=t.keyCode,i=/^(8|46)$/.test(e);if(27==e)return _.close(),!1;(32==e||i||!b.open&&_.component.key[e])&&(t.preventDefault(),t.stopPropagation(),i?_.clear().close():_.open())}),r(o,{haspopup:!0,expanded:!1,readonly:!1,owns:o.id+"_root"+(_._hidden?" "+_._hidden.id:"")})}function d(){_.$root.on({focusin:function(t){_.$root.removeClass(x.focused),t.stopPropagation()},"mousedown click":function(e){var i=e.target;i!=_.$root.children()[0]&&(e.stopPropagation(),"mousedown"!=e.type||t(i).is(":input")||"OPTION"==i.nodeName||(e.preventDefault(),o.focus()))}}),r(_.$root[0],"hidden",!0)}function p(){_.$root.find("[data-pick], [data-nav], [data-clear]").on("click",function(){var i=t(this),n=i.data(),r=i.hasClass(x.navDisabled)||i.hasClass(x.disabled),s=document.activeElement;s=s&&(s.type||s.href)&&s,(r||s&&!t.contains(_.$root[0],s))&&o.focus(),void 0!==n.nav&&(n.nav=parseInt(n.nav)),void 0!==n.pick&&(n.pick=parseInt(n.pick)),n.nav&&!r?(_.set("highlight",_.component.item.highlight,{nav:n.nav}),p()):e._.isInteger(n.pick)&&!r?_.set("select",n.pick).close(!0):n.clear&&_.clear().close(!0)}),_.$root.find("[data-close]").on("click",function(){_.close(!0)})}function g(){var e;!0===y.hiddenName?(e=o.name,o.name=""):e=(e=["string"==typeof y.hiddenPrefix?y.hiddenPrefix:"","string"==typeof y.hiddenSuffix?y.hiddenSuffix:"_submit"])[0]+o.name+e[1],_._hidden=t('<input type=hidden name="'+e+'"'+(o.id?'id="'+o.id+'_hidden"':"")+(k.data("value")||o.value?' value="'+_.get("select",y.formatSubmit)+'"':"")+">")[0],k.on("change."+b.id,function(){_._hidden.value=o.value?_.get("select",y.formatSubmit):""}).after(_._hidden)}function v(t){t.stopPropagation(),"focus"==t.type&&_.$root.addClass(x.focused),_.open()}if(!o)return e;var m=!1,b={id:o.id||"P"+Math.abs(~~(Math.random()*new Date))},y=l?t.extend(!0,{},l.defaults,u):u||{},x=t.extend({},e.klasses(),y.klass),k=t(o),w=function(){return this.start()},_=w.prototype={constructor:w,$node:k,start:function(){return b&&b.start?_:(b.methods={},b.start=!0,b.open=!1,b.type=o.type,o.autofocus=o==document.activeElement,o.readOnly=!y.editable,o.id=o.id||b.id,"text"!=o.type&&(o.type="text"),_.component=new l(_,y),_.$root=t(e._.node("div",h(),x.picker,'id="'+o.id+'_root"')),d(),y.formatSubmit&&g(),f(),y.container?t(y.container).append(_.$root):k.after(_.$root),_.on({start:_.component.onStart,render:_.component.onRender,stop:_.component.onStop,open:_.component.onOpen,close:_.component.onClose,set:_.component.onSet}).on({start:y.onStart,render:y.onRender,stop:y.onStop,open:y.onOpen,close:y.onClose,set:y.onSet}),m=i(_.$root.children()[0]),o.autofocus&&_.open(),_.trigger("start").trigger("render"))},render:function(t){return t?_.$root.html(h()):_.$root.find("."+x.box).html(_.component.nodes(b.open)),_.trigger("render")},stop:function(){return b.start?(_.close(),_._hidden&&_._hidden.parentNode.removeChild(_._hidden),_.$root.remove(),k.removeClass(x.input).removeData(s),setTimeout(function(){k.off("."+b.id)},0),o.type=b.type,o.readOnly=!1,_.trigger("stop"),b.methods={},b.start=!1,_):_},open:function(i){return b.open?_:(k.addClass(x.active),r(o,"expanded",!0),setTimeout(function(){_.$root.addClass(x.opened),r(_.$root[0],"hidden",!1)},0),!1!==i&&(b.open=!0,m&&c.css("overflow","hidden").css("padding-right","+="+n()),k.trigger("focus"),a.on("click."+b.id+" focusin."+b.id,function(t){var e=t.target;e!=o&&e!=document&&3!=t.which&&_.close(e===_.$root.children()[0])}).on("keydown."+b.id,function(i){var n=i.keyCode,r=_.component.key[n],s=i.target;27==n?_.close(!0):s!=o||!r&&13!=n?t.contains(_.$root[0],s)&&13==n&&(i.preventDefault(),s.click()):(i.preventDefault(),r?e._.trigger(_.component.key.go,_,[e._.trigger(r)]):_.$root.find("."+x.highlighted).hasClass(x.disabled)||_.set("select",_.component.item.highlight).close())})),p(),_.trigger("open"))},close:function(t){return t&&(k.off("focus."+b.id).trigger("focus"),setTimeout(function(){k.on("focus."+b.id,v)},0)),k.removeClass(x.active),r(o,"expanded",!1),setTimeout(function(){_.$root.removeClass(x.opened+" "+x.focused),r(_.$root[0],"hidden",!0)},0),b.open?(b.open=!1,m&&c.css("overflow","").css("padding-right","-="+n()),a.off("."+b.id),_.trigger("close")):_},clear:function(t){return _.set("clear",null,t)},set:function(e,i,n){var r,o,s=t.isPlainObject(e),a=s?e:{};if(n=s&&t.isPlainObject(i)?i:n||{},e){s||(a[e]=i);for(r in a)o=a[r],r in _.component.item&&(void 0===o&&(o=null),_.component.set(r,o,n)),"select"!=r&&"clear"!=r||k.val("clear"==r?"":_.get(r,y.format)).trigger("change");_.render()}return n.muted?_:_.trigger("set",a)},get:function(t,i){if(t=t||"value",null!=b[t])return b[t];if("value"==t)return o.value;if(t in _.component.item){if("string"==typeof i){var n=_.component.get(t);return n?e._.trigger(_.component.formats.toString,_.component,[i,n]):""}return _.component.get(t)}},on:function(e,i,n){var r,o,s=t.isPlainObject(e),a=s?e:{};
1if(e){s||(a[e]=i);for(r in a)o=a[r],n&&(r="_"+r),b.methods[r]=b.methods[r]||[],b.methods[r].push(o)}return _},off:function(){var t,e,i=arguments;for(t=0,namesCount=i.length;t<namesCount;t+=1)(e=i[t])in b.methods&&delete b.methods[e];return _},trigger:function(t,i){var n=function(t){var n=b.methods[t];n&&n.map(function(t){e._.trigger(t,_,[i])})};return n("_"+t),n(t),_}};return new w}function i(t){var e;return t.currentStyle?e=t.currentStyle.position:window.getComputedStyle&&(e=getComputedStyle(t).position),"fixed"==e}function n(){if(c.height()<=s.height())return 0;var e=t('<div style="visibility:hidden;width:100px" />').appendTo("body"),i=e[0].offsetWidth;e.css("overflow","scroll");var n=t('<div style="width:100%" />').appendTo(e)[0].offsetWidth;return e.remove(),i-n}function r(e,i,n){if(t.isPlainObject(i))for(var r in i)o(e,r,i[r]);else o(e,i,n)}function o(t,e,i){t.setAttribute(("role"==e?"":"aria-")+e,i)}var s=t(window),a=t(document),c=t(document.documentElement);return e.klasses=function(t){return t=t||"picker",{picker:t,opened:t+"--opened",focused:t+"--focused",input:t+"__input",active:t+"__input--active",holder:t+"__holder",frame:t+"__frame",wrap:t+"__wrap",box:t+"__box"}},e._={group:function(t){for(var i,n="",r=e._.trigger(t.min,t);r<=e._.trigger(t.max,t,[r]);r+=t.i)i=e._.trigger(t.item,t,[r]),n+=e._.node(t.node,i[0],i[1],i[2]);return n},node:function(e,i,n,r){return i?(i=t.isArray(i)?i.join(""):i,n=n?' class="'+n+'"':"",r=r?" "+r:"","<"+e+n+r+">"+i+"</"+e+">"):""},lead:function(t){return(t<10?"0":"")+t},trigger:function(t,e,i){return"function"==typeof t?t.apply(e,i||[]):t},digits:function(t){return/\d/.test(t[1])?2:1},isDate:function(t){return{}.toString.call(t).indexOf("Date")>-1&&this.isInteger(t.getDate())},isInteger:function(t){return{}.toString.call(t).indexOf("Number")>-1&&t%1==0},ariaAttr:function(e,i){t.isPlainObject(e)||(e={attribute:i}),i="";for(var n in e){var r=("role"==n?"":"aria-")+n;i+=null==e[n]?"":r+'="'+e[n]+'"'}return i}},e.extend=function(i,n){t.fn[i]=function(r,o){var s=this.data(i);return"picker"==r?s:s&&"string"==typeof r?e._.trigger(s[r],s,[o]):this.each(function(){t(this).data(i)||new e(this,i,n,r)})},t.fn[i].defaults=n.defaults},e}),function(t){"function"==typeof define&&define.amd?define(["picker","jquery"],t):"object"==typeof exports?module.exports=t(require("./picker.js"),require("jquery")):t(Picker,jQuery)}(function(t,e){function i(t,e){var i=this,n=t.$node[0],r=n.value,o=t.$node.data("value"),s=o||r,a=o?e.formatSubmit:e.format,c=function(){return n.currentStyle?"rtl"==n.currentStyle.direction:"rtl"==getComputedStyle(t.$root[0]).direction};i.settings=e,i.$node=t.$node,i.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse navigate create validate",view:"parse create validate viewset",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.disable=(e.disable||[]).slice(0),i.item.enable=-function(t){return!0===t[0]?t.shift():-1}(i.item.disable),i.set("min",e.min).set("max",e.max).set("now"),s?i.set("select",s,{format:a}):i.set("select",null).set("highlight",i.item.now),i.key={40:7,38:-7,39:function(){return c()?-1:1},37:function(){return c()?1:-1},go:function(t){var e=i.item.highlight,n=new Date(e.year,e.month,e.date+t);i.set("highlight",[n.getFullYear(),n.getMonth(),n.getDate()],{interval:t}),this.render()}},t.on("render",function(){t.$root.find("."+e.klass.selectMonth).on("change",function(){var i=this.value;i&&(t.set("highlight",[t.get("view").year,i,t.get("highlight").date]),t.$root.find("."+e.klass.selectMonth).trigger("focus"))}),t.$root.find("."+e.klass.selectYear).on("change",function(){var i=this.value;i&&(t.set("highlight",[i,t.get("view").month,t.get("highlight").date]),t.$root.find("."+e.klass.selectYear).trigger("focus"))})},1).on("open",function(){var n="";i.disabled(i.get("now"))&&(n=":not(."+e.klass.buttonToday+")"),t.$root.find("button"+n+", select").attr("disabled",!1)},1).on("close",function(){t.$root.find("button, select").attr("disabled",!0)},1)}var n=t._;i.prototype.set=function(t,e,i){var n=this,r=n.item;return null===e?("clear"==t&&(t="select"),r[t]=e,n):(r["enable"==t?"disable":"flip"==t?"enable":t]=n.queue[t].split(" ").map(function(r){return e=n[r](t,e,
1i)}).pop(),"select"==t?n.set("highlight",r.select,i):"highlight"==t?n.set("view",r.highlight,i):t.match(/^(flip|min|max|disable|enable)$/)&&(r.select&&n.disabled(r.select)&&n.set("select",r.select,i),r.highlight&&n.disabled(r.highlight)&&n.set("highlight",r.highlight,i)),n)},i.prototype.get=function(t){return this.item[t]},i.prototype.create=function(t,i,r){var o,s=this;return(i=void 0===i?t:i)==-1/0||i==1/0?o=i:e.isPlainObject(i)&&n.isInteger(i.pick)?i=i.obj:e.isArray(i)?(i=new Date(i[0],i[1],i[2]),i=n.isDate(i)?i:s.create().obj):i=n.isInteger(i)||n.isDate(i)?s.normalize(new Date(i),r):s.now(t,i,r),{year:o||i.getFullYear(),month:o||i.getMonth(),date:o||i.getDate(),day:o||i.getDay(),obj:o||i,pick:o||i.getTime()}},i.prototype.createRange=function(t,i){var r=this,o=function(t){return!0===t||e.isArray(t)||n.isDate(t)?r.create(t):t};return n.isInteger(t)||(t=o(t)),n.isInteger(i)||(i=o(i)),n.isInteger(t)&&e.isPlainObject(i)?t=[i.year,i.month,i.date+t]:n.isInteger(i)&&e.isPlainObject(t)&&(i=[t.year,t.month,t.date+i]),{from:o(t),to:o(i)}},i.prototype.withinRange=function(t,e){return t=this.createRange(t.from,t.to),e.pick>=t.from.pick&&e.pick<=t.to.pick},i.prototype.overlapRanges=function(t,e){var i=this;return t=i.createRange(t.from,t.to),e=i.createRange(e.from,e.to),i.withinRange(t,e.from)||i.withinRange(t,e.to)||i.withinRange(e,t.from)||i.withinRange(e,t.to)},i.prototype.now=function(t,e,i){return e=new Date,i&&i.rel&&e.setDate(e.getDate()+i.rel),this.normalize(e,i)},i.prototype.navigate=function(t,i,n){var r,o,s,a,c=e.isArray(i),l=e.isPlainObject(i),u=this.item.view;if(c||l){for(l?(o=i.year,s=i.month,a=i.date):(o=+i[0],s=+i[1],a=+i[2]),n&&n.nav&&u&&u.month!==s&&(o=u.year,s=u.month),o=(r=new Date(o,s+(n&&n.nav?n.nav:0),1)).getFullYear(),s=r.getMonth();new Date(o,s,a).getMonth()!==s;)a-=1;i=[o,s,a]}return i},i.prototype.normalize=function(t){return t.setHours(0,0,0,0),t},i.prototype.measure=function(t,e){var i=this;return e?"string"==typeof e?e=i.parse(t,e):n.isInteger(e)&&(e=i.now(t,e,{rel:e})):e="min"==t?-1/0:1/0,e},i.prototype.viewset=function(t,e){return this.create([e.year,e.month,1])},i.prototype.validate=function(t,i,r){var o,s,a,c,l=this,u=i,h=r&&r.interval?r.interval:1,f=-1===l.item.enable,d=l.item.min,p=l.item.max,g=f&&l.item.disable.filter(function(t){if(e.isArray(t)){var r=l.create(t).pick;r<i.pick?o=!0:r>i.pick&&(s=!0)}return n.isInteger(t)}).length;if((!r||!r.nav)&&(!f&&l.disabled(i)||f&&l.disabled(i)&&(g||o||s)||!f&&(i.pick<=d.pick||i.pick>=p.pick)))for(f&&!g&&(!s&&h>0||!o&&h<0)&&(h*=-1);l.disabled(i)&&(Math.abs(h)>1&&(i.month<u.month||i.month>u.month)&&(i=u,h=h>0?1:-1),i.pick<=d.pick?(a=!0,h=1,i=l.create([d.year,d.month,d.date+(i.pick===d.pick?0:-1)])):i.pick>=p.pick&&(c=!0,h=-1,i=l.create([p.year,p.month,p.date+(i.pick===p.pick?0:1)])),!a||!c);)i=l.create([i.year,i.month,i.date+h]);return i},i.prototype.disabled=function(t){var i=this,r=i.item.disable.filter(function(r){return n.isInteger(r)?t.day===(i.settings.firstDay?r:r-1)%7:e.isArray(r)||n.isDate(r)?t.pick===i.create(r).pick:e.isPlainObject(r)?i.withinRange(r,t):void 0});return r=r.length&&!r.filter(function(t){return e.isArray(t)&&"inverted"==t[3]||e.isPlainObject(t)&&t.inverted}).length,-1===i.item.enable?!r:r||t.pick<i.item.min.pick||t.pick>i.item.max.pick},i.prototype.parse=function(t,e,i){var r=this,o={};return e&&"string"==typeof e?(i&&i.format||((i=i||{}).format=r.settings.format),r.formats.toArray(i.format).map(function(t){var i=r.formats[t],s=i?n.trigger(i,r,[e,o]):t.replace(/^!/,"").length;i&&(o[t]=e.substr(0,s)),e=e.substr(s)}),[o.yyyy||o.yy,+(o.mm||o.m)-1,o.dd||o.d]):e},i.prototype.formats=function(){function t(t,e,i){var n=t.match(/\w+/)[0];return i.mm||i.m||(i.m=e.indexOf(n)+1),n.length}function e(t){return t.match(/\w+/)[0].length}return{d:function(t,e){return t?n.digits(t):e.date},dd:function(t,e){return t?2:n.lead(e.date)},ddd:function(t,i){return t?e(t):this.settings.weekdaysShort[i.day]},dddd:function(t,i){return t?e(t):this.settings.weekdaysFull[i.day]},m:function(t,e){return t?n.digits(t):e.month+1},mm:function(t,e){return t?2:n.lead(e.month+1)},mmm:function(e,i){var n=this.settings.monthsShort;return e?t(e,n,i):n[i.month]},mmmm:function(e,i){var n=this.settings.monthsFull;return e?t(e,n,i):n[i.month]},yy:function(t,e){return t?2:(""+e.year).slice(2)},yyyy:function(t,e){return t?4:e.year},toArray:function(t){return t.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(t,e){var i=this;return i.formats.toArray(t).map(function(t){return n.trigger(i.formats[t],i,[0,e])||t.replace(/^!/,"")}).join("")}}}(),i.prototype.isDateExact=function(t,i){var r=this;return n.isInteger(t)&&n.isInteger(i)||"boolean"==typeof t&&"boolean"==typeof i?t===i:(n.isDate(t)||e.isArray(t))&&(n.isDate(i)||e.isArray(i))?r.create(t).pick===r.create(i).pick:!(!e.isPlainObject(t)||!e.isPlainObject(i))&&(r.isDateExact(t.from,i.from)&&r.isDateExact(t.to,i.to))},i.prototype.isDateOverlap=function(t,i){var r=this,o=r.settings.firstDay?1:0;return n.isInteger(t)&&(n.isDate(i)||e.isArray(i))?(t=t%7+o)===r.create(i).day+1:n.isInteger(i)&&(n.isDate(t)||e.isArray(t))?(i=i%7+o)===r.create(t).day+1:!(!e.isPlainObject(t)||!e.isPlainObject(i))&&r.overlapRanges(t,i)},i.prototype.flipEnable=function(t){var e=this.item;e.enable=t||(-1==e.enable?1:-1)},i.prototype.deactivate=function(t,i){var r=this,o=r.item.disable.slice(0);return"flip"==i?r.flipEnable():!1===i?(r.flipEnable(1),o=[]):!0===i?(r.flipEnable(-1),o=[]):i.map(function(t){for(var i,s=0;s<o.length;s+=1)if(r.isDateExact(t,o[s])){i=!0;break}i||(n.isInteger(t)||n.isDate(t)||e.isArray(t)||e.isPlainObject(t)&&t.from&&t.to)&&o.push(t)}),o},i.prototype.activate=function(t,i){var r=this,o=r.item.disable,s=o.length;return"flip"==i?r.flipEnable():!0===i?(r.flipEnable(1),o=[]):!1===i?(r.flipEnable(-1),o=[]):i.map(function(t){var i,a,c,l;
1for(c=0;c<s;c+=1){if(a=o[c],r.isDateExact(a,t)){i=o[c]=null,l=!0;break}if(r.isDateOverlap(a,t)){e.isPlainObject(t)?(t.inverted=!0,i=t):e.isArray(t)?(i=t)[3]||i.push("inverted"):n.isDate(t)&&(i=[t.getFullYear(),t.getMonth(),t.getDate(),"inverted"]);break}}if(i)for(c=0;c<s;c+=1)if(r.isDateExact(o[c],t)){o[c]=null;break}if(l)for(c=0;c<s;c+=1)if(r.isDateOverlap(o[c],t)){o[c]=null;break}i&&o.push(i)}),o.filter(function(t){return null!=t})},i.prototype.nodes=function(t){var e=this,i=e.settings,r=e.item,o=r.now,s=r.select,a=r.highlight,c=r.view,l=r.disable,u=r.min,h=r.max,f=function(t,e){return i.firstDay&&(t.push(t.shift()),e.push(e.shift())),n.node("thead",n.node("tr",n.group({min:0,max:6,i:1,node:"th",item:function(n){return[t[n],i.klass.weekdays,'scope=col title="'+e[n]+'"']}})))}((i.showWeekdaysFull?i.weekdaysFull:i.weekdaysShort).slice(0),i.weekdaysFull.slice(0)),d=function(t){return n.node("div"," ",i.klass["nav"+(t?"Next":"Prev")]+(t&&c.year>=h.year&&c.month>=h.month||!t&&c.year<=u.year&&c.month<=u.month?" "+i.klass.navDisabled:""),"data-nav="+(t||-1)+" "+n.ariaAttr({role:"button",controls:e.$node[0].id+"_table"})+' title="'+(t?i.labelMonthNext:i.labelMonthPrev)+'"')},p=function(){var r=i.showMonthsShort?i.monthsShort:i.monthsFull;return i.selectMonths?n.node("select",n.group({min:0,max:11,i:1,node:"option",item:function(t){return[r[t],0,"value="+t+(c.month==t?" selected":"")+(c.year==u.year&&t<u.month||c.year==h.year&&t>h.month?" disabled":"")]}}),i.klass.selectMonth,(t?"":"disabled")+" "+n.ariaAttr({controls:e.$node[0].id+"_table"})+' title="'+i.labelMonthSelect+'"'):n.node("div",r[c.month],i.klass.month)},g=function(){var r=c.year,o=!0===i.selectYears?5:~~(i.selectYears/2);if(o){var s=u.year,a=h.year,l=r-o,f=r+o;if(s>l&&(f+=s-l,l=s),a<f){var d=l-s,p=f-a;l-=d>p?p:d,f=a}return n.node("select",n.group({min:l,max:f,i:1,node:"option",item:function(t){return[t,0,"value="+t+(r==t?" selected":"")]}}),i.klass.selectYear,(t?"":"disabled")+" "+n.ariaAttr({controls:e.$node[0].id+"_table"})+' title="'+i.labelYearSelect+'"')}return n.node("div",r,i.klass.year)};return n.node("div",(i.selectYears?g()+p():p()+g())+d()+d(1),i.klass.header)+n.node("table",f+n.node("tbody",n.group({min:0,max:5,i:1,node:"tr",item:function(t){var r=i.firstDay&&0===e.create([c.year,c.month,1]).day?-7:0;return[n.group({min:7*t-c.day+r+1,max:function(){return this.min+7-1},i:1,node:"td",item:function(t){t=e.create([c.year,c.month,t+(i.firstDay?1:0)]);var r=s&&s.pick==t.pick,f=a&&a.pick==t.pick,d=l&&e.disabled(t)||t.pick<u.pick||t.pick>h.pick;return[n.node("div",t.date,function(e){return e.push(c.month==t.month?i.klass.infocus:i.klass.outfocus),o.pick==t.pick&&e.push(i.klass.now),r&&e.push(i.klass.selected),f&&e.push(i.klass.highlighted),d&&e.push(i.klass.disabled),e.join(" ")}([i.klass.day]),"data-pick="+t.pick+" "+n.ariaAttr({role:"gridcell",selected:!(!r||e.$node.val()!==n.trigger(e.formats.toString,e,[i.format,t]))||null,activedescendant:!!f||null,disabled:!!d||null})),"",n.ariaAttr({role:"presentation"})]}})]}})),i.klass.table,'id="'+e.$node[0].id+'_table" '+n.ariaAttr({role:"grid",controls:e.$node[0].id,readonly:!0}))+n.node("div",n.node("button",i.today,i.klass.buttonToday,"type=button data-pick="+o.pick+(t&&!e.disabled(o)?"":" disabled")+" "+n.ariaAttr({controls:e.$node[0].id}))+n.node("button",i.clear,i.klass.buttonClear,"type=button data-clear=1"+(t?"":" disabled")+" "+n.ariaAttr({controls:e.$node[0].id}))+n.node("button",i.close,i.klass.buttonClose,"type=button data-close=true "+(t?"":" disabled")+" "+n.ariaAttr({controls:e.$node[0].id})),i.klass.footer)},i.defaults=function(t){return{labelMonthNext:"Next month",labelMonthPrev:"Previous month",labelMonthSelect:"Select a month",labelYearSelect:"Select a year",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],today:"Today",clear:"Clear",close:"Close",format:"d mmmm, yyyy",klass:{table:t+"table",header:t+"header",navPrev:t+"nav--prev",navNext:t+"nav--next",navDisabled:t+"nav
1--disabled",month:t+"month",year:t+"year",selectMonth:t+"select--month",selectYear:t+"select--year",weekdays:t+"weekday",day:t+"day",disabled:t+"day--disabled",selected:t+"day--selected",highlighted:t+"day--highlighted",now:t+"day--today",infocus:t+"day--infocus",outfocus:t+"day--outfocus",footer:t+"footer",buttonClear:t+"button--clear",buttonToday:t+"button--today",buttonClose:t+"button--close"}}}(t.klasses().picker+"__"),t.extend("pickadate",i)}),function(t){function e(t){var e=document.createElement("input"),i=(t="on"+t)in e;return i||(e.setAttribute(t,"return;"),i="function"==typeof e[t]),e=null,i}function i(e,n,r){var o=r.aliases[e];return!!o&&(o.alias&&i(o.alias,void 0,r),t.extend(!0,r,o),t.extend(!0,r,n),!0)}function n(e){function i(i){e.numericInput&&(i=i.split("").reverse().join(""));var n=!1,r=0,o=e.greedy,s=e.repeat;"*"==s&&(o=!1),1==i.length&&0==o&&0!=s&&(e.placeholder="");for(var a=t.map(i.split(""),function(t,i){var o=[];if(t==e.escapeChar)n=!0;else if(t!=e.optionalmarker.start&&t!=e.optionalmarker.end||n){var s=e.definitions[t];if(s&&!n)for(var a=0;a<s.cardinality;a++)o.push(e.placeholder.charAt((r+a)%e.placeholder.length));else o.push(t),n=!1;return r+=o.length,o}}),c=a.slice(),l=1;l<s&&o;l++)c=c.concat(a.slice());return{mask:c,repeat:s,greedy:o}}function n(i){e.numericInput&&(i=i.split("").reverse().join(""));var n=!1,r=!1,o=!1;return t.map(i.split(""),function(t,i){var s=[];if(t==e.escapeChar)r=!0;else if(t!=e.optionalmarker.start||r){if(t!=e.optionalmarker.end||r){var a=e.definitions[t];if(a&&!r){for(var c=a.prevalidator,l=c?c.length:0,u=1;u<a.cardinality;u++){var h=l>=u?c[u-1]:[],f=h.validator,d=h.cardinality;s.push({fn:f?"string"==typeof f?new RegExp(f):new function(){this.test=f}:new RegExp("."),cardinality:d||1,optionality:n,newBlockMarker:1==n&&o,offset:0,casing:a.casing,def:a.definitionSymbol||t}),1==n&&(o=!1)}s.push({fn:a.validator?"string"==typeof a.validator?new RegExp(a.validator):new function(){this.test=a.validator}:new RegExp("."),cardinality:a.cardinality,optionality:n,newBlockMarker:o,offset:0,casing:a.casing,def:a.definitionSymbol||t})}else s.push({fn:null,cardinality:0,optionality:n,newBlockMarker:o,offset:0,casing:null,def:t}),r=!1;return o=!1,s}n=!1,o=!0}else n=!0,o=!0})}function r(t){return e.optionalmarker.start+t+e.optionalmarker.end}function o(t){for(var i=0,n=0,r=t.length,o=0;o<r&&(t.charAt(o)==e.optionalmarker.start&&i++,t.charAt(o)==e.optionalmarker.end&&n++,!(i>0&&i==n));o++);var s=[t.substring(0,o)];return o<r&&s.push(t.substring(o+1,r)),s}function s(t){for(var i=t.length,n=0;n<i&&t.charAt(n)!=e.optionalmarker.start;n++);var r=[t.substring(0,n)];return n<i&&r.push(t.substring(n+1,i)),r}function a(e,u,h){var f,d,p=o(u),g=s(p[0]);g.length>1?(f=e+g[0]+r(g[1])+(p.length>1?p[1]:""),-1==t.inArray(f,l)&&""!=f&&(l.push(f),d=i(f),c.push({mask:f,_buffer:d.mask,buffer:d.mask.slice(),tests:n(f),lastValidPosition:-1,greedy:d.greedy,repeat:d.repeat,metadata:h})),f=e+g[0]+(p.length>1?p[1]:""),-1==t.inArray(f,l)&&""!=f&&(l.push(f),d=i(f),c.push({mask:f,_buffer:d.mask,buffer:d.mask.slice(),tests:n(f),lastValidPosition:-1,greedy:d.greedy,repeat:d.repeat,metadata:h})),s(g[1]).length>1&&a(e+g[0],g[1]+p[1],h),p.length>1&&s(p[1]).length>1&&(a(e+g[0]+r(g[1]),p[1],h),a(e+g[0],p[1],h))):(f=e+p,-1==t.inArray(f,l)&&""!=f&&(l.push(f),d=i(f),c.push({mask:f,_buffer:d.mask,buffer:d.mask.slice(),tests:n(f),lastValidPosition:-1,greedy:d.greedy,repeat:d.repeat,metadata:h})))}var c=[],l=[];return t.isFunction(e.mask)&&(e.mask=e.mask.call(this,e)),t.isArray(e.mask)?t.each(e.mask,function(t,e){void 0!=e.mask?a("",e.mask.toString(),e):a("",e.toString())}):a("",e.mask.toString()),e.greedy?c:c.sort(function(t,e){return t.mask.length-e.mask.length})}function r(e,i,n,r){function h(){return e[i]}function f(){return h().tests}function d(){return h()._buffer}function p(){return h().buffer}function g(r,o,s){function a(t,e,i,r){for(var o=b(t),s=i?1:0,a="",c=e.buffer,l=e.tests[o].cardinality;l>s;l--)a+=_(c,o-(l-1));return i&&(a+=i),null!=e.tests[o].fn?e.tests[o].fn.test(a,c,t,r,n):(i==_(e._buffer.slice(),t,!0)||i==n.skipOptionalPartCharacter)&&{refresh:!0,c:_(e._buffer.slice(),t,!0),pos:t}}if(s=!0===s)return!0===(l=a(r,h(),o,s))&&(l={pos:r}),l;var c=[],l=!1,u=i,f=p().slice(),d=h().lastValidPosition,g=(k(r),[]);return t.each(e,function(t,e){if("object"==typeof e){i=t;var n,v=r,b=h().lastValidPosition;
1if(b==d){if(v-d>1)for(var k=-1==b?0:b;k<v&&!1!==(n=a(k,h(),f[k],!0));k++){w(p(),k,f[k],!0),!0===n&&(n={pos:k});S=n.pos||k;h().lastValidPosition<S&&(h().lastValidPosition=S)}if(!m(v)&&!a(v,h(),o,s)){for(var _=x(v)-v,C=0;C<_&&!1===a(++v,h(),o,s);C++);g.push(i)}}if((h().lastValidPosition>=d||i==u)&&v>=0&&v<y()){if(!1!==(l=a(v,h(),o,s))){!0===l&&(l={pos:v});var S=l.pos||v;h().lastValidPosition<S&&(h().lastValidPosition=S)}c.push({activeMasksetIndex:t,result:l})}}}),i=u,function(i,n){var s=!1;if(t.each(n,function(e,n){if(s=-1==t.inArray(n.activeMasksetIndex,i)&&!1!==n.result)return!1}),s)n=t.map(n,function(n,r){if(-1==t.inArray(n.activeMasksetIndex,i))return n;e[n.activeMasksetIndex].lastValidPosition=d});else{var c,l=-1,u=-1;t.each(n,function(e,n){-1!=t.inArray(n.activeMasksetIndex,i)&&!1!==n.result&(-1==l||l>n.result.pos)&&(l=n.result.pos,u=n.activeMasksetIndex)}),n=t.map(n,function(n,s){if(-1!=t.inArray(n.activeMasksetIndex,i)){if(n.result.pos==l)return n;if(!1!==n.result){for(var h=r;h<l;h++){if(!1===(c=a(h,e[n.activeMasksetIndex],e[u].buffer[h],!0))){e[n.activeMasksetIndex].lastValidPosition=l-1;break}w(e[n.activeMasksetIndex].buffer,h,e[u].buffer[h],!0),e[n.activeMasksetIndex].lastValidPosition=h}return!1!==(c=a(l,e[n.activeMasksetIndex],o,!0))&&(w(e[n.activeMasksetIndex].buffer,l,o,!0),e[n.activeMasksetIndex].lastValidPosition=l),n}}})}return n}(g,c)}function v(){var n=i,r={activeMasksetIndex:0,lastValidPosition:-1,next:-1};t.each(e,function(t,e){"object"==typeof e&&(i=t,h().lastValidPosition>r.lastValidPosition?(r.activeMasksetIndex=t,r.lastValidPosition=h().lastValidPosition,r.next=x(h().lastValidPosition)):h().lastValidPosition==r.lastValidPosition&&(-1==r.next||r.next>x(h().lastValidPosition))&&(r.activeMasksetIndex=t,r.lastValidPosition=h().lastValidPosition,r.next=x(h().lastValidPosition)))}),n!=(i=-1!=r.lastValidPosition&&e[n].lastValidPosition==r.lastValidPosition?n:r.activeMasksetIndex)&&(E(p(),x(r.lastValidPosition),y()),h().writeOutBuffer=!0),V.data("_inputmask").activeMasksetIndex=i}function m(t){var e=b(t),i=f()[e];return void 0!=i&&i.fn}function b(t){return t%f().length}function y(){return n.getMaskLength(d(),h().greedy,h().repeat,p(),n)}function x(t){var e=y();if(t>=e)return e;for(var i=t;++i<e&&!m(i););return i}function k(t){var e=t;if(e<=0)return 0;for(;--e>0&&!m(e););return e}function w(t,e,i,n){n&&(e=C(t,e));var r=f()[b(e)],o=i;if(void 0!=o&&void 0!=r)switch(r.casing){case"upper":o=i.toUpperCase();break;case"lower":o=i.toLowerCase()}t[e]=o}function _(t,e,i){return i&&(e=C(t,e)),t[e]}function C(t,e){for(var i;void 0==t[e]&&t.length<y();)for(i=0;void 0!==d()[i];)t.push(d()[i++]);return e}function S(t,e,i){t._valueSet(e.join("")),void 0!=i&&D(t,i)}function E(t,e,i,n){for(var r=e,o=y();r<i&&r<o;r++)!0===n?m(r)||w(t,r,""):w(t,r,_(d().slice(),r,!0))}function T(t,e){var i=b(e);w(t,e,_(d(),i))}function O(t){return n.placeholder.charAt(t%n.placeholder.length)}function P(n,r,o,s,a){var c=void 0!=s?s.slice():A(n._valueGet()).split("");t.each(e,function(t,e){"object"==typeof e&&(e.buffer=e._buffer.slice(),e.lastValidPosition=-1,e.p=-1)}),!0!==o&&(i=0),r&&n._valueSet("");y();t.each(c,function(e,i){if(!0===a){var s=h().p,c=-1==s?s:k(s),l=-1==c?e:x(c);-1==t.inArray(i,d().slice(c+1,l))&&z.call(n,void 0,!0,i.charCodeAt(0),r,o,e)}else z.call(n,void 0,!0,i.charCodeAt(0),r,o,e),o=o||e>0&&e>h().p}),!0===o&&-1!=h().p&&(h().lastValidPosition=k(h().p))}function j(e){return t.inputmask.escapeRegex.call(this,e)}function A(t){return t.replace(new RegExp("("+j(d().join(""))+")*$"),"")}function I(t){for(var e=p(),i=e.slice(),n=i.length-1;n>=0;n--){var r=b(n);if(!f()[r].optionality)break;if(m(n)&&g(n,e[n],!0))break;i.pop()}S(t,i)}function M(t){return!q||"number"!=typeof t||n.greedy&&""==n.placeholder||(t=p().length-t),t}function D(e,i,r){var o,s=e.jquery&&e.length>0?e[0]:e;if("number"!=typeof i)return t(e).is(":visible")?(s.setSelectionRange?(i=s.selectionStart,r=s.selectionEnd):document.selection&&document.selection.createRange&&(r=(i=0-(o=document.selection.createRange()).duplicate().moveStart("character",-1e5))+o.text.length),i=M(i),r=M(r),{begin:i,end:r}):{begin:0,end:0};i=M(i),r=M(r),t(s).is(":visible")&&(r="number"==typeof r?r:i,s.scrollLeft=s.scrollWidth,0==n.insertMode&&i==r&&r++,s.setSelectionRange?(s.selectionStart=i,s.selectionEnd=a?i:r):s.createTextRange&&((o=s.createTextRange()).collapse(!0),o.moveEnd("character",r),o.moveStart("character",i),o.select()))}function F(r){if("*"!=n.repeat){var o=!1,s=0,a=i;return t.each(e,function(t,e){if("object"==typeof e){i=t;var n=k(y());if(e.lastValidPosition>=s&&e.lastValidPosition==n){for(var a=!0,c=0;c<=n;c++){var l=m(c),u=b(c);if(l&&(void 0==r[c]||r[c]==O(c))||!l&&r[c]!=d()[u]){a=!1;break}}if(o=o||a)return!1}s=e.lastValidPosition}}),i=a,o}}function G(t,e){return q?t-e>1||t-e==1&&n.insertMode:e-t>1||e-t==1&&n.insertMode}function L(e){var i=t._data(e).events;t.each(i,function(e,i){t.each(i,function(t,e){if("inputmask"==e.namespace&&"setvalue"!=e.type){var i=e.handler;e.handler=function(t){if(!this.readOnly&&!this.disabled)return i.apply(this,arguments);t.preventDefault}}})})}function R(e){var i;if(Object.getOwnPropertyDescriptor&&(i=Object.getOwnPropertyDescriptor(e,"value")),i&&i.get){if(!e._valueGet){var n=i.get,r=i.set;e._valueGet=function(){return q?n.call(this).split("").reverse().join(""):n.call(this)},e._valueSet=function(t){r.call(this,q?t.split("").reverse().join(""):t)},Object.defineProperty(e,"value",{get:function(){var e=t(this),i=t(this).data("_inputmask"),r=i.masksets,o=i.activeMasksetIndex;return i&&i.opts.autoUnmask?e.inputmask("unmaskedvalue"):n.call(this)!=r[o]._buffer.join("")?n.call(this):""},set:function(e){r.call(this,e),t(this).triggerHandler("setvalue.inputmask")}})}}else if(document.__lookupGetter__&&e.__lookupGetter__("value")){if(!e._valueGet){var n=e.__lookupGetter__("value"),r=e.__lookupSetter__("value");e._valueGet=function(){return q?n.call(this).split("").reverse().join(""):n.call(this)},e._valueSet=function(t){r.call(this,q?t.split("").reverse().join(""):t)},e.__defineGetter__("value",function(){var e=t(this),i=t(this).data("_inputmask"),r=i.masksets,o=i.activeMasksetIndex;return i&&i.opts.autoUnmask?e.inputmask("unmaskedvalue"):n.call(this)!=r[o]._buffer.join("")?n.call(this):""}),e.__defineSetter__("value",function(e){r.call(this,e),t(this).triggerHandler("setvalue.inputmask")})}}else e._valueGet||(e._valueGet=function(){return q?this.value.split("").reverse().join(""):this.value},e._valueSet=function(t){this.value=q?t.split("").reverse().join(""):t}),function(e){if(void 0==t.valHooks[e]||1!=t.valHooks[e].inputmaskpatch){var i=t.valHooks[e]&&t.valHooks[e].get?t.valHooks[e].get:function(t){return t.value},n=t.valHooks[e]&&t.valHooks[e].set?t.valHooks[e].set:function(t,e){return t.value=e,t};t.valHooks[e]={get:function(e){var n=t(e);if(n.data("_inputmask")){if(n.data("_inputmask").opts.autoUnmask)return n.inputmask("unmaskedvalue");var r=i(e),o=n.data("_inputmask");return r!=o.masksets[o.activeMasksetIndex]._buffer.join("")?r:""}return i(e)},set:function(e,i){var r=t(e),o=n(e,i);return r.data("_inputmask")&&r.triggerHandler("setvalue.inputmask"),o},inputmaskpatch:!0}}}(e.type)}function N(t,e,i,n){var r=p();if(!1!==n)for(;!m(t)&&t-1>=0;)t--;for(c=t;c<e&&c<y();c++)if(m(c)){T(r,c);var o=x(c),s=_(r,o);if(s!=O(o))if(o<y()&&!1!==g(c,s,!0)&&f()[b(c)].def==f()[b(o)].def)w(r,c,s,!0);else if(m(c))break}else T(r,c);if(void 0!=i&&w(r,k(e),i),0==h().greedy){var a=A(r.join("")).split("");r.length=a.length;for(var c=0,l=r.length;c<l;c++)r[c]=a[c];0==r.length&&(h().buffer=d().slice())}return t}function X(t,e,i){var n=p();if(_(n,t,!0)!=O(t))for(c=k(e);c>t&&c>=0;c--)if(m(c)){var r=k(c),o=_(n,r);o!=O(r)&&!1!==g(r,o,!0)&&f()[b(c)].def==f()[b(r)].def&&(w(n,c,o,!0),T(n,r))}else T(n,c);void 0!=i&&_(n,t)==O(t)&&w(n,t,i);var s=n.length;if(0==h().greedy){var a=A(n.join("")).split("");n.length=a.length;for(var c=0,l=n.length;c<l;c++)n[c]=a[c];0==n.length&&(h().buffer=d().slice())}return e-(s-n.length)}function B(t,i,r){if(n.numericInput||q){switch(i){case n.keyCode.BACKSPACE:i=n.keyCode.DELETE;break;case n.keyCode.DELETE:i=n.keyCode.BACKSPACE}if(q){var o=r.end;r.end=r.begin,r.begin=o}}var s=!0;if(r.begin==r.end){var a=i==n.keyCode.BACKSPACE?r.begin-1:r.begin;n.isNumeric&&""!=n.radixPoint&&p()[a]==n.radixPoint&&(r.begin=p().length-1==a?r.begin:i==n.keyCode.BACKSPACE?a:x(a),r.end=r.begin),s=!1,i==n.keyCode.BACKSPACE?r.begin--:i==n.keyCode.DELETE&&r.end++}else r.end-r.begin!=1||n.insertMode||(s=!1,i==n.keyCode.BACKSPACE&&r.begin--);E(p(),r.begin,r.end);var c=y();if(0==n.greedy)N(r.begin,c,void 0,!q&&i==n.keyCode.BACKSPACE&&!s);else{for(var l=r.begin,u=r.begin;u<r.end;u++)!m(u)&&s||(l=N(r.begin,c,void 0,!q&&i==n.keyCode.BACKSPACE&&!s));s||(r.begin=l)}var f=x(-1);E(p(),r.begin,r.end,!0),P(t,!1,void 0==e[1]||f>=r.end,p()),h().lastValidPosition<f?(h().lastValidPosition=-1,h().p=f):h().p=r.begin}function Y(e){J=!1;var i=this,r=t(i),o=e.keyCode,a=D(i);o==n.keyCode.BACKSPACE||o==n.keyCode.DELETE||s&&127==o||e.ctrlKey&&88==o?(e.preventDefault(),88==o&&($=p().join("")),B(i,o,a),v(),S(i,p(),h().p),i._valueGet()==d().join("")&&r.trigger("cleared"),n.showTooltip&&r.prop("title",h().mask)):o==n.keyCode.END||o==n.keyCode.PAGE_DOWN?setTimeout(function(){var t=x(h().lastValidPosition);n.insertMode||t!=y()||e.shiftKey||t--,D(i,e.shiftKey?a.begin:t,t)},0):o==n.keyCode.HOME&&!e.shiftKey||o==n.keyCode.PAGE_UP?D(i,0,e.shiftKey?a.begin:0):o==n.keyCode.ESCAPE||90==o&&e.ctrlKey?(P(i,!0,
1!1,$.split("")),r.click()):o!=n.keyCode.INSERT||e.shiftKey||e.ctrlKey?0!=n.insertMode||e.shiftKey||(o==n.keyCode.RIGHT?setTimeout(function(){var t=D(i);D(i,t.begin)},0):o==n.keyCode.LEFT&&setTimeout(function(){var t=D(i);D(i,t.begin-1)},0)):(n.insertMode=!n.insertMode,D(i,n.insertMode||a.begin!=y()?a.begin:a.begin-1));var c=D(i);!0===n.onKeyDown.call(this,e,p(),n)&&D(i,c.begin,c.end),Q=-1!=t.inArray(o,n.ignorables)}function z(r,o,s,a,c,l){if(void 0==s&&J)return!1;J=!0;var u=this,f=t(u);r=r||window.event;var s=o?s:r.which||r.charCode||r.keyCode;if(!(!0===o||r.ctrlKey&&r.altKey)&&(r.ctrlKey||r.metaKey||Q))return!0;if(s){!0!==o&&46==s&&0==r.shiftKey&&","==n.radixPoint&&(s=44);var d,m,b,C=String.fromCharCode(s);if(o){var E=c?l:h().lastValidPosition+1;d={begin:E,end:E}}else d=D(u);var T=G(d.begin,d.end),P=i;T&&(t.each(e,function(t,e){"object"==typeof e&&(i=t,h().undoBuffer=p().join(""))}),i=P,B(u,n.keyCode.DELETE,d),n.insertMode||t.each(e,function(t,e){"object"==typeof e&&(i=t,X(d.begin,y()),h().lastValidPosition=x(h().lastValidPosition))}),i=P);var j=p().join("").indexOf(n.radixPoint);n.isNumeric&&!0!==o&&-1!=j&&(n.greedy&&d.begin<=j?(d.begin=k(d.begin),d.end=d.begin):C==n.radixPoint&&(d.begin=j,d.end=d.begin));var A=d.begin;m=g(A,C,c),!0===c&&(m=[{activeMasksetIndex:i,result:m}]);var I=-1;if(t.each(m,function(t,e){i=e.activeMasksetIndex,h().writeOutBuffer=!0;var r=e.result;if(!1!==r){var o=!1,s=p();if(!0!==r&&(o=r.refresh,A=void 0!=r.pos?r.pos:A,C=void 0!=r.c?r.c:C),!0!==o){if(1==n.insertMode){for(var a=y(),l=s.slice();_(l,a,!0)!=O(a)&&a>=A;)a=0==a?-1:k(a);if(a>=A){X(A,y(),C);var u=h().lastValidPosition,f=x(u);f!=y()&&u>=A&&_(p().slice(),f,!0)!=O(f)&&(h().lastValidPosition=f)}else h().writeOutBuffer=!1}else w(s,A,C,!0);(-1==I||I>x(A))&&(I=x(A))}else if(!c){var d=A<y()?A+1:A;(-1==I||I>d)&&(I=d)}I>h().p&&(h().p=I)}}),!0!==c&&(i=P,v()),!1!==a&&(t.each(m,function(t,e){if(e.activeMasksetIndex==i)return b=e,!1}),void 0!=b)){var M=this;if(setTimeout(function(){n.onKeyValidation.call(M,b.result,n)},0),h().writeOutBuffer&&!1!==b.result){var L,R=p();L=o?void 0:n.numericInput?A>j?k(I):C==n.radixPoint?I-1:k(I-1):I,S(u,R,L),!0!==o&&setTimeout(function(){!0===F(R)&&f.trigger("complete"),K=!0,f.trigger("input")},0)}else T&&(h().buffer=h().undoBuffer.split(""))}n.showTooltip&&f.prop("title",h().mask),r&&(r.preventDefault?r.preventDefault():r.returnValue=!1)}}function W(e){var i=t(this),r=this,o=e.keyCode,s=p();n.onKeyUp.call(this,e,s,n),o==n.keyCode.TAB&&n.showMaskOnFocus&&(i.hasClass("focus.inputmask")&&0==r._valueGet().length?(S(r,s=d().slice()),D(r,0),$=p().join("")):(S(r,s),s.join("")==d().join("")&&-1!=t.inArray(n.radixPoint,s)?(D(r,M(0)),i.click()):D(r,M(0),M(y()))))}function U(e){if(!0===K&&"input"==e.type)return K=!1,!0;var i=this,r=t(i);if("propertychange"==e.type&&i._valueGet().length<=y())return!0;setTimeout(function(){var t=void 0!=n.onBeforePaste?n.onBeforePaste.call(this,i._valueGet()):i._valueGet();P(i,!1,!1,t.split(""),!0),S(i,p()),!0===F(p())&&r.trigger("complete"),r.click()},0)}function H(e){if(!0===K)return K=!1,!0;var i=this,r=t(i),o=D(i),s=i._valueGet();p().length-s.length!=1||s.charAt(o.begin)==p()[o.begin]||s.charAt(o.begin+1)==p()[o.begin]||m(o.begin)?(P(i,!1,!1),S(i,p()),setTimeout(function(){D(i,x(o.begin-1)),!0===F(p())&&r.trigger("complete")},0)):(e.keyCode=n.keyCode.BACKSPACE,Y.call(i,e))}var V,q=!1,$=p().join(""),J=!1,K=!1,Q=!1;if(void 0!=r)switch(r.action){case"isComplete":return F(r.buffer);case"unmaskedvalue":return q=r.$input.data("_inputmask").isRTL,function(e,i){if(!f()||!0!==i&&e.hasClass("hasDatepicker"))return e[0]._valueGet();var r=t.map(p(),function(t,e){return m(e)&&g(e,t,!0)?t:null}),o=(q?r.reverse():r).join("");return void 0!=n.onUnMask?n.onUnMask.call(this,p().join(""),o):o}(r.$input,r.skipDatepickerCheck);case"mask":!function(r){if((V=t(r)).is(":input")){if(V.data("_inputmask",{masksets:e,activeMasksetIndex:i,opts:n,isRTL:!1}),n.showTooltip&&V.prop("title",h().mask),h().greedy=h().greedy?h().greedy:0==h().repeat,null!=V.attr("maxLength")){var s=V.prop("maxLength");s>-1&&t.each(e,function(t,e){"object"==typeof e&&"*"==e.repeat&&(e.repeat=s)}),y()>=s&&s>
1-1&&(s<d().length&&(d().length=s),0==h().greedy&&(h().repeat=Math.round(s/d().length)),V.prop("maxLength",2*y()))}if(R(r),n.numericInput&&(n.isNumeric=n.numericInput),("rtl"==r.dir||n.numericInput&&n.rightAlignNumerics||n.isNumeric&&n.rightAlignNumerics)&&V.css("text-align","right"),"rtl"==r.dir||n.numericInput){r.dir="ltr",V.removeAttr("dir");var f=V.data("_inputmask");f.isRTL=!0,V.data("_inputmask",f),q=!0}V.unbind(".inputmask"),V.removeClass("focus.inputmask"),V.closest("form").bind("submit",function(){$!=p().join("")&&V.change()}).bind("reset",function(){setTimeout(function(){V.trigger("setvalue")},0)}),V.bind("mouseenter.inputmask",function(){var e=this;!t(this).hasClass("focus.inputmask")&&n.showMaskOnHover&&e._valueGet()!=p().join("")&&S(e,p())}).bind("blur.inputmask",function(){var r=t(this),o=this,s=o._valueGet(),a=p();r.removeClass("focus.inputmask"),$!=p().join("")&&r.change(),n.clearMaskOnLostFocus&&""!=s&&(s==d().join("")?o._valueSet(""):I(o)),!1===F(a)&&(r.trigger("incomplete"),n.clearIncomplete&&(t.each(e,function(t,e){"object"==typeof e&&(e.buffer=e._buffer.slice(),e.lastValidPosition=-1)}),i=0,n.clearMaskOnLostFocus?o._valueSet(""):S(o,a=d().slice())))}).bind("focus.inputmask",function(){var e=t(this),i=this,r=i._valueGet();n.showMaskOnFocus&&!e.hasClass("focus.inputmask")&&(!n.showMaskOnHover||n.showMaskOnHover&&""==r)&&i._valueGet()!=p().join("")&&S(i,p(),x(h().lastValidPosition)),e.addClass("focus.inputmask"),$=p().join("")}).bind("mouseleave.inputmask",function(){var e=t(this),i=this;n.clearMaskOnLostFocus&&(e.hasClass("focus.inputmask")||i._valueGet()==e.attr("placeholder")||(i._valueGet()==d().join("")||""==i._valueGet()?i._valueSet(""):I(i)))}).bind("click.inputmask",function(){var e=this;setTimeout(function(){var i=D(e),r=p();if(i.begin==i.end){var o,s=q?M(i.begin):i.begin,a=h().lastValidPosition;s<(o=n.isNumeric&&!1===n.skipRadixDance&&""!=n.radixPoint&&-1!=t.inArray(n.radixPoint,r)?n.numericInput?x(t.inArray(n.radixPoint,r)):t.inArray(n.radixPoint,r):x(a))?m(s)?D(e,s):D(e,x(s)):D(e,o)}},0)}).bind("dblclick.inputmask",function(){var t=this;setTimeout(function(){D(t,0,x(h().lastValidPosition))},0)}).bind(u+".inputmask dragdrop.inputmask drop.inputmask",U).bind("setvalue.inputmask",function(){var t=this;P(t,!0),$=p().join(""),t._valueGet()==d().join("")&&t._valueSet("")}).bind("complete.inputmask",n.oncomplete).bind("incomplete.inputmask",n.onincomplete).bind("cleared.inputmask",n.oncleared),V.bind("keydown.inputmask",Y).bind("keypress.inputmask",z).bind("keyup.inputmask",W),a&&(c?V.bind("input.inputmask",H):"input"!=u&&V.bind("input.inputmask",U)),l&&("input"==u&&V.unbind(u+".inputmask"),V.bind("input.inputmask",H)),o&&V.bind("input.inputmask",U),P(r,!0,!1,(void 0!=n.onBeforeMask?n.onBeforeMask.call(this,r._valueGet()):r._valueGet()).split("")),$=p().join("");var g;try{g=document.activeElement}catch(t){}g===r?(V.addClass("focus.inputmask"),D(r,x(h().lastValidPosition))):n.clearMaskOnLostFocus?p().join("")==d().join("")?r._valueSet(""):I(r):S(r,p()),L(r)}}(r.el);break;case"format":return(V=t({})).data("_inputmask",{masksets:e,activeMasksetIndex:i,opts:n,isRTL:n.numericInput}),n.numericInput&&(n.isNumeric=n.numericInput,q=!0),P(V,!1,!1,r.value.split(""),!0),p().join("");case"isValid":return(V=t({})).data("_inputmask",{masksets:e,activeMasksetIndex:i,opts:n,isRTL:n.numericInput}),n.numericInput&&(n.isNumeric=n.numericInput,q=!0),P(V,!1,!0,r.value.split("")),F(p())}}if(void 0===t.fn.inputmask){var o="function"==typeof ScriptEngineMajorVersion?ScriptEngineMajorVersion():new Function("/*@cc_on return @_jscript_version; @*/")()>=10,s=null!==navigator.userAgent.match(new RegExp("iphone","i")),a=null!==navigator.userAgent.match(new RegExp("android.*safari.*","i")),c=null!==navigator.userAgent.match(new RegExp("android.*chrome.*","i")),l=null!==navigator.userAgent.match(new RegExp("android.*firefox.*","i")),u=e("paste")?"paste":e("input")?"input":"propertychange";t.inputmask={defaults:{placeholder:"_",optionalmarker:{start:"[",end:"]"},quantifiermarker:{start:"{",end:"}"},groupmarker:{start:"(",end:")"},escapeChar:"\\",mask:null,oncomplete:t.noop,onincomplete:t.noop,oncleared:t.noop,repeat:0,greedy:!0,autoUnmask:!1,clearMaskOnLostFocus:!0,insertMode:!0,clearIncomplete:!1,aliases:{},onKeyUp:t.noop,onKeyDown:t.noop,onBeforeMask:void 0,onBeforePaste:void 0,onUnMask:void 0,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:t.noop,skipOptionalPartCharacter:" ",showTooltip:!1,numericInput:!1,isNumeric:!1,radixPoint:"",skipRadixDance:!1,rightAlignNumerics:!0,definitions:{9:{validator:"[0-9]",cardinality:1,definitionSymbol:"*"},a:{validator:"[A-Za-zА-яЁё]",cardinality:1,definitionSymbol:"*"},"*":{validator:"[A-Za-zА-яЁё0-9]",cardinality:1}},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123],getMaskLength:function(t,e,
1i,n,r){var o=t.length;return e||("*"==i?o=n.length+1:i>1&&(o+=t.length*(i-1))),o}},escapeRegex:function(t){var e=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];return t.replace(new RegExp("(\\"+e.join("|\\")+")","gim"),"\\$1")},format:function(e,o){var s=t.extend(!0,{},t.inputmask.defaults,o);return i(s.alias,o,s),r(n(s),0,s,{action:"format",value:e})},isValid:function(e,o){var s=t.extend(!0,{},t.inputmask.defaults,o);return i(s.alias,o,s),r(n(s),0,s,{action:"isValid",value:e})}},t.fn.inputmask=function(e,o){var s,a=t.extend(!0,{},t.inputmask.defaults,o),c=0;if("string"==typeof e)switch(e){case"mask":return i(a.alias,o,a),0==(s=n(a)).length?this:this.each(function(){r(t.extend(!0,{},s),0,a,{action:"mask",el:this})});case"unmaskedvalue":var l=t(this);return l.data("_inputmask")?(s=l.data("_inputmask").masksets,c=l.data("_inputmask").activeMasksetIndex,a=l.data("_inputmask").opts,r(s,c,a,{action:"unmaskedvalue",$input:l})):l.val();case"remove":return this.each(function(){var e=t(this),i=this;if(e.data("_inputmask")){s=e.data("_inputmask").masksets,c=e.data("_inputmask").activeMasksetIndex,a=e.data("_inputmask").opts,i._valueSet(r(s,c,a,{action:"unmaskedvalue",$input:e,skipDatepickerCheck:!0})),e.removeData("_inputmask"),e.unbind(".inputmask"),e.removeClass("focus.inputmask");var n;Object.getOwnPropertyDescriptor&&(n=Object.getOwnPropertyDescriptor(i,"value")),n&&n.get?i._valueGet&&Object.defineProperty(i,"value",{get:i._valueGet,set:i._valueSet}):document.__lookupGetter__&&i.__lookupGetter__("value")&&i._valueGet&&(i.__defineGetter__("value",i._valueGet),i.__defineSetter__("value",i._valueSet));try{delete i._valueGet,delete i._valueSet}catch(t){i._valueGet=void 0,i._valueSet=void 0}}});case"getemptymask":return this.data("_inputmask")?(s=this.data("_inputmask").masksets,c=this.data("_inputmask").activeMasksetIndex,s[c]._buffer.join("")):"";case"hasMaskedValue":return!!this.data("_inputmask")&&!this.data("_inputmask").opts.autoUnmask;case"isComplete":return s=this.data("_inputmask").masksets,c=this.data("_inputmask").activeMasksetIndex,a=this.data("_inputmask").opts,r(s,c,a,{action:"isComplete",buffer:this[0]._valueGet().split("")});case"getmetadata":return this.data("_inputmask")?(s=this.data("_inputmask").masksets,c=this.data("_inputmask").activeMasksetIndex,s[c].metadata):void 0;default:return i(e,o,a)||(a.mask=e),0==(s=n(a)).length?this:this.each(function(){r(t.extend(!0,{},s),c,a,{action:"mask",el:this})})}else{if("object"==typeof e)return a=t.extend(!0,{},t.inputmask.defaults,e),i(a.alias,e,a),0==(s=n(a)).length?this:this.each(function(){r(t.extend(!0,{},s),c,a,{action:"mask",el:this})});if(void 0==e)return this.each(function(){var e=t(this).attr("data-inputmask");if(e&&""!=e)try{e=e.replace(new RegExp("'","g"),'"');var n=t.parseJSON("{"+e+"}");t.extend(!0,n,o),i((a=t.extend(!0,{},t.inputmask.defaults,n)).alias,n,a),a.alias=void 0,t(this).inputmask(a)}catch(t){}})}}}}(jQuery),function(t){function e(e){return c?e.data("events"):t._data(e[0]).events}function i(t,i,n){var r=e(t),o=r[i];if(c)n?r.live.unshift(r.live.pop()):o.unshift(o.pop());else{var s=n?o.splice(o.delegateCount-1,1)[0]:o.pop();o.splice(n?0:o.delegateCount||0,0,s)}}function n(e,n,r){var o=n.split(/\s+/);e.each(function(){for(var e=0;e<o.length;++e){var n=t.trim(o[e]).match(/[^\.]+/i)[0];i(t(this),n,r)}})}function r(e){t.fn[e+"First"]=function(){var i=t.makeArray(arguments).shift();return i&&(t.fn[e].apply(this,arguments),n(this,i)),this}}var o=t.fn.jquery.split("."),s=parseInt(o[0]),a=parseInt(o[1]),c=s<1||1==s&&a<7;r("bind"),r("one"),t.fn.delegateFirst=function(){var e=t.makeArray(arguments),i=e[1];return i&&(e.splice(0,2),t.fn.delegate.apply(this,arguments),n(this,i,!0)),this},t.fn.liveFirst=function(){var e=t.makeArray(arguments);return e.unshift(this.selector),t.fn.delegateFirst.apply(t(document),e),this},c||(t.fn.onFirst=function(e,i){var r=t(this),o="string"==typeof i;if(t.fn.on.apply(r,arguments),"object"==typeof e)for(type in e)e.hasOwnProperty(type)&&n(r,type,o);else"string"==typeof e&&n(r,e,o);return r})}(jQuery),function(t){t.masksLoad=function(e){var i;return t.ajax({url:e,async:!1,dataType:"json",success:function(t){i=t}}
1),i},t.masksSort=function(e,i,n,r){return e.sort(function(e,o){for(var s=0,a=0;s<e[r].length&&a<o[r].length;){var c=e[r].charAt(s),l=o[r].charAt(a);if(n.test(c))if(n.test(l)){if(-1!=t.inArray(c,i)&&-1==t.inArray(l,i))return 1;if(-1==t.inArray(c,i)&&-1!=t.inArray(l,i))return-1;if(-1==t.inArray(c,i)&&-1==t.inArray(l,i)&&c!=l)return c<l?-1:1;s++,a++}else a++;else s++}for(;s<e[r].length||a<o[r].length;)if(s<e[r].length&&!n.test(e[r].charAt(s)))s++;else if(a<o[r].length&&!n.test(o[r].charAt(a)))a++;else{if(s<e[r].length)return 1;if(a<o[r].length)return-1}return 0}),e},t.fn.inputmasks=function(e,i){var n=function(t,e){if("number"!=typeof t){if(this.setSelectionRange)t=this.selectionStart,e=this.selectionEnd;else if(document.selection&&document.selection.createRange){var i=document.selection.createRange();e=(t=0-i.duplicate().moveStart("character",-1e5))+i.text.length}return{begin:t,end:e}}e="number"==typeof e?e:t,this.setSelectionRange?this.setSelectionRange(t,e):this.createTextRange&&((i=this.createTextRange()).collapse(!0),i.moveEnd("character",e),i.moveStart("character",t),i.select())},r=Object.keys||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var i in t)e[e.length]=i;return e};e=t.extend(!0,{onMaskChange:t.noop},e);var o={};for(var s in e.inputmask.definitions){var a=e.inputmask.definitions[s].validator;switch(typeof a){case"string":o[s]=new RegExp(a);break;case"object":"test"in e.definitions[s].validator&&(o[s]=a);break;case"function":o[s]={test:a}}}e.inputmask.definitions[e.replace]={validator:e.match.source,cardinality:1};var c=null!=navigator.userAgent.match(/iphone/i),l=!1,u=t.extend(!0,{},t.inputmask.defaults,e.inputmask).placeholder,h=t.extend(!0,{},t.inputmask.defaults,e.inputmask).insertMode,f=function(t){for(var i="",n=0;n<t.length;n++){var s=t.charAt(n);if(s==u)break;e.match.test(s)&&(i+=s)}for(var a in e.list){var c=e.list[a][e.listKey],l=!0;void 0===c&&(c=[]);for(var h=0,f=0;h<i.length&&f<c.length;){var d=c.charAt(f),p=i.charAt(h);if(e.match.test(d)||d in o){if(!(d in o&&o[d].test(p)||p==d)){l=!1;break}h++,f++}else f++}if(l&&h==i.length){var g=-1==c.substr(f).search(e.match),v=-1==(c=c.replace(new RegExp([e.match.source].concat(r(o)).join("|"),"g"),e.replace)).substr(f).search(e.replace);return{mask:c,obj:e.list[a],determined:g,completed:v}}}return!1},d=function(t,i,n){if(!t)return 0;for(var r=0,o=0;r<n.begin;r++)t.charAt(r)==e.replace&&o++;for(var s=0;r<n.end;r++)t.charAt(r)==e.replace&&s++;for(r=0;r<i.length&&(o>0||i.charAt(r)!=e.replace);r++)i.charAt(r)==e.replace&&o--;for(o=r;r<i.length&&s>0;r++)i.charAt(r)==e.replace&&s--;return s=r,{begin:o,end:s}},p=function(){t(this).unbind("keypress.inputmask",y).unbind("input.inputmask",_).unbind("paste.inputmask",_).unbind("dragdrop.inputmask",_).unbind("drop.inputmask",_).unbind("keydown.inputmask",b).unbind("setvalue.inputmask",k).unbind("blur.inputmask",x)},g=function(){p.call(this),t(this).bindFirst("keypress.inputmask",y).bindFirst("input.inputmask",_).bindFirst("paste.inputmask",_).bindFirst("dragdrop.inputmask",_).bindFirst("drop.inputmask",_).bindFirst("keydown.inputmask",b).bindFirst("setvalue.inputmask",k).bind("blur.inputmask",x)},v=function(i,r){if(i&&(r||i.mask!=l.mask)){var o;r||(o=d(l.mask,i.mask,n.call(this))),r&&(this._valueSet?this._valueSet(r):this.value=r),t(this).inputmask(i.mask,t.extend(!0,e.inputmask,{insertMode:h})),r||n.call(this,o.begin,o.end)}return l=i,e.onMaskChange.call(this,i.obj,i.determined),!0},m=function(e,i,n){var r=f(i);return!(!r||r.obj!=l.obj||r.determined!=l.determined)||(r&&(p.call(this),n?(v.call(this,r),t(this).trigger(e)):(t(this).trigger(e),v.call(this,r)),g.call(this)),e.stopImmediatePropagation(),!1)},b=function(t){var i=(t=t||window.event).which||t.charCode||t.keyCode;if(8==i||46==i||c&&127==i){var r=this._valueGet(),o=n.call(this);if(o.begin==o.end||!h&&o.begin==o.end-1){var s=o.begin;do{46!=i&&s--;var a=r.charAt(s);r=r.substring(0,s)+r.substring(s+1)}while(s>0&&s<r.length&&a!=u&&!e.match.test(a))}else{var l=r.substring(0,o.begin)+r.substring(o.end);-1==l.search(e.match)&&(r=l)}return m.call(this,t,r,!1)}return 45==i&&(h=!h),!0},y=function(t){var e=this;setTimeout(function(){var i=e._valueGet(),r=(t=t||window.event).which||t.charCode||t.keyCode,o=String.fromCharCode(r);return caretPos=n.call(e),i=i.substring(0,caretPos.begin)+o+i.substring(caretPos.end),m.call(e,t,i,!0)},50)},x=function(t){var e=f(this._valueGet());return v.call(this,e),g.call(this),!0},k=function(t){return w.call(this),t.stopImmediatePropagation(),!0},w=function(){var t;t=this._valueGet?this._valueGet():this.value;for(var e=f(t);!e&&t.length>0;)t=t.substr(0,t.length-1),e=f(t);v.call(this,e,t),g.call(this)},_=function(t){var e=this;return setTimeout(function(){w.call(e)},0),t.stopImmediatePropagation(),!0};switch(i){case"isCompleted":var C=f(this[0]._valueGet&&this[0]._valueGet()||this[0].value);return C&&C.completed;default:return this.each(function(){w.call(this)}),this}}}(jQuery),function(){var t=jQuery;!function(t){function e(e){return t.map(e.split("."),function(t){return parseInt(t,10)})}t.versioncompare=function(i,n){if(void 0===i)throw new Error("$.versioncompare needs at least one parameter.");if(n=n||t.fn.jquery,i==n)return 0;for(var r=e(i),o=e(n),s=Math.max(r.length,o.length),a=0;a<s;a++)if(r[a]=r[a]||0,o[a]=o[a]||0,r[a]!=o[a])return r[a]>o[a]?1:-1;return 0}}(jQuery),1===t.versioncompare("1.4.4",t().jquery)&&(t.fn.data=function(e,i){if(void 0!==i)return this.attr("data-"+e,i),this;if(void 0!==e)return this.attr("data-"+e);var n={};return t.each(this[0].attributes,function(){"data-"==this.name.substring(0,5)&&(n[this.name.substring(5)]=this.value)}),n},jQuery.expr[":"].focus=function(t){return t===document.activeElement&&(t.type||t.href)}),1===t.versioncompare("1.6",t().jquery)&&(t.fn.prop=t.fn.attr),1===t.versioncompare("1.5",t().jquery)&&(t._data=function(e){return t.data(e)}),t.fn.on||(t.fn.on=function(e,i,n){if("[object Object]"==Object.prototype.toString.call(e)){var r=this;t.each(e,function(t,e){r.on(t,e)})}else"[object Function]"==Object.prototype.toString.call(i)&&(n=i,i=""),t.fn.delegate&&i?this.delegate(i,e,n):i?t(i).live(e,n):this.bind(e,n);return this}),t.fn.off||(t.fn.off=function(t){return this.unbind(t),this}),t(function(){function e(){return/leclick\.dev$/.test(window.location.host)?"//leclick.dev":/leclick\.myterranet\.com$/.test(window.location.host)?"//leclick.myterranet.com":"//old.leclick.ru"}function i(i){i=t(i);var n=e(),r=i.data("lang");r&&"ru"!=r&&(n+="/"+r);var o=i.attr("data-remote-id");o=o?o.split(","):[];var s=i.attr("data-restaurant-id");s=s?s.split(","):[],o.length>1||s.length>1?n+="/booking/restaurants":n+="/booking/partners";var a={restaurantId:"restaurant-id",remoteId:"remote-id",id:"id",partner:"partner",source:"source",params:"params",header:"header",tab:"tab",from:"from",date:"date",time:"time",persons:"persons",beelineBarcode:"beeline-barcode",notifyToGCalendar:"notify-to-g-calendar",firstName:"first-name",lastName:"last-name",email:"email",fullPhone:"full-phone",wishes:"wishes",color:"color",container:"container",listName:"list-name",list:"list",cancelMessage:"cancel-message",cancelPhone:"cancel-phone",phonePrefix:"phone-prefix",licenseUrl:"license-url"};return t.each(a,function(t,e){var r=i.attr("data-"+e);r&&(n+="/"+t+"/"+encodeURIComponent(r))}),n}window.leclickPopup=function(e,i){var n,r,o,s,a,c=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/;if(!i&&"string"==t.type(e)){var l=e.match(c);l&&(l[2]?o=!0:i=!0)}
1if((n=t(".leclick-popup-container")).length||((n=t('<div class="leclick-popup-container" style="position:fixed; top:0; left:0;  width:100%; height:100%;"><div class="leclick-popup-overlay" style="position:absolute; top:0; left:0; width:100%; height:100%;"></div><div class="leclick-popup-loading" style="position:absolute; top:0; left:0; width:100%; height:100%;"></div><div class="leclick-popup-block" style="position:absolute; top:0; left:0;"></div></div>')).hide(),t("body").append(n),n.stop(!0,!0).fadeIn("fast")),o&&(s=t(e),(a=t("<div />")).insertAfter(s)),t.data(n[0],"container",o?e:null),t.data(n[0],"replacement",o?a:null),n.find(".leclick-popup-loading").show(),r=n.find(".leclick-popup-block"),i){var u=e.match(c),h=u?t(e):e,f=u?h.find("img:last"):null;if(f&&f.length){r.stop(!0,!0).fadeOut("fast");var d=function(){r.html(h),window.leclickPopup.success()};f.on("load",d).on("error",d)}else r.html(h),window.leclickPopup.success()}else o?(r.html(s),window.leclickPopup.success()):(r.stop(!0,!0).fadeOut("fast"),r.load(e,function(t,e){"error"==e&&r.html('<div class="error-xhr">'+t+"</div>"),window.leclickPopup.success()}));return this},window.leclickPopup.success=function(){var e=t(".leclick-popup-container"),i=e.find(".leclick-popup-block");e.find(".leclick-popup-loading").hide(),i.stop(!0,!0).fadeIn("fast"),i.prepend('<span class="leclick-popup-close-btn"></span><div class="leclick-popup-block-overlay" style="position:absolute; top:0; left:0; width:100%; height:100%; z-index:-1"></div>'),i.on("click",".leclick-popup-close",function(t){t.preventDefault(),window.leclickPopup.close()}),i.on("click",".leclick-popup-close-btn",function(t){if(t.preventDefault(),i.find(".leclick-r-content").hasClass("leclick-booking-success"))window.leclickPopup.close();else{var e=i.find(".leclick-popup-close-block");e.length?e.addClass("leclick-active"):window.leclickPopup.close()}}),i.on("click",".leclick-popup-close-block-btn",function(t){t.preventDefault(),i.find(".leclick-popup-close-block").removeClass("leclick-active")}),window.leclickPopup.resize(!0),t(window).unbind("resize",window.leclickPopup.resize).bind("resize",window.leclickPopup.resize)},window.leclickPopup.resize=function(e){var i=t(".leclick-popup-container"),n=i.find(".leclick-popup-block"),r=t(window),o=r.height(),s=r.width(),a=n.outerHeight(!0),c=n.outerWidth(!0),l=(o-a)/2,u=(s-c)/2,h=l<0||u<0,f=t("body");if(i.css({height:"100%",width:"100%",position:"fixed"}),h){i.css("position","absolute"),l=r.scrollTop();var d=f.outerHeight(!0);(o=d+a-(d-l))<d?o=d:i.css({height:o});var p=f.outerWidth(!0);(s=c)<p?s=p:i.css({width:s})}if(e)if(h)n.css({top:l+"px",left:u<0?0:u});else{var g=l/o*100,v=u/s*100;g<0&&(g=0),v<0&&(v=0),n.css({top:g+"%",left:v+"%"})}},window.leclickPopup.close=function(){var e=t(".leclick-popup-container");e.find(".leclick-r-content").hasClass("leclick-booking-success")||window.leclickSendInfo(e.find(".leclick-r-content"));var i=t.data(e[0],"container");e.fadeOut("fast",function(){if(i){var n=e.find(".leclick-popup-block").find(i);t.data(e[0],"replacement").replaceWith(n)}t(this).remove()})},window.leclickSendInfo=function(i){i=t(i);var n={url:window.location.href,restaurantId:i.data("restaurant-id"),date:i.find(".leclick-date").val(),time:i.find(".leclick-time").val(),persons:i.find(".leclick-persons").val(),wishes:i.find(".leclick-wishes").val(),firstName:i.find(".leclick-firstName").val(),lastName:i.find(".leclick-lastName").val(),email:i.find(".leclick-email").val(),fullPhone:i.find(".leclick-fullPhone").val()};if(n.fullPhone&&"7"!==n.fullPhone){var r=[];t.each(n,function(t,e){r.push(t+"="+encodeURIComponent(e))}),t.getScript(e()+"/booking/send-info?"+r.join("&"))}},window.leclickResult=function(e){if(e.list){var i=t("#"+e.list);i.find(".leclick-booking-list").hide(),i.find(".leclick-booking-container").html(e.content).show(),window.leclickPopup.resize(!0),i.on("click",".leclick-back-to-list",function(t){t.preventDefault(),i.find(".leclick-booking-list").show(),i.find(".leclick-booking-container").html("").show(),window.leclickPopup.resize(!0)})}else e.container?t(e.container).html(e.content):window.leclickPopup(e.content,!0)},t(document).on("click",".leclick-reservation",function(e){e.preventDefault(),t.getScript(i(this))});var n=1;t(".leclick-reservation-container").each(function(){var e=t(this),r=i(e),o="leclick-rc-"+n;e.addClass(o),r+="?container=."+o,t.getScript(r),++n}),t(document).on("change",".leclick-popup-container .leclick-time",function(){setTimeout(function(){window.leclickPopup.resize(!0)},1)}),t(document).on("click",".leclick-popup-container .leclick-tabs-nav li,.leclick-reserve-for-other,.leclick-next-step,.leclick-prev-step",function(){setTimeout(function(){window.leclickPopup.resize(!0)},1)})})}(),function(){function t(t){var e=i(t),n=e.find(".leclick-step.leclick-active:last"),r=n.next(),o=n.find("form.leclick-active .leclick-price"),s=r.find(".leclick-price");o.is(":visible")?(s.find(".leclick-deposit-price").text(o.find(".leclick-deposit-price").text()),s.show()):s.hide(),e.find(".leclick-step.leclick-active").removeClass("leclick-active"),r.addClass("leclick-active")}function e(){return/leclick\.dev$/.test(window.location.host)?"//leclick.dev":/leclick\.myterranet\.com$/.test(window.location.host)?"//leclick.myterranet.com":"//old.leclick.ru"}function i(t){return a(t).parents(".leclick-r-content")}function n(t){i(t).find(".leclick-step.leclick-active").removeClass("leclick-active").prev().addClass("leclick-active")}function r(t){a("#spinner").show();var n=i(t);n.find(".leclick-error").remove();var r=n.attr("id"),o=[];n.find("form.leclick-active").each(function(){o.push(a(this).serialize())});var s=e(),c=n.data("lang");c&&"ru"!=c&&(s+="/"+c),s+="/booking/add/uniqId/"+r;var l=n.data("id");l?s+="/id/"+l:n.data("restaurant-id")&&(s+="/restaurantId/"+n.data("restaurant-id")),a.each(["creator","partner","params","referer"],function(t,e){var i=n.data(e);a.isPlainObject(i)&&(i=JSON.stringify(i)),i&&("referer"==e?o.push(e+"="+encodeURIComponent(i)):s+="/"+e+"/"+encodeURIComponent(i))}),s+="?"+o.join("&"),a.getScript(s)}function o(t,e){var i=[];a.each(e,function(t,e){i.push("<li>"+e+"</li>")}),a('<ul class="leclick-error-list" />').html(i.join("")).insertAfter(t.parents(".leclick-controls"))}function s(t){a(".pay-button").closest("form").attr("action","https://partner.rficb.ru/alba/input/").attr("accept-charset","UTF-8"),a(".pay-button").html('<br><br><input id="orderKey" type="hidden" name="key" value="'+t.row.key+'" /><input type="hidden" id="orderPhone" name="phone_number" value="'+t.row.phone+'" /><input type="hidden" id="orderCost" name="cost" value="'+t.row.cost+'" /><input type="hidden" id="orderName" name="name" value="'+t.row.name+'"/><input type="hidden" id="orderEmail" name="email" value="'+t.row.email+'" />
1<input type="hidden" id="orderId" name="order_id" value="0" /><input type="hidden" id="orderComment" name="comment" value="'+t.row.id+'" /><input type="submit" value="Перейти к оплате" class="leclick-green-btn">').show(),t.body.length&&a("#body-message").html(t.body),a("#popup-close-body").html(t.close_message)}var a=jQuery;window.leclickGetParentBlock=i,window.leclickSchema={},window.leclickDepositBookingTime={},window.leclickBanquetSchema={},window.leclickBanquetDepositBookingTime={},window.schemas={},window.leclickUpdateSchema=function(t,e){var i=[];a.each(e.bookingTime,function(t,e){i.push('<option value="'+e.int+'" data-text="'+e.string+'">'+e.text+"</option>")}),e.banquet?(window.leclickBanquetSchema[t]=e.schema,window.leclickBanquetDepositBookingTime[t]=e.depositBookingTime,a("#"+t+"-rb-time").html(i.join("")).change(),e.schema.specialService?a("#"+t+"-rb-special-service").show():a("#"+t+"-rb-special-service").hide()):(window.schemas[t].setSchema(e.schema),window.leclickSchema[t]=e.schema,window.leclickDepositBookingTime[t]=e.depositBookingTime,a("#"+t+"-rt-time").html(i.join("")).change(),e.schema.specialService?a("#"+t+"-rt-special-service").show():a("#"+t+"-rt-special-service").hide())},window.leclickBookingResult=function(e,i){var n=a("#"+e),r=n.find(".leclick-step.leclick-active:first");switch(r.find(".leclick-error,.leclick-error-block").remove(),n.data("new-id",i.id),i.type){case"success":"undefined"!=typeof Storage&&n.find(".leclick-saveInfo")&&(localStorage.setItem("booking_"+e+"_firstName",n.find(".leclick-firstName").val()),localStorage.setItem("booking_"+e+"_lastName",n.find(".leclick-lastName").val()),localStorage.setItem("booking_"+e+"_email",n.find(".leclick-email").val()),localStorage.setItem("booking_"+e+"_fullPhone",n.find(".leclick-fullPhone").val())),window.buberStats&&window.buberStats.postTransaction({orderId:i.id}),i.row.tinkoffPortalId&&window.parent&&window.parent.postMessage&&window.parent.postMessage(JSON.stringify({portalId:i.row.tinkoffPortalId,orderId:i.row.id,restaurantId:i.row.restaurantId,bookingDateTime:i.row.timeFrom}),"*"),!i.row.tinkoffPortalId&&window.parent&&window.parent.postMessage&&window.parent.postMessage(JSON.stringify({orderId:i.row.id,restaurantId:i.row.restaurantId,restaurantName:i.row.restaurantName,restaurantAddress:i.row.restaurantAddress,clientName:i.row.name,clientMail:i.row.email,clientPhone:i.row.phone,bookingDateTime:i.row.timeFrom,persons:i.row.persons,comment:i.row.comment,wishes:i.row.wishes}),"*"),void 0!==a(".leclick-reservation-btn").attr("data-success-message")&&a(".leclick-reservation-btn").attr("data-success-message").length>0&&a("#body-message").html(a(".leclick-reservation-btn").attr("data-success-message")),i.redirect?(s(i),t(n.find(".leclick-step.leclick-active:last"))):(t(n.find(".leclick-step.leclick-active:last")),n.addClass("leclick-booking-success"));break;case"error":if(i.element)o(n.find("[name="+i.element+"]"),[i.message]);else{var c='<div class="leclick-error-block"><ul class="leclick-error-list-partners"><li>'+i.message+"</span></li></ul></div>";r.find("form").length?r.find("form").prepend(c):n.find("form .leclick-step.leclick-active:first .leclick-step-content").prepend(c)}}a("#spinner").hide(),window.leclickPopup.resize(!0)},window.leclickSendPhoneCode=function(t,e){var i=a("#"+t+" .leclick-step.leclick-active");switch(i.find(".leclick-error").remove(),e.type){case"success":i.find(".leclick-phoneApproveCode-block").show(),i.find(".leclick-sendPhoneCode-block").removeClass("leclick-sendPhoneCode-disabled");break;case"error":i.find("form").prepend('<p class="leclick-error">'+e.message+"</p>"),i.find(".leclick-phoneApproveCode-block").hide(),i.find(".leclick-sendPhoneCode-block").addClass("leclick-sendPhoneCode-disabled")}},window.leclickInviteResult=function(t,e){switch(e.type){case"success":a("#"+t+" .leclick-invitation-block").remove(),window.leclickPopup.close();break;case"error":alert(e.message)}},window.leclickOnResize=function(){a(".leclick-deposit-info").each(function(){var t=a(this),e=t.parents("form");a(window).width()<=460?t.insertAfter(e.find(".leclick-time").parents(".leclick-control-group:first")):t.insertAfter(e.find(".leclick-persons").parents(".leclick-control-group:first"))})},a(function(){function s(t){var e=!0;return a.each(["source"],function(i,n){var r=t.find(".leclick-"+n);!r.length||r.val()||void 0!=r.data("required")&&!r.data("required")||(r.parents(".leclick-control-group").addClass("leclick-error"),e=!1)}),e}function c(t){var e=!0,n=i(t).data("lang"),r="Поле не может быть пустым";n&&"ru"!=n&&(r="The field cannot be empty"),a.each(["firstName","email","phone","fullPhone"],function(i,n){var s=t.find(".leclick-"+n);!s.length||s.val()||void 0!=s.data("required")&&!parseInt(s.data("required"))||(s.parents(".leclick-control-group").addClass("leclick-error"),o(s,[r]),e=!1)});var s=t.find(".leclick-fullPhone");return"7"==s.val()&&(s.parents(".leclick-control-group").addClass("leclick-error"),o(s,[r]),e=!1),e}a(window).resize(function(){window.leclickOnResize()}),a(document).on("click",".leclick-tabs-nav a",function(t){t.preventDefault();var e=a(this);e.parent().addClass("leclick-active").siblings().removeClass("leclick-active"),i(e).find(".leclick-tab-item").removeClass("leclick-tab-active").filter(e.attr("href")).addClass("leclick-tab-active")}),a(document).on("change",".leclick-phoneCode",function(){var t=a(this).find("option:selected"),e=parseInt(t.data("length"));if(!isNaN(e)&&e>0){var n=i(this).find(".leclick-phone");n.attr("maxlength",e).val(n.val().substring(0,e))}}),a(document).on("change",".leclick-time",function(){a(this).prev("label").text(a(this).find("option:selected").data("text"))}),a(document).on("change",".leclick-source",function(){a(this).prev("label").text(a(this).find("option:selected").data("text"))}),a(document).on("change",".leclick-persons",function(){a(this).prev("label").find(".leclick-persons-text").text(a(this).find("option:selected").text())}),a(document).on("change",".leclick-time,.leclick-persons",function(){var t=a(this),e=t.parents("form"),n=i(t).attr("id"),r=e.find(".leclick-time"),o=r.attr("id")==n+"-rb-time",s=window[o?"leclickBanquetDepositBookingTime":"leclickDepositBookingTime"][n][r.val()],c=window.leclickSchema[n].commissions,l=e.find(".leclick-deposit-info"),u=e.find(".leclick-price");
1if(s){l.show(),l.find(".leclick-description").html(s.depositDescription);var h=s.deposit,f=c.length;if(f>0)for(var d=0;d<f;d++)1==c[d].method?h+=c[d].value:h+=Math.round(c[d].value*h*.01);parseInt(s.fixedDeposit)||(h*=e.find(".leclick-persons").val()),u.show(),u.find(".leclick-deposit-price").text(h)}else l.hide(),u.hide()}),a(document).on("change",".leclick-select",function(){a(this).prev("label").text(a(this).find("option:selected").text()||"--")}),a(document).on("click",".leclick-reserve-for-other",function(){a(a(this).data("block")).toggle()}),a(document).on("change",".leclick-date",function(){var t=a(this),n=i(t),r=n.attr("id"),o=e()+"/booking/schema/restaurantId/"+n.data("restaurant-id")+"/uniqId/"+r+"/date/"+t.val();t.attr("id")==r+"-rb-date"&&(o+="/banquet/1"),a.getScript(o)}),a(document).on("change",".leclick-time,.leclick-persons",function(){var t=a(this),e=i(t).attr("id");if(t.attr("id")==e+"-rt-time"||t.attr("id")==e+"-rt-persons"){var n=a("#"+e+"-rt-time").val(),r=a("#"+e+"-rt-persons").val();if(window.leclickSchema[e].halls){var o=['<option value="">--</option>'],s=[];a.each(window.leclickSchema[e].halls,function(t,e){var i=[];a.each(e.tables,function(t,e){-1===a.inArray(n,e.bookingTime)&&parseInt(e.row.persons)>=parseInt(r)&&i.push('<option value="'+e.row.id+'">'+e.row.name+"</option>")}),i.length&&(o.push('<optgroup label="'+e.row.name+'">'+i.join("")+"</optgroup>"),s.push('<option value="'+e.row.id+'">'+e.row.name+"</option>"))});var c=a("#"+e+"-rt-tableId"),l=c.val();c.html(o.join("")).val(l).change(),a("#"+e+"-hallId").html(s.join("")).change()}}}),a(document).on("click",".leclick-next-step",function(){a(this).parents("form").addClass("leclick-active")}),a(document).on("click",".leclick-prev-step",function(){a(this).parents("form").removeClass("leclick-active"),n(this),i(this).find(".leclick-step.leclick-active form").removeClass("leclick-active")}),a(document).on("click",".leclick-next-step1",function(){var e=a(this).parents("form");e.find(".leclick-error-list").remove(),e.find(".leclick-control-group").removeClass("leclick-error"),s(e)&&(i(this).find(".leclick-step2").length?t(this):r(this))}),a(document).on("click",".leclick-next-step2",function(){var t=a(this).parents("form");t.find(".leclick-error-list").remove(),t.find(".leclick-control-group").removeClass("leclick-error"),c(t)&&r(this)}),a(document).on("click",".leclick-next-step-all",function(){var t=a(this).parents("form");t.find(".leclick-error-list").remove(),t.find(".leclick-control-group").removeClass("leclick-error");var e=s(t),i=c(t);e&&i&&r(this)}),a(document).on("click",".leclick-sendPhoneCode",function(){var t=i(a(this));t.find(".leclick-error").remove();var n=t.attr("id"),r=e()+"/booking/change-phone/uniqId/"+n;r+="/phoneCode/"+encodeURIComponent(t.find(".leclick-phoneCode").val()),r+="/phone/"+encodeURIComponent(t.find(".leclick-phone").val()),r+="/fullPhone/"+encodeURIComponent(t.find(".leclick-fullPhone").val()),a.getScript(r)}),a(document).on("click",".leclick-schema-toggle",function(){var t=i(this),e=t.attr("id"),n=t.find(".leclick-schema");0!==parseInt(n.css("left"))?(n.css("left",0),setTimeout(function(){window.schemas[e].calcOffset()},220)):n.css("left","100%")}),a(document).on("change",".leclick-reasonId",function(){var t=a(this);""==t.val()?t.parents(".leclick-control-group:first").find(".leclick-otherReason").show():t.parents(".leclick-control-group:first").find(".leclick-otherReason").hide()}),a(window).bind("beforeunload",function(){a(".leclick-r-content").each(function(){a(this).hasClass("leclick-booking-success")||window.leclickSendInfo(this)})}),a(document).on("click",".leclick-new-invite",function(t){t.preventDefault();var e=i(this).find(".leclick-invite-list"),n=e.find(".leclick-invite:last").clone();n.find("input").val(""),e.append(n),a(this).hide().siblings(".leclick-del-invite").show(),window.leclickPopup.resize(!0)}),a(document).on("click",".leclick-del-invite",function(t){t.preventDefault(),a(this).parents(".leclick-invite:first").remove(),window.leclickPopup.resize(!0)}),a(document).on("click",".leclick-send-invites",function(t){t.preventDefault();var n=[],r=i(this);r.find(".leclick-invite-list .leclick-invites").each(function(){a(this).val()&&n.push(a(this).val())}),n.length&&a.getScript(e()+"/booking/send-invites/uniqId/"+r.attr("id")+"/id/"+r.data("new-id")+"?emails="+encodeURIComponent(n.join(",")))})}),window.leclickSchemaCanvas=function(t){var e=t.__abstracts||[],i=t.__statics||{},n=t.__extend||[];n instanceof Array||(n=[n]);var r;r=t.__construct?t.__construct:n.length?function(){for(var t=0;t<n.length;++t)n[t].apply(this,arguments)}:function(){};var o={};delete t.__construct,delete t.__abstracts,delete t.__statics,delete t.__extend;for(var s=0;s<n.length;++s){var a=n[s];"function"==typeof a.construct&&a.construct.call(r);for(var c in a)"function"==typeof a[c]&&"construct"!=c&&(r[c]=a[c]);for(var c in a.prototype)"function"==typeof a.prototype[c]&&"constructor"!=c&&(o[c]=a.prototype[c])}if(i.__abstracts)for(c=0;c<i.__abstracts.length;++c)o[i.__abstracts[c]]=function(){throw c+" is static abstract method"};for(c=0;c<e.length;++c)o[e[c]]=function(){throw c+" is abstract method"};o.instanceOf=function(t){if(arguments.length>1){for(var e=!0,i=0;i<arguments.length;++i)e=e&&this.instanceOf(arguments[i]);return e}if(r===t)return!0;for(i=0;i<n.length;++i)if(n[i].prototype.instanceOf.call(this,t))return!0;return t===Object};for(var c in t)"function"==typeof t[c]&&(o[c]=t[c]);for(var c in i)"function"==typeof i[c]&&(r[c]=i[c]);return"function"==typeof i.__construct&&i.__construct.call(r),r.prototype=o,r.fn=o,r}({__construct:function(t){this.uniqId=t,this.container=a("#"+t),this.schema=window.leclickSchema[t],this.initCanvas(),this.init()}
1,initCanvas:function(){var t=this;this.canvas=new fabric.Canvas(this.container.find(".leclick-schema canvas").attr("id"),{selection:!1,hoverCursor:"pointer"}),this.canvas.on({"object:selected":function(e){t.selectTable(e.target.id)}}),a(this.container).on("click",".leclick-schema .leclick-tableName",function(){t.selectTable(a(this).data("id"))}),a(this.container).on("change",".leclick-hallId",function(){t.setHall(a(this).val())})},init:function(){this.container.find(".leclick-hallId").change()},calcOffset:function(){this.canvas.calcOffset()},setSchema:function(t){return this.schema=t,this},setHall:function(t){var e=this;if(this.canvas.clear(),this.container.find(".leclick-schema .leclick-tableName").remove(),!this.schema.halls)return this;var i=this.schema.halls[t];if(!i)return this;var n=e.container.find(".leclick-rt-time").val(),r=e.container.find(".leclick-tableId").val(),o=e.container.find(".leclick-rt-persons").val(),s=parseInt(i.row.width),c=parseInt(i.row.height);return this.canvas.setWidth(s),this.canvas.setHeight(c),this._ranks=[],this._elements={},i.decorators&&a.each(i.decorators,function(t,i){e.storeElement(i,"decorator")}),i.tables&&a.each(i.tables,function(t,i){e.storeElement(i,"table",n,o)}),this._ranks.sort(function(t,e){return t-e}),a.each(this._ranks,function(t,i){a.each(e._elements[i],function(t,i){var n={top:i.top,left:i.left,hasControls:!1,hasBorders:!1,lockMovementX:!0,lockMovementY:!0};switch(i.type){case"table":e.createTable(i,n,r);break;case"circle":e.createCircle(i,n);break;case"rectangle":e.createRect(i,n);break;case"text":e.createText(i,n)}})}),this.canvas.renderAll(),this},createTable:function(t,e,i){var n=this;return fabric.Image.fromURL(t.src,function(r){r.id=t.id,r.type="table";var o=t.overlay?"leclick-red":i==t.id?"leclick-brown":"leclick-green",s=a('<span id="'+n.uniqId+"-tableName-"+t.id+'" data-id="'+t.id+'" class="leclick-tableName '+o+'">'+t.name+"</span>").css({position:"absolute",display:"block"});n.container.find(".canvas-container").append(s),s.css({left:e.left-s.outerWidth(!0)/2,top:e.top-s.outerHeight(!0)/2}),a(".canvas-container").append(s),r.setOptions(a.extend({angle:t.angle,perPixelTargetFind:!0,overlay:t.overlay},e)),n.canvas.add(r)}),this},createCircle:function(t,e){var i=new fabric.Circle({perPixelTargetFind:!0,fill:t.color,width:t.width,height:t.height,radius:t.width/2,overlay:!0});return i.setOptions(e),this.canvas.add(i),this},createRect:function(t,e){var i=new fabric.Rect({perPixelTargetFind:!0,fill:t.color,width:t.width,height:t.height,angle:t.angle,overlay:!0});return i.setOptions(e),this.canvas.add(i),this},createText:function(t,e){var i=new fabric.Text(t.name,{fill:t.color,angle:t.angle,fontFamily:"Arial",fontSize:t.fontSize,overlay:!0});return i.setOptions(e),this.canvas.add(i),this},storeElement:function(t,e,i,n){var r=t.row,o=parseInt(r.rank,10);-1===a.inArray(o,this._ranks)&&(this._ranks.push(o),this._elements[o]=[]);var s={id:parseInt(r.id,10),type:"decorator"==e?r.type:"table",name:r.name,top:parseInt(r.top,10),left:parseInt(r.left),angle:r.angle?parseFloat(r.angle):0};switch(e){case"table":s.src=r.image,s.overlay=!(a.inArray(parseInt(i),t.bookingTime)>-1&&r.persons>=n);break;case"decorator":s.width=parseInt(r.width,10),s.height=parseInt(r.height,10),s.color=r.color,s.fontSize=r.fontSize?parseInt(r.fontSize,10):0}return this._elements[o].push(s),this},selectTable:function(t){var e=this;this.container.find(".leclick-tableId").val(t).change(),this.canvas.forEachObject(function(i){if("table"==i.type&&!i.overlay){var n=a("#"+e.uniqId+"-tableName-"+i.id);n.removeClass("leclick-green leclick-brown").addClass(i.id==t?"leclick-brown":"leclick-green").css({left:i.left-n.outerWidth(!0)/2,top:i.top-n.outerHeight(!0)/2})}}),this.container.find(".leclick-schema-toggle:first").trigger("click")}})}();var fabric=fabric||{version:"1.1.0"};"undefined"!=typeof exports&&(exports.fabric=fabric),"undefined"!=typeof document&&"undefined"!=typeof window?(fabric.document=document,fabric.window=window):(fabric.document=require("jsdom").jsdom("<!DOCTYPE html><html><head></head><body></body></html>"),fabric.window=fabric.document.createWindow()),fabric.isTouchSupported="ontouchstart"in fabric.document.documentElement,fabric.isLikelyNode="undefined"!=typeof Buffer&&"undefined"==typeof window;var Cufon=function(){function t(t){var e=this.face=t.face;this.glyphs=t.glyphs,this.w=t.w,this.baseSize=parseInt(e["units-per-em"],10),this.family=e["font-family"].toLowerCase(),this.weight=e["font-weight"],this.style=e["font-style"]||"normal",this.viewBox=function(){var t=e.bbox.split(/\s+/),i={minX:parseInt(t[0],10),minY:parseInt(t[1],10),maxX:parseInt(t[2],10),maxY:parseInt(t[3],10)};return i.width=i.maxX-i.minX,i.height=i.maxY-i.minY,i.toString=function(){return[this.minX,this.minY,this.width,this.height].join(" ")},i}(),this.ascent=-parseInt(e.ascent,10),this.descent=-parseInt(e.descent,10),this.height=-this.ascent+this.descent}function e(){var t={},e={oblique:"italic",italic:"oblique"};this.add=function(e){(t[e.style]||(t[e.style]={}))[e.weight]=e},this.get=function(i,n){var r=t[i]||t[e[i]]||t.normal||t.italic||t.oblique;if(!r)return null;if(n={normal:400,bold:700}[n]||parseInt(n,10),r[n])return r[n];var o,s,a={1:1,99:0}[n%100],c=[];void 0===a&&(a=n>400),500==n&&(n=400);
1for(var l in r)l=parseInt(l,10),(!o||l<o)&&(o=l),(!s||l>s)&&(s=l),c.push(l);return n<o&&(n=o),n>s&&(n=s),c.sort(function(t,e){return(a?t>n&&e>n?t<e:t>e:t<n&&e<n?t>e:t<e)?-1:1}),r[c[0]]}}function i(t){var e={},i={};this.get=function(i){return void 0!=e[i]?e[i]:t[i]},this.getSize=function(t,e){return i[t]||(i[t]=new d.Size(this.get(t),e))},this.extend=function(t){for(var i in t)e[i]=t[i];return this}}function n(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent&&t.attachEvent("on"+e,function(){return i.call(t,fabric.window.event)})}function r(t,e){var i=g.get(t);return i.options?t:(e.hover&&e.hoverables[t.nodeName.toLowerCase()]&&v.attach(t),i.options=e,t)}function o(t){var e={};return function(i){return e.hasOwnProperty(i)||(e[i]=t.apply(null,arguments)),e[i]}}function s(t,e){e||(e=d.getStyle(t));for(var i,n=d.quotedList(e.get("fontFamily").toLowerCase()),r=0,o=n.length;r<o;++r)if(i=n[r],y[i])return y[i].get(e.get("fontStyle"),e.get("fontWeight"));return null}function a(t){return fabric.document.getElementsByTagName(t)}function c(){for(var t,e={},i=0,n=arguments.length;i<n;++i)for(t in arguments[i])e[t]=arguments[i][t];return e}function l(t,e,i,n,r,o){var s=n.separate;if("none"==s)return b[n.engine].apply(null,arguments);var a,c=fabric.document.createDocumentFragment(),l=e.split(k[s]),u="words"==s;u&&p&&(/^\s/.test(e)&&l.unshift(""),/\s$/.test(e)&&l.push(""));for(var h=0,f=l.length;h<f;++h)(a=b[n.engine](t,u?d.textAlign(l[h],i,h,f):l[h],i,n,r,o,h<f-1))&&c.appendChild(a);return c}function u(t,e){for(var i,n,o,a,c=r(t,e).firstChild;c;c=o){if(o=c.nextSibling,a=!1,1==c.nodeType){if(!c.firstChild)continue;if(!/cufon/.test(c.className)){arguments.callee(c,e);continue}a=!0}if(n||(n=d.getStyle(t).extend(e)),i||(i=s(t,n)),i)if(a)b[e.engine](i,null,n,e,c,t);else{var u=c.data;if("undefined"!=typeof G_vmlCanvasManager&&(u=u.replace(/\r/g,"\n")),""!==u){var h=l(i,u,n,e,c,t);h?c.parentNode.replaceChild(h,c):c.parentNode.removeChild(c)}}}}var h=function(){return h.replace.apply(null,arguments)},f=h.DOM={ready:function(){var t=!1,e={loaded:1,complete:1},i=[],r=function(){if(!t){t=!0;for(var e;e=i.shift();e());}};return fabric.document.addEventListener&&(fabric.document.addEventListener("DOMContentLoaded",r,!1),fabric.window.addEventListener("pageshow",r,!1)),!fabric.window.opera&&fabric.document.readyState&&function(){e[fabric.document.readyState]?r():setTimeout(arguments.callee,10)}(),fabric.document.readyState&&fabric.document.createStyleSheet&&function(){try{fabric.document.body.doScroll("left"),r()}catch(t){setTimeout(arguments.callee,1)}}(),n(fabric.window,"load",r),function(e){arguments.length?t?e():i.push(e):r()}}()},d=h.CSS={Size:function(t,e){this.value=parseFloat(t),this.unit=String(t).match(/[a-z%]*$/)[0]||"px",this.convert=function(t){return t/e*this.value},this.convertFrom=function(t){return t/this.value*e},this.toString=function(){return this.value+this.unit}},getStyle:function(t){return new i(t.style)},quotedList:o(function(t){for(var e,i=[],n=/\s*((["'])([\s\S]*?[^\\])\2|[^,]+)\s*/g;e=n.exec(t);)i.push(e[3]||e[1]);return i}),ready:function(){var t=!1,e=[],i=function(){t=!0;for(var i;i=e.shift();i());},n=Object.prototype.propertyIsEnumerable?a("style"):{length:0},r=a("link");return f.ready(function(){for(var t,e=0,o=0,s=r.length;t=r[o],o<s;++o)t.disabled||"stylesheet"!=t.rel.toLowerCase()||++e;fabric.document.styleSheets.length>=n.length+e?i():setTimeout(arguments.callee,10)}),function(i){t?i():e.push(i)}}(),supports:function(t,e){var i=fabric.document.createElement("span").style;return void 0!==i[t]&&(i[t]=e,i[t]===e)},textAlign:function(t,e,i,n){return"right"==e.get("textAlign")?i>0&&(t=" "+t):i<n-1&&(t+=" "),t},textDecoration:function(t,e){e||(e=this.getStyle(t));for(var i={underline:null,overline:null,"line-through":null},n=t;n.parentNode&&1==n.parentNode.nodeType;){var r=!0;for(var o in i)i[o]||(-1!=e.get("textDecoration").indexOf(o)&&(i[o]=e.get("color")),r=!1);if(r)break;e=this.getStyle(n=n.parentNode)}return i},textShadow:o(function(t){if("none"==t)return null;for(var e,i=[],n={},r=0,o=/(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)|(-?[\d.]+[a-z%]*)|,/gi;e=o.exec(t);)","==e[0]?(i.push(n),n={},r=0):e[1]?n.color=e[1]:n[["offX","offY","blur"][r++]]=e[2];return i.push(n),i}),color:o(function(t){var e={};return e.color=t.replace(/^rgba\((.*?),\s*([\d.]+)\)/,function(t,i,n){return e.opacity=parseFloat(n),"rgb("+i+")"}),e}),textTransform:function(t,e){return t[{uppercase:"toUpperCase",lowercase:"toLowerCase"}[e.get("textTransform")]||"toString"]()}},p=0==" ".split(/\s+/).length,g=new function(){function t(t){return t.cufid||(t.cufid=++i)}var e={},i=0;this.get=function(i){var n=t(i);return e[n]||(e[n]={})}},v=new function(){function t(t,e){return t.contains?t.contains(e):16&t.compareDocumentPosition(e)}function e(e){var i=e.relatedTarget;i&&!t(this,i)&&r(this)}function i(t){r(this)}function r(t){setTimeout(function(){h.replace(t,g.get(t).options,!0)},10)}
1this.attach=function(t){void 0===t.onmouseenter?(n(t,"mouseover",e),n(t,"mouseout",e)):(n(t,"mouseenter",i),n(t,"mouseleave",i))}},m=[],b={},y={},x={engine:null,hover:!1,hoverables:{a:!0},printable:!0,selector:fabric.window.Sizzle||fabric.window.jQuery&&function(t){return jQuery(t)}||fabric.window.dojo&&dojo.query||fabric.window.$$&&function(t){return $$(t)}||fabric.window.$&&function(t){return $(t)}||fabric.document.querySelectorAll&&function(t){return fabric.document.querySelectorAll(t)}||a,separate:"words",textShadow:"none"},k={words:/\s+/,characters:""};return h.now=function(){return f.ready(),h},h.refresh=function(){for(var t=m.splice(0,m.length),e=0,i=t.length;e<i;++e)h.replace.apply(null,t[e]);return h},h.registerEngine=function(t,e){return e?(b[t]=e,h.set("engine",t)):h},h.registerFont=function(i){var n=new t(i),r=n.family;return y[r]||(y[r]=new e),y[r].add(n),h.set("fontFamily",'"'+r+'"')},h.replace=function(t,e,i){return(e=c(x,e)).engine?("string"==typeof e.textShadow&&e.textShadow&&(e.textShadow=d.textShadow(e.textShadow)),i||m.push(arguments),(t.nodeType||"string"==typeof t)&&(t=[t]),d.ready(function(){for(var i=0,n=t.length;i<n;++i){var r=t[i];"string"==typeof r?h.replace(e.selector(r),e,!0):u(r,e)}}),h):h},h.replaceElement=function(t,e){return"string"==typeof(e=c(x,e)).textShadow&&e.textShadow&&(e.textShadow=d.textShadow(e.textShadow)),u(t,e)},h.engines=b,h.fonts=y,h.getOptions=function(){return c(x)},h.set=function(t,e){return x[t]=e,h},h}();Cufon.registerEngine("canvas",function(){function t(t,e){var i,n=0,r=0,o=[],s=/([mrvxe])([^a-z]*)/g;t:for(var a=0;i=s.exec(t);++a){var c=i[2].split(",");switch(i[1]){case"v":o[a]={m:"bezierCurveTo",a:[n+~~c[0],r+~~c[1],n+~~c[2],r+~~c[3],n+=~~c[4],r+=~~c[5]]};break;case"r":o[a]={m:"lineTo",a:[n+=~~c[0],r+=~~c[1]]};break;case"m":o[a]={m:"moveTo",a:[n=~~c[0],r=~~c[1]]};break;case"x":o[a]={m:"closePath",a:[]};break;case"e":break t}e[o[a].m].apply(e,o[a].a)}return o}function e(t,e){for(var i=0,n=t.length;i<n;++i){var r=t[i];e[r.m].apply(e,r.a)}}var i=Cufon.CSS.supports("display","inline-block"),n=!i&&("BackCompat"==fabric.document.compatMode||/frameset|transitional/i.test(fabric.document.doctype.publicId)),r=fabric.document.createElement("style");r.type="text/css";var o=fabric.document.createTextNode(".cufon-canvas{text-indent:0}@media screen,projection{.cufon-canvas{display:inline;display:inline-block;position:relative;vertical-align:middle"+(n?"":";font-size:1px;line-height:1px")+"}.cufon-canvas .cufon-alt{display:-moz-inline-box;display:inline-block;width:0;height:0;overflow:hidden}"+(i?".cufon-canvas canvas{position:relative}":".cufon-canvas canvas{position:absolute}")+"}@media print{.cufon-canvas{padding:0 !important}.cufon-canvas canvas{display:none}.cufon-canvas .cufon-alt{display:inline}}");try{r.appendChild(o)}catch(t){r.setAttribute("type","text/css"),r.styleSheet.cssText=o.data}return fabric.document.getElementsByTagName("head")[0].appendChild(r),function(n,r,o,s,a,c){function l(i){W.fillStyle=i||Cufon.textOptions.color||o.get("color");var r=0,a=0;"right"===s.textAlign?W.translate(A[a],0):"center"===s.textAlign&&W.translate(A[a]/2,0);for(var c=0,l=C.length;c<l;++c)if("\n"!==C[c]){var u=n.glyphs[C[c]]||n.missingGlyph;if(u){var h=Number(u.w||n.w)+d;V&&(W.save(),W.strokeStyle=W.fillStyle,W.lineWidth+=W.lineWidth,W.beginPath(),V.underline&&(W.moveTo(0,.5-n.face["underline-position"]),W.lineTo(h,.5-n.face["underline-position"])),V.overline&&(W.moveTo(0,n.ascent+.5),W.lineTo(h,n.ascent+.5)),V["line-through"]&&(W.moveTo(0,.5-n.descent),W.lineTo(h,.5-n.descent)),W.stroke(),W.restore()),q&&(W.save(),W.transform(1,0,-.25,1,0,0)),W.beginPath(),u.d&&(u.code?e(u.code,W):u.code=t("m"+u.d,W)),W.fill(),s.strokeStyle&&(W.closePath(),W.save(),W.lineWidth=s.strokeWidth,W.strokeStyle=s.strokeStyle,W.stroke(),W.restore()),q&&W.restore(),W.translate(h,0),r+=h}}else{a++;var f=-n.ascent-n.ascent/5*s.lineHeight;"right"===s.textAlign?(W.translate(-S,f),W.translate(A[a],0)):"center"===s.textAlign?(W.translate(-r-A[a-1]/2,f),W.translate(A[a]/2,0)):W.translate(-r,f),r=0}}var u=null===r,h=n.viewBox,f=o.getSize("fontSize",n.baseSize),d=o.get("letterSpacing");d="normal"==d?0:f.convertFrom(parseInt(d,10));var p=0,g=0,v=0,m=s.textShadow,b=[];if(Cufon.textOptions.shadowOffsets=[],Cufon.textOptions.shadows=null,m){Cufon.textOptions.shadows=m;for(var y=0,x=m.length;y<x;++y){var k=m[y],w=f.convertFrom(parseFloat(k.offX)),_=f.convertFrom(parseFloat(k.offY));b[y]=[w,_]}}for(var C=Cufon.CSS.textTransform(u?a.alt:r,o).split(""),S=0,E=null,T=0,O=1,P=[],y=0,x=C.length;y<x;++y)if("\n"!==C[y]){var j=n.glyphs[C[y]]||n.missingGlyph;j&&(S+=E=Number(j.w||n.w)+d)}else O++,S>T&&(T=S),P.push(S),S=0;P.push(S),S=Math.max(T,S);for(var A=[],y=P.length;y--;)A[y]=S-P[y];if(null===E)return null;g+=h.width-E,v+=h.minX;var I,M;if(u)I=a,M=a.firstChild;
1else if(I=fabric.document.createElement("span"),I.className="cufon cufon-canvas",I.alt=r,M=fabric.document.createElement("canvas"),I.appendChild(M),s.printable){var D=fabric.document.createElement("span");D.className="cufon-alt",D.appendChild(fabric.document.createTextNode(r)),I.appendChild(D)}var F=I.style,G=M.style||{},L=f.convert(h.height-p+0),R=Math.ceil(L),N=R/L;M.width=Math.ceil(f.convert(S+g-v)*N),M.height=R,p+=h.minY,G.top=Math.round(f.convert(p-n.ascent))+"px",G.left=Math.round(f.convert(v))+"px";var X=Math.ceil(f.convert(S*N)),B=X+"px",Y=f.convert(n.height),z=(s.lineHeight-1)*f.convert(-n.ascent/5)*(O-1);Cufon.textOptions.width=X,Cufon.textOptions.height=Y*O+z,Cufon.textOptions.lines=O,Cufon.textOptions.totalLineHeight=z,i?(F.width=B,F.height=Y+"px"):(F.paddingLeft=B,F.paddingBottom=Y-1+"px");var W=Cufon.textOptions.context||M.getContext("2d"),U=R/h.height;Cufon.textOptions.fontAscent=n.ascent*U,Cufon.textOptions.boundaries=null;for(var H=Cufon.textOptions.shadowOffsets,y=b.length;y--;)H[y]=[b[y][0]*U,b[y][1]*U];W.save(),W.scale(U,U),W.translate(-v-1/U*M.width/2+(Cufon.fonts[n.family].offsetLeft||0),-p-Cufon.textOptions.height/U/2+(Cufon.fonts[n.family].offsetTop||0)),W.lineWidth=n.face["underline-thickness"],W.save();var V=Cufon.getTextDecoration(s),q="italic"===s.fontStyle;if(W.save(),function(){W.save();var t=0,e=0,i=[{left:0}];s.backgroundColor&&(W.save(),W.fillStyle=s.backgroundColor,W.translate(0,n.ascent),W.fillRect(0,0,S+10,(-n.ascent+n.descent)*O),W.restore()),"right"===s.textAlign?(W.translate(A[e],0),i[0].left=A[e]*U):"center"===s.textAlign&&(W.translate(A[e]/2,0),i[0].left=A[e]/2*U);for(var r=0,o=C.length;r<o;++r)if("\n"!==C[r]){var a=n.glyphs[C[r]]||n.missingGlyph;if(a){var c=Number(a.w||n.w)+d;s.textBackgroundColor&&(W.save(),W.fillStyle=s.textBackgroundColor,W.translate(0,n.ascent),W.fillRect(0,0,c+10,-n.ascent+n.descent),W.restore()),W.translate(c,0),t+=c,r==o-1&&(i[i.length-1].width=t*U,i[i.length-1].height=(-n.ascent+n.descent)*U)}}else{e++;var l=-n.ascent-n.ascent/5*s.lineHeight,u=i[i.length-1],h={left:0};u.width=t*U,u.height=(-n.ascent+n.descent)*U,"right"===s.textAlign?(W.translate(-S,l),W.translate(A[e],0),h.left=A[e]*U):"center"===s.textAlign?(W.translate(-t-A[e-1]/2,l),W.translate(A[e]/2,0),h.left=A[e]/2*U):W.translate(-t,l),i.push(h),t=0}W.restore(),Cufon.textOptions.boundaries=i}(),m)for(var y=0,x=m.length;y<x;++y){k=m[y];W.save(),W.translate.apply(W,b[y]),l(k.color),W.restore()}return l(),W.restore(),W.restore(),W.restore(),I}}()),Cufon.registerEngine("vml",function(){function t(t,i){return e(t,/(?:em|ex|%)$/i.test(i)?"1em":i)}function e(t,e){if(/px$/i.test(e))return parseFloat(e);var i=t.style.left,n=t.runtimeStyle.left;t.runtimeStyle.left=t.currentStyle.left,t.style.left=e;var r=t.style.pixelLeft;return t.style.left=i,t.runtimeStyle.left=n,r}if(fabric.document.namespaces){var i=fabric.document.createElement("canvas");if(!(i&&i.getContext&&i.getContext.apply)){null==fabric.document.namespaces.cvml&&fabric.document.namespaces.add("cvml","urn:schemas-microsoft-com:vml");var n=fabric.document.createElement("cvml:shape");if(n.style.behavior="url(#default#VML)",n.coordsize)return n=null,fabric.document.write('
1<style type="text/css">.cufon-vml-canvas{text-indent:0}@media screen{cvml\\:shape,cvml\\:shadow{behavior:url(#default#VML);display:block;antialias:true;position:absolute}.cufon-vml-canvas{position:absolute;text-align:left}.cufon-vml{display:inline-block;position:relative;vertical-align:middle}.cufon-vml .cufon-alt{position:absolute;left:-10000in;font-size:1px}a .cufon-vml{cursor:pointer}}@media print{.cufon-vml *{display:none}.cufon-vml .cufon-alt{display:inline}}</style>'),function(i,n,r,o,s,a,c){var l=null===n;l&&(n=s.alt);var u=i.viewBox,h=r.computedFontSize||(r.computedFontSize=new Cufon.CSS.Size(t(a,r.get("fontSize"))+"px",i.baseSize)),f=r.computedLSpacing;void 0==f&&(f=r.get("letterSpacing"),r.computedLSpacing=f="normal"==f?0:~~h.convertFrom(e(a,f)));var d,p;if(l)d=s,p=s.firstChild;else{if(d=fabric.document.createElement("span"),d.className="cufon cufon-vml",d.alt=n,p=fabric.document.createElement("span"),p.className="cufon-vml-canvas",d.appendChild(p),o.printable){var g=fabric.document.createElement("span");g.className="cufon-alt",g.appendChild(fabric.document.createTextNode(n)),d.appendChild(g)}c||d.appendChild(fabric.document.createElement("cvml:shape"))}var v=d.style,m=p.style,b=h.convert(u.height),y=Math.ceil(b),x=y/b,k=u.minX,w=u.minY;m.height=y,m.top=Math.round(h.convert(w-i.ascent)),m.left=Math.round(h.convert(k)),v.height=h.convert(i.height)+"px";Cufon.getTextDecoration(o);for(var _,C,S=r.get("color"),E=Cufon.CSS.textTransform(n,r).split(""),T=0,O=0,P=null,j=o.textShadow,A=0,I=0,M=E.length;A<M;++A)(_=i.glyphs[E[A]]||i.missingGlyph)&&(T+=P=~~(_.w||i.w)+f);if(null===P)return null;var D,F=-k+T+(u.width-P),G=h.convert(F*x),L=Math.round(G),R=F+","+u.height,N="r"+R+"nsnf";for(A=0;A<M;++A)if(_=i.glyphs[E[A]]||i.missingGlyph){l?(C=p.childNodes[I]).firstChild&&C.removeChild(C.firstChild):(C=fabric.document.createElement("cvml:shape"),p.appendChild(C)),C.stroked="f",C.coordsize=R,C.coordorigin=D=k-O+","+w,C.path=(_.d?"m"+_.d+"xe":"")+"m"+D+N,C.fillcolor=S;var X=C.style;if(X.width=L,X.height=y,j){var B,Y=j[0],z=j[1],W=Cufon.CSS.color(Y.color),U=fabric.document.createElement("cvml:shadow");U.on="t",U.color=W.color,U.offset=Y.offX+","+Y.offY,z&&(B=Cufon.CSS.color(z.color),U.type="double",U.color2=B.color,U.offset2=z.offX+","+z.offY),U.opacity=W.opacity||B&&B.opacity||1,C.appendChild(U)}O+=~~(_.w||i.w)+f,++I}return v.width=Math.max(Math.ceil(h.convert(T*x)),0),d}}}}()),Cufon.getTextDecoration=function(t){return{underline:"underline"===t.textDecoration,overline:"overline"===t.textDecoration,"line-through":"line-through"===t.textDecoration}},"undefined"!=typeof exports&&(exports.Cufon=Cufon);var JSON;
1if(JSON||(JSON={}),function(){"use strict";function f(t){return t<10?"0"+t:t}function quote(t){return escapable.lastIndex=0,escapable.test(t)?'"'+t.replace(escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var i,n,r,o,s,a=gap,c=e[t];switch(c&&"object"==typeof c&&"function"==typeof c.toJSON&&(c=c.toJSON(t)),"function"==typeof rep&&(c=rep.call(e,t,c)),typeof c){case"string":return quote(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";if(gap+=indent,s=[],"[object Array]"===Object.prototype.toString.apply(c)){for(o=c.length,i=0;i<o;i+=1)s[i]=str(i,c)||"null";return r=0===s.length?"[]":gap?"[\n"+gap+s.join(",\n"+gap)+"\n"+a+"]":"["+s.join(",")+"]",gap=a,r}if(rep&&"object"==typeof rep)for(o=rep.length,i=0;i<o;i+=1)"string"==typeof rep[i]&&(r=str(n=rep[i],c))&&s.push(quote(n)+(gap?": ":":")+r);else for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(r=str(n,c))&&s.push(quote(n)+(gap?": ":":")+r);return r=0===s.length?"{}":gap?"{\n"+gap+s.join(",\n"+gap)+"\n"+a+"}":"{"+s.join(",")+"}",gap=a,r}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(t){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(t){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(t,e,i){var n;if(gap="",indent="","number"==typeof i)for(n=0;n<i;n+=1)indent+=" ";else"string"==typeof i&&(indent=i);if(rep=e,e&&"function"!=typeof e&&("object"!=typeof e||"number"!=typeof e.length))throw new Error("JSON.stringify");return str("",{"":t})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(t,e){var i,n,r=t[e];if(r&&"object"==typeof r)for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(void 0!==(n=walk(r,i))?r[i]=n:delete r[i]);return reviver.call(t,e,r)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(t){return"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),void 0===Event)var Event={};if(void 0===eventjs)var eventjs=Event;if(void 0===(Event=function(t){"use strict";t.modifyEventListener=!1,t.modifySelectors=!1,t.add=function(t,e,n,r){return i(t,e,n,r,"add")},t.remove=function(t,e,n,r){return i(t,e,n,r,"remove")},t.stop=function(t){t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.bubble=0},t.prevent=function(t){t.preventDefault&&t.preventDefault(),t.returnValue=!1},t.cancel=function(e){t.stop(e),t.prevent(e)},t.supports=function(t,e){if("string"==typeof t&&(e=t,t=window),(e="on"+e)in t)return!0;if(t.setAttribute||(t=document.createElement("div")),t.setAttribute&&t.removeAttribute){t.setAttribute(e,"");var i="function"==typeof t[e];return void 0!==t[e]&&(t[e]=null),t.removeAttribute(e),i}};var e=function(t){if(!t||"object"!=typeof t)return t;var i=new t.constructor;for(var n in t)t[n]&&"object"==typeof t[n]?i[n]=e(t[n]):i[n]=t[n];return i},i=function(a,h,f,d,p,g){d=d||{};{if("string"!=typeof a||"ready"!==h){if("string"==typeof a){if(0===(a=document.querySelectorAll(a)).length)return r("Missing target on listener!");1===a.length&&(a=a[0])}var v,m={};if(a.length>0){for(var b=0,y=a.length;b<y;b++)(v=i(a[b],h,f,e(d),p))&&(m[b]=v);return n(m)}if(h.indexOf&&-1!==h.indexOf(" ")&&(h=h.split(" ")),h.indexOf&&-1!==h.indexOf(",")&&(h=h.split(",")),"string"!=typeof h){if("number"==typeof h.length)for(var x=0,k=h.length;x<k;x++)(v=i(a,h[x],f,e(d),p))&&(m[h[x]]=v);else for(var w in h)(v="function"==typeof h[w]?i(a,w,h[w],e(d),p):i(a,w,h[w].listener,e(h[w]),p))&&(m[w]=v);return n(m)}if("function"!=typeof f)return r("Listener is not a function!");var _=d.useCapture||!1,C=o(h)+c(a)+"."+c(f)+"."+(_?1:0);if(t.Gesture&&t.Gesture._gestureHandlers[h]){if("remove"===p){if(!s[C])return;s[C].remove(),delete s[C]}else if("add"===p){if(s[C])return s[C];if(d.useCall&&!t.modifyEventListener){var S=f;f=function(t,e){for(var i in e)t[i]=e[i];return S.call(a,t)}}d.gesture=h,d.target=a,d.listener=f,d.fromOverwrite=g,s[C]=t.proxy[h](d)}}else if(h=o(h),"remove"===p){if(!s[C])return;a[u](h,f,_),delete s[C]}else if("add"===p){if(s[C])return s[C];a[l](h,f,_),s[C]={type:h,target:a,listener:f,remove:function(){t.remove(a,h,f,d)}}}return s[C]}var E=(new Date).getTime(),T=d.timeout,O=d.interval||1e3/60,P=window.setInterval(function(){(new Date).getTime()-E>T&&window.clearInterval(P),document.querySelector(a)&&(window.clearInterval(P),f())},O)}},n=function(t){return{remove:function(){for(var e in t)t[e].remove()},add:function(){for(var e in t)t[e].add()}}},r=function(t){"undefined"!=typeof console&&void 0!==console.error&&console.error(t)},o=function(){var e={};return function(i){return t.pointerType||(window.navigator.msPointerEnabled?(t.pointerType="mspointer",e={mousedown:"MSPointerDown",mousemove:"MSPointerMove",mouseup:"MSPointerUp"}):t.supports("touchstart")?(t.pointerType="touch",e={mousedown:"touchstart",mouseup:"touchend",mousemove:"touchmove"}):t.pointerType="mouse"),e[i]&&(i=e[i]),document.addEventListener?i:"on"+i}}(),s={},a=0,c=function(t){return t===window?"#window":t===document?"#document":t?(t.uniqueID||(t.uniqueID="id"+a++),t.uniqueID):r("Missing target on listener!")},l=document.addEventListener?"addEventListener":"attachEvent",u=document.removeEventListener?"removeEventListener":"detachEvent";return t.createPointerEvent=function(e,i,n){var r=i.gesture,o=i.target,s=e.changedTouches||t.proxy.getCoords(e);if(s.length){var a=s[0];
1i.pointers=n?[]:s,i.pageX=a.pageX,i.pageY=a.pageY,i.x=i.pageX,i.y=i.pageY}var c=document.createEvent("Event");c.initEvent(r,!0,!0),c.originalEvent=e;for(var l in i)"target"!==l&&(c[l]=i[l]);o.dispatchEvent(c)},t.modifyEventListener&&window.HTMLElement&&function(){var e=function(e){var n=function(n){var r=n+"EventListener",s=e[r];e[r]=function(e,r,a){if(t.Gesture&&t.Gesture._gestureHandlers[e]){var c=a;"object"==typeof a?c.useCall=!0:c={useCall:!0,useCapture:a},i(this,e,r,c,n,!0),s.call(this,e,r,a)}else s.call(this,o(e),r,a)}};n("add"),n("remove")};navigator.userAgent.match(/Firefox/)?(e(HTMLDivElement.prototype),e(HTMLCanvasElement.prototype)):e(HTMLElement.prototype),e(document),e(window)}(),t.modifySelectors&&function(){var t=NodeList.prototype;t.removeEventListener=function(t,e,i){for(var n=0,r=this.length;n<r;n++)this[n].removeEventListener(t,e,i)},t.addEventListener=function(t,e,i){for(var n=0,r=this.length;n<r;n++)this[n].addEventListener(t,e,i)}}(),t}(Event)))var Event={};if(void 0===Event.proxy&&(Event.proxy={}),Event.proxy=function(t){"use strict";return t.pointerSetup=function(t,e){t.doc=t.target.ownerDocument||t.target,t.minFingers=t.minFingers||t.fingers||1,t.maxFingers=t.maxFingers||t.fingers||1/0,t.position=t.position||"relative",delete t.fingers,(e=e||{}).gesture=t.gesture,e.target=t.target,e.pointerType=Event.pointerType,Event.modifyEventListener&&t.fromOverwrite&&(t.listener=Event.createPointerEvent);var i=0,n=0===e.gesture.indexOf("pointer")&&Event.modifyEventListener?"pointer":"mouse";return e.listener=t.listener,e.proxy=function(i){e.defaultListener=t.listener,t.listener=i,i(t.event,e)},e.remove=function(){t.onPointerDown&&Event.remove(t.target,n+"down",t.onPointerDown),t.onPointerMove&&Event.remove(t.doc,n+"move",t.onPointerMove),t.onPointerUp&&Event.remove(t.doc,n+"up",t.onPointerUp)},e.resume=function(e){!t.onPointerMove||e&&!e.move||Event.add(t.doc,n+"move",t.onPointerMove),!t.onPointerUp||e&&!e.move||Event.add(t.doc,n+"up",t.onPointerUp),t.fingers=i},e.pause=function(e){i=t.fingers,!t.onPointerMove||e&&!e.move||Event.remove(t.doc,n+"move",t.onPointerMove),!t.onPointerUp||e&&!e.up||Event.remove(t.doc,n+"up",t.onPointerUp),t.fingers=0},e},t.pointerStart=function(e,i,n){var r=function(t,e){var i=n.bbox,r=s[e]={};switch(n.position){case"absolute":r.offsetX=0,r.offsetY=0;break;case"difference":r.offsetX=t.pageX,r.offsetY=t.pageY;break;case"move":r.offsetX=t.pageX-i.x1,r.offsetY=t.pageY-i.y1;break;default:r.offsetX=i.x1,r.offsetY=i.y1}if("relative"===n.position)var o=(t.pageX+i.scrollLeft-r.offsetX)*i.scaleX,a=(t.pageY+i.scrollTop-r.offsetY)*i.scaleY;else var o=t.pageX-r.offsetX,a=t.pageY-r.offsetY;r.rotation=0,r.scale=1,r.startTime=r.moveTime=(new Date).getTime(),r.move={x:o,y:a},r.start={x:o,y:a},n.fingers++};n.event=e,i.defaultListener&&(n.listener=i.defaultListener,delete i.defaultListener);for(var o=!n.fingers,s=n.tracker,a=e.changedTouches||t.getCoords(e),c=a.length,l=0;l<c;l++){var u=a[l],h=u.identifier||1/0;if(n.fingers){if(n.fingers>=n.maxFingers){d=[];for(var h in n.tracker)d.push(h);return i.identifier=d.join(","),o}for(var f in s){if(s[f].up){delete s[f],r(u,h),n.cancel=!0;break}0}if(s[h])continue;r(u,h)}else s=n.tracker={},i.bbox=n.bbox=t.getBoundingBox(n.target),n.fingers=0,n.cancel=!1,r(u,h)}var d=[];for(var h in n.tracker)d.push(h);return i.identifier=d.join(","),o},t.pointerEnd=function(t,e,i,n){for(var r=t.touches||[],o=r.length,s={},a=0;a<o;a++)s[(c=r[a].identifier)||1/0]=!0;for(var c in i.tracker){var l=i.tracker[c];s[c]||l.up||(n&&n({pageX:l.pageX,pageY:l.pageY,changedTouches:[{pageX:l.pageX,pageY:l.pageY,identifier:"Infinity"===c?1/0:c}]},"up"),l.up=!0,i.fingers--)}if(0!==i.fingers)return!1;var u=[];i.gestureFingers=0;for(var c in i.tracker)i.gestureFingers++,u.push(c);return e.identifier=u.join(","),!0},t.getCoords=function(e){return void 0!==e.pageX?t.getCoords=function(t){return Array({type:"mouse",x:t.pageX,y:t.pageY,pageX:t.pageX,pageY:t.pageY,identifier:1/0})}:t.getCoords=function(t){return t=t||window.event,Array({type:"mouse",x:t.clientX+document.documentElement.scrollLeft,y:t.clientY+document.documentElement.scrollTop,pageX:t.clientX+document.documentElement.scrollLeft,pageY:t.clientY+document.documentElement.scrollTop,identifier:1/0})},t.getCoords(e)},t.getCoord=function(e){if("ontouchstart"in window){var i=0,n=0;t.getCoord=function(t){var e=t.changedTouches;return e.length?{x:i=e[0].pageX,y:n=e[0].pageY}:{x:i,y:n}}}else void 0!==e.pageX&&void 0!==e.pageY?t.getCoord=function(t){return{x:t.pageX,y:t.pageY}}:t.getCoord=function(t){return t=t||window.event,{x:t.clientX+document.documentElement.scrollLeft,y:t.clientY+document.documentElement.scrollTop}};return t.getCoord(e)},t.getBoundingBox=function(t){t!==window&&t!==document||(t=document.body);var e={x1:0,y1:0,x2:0,y2:0,scrollLeft:0,scrollTop:0};t===document.body?(e.height=window.innerHeight,e.width=window.innerWidth):(e.height=t.offsetHeight,e.width=t.offsetWidth),e.scaleX=t.width/e.width||1,e.scaleY=t.height/e.he
1ight||1;for(i=t;null!==i;)e.x1+=i.offsetLeft,e.y1+=i.offsetTop,i=i.offsetParent;for(var i=t.parentNode;null!==i&&i!==document.body&&void 0!==i.scrollTop;)e.scrollLeft+=i.scrollLeft,e.scrollTop+=i.scrollTop,i=i.parentNode;return e.x2=e.x1+e.width,e.y2=e.y1+e.height,e},function(){var e=navigator.userAgent.toLowerCase(),i=-1!==e.indexOf("macintosh");if(i&&-1!==e.indexOf("khtml"))n={91:!0,93:!0};else if(i&&-1!==e.indexOf("firefox"))n={224:!0};else var n={17:!0};t.isMetaKey=function(t){return!!n[t.keyCode]},t.metaTracker=function(e){n[e.keyCode]&&(t.metaKey="keydown"===e.type)}}(),t}(Event.proxy),void 0===Event)var Event={};if(void 0===Event.proxy&&(Event.proxy={}),Event.proxy=function(t){"use strict";return t.click=function(e){e.maxFingers=e.maxFingers||e.fingers||1;var i;e.onPointerDown=function(i){t.pointerStart(i,n,e)&&(Event.add(e.doc,"mousemove",e.onPointerMove).listener(i),Event.add(e.doc,"mouseup",e.onPointerUp))},e.onPointerMove=function(t){i=t},e.onPointerUp=function(r){if(t.pointerEnd(r,n,e)){if(Event.remove(e.doc,"mousemove",e.onPointerMove),Event.remove(e.doc,"mouseup",e.onPointerUp),i.cancelBubble&&++i.bubble>1)return;var o=(i.changedTouches||t.getCoords(i))[0],s=e.bbox,a=t.getBoundingBox(e.target);if("relative"===e.position)var c=(o.pageX+s.scrollLeft-s.x1)*s.scaleX,l=(o.pageY+s.scrollTop-s.y1)*s.scaleY;else var c=o.pageX-s.x1,l=o.pageY-s.y1;c>0&&c<s.width&&l>0&&l<s.height&&s.scrollTop===a.scrollTop&&e.listener(i,n)}};var n=t.pointerSetup(e);return n.state="click",Event.add(e.target,"mousedown",e.onPointerDown),n},Event.Gesture=Event.Gesture||{},Event.Gesture._gestureHandlers=Event.Gesture._gestureHandlers||{},Event.Gesture._gestureHandlers.click=t.click,t}(Event.proxy),void 0===Event)var Event={};if(void 0===Event.proxy&&(Event.proxy={}),Event.proxy=function(t){"use strict";return t.dbltap=t.dblclick=function(e){e.maxFingers=e.maxFingers||e.fingers||1;var i,n,r,o,s;e.onPointerDown=function(c){var l=c.changedTouches||t.getCoords(c);i&&!n?(s=l[0],n=(new Date).getTime()-i):(o=l[0],i=(new Date).getTime(),n=0,clearTimeout(r),r=setTimeout(function(){i=0},700)),t.pointerStart(c,a,e)&&(Event.add(e.doc,"mousemove",e.onPointerMove).listener(c),Event.add(e.doc,"mouseup",e.onPointerUp))},e.onPointerMove=function(a){if(i&&!n){var c=a.changedTouches||t.getCoords(a);s=c[0]}var l=e.bbox;if("relative"===e.position)var u=(s.pageX+l.scrollLeft-l.x1)*l.scaleX,h=(s.pageY+l.scrollTop-l.y1)*l.scaleY;else var u=s.pageX-l.x1,h=s.pageY-l.y1;u>0&&u<l.width&&h>0&&h<l.height&&Math.abs(s.pageX-o.pageX)<=25&&Math.abs(s.pageY-o.pageY)<=25||(Event.remove(e.doc,"mousemove",e.onPointerMove),clearTimeout(r),i=n=0)},e.onPointerUp=function(o){t.pointerEnd(o,a,e)&&(Event.remove(e.doc,"mousemove",e.onPointerMove),Event.remove(e.doc,"mouseup",e.onPointerUp)),i&&n&&(n<=700&&!(o.cancelBubble&&++o.bubble>1)&&(a.state=e.gesture,e.listener(o,a)),clearTimeout(r),i=n=0)};var a=t.pointerSetup(e);return a.state="dblclick",Event.add(e.target,"mousedown",e.onPointerDown),a},Event.Gesture=Event.Gesture||{},Event.Gesture._gestureHandlers=Event.Gesture._gestureHandlers||{},Event.Gesture._gestureHandlers.dbltap=t.dbltap,Event.Gesture._gestureHandlers.dblclick=t.dblclick,t}(Event.proxy),void 0===Event)var Event={};if(void 0===Event.proxy&&(Event.proxy={}),Event.proxy=function(t){"use strict";return t.dragElement=function(e,i){t.drag({event:i,target:e,position:"move",listener:function(t,i){e.style.left=i.x+"px",e.style.top=i.y+"px",Event.prevent(t)}})},t.drag=function(e){e.gesture="drag",e.onPointerDown=function(n){t.pointerStart(n,i,e)&&(e.monitor||(Event.add(e.doc,"mousemove",e.onPointerMove),Event.add(e.doc,"mouseup",e.onPointerUp))),e.onPointerMove(n,"down")},e.onPointerMove=function(n,r){if(!e.tracker)return e.onPointerDown(n);for(var o=e.bbox,s=n.changedTouches||t.getCoords(n),a=s.length,c=0;c<a;c++){var l=s[c],u=l.identifier||1/0,h=e.tracker[u];h&&(h.pageX=l.pageX,h.pageY=l.pageY,i.state=r||"move",i.identifier=u,i.start=h.start,i.fingers=e.fingers,"relative"===e.position?(i.x=(h.pageX+o.scrollLeft-h.offsetX)*o.scaleX,i.y=(h.pageY+o.scrollTop-h.offsetY)*o.scaleY):(i.x=h.pageX-h.offsetX,i.y=h.pageY-h.offsetY),e.listener(n,i))}},e.onPointerUp=function(n){t.pointerEnd(n,i,e,e.onPointerMove)&&(e.monitor||(Event.remove(e.doc,"mousemove",e.onPointerMove),Event.remove(e.doc,"mouseup",e.onPointerUp)))};var i=t.pointerSetup(e);return e.event?e.onPointerDown(e.event):(Event.add(e.target,"mousedown",e.onPointerDown),e.monitor&&(Event.add(e.doc,"mousemove",e.onPointerMove),Event.add(e.doc,"mouseup",e.onPointerUp))),i},Event.Gesture=Event.Gesture||{},Event.Gesture._gestureHandlers=Event.Gesture._gestureHandlers||{},Event.Gesture._gestureHandlers.drag=t.drag,t}(Event.proxy),void 0===Event)var Event={};if(void 0===Event.proxy&&(Event.proxy={}),Event.proxy=function(t){"use strict";var e=Math.PI/180;return t.gesture=function(i){i.minFingers=i.minFingers||i.fingers||2,i.onPointerDown=function(e){var r=i.fingers;if(t.pointerStart(e,n,i)&&(Event.add(i.doc,"mousemove",i.onPointerMove),Event.add(i.doc,"mouseup",i.onPointerUp)),i.fingers===i.minFingers&&r!==i.fingers){n.fingers=i.minFingers,n.scale=1,n.rotation=0,n.state="start";var o="";for(var s in i.tracker)o+=s;n.identifier=parseInt(o),i.listener(e,n)}},i.onPointerMove=function(r,o){for(var s=i.bbox,a=i.tracker,c=(h=r.changedTouches||t.getCoords(r)).length,l=0;l<c;l++){var u=a[v=(m=h[l]).identifier||1/0];u&&("relative"===i.position?(u.move.x=(m.pageX+s.scrollLeft-s.x1)*s.scaleX,u.move.y=(m.pageY+s.scrollTop-s.y1)*s.scaleY):(u.move.x=m.pageX-s.x1,u.move.y=m.pageY-s.y1))}if(!(i.fingers<i.minFingers)){var h=[],f=0,d=0,p=0,g=0,c=0;for(var v in a)(m=a[v]).up||(p+=m.move.x,g+=m.move.y,c++);p/=c,g/=c;for(var v in a){var m=a[v];if(!m.up){var b=m.start;if(!b.distance){var y=b.x-p,x=b.y-g;b.distance=Math.sqrt(y*y+x*x),b.angle=Math.atan2(y,x)/e}var y=m.move.x-p,x=m.move.y-g;f+=Math.sqrt(y*y+x*x)/b.distance;var k=Math.atan2(y,x)/e,w=(b.angle-k+360)%360-180;m.DEG2=m.DEG1,m.DEG1=w>0?w:-w,void 0!==m.DEG2&&(w>0?m.rotation+=m.DEG1-m.DEG2:m.rotation-=m.DEG1-m.DEG2,d+=m.rotation),h.push(m.move)}}n.touches=h,n.fingers=i.fingers,n.scale=f/i.fingers,n.rotation=d/i.fingers,n.state="change",i.listener(r,n)}},i.onPointerUp=function(e){var r=i.fingers;t.pointerEnd(e,n,i)&&(Event.remove(i.doc,"mousemove",i.onPointerMove),Event.remove(i.doc,"mouseup",i.onPointerUp)),r===i.minFingers&&i.fingers<i.minFingers&&(n.fingers=i.fingers,n.state="end",i.listener(e,n))};var n=t.pointerSetup(i);return Event.add(i.target,"mousedown",i.onPointerDown),n},Event.Gesture=Event.Gesture||{},Event.Gesture._gestureHandlers=Event.Gesture._gestureHandlers||{},Event.Gesture._gestureHandlers.gesture=t.gesture,t}(Event.proxy),void 0===Event)var Event={};if(void 0===Event.proxy&&(Event.proxy={}),Event.proxy=function(t){"use strict";return t.pointerdown=t.pointermove=t.pointerup=function(e){if(!e.target.isPointerEmitter){var i=!0;e.onPointerDown=function(t){i=!1,n.gesture="pointerdown",e.listener(t,n)},e.onPointerMove=function(t){n.gesture="pointermove",e.listener(t,n,i)},e.onPointerUp=function(t){i=!0,n.gesture="pointerup",e.listener(t,n,!0)};var n=t.pointerSetup(e);return Event.add(e.target,"mousedown",e.onPointerDown),Event.add(e.target,"mousemove",e.onPointerMove),Event.add(e.doc,"mouseup",e.onPointerUp),e.target.isPointerEmitter=!0,n}},Event.Gesture=Event.Gesture||{},Event.Gesture._gestureHandlers=Event.Gesture._gestureHandlers||{},Event.Gesture._gestureHandlers.pointerdown=t.pointerdown,Event.Gesture._gestureHandlers.pointermove=t.pointermove,Event.Gesture._gestureHandlers.pointerup=t.pointerup,t}(Event.proxy),void 0===Event)var Event={};if(void 0===Event.proxy&&(Event.proxy={}),Event.proxy=function(t){"use strict";return t.shake=function(t){var e={gesture:"devicemotion",acceleration:{},accelerationIncludingGravity:{},target:t.target,listener:t.listener,remove:function(){window.removeEventListener("devicemotion",o,!1)}},i=(new Date).getTime(),n={x:0,y:0,z:0},r={x:{count:0,value:0},y:{count:0,value:0},z:{count:0,value:0}},o=function(o){var s=o.accelerationIncludingGravity;if(n.x=.8*n.x+(1-.8)*s.x,n.y=.8*n.y+(1-.8)*s.y,n.z=.8*n.z+(1-.8)*s.z,e.accelerationIncludingGravity=n,e.acceleration.x=s.x-n.x,e.acceleration.y=s.y-n.y,e.acceleration.z=s.z-n.z,"devicemotion"!==t.gesture)for(var a=(new Date).getTime(),c=0,l="xyz".length;c<l;c++){var u="xyz"[c],h=e.acceleration[u],f=r[u],d=Math.abs(h);if(!(a-i<1e3)&&d>4){var p=a*h/d,g=Math.abs(p+f.value);f.value&&g<200?(f.value=p,f.count++,3===f.count&&(t.listener(o,e),i=a,f.value=0,f.count=0)):(f.value=p,f.count=1)}}else t.listener(o,e)};if(window.addEventListener)return window.addEventListener("devicemotion",o,!1),e},Event.Gesture=Event.Gesture||{},Event.Gesture._gestureHandlers=Event.Gesture._gestureHandlers||{},Event.Gesture._gestureHandlers.shake=t.shake,t}(Event.proxy),void 0===Event)var Event={};if(void 0===Event.proxy&&(Event.proxy={}),Event.proxy=function(t){"use strict";var e=Math.PI/180;return t.swipe=function(i){i.snap=i.snap||90,i.threshold=i.threshold||1,i.onPointerDown=function(e){t.pointerStart(e,n,i)&&(Event.add(i.doc,"mousemove",i.onPointerMove).listener(e),Event.add(i.doc,"mouseup",i.onPointerUp))},i.onPointerMove=function(e){for(var n=e.changedTouches||t.getCoords(e),r=n.length,o=0;o<r;o++){var s=n[o],a=s.identifier||1/0,c=i.tracker[a];c&&(c.move.x=s.pageX,c.move.y=s.pageY,c.moveTime=(new Date).getTime())}},i.onPointerUp=function(r){if(t.pointerEnd(r,n,i)){Event.remove(i.doc,"mousemove",i.onPointerMove),Event.remove(i.doc,"mouseup",i.onPointerUp);var o,s,a={x:0,y:0},c=0,l=0,u=0;for(var h in i.tracker){var f=i.tracker[h],d=f.move.x-f.start.x,p=f.move.y-f.start.y;c+=f.move.x,l+=f.move.y,a.x+=f.start.x,a.y+=f.start.y,u++;var g=Math.sqrt(d*d+p*p),v=f.moveTime-f.startTime,m=Math.atan2(d,p)/e+180,b=v?g/v:0;if(void 0===s)s=m,o=b;else{if(!(Math.abs(m-s)<=20))return;s=(s+m)/2,o=(o+b)/2}}o>i.threshold&&(a.x/=u,a.y/=u,n.start=a,n.x=c/u,n.y=l/u,n.angle=-(((s/i.snap+.5>>0)*i.snap||360)-360),n.velocity=o,n.fingers=i.gestureFingers,n.state="swipe",i.listener(r,n))}};var n=t.pointerSetup(i);return Event.add(i.target,"mousedown",i.onPointerDown),n},Event.Gesture=Event.Gesture||{},Event.Gesture._gestureHandlers=Event.Gesture._gestureHandlers||{},Event.Gesture._gestureHandlers.swipe=t.swipe,t}(Event.proxy),void 0===Event)var Event={};if(void 0===Event.proxy&&(Event.proxy={}),Event.proxy=function(t){"use strict";return t.tap=t.longpress=function(e){e.delay=e.delay||500,e.timeout=e.timeout||250;var i,n;
1e.onPointerDown=function(o){if(t.pointerStart(o,r,e)){if(i=(new Date).getTime(),Event.add(e.doc,"mousemove",e.onPointerMove).listener(o),Event.add(e.doc,"mouseup",e.onPointerUp),"longpress"!==e.gesture)return;n=setTimeout(function(){if(!(o.cancelBubble&&++o.bubble>1)){var t=0;for(var i in e.tracker){if(!0===e.tracker[i].end)return;if(e.cancel)return;t++}r.state="start",r.fingers=t,e.listener(o,r)}},e.delay)}},e.onPointerMove=function(i){for(var n=e.bbox,r=i.changedTouches||t.getCoords(i),o=r.length,s=0;s<o;s++){var a=r[s],c=a.identifier||1/0,l=e.tracker[c];if(l){if("relative"===e.position)var u=(a.pageX+n.scrollLeft-n.x1)*n.scaleX,h=(a.pageY+n.scrollTop-n.y1)*n.scaleY;else var u=a.pageX-n.x1,h=a.pageY-n.y1;if(!(u>0&&u<n.width&&h>0&&h<n.height&&Math.abs(u-l.start.x)<=25&&Math.abs(h-l.start.y)<=25))return Event.remove(e.doc,"mousemove",e.onPointerMove),void(e.cancel=!0)}}},e.onPointerUp=function(o){if(t.pointerEnd(o,r,e)){if(clearTimeout(n),Event.remove(e.doc,"mousemove",e.onPointerMove),Event.remove(e.doc,"mouseup",e.onPointerUp),o.cancelBubble&&++o.bubble>1)return;if("longpress"===e.gesture)return void("start"===r.state&&(r.state="end",e.listener(o,r)));if(e.cancel)return;if((new Date).getTime()-i>e.timeout)return;r.state="tap",r.fingers=e.gestureFingers,e.listener(o,r)}};var r=t.pointerSetup(e);return Event.add(e.target,"mousedown",e.onPointerDown),r},Event.Gesture=Event.Gesture||{},Event.Gesture._gestureHandlers=Event.Gesture._gestureHandlers||{},Event.Gesture._gestureHandlers.tap=t.tap,Event.Gesture._gestureHandlers.longpress=t.longpress,t}(Event.proxy),void 0===Event)var Event={};void 0===Event.proxy&&(Event.proxy={}),Event.proxy=function(t){"use strict";return t.wheel=function(t){var e,i=t.timeout||150,n=0,r={gesture:"wheel",state:"start",wheelDelta:0,target:t.target,listener:t.listener,remove:function(){t.target[a](c,o,!1)}},o=function(o){o=o||window.event,r.state=n++?"change":"start",r.wheelDelta=o.detail?-20*o.detail:o.wheelDelta,t.listener(o,r),clearTimeout(e),e=setTimeout(function(){n=0,r.state="end",r.wheelDelta=0,t.listener(o,r)},i)},s=document.addEventListener?"addEventListener":"attachEvent",a=document.removeEventListener?"removeEventListener":"detachEvent",c=Event.supports("mousewheel")?"mousewheel":"DOMMouseScroll";return t.target[s](c,o,!1),r},Event.Gesture=Event.Gesture||{},Event.Gesture._gestureHandlers=Event.Gesture._gestureHandlers||{},Event.Gesture._gestureHandlers.wheel=t.wheel,t}(Event.proxy),fabric.log=function(){},fabric.warn=function(){},"undefined"!=typeof console&&(void 0!==console.log&&console.log.apply&&(fabric.log=function(){return console.log.apply(console,arguments)}),void 0!==console.warn&&console.warn.apply&&(fabric.warn=function(){return console.warn.apply(console,arguments)})),fabric.Observable={observe: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)},stopObserving:function(t,e){this.__eventListeners||(this.__eventListeners={}),this.__eventListeners[t]&&(e?fabric.util.removeFromArray(this.__eventListeners[t],e):this.__eventListeners[t].length=0)},fire:function(t,e){this.__eventListeners||(this.__eventListeners={});var i=this.__eventListeners[t];if(i)for(var n=0,r=i.length;n<r;n++)i[n](e||{})}},fabric.Observable.on=fabric.Observable.observe,fabric.Observable.off=fabric.Observable.stopObserving,fabric.Observable.trigger=fabric.Observable.fire,function(){var t=Math.sqrt,e=Math.atan2;fabric.util={};var i=Math.PI/180,n=fabric.window.requestAnimationFrame||fabric.window.webkitRequestAnimationFrame||fabric.window.mozRequestAnimationFrame||fabric.window.oRequestAnimationFrame||fabric.window.msRequestAnimationFrame||function(t){fabric.window.setTimeout(t,1e3/60)},r=function(){return n.apply(fabric.window,arguments)};fabric.util.removeFromArray=function(t,e){var i=t.indexOf(e);return-1!==i&&t.splice(i,1),t},fabric.util.degreesToRadians=function(t){return t*i},fabric.util.radiansToDegrees=function(t){return t/i}
1,fabric.util.rotatePoint=function(t,e,i){var n=Math.sin(i),r=Math.cos(i);t.subtractEquals(e);var o=t.x*r-t.y*n,s=t.x*n+t.y*r;return new fabric.Point(o,s).addEquals(e)},fabric.util.toFixed=function(t,e){return parseFloat(Number(t).toFixed(e))},fabric.util.getRandomInt=function(t,e){return Math.floor(Math.random()*(e-t+1))+t},fabric.util.falseFunction=function(){return!1},fabric.util.animate=function(t){t||(t={});var e,i=+new Date,n=t.duration||500,o=i+n,s=t.onChange||function(){},a=t.abort||function(){return!1},c=t.easing||function(t,e,i,n){return-i*Math.cos(t/n*(Math.PI/2))+i+e},l="startValue"in t?t.startValue:0,u="endValue"in t?t.endValue:100,h=t.byValue||u-l;t.onStart&&t.onStart(),function u(){e=+new Date,s(c(e>o?n:e-i,l,h,n)),e>o||a()?t.onComplete&&t.onComplete():r(u)}()},fabric.util.requestAnimFrame=r,fabric.util.loadImage=function(t,e,i){if(t){var n=new Image;n.onload=function(){e&&e.call(i,n),n=n.onload=null},n.src=t}else e&&e.call(i,t)},fabric.util.enlivenObjects=function(t,e){function i(t){return fabric[fabric.util.string.camelize(fabric.util.string.capitalize(t))]}function n(){++o===s&&e&&e(r)}var r=[],o=0,s=t.length;t.forEach(function(t,e){if(t.type){var o=i(t.type);o.async?o.fromObject(t,function(t,i){i||(r[e]=t),n()}):(r[e]=o.fromObject(t),n())}})},fabric.util.groupSVGElements=function(t,e,i){var n;return t.length>1?t.some(function(t){return"text"===t.type})?(n=new fabric.Group([],e),t.reverse().forEach(function(t){t.cx&&(t.left=t.cx),t.cy&&(t.top=t.cy),n.addWithUpdate(t)})):n=new fabric.PathGroup(t,e):n=t[0],void 0!==i&&n.setSourcePath(i),n},fabric.util.populateWithProperties=function(t,e,i){if(i&&"[object Array]"===Object.prototype.toString.call(i))for(var n=0,r=i.length;n<r;n++)e[i[n]]=t[i[n]]},fabric.util.drawDashedLine=function(i,n,r,o,s,a){var c=o-n,l=s-r,u=t(c*c+l*l),h=e(l,c),f=a.length,d=0,p=!0;for(i.save(),i.translate(n,r),i.moveTo(0,0),i.rotate(h),n=0;u>n;)(n+=a[d++%f])>u&&(n=u),i[p?"lineTo":"moveTo"](n,0),p=!p;i.restore()},fabric.util.createCanvasElement=function(t){return t||(t=fabric.document.createElement("canvas")),t.getContext||"undefined"==typeof G_vmlCanvasManager||G_vmlCanvasManager.initElement(t),t},fabric.util.createAccessors=function(t){for(var e=t.prototype,i=e.stateProperties.length;i--;){var n=e.stateProperties[i],r=n.charAt(0).toUpperCase()+n.slice(1),o="set"+r,s="get"+r;e[s]||(e[s]=function(t){return new Function('return this.get("'+t+'")')}(n)),e[o]||(e[o]=function(t){return new Function("value",'return this.set("'+t+'", value)')}(n))}},fabric.util.clipContext=function(t,e){e.save(),e.beginPath(),t.clipTo(e),e.clip()}}(),function(){var t=Array.prototype.slice;Array.prototype.indexOf||(Array.prototype.indexOf=function(t){if(void 0===this||null===this)throw new TypeError;var e=Object(this),i=e.length>>>0;if(0===i)return-1;var n=0;if(arguments.length>0&&((n=Number(arguments[1]))!==n?n=0:0!==n&&n!==Number.POSITIVE_INFINITY&&n!==Number.NEGATIVE_INFINITY&&(n=(n>0||-1)*Math.floor(Math.abs(n)))),n>=i)return-1;for(var r=n>=0?n:Math.max(i-Math.abs(n),0);r<i;r++)if(r in e&&e[r]===t)return r;return-1}),Array.prototype.forEach||(Array.prototype.forEach=function(t,e){for(var i=0,n=this.length>>>0;i<n;i++)i in this&&t.call(e,this[i],i,this)}),Array.prototype.map||(Array.prototype.map=function(t,e){for(var i=[],n=0,r=this.length>>>0;n<r;n++)n in this&&(i[n]=t.call(e,this[n],n,this));return i}),Array.prototype.every||(Array.prototype.every=function(t,e){for(var i=0,n=this.length>>>0;i<n;i++)if(i in this&&!t.call(e,this[i],i,this))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(t,e){for(var i=0,n=this.length>>>0;i<n;i++)if(i in this&&t.call(e,this[i],i,this))return!0;return!1}),Array.prototype.filter||(Array.prototype.filter=function(t,e){for(var i,n=[],r=0,o=this.length>>>0;r<o;r++)r in this&&(i=this[r],t.call(e,i,r,this)&&n.push(i));return n}),Array.prototype.reduce||(Array.prototype.reduce=function(t){var e,i=this.length>>>0,n=0;if(arguments.length>1)e=arguments[1];else for(;;){if(n in this){e=this[n++];break}if(++n>=i)throw new TypeError}for(;n<i;n++)n in this&&(e=t.call(null,e,this[n],n,this));return e}),fabric.util.array={invoke:function(e,i){for(var n=t.call(arguments,2),r=[],o=0,s=e.length;o<s;o++)r[o]=n.length?e[o][i].apply(e[o],n):e[o][i].call(e[o]);return r},min:function(t,e){if(t&&0!==t.length){var i=t.length-1,n=e?t[i][e]:t[i];if(e)for(;i--;)t[i][e]<n&&(n=t[i][e]);else for(;i--;)t[i]<n&&(n=t[i]);return n}},max:function(t,e){if(t&&0!==t.length){var i=t.length-1,n=e?t[i][e]:t[i];if(e)for(;i--;)t[i][e]>=n&&(n=t[i][e]);else for(;i--;)t[i]>=n&&(n=t[i]);return n}}}}(),function(){function t(t,e){for(var i in e)t[i]=e[i];return t}fabric.util.object={extend:t,clone:function(e){return t({},e)}}}(),function(){String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\xA0]+/,"").replace(/[\s\xA0]+$/,"")}),fabric.util.string={camelize:function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},capitalize:function(t){return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()},escapeXml:function(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}}(),function(){var t=Array.prototype.slice,e=Function.prototype.apply,i=function(){};Function.prototype.bind||(Function.prototype.bind=function(n){var r,o=this,s=t.call(arguments,1
1);return r=s.length?function(){return e.call(o,this instanceof i?this:n,s.concat(t.call(arguments)))}:function(){return e.call(o,this instanceof i?this:n,arguments)},i.prototype=this.prototype,r.prototype=new i,r})}(),function(){function t(){}function e(t){var e=this.constructor.superclass.prototype[t];return arguments.length>1?e.apply(this,i.call(arguments,1)):e.call(this)}var i=Array.prototype.slice,n=function(){},r=function(){for(var t in{toString:1})if("toString"===t)return!1;return!0}(),o=function(t,e,i){for(var n in e)n in t.prototype&&"function"==typeof t.prototype[n]&&(e[n]+"").indexOf("callSuper")>-1?t.prototype[n]=function(t){return function(){var n=this.constructor.superclass;this.constructor.superclass=i;var r=e[t].apply(this,arguments);if(this.constructor.superclass=n,"initialize"!==t)return r}}(n):t.prototype[n]=e[n],r&&(e.toString!==Object.prototype.toString&&(t.prototype.toString=e.toString),e.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=e.valueOf))};fabric.util.createClass=function(){function r(){this.initialize.apply(this,arguments)}var s=null,a=i.call(arguments,0);"function"==typeof a[0]&&(s=a.shift()),r.superclass=s,r.subclasses=[],s&&(t.prototype=s.prototype,r.prototype=new t,s.subclasses.push(r));for(var c=0,l=a.length;c<l;c++)o(r,a[c],s);return r.prototype.initialize||(r.prototype.initialize=n),r.prototype.constructor=r,r.prototype.callSuper=e,r}}(),function(){function t(t){var e,i,n=Array.prototype.slice.call(arguments,1),r=n.length;for(i=0;i<r;i++)if(e=typeof t[n[i]],!/^(?:function|object|unknown)$/.test(e))return!1;return!0}function e(t,e){return{handler:e,wrappedHandler:i(t,e)}}function i(t,e){return function(i){e.call(r(t),i||fabric.window.event)}}function n(t,e){return function(i){if(f[t]&&f[t][e])for(var n=f[t][e],r=0,o=n.length;r<o;r++)n[r].call(this,i||fabric.window.event)}}var r,o,s=function(){var t=0;return function(e){return e.__uniqueID||(e.__uniqueID="uniqueID__"+t++)}}();!function(){var t={};r=function(e){return t[e]},o=function(e,i){t[e]=i}}();var a,c,l=t(fabric.document.documentElement,"addEventListener","removeEventListener")&&t(fabric.window,"addEventListener","removeEventListener"),u=t(fabric.document.documentElement,"attachEvent","detachEvent")&&t(fabric.window,"attachEvent","detachEvent"),h={},f={};l?(a=function(t,e,i){t.addEventListener(e,i,!1)},c=function(t,e,i){t.removeEventListener(e,i,!1)}):u?(a=function(t,i,n){var r=s(t);o(r,t),h[r]||(h[r]={}),h[r][i]||(h[r][i]=[]);var a=e(r,n);h[r][i].push(a),t.attachEvent("on"+i,a.wrappedHandler)},c=function(t,e,i){var n,r=s(t);if(h[r]&&h[r][e])for(var o=0,a=h[r][e].length;o<a;o++)(n=h[r][e][o])&&n.handler===i&&(t.detachEvent("on"+e,n.wrappedHandler),h[r][e][o]=null)}):(a=function(t,e,i){var r=s(t);if(f[r]||(f[r]={}),!f[r][e]){f[r][e]=[];var o=t["on"+e];o&&f[r][e].push(o),t["on"+e]=n(r,e)}f[r][e].push(i)},c=function(t,e,i){var n=s(t);if(f[n]&&f[n][e])for(var r=f[n][e],o=0,a=r.length;o<a;o++)r[o]===i&&r.splice(o,1)}),fabric.util.addListener=a,fabric.util.removeListener=c;var d=function(t){return"unknown"!=typeof t.clientX?t.clientX:0},p=function(t){return"unknown"!=typeof t.clientY?t.clientY:0};fabric.isTouchSupported&&(d=function(t){return"touchend"!==t.type?t.touches&&t.touches[0]?t.touches[0].pageX-(t.touches[0].pageX-t.touches[0].clientX)||t.clientX:t.clientX:t.changedTouches&&t.changedTouches[0]?t.changedTouches[0].pageX-(t.changedTouches[0].pageX-t.changedTouches[0].clientX)||t.clientX:t.clientX},p=function(t){return"touchend"!==t.type?t.touches&&t.touches[0]?t.touches[0].pageY-(t.touches[0].pageY-t.touches[0].clientY)||t.clientY:t.clientY:t.changedTouches&&t.changedTouches[0]?t.changedTouches[0].pageY-(t.changedTouches[0].pageY-t.changedTouches[0].clientY)||t.clientY:t.clientY}),fabric.util.getPointer=function(t,e){t||(t=fabric.window.event);for(var i,n=t.target||("unknown"!=typeof t.srcElement?t.srcElement:null),r=fabric.document.body||{scrollLeft:0,scrollTop:0},o=fabric.document.documentElement,s=n,a=0,c=0;n&&n.parentNode&&!i;)(n=n.parentNode)!==fabric.document&&"fixed"===fabric.util.getElementPosition(n)&&(i=n),n!==fabric.document&&s!==e&&"absolute"===fabric.util.getElementPosition(n)?(a=0,c=0):n===fabric.document&&s!==e?(a=r.scrollLeft||o.scrollLeft||0,c=r.scrollTop||o.scrollTop||0):(a+=n.scrollLeft||0,c+=n.scrollTop||0);return{x:d(t)+a,y:p(t)+c}},fabric.util.object.extend(fabric.util,fabric.Observable)}(),function(){var t=fabric.document.createElement("div"),e="string"==typeof t.style.opacity,i="string"==typeof t.style.filter,n=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,r=function(t){return t};e?r=function(t,e){return t.style.opacity=e,t}:i&&(r=function(t,e){var i=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(i.zoom=1),n.test(i.filter)?(e=e>=.9999?"":"alpha(opacity="+100*e+")",i.filter=i.filter.replace(n,e)):i.filter+=" alph
1a(opacity="+100*e+")",t}),fabric.util.setStyle=function(t,e){var i=t.style;if(!i)return t;if("string"==typeof e)return t.style.cssText+=";"+e,e.indexOf("opacity")>-1?r(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var n in e)"opacity"===n?r(t,e[n]):i["float"===n||"cssFloat"===n?void 0===i.styleFloat?"cssFloat":"styleFloat":n]=e[n];return t}}(),function(){function t(t,e){var i=fabric.document.createElement(t);for(var n in e)"class"===n?i.className=e[n]:"for"===n?i.htmlFor=e[n]:i.setAttribute(n,e[n]);return i}var e,i=Array.prototype.slice,n=function(t){return i.call(t,0)};try{e=n(fabric.document.childNodes)instanceof Array}catch(t){}e||(n=function(t){for(var e=new Array(t.length),i=t.length;i--;)e[i]=t[i];return e});var r;r=fabric.document.defaultView&&fabric.document.defaultView.getComputedStyle?function(t){return fabric.document.defaultView.getComputedStyle(t,null).position}:function(t){var e=t.style.position;return!e&&t.currentStyle&&(e=t.currentStyle.position),e},function(){var t=fabric.document.documentElement.style,e="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),e?t.style[e]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t},fabric.util.makeElementSelectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=null),e?t.style[e]="":"string"==typeof t.unselectable&&(t.unselectable=""),t}}(),function(){fabric.util.getScript=function(t,e){var i=fabric.document.getElementsByTagName("head")[0],n=fabric.document.createElement("script"),r=!0;n.type="text/javascript",n.setAttribute("runat","server"),n.onload=n.onreadystatechange=function(t){if(r){if("string"==typeof this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)return;r=!1,e(t||fabric.window.event),n=n.onload=n.onreadystatechange=null}},n.src=t,i.appendChild(n)}}(),fabric.util.getById=function(t){return"string"==typeof t?fabric.document.getElementById(t):t},fabric.util.toArray=n,fabric.util.makeElement=t,fabric.util.addClass=function(t,e){-1===(" "+t.className+" ").indexOf(" "+e+" ")&&(t.className+=(t.className?" ":"")+e)},fabric.util.wrapElement=function(e,i,n){return"string"==typeof i&&(i=t(i,n)),e.parentNode&&e.parentNode.replaceChild(i,e),i.appendChild(e),i},fabric.util.getElementOffset=function(t){var e=0,i=0;do{e+=t.offsetTop||0,i+=t.offsetLeft||0,t=t.offsetParent}while(t);return{left:i,top:e}},fabric.util.getElementPosition=r}(),function(){function t(t,e){return t+(/\?/.test(t)?"&":"?")+e}function e(){}var i=function(){for(var t=[function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP.3.0")},function(){return new XMLHttpRequest}],e=t.length;e--;)try{if(t[e]())return t[e]}catch(t){}}();fabric.util.request=function(n,r){r||(r={});var o,s=r.method?r.method.toUpperCase():"GET",a=r.onComplete||function(){},c=i();return c.onreadystatechange=function(){4===c.readyState&&(a(c),c.onreadystatechange=e)},"GET"===s&&(o=null,"string"==typeof r.parameters&&(n=t(n,r.parameters))),c.open(s,n,!0),"POST"!==s&&"PUT"!==s||c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(o),c}}(),function(){function t(t,i,n,r){return n-e(r-t,0,n,r)+i}function e(t,e,i,n){return(t/=n)<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,n){return i*(t/=n)*t+e},easeOutQuad:function(t,e,i,n){return-i*(t/=n)*(t-2)+e},easeInOutQuad:function(t,e,i,n){return(t/=n/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,i,n){return i*(t/=n)*t*t+e},easeOutCubic:function(t,e,i,n){return i*((t=t/n-1)*t*t+1)+e},easeInOutCubic:function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,i,n){return i*(t/=n)*t*t*t+e}
1,easeOutQuart:function(t,e,i,n){return-i*((t=t/n-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,i,n){return(t/=n/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,i,n){return i*(t/=n)*t*t*t*t+e},easeOutQuint:function(t,e,i,n){return i*((t=t/n-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,i,n){return(t/=n/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,n){return-i*Math.cos(t/n*(Math.PI/2))+i+e},easeOutSine:function(t,e,i,n){return i*Math.sin(t/n*(Math.PI/2))+e},easeInOutSine:function(t,e,i,n){return-i/2*(Math.cos(Math.PI*t/n)-1)+e},easeInExpo:function(t,e,i,n){return 0===t?e:i*Math.pow(2,10*(t/n-1))+e},easeOutExpo:function(t,e,i,n){return t===n?e+i:i*(1-Math.pow(2,-10*t/n))+e},easeInOutExpo:function(t,e,i,n){return 0===t?e:t===n?e+i:(t/=n/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,n){return-i*(Math.sqrt(1-(t/=n)*t)-1)+e},easeOutCirc:function(t,e,i,n){return i*Math.sqrt(1-(t=t/n-1)*t)+e},easeInOutCirc:function(t,e,i,n){return(t/=n/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,n){var r=1.70158,o=0,s=i;return 0===t?e:1==(t/=n)?e+i:(o||(o=.3*n),s<Math.abs(i)?(s=i,r=o/4):r=o/(2*Math.PI)*Math.asin(i/s),-s*Math.pow(2,10*(t-=1))*Math.sin((t*n-r)*(2*Math.PI)/o)+e)},easeOutElastic:function(t,e,i,n){var r=1.70158,o=0,s=i;return 0===t?e:1==(t/=n)?e+i:(o||(o=.3*n),s<Math.abs(i)?(s=i,r=o/4):r=o/(2*Math.PI)*Math.asin(i/s),s*Math.pow(2,-10*t)*Math.sin((t*n-r)*(2*Math.PI)/o)+i+e)},easeInOutElastic:function(t,e,i,n){var r=1.70158,o=0,s=i;return 0===t?e:2==(t/=n/2)?e+i:(o||(o=n*(.3*1.5)),s<Math.abs(i)?(s=i,r=o/4):r=o/(2*Math.PI)*Math.asin(i/s),t<1?s*Math.pow(2,10*(t-=1))*Math.sin((t*n-r)*(2*Math.PI)/o)*-.5+e:s*Math.pow(2,-10*(t-=1))*Math.sin((t*n-r)*(2*Math.PI)/o)*.5+i+e)},easeInBack:function(t,e,i,n,r){return void 0===r&&(r=1.70158),i*(t/=n)*t*((r+1)*t-r)+e},easeOutBack:function(t,e,i,n,r){return void 0===r&&(r=1.70158),i*((t=t/n-1)*t*((r+1)*t+r)+1)+e},easeInOutBack:function(t,e,i,n,r){return void 0===r&&(r=1.70158),(t/=n/2)<1?i/2*(t*t*((1+(r*=1.525))*t-r))+e:i/2*((t-=2)*t*((1+(r*=1.525))*t+r)+2)+e},easeInBounce:t,easeOutBounce:e,easeInOutBounce:function(i,n,r,o){return i<o/2?.5*t(2*i,0,r,o)+n:.5*e(2*i-o,0,r,o)+.5*r+n}}}(),function(t){"use strict";function e(t){return t in u?u[t]:t}function i(t){for(var e=t.length;e--;){var i=t[e].get("fill");if(/^url\(/.test(i)){var n=i.slice(5,i.length-1);s.gradientDefs[n]&&t[e].set("fill",s.Gradient.fromElement(s.gradientDefs[n],t[e]))}}}function n(t){for(var e=t.getElementsByTagName("style"),i={},n=0,r=e.length;n<r;n++){var o=e[0].textContent;(o=o.replace(/\/\*[\s\S]*?\*\//g,"")).match(/[^{]*\{[\s\S]*?\}/g).map(function(t){return t.trim()}).forEach(function(t){var e=t.match(/([\s\S]*?)\s*\{([^}]*)\}/);t=e[1];var n=e[2].trim().replace(/;$/,"").split(/\s*;\s*/);i[t]||(i[t]={});for(var r=0,o=n.length;r<o;r++){var s=n[r].split(/\s*:\s*/),a=s[0],c=s[1];i[t][a]=c}})}return i}function r(t){var e=t.nodeName,i=t.getAttribute("class"),n=t.getAttribute("id"),r={};for(var o in s.cssRules)if(i&&new RegExp("^\\."+i).test(o)||n&&new RegExp("^#"+n).test(o)||new RegExp("^"+e).test(o))for(var a in s.cssRules[o])r[a]=s.cssRules[o][a];return r}function o(t){var e=t.objects,i=t.options;return e=e.map(function(t){return s[c(t.type)].fromObject(t)}),{objects:e,options:i}}var s=t.fabric||(t.fabric={}),a=s.util.object.extend,c=s.util.string.capitalize,l=s.util.object.clone,u={cx:"left",x:"left",cy:"top",y:"top",r:"radius","fill-opacity":"opacity","fill-rule":"fillRule","stroke-width":"strokeWidth",transform:"transformMatrix","text-decoration":"textDecoration","font-size":"fontSize","font-weight":"fontWeight","font-style":"fontStyle","font-family":"fontFamily"};s.parseTransformAttribute=function(){function t(t,e){var i=e[0];t[0]=Math.cos(i),t[1]=Math.sin(i),t[2]=-Math.sin(i),t[3]=Math.cos(i)}function e(t,e){var i=e[0],n=2===e.length?e[1]:e[0];t[0]=i,t[3]=n}function i(t,e){t[2]=e[0]}function n(t,e){t[1]=e[0]}function r(t,e){t[4]=e[0],2===e.length&&(t[5]=e[1])}var o=[1,0,0,1,0,0],s="(?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)",a="(?:\\s+,?\\s*|,\\s*)",c="(?:(?:(matrix)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))|(?:(translate)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(scale)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(rotate)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(skewX)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))|(?:(skewY)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\)))",l=new RegExp("^\\s*(?:(?
1:(?:(?:(matrix)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))|(?:(translate)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(scale)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(rotate)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(skewX)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))|(?:(skewY)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\)))(?:(?:\\s+,?\\s*|,\\s*)(?:(?:(matrix)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))|(?:(translate)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(scale)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(rotate)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(skewX)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))|(?:(skewY)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))))*)?)\\s*$"),u=new RegExp(c);return function(s){var a=o.concat();return!s||s&&!l.test(s)?a:(s.replace(u,function(o){var s=new RegExp(c).exec(o).filter(function(t){return""!==t&&null!=t}),l=s[1],u=s.slice(2).map(parseFloat);switch(l){case"translate":r(a,u);break;case"rotate":t(a,u);break;case"scale":e(a,u);break;case"skewX":i(a,u);break;case"skewY":n(a,u);break;case"matrix":a=u}}),a)}}(),s.parseSVGDocument=function(){function t(t,e){for(;t&&(t=t.parentNode);)if(e.test(t.nodeName))return!0;return!1}var e=/^(path|circle|polygon|polyline|ellipse|rect|line|image|text)$/,i="(?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)",r=new RegExp("^\\s*("+i+"+)\\s*,?\\s*("+i+"+)\\s*,?\\s*("+i+"+)\\s*,?\\s*("+i+"+)\\s*$");return function(i,o,a){if(i){var c=new Date,u=s.util.toArray(i.getElementsByTagName("*"));if(0===u.length){for(var h=[],f=0,d=(u=i.selectNodes("//*[name(.)!='svg']")).length;f<d;f++)h[f]=u[f];u=h}var p=u.filter(function(i){return e.test(i.tagName)&&!t(i,/^(?:pattern|defs)$/)});if(p&&(!p||p.length)){var g=i.getAttribute("viewBox"),v=i.getAttribute("width"),m=i.getAttribute("height"),b=null,y=null;g&&(g=g.match(r))&&(parseInt(g[1],10),parseInt(g[2],10),b=parseInt(g[3],10),y=parseInt(g[4],10));var x={width:b=v?parseFloat(v):b,height:y=m?parseFloat(m):y};s.gradientDefs=s.getGradientDefs(i),s.cssRules=n(i),s.parseElements(p,function(t){s.documentParsingTime=new Date-c,o&&o(t,x)},l(x),a)}}}}();var h={has:function(t,e){e(!1)},get:function(){},set:function(){}};a(s,{parseAttributes:function(t,i){if(t){var n,o,c={};t.parentNode&&/^g$/i.test(t.parentNode.nodeName)&&(c=s.parseAttributes(t.parentNode,i));var l=i.reduce(function(i,r){return n=t.getAttribute(r),o=parseFloat(n),n&&("fill"!==r&&"stroke"!==r||"none"!==n||(n=""),"fill-rule"===r&&(n="evenodd"===n?"destination-over":n),"transform"===r&&(n=s.parseTransformAttribute(n)),i[r=e(r)]=isNaN(o)?n:o),i},{});return l=a(l,a(r(t),s.parseStyleAttribute(t))),a(c,l)}},parseElements:function(t,e,n,r){function o(){0==--u&&(i(l=l.filter(function(t){return null!=t})),e(l))}for(var a,l=new Array(t.length),u=t.length,h=0,f=t.length;h<f;h++){a=t[h];var d=s[c(a.tagName)];if(d&&d.fromElement)try{if(d.async)d.fromElement(a,function(t,e){return function(e){r&&r(void 0,e),l.splice(t,0,e),o()}}(h),n);else{var p=d.fromElement(a,n);r&&r(a,p),l.splice(h,0,p),o()}}catch(t){s.log(t)}else o()}},parseStyleAttribute:function(t){var i={},n=t.getAttribute("style");if(!n)return i;if("string"==typeof n)n=n.replace(/;$/,"").split(";").forEach(function(t){var n=t.split(":"),r=n[1].trim(),o=parseFloat(r);i[e(n[0].trim().toLowerCase())]=isNaN(o)?r:o});else for(var r in n)if(void 0!==n[r]){var o=parseFloat(n[r]);i[e(r.toLowerCase())]=isNaN(o)?n[r]:o}return i},parsePointsAttribute:function(t){if(!t)return null;var e=(t=t.trim()).indexOf(",")>-1;t=t.split(/\s+/);var i,n,r=[];if(e)for(i=0,n=t.length;i<n;i++){var o=t[i].split(",");r.push({x:parseFloat(o[0]),y:parseFloat(o[1])})}else for(i=0,n=t.length;i<n;i+=2)r.push({x:parseFloat(t[i]),y:parseFloat(t[i+1])});return r.length,r}
1,getCSSRules:n,loadSVGFromURL:function(t,e,i){function n(n){var r=n.responseXML;!r.documentElement&&s.window.ActiveXObject&&n.responseText&&((r=new ActiveXObject("Microsoft.XMLDOM")).async="false",r.loadXML(n.responseText.replace(/<!DOCTYPE[\s\S]*?(\[[\s\S]*\])*?>/i,""))),r.documentElement&&s.parseSVGDocument(r.documentElement,function(i,n){h.set(t,{objects:s.util.array.invoke(i,"toObject"),options:n}),e(i,n)},i)}t=t.replace(/^\n\s*/,"").trim(),h.has(t,function(i){i?h.get(t,function(t){var i=o(t);e(i.objects,i.options)}):new s.util.request(t,{method:"get",onComplete:n})})},loadSVGFromString:function(t,e,i){t=t.trim();var n;if("undefined"!=typeof DOMParser){var r=new DOMParser;r&&r.parseFromString&&(n=r.parseFromString(t,"text/xml"))}else s.window.ActiveXObject&&((n=new ActiveXObject("Microsoft.XMLDOM")).async="false",n.loadXML(t.replace(/<!DOCTYPE[\s\S]*?(\[[\s\S]*\])*?>/i,"")));s.parseSVGDocument(n.documentElement,function(t,i){e(t,i)},i)},createSVGFontFacesMarkup:function(t){for(var e="",i=0,n=t.length;i<n;i++)"text"===t[i].type&&t[i].path&&(e+=["@font-face {","font-family: ",t[i].fontFamily,"; ","src: url('",t[i].path,"')","}"].join(""));return e&&(e=['<style type="text/css">',"<![CDATA[",e,"]]>","</style>"].join("")),e},createSVGRefElementsMarkup:function(t){var e="";return t.backgroundColor&&t.backgroundColor.source&&(e=['<pattern x="0" y="0" id="backgroundColorPattern" ','width="',t.backgroundColor.source.width,'" height="',t.backgroundColor.source.height,'" patternUnits="userSpaceOnUse">','<image x="0" y="0" ','width="',t.backgroundColor.source.width,'" height="',t.backgroundColor.source.height,'" xlink:href="',t.backgroundColor.source.src,'"></image></pattern>'].join("")),e}})}("undefined"!=typeof exports?exports:this),function(){function t(t){var e,i,n=t.getAttribute("style"),r=t.getAttribute("offset");if(r=parseFloat(r)/(/%$/.test(r)?100:1),n){var o=n.split(/\s*;\s*/);""===o[o.length-1]&&o.pop();for(var s=o.length;s--;){var a=o[s].split(/\s*:\s*/),c=a[0].trim(),l=a[1].trim();"stop-color"===c?e=l:"stop-opacity"===c&&(i=l)}}return e||(e=t.getAttribute("stop-color")),i||(i=t.getAttribute("stop-opacity")),e=new fabric.Color(e).toRgb(),{offset:r,color:e,opacity:i}}function e(t,e){for(var i in e){if("string"==typeof e[i]&&/^\d+%$/.test(e[i])){var n=parseFloat(e[i],10);"x1"===i||"x2"===i||"r2"===i?e[i]=fabric.util.toFixed(t.width*n/100,2):"y1"!==i&&"y2"!==i||(e[i]=fabric.util.toFixed(t.height*n/100,2))}"x1"===i||"x2"===i?e[i]-=fabric.util.toFixed(t.width/2,2):"y1"!==i&&"y2"!==i||(e[i]-=fabric.util.toFixed(t.height/2,2))}}function i(t,e){for(var i in e)"x1"===i||"x2"===i?e[i]+=fabric.util.toFixed(t.width/2,2):"y1"!==i&&"y2"!==i||(e[i]+=fabric.util.toFixed(t.height/2,2)),"x1"===i||"x2"===i||"r2"===i?e[i]=fabric.util.toFixed(e[i]/t.width*100,2)+"%":"y1"!==i&&"y2"!==i||(e[i]=fabric.util.toFixed(e[i]/t.height*100,2)+"%")}fabric.Gradient=fabric.util.createClass({initialize:function(t){t||(t={});var e={};this.id=fabric.Object.__uid++,this.type=t.type||"linear",e={x1:t.coords.x1||0,y1:t.coords.y1||0,x2:t.coords.x2||0,y2:t.coords.y2||0},"radial"===this.type&&(e.r1=t.coords.r1||0,e.r2=t.coords.r2||0),this.coords=e,this.gradientUnits=t.gradientUnits||"objectBoundingBox",this.colorStops=fabric.util.object.clone(t.colorStops)},addColorStop:function(t){for(var e in t){var i=new fabric.Color(t[e]);this.colorStops.push({offset:e,color:i.toRgb(),opacity:i.getAlpha()})}return this},toObject:function(){return{type:this.type,coords:this.coords,gradientUnits:this.gradientUnits,colorStops:this.colorStops}},toLive:function(t){var e;if(this.type){"linear"===this.type?e=t.createLinearGradient(this.coords.x1,this.coords.y1,this.coords.x2||t.canvas.width,this.coords.y2):"radial"===this.type&&(e=t.createRadialGradient(this.coords.x1,this.coords.y1,this.coords.r1,this.coords.x2,this.coords.y2,this.coords.r2));for(var i=0;i<this.colorStops.length;i++){var n=this.colorStops[i].color,r=this.colorStops[i].opacity,o=this.colorStops[i].offset;r&&(n=new fabric.Color(n).setAlpha(r).toRgba()),e.addColorStop(parseFloat(o),n)}return e}},toSVG:function(t,e){var n,r=fabric.util.object.clone(this.coords);this.colorStops.sort(function(t,e){return t.offset-e.offset}),e&&"userSpaceOnUse"===this.gradientUnits?(r.x1+=t.width/2,r.y1+=t.height/2,r.x2+=t.width/2,r.y2+=t.height/2):"objectBoundingBox"===this.gradientUnits&&i(t,r),"linear"===this.type?n=["<linearGradient ",'id="SVGID_',this.id,'" gradientUnits="',this.gradientUnits,'" x1="',r.x1,'" y1="',r.y1,'" x2="',r.x2,'" y2="',r.y2,'">']:"radial"===this.type&&(n=["<radialGradient ",'id="SVGID_',this.id,'" gradientUnits="',this.gradientUnits,'" cx="',r.x2,'" cy="',r.y2,'" r="',r.r2,'" fx="',r.x1,'" fy="',r.y1,'">']);for(var o=0;o<this.colorStops.length;o++)n.push("<stop ",'offset="',100*this.colorStops[o].offset+"%",'" style="stop-color:',this.colorStops[o].color,this.colorStops[o].opacity?";stop-opacity: "+this.colorStops[o].opacity:";",'"/>');return n.push("linear"===this.type?"</linearGradient>":"</radialGradient>"),n.join("")}}),fabric.util.object.extend(fabric.Gradient,{fromElement:function(i,n){var r=i.getElementsByTagName("stop"),o="linearGradient"===i.nodeName?"linear":"radial",s=i.getAttribute("gradientUnits")||"objectBoundingBox",a=[],c={};"linear"===o?c={x1:i.getAttribute("x1")||0,y1:i.getAttribute("y1")||0,x2:i.getAttribute("x2")||"100%",y2:i.getAttribute("y2")||0}:"radial"===o&&(c={x1:i.getAttribute("fx")||i.getAttribute("cx")||"50%",y1:i.getAttribute("fy")||i.getAttribute("cy")||"50%",r1:0,x2:i.getAttribute("cx")||"50%",y2:i.getAttribute("cy")||"50%",r2:i.getAttribute("r")||"50%"});for(var l=r.length;l--;)a.push(t(r[l]));return e(n,c),new fabric.Gradient({type:o,coords:c,gradientUnits:s,colorStops:a})}
1,forObject:function(t,i){return i||(i={}),e(t,i),new fabric.Gradient(i)}}),fabric.getGradientDefs=function(t){var e,i,n=t.getElementsByTagName("linearGradient"),r=t.getElementsByTagName("radialGradient"),o={};for(i=n.length;i--;)o[(e=n[i]).getAttribute("id")]=e;for(i=r.length;i--;)o[(e=r[i]).getAttribute("id")]=e;return o}}(),fabric.Pattern=fabric.util.createClass({repeat:"repeat",initialize:function(t){t||(t={}),t.source&&(this.source="string"==typeof t.source?new Function(t.source):t.source),t.repeat&&(this.repeat=t.repeat)},toObject:function(){var t;return"function"==typeof this.source?t=String(this.source).match(/function\s+\w*\s*\(.*\)\s+\{([\s\S]*)\}/)[1]:"string"==typeof this.source.src&&(t=this.source.src),{source:t,repeat:this.repeat}},toLive:function(t){var e="function"==typeof this.source?this.source():this.source;return t.createPattern(e,this.repeat)}}),fabric.Shadow=fabric.util.createClass({color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,initialize:function(t){for(var e in t)this[e]=t[e]},toObject:function(){return{color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY}},toSVG:function(){}}),function(t){"use strict";function e(t,e){arguments.length>0&&this.init(t,e)}var i=t.fabric||(t.fabric={});i.Point?i.warn("fabric.Point is already defined"):(i.Point=e,e.prototype={constructor:e,init:function(t,e){this.x=t,this.y=e},add:function(t){return new e(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 e(this.x+t,this.y+t)},scalarAddEquals:function(t){return this.x+=t,this.y+=t,this},subtract:function(t){return new e(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 e(this.x-t,this.y-t)},scalarSubtractEquals:function(t){return this.x-=t,this.y-=t,this},multiply:function(t){return new e(this.x*t,this.y*t)},multiplyEquals:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return new e(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,i){return new e(this.x+(t.x-this.x)*i,this.y+(t.y-this.y)*i)},distanceFrom:function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},midPointFrom:function(t){return new e(this.x+(t.x-this.x)/2,this.y+(t.y-this.y)/2)},min:function(t){return new e(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new e(Math.max(this.x,t.x),Math.max(this.y,t.y))},toString:function(){return this.x+","+this.y},setXY:function(t,e){this.x=t,this.y=e},setFromPoint:function(t){this.x=t.x,this.y=t.y},swap:function(t){var e=this.x,i=this.y;this.x=t.x,this.y=t.y,t.x=e,t.y=i}})}("undefined"!=typeof exports?exports:this),function(t){"use strict";function e(t){arguments.length>0&&this.init(t)}var i=t.fabric||(t.fabric={});i.Intersection?i.warn("fabric.Intersection is already defined"):(i.Intersection=e,i.Intersection.prototype={init:function(t){this.status=t,this.points=[]},appendPoint:function(t){this.points.push(t)},appendPoints:function(t){this.points=this.points.concat(t)}},i.Intersection.intersectLineLine=function(t,n,r,o){var s,a=(o.x-r.x)*(t.y-r.y)-(o.y-r.y)*(t.x-r.x),c=(n.x-t.x)*(t.y-r.y)-(n.y-t.y)*(t.x-r.x),l=(o.y-r.y)*(n.x-t.x)-(o.x-r.x)*(n.y-t.y);if(0!==l){var u=a/l,h=c/l;0<=u&&u<=1&&0<=h&&h<=1?(s=new e("Intersection")).points.push(new i.Point(t.x+u*(n.x-t.x),t.y+u*(n.y-t.y))):s=new e("No Intersection")}else s=new e(0===a||0===c?"Coincident":"Parallel");return s},i.Intersection.intersectLinePolygon=function(t,i,n){for(var r=new e("No Intersection"),o=n.length,s=0;s<o;s++){var a=n[s],c=n[(s+1)%o],l=e.intersectLineLine(t,i,a,c);r.appendPoints(l.points)}return r.points.length>0&&(r.status="Intersection"),r},i.Intersection.intersectPolygonPolygon=function(t,i){for(var n=new e("No Intersection"),r=t.length,o=0;o<r;o++){var s=t[o],a=t[(o+1)%r],c=e.intersectLinePolygon(s,a,i);n.appendPoints(c.points)}return n.points.length>0&&(n.status="Intersection"),n},i.Intersection.intersectPolygonRectangle=function(t,n,r){var o=n.min(r),s=n.max(r),a=new i.Point(s.x,o.y),c=new i.Point(o.x,s.y),l=e.intersectLinePolygon(o,a,t),u=e.intersectLinePolygon(a,s,t),h=e.intersectLinePolygon(s,c,t),f=e.intersectLinePolygon(c,o,t),d=new e("No Intersection");return d.appendPoints(l.points),d.appendPoints(u.points),d.appendPoints(h.points),d.appendPoints(f.points),d.points.length>0&&(d.status="Intersection"),d})}
1("undefined"!=typeof exports?exports:this),function(t){"use strict";function e(t){t?this._tryParsingColor(t):this.setSource([0,0,0,1])}var i=t.fabric||(t.fabric={});i.Color?i.warn("fabric.Color is already defined."):(i.Color=e,i.Color.prototype={_tryParsingColor:function(t){var i;t in e.colorNameMap&&(t=e.colorNameMap[t]),(i=e.sourceFromHex(t))||(i=e.sourceFromRgb(t)),i&&this.setSource(i)},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]+")"},toHex:function(){var t=this.getSource(),e=t[0].toString(16);e=1===e.length?"0"+e:e;var i=t[1].toString(16);i=1===i.length?"0"+i:i;var n=t[2].toString(16);return n=1===n.length?"0"+n:n,e.toUpperCase()+i.toUpperCase()+n.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),i=t[3];return this.setSource([e,e,e,i]),this},toBlackWhite:function(t){var e=this.getSource(),i=(.3*e[0]+.59*e[1]+.11*e[2]).toFixed(0),n=e[3];return t=t||127,i=Number(i)<Number(t)?0:255,this.setSource([i,i,i,n]),this},overlayWith:function(t){t instanceof e||(t=new e(t));for(var i=[],n=this.getAlpha(),r=this.getSource(),o=t.getSource(),s=0;s<3;s++)i.push(Math.round(.5*r[s]+.5*o[s]));return i[3]=n,this.setSource(i),this}},i.Color.reRGBa=/^rgba?\((\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(\d+(?:\.\d+)?))?\)$/,i.Color.reHex=/^#?([0-9a-f]{6}|[0-9a-f]{3})$/i,i.Color.colorNameMap={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"},i.Color.fromRgb=function(t){return e.fromSource(e.sourceFromRgb(t))},i.Color.sourceFromRgb=function(t){var i=t.match(e.reRGBa);if(i)return[parseInt(i[1],10),parseInt(i[2],10),parseInt(i[3],10),i[4]?parseFloat(i[4]):1]},i.Color.fromRgba=e.fromRgb,i.Color.fromHex=function(t){return e.fromSource(e.sourceFromHex(t))},i.Color.sourceFromHex=function(t){if(t.match(e.reHex)){var i=t.slice(t.indexOf("#")+1),n=3===i.length,r=n?i.charAt(0)+i.charAt(0):i.substring(0,2),o=n?i.charAt(1)+i.charAt(1):i.substring(2,4),s=n?i.charAt(2)+i.charAt(2):i.substring(4,6);return[parseInt(r,16),parseInt(o,16),parseInt(s,16),1]}},i.Color.fromSource=function(t){var i=new e;return i.setSource(t),i})}("undefined"!=typeof exports?exports:this),function(){"use strict";if(fabric.StaticCanvas)fabric.warn("fabric.StaticCanvas is already defined.");else{var t=fabric.util.object.extend,e=fabric.util.getElementOffset,i=fabric.util.removeFromArray,n=fabric.util.removeListener,r=new Error("Could not initialize `canvas` element");fabric.StaticCanvas=function(t,e){e||(e={}),this._initStatic(t,e),fabric.StaticCanvas.activeInstance=this},t(fabric.StaticCanvas.prototype,fabric.Observable),t(fabric.StaticCanvas.prototype,{backgroundColor:"",backgroundImage:"",backgroundImageOpacity:1,backgroundImageStretch:!0,overlayImage:"",overlayImageLeft:0,overlayImageTop:0,includeDefaultValues:!0,stateful:!0,renderOnAddition:!0,clipTo:null,controlsAboveOverlay:!1,onBeforeScaleRotate:function(){},_initStatic:function(t,e){this._objects=[],this._createLowerCanvas(t),this._initOptions(e),e.overlayImage&&this.setOverlayImage(e.overlayImage,this.renderAll.bind(this)),e.backgroundImage&&this.setBackgroundImage(e.backgroundImage,this.renderAll.bind(this)),e.backgroundColor&&this.setBackgroundColor(e.backgroundColor,this.renderAll.bind(this)),this.calcOffset()},calcOffset:function(){return this._offset=e(this.lowerCanvasEl),this},setOverlayImage:function(t,e,i){return fabric.util.loadImage(t,function(t){this.overlayImage=t,i&&"overlayImageLeft"in i&&(this.overlayImageLeft=i.overlayImageLeft),i&&"overlayImageTop"in i&&(this.overlayImageTop=i.overlayImageTop),e&&e()},this),this}
1,setBackgroundImage:function(t,e,i){return fabric.util.loadImage(t,function(t){this.backgroundImage=t,i&&"backgroundImageOpacity"in i&&(this.backgroundImageOpacity=i.backgroundImageOpacity),i&&"backgroundImageStretch"in i&&(this.backgroundImageStretch=i.backgroundImageStretch),e&&e()},this),this},setBackgroundColor:function(t,e){if(t.source){var i=this;fabric.util.loadImage(t.source,function(n){i.backgroundColor=new fabric.Pattern({source:n,repeat:t.repeat}),e&&e()})}else this.backgroundColor=t,e&&e();return this},_createCanvasElement:function(){var t=fabric.document.createElement("canvas");if(t.style||(t.style={}),!t)throw r;return this._initCanvasElement(t),t},_initCanvasElement:function(t){if(fabric.util.createCanvasElement(t),void 0===t.getContext)throw r},_initOptions:function(t){for(var e in t)this[e]=t[e];this.width=parseInt(this.lowerCanvasEl.width,10)||0,this.height=parseInt(this.lowerCanvasEl.height,10)||0,this.lowerCanvasEl.style&&(this.lowerCanvasEl.style.width=this.width+"px",this.lowerCanvasEl.style.height=this.height+"px")},_createLowerCanvas:function(t){this.lowerCanvasEl=fabric.util.getById(t)||this._createCanvasElement(),this._initCanvasElement(this.lowerCanvasEl),fabric.util.addClass(this.lowerCanvasEl,"lower-canvas"),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){return this._setDimension("width",t)},setHeight:function(t){return this._setDimension("height",t)},setDimensions:function(t){for(var e in t)this._setDimension(e,t[e]);return this},_setDimension:function(t,e){return this.lowerCanvasEl[t]=e,this.lowerCanvasEl.style[t]=e+"px",this.upperCanvasEl&&(this.upperCanvasEl[t]=e,this.upperCanvasEl.style[t]=e+"px"),this.cacheCanvasEl&&(this.cacheCanvasEl[t]=e),this.wrapperEl&&(this.wrapperEl.style[t]=e+"px"),this[t]=e,this.calcOffset(),this.renderAll(),this},getElement:function(){return this.lowerCanvasEl},getActiveObject:function(){return null},getActiveGroup:function(){return null},_draw:function(t,e){if(e)if(this.controlsAboveOverlay){var i=e.hasBorders,n=e.hasControls;e.hasBorders=e.hasControls=!1,e.render(t),e.hasBorders=i,e.hasControls=n}else e.render(t)},add:function(){this._objects.push.apply(this._objects,arguments);for(var t=arguments.length;t--;)this._initObject(arguments[t]);return this.renderOnAddition&&this.renderAll(),this},_initObject:function(t){this.stateful&&t.setupState(),t.setCoords(),t.canvas=this,this.fire("object:added",{target:t}),t.fire("added")},insertAt:function(t,e,i){return i?this._objects[e]=t:this._objects.splice(e,0,t),this._initObject(t),this.renderOnAddition&&this.renderAll(),this},getObjects:function(){return this._objects},clearContext:function(t){return t.clearRect(0,0,this.width,this.height),this},getContext:function(){return this.contextContainer},clear:function(){return this._objects.length=0,this.discardActiveGroup&&this.discardActiveGroup(),this.clearContext(this.contextContainer),this.contextTop&&this.clearContext(this.contextTop),this.fire("canvas:cleared"),this.renderAll(),this},renderAll:function(t){var e=this[!0===t&&this.interactive?"contextTop":"contextContainer"];this.contextTop&&this.selection&&this.clearContext(this.contextTop),t||this.clearContext(e),this.fire("before:render"),this.clipTo&&fabric.util.clipCanvas(this,e),this.backgroundColor&&(e.fillStyle=this.backgroundColor.toLive?this.backgroundColor.toLive(e):this.backgroundColor,e.fillRect(0,0,this.width,this.height)),"object"==typeof this.backgroundImage&&this._drawBackroundImage(e);for(var i=this.getActiveGroup(),n=0,r=this._objects.length;n<r;++n)(!i||i&&this._objects[n]&&!i.contains(this._objects[n]))&&this._draw(e,this._objects[n]);if(i){var o=[];this.forEachObject(function(t){i.contains(t)&&o.push(t)}),i._set("objects",o),this._draw(e,i)}return this.clipTo&&e.restore(),this.overlayImage&&e.drawImage(this.overlayImage,this.overlayImageLeft,this.overlayImageTop),this.controlsAboveOverlay&&this.drawControls(e),this.fire("after:render"),this},_drawBackroundImage:function(t){t.save(),t.globalAlpha=this.backgroundImageOpacity,this.backgroundImageStretch?t.drawImage(this.backgroundImage,0,0,this.width,this.height):t.drawImage(this.backgroundImage,0,0
1),t.restore()},renderTop:function(){var t=this.contextTop||this.contextContainer;this.clearContext(t),this.selection&&this._groupSelector&&this._drawSelection();var e=this.getActiveGroup();return e&&e.render(t),this.overlayImage&&t.drawImage(this.overlayImage,this.overlayImageLeft,this.overlayImageTop),this.fire("after:render"),this},drawControls:function(t){var e=this.getActiveGroup();if(e)t.save(),fabric.Group.prototype.transform.call(e,t),e.drawBorders(t).drawControls(t),t.restore();else for(var i=0,n=this._objects.length;i<n;++i)this._objects[i]&&this._objects[i].active&&(t.save(),fabric.Object.prototype.transform.call(this._objects[i],t),this._objects[i].drawBorders(t).drawControls(t),t.restore(),this.lastRenderedObjectWithControlsAboveOverlay=this._objects[i])},toDataURL:function(t){t||(t={});var e=t.format||"png",i=t.quality||1,n=t.multiplier||1;return 1!==n?this.__toDataURLWithMultiplier(e,i,n):this.__toDataURL(e,i)},__toDataURL:function(t,e){this.renderAll(!0);var i=this.upperCanvasEl||this.lowerCanvasEl,n=fabric.StaticCanvas.supports("toDataURLWithQuality")?i.toDataURL("image/"+t,e):i.toDataURL("image/"+t);return this.contextTop&&this.clearContext(this.contextTop),this.renderAll(),n},__toDataURLWithMultiplier:function(t,e,i){var n=this.getWidth(),r=this.getHeight(),o=n*i,s=r*i,a=this.getActiveObject(),c=this.getActiveGroup(),l=this.contextTop||this.contextContainer;this.setWidth(o).setHeight(s),l.scale(i,i),c?this._tempRemoveBordersControlsFromGroup(c):a&&this.deactivateAll&&this.deactivateAll(),this.width=n,this.height=r,this.renderAll(!0);var u=this.toDataURL(t,e);return l.scale(1/i,1/i),this.setWidth(n).setHeight(r),c?this._restoreBordersControlsOnGroup(c):a&&this.setActiveObject&&this.setActiveObject(a),this.contextTop&&this.clearContext(this.contextTop),this.renderAll(),u},toDataURLWithMultiplier:function(t,e,i){return this.toDataURL({format:t,multiplier:e,quality:i})},_tempRemoveBordersControlsFromGroup:function(t){t.origHasControls=t.hasControls,t.origBorderColor=t.borderColor,t.hasControls=!0,t.borderColor="rgba(0,0,0,0)",t.forEachObject(function(t){t.origBorderColor=t.borderColor,t.borderColor="rgba(0,0,0,0)"})},_restoreBordersControlsOnGroup:function(t){t.hideControls=t.origHideControls,t.borderColor=t.origBorderColor,t.forEachObject(function(t){t.borderColor=t.origBorderColor,delete t.origBorderColor})},getCenter:function(){return{top:this.getHeight()/2,left:this.getWidth()/2}},centerObjectH:function(t){return t.set("left",this.getCenter().left),this.renderAll(),this},centerObjectV:function(t){return t.set("top",this.getCenter().top),this.renderAll(),this},centerObject:function(t){return this.centerObjectH(t).centerObjectV(t)},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={objects:this._objects.map(function(i){var n;this.includeDefaultValues||(n=i.includeDefaultValues,i.includeDefaultValues=!1);var r=i[t](e);return this.includeDefaultValues||(i.includeDefaultValues=n),r},this),background:this.backgroundColor&&this.backgroundColor.toObject?this.backgroundColor.toObject():this.backgroundColor};return this.backgroundImage&&(i.backgroundImage=this.backgroundImage.src,i.backgroundImageOpacity=this.backgroundImageOpacity,i.backgroundImageStretch=this.backgroundImageStretch),this.overlayImage&&(i.overlayImage=this.overlayImage.src,i.overlayImageLeft=this.overlayImageLeft,i.overlayImageTop=this.overlayImageTop),fabric.util.populateWithProperties(this,i,e),i},toSVG:function(t){t||(t={});var e=[];t.suppressPreamble||e.push('<?xml version="1.0" standalone="no" ?>','<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ','"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'),e.push("<svg ",'xmlns="http://www.w3.org/2000/svg" ','xmlns:xlink="http://www.w3.org/1999/xlink" ','version="1.1" ','width="',this.width,'" ','height="',this.height,'" ',this.backgroundColor&&!this.backgroundColor.source?'style="background-color: '+this.backgroundColor+'" ':null,'xml:space="preserve">',"<desc>Created with Fabric.js ",fabric.version,"</desc>","<defs>",fabric.createSVGFontFacesMarkup(this.getObjects()),fabric.createSVGRefElementsMarkup(this),"</defs>"),this.backgroundColor&&this.backgroundColor.source&&e.push('<rect x="0" y="0" ','width="',"repeat-y"===this.backgroundColor.repeat||"no-repeat"===this.backgroundColor.repeat?this.backgroundColor.source.width:this.width,'" height="',"repeat-x"===this.backgroundColor.repeat||"no-repeat"===this.backgroundColor.repeat?this.backgroundColor.source.height:this.height,'" fill="url(#backgroundColorPattern)"',"></rect>"),this.backgroundImage&&e.push('<image x="0" y="0" ','width="',this.backgroundImageStretch?this.width:this.backgroundImage.width,'" height="',this.backgroundImageStretch?this.height:this.backgroundImage.height,'" preserveAspectRatio="',this.backgroundImageStretch?"none":"defer",'" xlink:href="',this.backgroundImage.src,'" style="opacity:',this.backgroundImageOpacity,'"></image>'),this.overlayImage&&e.push('<image x="',this.overlayImageLeft,'" y="',this.overlayImageTop,'" width="',this.overlayImage.width,'" height="',this.overlayImage.height,'" xlink:href="',this.overlayImage.src,'"></image>');for(var i=0,n=this.getObjects(),r=n.length;i<r;i++)e.push(n[i].toSVG());return e.push("</svg>"),e.join("")},isEmpty:function(){return 0===this._objects.length},remove:function(t){this.getActiveObject()===t&&(this.fire("before:selection:cleared",{target:t}),this.discardActiveObject(),this.fire("selection:cleared"));var e=this._objects,i=e.indexOf(t);return-1!==i&&(e.splice(i,1),this.fire("object:removed",{target:t})),this.renderAll(),t},sendToBack:function(t){return i(this._objects,t),this._objects.unshift(t),this.renderAll()},bringToFront:function(t){return i(this._objects,t),this._objects.push(t),this.renderAll()},sendBackwards:function(t){var e=this._objects.indexOf(t),n=e;if(0!==e){for(var r=e-1;r>=0;--r)if(t.intersectsWithObject(this._objects[r])||t.isContainedWithinObject(this._objects[r])||this._objects[r].isContainedWithinObject(t)){n=r;break}i(this._objects,t),this._objects.splice(n,0,t)}return this.renderAll()},bringForward:function(t){var e=this.getObjects(),n=e.indexOf(t),r=n;if(n!==e.length-1){for(var o=n+1,s=this._objects.length;o<s;++o)if(t.intersectsWithObject(e[o])||t.isContainedWithinObject(this._objects[o])||this._objects[o].isContainedWithinObject(t)){r=o;break}i(e,t),e.splice(r,0,t)}this.renderAll()},item:function(t){return this.getObjects()[t]},complexity:function(){return this.getObjects().reduce(function(t,e){return t+=e.complexity?e.complexity():0},0)}
1,forEachObject:function(t,e){for(var i=this.getObjects(),n=i.length;n--&&!1!==t.call(e,i[n],n,i););return this},dispose:function(){return this.clear(),this.interactive&&(n(this.upperCanvasEl,"mousedown",this._onMouseDown),n(this.upperCanvasEl,"mousemove",this._onMouseMove),n(fabric.window,"resize",this._onResize)),this},_resizeImageToFit:function(t){var e=t.width||t.offsetWidth,i=this.getWidth()/e;e&&(t.width=e*i)}}),fabric.StaticCanvas.prototype.toString=function(){return"#<fabric.Canvas ("+this.complexity()+"): { objects: "+this.getObjects().length+" }>"},t(fabric.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',toGrayscale:function(t){var e,i,n,r,o=t.getContext("2d"),s=o.getImageData(0,0,t.width,t.height),a=s.data,c=s.width,l=s.height;for(n=0;n<c;n++)for(r=0;r<l;r++)i=(a[e=4*n*l+4*r]+a[e+1]+a[e+2])/3,a[e]=i,a[e+1]=i,a[e+2]=i;o.putImageData(s,0,0)},supports:function(t){var e=fabric.util.createCanvasElement();if(!e||!e.getContext)return null;var i=e.getContext("2d");if(!i)return null;switch(t){case"getImageData":return void 0!==i.getImageData;case"toDataURL":return void 0!==e.toDataURL;case"toDataURLWithQuality":try{return e.toDataURL("image/jpeg",0),!0}catch(t){}return!1;default:return null}}}),fabric.StaticCanvas.prototype.toJSON=fabric.StaticCanvas.prototype.toObject}}(),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.array.min,n=e.util.array.max;e.FreeDrawing?e.warn("fabric.FreeDrawing is already defined"):e.FreeDrawing=e.util.createClass({initialize:function(t){this.canvas=t,this._points=[]},_addPoint:function(t){this._points.push(t)},_reset:function(){this._points.length=0;var t=this.canvas.contextTop;t.strokeStyle=this.canvas.freeDrawingColor,t.lineWidth=this.canvas.freeDrawingLineWidth,t.lineCap=t.lineJoin="round"},_prepareForDrawing:function(t){this.canvas._isCurrentlyDrawing=!0,this.canvas.discardActiveObject().renderAll();var i=new e.Point(t.x,t.y);this._reset(),this._addPoint(i),this.canvas.contextTop.moveTo(i.x,i.y)},_captureDrawingPath:function(t){var i=new e.Point(t.x,t.y);this._addPoint(i)},_render:function(){var t=this.canvas.contextTop;t.beginPath();var e=this._points[0],i=this._points[1];t.moveTo(e.x,e.y);for(var n=1,r=this._points.length;n<r;n++){var o=e.midPointFrom(i);t.quadraticCurveTo(e.x,e.y,o.x,o.y),e=this._points[n],i=this._points[n+1]}t.lineTo(e.x,e.y),t.stroke()},_getSVGPathData:function(){return this.box=this.getPathBoundingBox(this._points),this.convertPointsToSVGPath(this._points,this.box.minx,this.box.maxx,this.box.miny,this.box.maxy)},getPathBoundingBox:function(t){for(var e=[],r=[],o=t[0],s=t[1],a=o,c=1,l=t.length;c<l;c++){var u=o.midPointFrom(s);e.push(a.x),e.push(u.x),r.push(a.y),r.push(u.y),o=t[c],s=t[c+1],a=u}return e.push(o.x),r.push(o.y),{minx:i(e),miny:i(r),maxx:n(e),maxy:n(r)}},convertPointsToSVGPath:function(t,i,n,r){var o=[],s=new e.Point(t[0].x-i,t[0].y-r),a=new e.Point(t[1].x-i,t[1].y-r);o.push("M ",t[0].x-i," ",t[0].y-r," ");for(var c=1,l=t.length;c<l;c++){var u=s.midPointFrom(a);o.push("Q ",s.x," ",s.y," ",u.x," ",u.y," "),s=new e.Point(t[c].x-i,t[c].y-r),c+1<t.length&&(a=new e.Point(t[c+1].x-i,t[c+1].y-r))}return o.push("L ",s.x," ",s.y," "),o},createPath:function(t){var i=new e.Path(t);return i.fill=null,i.stroke=this.canvas.freeDrawingColor,i.strokeWidth=this.canvas.freeDrawingLineWidth,i},_finalizeAndAddPath:function(){this.canvas._isCurrentlyDrawing=!1,this.canvas.contextTop.closePath();var t=this._getSVGPathData().join("");if("M 0 0 Q 0 0 0 0 L 0 0"!==t){var e=this.box.minx+(this.box.maxx-this.box.minx)/2,i=this.box.miny+(this.box.maxy-this.box.miny)/2;this.canvas.contextTop.arc(e,i,3,0,2*Math.PI,!1);var n=this.createPath(t);n.set({left:e,top:i}),this.canvas.add(n),n.setCoords(),this.canvas.contextTop&&this.canvas.clearContext(this.canvas.contextTop),this.canvas.renderAll(),this.canvas.fire("path:created",{path:n})}else this.canvas.renderAll()}})}("undefined"!=typeof exports?exports:this),function(){function t(){}var e=fabric.util.object.extend,i=fabric.util.getPointer,n=fabric.util.degreesToRadians,r=fabric.util.radiansToDegrees,o=Math.atan2,s=Math.abs,a=Math.min,c=Math.max;fabric.Canvas=function(t,e){e||(e={}),this._initStatic(t,e),this._initInteractive(),this._createCacheCanvas(),fabric.Canvas.activeInstance=this},t.prototype=fabric.StaticCanvas.prototype,fabric.Canvas.prototype=new t;var l={uniScaleTransform:!1,centerTransform:!1,interactive:!0,selection:!0,selectionColor:"rgba(100, 100, 255, 0.3)",selectionDashArray:[],selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,freeDrawingColor:"rgb(0, 0, 0)",freeDrawingLineWidth:1,hoverCurs
1or:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",rotationCursor:"crosshair",containerClass:"canvas-container",perPixelTargetFind:!1,targetFindTolerance:0,_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this.freeDrawing=fabric.FreeDrawing&&new fabric.FreeDrawing(this),this._initWrapperElement(),this._createUpperCanvas(),this._initEvents(),this.calcOffset()},_resetCurrentTransform:function(t){var e=this._currentTransform;e.target.set("scaleX",e.original.scaleX),e.target.set("scaleY",e.original.scaleY),e.target.set("left",e.original.left),e.target.set("top",e.original.top),t.altKey||this.centerTransform?("center"!==e.originX&&("right"===e.originX?e.mouseXSign=-1:e.mouseXSign=1),"center"!==e.originY&&("bottom"===e.originY?e.mouseYSign=-1:e.mouseYSign=1),e.originX="center",e.originY="center"):(e.originX=e.original.originX,e.originY=e.original.originY)},containsPoint:function(t,e){var i=this.getPointer(t),n=this._normalizePointer(e,i),r=n.x,o=n.y,s=e._getImageLines(e.oCoords),a=e._findCrossPoints(r,o,s);return!!(a&&a%2==1||e._findTargetCorner(t,this._offset))},_normalizePointer:function(t,e){var i=this.getActiveGroup(),n=e.x,r=e.y;return i&&"group"!==t.type&&i.contains(t)&&(n-=i.left,r-=i.top),{x:n,y:r}},_isTargetTransparent:function(t,e,i){var n=this.contextCache,r=t.hasBorders,o=t.transparentCorners;t.hasBorders=t.transparentCorners=!1,this._draw(n,t),t.hasBorders=r,t.transparentCorners=o,this.targetFindTolerance>0&&(e>this.targetFindTolerance?e-=this.targetFindTolerance:e=0,i>this.targetFindTolerance?i-=this.targetFindTolerance:i=0);for(var s=!0,a=n.getImageData(e,i,2*this.targetFindTolerance||1,2*this.targetFindTolerance||1),c=3;c<a.data.length&&!1!=(s=a.data[c]<=0);c+=4);return a=null,this.clearContext(n),s},_shouldClearSelection:function(t){var e=this.findTarget(t),i=this.getActiveGroup();return!e||e&&i&&!i.contains(e)&&i!==e&&!t.shiftKey},_setupCurrentTransform:function(t,e){var r,o="drag",s=i(t,e.canvas.upperCanvasEl);(r=e._findTargetCorner(t,this._offset))&&(o="ml"===r||"mr"===r?"scaleX":"mt"===r||"mb"===r?"scaleY":"mtr"===r?"rotate":"scale");var a="center",c="center";"ml"===r||"tl"===r||"bl"===r?a="right":"mr"!==r&&"tr"!==r&&"br"!==r||(a="left"),"tl"===r||"mt"===r||"tr"===r?c="bottom":"bl"!==r&&"mb"!==r&&"br"!==r||(c="top"),"mtr"===r&&(a="center",c="center"),this._currentTransform={target:e,action:o,scaleX:e.scaleX,scaleY:e.scaleY,offsetX:s.x-e.left,offsetY:s.y-e.top,originX:a,originY:c,ex:s.x,ey:s.y,left:e.left,top:e.top,theta:n(e.angle),width:e.width*e.scaleX,mouseXSign:1,mouseYSign:1},this._currentTransform.original={left:e.left,top:e.top,scaleX:e.scaleX,scaleY:e.scaleY,originX:a,originY:c},this._resetCurrentTransform(t)},_shouldHandleGroupLogic:function(t,e){var i=this.getActiveObject();return t.shiftKey&&(this.getActiveGroup()||i&&i!==e)&&this.selection},_handleGroupLogic:function(t,e){if(e!==this.getActiveGroup()||(e=this.findTarget(t,!0))&&!e.isType("group")){var i=this.getActiveGroup();if(i)i.contains(e)?(i.removeWithUpdate(e),this._resetObjectTransform(i),e.setActive(!1),1===i.size()&&this.discardActiveGroup()):(i.addWithUpdate(e),this._resetObjectTransform(i)),this.fire("selection:created",{target:i,e:t}),i.setActive(!0);else{if(this._activeObject&&e!==this._activeObject){var n=new fabric.Group([this._activeObject,e]);this.setActiveGroup(n),i=this.getActiveGroup()}e.setActive(!0)}i&&i.saveCoords()}},_translateObject:function(t,e){var i=this._currentTransform.target;i.get("lockMovementX")||i.set("left",t-this._currentTransform.offsetX),i.get("lockMovementY")||i.set("top",e-this._currentTransform.offsetY)},_scaleObject:function(t,e,i){var n=this._currentTransform,r=this._offset,o=n.target,s=o.get("lockScalingX"),a=o.get("lockScalingY");if(!s||!a){var c=o.translateToOriginPoint(o.getCenterPoint(),n.originX,n.originY),l=o.toLocalPoint(new fabric.Point(t-r.left,e-r.top),n.originX,n.originY);"right"===n.originX?l.x*=-1:"center"===n.originX&&(l.x*=2*n.mouseXSign,l.x<0&&(n.mouseXSign=-n.mouseXSign)),"bottom"===n.originY?l.y*=-1:"center"===n.originY&&(l.y*=2*n.mouseYSign,l.y<0&&(n.mouseYSign=-n.mouseYSign));var u=o.scaleX,h=o.scaleY;if("equally"!==i||s||a)i?"x"!==i||o.get("lockUniScaling")?"y"!==i||o.get("lockUniScaling")||(h=l.y/(o.height+o.padding),a||o.set("scaleY",h)):(u=l.x/(o.width+o.padding),s||o.set("scaleX",u)):(u=l.x/(o.width+o.padding),h=l.y
1/(o.height+o.padding),s||o.set("scaleX",u),a||o.set("scaleY",h));else{var f=l.y+l.x,d=o.height*n.original.scaleY+o.width*n.original.scaleX+2*o.padding-2*o.strokeWidth+1;u=n.original.scaleX*f/d,h=n.original.scaleY*f/d,o.set("scaleX",u),o.set("scaleY",h)}u<0&&("left"===n.originX?n.originX="right":"right"===n.originX&&(n.originX="left")),h<0&&("top"===n.originY?n.originY="bottom":"bottom"===n.originY&&(n.originY="top")),o.setPositionByOrigin(c,n.originX,n.originY)}},_rotateObject:function(t,e){var i=this._currentTransform,n=this._offset;if(!i.target.get("lockRotation")){var s=o(i.ey-i.top-n.top,i.ex-i.left-n.left),a=o(e-i.top-n.top,t-i.left-n.left);i.target.angle=r(a-s+i.theta)}},_setCursor:function(t){this.upperCanvasEl.style.cursor=t},_resetObjectTransform:function(t){t.scaleX=1,t.scaleY=1,t.setAngle(0)},_drawSelection:function(){var t=this.contextTop,e=this._groupSelector,i=e.left,n=e.top,r=s(i),o=s(n);if(t.fillStyle=this.selectionColor,t.fillRect(e.ex-(i>0?0:-i),e.ey-(n>0?0:-n),r,o),t.lineWidth=this.selectionLineWidth,t.strokeStyle=this.selectionBorderColor,this.selectionDashArray.length>1){var a=e.ex+.5-(i>0?0:r),c=e.ey+.5-(n>0?0:o);t.beginPath(),fabric.util.drawDashedLine(t,a,c,a+r,c,this.selectionDashArray),fabric.util.drawDashedLine(t,a,c+o-1,a+r,c+o-1,this.selectionDashArray),fabric.util.drawDashedLine(t,a,c,a,c+o,this.selectionDashArray),fabric.util.drawDashedLine(t,a+r-1,c,a+r-1,c+o,this.selectionDashArray),t.closePath(),t.stroke()}else t.strokeRect(e.ex+.5-(i>0?0:r),e.ey+.5-(n>0?0:o),r,o)},_findSelectedObjects:function(t){for(var e,i=[],n=this._groupSelector.ex,r=this._groupSelector.ey,o=n+this._groupSelector.left,s=r+this._groupSelector.top,l=new fabric.Point(a(n,o),a(r,s)),u=new fabric.Point(c(n,o),c(r,s)),h=0,f=this._objects.length;h<f;++h)(e=this._objects[h])&&(e.intersectsWithRect(l,u)||e.isContainedWithinRect(l,u))&&this.selection&&e.selectable&&(e.setActive(!0),i.push(e));1===i.length?this.setActiveObject(i[0],t):i.length>1&&(i=new fabric.Group(i),this.setActiveGroup(i),i.saveCoords(),this.fire("selection:created",{target:i})),this.renderAll()},findTarget:function(t,e){var i,n=this.getPointer(t);if(this.controlsAboveOverlay&&this.lastRenderedObjectWithControlsAboveOverlay&&this.containsPoint(t,this.lastRenderedObjectWithControlsAboveOverlay)&&this.lastRenderedObjectWithControlsAboveOverlay._findTargetCorner(t,this._offset))return i=this.lastRenderedObjectWithControlsAboveOverlay;var r=this.getActiveGroup();if(r&&!e&&this.containsPoint(t,r))return i=r;for(var o=[],s=this._objects.length;s--;)if(this._objects[s]&&!this._objects[s].overlay&&this.containsPoint(t,this._objects[s])){if(!this.perPixelTargetFind&&!this._objects[s].perPixelTargetFind){i=this._objects[s],this.relatedTarget=i;break}o[o.length]=this._objects[s]}for(var a=0,c=o.length;a<c;
1a++)if(n=this.getPointer(t),!this._isTargetTransparent(o[a],n.x,n.y)){i=o[a],this.relatedTarget=i;break}return i&&i.selectable?i:void 0},getPointer:function(t){var e=i(t,this.upperCanvasEl);return{x:Math.ceil((e.x-this._offset.left)*(this.upperCanvasEl.getAttribute("width")/parseInt(this.upperCanvasEl.style.width))),y:Math.ceil((e.y-this._offset.top)*(this.upperCanvasEl.getAttribute("height")/parseInt(this.upperCanvasEl.style.height)))}},_createUpperCanvas:function(){this.upperCanvasEl=this._createCanvasElement(),this.upperCanvasEl.className="upper-canvas",this.wrapperEl.appendChild(this.upperCanvasEl),this._applyCanvasStyle(this.upperCanvasEl),this.contextTop=this.upperCanvasEl.getContext("2d")},_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.getWidth()+"px",height:this.getHeight()+"px",position:"relative"}),fabric.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(t){var e=this.getWidth()||t.width,i=this.getHeight()||t.height;fabric.util.setStyle(t,{position:"absolute",width:e+"px",height:i+"px",left:0,top:0}),t.width=e,t.height=i,fabric.util.makeElementUnselectable(t)},getSelectionContext:function(){return this.contextTop}
1,getSelectionElement:function(){return this.upperCanvasEl},setActiveObject:function(t,e){return this._activeObject&&this._activeObject.setActive(!1),this._activeObject=t,t.setActive(!0),this.renderAll(),this.fire("object:selected",{target:t,e:e}),t.fire("selected",{e:e}),this},getActiveObject:function(){return this._activeObject},discardActiveObject:function(){return this._activeObject&&this._activeObject.setActive(!1),this._activeObject=null,this},setActiveGroup:function(t){return this._activeGroup=t,t&&(t.canvas=this,t.setActive(!0)),this},getActiveGroup:function(){return this._activeGroup},discardActiveGroup:function(){var t=this.getActiveGroup();return t&&t.destroy(),this.setActiveGroup(null)},deactivateAll:function(){for(var t=this.getObjects(),e=0,i=t.length;e<i;e++)t[e].setActive(!1);return this.discardActiveGroup(),this.discardActiveObject(),this},deactivateAllWithDispatch:function(){var t=this.getActiveGroup()||this.getActiveObject();return t&&this.fire("before:selection:cleared",{target:t}),this.deactivateAll(),t&&this.fire("selection:cleared"),this}};fabric.Canvas.prototype.toString=fabric.StaticCanvas.prototype.toString,e(fabric.Canvas.prototype,l);for(var u in fabric.StaticCanvas)"prototype"!==u&&(fabric.Canvas[u]=fabric.StaticCanvas[u]);fabric.isTouchSupported&&(fabric.Canvas.prototype._setCursorFromEvent=function(){}),fabric.Element=fabric.Canvas}(),function(){var t={tr:"ne-resize",br:"se-resize",bl:"sw-resize",tl:"nw-resize",ml:"w-resize",mt:"n-resize",mr:"e-resize",mb:"s-resize"},e=fabric.util.addListener,i=fabric.util.removeListener,n=fabric.util.getPointer;fabric.util.object.extend(fabric.Canvas.prototype,{_initEvents:function(){var t=this;this._onMouseDown=this._onMouseDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onResize=this._onResize.bind(this),e(fabric.window,"resize",this._onResize),fabric.isTouchSupported?(e(this.upperCanvasEl,"touchstart",this._onMouseDown),e(this.upperCanvasEl,"touchmove",this._onMouseMove),void 0!==Event&&"add"in Event&&Event.add(this.upperCanvasEl,"gesture",function(e,i){t.__onTransformGesture(e,i)})):(e(this.upperCanvasEl,"mousedown",this._onMouseDown),e(this.upperCanvasEl,"mousemove",this._onMouseMove))},_onMouseDown:function(t){this.__onMouseDown(t),!fabric.isTouchSupported&&e(fabric.document,"mouseup",this._onMouseUp),fabric.isTouchSupported&&e(fabric.document,"touchend",this._onMouseUp),!fabric.isTouchSupported&&e(fabric.document,"mousemove",this._onMouseMove),fabric.isTouchSupported&&e(fabric.document,"touchmove",this._onMouseMove),!fabric.isTouchSupported&&i(this.upperCanvasEl,"mousemove",this._onMouseMove),fabric.isTouchSupported&&i(this.upperCanvasEl,"touchmove",this._onMouseMove)},_onMouseUp:function(t){this.__onMouseUp(t),!fabric.isTouchSupported&&i(fabric.document,"mouseup",this._onMouseUp),fabric.isTouchSupported&&i(fabric.document,"touchend",this._onMouseUp),!fabric.isTouchSupported&&i(fabric.document,"mousemove",this._onMouseMove),fabric.isTouchSupported&&i(fabric.document,"touchmove",this._onMouseMove),!fabric.isTouchSupported&&e(this.upperCanvasEl,"mousemove",this._onMouseMove),fabric.isTouchSupported&&e(this.upperCanvasEl,"touchmove",this._onMouseMove)},_onMouseMove:function(t){this.__onMouseMove(t)},_onResize:function(){this.calcOffset()},__onMouseUp:function(t){var e;if(this.isDrawingMode&&this._isCurrentlyDrawing)return this.freeDrawing._finalizeAndAddPath(),void this.fire("mouse:up",{e:t});if(this._currentTransform){var i=this._currentTransform;(e=i.target)._scaling&&(e._scaling=!1);for(var n=this._objects.length;n--;)this._objects[n].setCoords();e.isMoving=!1,this.stateful&&e.hasStateChanged()&&(this.fire("object:modified",{target:e}),e.fire("modified")),this._previousOriginX&&(this._currentTransform.target.adjustPosition(this._previousOriginX),this._previousOriginX=null)}this._currentTransform=null,this._groupSelector&&this._findSelectedObjects(t);var r=this.getActiveGroup();r&&(r.setObjectsCoords(),r.set("isMoving",!1),this._setCursor(this.defaultCursor)),this._groupSelector=null,this.renderAll(),this._setCursorFromEvent(t,e),this._setCursor("");var o=this;setTimeout(function(){o._setCursorFromEvent(t,e)},50),this.fire("mouse:up",{target:e,e:t}),e&&e.fire("mouseup",{e:t})},__onMouseDown:function(t){var e;if(("which"in t?1===t.which:1===t.button)||fabric.isTouchSupported){if(this.isDrawingMode)return e=this.getPointer(t),this.freeDrawing._prepareForDrawing(e),this.freeDrawing._captureDrawingPath(e),void this.fire("mouse:down",{e:t});if(!this._currentTransform){var i,n=this.findTarget(t);e=this.getPointer(t),this._shouldClearSelection(t)?(this._groupSelector={ex:e.x,ey:e.y,top:0,left:0},this.deactivateAllWithDispatch()):(this.stateful&&n.saveState(),(i=n._findTargetCorner(t,this._offset))&&this.onBeforeScaleRotate(n),this._shouldHandleGroupLogic(t,n)?(this._handleGroupLogic(t,n),n=this.getActiveGroup()):(n!==this.getActiveGroup()&&this.deactivateAll(),this.setActiveObject(n,t)),this._setupCurrentTransform(t,n)),this.renderAll(),this.fire("mouse:down",{target:n,e:t}),n&&n.fire("mousedown",{e:t}),"mtr"===i&&(this._previousOriginX=this._currentTransform.target.originX,this._currentTransform.target.adjustPosition("center"),this._currentTransform.left=this._currentTransform.target.left,this._currentTransform.top=this._currentTransform.target.top)}}},__onMouseMove:function(t){var e,i;if(this.isDrawingMode)return t.preventDefault&&t.preventDefault(),this._isCurrentlyDrawing&&(i=this.getPointer(t),this.freeDrawing._captureDrawingPath(i),this.clearContext(this.contextTop),this.freeDrawing._render(this.contextTop)),this.upperCanvasEl.style.cursor=this.freeDrawingCursor,void this.fire("mouse:move",{e:t});var r=this._groupSelector;
1if(null!==r)i=n(t,this.upperCanvasEl),r.left=i.x-this._offset.left-r.ex,r.top=i.y-this._offset.top-r.ey,this.renderTop();else if(this._currentTransform){t.preventDefault&&t.preventDefault();var o=(i=n(t,this.upperCanvasEl)).x,s=i.y;this._currentTransform.target.isMoving=!0;var a=this._currentTransform,c=!1;"scale"!==a.action&&"scaleX"!==a.action&&"scaleY"!==a.action||(!t.altKey||"center"===a.originX&&"center"===a.originY)&&(t.altKey||"center"!==a.originX||"center"!==a.originY)||(this._resetCurrentTransform(t),c=!0),"rotate"===this._currentTransform.action?(this._rotateObject(o,s),this.fire("object:rotating",{target:this._currentTransform.target,e:t}),this._currentTransform.target.fire("rotating")):"scale"===this._currentTransform.action?(t.shiftKey||this.uniScaleTransform?(this._currentTransform.currentAction="scale",this._scaleObject(o,s)):(c||"scale"!==a.currentAction||this._resetCurrentTransform(t),this._currentTransform.currentAction="scaleEqually",this._scaleObject(o,s,"equally")),this.fire("object:scaling",{target:this._currentTransform.target,e:t})):"scaleX"===this._currentTransform.action?(this._scaleObject(o,s,"x"),this.fire("object:scaling",{target:this._currentTransform.target,e:t}),this._currentTransform.target.fire("scaling",{e:t})):"scaleY"===this._currentTransform.action?(this._scaleObject(o,s,"y"),this.fire("object:scaling",{target:this._currentTransform.target,e:t}),this._currentTransform.target.fire("scaling",{e:t})):(this._translateObject(o,s),this.fire("object:moving",{target:this._currentTransform.target,e:t}),this._setCursor(this.moveCursor),this._currentTransform.target.fire("moving",{e:t})),this.renderAll()}else{var l=this.upperCanvasEl.style;if(e=this.findTarget(t))t.preventDefault&&t.preventDefault(),this._setCursorFromEvent(t,e);else{for(var u=this._objects.length;u--;)this._objects[u]&&!this._objects[u].active&&this._objects[u].setActive(!1);l.cursor=this.defaultCursor}}this.fire("mouse:move",{target:e,e:t}),e&&e.fire("mousemove",{e:t})},_setCursorFromEvent:function(e,i){var n=this.upperCanvasEl.style;if(!i)return n.cursor=this.defaultCursor,!1;var r=this.getActiveGroup(),o=i._findTargetCorner&&(!r||!r.contains(i))&&i._findTargetCorner(e,this._offset);if(o)if(o in t)n.cursor=t[o];else{if("mtr"!==o||!i.hasRotatingPoint)return n.cursor=this.defaultCursor,!1;n.cursor=this.rotationCursor}else n.cursor=this.hoverCursor;return!0}})}(),fabric.util.object.extend(fabric.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(t,e){var i=function(){},n=(e=e||{}).onComplete||i,r=e.onChange||i,o=this;return fabric.util.animate({startValue:t.get("left"),endValue:this.getCenter().left,duration:this.FX_DURATION,onChange:function(e){t.set("left",e),o.renderAll(),r()},onComplete:function(){t.setCoords(),n()}}),this},fxCenterObjectV:function(t,e){var i=function(){},n=(e=e||{}).onComplete||i,r=e.onChange||i,o=this;return fabric.util.animate({startValue:t.get("top"),endValue:this.getCenter().top,duration:this.FX_DURATION,onChange:function(e){t.set("top",e),o.renderAll(),r()},onComplete:function(){t.setCoords(),n()}}),this},fxRemove:function(t,e){var i=function(){},n=(e=e||{}).onComplete||i,r=e.onChange||i,o=this;return fabric.util.animate({startValue:t.get("opacity"),endValue:0,duration:this.FX_DURATION,onStart:function(){t.setActive(!1)},onChange:function(e){t.set("opacity",e),o.renderAll(),r()},onComplete:function(){o.remove(t),n()}}),this}}),fabric.util.object.extend(fabric.StaticCanvas.prototype,{loadFromDatalessJSON:function(t,e){if(t){var i="string"==typeof t?JSON.parse(t):t;if(i&&(!i||i.objects)){this.clear();var n=this;this._enlivenDatalessObjects(i.objects,function(){n._setBgOverlayImages(i,e)})}}},_enlivenDatalessObjects:function(t,e){function i(t,i){n.insertAt(t,i,!0),t.setCoords(),++r===o&&e&&e()}var n=this,r=0,o=t.length;0===o&&e&&e();try{t.forEach(function(t,e){var n=t.paths?"paths":"path",r=t[n];if(delete t[n],"string"!=typeof r)if("image"===t.type||"group"===t.type)fabric[fabric.util.string.capitalize(t.type)].fromObject(t,function(t){i(t,e)});else{var o=fabric[fabric.util.string.camelize(fabric.util.string.capitalize(t.type))];if(!o||!o.fromObject)return;r&&(t[n]=r),i(o.fromObject(t),e)}else if("image"===t.type)fabric.util.loadImage(r,function(n){var o=new fabric.Image(n);o.setSourcePath(r),fabric.util.object.extend(o,t),o.setAngle(t.angle),i(o,e)});else if("text"===t.type)if(t.useNative)i(fabric.Text.fromObject(t),e);else{t.path=r;var s=fabric.Text.fromObject(t);fabric.util.getScript(r,function(){"[object Opera]"===Object.prototype.toString.call(fabric.window.opera)?setTimeout(function(){i(s,e)},500):i(s,e)})}else fabric.loadSVGFromURL(r,function(n){var o=fabric.util.groupSVGElements(n,t,r);o instanceof fabric.PathGroup||(fabric.util.object.extend(o,t),void 0!==t.angle&&o.setAngle(t.angle)),i(o,e)})},this)}catch(t){fabric.log(t)}},loadFromJSON:function(t,e){if(t){var i="string"==typeof t?JSON.parse(t):t,n=this;return this._enlivenObjects(i.objects,function(){n._setBgOverlayImages(i,e)}),this}},_setBgOverlayImages:function(t,e){var i,n,r,o=this;
1t.backgroundImage?this.setBackgroundImage(t.backgroundImage,function(){o.backgroundImageOpacity=t.backgroundImageOpacity,o.backgroundImageStretch=t.backgroundImageStretch,o.renderAll(),n=!0,e&&r&&i&&e()}):n=!0,t.overlayImage?this.setOverlayImage(t.overlayImage,function(){o.overlayImageLeft=t.overlayImageLeft||0,o.overlayImageTop=t.overlayImageTop||0,o.renderAll(),r=!0,e&&n&&i&&e()}):r=!0,t.background?this.setBackgroundColor(t.background,function(){o.renderAll(),i=!0,e&&r&&n&&e()}):i=!0,t.backgroundImage||t.overlayImage||t.background||e&&e()},_enlivenObjects:function(t,e){var i=this;fabric.util.enlivenObjects(t,function(t){t.forEach(function(t,e){i.insertAt(t,e,!0)}),e&&e()})},_toDataURL:function(t,e){this.clone(function(i){e(i.toDataURL(t))})},_toDataURLWithMultiplier:function(t,e,i){this.clone(function(n){i(n.toDataURLWithMultiplier(t,e))})},clone:function(t){var e=JSON.stringify(this);this.cloneWithoutData(function(i){i.loadFromJSON(e,function(){t&&t(i)})})},cloneWithoutData:function(t){var e=fabric.document.createElement("canvas");e.width=this.getWidth(),e.height=this.getHeight();var i=new fabric.Canvas(e);i.clipTo=this.clipTo,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(){var t=fabric.util.degreesToRadians,e=fabric.util.radiansToDegrees;fabric.util.object.extend(fabric.Canvas.prototype,{__onTransformGesture:function(t,e){if(!this.isDrawingMode&&2===t.touches.length&&"gesture"===e.gesture){var i=this.findTarget(t);void 0!==i&&(this.onBeforeScaleRotate(i),this._rotateObjectByAngle(e.rotation),this._scaleObjectBy(e.scale)),this.fire("touch:gesture",{target:i,e:t,self:e})}},_scaleObjectBy:function(t,e){var i=this._currentTransform,n=i.target,r=n.get("lockScalingX"),o=n.get("lockScalingY");r&&o||(n._scaling=!0,e?"x"!==e||n.get("lockUniScaling")?"y"!==e||n.get("lockUniScaling")||o||n.set("scaleY",i.scaleY*t):r||n.set("scaleX",i.scaleX*t):(r||n.set("scaleX",i.scaleX*t),o||n.set("scaleY",i.scaleY*t)))},_rotateObjectByAngle:function(i){var n=this._currentTransform;n.target.get("lockRotation")||(n.target.angle=e(t(i)+n.theta))}})}(),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.toFixed,r=e.util.string.capitalize,o=e.util.degreesToRadians;if(!e.Object){var s=t.Image;try{var a="undefined"!=typeof require&&require("canvas").Image;a&&(s=a)}catch(t){e.log(t)}e.Object=e.util.createClass({type:"object",originX:"center",originY:"center",top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,cornerSize:12,transparentCorners:!0,padding:0,borderColor:"rgba(102,153,255,0.75)",cornerColor:"rgba(102,153,255,0.5)",fill:"rgb(0,0,0)",fillRule:"source-over",overlayFill:null,stroke:null,strokeWidth:1,strokeDashArray:null,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,transformMatrix:null,minScaleLimit:.01,selectable:!0,overlay:!1,visible:!0,hasControls:!0,hasBorders:!0,hasRotatingPoint:!0,rotatingPointOffset:40,perPixelTargetFind:!1,includeDefaultValues:!0,clipTo:null,stateProperties:"top left width height scaleX scaleY flipX flipY angle opacity cornerSize fill overlayFill originX originY stroke strokeWidth strokeDashArray fillRule borderScaleFactor transformMatrix selectable shadow visible".split(" "),initialize:function(t){t&&this.setOptions(t)},_initGradient:function(t){!t.fill||!t.fill.colorStops||t.fill instanceof e.Gradient||this.set("fill",new e.Gradient(t.fill))},_initPattern:function(t){!t.fill||!t.fill.source||t.fill instanceof e.Pattern||this.set("fill",new e.Pattern(t.fill)),!t.stroke||!t.stroke.source||t.stroke instanceof e.Pattern||this.set("stroke",new e.Pattern(t.stroke))},_initShadow:function(t){!t.shadow||t.shadow instanceof e.Shadow||this.setShadow(t.shadow)},setOptions:function(t){for(var e in t)this.set(e,t[e]);this._initGradient(t),this._initPattern(t),this._initShadow(t)},transform:function(t){t.globalAlpha=this.opacity;var e=this.getCenterPoint();t.translate(e.x,e.y),t.rotate(o(this.angle)),t.scale(this.scaleX*(this.flipX?-1:1),this.scaleY*(this.flipY?-1:1))},toObject:function(t){var i=e.Object.NUM_FRACTION_DIGITS,r={type:this.t
1ype,originX:this.originX,originY:this.originY,left:n(this.left,i),top:n(this.top,i),width:n(this.width,i),height:n(this.height,i),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,overlayFill:this.overlayFill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:this.strokeWidth,strokeDashArray:this.strokeDashArray,scaleX:n(this.scaleX,i),scaleY:n(this.scaleY,i),angle:n(this.getAngle(),i),flipX:this.flipX,flipY:this.flipY,opacity:n(this.opacity,i),selectable:this.selectable,hasControls:this.hasControls,hasBorders:this.hasBorders,hasRotatingPoint:this.hasRotatingPoint,transparentCorners:this.transparentCorners,perPixelTargetFind:this.perPixelTargetFind,shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible};return this.includeDefaultValues||(r=this._removeDefaultValues(r)),e.util.populateWithProperties(this,r,t),r},toDatalessObject:function(t){return this.toObject(t)},getSvgStyles:function(){return["stroke: ",this.stroke?this.stroke:"none","; ","stroke-width: ",this.strokeWidth?this.strokeWidth:"0","; ","stroke-dasharray: ",this.strokeDashArray?this.strokeDashArray.join(" "):"; ","fill: ",this.fill?this.fill&&this.fill.toLive?"url(#SVGID_"+this.fill.id+")":this.fill:"none","; ","opacity: ",this.opacity?this.opacity:"1",";",this.visible?"":" visibility: hidden;"].join("")},getSvgTransform:function(){var t=this.getAngle(),i=this.getCenterPoint(),r=e.Object.NUM_FRACTION_DIGITS;return["translate("+n(i.x,r)+" "+n(i.y,r)+")",0!==t?" rotate("+n(t,r)+")":"",1===this.scaleX&&1===this.scaleY?"":" scale("+n(this.scaleX,r)+" "+n(this.scaleY,r)+")",this.flipX?"matrix(-1 0 0 1 0 0) ":"",this.flipY?"matrix(1 0 0 -1 0 0)":""].join("")},_removeDefaultValues:function(t){var i=e.Object.prototype.options;return i&&this.stateProperties.forEach(function(e){t[e]===i[e]&&delete t[e]}),t},isActive:function(){return!!this.active},setActive:function(t){return this.active=!!t,this}
1,toString:function(){return"#<fabric."+r(this.type)+">"},get:function(t){return this[t]},set:function(t,e){if("object"==typeof t)for(var i in t)this._set(i,t[i]);else"function"==typeof e?this._set(t,e(this.get(t))):this._set(t,e);return this},_set:function(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):"width"!==t&&"height"!==t||(this.minScaleLimit=n(Math.min(.1,1/Math.max(this.width,this.height)),2)),this[t]=e,this},toggle:function(t){var e=this.get(t);return"boolean"==typeof e&&this.set(t,!e),this},setSourcePath:function(t){return this.sourcePath=t,this},render:function(t,i){if(0!==this.width&&0!==this.height&&this.visible){t.save();var n=this.transformMatrix;n&&!this.group&&t.setTransform(n[0],n[1],n[2],n[3],n[4],n[5]),i||this.transform(t),(this.stroke||this.strokeDashArray)&&(t.lineWidth=this.strokeWidth,this.stroke&&this.stroke.toLive?t.strokeStyle=this.stroke.toLive(t):t.strokeStyle=this.stroke),this.overlayFill?t.fillStyle=this.overlayFill:this.fill&&(t.fillStyle=this.fill.toLive?this.fill.toLive(t):this.fill),n&&this.group&&(t.translate(-this.group.width/2,-this.group.height/2),t.transform(n[0],n[1],n[2],n[3],n[4],n[5])),this._setShadow(t),this.clipTo&&e.util.clipContext(this,t),this._render(t,i),this.clipTo&&t.restore(),this._removeShadow(t),this.active&&!i&&(this.drawBorders(t),this.drawControls(t)),t.restore()}},_setShadow:function(t){this.shadow&&(t.shadowColor=this.shadow.color,t.shadowBlur=this.shadow.blur,t.shadowOffsetX=this.shadow.offsetX,t.shadowOffsetY=this.shadow.offsetY)},_removeShadow:function(t){t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0},clone:function(t,i){return this.constructor.fromObject?this.constructor.fromObject(this.toObject(i),t):new e.Object(this.toObject(i))},cloneAsImage:function(t){if(e.Image){var i=new s;i.onload=function(){t&&t(new e.Image(i),n),i=i.onload=null};var n={angle:this.getAngle(),flipX:this.getFlipX(),flipY:this.getFlipY()};this.set({angle:0,flipX:!1,flipY:!1}),this.toDataURL(function(t){i.src=t})}return this},toDataURL:function(t){function i(e){e.left=n.width/2,e.top=n.height/2,e.setActive(!1),r.add(e);var i=r.toDataURL();r.dispose(),r=e=null,t&&t(i)}var n=e.util.createCanvasElement();n.width=this.getBoundingRectWidth(),n.height=this.getBoundingRectHeight(),e.util.wrapElement(n,"div");var r=new e.Canvas(n);r.backgroundColor="transparent",r.renderAll(),this.constructor.async?this.clone(i):i(this.clone())},hasStateChanged:function(){return this.stateProperties.some(function(t){return this[t]!==this.originalState[t]},this)},saveState:function(t){return this.stateProperties.forEach(function(t){this.originalState[t]=this.get(t)},this),t&&t.stateProperties&&t.stateProperties.forEach(function(t){this.originalState[t]=this.get(t)},this),this},setupState:function(){this.originalState={},this.saveState()},isType:function(t){return this.type===t},toGrayscale:function(){var t=this.get("fill");return t&&this.set("overlayFill",new e.Color(t).toGrayscale().toRgb()),this},complexity:function(){return 0},toJSON:function(t){return this.toObject(t)},setGradient:function(t,i){i||(i={});var n={colorStops:[]};n.type=i.type||(i.r1||i.r2?"radial":"linear"),n.coords={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},(i.r1||i.r2)&&(n.coords.r1=i.r1,n.coords.r2=i.r2);for(var r in i.colorStops){var o=new e.Color(i.colorStops[r]);n.colorStops.push({offset:r,color:o.toRgb(),opacity:o.getAlpha()})}this.set(t,e.Gradient.forObject(this,n))},setPatternFill:function(t){this.set("fill",new e.Pattern(t))},setShadow:function(t){this.set("shadow",new e.Shadow(t))},animate:function(){if(arguments[0]&&"object"==typeof arguments[0])for(var t in arguments[0])this._animate(t,arguments[0][t],arguments[1]);else this._animate.apply(this,arguments);return this},_animate:function(t,i,n){var r,o=this;i=i.toString(),n=n?e.util.object.clone(n):{},~t.indexOf(".")&&(r=t.split("."));var s=r?this.get(r[0])[r[1]]:this.get(t);"from"in n||(n.from=s),i=~i.indexOf("=")?s+parseFloat(i.replace("=","")):parseFloat(i),e.util.animate({startValue:n.from,endValue:i,byValue:n.by,easing:n.easing,duration:n.duration,onChange:function(e){r?o[r[0]][r[1]]=e:o.set(t,e),n.onChange&&n.onChange()},onComplete:function(){o.setCoords(),n.onComplete&&n.onComplete()}})},centerH:function(){return this.canvas.centerObjectH(this),this},centerV:function(){return this.canvas.centerObjectV(this),this},center:function(){return this.centerH().centerV()},remove:function(){return this.canvas.remove(this)},sendToBack:function(){return this.canvas.sendToBack(this),this},bringToFront:function(){return this.canvas.bringToFront(this),this},sendBackwards:function(){return this.canvas.sendBackwards(this),this},bringForward:function(){return this.canvas.bringForward(this),this}}),e.util.createAccessors(e.Object),e.Object.prototype.rotate=e.Object.prototype.setAngle,i(e.Object.prototype,e.Observable),e.Object.NUM_FRACTION_DIGITS=2,e.Object.__uid=0}}
1("undefined"!=typeof exports?exports:this),function(){var t=fabric.util.degreesToRadians;fabric.util.object.extend(fabric.Object.prototype,{translateToCenterPoint:function(e,i,n){var r=e.x,o=e.y;return"left"===i?r=e.x+this.getWidth()/2:"right"===i&&(r=e.x-this.getWidth()/2),"top"===n?o=e.y+this.getHeight()/2:"bottom"===n&&(o=e.y-this.getHeight()/2),fabric.util.rotatePoint(new fabric.Point(r,o),e,t(this.angle))},translateToOriginPoint:function(e,i,n){var r=e.x,o=e.y;return"left"===i?r=e.x-this.getWidth()/2:"right"===i&&(r=e.x+this.getWidth()/2),"top"===n?o=e.y-this.getHeight()/2:"bottom"===n&&(o=e.y+this.getHeight()/2),fabric.util.rotatePoint(new fabric.Point(r,o),e,t(this.angle))},getCenterPoint:function(){return this.translateToCenterPoint(new fabric.Point(this.left,this.top),this.originX,this.originY)},toLocalPoint:function(e,i,n){var r,o,s=this.getCenterPoint();return void 0!==i&&void 0!==n?(r="left"===i?s.x-this.getWidth()/2:"right"===i?s.x+this.getWidth()/2:s.x,o="top"===n?s.y-this.getHeight()/2:"bottom"===n?s.y+this.getHeight()/2:s.y):(r=this.left,o=this.top),fabric.util.rotatePoint(new fabric.Point(e.x,e.y),s,-t(this.angle)).subtractEquals(new fabric.Point(r,o))},setPositionByOrigin:function(t,e,i){var n=this.translateToCenterPoint(t,e,i),r=this.translateToOriginPoint(n,this.originX,this.originY);this.set("left",r.x),this.set("top",r.y)},adjustPosition:function(e){var i=t(this.angle),n=this.getWidth()/2,r=Math.cos(i)*n,o=Math.sin(i)*n,s=this.getWidth(),a=Math.cos(i)*s,c=Math.sin(i)*s;"center"===this.originX&&"left"===e||"right"===this.originX&&"center"===e?(this.left-=r,this.top-=o):"left"===this.originX&&"center"===e||"center"===this.originX&&"right"===e?(this.left+=r,this.top+=o):"left"===this.originX&&"right"===e?(this.left+=a,this.top+=c):"right"===this.originX&&"left"===e&&(this.left-=a,this.top-=c),this.setCoords(),this.originX=e}})}(),function(){var t=fabric.util.degreesToRadians;fabric.util.object.extend(fabric.Object.prototype,{intersectsWithRect:function(t,e){var i=this.oCoords,n=new fabric.Point(i.tl.x,i.tl.y),r=new fabric.Point(i.tr.x,i.tr.y),o=new fabric.Point(i.bl.x,i.bl.y),s=new fabric.Point(i.br.x,i.br.y);return"Intersection"===fabric.Intersection.intersectPolygonRectangle([n,r,s,o],t,e).status},intersectsWithObject:function(t){function e(t){return{tl:new fabric.Point(t.tl.x,t.tl.y),tr:new fabric.Point(t.tr.x,t.tr.y),bl:new fabric.Point(t.bl.x,t.bl.y),br:new fabric.Point(t.br.x,t.br.y)}}var i=e(this.oCoords),n=e(t.oCoords);return"Intersection"===fabric.Intersection.intersectPolygonPolygon([i.tl,i.tr,i.br,i.bl],[n.tl,n.tr,n.br,n.bl]).status},isContainedWithinObject:function(t){return this.isContainedWithinRect(t.oCoords.tl,t.oCoords.br)},isContainedWithinRect:function(t,e){var i=this.oCoords,n=new fabric.Point(i.tl.x,i.tl.y),r=new fabric.Point(i.tr.x,i.tr.y),o=new fabric.Point(i.bl.x,i.bl.y);return n.x>t.x&&r.x<e.x&&n.y>t.y&&o.y<e.y},getBoundingRectWidth:function(){return this.getBoundingRect().width},getBoundingRectHeight:function(){return this.getBoundingRect().height},getBoundingRect:function(){this.oCoords||this.setCoords();var t=[this.oCoords.tl.x,this.oCoords.tr.x,this.oCoords.br.x,this.oCoords.bl.x],e=fabric.util.array.min(t),i=fabric.util.array.max(t),n=Math.abs(e-i),r=[this.oCoords.tl.y,this.oCoords.tr.y,this.oCoords.br.y,this.oCoords.bl.y],o=fabric.util.array.min(r),s=fabric.util.array.max(r);return{left:e,top:o,width:n,height:Math.abs(o-s)}},getWidth:function(){return this.width*this.scaleX},getHeight:function(){return this.height*this.scaleY},_constrainScale:function(t){return Math.abs(t)<this.minScaleLimit?t<0?-this.minScaleLimit:this.minScaleLimit:t},scale:function(t){return(t=this._constrainScale(t))<0&&(this.flipX=!this.flipX,this.flipY=!this.flipY,t*=-1),this.scaleX=t,this.scaleY=t,this.setCoords(),this},scaleToWidth:function(t){var e=this.getBoundingRectWidth()/this.getWidth();return this.scale(t/this.width/e)},scaleToHeight:function(t){var e=this.getBoundingRectHeight()/this.getHeight();return this.scale(t/this.height/e)},setCoords:function(){var e=this.strokeWidth>1?this.strokeWidth:0,i=this.padding,n=t(this.angle);this.currentWidth=(this.width+e)*this.scaleX+2*i,this.currentHeight=(this.height+e)*this.scaleY+2*i,this.currentWidth<0&&(this.currentWidth=Math.abs(this.currentWidth));var r=Math.sqrt(Math.pow(this.currentWidth/2,2)+Math.pow(this.currentHeight/2,2)),o=Math.atan(this.currentHeight/this.currentWidth),s=Math.cos(o+n)*r,a=Math.sin(o+n)*r,c=Math.sin(n),l=Math.cos(n),u=this.getCenterPoint(),h={x:u.x-s,y:u.y-a},f={x:h.x+this.currentWidth*l,y:h.y+this.currentWidth*c},d={x:f.x-this.currentHeight*c,y:f.y+this.currentHeight*l},p={x:h.x-this.currentHeight*c,y:h.y+this.currentHeight*l},g={x:h.x-this.currentHeight/2*c,y:h.y+this.currentHeight/2*l},v={x:h.x+this.currentWidth/2*l,y:h.y+this.currentWidth/2*c},m={x:f.x-this.currentHeight/2*c,y:f.y+this.currentHeight/2*l},b={x:p.x+this.currentWidth/2*l,y:p.y+this.currentWidth/2*c},y={x:h.x+this.currentWidth/2*l,y:h.y+this.currentWidth/2*c};return this.oCoords={tl:h,tr:f,br:d,bl:p,ml:g,mt:v,mr:m,mb:b,mtr:y},this._setCornerCoords(),this}})}(),function(){var t=fabric.util.getPointer,e=fabric.util.degreesToRadians;fabric.util.object.extend(fabric.Object.prototype,{_findTargetCorner:function(e,i){if(!this.hasControls||!this.active)return!1;var n,r,o=t(e,this.canvas.upperCanvasEl),s=o.x-i.left,a=o.y-i.top;for(var c in this.oCoords)if(("mtr"!==c||this.hasRotatingPoint)&&(!this.get("lockUniScaling")||"mt"!==c&&"mr"!==c&&"mb"!==c&&"ml"!==c)&&(r=this._getImageLines(this.oCoords[c].corner,c),(n=this._findCrossPoints(s,a,r))%2==1&&0!==n))return this.__corner=c,c;return!1}
1,_findCrossPoints:function(t,e,i){var n,r,o,s,a,c=0;for(var l in i)if(!((a=i[l]).o.y<e&&a.d.y<e||a.o.y>=e&&a.d.y>=e||(a.o.x===a.d.x&&a.o.x>=t?(s=a.o.x,e):(n=0,r=(a.d.y-a.o.y)/(a.d.x-a.o.x),(o=e-n*t)+n*(s=-(o-(a.o.y-r*a.o.x))/(n-r))),s>=t&&(c+=1),2!==c)))break;return c},_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}}},_setCornerCoords:function(){var t=this.oCoords,i=e(this.angle),n=e(45-this.angle),r=Math.sqrt(2*Math.pow(this.cornerSize,2))/2,o=r*Math.cos(n),s=r*Math.sin(n),a=Math.sin(i),c=Math.cos(i);t.tl.corner={tl:{x:t.tl.x-s,y:t.tl.y-o},tr:{x:t.tl.x+o,y:t.tl.y-s},bl:{x:t.tl.x-o,y:t.tl.y+s},br:{x:t.tl.x+s,y:t.tl.y+o}},t.tr.corner={tl:{x:t.tr.x-s,y:t.tr.y-o},tr:{x:t.tr.x+o,y:t.tr.y-s},br:{x:t.tr.x+s,y:t.tr.y+o},bl:{x:t.tr.x-o,y:t.tr.y+s}},t.bl.corner={tl:{x:t.bl.x-s,y:t.bl.y-o},bl:{x:t.bl.x-o,y:t.bl.y+s},br:{x:t.bl.x+s,y:t.bl.y+o},tr:{x:t.bl.x+o,y:t.bl.y-s}},t.br.corner={tr:{x:t.br.x+o,y:t.br.y-s},bl:{x:t.br.x-o,y:t.br.y+s},br:{x:t.br.x+s,y:t.br.y+o},tl:{x:t.br.x-s,y:t.br.y-o}},t.ml.corner={tl:{x:t.ml.x-s,y:t.ml.y-o},tr:{x:t.ml.x+o,y:t.ml.y-s},bl:{x:t.ml.x-o,y:t.ml.y+s},br:{x:t.ml.x+s,y:t.ml.y+o}},t.mt.corner={tl:{x:t.mt.x-s,y:t.mt.y-o},tr:{x:t.mt.x+o,y:t.mt.y-s},bl:{x:t.mt.x-o,y:t.mt.y+s},br:{x:t.mt.x+s,y:t.mt.y+o}},t.mr.corner={tl:{x:t.mr.x-s,y:t.mr.y-o},tr:{x:t.mr.x+o,y:t.mr.y-s},bl:{x:t.mr.x-o,y:t.mr.y+s},br:{x:t.mr.x+s,y:t.mr.y+o}},t.mb.corner={tl:{x:t.mb.x-s,y:t.mb.y-o},tr:{x:t.mb.x+o,y:t.mb.y-s},bl:{x:t.mb.x-o,y:t.mb.y+s},br:{x:t.mb.x+s,y:t.mb.y+o}},t.mtr.corner={tl:{x:t.mtr.x-s+a*this.rotatingPointOffset,y:t.mtr.y-o-c*this.rotatingPointOffset},tr:{x:t.mtr.x+o+a*this.rotatingPointOffset,y:t.mtr.y-s-c*this.rotatingPointOffset},bl:{x:t.mtr.x-o+a*this.rotatingPointOffset,y:t.mtr.y+s-c*this.rotatingPointOffset},br:{x:t.mtr.x+s+a*this.rotatingPointOffset,y:t.mtr.y+o-c*this.rotatingPointOffset}}},drawBorders:function(t){if(this.hasBorders){var e=this.padding,i=2*e,n=this.strokeWidth>1?this.strokeWidth:0;t.save(),t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,t.strokeStyle=this.borderColor;var r=1/this._constrainScale(this.scaleX),o=1/this._constrainScale(this.scaleY);t.lineWidth=1/this.borderScaleFactor,t.scale(r,o);var s=this.getWidth(),a=this.getHeight();if(t.strokeRect(.5+~~(-s/2-e-n/2*this.scaleX),.5+~~(-a/2-e-n/2*this.scaleY),~~(s+i+n*this.scaleX),~~(a+i+n*this.scaleY)),this.hasRotatingPoint&&!this.get("lockRotation")&&this.hasControls){var c=(this.flipY?a+n*this.scaleY+2*e:-a-n*this.scaleY-2*e)/2;t.beginPath(),t.moveTo(0,c),t.lineTo(0,c+(this.flipY?this.rotatingPointOffset:-this.rotatingPointOffset)),t.closePath(),t.stroke()}return t.restore(),this}},drawControls:function(t){if(this.hasControls){var e,i,n=this.cornerSize,r=n/2,o=this.strokeWidth/2,s=-this.width/2,a=-this.height/2,c=n/this.scaleX,l=n/this.scaleY,u=this.padding/this.scaleX,h=this.padding/this.scaleY,f=r/this.scaleY,d=r/this.scaleX,p=(r-n)/this.scaleX,g=(r-n)/this.scaleY,v=this.height,m=this.width,b=this.transparentCorners?"strokeRect":"fillRect",y="undefined"!=typeof G_vmlCanvasManager;return t.save(),t.lineWidth=1/Math.max(this.scaleX,this.scaleY),t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,t.strokeStyle=t.fillStyle=this.cornerColor,e=s-d-o-u,i=a-f-o-h,y||t.clearRect(e,i,c,l),t[b](e,i,c,l),e=s+m-d+o+u,i=a-f-o-h,y||t.clearRect(e,i,c,l),t[b](e,i,c,l),e=s-d-o-u,i=a+v+g+o+h,y||t.clearRect(e,i,c,l),t[b](e,i,c,l),e=s+m+p+o+u,i=a+v+g+o+h,y||t.clearRect(e,i,c,l),t[b](e,i,c,l),this.get("lockUniScaling")||(e=s+m/2-d,i=a-f-o-h,y||t.clearRect(e,i,c,l),t[b](e,i,c,l),e=s+m/2-d,i=a+v+g+o+h,y||t.clearRect(e,i,c,l),t[b](e,i,c,l),e=s+m+p+o+u,i=a+v/2-f,y||t.clearRect(e,i,c,l),t[b](e,i,c,l),e=s-d-o-u,i=a+v/2-f,y||t.clearRect(e,i,c,l),t[b](e,i,c,l)),this.hasRotatingPoint&&(e=s+m/2-d,i=this.flipY?a+v+this.rotatingPointOffset/this.scaleY-l/2+o+h:a-this.rotatingPointOffset/this.scaleY-l/2-o-h,y||t.clearRect(e,i,c,l),t[b](e,i,c,l)),t.restore(),this}}})}(),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n={x1:1,x2:1,y1:1,y2:1};e.Line?e.warn("fabric.Line is already defined"):(e.Line=e.util.createClass(e.Object,{type:"line",initialize:function(t,e){e=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._setWi
1dthHeight(e)},_setWidthHeight:function(t){t||(t={}),this.set("width",this.x2-this.x1||1),this.set("height",this.y2-this.y1||1),this.set("left","left"in t?t.left:this.x1+this.width/2),this.set("top","top"in t?t.top:this.y1+this.height/2)},_set:function(t,e){return this[t]=e,t in n&&this._setWidthHeight(),this},_render:function(t){t.beginPath(),this.group&&t.translate(-this.group.width/2+this.left,-this.group.height/2+this.top),t.moveTo(1===this.width?0:-this.width/2,1===this.height?0:-this.height/2),t.lineTo(1===this.width?0:this.width/2,1===this.height?0:this.height/2),t.lineWidth=this.strokeWidth;var e=t.strokeStyle;t.strokeStyle=t.fillStyle,t.stroke(),t.strokeStyle=e},complexity:function(){return 1},toObject:function(t){return i(this.callSuper("toObject",t),{x1:this.get("x1"),y1:this.get("y1"),x2:this.get("x2"),y2:this.get("y2")})},toSVG:function(){var t=[];return this.stroke&&this.stroke.toLive&&t.push(this.stroke.toSVG(this,!0)),t.push("<line ",'x1="',this.get("x1"),'" y1="',this.get("y1"),'" x2="',this.get("x2"),'" y2="',this.get("y2"),'" style="',this.getSvgStyles(),'"/>'),t.join("")}}),e.Line.ATTRIBUTE_NAMES="x1 y1 x2 y2 stroke stroke-width transform".split(" "),e.Line.fromElement=function(t,n){var r=e.parseAttributes(t,e.Line.ATTRIBUTE_NAMES),o=[r.x1||0,r.y1||0,r.x2||0,r.y2||0];return new e.Line(o,i(r,n))},e.Line.fromObject=function(t){var i=[t.x1,t.y1,t.x2,t.y2];return new e.Line(i,t)})}("undefined"!=typeof exports?exports:this),function(t){"use strict";function e(t){return"radius"in t&&t.radius>0}var i=t.fabric||(t.fabric={}),n=2*Math.PI,r=i.util.object.extend;i.Circle?i.warn("fabric.Circle is already defined."):(i.Circle=i.util.createClass(i.Object,{type:"circle",initialize:function(t){t=t||{},this.set("radius",t.radius||0),this.callSuper("initialize",t);var e=2*this.get("radius");this.set("width",e).set("height",e)},toObject:function(t){return r(this.callSuper("toObject",t),{radius:this.get("radius")})},toSVG:function(){var t=[];return this.fill&&this.fill.toLive&&t.push(this.fill.toSVG(this,!1)),this.stroke&&this.stroke.toLive&&t.push(this.stroke.toSVG(this,!1)),t.push("<circle ",'cx="0" cy="0" ','r="',this.radius,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),'"/>'),t.join("")},_render:function(t,e){t.beginPath(),t.globalAlpha=this.group?t.globalAlpha*this.opacity:this.opacity,t.arc(e?this.left:0,e?this.top:0,this.radius,0,n,!1),t.closePath(),this.fill&&t.fill(),this._removeShadow(t),this.stroke&&t.stroke()},getRadiusX:function(){return this.get("radius")*this.get("scaleX")},getRadiusY:function(){return this.get("radius")*this.get("scaleY")},setRadius:function(t){this.radius=t,this.set("width",2*t).set("height",2*t)},complexity:function(){return 1}}),i.Circle.ATTRIBUTE_NAMES="cx cy r fill fill-opacity opacity stroke stroke-width transform".split(" "),i.Circle.fromElement=function(t,n){n||(n={});var o=i.parseAttributes(t,i.Circle.ATTRIBUTE_NAMES);if(!e(o))throw new Error("value of `r` attribute is required and can not be negative");"left"in o&&(o.left-=n.width/2||0),"top"in o&&(o.top-=n.height/2||0);var s=new i.Circle(r(o,n));return s.cx=parseFloat(t.getAttribute("cx"))||0,s.cy=parseFloat(t.getAttribute("cy"))||0,s},i.Circle.fromObject=function(t){return new i.Circle(t)})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={});e.Triangle?e.warn("fabric.Triangle is already defined"):(e.Triangle=e.util.createClass(e.Object,{type:"triangle",initialize:function(t){t=t||{},this.callSuper("initialize",t),this.set("width",t.width||100).set("height",t.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.fill&&t.fill(),this.stroke&&t.stroke()},complexity:function(){return 1},toSVG:function(){var t=[],e=this.width/2,i=this.height/2,n=[-e+" "+i,"0 "+-i,e+" "+i].join(",");return this.fill&&this.fill.toLive&&t.push(this.fill.toSVG(this,!0)),this.stroke&&this.stroke.toLive&&t.push(this.stroke.toSVG(this,!0)),t.push("<polygon ",'points="',n,'" style="',this.getSvgStyles(),'" transform="',this.get
1SvgTransform(),'"/>'),t.join("")}}),e.Triangle.fromObject=function(t){return new e.Triangle(t)})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=2*Math.PI,n=e.util.object.extend;e.Ellipse?e.warn("fabric.Ellipse is already defined."):(e.Ellipse=e.util.createClass(e.Object,{type:"ellipse",rx:0,ry:0,initialize:function(t){t=t||{},this.callSuper("initialize",t),this.set("rx",t.rx||0),this.set("ry",t.ry||0),this.set("width",2*this.get("rx")),this.set("height",2*this.get("ry"))},toObject:function(t){return n(this.callSuper("toObject",t),{rx:this.get("rx"),ry:this.get("ry")})},toSVG:function(){var t=[];return this.fill&&this.fill.toLive&&t.push(this.fill.toSVG(this,!1)),this.stroke&&this.stroke.toLive&&t.push(this.stroke.toSVG(this,!1)),t.push("<ellipse ",'rx="',this.get("rx"),'" ry="',this.get("ry"),'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),'"/>'),t.join("")},render:function(t,e){if(0!==this.rx&&0!==this.ry)return this.callSuper("render",t,e)},_render:function(t,e){t.beginPath(),t.save(),t.globalAlpha=this.group?t.globalAlpha*this.opacity:this.opacity,this.transformMatrix&&this.group&&t.translate(this.cx,this.cy),t.transform(1,0,0,this.ry/this.rx,0,0),t.arc(e?this.left:0,e?this.top:0,this.rx,0,i,!1),this.stroke&&t.stroke(),this._removeShadow(t),this.fill&&t.fill(),t.restore()},complexity:function(){return 1}}),e.Ellipse.ATTRIBUTE_NAMES="cx cy rx ry fill fill-opacity opacity stroke stroke-width transform".split(" "),e.Ellipse.fromElement=function(t,i){i||(i={});var r=e.parseAttributes(t,e.Ellipse.ATTRIBUTE_NAMES),o=r.left,s=r.top;"left"in r&&(r.left-=i.width/2||0),"top"in r&&(r.top-=i.height/2||0);var a=new e.Ellipse(n(r,i));return a.cx=o||0,a.cy=s||0,a},e.Ellipse.fromObject=function(t){return new e.Ellipse(t)})}("undefined"!=typeof exports?exports:this),function(t){"use strict";function e(t){return t.left=t.left||0,t.top=t.top||0,t}var i=t.fabric||(t.fabric={}),n=i.util.object.extend;i.Rect?console.warn("fabric.Rect is already defined"):(i.Rect=i.util.createClass(i.Object,{type:"rect",rx:0,ry:0,initialize:function(t){t=t||{},this._initStateProperties(),this.callSuper("initialize",t),this._initRxRy(),this.x=0,this.y=0},_initStateProperties:function(){this.stateProperties=this.stateProperties.concat(["rx","ry"])},_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||0,i=this.ry||0,n=-this.width/2,r=-this.height/2,o=this.width,s=this.height;t.beginPath(),t.globalAlpha=this.group?t.globalAlpha*this.opacity:this.opacity,this.transformMatrix&&this.group&&t.translate(this.width/2+this.x,this.height/2+this.y),!this.transformMatrix&&this.group&&t.translate(-this.group.width/2+this.width/2+this.x,-this.group.height/2+this.height/2+this.y),t.moveTo(n+e,r),t.lineTo(n+o-e,r),t.quadraticCurveTo(n+o,r,n+o,r+i,n+o,r+i),t.lineTo(n+o,r+s-i),t.quadraticCurveTo(n+o,r+s,n+o-e,r+s,n+o-e,r+s),t.lineTo(n+e,r+s),t.quadraticCurveTo(n,r+s,n,r+s-i,n,r+s-i),t.lineTo(n,r+i),t.quadraticCurveTo(n,r,n+e,r,n+e,r),t.closePath(),this.fill&&t.fill(),this._removeShadow(t),this.strokeDashArray?this._renderDashedStroke(t):this.stroke&&t.stroke()},_renderDashedStroke:function(t){function e(e,c){for(var l=0,u=0,h=(c?o.height:o.width)+2*s;l<h;){var f=o.strokeDashArray[i++];(l+=f)>h&&(u=l-h),e?n+=f*e-(u*e||0):r+=f*c-(u*c||0),t[1&i?"moveTo":"lineTo"](n,r),i>=a&&(i=0)}}1&this.strokeDashArray.length&&this.strokeDashArray.push.apply(this.strokeDashArray,this.strokeDashArray);var i=0,n=-this.width/2,r=-this.height/2,o=this,s=this.padding,a=this.strokeDashArray.length;t.save(),t.beginPath(),e(1,0),e(0,1),e(-1,0),e(0,-1),t.stroke(),t.closePath(),t.restore()},_normalizeLeftTopProperties:function(t){return t.left&&this.set("left",t.left+this.getWidth()/2),this.set("x",t.left||0),t.top&&this.set("top",t.top+this.getHeight()/2),this.set("y",t.top||0),this},complexity:function(){return 1},toObject:function(t){return n(this.callSuper("toObject",t),{rx:this.get("rx")||0,ry:this.get("ry")||0})},toSVG:function(){var t=[];return this.fill&&this.fill.toLive&&t.push(this.fill.toSVG(this,!1)),this.stroke&&this.stroke.toLive&&t.push(this.stroke.toSVG(this,!1)),t.push("<rect ",'x="',-1*this.width/2,'" y="',-1*this.height/2,'" rx="',this.get("rx"),'" ry="',this.get("ry"),'" width="',this.width,'" height="',this.height,'" style="',this.get
1SvgStyles(),'" transform="',this.getSvgTransform(),'"/>'),t.join("")}}),i.Rect.ATTRIBUTE_NAMES="x y width height rx ry fill fill-opacity opacity stroke stroke-width transform".split(" "),i.Rect.fromElement=function(t,r){if(!t)return null;var o=i.parseAttributes(t,i.Rect.ATTRIBUTE_NAMES);o=e(o);var s=new i.Rect(n(r?i.util.object.clone(r):{},o));return s._normalizeLeftTopProperties(o),s},i.Rect.fromObject=function(t){return new i.Rect(t)})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.toFixed;e.Polyline?e.warn("fabric.Polyline is already defined"):(e.Polyline=e.util.createClass(e.Object,{type:"polyline",initialize:function(t,e,i){e=e||{},this.set("points",t),this.callSuper("initialize",e),this._calcDimensions(i)},_calcDimensions:function(t){return e.Polygon.prototype._calcDimensions.call(this,t)},toObject:function(t){return e.Polygon.prototype.toObject.call(this,t)},toSVG:function(){for(var t=[],e=[],n=0,r=this.points.length;n<r;n++)t.push(i(this.points[n].x,2),",",i(this.points[n].y,2)," ");return this.fill&&this.fill.toLive&&e.push(this.fill.toSVG(this,!1)),this.stroke&&this.stroke.toLive&&e.push(this.stroke.toSVG(this,!1)),e.push("<polyline ",'points="',t.join(""),'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),'"/>'),e.join("")},_render:function(t){var e;t.beginPath(),t.moveTo(this.points[0].x,this.points[0].y);for(var i=0,n=this.points.length;i<n;i++)e=this.points[i],t.lineTo(e.x,e.y);this.fill&&t.fill(),this._removeShadow(t),this.stroke&&t.stroke()},complexity:function(){return this.get("points").length}}),e.Polyline.ATTRIBUTE_NAMES="fill fill-opacity opacity stroke stroke-width transform".split(" "),e.Polyline.fromElement=function(t,i){if(!t)return null;i||(i={});for(var n=e.parsePointsAttribute(t.getAttribute("points")),r=e.parseAttributes(t,e.Polyline.ATTRIBUTE_NAMES),o=0,s=n.length;o<s;o++)n[o].x-=i.width/2||0,n[o].y-=i.height/2||0;return new e.Polyline(n,e.util.object.extend(r,i),!0)},e.Polyline.fromObject=function(t){var i=t.points;return new e.Polyline(i,t,!0)})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.array.min,r=e.util.array.max,o=e.util.toFixed;e.Polygon?e.warn("fabric.Polygon is already defined"):(e.Polygon=e.util.createClass(e.Object,{type:"polygon",initialize:function(t,e,i){e=e||{},this.points=t,this.callSuper("initialize",e),this._calcDimensions(i)},_calcDimensions:function(t){var e=this.points,i=n(e,"x"),o=n(e,"y"),s=r(e,"x"),a=r(e,"y");if(this.width=s-i||1,this.height=a-o||1,this.minX=i,this.minY=o,!t){var c=this.width/2,l=this.height/2;this.points.forEach(function(t){t.x-=c,t.y-=l},this)}},toObject:function(t){return i(this.callSuper("toObject",t),{points:this.points.concat()})},toSVG:function(){for(var t=[],e=[],i=0,n=this.points.length;i<n;i++)t.push(o(this.points[i].x,2),",",o(this.points[i].y,2)," ");return this.fill&&this.fill.toLive&&e.push(this.fill.toSVG(this,!1)),this.stroke&&this.stroke.toLive&&e.push(this.stroke.toSVG(this,!1)),e.push("<polygon ",'points="',t.join(""),'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),'"/>'),e.join("")},_render:function(t){var e;t.beginPath(),t.moveTo(this.points[0].x,this.points[0].y);for(var i=0,n=this.points.length;i<n;i++)e=this.points[i],t.lineTo(e.x,e.y);this.fill&&t.fill(),this._removeShadow(t),this.stroke&&(t.closePath(),t.stroke())},complexity:function(){return this.points.length}}),e.Polygon.ATTRIBUTE_NAMES="fill fill-opacity opacity stroke stroke-width transform".split(" "),e.Polygon.fromElement=function(t,n){if(!t)return null;n||(n={});for(var r=e.parsePointsAttribute(t.getAttribute("points")),o=e.parseAttributes(t,e.Polygon.ATTRIBUTE_NAMES),s=0,a=r.length;s<a;s++)r[s].x-=n.width/2||0,r[s].y-=n.height/2||0;return new e.Polygon(r,i(o,n),!0)},e.Polygon.fromObject=function(t){return new e.Polygon(t.points,t,!0)})}("undefined"!=typeof exports?exports:this),function(t){function e(t,e,r,o){for(var s=o[0],a=o[1],c=o[2],l=o[3],u=o[4],h=i(o[5],o[6],s,a,l,u,c,e,r),f=0;f<h.length;f++){var d=n.apply(this,h[f]);t.bezierCurveTo.apply(t,d)}}function i(t,e,i,n,r,o,a,l,h){if(s=u.call(arguments),c[s])return c[s];var f=a*(Math.PI/180),d=Math.sin(f),p=Math.cos(f),g=p*(l-t)*.5+d*(h-e)*.5,v=p*(h-e)*.5-d*(l-t)*.5,m=g*g/((i=Math.abs(i))*i)+v*v/((n=Math.abs(n))*n);m>1&&(i*=m=Math.sqrt(m),n*=m);var b=p/i,y=d/i,x=-d/n,k=p/n,w=b*l+y*h,_=x*l+k*h,C=b*t+y*e,S=x*t+k*e,E=1/((C-w)*(C-w)+(S-_)*(S-_))-.25;E<0&&(E=0);var T=Math.sqrt(E);o===r&&(T=-T);var O=.5*(w+C)-T*(S-_),P=.5*(_+S)+T*(C-w),j=Math.atan2(_-P,w-O),A=Math.atan2(S-P,C-O)-j;A<0&&1===o?A+=2*Math.PI:A>0&&0===o&&(A-=2*Math.PI);for(var I=Math.ceil(Math.abs(A/(.5*Math.PI+.001))),M=[],D=0;D<I;D++){var F=j+D*A/I,G=j+(D+1)*A/I;M[D]=[O,P,F,G,i,n,d,p]}return c[s]=M}function n(t,e,i,n,r,o,a,c){if(s=u.call(arguments),l[s])return l[s];
1var h=c*r,f=-a*o,d=a*r,p=c*o,g=.5*(n-i),v=8/3*Math.sin(.5*g)*Math.sin(.5*g)/Math.sin(g),m=t+Math.cos(i)-v*Math.sin(i),b=e+Math.sin(i)+v*Math.cos(i),y=t+Math.cos(n),x=e+Math.sin(n),k=y+v*Math.sin(n),w=x-v*Math.cos(n);return l[s]=[h*m+f*b,d*m+p*b,h*k+f*w,d*k+p*w,h*y+f*x,d*y+p*x]}function r(t){return"H"===t[0]?t[1]:t[t.length-2]}function o(t){return"V"===t[0]?t[1]:t[t.length-1]}var s,a={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},c={},l={},u=Array.prototype.join,h=t.fabric||(t.fabric={}),f=h.util.array.min,d=h.util.array.max,p=h.util.object.extend,g=Object.prototype.toString;h.Path?h.warn("fabric.Path is already defined"):(h.Path=h.util.createClass(h.Object,{type:"path",initialize:function(t,e){if(e=e||{},this.setOptions(e),!t)throw new Error("`path` argument is required");var i="[object Array]"===g.call(t);this.path=i?t:t.match&&t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi),this.path&&(i||(this.path=this._parsePath()),this._initializePath(e),e.sourcePath&&this.setSourcePath(e.sourcePath))},_initializePath:function(t){var e="width"in t,i="height"in t,n="left"in t,r="top"in t;e&&i?(r||(this.top=this.height/2),n||(this.left=this.width/2)):(p(this,this._parseDimensions()),e&&(this.width=t.width),i&&(this.height=t.height)),this.pathOffset=this._calculatePathOffset(r||n)},_calculatePathOffset:function(t){return{x:t?0:this.left-this.width/2,y:t?0:this.top-this.height/2}},_render:function(t){for(var i,n,r,o,s,a=null,c=0,l=0,u=0,h=0,f=-(this.width/2+this.pathOffset.x),d=-(this.height/2+this.pathOffset.y),p=0,g=this.path.length;p<g;++p){switch((i=this.path[p])[0]){case"l":c+=i[1],l+=i[2],t.lineTo(c+f,l+d);break;case"L":c=i[1],l=i[2],t.lineTo(c+f,l+d);break;case"h":c+=i[1],t.lineTo(c+f,l+d);break;case"H":c=i[1],t.lineTo(c+f,l+d);break;case"v":l+=i[1],t.lineTo(c+f,l+d);break;case"V":l=i[1],t.lineTo(c+f,l+d);break;case"m":c+=i[1],l+=i[2],t[!a||"m"!==a[0]&&"M"!==a[0]?"moveTo":"lineTo"](c+f,l+d);break;case"M":c=i[1],l=i[2],t[!a||"m"!==a[0]&&"M"!==a[0]?"moveTo":"lineTo"](c+f,l+d);break;case"c":n=c+i[5],r=l+i[6],u=c+i[3],h=l+i[4],t.bezierCurveTo(c+i[1]+f,l+i[2]+d,u+f,h+d,n+f,r+d),c=n,l=r;break;case"C":c=i[5],l=i[6],u=i[3],h=i[4],t.bezierCurveTo(i[1]+f,i[2]+d,u+f,h+d,c+f,l+d);break;case"s":n=c+i[3],r=l+i[4],u=u?2*c-u:c,h=h?2*l-h:l,t.bezierCurveTo(u+f,h+d,c+i[1]+f,l+i[2]+d,n+f,r+d),u=c+i[1],h=l+i[2],c=n,l=r;break;case"S":n=i[3],r=i[4],u=2*c-u,h=2*l-h,t.bezierCurveTo(u+f,h+d,i[1]+f,i[2]+d,n+f,r+d),c=n,l=r,u=i[1],h=i[2];break;case"q":n=c+i[3],r=l+i[4],u=c+i[1],h=l+i[2],t.quadraticCurveTo(u+f,h+d,n+f,r+d),c=n,l=r;break;case"Q":n=i[3],r=i[4],t.quadraticCurveTo(i[1]+f,i[2]+d,n+f,r+d),c=n,l=r,u=i[1],h=i[2];break;case"t":n=c+i[1],r=l+i[2],null===a[0].match(/[QqTt]/)?(u=c,h=l):"t"===a[0]?(u=2*c-o,h=2*l-s):"q"===a[0]&&(u=2*c-u,h=2*l-h),o=u,s=h,t.quadraticCurveTo(u+f,h+d,n+f,r+d),l=r,u=(c=n)+i[1],h=l+i[2];break;case"T":n=i[1],r=i[2],u=2*c-u,h=2*l-h,t.quadraticCurveTo(u+f,h+d,n+f,r+d),c=n,l=r;break;case"a":e(t,c+f,l+d,[i[1],i[2],i[3],i[4],i[5],i[6]+c+f,i[7]+l+d]),c+=i[6],l+=i[7];break;case"A":e(t,c+f,l+d,[i[1],i[2],i[3],i[4],i[5],i[6]+f,i[7]+d]),c=i[6],l=i[7];break;case"z":case"Z":t.closePath()}a=i}},render:function(t,e){t.save();var i=this.transformMatrix;i&&t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),e||this.transform(t),this.overlayFill?t.fillStyle=this.overlayFill:this.fill&&(t.fillStyle=this.fill.toLive?this.fill.toLive(t):this.fill),this.stroke&&(t.strokeStyle=this.stroke.toLive?this.stroke.toLive(t):this.stroke),this._setShadow(t),this.clipTo&&h.util.clipContext(this,t),t.beginPath(),this._render(t),this.fill&&t.fill(),this.clipTo&&t.restore(),this._removeShadow(t),this.stroke&&(t.strokeStyle=this.stroke,t.lineWidth=this.strokeWidth,t.lineCap=t.lineJoin="round",t.stroke()),!e&&this.active&&(this.drawBorders(t),this.drawControls(t)),t.restore()},toString:function(){return"#<fabric.Path ("+this.complexity()+'): { "top": '+this.top+', "left": '+this.left+" }>"},toObject:function(t){var e=p(this.callSuper("toObject",t),{path:this.path});return this.sourcePath&&(e.sourcePath=this.sourcePath),this.transformMatrix&&(e.transformMatrix=this.transformMatrix),e},toDatalessObject:function(t){var e=this.toObject(t);return this.sourcePath&&(e.path=this.sourcePath),delete e.sourcePath,e},toSVG:function(){for(var t=[],e=[],i=0,n=this.path.length;i<n;i++)t.push(this.path[i].join(" "));var r=t.join(" ");return this.fill&&this.fill.toLive&&e.push(this.fill.toSVG(this,!0)),this.stroke&&this.stroke.toLive&&e.push(this.stroke.toSVG(this,!0)),e.push('<g transform="',this.group?"":this.getSvgTransform(),'">
1',"<path ",'d="',r,'" style="',this.getSvgStyles(),'" transform="translate(',-this.width/2," ",-this.height/2,")",'" stroke-linecap="round" ',"/>","</g>"),e.join("")},complexity:function(){return this.path.length},_parsePath:function(){for(var t,e,i,n,r=[],o=0,s=this.path.length;o<s;o++){e=(t=this.path[o]).slice(1).trim().replace(/(\d)-/g,"$1###-").split(/\s|,|###/),n=[t.charAt(0)];for(var c=0,l=e.length;c<l;c++)i=parseFloat(e[c]),isNaN(i)||n.push(i);var u=n[0].toLowerCase(),h=a[u];if(n.length-1>h)for(var f=1,d=n.length;f<d;f+=h)r.push([n[0]].concat(n.slice(f,f+h)));else r.push(n)}return r},_parseDimensions:function(){var t,e,i,n,s=[],a=[],c=!1;this.path.forEach(function(l,u){"H"!==l[0]&&(t=r(0===u?l:this.path[u-1])),"V"!==l[0]&&(e=o(0===u?l:this.path[u-1])),l[0]===l[0].toLowerCase()&&(c=!0),i=c?t+r(l):"V"===l[0]?t:r(l),n=c?e+o(l):"H"===l[0]?e:o(l);var h=parseInt(i,10);isNaN(h)||s.push(h),h=parseInt(n,10),isNaN(h)||a.push(h)},this);var l=f(s),u=f(a),h=d(s)-l,p=d(a)-u,g={top:u+p/2,left:l+h/2,bottom:d(a)-p,right:d(s)-h};return g.width=h,g.height=p,g}}),h.Path.fromObject=function(t){return new h.Path(t.path,t)},h.Path.ATTRIBUTE_NAMES="d fill fill-opacity opacity fill-rule stroke stroke-width transform".split(" "),h.Path.fromElement=function(t,e){var i=h.parseAttributes(t,h.Path.ATTRIBUTE_NAMES);return new h.Path(i.d,p(i,e))})}("undefined"!=typeof exports?exports:this),function(t){"use strict";function e(t){for(var e=0,n=t.length;e<n;e++)if(!(t[e]instanceof i.Object)){var r=s(a(t[e].type));t[e]=i[r].fromObject(t[e])}return t}var i=t.fabric||(t.fabric={}),n=i.util.object.extend,r=i.util.array.invoke,o=i.Object.prototype.toObject,s=i.util.string.camelize,a=i.util.string.capitalize;i.PathGroup?i.warn("fabric.PathGroup is already defined"):(i.PathGroup=i.util.createClass(i.Path,{type:"path-group",fill:"",initialize:function(t,e){e=e||{},this.paths=t||[];for(var i=this.paths.length;i--;)this.paths[i].group=this;this.setOptions(e),this.setCoords(),e.sourcePath&&this.setSourcePath(e.sourcePath)},render:function(t){if(this.visible){t.save();var e=this.transformMatrix;e&&t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),this.transform(t),this._setShadow(t),this.clipTo&&i.util.clipContext(this,t);for(var n=0,r=this.paths.length;n<r;++n)this.paths[n].render(t,!0);this.clipTo&&t.restore(),this._removeShadow(t),this.active&&(this.drawBorders(t),this.drawControls(t)),t.restore()}},_set:function(t,e){if(("fill"===t||"overlayFill"===t)&&e&&this.isSameColor())for(var i=this.paths.length;i--;)this.paths[i]._set(t,e);return this.callSuper("_set",t,e)},toObject:function(t){return n(o.call(this,t),{paths:r(this.getObjects(),"toObject",t),sourcePath:this.sourcePath})},toDatalessObject:function(t){var e=this.toObject(t);return this.sourcePath&&(e.paths=this.sourcePath),e},toSVG:function(){for(var t=this.getObjects(),e=["<g ",'style="',this.getSvgStyles(),'" ','transform="',this.getSvgTransform(),'" ',">"],i=0,n=t.length;i<n;i++)e.push(t[i].toSVG());return e.push("</g>"),e.join("")},toString:function(){return"#<fabric.PathGroup ("+this.complexity()+"): { top: "+this.top+", left: "+this.left+" }>"},isSameColor:function(){var t=this.getObjects()[0].get("fill");return this.getObjects().every(function(e){return e.get("fill")===t})},complexity:function(){return this.paths.reduce(function(t,e){return t+(e&&e.complexity?e.complexity():0)},0)},toGrayscale:function(){for(var t=this.paths.length;t--;)this.paths[t].toGrayscale();return this},getObjects:function(){return this.paths}}),i.PathGroup.fromObject=function(t){var n=e(t.paths);return new i.PathGroup(n,t)})}("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.array.min,r=e.util.array.max,o=e.util.array.invoke,s=e.util.removeFromArray;if(!e.Group){var a={lockMovementX:!0,lockMovementY:!0,lockRotation:!0,lockScalingX:!0,lockScalingY:!0,lockUniScaling:!0};e.Group=e.util.createClass(e.Object,{type:"group",initialize:function(t,e){e=e||{},this.objects=t||[],this.originalState={},this.callSuper("initialize"),this._calcBounds(),this._updateObjectsCoords(),e&&i(this,e),this._setOpacityIfSame(),this.setCoords(!0),this.saveCoords()},_updateObjectsCoords:function(){var t=this.left,e=this.top;this.forEachObject(function(i){var n=i.get("left"),r=i.get("top");
1i.set("originalLeft",n),i.set("originalTop",r),i.set("left",n-t),i.set("top",r-e),i.setCoords(),i.__origHasControls=i.hasControls,i.hasControls=!1},this)},toString:function(){return"#<fabric.Group: ("+this.complexity()+")>"},getObjects:function(){return this.objects},addWithUpdate:function(t){return this._restoreObjectsState(),this.objects.push(t),this._calcBounds(),this._updateObjectsCoords(),this},removeWithUpdate:function(t){return this._restoreObjectsState(),s(this.objects,t),t.setActive(!1),this._calcBounds(),this._updateObjectsCoords(),this},add:function(t){return this.objects.push(t),this},remove:function(t){return s(this.objects,t),this},size:function(){return this.getObjects().length},delegatedProperties:{fill:!0,opacity:!0,fontFamily:!0,fontWeight:!0,fontSize:!0,fontStyle:!0,lineHeight:!0,textDecoration:!0,textShadow:!0,textAlign:!0,backgroundColor:!0},_set:function(t,e){if(t in this.delegatedProperties){var i=this.objects.length;for(this[t]=e;i--;)this.objects[i].set(t,e)}else this[t]=e},contains:function(t){return this.objects.indexOf(t)>-1},toObject:function(t){return i(this.callSuper("toObject",t),{objects:o(this.objects,"toObject",t)})},render:function(t,i){t.save(),this.transform(t);var n=Math.max(this.scaleX,this.scaleY);this.clipTo&&e.util.clipContext(this,t);for(var r=this.objects.length;r>0;r--){var o=this.objects[r-1],s=o.borderScaleFactor,a=o.hasRotatingPoint;o.borderScaleFactor=n,o.hasRotatingPoint=!1,o.render(t),o.borderScaleFactor=s,o.hasRotatingPoint=a}this.clipTo&&t.restore(),!i&&this.active&&(this.drawBorders(t),this.drawControls(t)),t.restore(),this.setCoords()},item:function(t){return this.getObjects()[t]},complexity:function(){return this.getObjects().reduce(function(t,e){return t+="function"==typeof e.complexity?e.complexity():0},0)},_restoreObjectsState:function(){return this.objects.forEach(this._restoreObjectState,this),this},_restoreObjectState:function(t){var e=this.get("left"),i=this.get("top"),n=this.getAngle()*(Math.PI/180),r=Math.cos(n)*t.get("top")+Math.sin(n)*t.get("left"),o=-Math.sin(n)*t.get("top")+Math.cos(n)*t.get("left");return t.setAngle(t.getAngle()+this.getAngle()),t.set("left",e+o*this.get("scaleX")),t.set("top",i+r*this.get("scaleY")),t.set("scaleX",t.get("scaleX")*this.get("scaleX")),t.set("scaleY",t.get("scaleY")*this.get("scaleY")),t.setCoords(),t.hasControls=t.__origHasControls,delete t.__origHasControls,t.setActive(!1),t.setCoords(),this},destroy:function(){return this._restoreObjectsState()},saveCoords:function(){return this._originalLeft=this.get("left"),this._originalTop=this.get("top"),this},hasMoved:function(){return this._originalLeft!==this.get("left")||this._originalTop!==this.get("top")},setObjectsCoords:function(){return this.forEachObject(function(t){t.setCoords()}),this},activateAllObjects:function(){return this.forEachObject(function(t){t.setActive()}),this},forEachObject:e.StaticCanvas.prototype.forEachObject,_setOpacityIfSame:function(){var t=this.getObjects(),e=t[0]?t[0].get("opacity"):1;t.every(function(t){return t.get("opacity")===e})&&(this.opacity=e)},_calcBounds:function(){for(var t,e,i,o,s,a,c,l=[],u=[],h=0,f=this.objects.length;h<f;++h){(s=this.objects[h]).setCoords();for(var d in s.oCoords)l.push(s.oCoords[d].x),u.push(s.oCoords[d].y)}t=n(l),i=r(l),e=n(u),o=r(u),a=i-t||0,c=o-e||0,this.width=a,this.height=c,this.left=t+a/2||0,this.top=e+c/2||0},containsPoint:function(t){var e=this.get("width")/2,i=this.get("height")/2,n=this.get("left"),r=this.get("top");return n-e<t.x&&n+e>t.x&&r-i<t.y&&r+i>t.y},toGrayscale:function(){for(var t=this.objects.length;t--;)this.objects[t].toGrayscale();return this},toSVG:function(){for(var t=[],e=this.objects.length;e--;)t.push(this.objects[e].toSVG());return'<g transform="'+this.getSvgTransform()+'">'+t.join("")+"</g>"},get:function(t){if(t in a){if(this[t])return this[t];for(var e=0,i=this.objects.length;e<i;e++)if(this.objects[e][t])return!0;return!1}return t in this.delegatedProperties?this.objects[0]&&this.objects[0].get(t):this[t]}}),e.Group.fromObject=function(t,i){e.util.enlivenObjects(t.objects,function(n){delete t.objects,i&&i(new e.Group(n,t))})},e.Group.async=!0}}
1("undefined"!=typeof exports?exports:this),function(t){"use strict";var e=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",initialize:function(t,e){e||(e={}),this.callSuper("initialize",e),this._initElement(t),this._originalImage=this.getElement(),this._initConfig(e),this.filters=[],e.filters&&(this.filters=e.filters,this.applyFilters())},getElement:function(){return this._element},setElement:function(t){return this._element=t,this._initConfig(),this},getOriginalSize:function(){var t=this.getElement();return{width:t.width,height:t.height}},render:function(t,e){t.save();var i=this.transformMatrix;this.group&&t.translate(-this.group.width/2+this.width/2,-this.group.height/2+this.height/2),i&&t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),e||this.transform(t),this._setShadow(t),this.clipTo&&fabric.util.clipContext(this,t),this._render(t),this.clipTo&&t.restore(),this._removeShadow(t),this.active&&!e&&(this.drawBorders(t),this.drawControls(t)),t.restore()},toObject:function(t){return e(this.callSuper("toObject",t),{src:this._originalImage.src||this._originalImage._src,filters:this.filters.concat()})},toSVG:function(){return'<g transform="'+this.getSvgTransform()+'"><image xlink:href="'+this.getSvgSrc()+'" style="'+this.getSvgStyles()+'" transform="translate('+-this.width/2+" "+-this.height/2+')" width="'+this.width+'" height="'+this.height+'"></image></g>'},getSrc:function(){return this.getElement().src||this.getElement()._src},toString:function(){return'#<fabric.Image: { src: "'+this.getSrc()+'" }>'},clone:function(t,e){this.constructor.fromObject(this.toObject(e),t)},applyFilters:function(t){if(0===this.filters.length)return this.setElement(this._originalImage),void(t&&t());var e="undefined"!=typeof Buffer&&"undefined"==typeof window,i=this._originalImage,n=fabric.util.createCanvasElement(),r=e?new(require("canvas").Image):fabric.document.createElement("img"),o=this;if(n.width=i.width,n.height=i.height,n.getContext("2d").drawImage(i,0,0,i.width,i.height),this.filters.forEach(function(t){t&&t.applyTo(n)}),r.onload=function(){o._element=r,t&&t(),r.onload=n=i=null},r.width=i.width,r.height=i.height,e){var s=n.toDataURL("image/png").substring(22);r.src=new Buffer(s,"base64"),o._element=r,t&&t()}else r.src=n.toDataURL("image/png");return this},_render:function(t){t.drawImage(this._element,-this.width/2,-this.height/2,this.width,this.height)},_resetWidthHeight:function(){var t=this.getElement();this.set("width",t.width),this.set("height",t.height)},_initElement:function(t){this.setElement(fabric.util.getById(t)),fabric.util.addClass(this.getElement(),fabric.Image.CSS_CANVAS)},_initConfig:function(t){t||(t={}),this.setOptions(t),this._setWidthHeight(t)},_initFilters:function(t){t.filters&&t.filters.length&&(this.filters=t.filters.map(function(t){return t&&fabric.Image.filters[t.type].fromObject(t)}))},_setWidthHeight:function(t){this.width="width"in t?t.width:this.getElement().width||0,this.height="height"in t?t.height:this.getElement().height||0},complexity:function(){return 1}}),fabric.Image.CSS_CANVAS="canvas-img",fabric.Image.prototype.getSvgSrc=fabric.Image.prototype.getSrc,fabric.Image.fromObject=function(t,e){var i=fabric.document.createElement("img"),n=t.src;t.width&&(i.width=t.width),t.height&&(i.height=t.height),i.onload=function(){fabric.Image.prototype._initFilters.call(t,t);var n=new fabric.Image(i,t);e&&e(n),i=i.onload=i.onerror=null},i.onerror=function(){fabric.log("Error loading "+i.src),e&&e(null,!0),i=i.onload=i.onerror=null},i.src=n},fabric.Image.fromURL=function(t,e,i){var n=fabric.document.createElement("img");n.onload=function(){e&&e(new fabric.Image(n,i)),n=n.onload=null},n.src=t},fabric.Image.ATTRIBUTE_NAMES="x y width height fill fill-opacity opacity stroke stroke-width transform xlink:href".split(" "),fabric.Image.fromElement=function(t,i,n){var r=fabric.parseAttributes(t,fabric.Image.ATTRIBUTE_NAMES);fabric.Image.fromURL(r["xlink:href"],i,e(n?fabric.util.object.clone(n):{},r))},fabric.Image.async=!0)}
vendor: 4,132 bytes, line 1
1("undefined"!=typeof exports?exports:this),fabric.util.object.extend(fabric.Object.prototype,{_getAngleValueForStraighten:function(){var t=this.getAngle()%360;return t>0?90*Math.round((t-1)/90):90*Math.round(t/90)},straighten:function(){return this.setAngle(this._getAngleValueForStraighten()),this},fxStraighten:function(t){var e=function(){},i=(t=t||{}).onComplete||e,n=t.onChange||e,r=this;return fabric.util.animate({startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(t){r.setAngle(t),n()},onComplete:function(){r.setCoords(),i()},onStart:function(){r.setActive(!1)}}),this}}),fabric.util.object.extend(fabric.StaticCanvas.prototype,{straightenObject:function(t){return t.straighten(),this.renderAll(),this},fxStraightenObject:function(t){return t.fxStraighten({onChange:this.renderAll.bind(this)}),this}}),fabric.Image.filters={},fabric.Image.filters.Grayscale=fabric.util.createClass({type:"Grayscale",applyTo:function(t){var e,i,n,r,o=t.getContext("2d"),s=o.getImageData(0,0,t.width,t.height),a=s.data,c=s.width,l=s.height;for(n=0;n<c;n++)for(r=0;r<l;r++)i=(a[e=4*n*l+4*r]+a[e+1]+a[e+2])/3,a[e]=i,a[e+1]=i,a[e+2]=i;o.putImageData(s,0,0)},toJSON:function(){return{type:this.type}}}),fabric.Image.filters.Grayscale.fromObject=function(){return new fabric.Image.filters.Grayscale},fabric.Image.filters.RemoveWhite=fabric.util.createClass({type:"RemoveWhite",initialize:function(t){t||(t={}),this.threshold=t.threshold||30,this.distance=t.distance||20},applyTo:function(t){for(var e,i,n,r=t.getContext("2d"),o=r.getImageData(0,0,t.width,t.height),s=o.data,a=this.threshold,c=this.distance,l=255-a,u=Math.abs,h=0,f=s.length;h<f;h+=4)e=s[h],i=s[h+1],n=s[h+2],e>l&&i>l&&n>l&&u(e-i)<c&&u(e-n)<c&&u(i-n)<c&&(s[h+3]=1);r.putImageData(o,0,0)},toJSON:function(){return{type:this.type,threshold:this.threshold,distance:this.distance}}}),fabric.Image.filters.RemoveWhite.fromObject=function(t){return new fabric.Image.filters.RemoveWhite(t)},fabric.Image.filters.Invert=fabric.util.createClass({type:"Invert",applyTo:function(t){var e,i=t.getContext("2d"),n=i.getImageData(0,0,t.width,t.height),r=n.data,o=r.length;for(e=0;e<o;e+=4)r[e]=255-r[e],r[e+1]=255-r[e+1],r[e+2]=255-r[e+2];i.putImageData(n,0,0)},toJSON:function(){return{type:this.type}}}),fabric.Image.filters.Invert.fromObject=function(){return new fabric.Image.filters.Invert},fabric.Image.filters.Sepia=fabric.util.createClass({type:"Sepia",applyTo:function(t){var e,i,n=t.getContext("2d"),r=n.getImageData(0,0,t.width,t.height),o=r.data,s=o.length;for(e=0;e<s;e+=4)i=.3*o[e]+.59*o[e+1]+.11*o[e+2],o[e]=i+100,o[e+1]=i+50,o[e+2]=i+255;n.putImageData(r,0,0)},toJSON:function(){return{type:this.type}}}),fabric.Image.filters.Sepia.fromObject=function(){return new fabric.Image.filters.Sepia},fabric.Image.filters.Sepia2=fabric.util.createClass({type:"Sepia2",applyTo:function(t){var e,i,n,r,o=t.getContext("2d"),s=o.getImageData(0,0,t.width,t.height),a=s.data,c=a.length;for(e=0;e<c;e+=4)i=a[e],n=a[e+1],r=a[e+2],a[e]=(.393*i+.769*n+.189*r)/1.351,a[e+1]=(.349*i+.686*n+.168*r)/1.203,a[e+2]=(.272*i+.534*n+.131*r)/2.14;o.putImageData(s,0,0)},toJSON:function(){return{type:this.type}}}),fabric.Image.filters.Sepia2.fromObject=function(){return new fabric.Image.filters.Sepia2},fabric.Image.filters.Brightness=fabric.util.createClass({type:"Brightness",initialize:function(t){t||(t={}),this.brightness=t.brightness||100},applyTo:function(t){for(var e=t.getContext("2d"),i=e.getImageData(0,0,t.width,t.height),n=i.data,r=this.brightness,o=0,s=n.length;o<s;o+=4)n[o]+=r,n[o+1]+=r,n[o+2]+=r;e.putImageData(i,0,0)},toJSON:function(){return{type:this.type,brightness:this.brightness}}}),fabric.Image.filters.Brightness.fromObject=function(t){return new fabric.Image.filters.Brightness(t)},fabric.Image.filters.Noise=fabric.util.createClass({type:"Noise",initialize:function(t){t||(t={}),this.noise=t.noise||100},applyTo:function(t){for(var e,i=t.getContext("2d"),n=i.getImageData(0,0,t.width,t.height),r=n.data,o=this.noise,s=0,a=r.length;s<a;s+=4)e=(.5-Math.random())*o,r[s]+=e,r[s+1]+=e,r[s+2]+=e;i.putImageData(n,0,0)}
1,toJSON:function(){return{type:this.type,noise:this.noise}}}),fabric.Image.filters.Noise.fromObject=function(t){return new fabric.Image.filters.Noise(t)},fabric.Image.filters.GradientTransparency=fabric.util.createClass({type:"GradientTransparency",initialize:function(t){t||(t={}),this.threshold=t.threshold||100},applyTo:function(t){for(var e=t.getContext("2d"),i=e.getImageData(0,0,t.width,t.height),n=i.data,r=this.threshold,o=n.length,s=0,a=n.length;s<a;s+=4)n[s+3]=r+255*(o-s)/o;e.putImageData(i,0,0)},toJSON:function(){return{type:this.type,threshold:this.threshold}}}),fabric.Image.filters.GradientTransparency.fromObject=function(t){return new fabric.Image.filters.GradientTransparency(t)},fabric.Image.filters.Tint=fabric.util.createClass({type:"Tint",initialize:function(t){t||(t={}),this.color=t.color||0},applyTo:function(t){var e,i=t.getContext("2d"),n=i.getImageData(0,0,t.width,t.height),r=n.data,o=r.length,s=parseInt(this.color,10).toString(16),a=parseInt("0x"+s.substr(0,2),16),c=parseInt("0x"+s.substr(2,2),16),l=parseInt("0x"+s.substr(4,2),16);for(e=0;e<o;e+=4)r[e+3]>0&&(r[e]=a,r[e+1]=c,r[e+2]=l);i.putImageData(n,0,0)},toJSON:function(){return{type:this.type,color:this.color}}}),fabric.Image.filters.Tint.fromObject=function(t){return new fabric.Image.filters.Tint(t)},fabric.Image.filters.Convolute=fabric.util.createClass({type:"Convolute",initialize:function(t){t||(t={}),this.opaque=t.opaque,this.matrix=t.matrix||[0,0,0,0,1,0,0,0,0];var e=fabric.util.createCanvasElement();this.tmpCtx=e.getContext("2d")},_createImageData:function(t,e){return this.tmpCtx.createImageData(t,e)},applyTo:function(t){for(var e=this.matrix,i=t.getContext("2d"),n=i.getImageData(0,0,t.width,t.height),r=Math.round(Math.sqrt(e.length)),o=Math.floor(r/2),s=n.data,a=n.width,c=n.height,l=a,u=c,h=this._createImageData(l,u),f=h.data,d=this.opaque?1:0,p=0;p<u;p++)for(var g=0;g<l;g++){for(var v=p,m=g,b=4*(p*l+g),y=0,x=0,k=0,w=0,_=0;_<r;_++)for(var C=0;C<r;C++){var S=v+_-o,E=m+C-o;if(S>=0&&S<c&&E>=0&&E<a){var T=4*(S*a+E),O=e[_*r+C];y+=s[T]*O,x+=s[T+1]*O,k+=s[T+2]*O,w+=s[T+3]*O}}f[b]=y,f[b+1]=x,f[b+2]=k,f[b+3]=w+d*(255-w)}i.putImageData(h,0,0)},toJSON:function(){return{type:this.type,matrix:this.matrix}}}),fabric.Image.filters.Convolute.fromObject=function(t){return new fabric.Image.filters.Convolute(t)},fabric.Image.filters.Pixelate=fabric.util.createClass({type:"Pixelate",initialize:function(t){t||(t={}),this.blocksize=t.blocksize||4},applyTo:function(t){var e,i,n,r,o,s,a,c=t.getContext("2d"),l=c.getImageData(0,0,t.width,t.height),u=l.data,h=l.width,f=l.height;for(i=0;i<h;i+=this.blocksize)for(n=0;n<f;n+=this.blocksize){r=u[e=4*i*f+4*n],o=u[e+1],s=u[e+2],a=u[e+3];for(var d=i,p=i+this.blocksize;d<p;d++)for(var g=n,v=n+this.blocksize;g<v;g++)u[e=4*d*f+4*g]=r,u[e+1]=o,u[e+2]=s,u[e+3]=a}c.putImageData(l,0,0)},toJSON:function(){return{type:this.type,blocksize:this.blocksize}}}),fabric.Image.filters.Pixelate.fromObject=function(t){return new fabric.Image.filters.Pixelate(t)},function(t){"use strict";var e=t.fabric||(t.fabric={}),i=e.util.object.extend,n=e.util.object.clone,r=e.util.toFixed;if(e.Text)e.warn("fabric.Text is already defined");else{var o={fontSize:!0,fontWeight:!0,fontFamily:!0,textDecoration:!0,fontStyle:!0,lineHeight:!0,strokeStyle:!0,strokeWidth:!0,text:!0},s=e.Object.prototype.stateProperties.concat();s.push("fontFamily","fontWeight","fontSize","path","text","textDecoration","textShadow","textAlign","fontStyle","lineHeight","strokeStyle","strokeWidth","backgroundColor","textBackgroundColor","useNative"),e.Text=e.util.createClass(e.Object,{fontSize:40,fontWeight:"normal",fontFamily:"Times New Roman",textDecoration:"",textShadow:"",textAlign:"left",fontStyle:"",lineHeight:1.3,strokeStyle:"",strokeWidth:1,backgroundColor:"",textBackgroundColor:"",path:null,type:"text",useNative:!0,stateProperties:s,initialize:function(t,e){e=e||{},this.text=t,this.setOptions(e),this._initDimensions(),this.setCoords()},_initDimensions:function(){var t=e.util.createCanvasElement();this._render(t.getContext("2d"))},toString:function(){return"#<fabric.Text ("+this.complexity()+'): { "text": "'+this.text+'", "fontFamily": "'+this.fontFamily+'" }>'},_render:function(t){void 0===Cufon||!0===this.useNative?this._renderViaNative(t):this._renderViaCufon(t)},_renderViaCufon:function(t){var e=Cufon.textOptions||(Cufon.textOptions={});e.left=this.left,e.top=this.top,e.context=t,e.color=this.fill;var i=this._initDummyElementForCufon();this.transform(t),Cufon.replaceElement(i,{engine:"canvas",separate:"none",fontFamily:this.fontFamily,fontWeight:this.fontWeight,textDecoration:this.textDecoration,textShadow:this.textShadow,textAlign:this.textAlign,fontStyle:this.fontStyle,lineHeight:this.lineHeight,strokeStyle:this.strokeStyle,strokeWidth:this.strokeWidth,backgroundColor:this.backgroundColor,textBackgroun
1dColor:this.textBackgroundColor}),this.width=e.width,this.height=e.height,this._totalLineHeight=e.totalLineHeight,this._fontAscent=e.fontAscent,this._boundaries=e.boundaries,this._shadowOffsets=e.shadowOffsets,this._shadows=e.shadows||[],i=null,this.setCoords()},_renderViaNative:function(t){this.transform(t),this._setTextStyles(t);var i=this.text.split(/\r?\n/);this.width=this._getTextWidth(t,i),this.height=this._getTextHeight(t,i),this._renderTextBackground(t,i),"left"!==this.textAlign&&"justify"!==this.textAlign&&(t.save(),t.translate("center"===this.textAlign?this.width/2:this.width,0)),this._setTextShadow(t),this.clipTo&&e.util.clipContext(this,t),this._renderTextFill(t,i),this._renderTextStroke(t,i),this.clipTo&&t.restore(),this.textShadow&&t.restore(),"left"!==this.textAlign&&"justify"!==this.textAlign&&t.restore(),this._renderTextDecoration(t,i),this._setBoundaries(t,i),this._totalLineHeight=0,this.setCoords()},_setBoundaries:function(t,e){this._boundaries=[];for(var i=0,n=e.length;i<n;i++){var r=this._getLineWidth(t,e[i]),o=this._getLineLeftOffset(r);this._boundaries.push({height:this.fontSize*this.lineHeight,width:r,left:o})}},_setTextStyles:function(t){t.fillStyle=this.fill.toLive?this.fill.toLive(t):this.fill,t.strokeStyle=this.strokeStyle,t.lineWidth=this.strokeWidth,t.textBaseline="alphabetic",t.textAlign=this.textAlign,t.font=this._getFontDeclaration()},_getTextHeight:function(t,e){return this.fontSize*e.length*this.lineHeight},_getTextWidth:function(t,e){for(var i=t.measureText(e[0]).width,n=1,r=e.length;n<r;n++){var o=t.measureText(e[n]).width;o>i&&(i=o)}return i},_setTextShadow:function(t){if(this.textShadow){var e=/\s+(-?\d+)(?:px)?\s+(-?\d+)(?:px)?\s+(\d+)(?:px)?\s*/,i=this.textShadow,n=e.exec(this.textShadow),r=i.replace(e,"");t.save(),t.shadowColor=r,t.shadowOffsetX=parseInt(n[1],10),t.shadowOffsetY=parseInt(n[2],10),t.shadowBlur=parseInt(n[3],10),this._shadows=[{blur:t.shadowBlur,color:t.shadowColor,offX:t.shadowOffsetX,offY:t.shadowOffsetY}],this._shadowOffsets=[[parseInt(t.shadowOffsetX,10),parseInt(t.shadowOffsetY,10)]]}},_drawTextLine:function(t,e,i,n,r){if("justify"===this.textAlign){var o=e.measureText(i).width,s=this.width;if(s>o)for(var a=i.split(/\s+/),c=(s-e.measureText(i.replace(/\s+/g,"")).width)/(a.length-1),l=0,u=0,h=a.length;u<h;u++)e[t](a[u],n+l,r),l+=e.measureText(a[u]).width+c;else e[t](i,n,r)}else e[t](i,n,r)},_renderTextFill:function(t,e){this._boundaries=[];for(var i=0,n=e.length;i<n;i++)this._drawTextLine("fillText",t,e[i],-this.width/2,-this.height/2+i*this.fontSize*this.lineHeight+this.fontSize)},_renderTextStroke:function(t,e){if(this.strokeStyle){t.beginPath();for(var i=0,n=e.length;i<n;i++)this._drawTextLine("strokeText",t,e[i],-this.width/2,-this.height/2+i*this.fontSize*this.lineHeight+this.fontSize);t.closePath()}},_renderTextBackground:function(t,e){this._renderTextBoxBackground(t),this._renderTextLinesBackground(t,e)},_renderTextBoxBackground:function(t){this.backgroundColor&&(t.save(),t.fillStyle=this.backgroundColor,t.fillRect(-this.width/2,-this.height/2,this.width,this.height),t.restore())},_renderTextLinesBackground:function(t,e){if(this.textBackgroundColor){t.save(),t.fillStyle=this.textBackgroundColor;for(var i=0,n=e.length;i<n;i++)if(""!==e[i]){var r=this._getLineWidth(t,e[i]),o=this._getLineLeftOffset(r);t.fillRect(-this.width/2+o,-this.height/2+i*this.fontSize*this.lineHeight,r,this.fontSize*this.lineHeight)}t.restore()}},_getLineLeftOffset:function(t){return"center"===this.textAlign?(this.width-t)/2:"right"===this.textAlign?this.width-t:0},_getLineWidth:function(t,e){return"justify"===this.textAlign?this.width:t.measureText(e).width},_renderTextDecoration:function(t,e){function i(i){for(var o=0,s=e.length;o<s;o++){var a=r._getLineWidth(t,e[o]),c=r._getLineLeftOffset(a);t.fillRect(-r.width/2+c,i+o*r.fontSize*r.lineHeight-n,a,1)}}var n=this._getTextHeight(t,e)/2,r=this;this.textDecoration.indexOf("underline")>-1&&i(this.fontSize),this.textDecoration.indexOf("line-through")>-1&&i(this.fontSize/2),this.textDecoration.indexOf("overline")>-1&&i(0)},_getFontDeclaration:function(){return[e.isLikelyNode?this.fontWeight:this.fontStyle,e.isLikelyNode?this.fontStyle:this.fontWeight,this.fontSize+"px",e.isLikelyNode?'"'+this.fontFamily+'"':this.fontFamily].join(" ")},_initDummyElementForCufon:function(){var t=e.document.createElement("pre");return e.document.createElement("div").appendChild(t),"undefined"==typeof G_vmlCanvasManager?t.innerHTML=this.text:t.innerText=this.text.replace(/\r?\n/gi,"\r"),t.style.fontSize=this.fontSize+"px",t.style.letterSpacing="normal",t},render:function(t,e){t.save(),this._render(t),!e&&this.active&&(this.drawBorders(t),this.drawControls(t)),t.restore(
1)},toObject:function(t){return i(this.callSuper("toObject",t),{text:this.text,fontSize:this.fontSize,fontWeight:this.fontWeight,fontFamily:this.fontFamily,fontStyle:this.fontStyle,lineHeight:this.lineHeight,textDecoration:this.textDecoration,textShadow:this.textShadow,textAlign:this.textAlign,path:this.path,strokeStyle:this.strokeStyle,strokeWidth:this.strokeWidth,backgroundColor:this.backgroundColor,textBackgroundColor:this.textBackgroundColor,useNative:this.useNative})},toSVG:function(){var t=this.text.split(/\r?\n/),e=this.useNative?this.fontSize*this.lineHeight:-this._fontAscent-this._fontAscent/5*this.lineHeight,i=-this.width/2,n=this.useNative?this.fontSize-1:this.height/2-t.length*this.fontSize-this._totalLineHeight,o=this._getSVGTextAndBg(e,i,t),s=this._getSVGShadows(e,t);return n+=this._fontAscent?this._fontAscent/5*this.lineHeight:0,['<g transform="',this.getSvgTransform(),'">',o.textBgRects.join(""),"<text ",this.fontFamily?"font-family=\"'"+this.fontFamily+"'\" ":"",this.fontSize?'font-size="'+this.fontSize+'" ':"",this.fontStyle?'font-style="'+this.fontStyle+'" ':"",this.fontWeight?'font-weight="'+this.fontWeight+'" ':"",this.textDecoration?'text-decoration="'+this.textDecoration+'" ':"",'style="',this.getSvgStyles(),'" ','transform="translate(',r(i,2)," ",r(n,2),')">',s.join(""),o.textSpans.join(""),"</text>","</g>"].join("")},_getSVGShadows:function(t,i){var n,o,s,a,c=[],l=1;if(!this._shadows||!this._boundaries)return c;for(n=0,s=this._shadows.length;n<s;n++)for(o=0,a=i.length;o<a;o++)if(""!==i[o]){var u=this._boundaries&&this._boundaries[o]?this._boundaries[o].left:0;c.push('<tspan x="',r(u+l+this._shadowOffsets[n][0],2),0===o||this.useNative?'" y':'" dy','="',r(this.useNative?t*o-this.height/2+this._shadowOffsets[n][1]:t
1+(0===o?this._shadowOffsets[n][1]:0),2),'" ',this._getFillAttributes(this._shadows[n].color),">",e.util.string.escapeXml(i[o]),"</tspan>"),l=1}else l++;return c},_getSVGTextAndBg:function(t,i,n){var o,s,a,c=[],l=[],u=1;for(this.backgroundColor&&this._boundaries&&l.push("<rect ",this._getFillAttributes(this.backgroundColor),' x="',r(-this.width/2,2),'" y="',r(-this.height/2,2),'" width="',r(this.width,2),'" height="',r(this.height,2),'"></rect>'),o=0,a=n.length;o<a;o++)""!==n[o]?(s=this._boundaries&&this._boundaries[o]?r(this._boundaries[o].left,2):0,c.push('<tspan x="',s,'" ',0===o||this.useNative?"y":"dy",'="',r(this.useNative?t*o-this.height/2:t*u,2),'" ',this._getFillAttributes(this.fill),">",e.util.string.escapeXml(n[o]),"</tspan>"),u=1):u++,this.textBackgroundColor&&this._boundaries&&l.push("<rect ",this._getFillAttributes(this.textBackgroundColor),' x="',r(i+this._boundaries[o].left,2),'" y="',r(t*o-this.height/2,2),'" width="',r(this._boundaries[o].width,2),'" height="',r(this._boundaries[o].height,2),'"></rect>');return{textSpans:c,textBgRects:l}},_getFillAttributes:function(t){var i=t?new e.Color(t):"";return i&&i.getSource()&&1!==i.getAlpha()?'opacity="'+i.getAlpha()+'" fill="'+i.setAlpha(1).toRgb()+'"':'fill="'+t+'"'},setColor:function(t){return this.set("fill",t),this},getText:function(){return this.text},_set:function(t,e){"fontFamily"===t&&this.path&&(this.path=this.path.replace(/(.*?)([^\/]*)(\.font\.js)/,"$1"+e+"$3")),this.callSuper("_set",t,e),t in o&&(this._initDimensions(),this.setCoords())}}),e.Text.ATTRIBUTE_NAMES="x y fill fill-opacity opacity stroke stroke-width transform font-family font-style font-weight font-size text-decoration".split(" "),e.Text.fromObject=function(t){return new e.Text(t.text,n(t))},e.Text.fromElement=function(t,i){if(!t)return null;var n=e.parseAttributes(t,e.Text.ATTRIBUTE_NAMES);i=e.util.object.extend(i?e.util.object.clone(i):{},n);var r=new e.Text(t.textContent,i);return r.set({left:r.getLeft()+r.getWidth()/2,top:r.getTop()-r.getHeight()/2}),r},e.util.createAccessors(e.Text)}}("undefined"!=typeof exports?exports:this),function(){function request(t,e,i){var n=URL.parse(t);HTTP.request({hostname:n.hostname,port:n.port,path:n.pathname,method:"GET"},function(t){var n="";e&&t.setEncoding(e),t.on("end",function(){i(n)}),t.on("data",function(e){200===t.statusCode&&(n+=e)})}).on("error",function(t){t.errno===process.ECONNREFUSED?fabric.log("ECONNREFUSED: connection refused to "+n.hostname+":"+n.port):fabric.log(t.message)})}function request_fs(t,e){var i=require("fs").createReadStream(t),n="";i.on("data",function(t){n+=t}),i.on("end",function(){e(n)})}if("undefined"==typeof document||"undefined"==typeof window){var DOMParser=new require("xmldom").DOMParser,URL=require("url"),HTTP=require("http"),Canvas=require("canvas"),Image=require("canvas").Image;fabric.util.loadImage=function(t,e,i){var n=function(n){r.src=new Buffer(n,"binary"),r._src=t,e&&e.call(i,r)},r=new Image;t&&0===t.indexOf("data")?(r.src=r._src=t,e&&e.call(i,r)):t&&0!==t.indexOf("http")?request_fs(t,n):t&&request(t,"binary",n)},fabric.loadSVGFromURL=function(t,e){request(t=t.replace(/^\n\s*/,"").replace(/\?.*$/,"").trim(),"",function(t){fabric.loadSVGFromString(t,e)})},fabric.loadSVGFromString=function(t,e){var i=(new DOMParser).parseFromString(t);fabric.parseSVGDocument(i.documentElement,function(t,i){e(t,i)})},fabric.util.getScript=function(url,callback){request(url,"",function(body){eval(body),callback&&callback()})},fabric.Image.fromObject=function(t,e){fabric.util.loadImage(t.src,function(i){var n=new fabric.Image(i);n._initConfig(t),n._initFilters(t),e(n)})},fabric.createCanvasForNode=function(t,e){var i=fabric.document.createElement("canvas"),n=new Canvas(t||600,e||600);i.style={},i.width=n.width,i.height=n.height;var r=new(fabric.Canvas||fabric.StaticCanvas)(i);return r.contextContainer=n.getContext("2d"),r.nodeCanvas=n,r.Font=Canvas.Font,r},fabric.StaticCanvas.prototype.createPNGStream=function(){return this.nodeCanvas.createPNGStream()},fabric.StaticCanvas.prototype.createJPEGStream=function(t){return this.nodeCanvas.createJPEGStream(t)};var origSetWidth=fabric.StaticCanvas.prototype.setWidth;fabric.StaticCanvas.prototype.setWidth=function(t){return origSetWidth.call(this,t),this.nodeCanvas.width=t,this},fabric.Canvas&&(fabric.Canvas.prototype.setWidth=fabric.StaticCanvas.prototype.setWidth);var origSetHeight=fabric.StaticCanvas.prototype.setHeight;fabric.StaticCanvas.prototype.setHeight=function(t){return origSetHeight.call(this,t),this.nodeCanvas.height=t,this},fabric.Canvas&&(fabric.Canvas.prototype.setHeight=fabric.StaticCanvas.prototype.setHeight)}}();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.