scratch-paint 4.1.54 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ /*! For license information please see scratch-paint.js.LICENSE.txt */
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("prop-types"),require("minilog"),require("react"),require("react-redux"),require("react-intl"),require("@scratch/scratch-svg-renderer"),require("react-style-proptype"),require("react-popover"),require("react-responsive"),require("redux")):"function"==typeof define&&define.amd?define(["prop-types","minilog","react","react-redux","react-intl","@scratch/scratch-svg-renderer","react-style-proptype","react-popover","react-responsive","redux"],e):"object"==typeof exports?exports["scratch-paint"]=e(require("prop-types"),require("minilog"),require("react"),require("react-redux"),require("react-intl"),require("@scratch/scratch-svg-renderer"),require("react-style-proptype"),require("react-popover"),require("react-responsive"),require("redux")):t["scratch-paint"]=e(t["prop-types"],t.minilog,t.react,t["react-redux"],t["react-intl"],t["@scratch/scratch-svg-renderer"],t["react-style-proptype"],t["react-popover"],t["react-responsive"],t.redux)}(self,function(t,e,n,i,o,s,a,l,c,u){return function(){var h={311:function(t,e,n){var i,r,o;(function(s,a){var l=(s=s||n(12)).window?s.window:s,c=s.document,u=new function(){var t=/^(statics|enumerable|beans|preserve)$/,e=[],n=e.slice,i=Object.create,r=Object.getOwnPropertyDescriptor,o=Object.defineProperty,s=e.forEach||function(t,e){for(var n=0,i=this.length;n<i;n++)t.call(e,this[n],n,this)},l=function(t,e){for(var n in this)this.hasOwnProperty(n)&&t.call(e,this[n],n,this)},c=Object.assign||function(t){for(var e=1,n=arguments.length;e<n;e++){var i=arguments[e];for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}return t},u=function(t,e,n){if(t){var i=r(t,"length");(i&&"number"==typeof i.value?s:l).call(t,e,n=n||t)}return n};function h(e,n,i,s,a){var l={};function c(t,c){"string"==typeof(c=c||(c=r(n,t))&&(c.get?c:c.value))&&"#"===c[0]&&(c=e[c.substring(1)]||c);var u,h="function"==typeof c,p=c,f=a||h&&!c.base?c&&c.get?t in e:e[t]:null;a&&f||(h&&f&&(c.base=f),h&&!1!==s&&(u=t.match(/^([gs]et|is)(([A-Z])(.*))$/))&&(l[u[3].toLowerCase()+u[4]]=u[2]),p&&!h&&p.get&&"function"==typeof p.get&&d.isPlainObject(p)||(p={value:p,writable:!0}),(r(e,t)||{configurable:!0}).configurable&&(p.configurable=!0,p.enumerable=null!=i?i:!u),o(e,t,p))}if(n){for(var u in n)n.hasOwnProperty(u)&&!t.test(u)&&c(u);for(var u in l){var h=l[u],p=e["set"+h],f=e["get"+h]||p&&e["is"+h];!f||!0!==s&&0!==f.length||c(u,{get:f,set:p})}}return e}function d(){for(var t=0,e=arguments.length;t<e;t++){var n=arguments[t];n&&c(this,n)}return this}return h(d,{inject:function(t){if(t){var e=!0===t.statics?t:t.statics,n=t.beans,i=t.preserve;e!==t&&h(this.prototype,t,t.enumerable,n,i),h(this,e,null,n,i)}for(var r=1,o=arguments.length;r<o;r++)this.inject(arguments[r]);return this},extend:function(){for(var t,e,n,r=this,s=0,a=arguments.length;s<a&&(!t||!e);s++)n=arguments[s],t=t||n.initialize,e=e||n.prototype;return t=t||function(){r.apply(this,arguments)},e=t.prototype=e||i(this.prototype),o(e,"constructor",{value:t,writable:!0,configurable:!0}),h(t,this),arguments.length&&this.inject.apply(t,arguments),t.base=r,t}}).inject({enumerable:!1,initialize:d,set:d,inject:function(){for(var t=0,e=arguments.length;t<e;t++){var n=arguments[t];n&&h(this,n,n.enumerable,n.beans,n.preserve)}return this},extend:function(){var t=i(this);return t.inject.apply(t,arguments)},each:function(t,e){return u(this,t,e)},clone:function(){return new this.constructor(this)},statics:{set:c,each:u,create:i,define:o,describe:r,clone:function(t){return c(new t.constructor,t)},isPlainObject:function(t){var e=null!=t&&t.constructor;return e&&(e===Object||e===d||"Object"===e.name)},pick:function(t,e){return t!==a?t:e},slice:function(t,e,i){return n.call(t,e,i)}}})};t.exports=u,u.inject({enumerable:!1,toString:function(){return null!=this._id?(this._class||"Object")+(this._name?" '"+this._name+"'":" @"+this._id):"{ "+u.each(this,function(t,e){if(!/^_/.test(e)){var n=typeof t;this.push(e+": "+("number"===n?g.instance.number(t):"string"===n?"'"+t+"'":t))}},[]).join(", ")+" }"},getClassName:function(){return this._class||""},importJSON:function(t){return u.importJSON(t,this)},exportJSON:function(t){return u.exportJSON(this,t)},toJSON:function(){return u.serialize(this)},set:function(t,e){return t&&u.filter(this,t,e,this._prioritize),this}},{beans:!1,statics:{exports:{},extend:function t(){var e=t.base.apply(this,arguments),n=e.prototype._class;return n&&!u.exports[n]&&(u.exports[n]=e),e},equals:function(t,e){if(t===e)return!0;if(t&&t.equals)return t.equals(e);if(e&&e.equals)return e.equals(t);if(t&&e&&"object"==typeof t&&"object"==typeof e){if(Array.isArray(t)&&Array.isArray(e)){if((n=t.length)!==e.length)return!1;for(;n--;)if(!u.equals(t[n],e[n]))return!1}else{var n,i=Object.keys(t);if((n=i.length)!==Object.keys(e).length)return!1;for(;n--;){var r=i[n];if(!e.hasOwnProperty(r)||!u.equals(t[r],e[r]))return!1}}return!0}return!1},read:function(t,e,n,i){if(this===u){var r=this.peek(t,e);return t.__index++,r}var o=this.prototype,s=o._readIndex,l=e||s&&t.__index||0,c=t.length,h=t[l];if(i=i||c-l,h instanceof this||n&&n.readNull&&null==h&&i<=1)return s&&(t.__index=l+1),h&&n&&n.clone?h.clone():h;if(h=u.create(o),s&&(h.__read=!0),h=h.initialize.apply(h,l>0||l+i<c?u.slice(t,l,l+i):t)||h,s){t.__index=l+h.__read;var d=h.__filtered;d&&(t.__filtered=d,h.__filtered=a),h.__read=a}return h},peek:function(t,e){return t[t.__index=e||t.__index||0]},remain:function(t){return t.length-(t.__index||0)},readList:function(t,e,n,i){for(var r,o=[],s=e||0,a=i?s+i:t.length,l=s;l<a;l++)o.push(Array.isArray(r=t[l])?this.read(r,0,n):this.read(t,l,n,1));return o},readNamed:function(t,e,n,i,r){var o=this.getNamed(t,e),s=o!==a;if(s){var l=t.__filtered;if(!l){var c=this.getSource(t);(l=t.__filtered=u.create(c)).__unfiltered=c}l[e]=a}return this.read(s?[o]:t,n,i,r)},readSupported:function(t,e){var n=this.getSource(t),i=this,r=!1;return n&&Object.keys(n).forEach(function(n){if(n in e){var o=i.readNamed(t,n);o!==a&&(e[n]=o),r=!0}}),r},getSource:function(t){var e=t.__source;if(e===a){var n=1===t.length&&t[0];e=t.__source=n&&u.isPlainObject(n)?n:null}return e},getNamed:function(t,e){var n=this.getSource(t);if(n)return e?n[e]:t.__filtered||n},hasNamed:function(t,e){return!!this.getNamed(t,e)},filter:function(t,e,n,i){var r;function o(i){if(!(n&&i in n||r&&i in r)){var o=e[i];o!==a&&(t[i]=o)}}if(i){for(var s,l={},c=0,u=i.length;c<u;c++)(s=i[c])in e&&(o(s),l[s]=!0);r=l}return Object.keys(e.__unfiltered||e).forEach(o),t},isPlainValue:function(t,e){return u.isPlainObject(t)||Array.isArray(t)||e&&"string"==typeof t},serialize:function(t,e,n,i){e=e||{};var r,o=!i;if(o&&(e.formatter=new g(e.precision),i={length:0,definitions:{},references:{},add:function(t,e){var n="#"+t._id,i=this.references[n];if(!i){this.length++;var r=e.call(t),o=t._class;o&&r[0]!==o&&r.unshift(o),this.definitions[n]=r,i=this.references[n]=[n]}return i}}),t&&t._serialize){r=t._serialize(e,i);var s=t._class;!s||t._compactSerialize||!o&&n||r[0]===s||r.unshift(s)}else if(Array.isArray(t)){r=[];for(var a=0,l=t.length;a<l;a++)r[a]=u.serialize(t[a],e,n,i)}else if(u.isPlainObject(t)){r={};var c=Object.keys(t);for(a=0,l=c.length;a<l;a++){var h=c[a];r[h]=u.serialize(t[h],e,n,i)}}else r="number"==typeof t?e.formatter.number(t,e.precision):t;return o&&i.length>0?[["dictionary",i.definitions],r]:r},deserialize:function(t,e,n,i,r){var o=t,s=!n,a=s&&t&&t.length&&"dictionary"===t[0][0];if(n=n||{},Array.isArray(t)){var l=t[0],c="dictionary"===l;if(1==t.length&&/^#/.test(l))return n.dictionary[l];o=[];for(var h=(l=u.exports[l])?1:0,d=t.length;h<d;h++)o.push(u.deserialize(t[h],e,n,c,a));if(l){var p=o;o=e?e(l,p,s||r):new l(p)}}else if(u.isPlainObject(t))for(var f in o={},i&&(n.dictionary=o),t)o[f]=u.deserialize(t[f],e,n);return a?o[1]:o},exportJSON:function(t,e){var n=u.serialize(t,e);return e&&0==e.asString?n:JSON.stringify(n)},importJSON:function(t,e){return u.deserialize("string"==typeof t?JSON.parse(t):t,function(t,n,i){var r=i&&e&&e.constructor===t,o=r?e:u.create(t.prototype);if(1===n.length&&o instanceof S&&(r||!(o instanceof N))){var s=n[0];u.isPlainObject(s)&&(s.insert=!1,r&&(n=n.concat([{insert:!0}])))}return(r?o.set:t).apply(o,n),r&&(e=null),o})},push:function(t,e){var n=e.length;if(n<4096)t.push.apply(t,e);else{var i=t.length;t.length+=n;for(var r=0;r<n;r++)t[i+r]=e[r]}return t},splice:function(t,e,n,i){var r=e&&e.length,o=n===a;(n=o?t.length:n)>t.length&&(n=t.length);for(var s=0;s<r;s++)e[s]._index=n+s;if(o)return u.push(t,e),[];var l=[n,i];e&&u.push(l,e);for(var c=t.splice.apply(t,l),h=(s=0,c.length);s<h;s++)c[s]._index=a;for(s=n+r,h=t.length;s<h;s++)t[s]._index=s;return c},capitalize:function(t){return t.replace(/\b[a-z]/g,function(t){return t.toUpperCase()})},camelize:function(t){return t.replace(/-(.)/g,function(t,e){return e.toUpperCase()})},hyphenate:function(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}}});var h={on:function(t,e){if("string"!=typeof t)u.each(t,function(t,e){this.on(e,t)},this);else{var n=this._eventTypes,i=n&&n[t],r=this._callbacks=this._callbacks||{};-1===(r=r[t]=r[t]||[]).indexOf(e)&&(r.push(e),i&&i.install&&1===r.length&&i.install.call(this,t))}return this},off:function(t,e){if("string"==typeof t){var n,i=this._eventTypes,r=i&&i[t],o=this._callbacks&&this._callbacks[t];return o&&(!e||-1!==(n=o.indexOf(e))&&1===o.length?(r&&r.uninstall&&r.uninstall.call(this,t),delete this._callbacks[t]):-1!==n&&o.splice(n,1)),this}u.each(t,function(t,e){this.off(e,t)},this)},once:function(t,e){return this.on(t,function n(){e.apply(this,arguments),this.off(t,n)})},emit:function(t,e){var n=this._callbacks&&this._callbacks[t];if(!n)return!1;var i=u.slice(arguments,1),r=e&&e.target&&!e.currentTarget;n=n.slice(),r&&(e.currentTarget=this);for(var o=0,s=n.length;o<s;o++)if(0==n[o].apply(this,i)){e&&e.stop&&e.stop();break}return r&&delete e.currentTarget,!0},responds:function(t){return!(!this._callbacks||!this._callbacks[t])},attach:"#on",detach:"#off",fire:"#emit",_installEvents:function(t){var e=this._eventTypes,n=this._callbacks,i=t?"install":"uninstall";if(e)for(var r in n)if(n[r].length>0){var o=e[r],s=o&&o[i];s&&s.call(this,r)}},statics:{inject:function t(e){var n=e._events;if(n){var i={};u.each(n,function(t,n){var r="string"==typeof t,o=r?t:n,s=u.capitalize(o),a=o.substring(2).toLowerCase();i[a]=r?{}:t,o="_"+o,e["get"+s]=function(){return this[o]},e["set"+s]=function(t){var e=this[o];e&&this.off(a,e),t&&this.on(a,t),this[o]=t}}),e._eventTypes=i}return t.base.apply(this,arguments)}}},d=u.extend({_class:"PaperScope",initialize:function t(){dt=this,this.settings=new u({applyMatrix:!0,insertItems:!0,handleSize:4,hitTolerance:0}),this.project=null,this.projects=[],this.tools=[],this._id=t._id++,t._scopes[this._id]=this;var e=t.prototype;if(!this.support){var n=lt.getContext(1,1)||{};e.support={nativeDash:"setLineDash"in n||"mozDash"in n,nativeBlendModes:ct.nativeModes},lt.release(n)}if(!this.agent){var i=s.navigator.userAgent.toLowerCase(),r=(/(darwin|win|mac|linux|freebsd|sunos)/.exec(i)||[])[0],o="darwin"===r?"mac":r,a=e.agent=e.browser={platform:o};o&&(a[o]=!0),i.replace(/(opera|chrome|safari|webkit|firefox|msie|trident|atom|node|jsdom)\/?\s*([.\d]+)(?:.*version\/([.\d]+))?(?:.*rv\:v?([.\d]+))?/g,function(t,e,n,i,r){if(!a.chrome){var o="opera"===e?i:/^(node|trident)$/.test(e)?r:n;a.version=o,a.versionNumber=parseFloat(o),e={trident:"msie",jsdom:"node"}[e]||e,a.name=e,a[e]=!0}}),a.chrome&&delete a.webkit,a.atom&&delete a.chrome}},version:"0.12.7",getView:function(){var t=this.project;return t&&t._view},getPaper:function(){return this},execute:function(t,e){var n=dt.PaperScript.execute(t,this,e);return K.updateFocus(),n},install:function(t){var e=this;for(var n in u.each(["project","view","tool"],function(n){u.define(t,n,{configurable:!0,get:function(){return e[n]}})}),this)!/^_/.test(n)&&this[n]&&(t[n]=this[n])},setup:function(t){return dt=this,this.project=new x(t),this},createCanvas:function(t,e){return lt.getCanvas(t,e)},activate:function(){dt=this},clear:function(){for(var t=this.projects,e=this.tools,n=t.length-1;n>=0;n--)t[n].remove();for(n=e.length-1;n>=0;n--)e[n].remove()},remove:function(){this.clear(),delete d._scopes[this._id]},statics:new function(){function t(t){return t+="Attribute",function(e,n){return e[t](n)||e[t]("data-paper-"+n)}}return{_scopes:{},_id:0,get:function(t){return this._scopes[t]||null},getAttribute:t("get"),hasAttribute:t("has")}}}),p=u.extend(h,{initialize:function(t){this._scope=dt,this._index=this._scope[this._list].push(this)-1,!t&&this._scope[this._reference]||this.activate()},activate:function(){if(!this._scope)return!1;var t=this._scope[this._reference];return t&&t!==this&&t.emit("deactivate"),this._scope[this._reference]=this,this.emit("activate",t),!0},isActive:function(){return this._scope[this._reference]===this},remove:function(){return null!=this._index&&(u.splice(this._scope[this._list],null,this._index,1),this._scope[this._reference]==this&&(this._scope[this._reference]=null),this._scope=null,!0)},getView:function(){return this._scope.getView()}}),f={findItemBoundsCollisions:function(t,e,n){function i(t){for(var e=new Array(t.length),n=0;n<t.length;n++){var i=t[n].getBounds();e[n]=[i.left,i.top,i.right,i.bottom]}return e}var r=i(t),o=e&&e!==t?i(e):r;return this.findBoundsCollisions(r,o,n||0)},findCurveBoundsCollisions:function(t,e,n,i){function r(t){for(var e=Math.min,n=Math.max,i=new Array(t.length),r=0;r<t.length;r++){var o=t[r];i[r]=[e(o[0],o[2],o[4],o[6]),e(o[1],o[3],o[5],o[7]),n(o[0],o[2],o[4],o[6]),n(o[1],o[3],o[5],o[7])]}return i}var o=r(t),s=e&&e!==t?r(e):o;if(i){for(var a=this.findBoundsCollisions(o,s,n||0,!1,!0),l=this.findBoundsCollisions(o,s,n||0,!0,!0),c=[],u=0,h=a.length;u<h;u++)c[u]={hor:a[u],ver:l[u]};return c}return this.findBoundsCollisions(o,s,n||0)},findBoundsCollisions:function(t,e,n,i,r){var o=!e||t===e,s=o?t:t.concat(e),a=t.length,l=s.length;function c(t,e,n){for(var i=0,r=t.length;i<r;){var o=r+i>>>1;s[t[o]][e]<n?i=o+1:r=o}return i-1}for(var u=i?1:0,h=u+2,d=i?0:1,p=d+2,f=new Array(l),g=0;g<l;g++)f[g]=g;f.sort(function(t,e){return s[t][u]-s[e][u]});var m=[],y=new Array(a);for(g=0;g<l;g++){var v=f[g],b=s[v],I=o?v:v-a,A=v<a,M=o||!A,w=A?[]:null;if(m.length){var C=c(m,h,b[u]-n)+1;if(m.splice(0,C),o&&r){w=w.concat(m);for(var T=0;T<m.length;T++){y[D=m[T]].push(I)}}else{var x=b[p],S=b[d];for(T=0;T<m.length;T++){var D=m[T],N=s[D],_=D<a,E=o||D>=a;(r||(A&&E||M&&_)&&x>=N[d]-n&&S<=N[p]+n)&&(A&&E&&w.push(o?D:D-a),M&&_&&y[D].push(I))}}}if(A&&(t===e&&w.push(v),y[v]=w),m.length){var j=c(m,h,b[h]);m.splice(j+1,0,v)}else m.push(v)}for(g=0;g<y.length;g++){var k=y[g];k&&k.sort(function(t,e){return t-e})}return y}},g=u.extend({initialize:function(t){this.precision=u.pick(t,5),this.multiplier=Math.pow(10,this.precision)},number:function(t){return this.precision<16?Math.round(t*this.multiplier)/this.multiplier:t},pair:function(t,e,n){return this.number(t)+(n||",")+this.number(e)},point:function(t,e){return this.number(t.x)+(e||",")+this.number(t.y)},size:function(t,e){return this.number(t.width)+(e||",")+this.number(t.height)},rectangle:function(t,e){return this.point(t,e)+(e||",")+this.size(t,e)}});g.instance=new g;var m=new function(){var t=[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],e=[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]],n=Math.abs,i=Math.sqrt,r=Math.pow,o=Math.log2||function(t){return Math.log(t)*Math.LOG2E},s=1e-12,a=112e-18;function l(t,e,n){return t<e?e:t>n?n:t}function c(t,e,i){function r(t){var e=134217729*t,n=t-e+e;return[n,t-n]}var o=e*e-t*i,s=e*e+t*i;if(3*n(o)<s){var a=r(t),l=r(e),c=r(i),u=e*e,h=t*i;o=u-h+(l[0]*l[0]-u+2*l[0]*l[1]+l[1]*l[1]-(a[0]*c[0]-h+a[0]*c[1]+a[1]*c[0]+a[1]*c[1]))}return o}function u(){var t=Math.max.apply(Math,arguments);return t&&(t<1e-8||t>1e8)?r(2,-Math.round(o(t))):0}return{EPSILON:s,MACHINE_EPSILON:a,CURVETIME_EPSILON:1e-8,GEOMETRIC_EPSILON:1e-7,TRIGONOMETRIC_EPSILON:1e-8,KAPPA:4*(i(2)-1)/3,isZero:function(t){return t>=-1e-12&&t<=s},isMachineZero:function(t){return t>=-112e-18&&t<=a},clamp:l,integrate:function(n,i,r,o){for(var s=t[o-2],a=e[o-2],l=.5*(r-i),c=l+i,u=0,h=o+1>>1,d=1&o?a[u++]*n(c):0;u<h;){var p=l*s[u];d+=a[u++]*(n(c+p)+n(c-p))}return l*d},findRoot:function(t,e,i,r,o,s,a){for(var c=0;c<s;c++){var u=t(i),h=u/e(i),d=i-h;if(n(h)<a){i=d;break}u>0?(o=i,i=d<=r?.5*(r+o):d):(r=i,i=d>=o?.5*(r+o):d)}return l(i,r,o)},solveQuadratic:function(t,e,r,o,h,d){var p,f=1/0;if(n(t)<s){if(n(e)<s)return n(r)<s?-1:0;p=-r/e}else{var g=c(t,e*=-.5,r);if(g&&n(g)<a){var m=u(n(t),n(e),n(r));m&&(g=c(t*=m,e*=m,r*=m))}if(g>=-112e-18){var y=g<0?0:i(g),v=e+(e<0?-y:y);0===v?f=-(p=r/t):(p=v/t,f=r/v)}}var b=0,I=null==h,A=h-s,M=d+s;return isFinite(p)&&(I||p>A&&p<M)&&(o[b++]=I?p:l(p,h,d)),f!==p&&isFinite(f)&&(I||f>A&&f<M)&&(o[b++]=I?f:l(f,h,d)),b},solveCubic:function(t,e,o,c,h,d,p){var f,g,y,v,b,I=u(n(t),n(e),n(o),n(c));function A(n){var i=t*(f=n);v=(i+(g=i+e))*f+(y=g*f+o),b=y*f+c}if(I&&(t*=I,e*=I,o*=I,c*=I),n(t)<s)t=e,g=o,y=c,f=1/0;else if(n(c)<s)g=e,y=o,f=0;else{A(-e/t/3);var M=b/t,w=r(n(M),1/3),C=M<0?-1:1,T=-v/t,x=T>0?1.324717957244746*Math.max(w,i(T)):w,S=f-C*x;if(S!==f){do{A(S),S=0===v?f:f-b/v/(1+a)}while(C*S>C*f);n(t)*f*f>n(c/f)&&(g=((y=-c/f)-o)/f)}}var D=m.solveQuadratic(t,g,y,h,d,p),N=null==d;return isFinite(f)&&(0===D||D>0&&f!==h[0]&&f!==h[1])&&(N||f>d-s&&f<p+s)&&(h[D++]=N?f:l(f,d,p)),D}}},y={_id:1,_pools:{},get:function(t){if(t){var e=this._pools[t];return e||(e=this._pools[t]={_id:1}),e._id++}return this._id++}},v=u.extend({_class:"Point",_readIndex:!0,initialize:function(t,e){var n=typeof t,i=this.__read,r=0;if("number"===n){var o="number"==typeof e;this._set(t,o?e:t),i&&(r=o?2:1)}else if("undefined"===n||null===t)this._set(0,0),i&&(r=null===t?1:0);else{var s="string"===n?t.split(/[\s,]+/)||[]:t;r=1,Array.isArray(s)?this._set(+s[0],+(s.length>1?s[1]:s[0])):"x"in s?this._set(s.x||0,s.y||0):"width"in s?this._set(s.width||0,s.height||0):"angle"in s?(this._set(s.length||0,0),this.setAngle(s.angle||0)):(this._set(0,0),r=0)}return i&&(this.__read=r),this},set:"#initialize",_set:function(t,e){return this.x=t,this.y=e,this},equals:function(t){return this===t||t&&(this.x===t.x&&this.y===t.y||Array.isArray(t)&&this.x===t[0]&&this.y===t[1])||!1},clone:function(){return new v(this.x,this.y)},toString:function(){var t=g.instance;return"{ x: "+t.number(this.x)+", y: "+t.number(this.y)+" }"},_serialize:function(t){var e=t.formatter;return[e.number(this.x),e.number(this.y)]},getLength:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},setLength:function(t){if(this.isZero()){var e=this._angle||0;this._set(Math.cos(e)*t,Math.sin(e)*t)}else{var n=t/this.getLength();m.isZero(n)&&this.getAngle(),this._set(this.x*n,this.y*n)}},getAngle:function(){return 180*this.getAngleInRadians.apply(this,arguments)/Math.PI},setAngle:function(t){this.setAngleInRadians.call(this,t*Math.PI/180)},getAngleInDegrees:"#getAngle",setAngleInDegrees:"#setAngle",getAngleInRadians:function(){if(arguments.length){var t=v.read(arguments),e=this.getLength()*t.getLength();if(m.isZero(e))return NaN;var n=this.dot(t)/e;return Math.acos(n<-1?-1:n>1?1:n)}return this.isZero()?this._angle||0:this._angle=Math.atan2(this.y,this.x)},setAngleInRadians:function(t){if(this._angle=t,!this.isZero()){var e=this.getLength();this._set(Math.cos(t)*e,Math.sin(t)*e)}},getQuadrant:function(){return this.x>=0?this.y>=0?1:4:this.y>=0?2:3}},{beans:!1,getDirectedAngle:function(){var t=v.read(arguments);return 180*Math.atan2(this.cross(t),this.dot(t))/Math.PI},getDistance:function(){var t=arguments,e=v.read(t),n=e.x-this.x,i=e.y-this.y,r=n*n+i*i;return u.read(t)?r:Math.sqrt(r)},normalize:function(t){t===a&&(t=1);var e=this.getLength(),n=0!==e?t/e:0,i=new v(this.x*n,this.y*n);return n>=0&&(i._angle=this._angle),i},rotate:function(t,e){if(0===t)return this.clone();t=t*Math.PI/180;var n=e?this.subtract(e):this,i=Math.sin(t),r=Math.cos(t);return n=new v(n.x*r-n.y*i,n.x*i+n.y*r),e?n.add(e):n},transform:function(t){return t?t._transformPoint(this):this},add:function(){var t=v.read(arguments);return new v(this.x+t.x,this.y+t.y)},subtract:function(){var t=v.read(arguments);return new v(this.x-t.x,this.y-t.y)},multiply:function(){var t=v.read(arguments);return new v(this.x*t.x,this.y*t.y)},divide:function(){var t=v.read(arguments);return new v(this.x/t.x,this.y/t.y)},modulo:function(){var t=v.read(arguments);return new v(this.x%t.x,this.y%t.y)},negate:function(){return new v(-this.x,-this.y)},isInside:function(){return M.read(arguments).contains(this)},isClose:function(){var t=arguments,e=v.read(t),n=u.read(t);return this.getDistance(e)<=n},isCollinear:function(){var t=v.read(arguments);return v.isCollinear(this.x,this.y,t.x,t.y)},isColinear:"#isCollinear",isOrthogonal:function(){var t=v.read(arguments);return v.isOrthogonal(this.x,this.y,t.x,t.y)},isZero:function(){var t=m.isZero;return t(this.x)&&t(this.y)},isNaN:function(){return isNaN(this.x)||isNaN(this.y)},isInQuadrant:function(t){return this.x*(t>1&&t<4?-1:1)>=0&&this.y*(t>2?-1:1)>=0},dot:function(){var t=v.read(arguments);return this.x*t.x+this.y*t.y},cross:function(){var t=v.read(arguments);return this.x*t.y-this.y*t.x},project:function(){var t=v.read(arguments),e=t.isZero()?0:this.dot(t)/t.dot(t);return new v(t.x*e,t.y*e)},statics:{min:function(){var t=arguments,e=v.read(t),n=v.read(t);return new v(Math.min(e.x,n.x),Math.min(e.y,n.y))},max:function(){var t=arguments,e=v.read(t),n=v.read(t);return new v(Math.max(e.x,n.x),Math.max(e.y,n.y))},random:function(){return new v(Math.random(),Math.random())},isCollinear:function(t,e,n,i){return Math.abs(t*i-e*n)<=1e-8*Math.sqrt((t*t+e*e)*(n*n+i*i))},isOrthogonal:function(t,e,n,i){return Math.abs(t*n+e*i)<=1e-8*Math.sqrt((t*t+e*e)*(n*n+i*i))}}},u.each(["round","ceil","floor","abs"],function(t){var e=Math[t];this[t]=function(){return new v(e(this.x),e(this.y))}},{})),b=v.extend({initialize:function(t,e,n,i){this._x=t,this._y=e,this._owner=n,this._setter=i},_set:function(t,e,n){return this._x=t,this._y=e,n||this._owner[this._setter](this),this},getX:function(){return this._x},setX:function(t){this._x=t,this._owner[this._setter](this)},getY:function(){return this._y},setY:function(t){this._y=t,this._owner[this._setter](this)},isSelected:function(){return!!(this._owner._selection&this._getSelection())},setSelected:function(t){this._owner._changeSelection(this._getSelection(),t)},_getSelection:function(){return"setPosition"===this._setter?4:0}}),I=u.extend({_class:"Size",_readIndex:!0,initialize:function(t,e){var n=typeof t,i=this.__read,r=0;if("number"===n){var o="number"==typeof e;this._set(t,o?e:t),i&&(r=o?2:1)}else if("undefined"===n||null===t)this._set(0,0),i&&(r=null===t?1:0);else{var s="string"===n?t.split(/[\s,]+/)||[]:t;r=1,Array.isArray(s)?this._set(+s[0],+(s.length>1?s[1]:s[0])):"width"in s?this._set(s.width||0,s.height||0):"x"in s?this._set(s.x||0,s.y||0):(this._set(0,0),r=0)}return i&&(this.__read=r),this},set:"#initialize",_set:function(t,e){return this.width=t,this.height=e,this},equals:function(t){return t===this||t&&(this.width===t.width&&this.height===t.height||Array.isArray(t)&&this.width===t[0]&&this.height===t[1])||!1},clone:function(){return new I(this.width,this.height)},toString:function(){var t=g.instance;return"{ width: "+t.number(this.width)+", height: "+t.number(this.height)+" }"},_serialize:function(t){var e=t.formatter;return[e.number(this.width),e.number(this.height)]},add:function(){var t=I.read(arguments);return new I(this.width+t.width,this.height+t.height)},subtract:function(){var t=I.read(arguments);return new I(this.width-t.width,this.height-t.height)},multiply:function(){var t=I.read(arguments);return new I(this.width*t.width,this.height*t.height)},divide:function(){var t=I.read(arguments);return new I(this.width/t.width,this.height/t.height)},modulo:function(){var t=I.read(arguments);return new I(this.width%t.width,this.height%t.height)},negate:function(){return new I(-this.width,-this.height)},isZero:function(){var t=m.isZero;return t(this.width)&&t(this.height)},isNaN:function(){return isNaN(this.width)||isNaN(this.height)},statics:{min:function(t,e){return new I(Math.min(t.width,e.width),Math.min(t.height,e.height))},max:function(t,e){return new I(Math.max(t.width,e.width),Math.max(t.height,e.height))},random:function(){return new I(Math.random(),Math.random())}}},u.each(["round","ceil","floor","abs"],function(t){var e=Math[t];this[t]=function(){return new I(e(this.width),e(this.height))}},{})),A=I.extend({initialize:function(t,e,n,i){this._width=t,this._height=e,this._owner=n,this._setter=i},_set:function(t,e,n){return this._width=t,this._height=e,n||this._owner[this._setter](this),this},getWidth:function(){return this._width},setWidth:function(t){this._width=t,this._owner[this._setter](this)},getHeight:function(){return this._height},setHeight:function(t){this._height=t,this._owner[this._setter](this)}}),M=u.extend({_class:"Rectangle",_readIndex:!0,beans:!0,initialize:function(t,e,n,i){var r,o=arguments,s=typeof t;if("number"===s?(this._set(t,e,n,i),r=4):"undefined"===s||null===t?(this._set(0,0,0,0),r=null===t?1:0):1===o.length&&(Array.isArray(t)?(this._set.apply(this,t),r=1):t.x!==a||t.width!==a?(this._set(t.x||0,t.y||0,t.width||0,t.height||0),r=1):t.from===a&&t.to===a&&(this._set(0,0,0,0),u.readSupported(o,this)&&(r=1))),r===a){var l,c,h=v.readNamed(o,"from"),d=u.peek(o),p=h.x,f=h.y;if(d&&d.x!==a||u.hasNamed(o,"to")){var g=v.readNamed(o,"to");l=g.x-p,c=g.y-f,l<0&&(p=g.x,l=-l),c<0&&(f=g.y,c=-c)}else{var m=I.read(o);l=m.width,c=m.height}this._set(p,f,l,c),r=o.__index}var y=o.__filtered;return y&&(this.__filtered=y),this.__read&&(this.__read=r),this},set:"#initialize",_set:function(t,e,n,i){return this.x=t,this.y=e,this.width=n,this.height=i,this},clone:function(){return new M(this.x,this.y,this.width,this.height)},equals:function(t){var e=u.isPlainValue(t)?M.read(arguments):t;return e===this||e&&this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height||!1},toString:function(){var t=g.instance;return"{ x: "+t.number(this.x)+", y: "+t.number(this.y)+", width: "+t.number(this.width)+", height: "+t.number(this.height)+" }"},_serialize:function(t){var e=t.formatter;return[e.number(this.x),e.number(this.y),e.number(this.width),e.number(this.height)]},getPoint:function(t){return new(t?v:b)(this.x,this.y,this,"setPoint")},setPoint:function(){var t=v.read(arguments);this.x=t.x,this.y=t.y},getSize:function(t){return new(t?I:A)(this.width,this.height,this,"setSize")},_fw:1,_fh:1,setSize:function(){var t=I.read(arguments),e=this._sx,n=this._sy,i=t.width,r=t.height;e&&(this.x+=(this.width-i)*e),n&&(this.y+=(this.height-r)*n),this.width=i,this.height=r,this._fw=this._fh=1},getLeft:function(){return this.x},setLeft:function(t){if(!this._fw){var e=t-this.x;this.width-=.5===this._sx?2*e:e}this.x=t,this._sx=this._fw=0},getTop:function(){return this.y},setTop:function(t){if(!this._fh){var e=t-this.y;this.height-=.5===this._sy?2*e:e}this.y=t,this._sy=this._fh=0},getRight:function(){return this.x+this.width},setRight:function(t){if(!this._fw){var e=t-this.x;this.width=.5===this._sx?2*e:e}this.x=t-this.width,this._sx=1,this._fw=0},getBottom:function(){return this.y+this.height},setBottom:function(t){if(!this._fh){var e=t-this.y;this.height=.5===this._sy?2*e:e}this.y=t-this.height,this._sy=1,this._fh=0},getCenterX:function(){return this.x+this.width/2},setCenterX:function(t){this._fw||.5===this._sx?this.x=t-this.width/2:(this._sx&&(this.x+=2*(t-this.x)*this._sx),this.width=2*(t-this.x)),this._sx=.5,this._fw=0},getCenterY:function(){return this.y+this.height/2},setCenterY:function(t){this._fh||.5===this._sy?this.y=t-this.height/2:(this._sy&&(this.y+=2*(t-this.y)*this._sy),this.height=2*(t-this.y)),this._sy=.5,this._fh=0},getCenter:function(t){return new(t?v:b)(this.getCenterX(),this.getCenterY(),this,"setCenter")},setCenter:function(){var t=v.read(arguments);return this.setCenterX(t.x),this.setCenterY(t.y),this},getArea:function(){return this.width*this.height},isEmpty:function(){return 0===this.width||0===this.height},contains:function(t){return t&&t.width!==a||4===(Array.isArray(t)?t:arguments).length?this._containsRectangle(M.read(arguments)):this._containsPoint(v.read(arguments))},_containsPoint:function(t){var e=t.x,n=t.y;return e>=this.x&&n>=this.y&&e<=this.x+this.width&&n<=this.y+this.height},_containsRectangle:function(t){var e=t.x,n=t.y;return e>=this.x&&n>=this.y&&e+t.width<=this.x+this.width&&n+t.height<=this.y+this.height},intersects:function(){var t=M.read(arguments),e=u.read(arguments)||0;return t.x+t.width>this.x-e&&t.y+t.height>this.y-e&&t.x<this.x+this.width+e&&t.y<this.y+this.height+e},intersect:function(){var t=M.read(arguments),e=Math.max(this.x,t.x),n=Math.max(this.y,t.y),i=Math.min(this.x+this.width,t.x+t.width),r=Math.min(this.y+this.height,t.y+t.height);return new M(e,n,i-e,r-n)},unite:function(){var t=M.read(arguments),e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x+this.width,t.x+t.width),r=Math.max(this.y+this.height,t.y+t.height);return new M(e,n,i-e,r-n)},include:function(){var t=v.read(arguments),e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x+this.width,t.x),r=Math.max(this.y+this.height,t.y);return new M(e,n,i-e,r-n)},expand:function(){var t=I.read(arguments),e=t.width,n=t.height;return new M(this.x-e/2,this.y-n/2,this.width+e,this.height+n)},scale:function(t,e){return this.expand(this.width*t-this.width,this.height*(e===a?t:e)-this.height)}},u.each([["Top","Left"],["Top","Right"],["Bottom","Left"],["Bottom","Right"],["Left","Center"],["Top","Center"],["Right","Center"],["Bottom","Center"]],function(t,e){var n=t.join(""),i=/^[RL]/.test(n);e>=4&&(t[1]+=i?"Y":"X");var r=t[i?0:1],o=t[i?1:0],s="get"+r,a="get"+o,l="set"+r,c="set"+o,u="set"+n;this["get"+n]=function(t){return new(t?v:b)(this[s](),this[a](),this,u)},this[u]=function(){var t=v.read(arguments);this[l](t.x),this[c](t.y)}},{beans:!0})),w=M.extend({initialize:function(t,e,n,i,r,o){this._set(t,e,n,i,!0),this._owner=r,this._setter=o},_set:function(t,e,n,i,r){return this._x=t,this._y=e,this._width=n,this._height=i,r||this._owner[this._setter](this),this}},new function(){var t=M.prototype;return u.each(["x","y","width","height"],function(t){var e=u.capitalize(t),n="_"+t;this["get"+e]=function(){return this[n]},this["set"+e]=function(t){this[n]=t,this._dontNotify||this._owner[this._setter](this)}},u.each(["Point","Size","Center","Left","Top","Right","Bottom","CenterX","CenterY","TopLeft","TopRight","BottomLeft","BottomRight","LeftCenter","TopCenter","RightCenter","BottomCenter"],function(e){var n="set"+e;this[n]=function(){this._dontNotify=!0,t[n].apply(this,arguments),this._dontNotify=!1,this._owner[this._setter](this)}},{isSelected:function(){return!!(2&this._owner._selection)},setSelected:function(t){var e=this._owner;e._changeSelection&&e._changeSelection(2,t)}}))}),C=u.extend({_class:"Matrix",initialize:function t(e,n){var i=arguments,r=i.length,o=!0;if(r>=6?this._set.apply(this,i):1===r||2===r?e instanceof t?this._set(e._a,e._b,e._c,e._d,e._tx,e._ty,n):Array.isArray(e)?this._set.apply(this,n?e.concat([n]):e):o=!1:r?o=!1:this.reset(),!o)throw new Error("Unsupported matrix parameters");return this},set:"#initialize",_set:function(t,e,n,i,r,o,s){return this._a=t,this._b=e,this._c=n,this._d=i,this._tx=r,this._ty=o,s||this._changed(),this},_serialize:function(t,e){return u.serialize(this.getValues(),t,!0,e)},_changed:function(){var t=this._owner;t&&(t._applyMatrix?t.transform(null,!0):t._changed(25))},clone:function(){return new C(this._a,this._b,this._c,this._d,this._tx,this._ty)},equals:function(t){return t===this||t&&this._a===t._a&&this._b===t._b&&this._c===t._c&&this._d===t._d&&this._tx===t._tx&&this._ty===t._ty},toString:function(){var t=g.instance;return"[["+[t.number(this._a),t.number(this._c),t.number(this._tx)].join(", ")+"], ["+[t.number(this._b),t.number(this._d),t.number(this._ty)].join(", ")+"]]"},reset:function(t){return this._a=this._d=1,this._b=this._c=this._tx=this._ty=0,t||this._changed(),this},apply:function(t,e){var n=this._owner;return!!n&&(n.transform(null,u.pick(t,!0),e),this.isIdentity())},translate:function(){var t=v.read(arguments),e=t.x,n=t.y;return this._tx+=e*this._a+n*this._c,this._ty+=e*this._b+n*this._d,this._changed(),this},scale:function(){var t=arguments,e=v.read(t),n=v.read(t,0,{readNull:!0});return n&&this.translate(n),this._a*=e.x,this._b*=e.x,this._c*=e.y,this._d*=e.y,n&&this.translate(n.negate()),this._changed(),this},rotate:function(t){t*=Math.PI/180;var e=v.read(arguments,1),n=e.x,i=e.y,r=Math.cos(t),o=Math.sin(t),s=n-n*r+i*o,a=i-n*o-i*r,l=this._a,c=this._b,u=this._c,h=this._d;return this._a=r*l+o*u,this._b=r*c+o*h,this._c=-o*l+r*u,this._d=-o*c+r*h,this._tx+=s*l+a*u,this._ty+=s*c+a*h,this._changed(),this},shear:function(){var t=arguments,e=v.read(t),n=v.read(t,0,{readNull:!0});n&&this.translate(n);var i=this._a,r=this._b;return this._a+=e.y*this._c,this._b+=e.y*this._d,this._c+=e.x*i,this._d+=e.x*r,n&&this.translate(n.negate()),this._changed(),this},skew:function(){var t=arguments,e=v.read(t),n=v.read(t,0,{readNull:!0}),i=Math.PI/180,r=new v(Math.tan(e.x*i),Math.tan(e.y*i));return this.shear(r,n)},append:function(t,e){if(t){var n=this._a,i=this._b,r=this._c,o=this._d,s=t._a,a=t._c,l=t._b,c=t._d,u=t._tx,h=t._ty;this._a=s*n+l*r,this._c=a*n+c*r,this._b=s*i+l*o,this._d=a*i+c*o,this._tx+=u*n+h*r,this._ty+=u*i+h*o,e||this._changed()}return this},prepend:function(t,e){if(t){var n=this._a,i=this._b,r=this._c,o=this._d,s=this._tx,a=this._ty,l=t._a,c=t._c,u=t._b,h=t._d,d=t._tx,p=t._ty;this._a=l*n+c*i,this._c=l*r+c*o,this._b=u*n+h*i,this._d=u*r+h*o,this._tx=l*s+c*a+d,this._ty=u*s+h*a+p,e||this._changed()}return this},appended:function(t){return this.clone().append(t)},prepended:function(t){return this.clone().prepend(t)},invert:function(){var t=this._a,e=this._b,n=this._c,i=this._d,r=this._tx,o=this._ty,s=t*i-e*n,a=null;return s&&!isNaN(s)&&isFinite(r)&&isFinite(o)&&(this._a=i/s,this._b=-e/s,this._c=-n/s,this._d=t/s,this._tx=(n*o-i*r)/s,this._ty=(e*r-t*o)/s,a=this),a},inverted:function(){return this.clone().invert()},concatenate:"#append",preConcatenate:"#prepend",chain:"#appended",_shiftless:function(){return new C(this._a,this._b,this._c,this._d,0,0)},_orNullIfIdentity:function(){return this.isIdentity()?null:this},isIdentity:function(){return 1===this._a&&0===this._b&&0===this._c&&1===this._d&&0===this._tx&&0===this._ty},isInvertible:function(){var t=this._a*this._d-this._c*this._b;return t&&!isNaN(t)&&isFinite(this._tx)&&isFinite(this._ty)},isSingular:function(){return!this.isInvertible()},transform:function(t,e,n){return arguments.length<3?this._transformPoint(v.read(arguments)):this._transformCoordinates(t,e,n)},_transformPoint:function(t,e,n){var i=t.x,r=t.y;return e||(e=new v),e._set(i*this._a+r*this._c+this._tx,i*this._b+r*this._d+this._ty,n)},_transformCoordinates:function(t,e,n){for(var i=0,r=2*n;i<r;i+=2){var o=t[i],s=t[i+1];e[i]=o*this._a+s*this._c+this._tx,e[i+1]=o*this._b+s*this._d+this._ty}return e},_transformCorners:function(t){var e=t.x,n=t.y,i=e+t.width,r=n+t.height,o=[e,n,i,n,i,r,e,r];return this._transformCoordinates(o,o,4)},_transformBounds:function(t,e,n){for(var i=this._transformCorners(t),r=i.slice(0,2),o=r.slice(),s=2;s<8;s++){var a=i[s],l=1&s;a<r[l]?r[l]=a:a>o[l]&&(o[l]=a)}return e||(e=new M),e._set(r[0],r[1],o[0]-r[0],o[1]-r[1],n)},inverseTransform:function(){return this._inverseTransform(v.read(arguments))},_inverseTransform:function(t,e,n){var i=this._a,r=this._b,o=this._c,s=this._d,a=this._tx,l=this._ty,c=i*s-r*o,u=null;if(c&&!isNaN(c)&&isFinite(a)&&isFinite(l)){var h=t.x-this._tx,d=t.y-this._ty;e||(e=new v),u=e._set((h*s-d*o)/c,(d*i-h*r)/c,n)}return u},decompose:function(){var t,e,n,i=this._a,r=this._b,o=this._c,s=this._d,a=i*s-r*o,l=Math.sqrt,c=Math.atan2,u=180/Math.PI;if(0!==i||0!==r){var h=l(i*i+r*r);t=Math.acos(i/h)*(r>0?1:-1),e=[h,a/h],n=[c(i*o+r*s,h*h),0]}else if(0!==o||0!==s){var d=l(o*o+s*s);t=Math.asin(o/d)*(s>0?1:-1),e=[a/d,d],n=[0,c(i*o+r*s,d*d)]}else t=0,n=e=[0,0];return{translation:this.getTranslation(),rotation:t*u,scaling:new v(e),skewing:new v(n[0]*u,n[1]*u)}},getValues:function(){return[this._a,this._b,this._c,this._d,this._tx,this._ty]},getTranslation:function(){return new v(this._tx,this._ty)},getScaling:function(){return this.decompose().scaling},getRotation:function(){return this.decompose().rotation},applyToContext:function(t){this.isIdentity()||t.transform(this._a,this._b,this._c,this._d,this._tx,this._ty)}},u.each(["a","b","c","d","tx","ty"],function(t){var e=u.capitalize(t),n="_"+t;this["get"+e]=function(){return this[n]},this["set"+e]=function(t){this[n]=t,this._changed()}},{})),T=u.extend({_class:"Line",initialize:function(t,e,n,i,r){var o=!1;arguments.length>=4?(this._px=t,this._py=e,this._vx=n,this._vy=i,o=r):(this._px=t.x,this._py=t.y,this._vx=e.x,this._vy=e.y,o=n),o||(this._vx-=this._px,this._vy-=this._py)},getPoint:function(){return new v(this._px,this._py)},getVector:function(){return new v(this._vx,this._vy)},getLength:function(){return this.getVector().getLength()},intersect:function(t,e){return T.intersect(this._px,this._py,this._vx,this._vy,t._px,t._py,t._vx,t._vy,!0,e)},getSide:function(t,e){return T.getSide(this._px,this._py,this._vx,this._vy,t.x,t.y,!0,e)},getDistance:function(t){return Math.abs(this.getSignedDistance(t))},getSignedDistance:function(t){return T.getSignedDistance(this._px,this._py,this._vx,this._vy,t.x,t.y,!0)},isCollinear:function(t){return v.isCollinear(this._vx,this._vy,t._vx,t._vy)},isOrthogonal:function(t){return v.isOrthogonal(this._vx,this._vy,t._vx,t._vy)},statics:{intersect:function(t,e,n,i,r,o,s,a,l,c){l||(n-=t,i-=e,s-=r,a-=o);var u=n*a-i*s;if(!m.isMachineZero(u)){var h=t-r,d=e-o,p=(s*d-a*h)/u,f=(n*d-i*h)/u,g=-1e-12,y=1+1e-12;if(c||g<p&&p<y&&g<f&&f<y)return c||(p=p<=0?0:p>=1?1:p),new v(t+p*n,e+p*i)}},getSide:function(t,e,n,i,r,o,s,a){s||(n-=t,i-=e);var l=r-t,c=l*i-(o-e)*n;return!a&&m.isMachineZero(c)&&(c=(l*n+l*n)/(n*n+i*i))>=0&&c<=1&&(c=0),c<0?-1:c>0?1:0},getSignedDistance:function(t,e,n,i,r,o,s){return s||(n-=t,i-=e),0===n?i>0?r-t:t-r:0===i?n<0?o-e:e-o:((r-t)*i-(o-e)*n)/(i>n?i*Math.sqrt(1+n*n/(i*i)):n*Math.sqrt(1+i*i/(n*n)))},getDistance:function(t,e,n,i,r,o,s){return Math.abs(T.getSignedDistance(t,e,n,i,r,o,s))}}}),x=p.extend({_class:"Project",_list:"projects",_reference:"project",_compactSerialize:!0,initialize:function(t){p.call(this,!0),this._children=[],this._namedChildren={},this._activeLayer=null,this._currentStyle=new q(null,null,this),this._view=K.create(this,t||lt.getCanvas(1,1)),this._selectionItems={},this._selectionCount=0,this._updateVersion=0},_serialize:function(t,e){return u.serialize(this._children,t,!0,e)},_changed:function(t,e){if(1&t){var n=this._view;n&&(n._needsUpdate=!0,!n._requested&&n._autoUpdate&&n.requestUpdate())}var i=this._changes;if(i&&e){var r=this._changesById,o=e._id,s=r[o];s?s.flags|=t:i.push(r[o]={item:e,flags:t})}},clear:function(){for(var t=this._children,e=t.length-1;e>=0;e--)t[e].remove()},isEmpty:function(){return!this._children.length},remove:function t(){return!!t.base.call(this)&&(this._view&&this._view.remove(),!0)},getView:function(){return this._view},getCurrentStyle:function(){return this._currentStyle},setCurrentStyle:function(t){this._currentStyle.set(t)},getIndex:function(){return this._index},getOptions:function(){return this._scope.settings},getLayers:function(){return this._children},getActiveLayer:function(){return this._activeLayer||new N({project:this,insert:!0})},getSymbolDefinitions:function(){var t=[],e={};return this.getItems({class:j,match:function(n){var i=n._definition,r=i._id;return e[r]||(e[r]=!0,t.push(i)),!1}}),t},getSymbols:"getSymbolDefinitions",getSelectedItems:function(){var t=this._selectionItems,e=[];for(var n in t){var i=t[n],r=i._selection;1&r&&i.isInserted()?e.push(i):r||this._updateSelection(i)}return e},_updateSelection:function(t){var e=t._id,n=this._selectionItems;t._selection?n[e]!==t&&(this._selectionCount++,n[e]=t):n[e]===t&&(this._selectionCount--,delete n[e])},selectAll:function(){for(var t=this._children,e=0,n=t.length;e<n;e++)t[e].setFullySelected(!0)},deselectAll:function(){var t=this._selectionItems;for(var e in t)t[e].setFullySelected(!1)},addLayer:function(t){return this.insertLayer(a,t)},insertLayer:function(t,e){if(e instanceof N){e._remove(!1,!0),u.splice(this._children,[e],t,0),e._setProject(this,!0);var n=e._name;n&&e.setName(n),this._changes&&e._changed(5),this._activeLayer||(this._activeLayer=e)}else e=null;return e},_insertItem:function(t,e,n){return e=this.insertLayer(t,e)||(this._activeLayer||this._insertItem(a,new N(S.NO_INSERT),!0)).insertChild(t,e),n&&e.activate&&e.activate(),e},getItems:function(t){return S._getItems(this,t)},getItem:function(t){return S._getItems(this,t,null,null,!0)[0]||null},importJSON:function(t){this.activate();var e=this._activeLayer;return u.importJSON(t,e&&e.isEmpty()&&e)},removeOn:function(t){var e=this._removeSets;if(e){"mouseup"===t&&(e.mousedrag=null);var n=e[t];if(n){for(var i in n){var r=n[i];for(var o in e){var s=e[o];s&&s!=n&&delete s[r._id]}r.remove()}e[t]=null}}},draw:function(t,e,n){this._updateVersion++,t.save(),e.applyToContext(t);for(var i=this._children,r=new u({offset:new v(0,0),pixelRatio:n,viewMatrix:e.isIdentity()?null:e,matrices:[new C],updateMatrix:!0}),o=0,s=i.length;o<s;o++)i[o].draw(t,r);if(t.restore(),this._selectionCount>0){t.save(),t.strokeWidth=1;var a=this._selectionItems,l=this._scope.settings.handleSize,c=this._updateVersion;for(var h in a)a[h]._drawSelection(t,e,l,a,c);t.restore()}}}),S=u.extend(h,{statics:{extend:function t(e){return e._serializeFields&&(e._serializeFields=u.set({},this.prototype._serializeFields,e._serializeFields)),t.base.apply(this,arguments)},NO_INSERT:{insert:!1}},_class:"Item",_name:null,_applyMatrix:!0,_canApplyMatrix:!0,_canScaleStroke:!1,_pivot:null,_visible:!0,_blendMode:"normal",_opacity:1,_locked:!1,_guide:!1,_clipMask:!1,_selection:0,_selectBounds:!0,_selectChildren:!1,_serializeFields:{name:null,applyMatrix:null,matrix:new C,pivot:null,visible:!0,blendMode:"normal",opacity:1,locked:!1,guide:!1,clipMask:!1,selected:!1,data:{}},_prioritize:["applyMatrix"]},new function(){var t=["onMouseDown","onMouseUp","onMouseDrag","onClick","onDoubleClick","onMouseMove","onMouseEnter","onMouseLeave"];return u.each(t,function(t){this._events[t]={install:function(t){this.getView()._countItemEvent(t,1)},uninstall:function(t){this.getView()._countItemEvent(t,-1)}}},{_events:{onFrame:{install:function(){this.getView()._animateItem(this,!0)},uninstall:function(){this.getView()._animateItem(this,!1)}},onLoad:{},onError:{}},statics:{_itemHandlers:t}})},{initialize:function(){},_initialize:function(t,e){var n=t&&u.isPlainObject(t),i=n&&!0===t.internal,r=this._matrix=new C,o=n&&t.project||dt.project,s=dt.settings;return this._id=i?null:y.get(),this._parent=this._index=null,this._applyMatrix=this._canApplyMatrix&&s.applyMatrix,e&&r.translate(e),r._owner=this,this._style=new q(o._currentStyle,this,o),i||n&&0==t.insert||!s.insertItems&&(!n||!0!==t.insert)?this._setProject(o):(n&&t.parent||o)._insertItem(a,this,!0),n&&t!==S.NO_INSERT&&this.set(t,{internal:!0,insert:!0,project:!0,parent:!0}),n},_serialize:function(t,e){var n={},i=this;function r(r){for(var o in r){var s=i[o];u.equals(s,"leading"===o?1.2*r.fontSize:r[o])||(n[o]=u.serialize(s,t,"data"!==o,e))}}return r(this._serializeFields),this instanceof D||r(this._style._defaults),[this._class,n]},_changed:function(t){var e=this._symbol,n=this._parent||e,i=this._project;8&t&&(this._bounds=this._position=this._decomposed=a),16&t&&(this._globalMatrix=a),n&&72&t&&S._clearBoundsCache(n),2&t&&S._clearBoundsCache(this),i&&i._changed(t,this),e&&e._changed(t)},getId:function(){return this._id},getName:function(){return this._name},setName:function(t){if(this._name&&this._removeNamed(),t===+t+"")throw new Error("Names consisting only of numbers are not supported.");var e=this._getOwner();if(t&&e){var n=e._children,i=e._namedChildren;(i[t]=i[t]||[]).push(this),t in n||(n[t]=this)}this._name=t||a,this._changed(256)},getStyle:function(){return this._style},setStyle:function(t){this.getStyle().set(t)}},u.each(["locked","visible","blendMode","opacity","guide"],function(t){var e=u.capitalize(t),n="_"+t,i={locked:256,visible:265};this["get"+e]=function(){return this[n]},this["set"+e]=function(e){e!=this[n]&&(this[n]=e,this._changed(i[t]||257))}},{}),{beans:!0,getSelection:function(){return this._selection},setSelection:function(t){if(t!==this._selection){this._selection=t;var e=this._project;e&&(e._updateSelection(this),this._changed(257))}},_changeSelection:function(t,e){var n=this._selection;this.setSelection(e?n|t:n&~t)},isSelected:function(){if(this._selectChildren)for(var t=this._children,e=0,n=t.length;e<n;e++)if(t[e].isSelected())return!0;return!!(1&this._selection)},setSelected:function(t){if(this._selectChildren)for(var e=this._children,n=0,i=e.length;n<i;n++)e[n].setSelected(t);this._changeSelection(1,t)},isFullySelected:function(){var t=this._children,e=!!(1&this._selection);if(t&&e){for(var n=0,i=t.length;n<i;n++)if(!t[n].isFullySelected())return!1;return!0}return e},setFullySelected:function(t){var e=this._children;if(e)for(var n=0,i=e.length;n<i;n++)e[n].setFullySelected(t);this._changeSelection(1,t)},isClipMask:function(){return this._clipMask},setClipMask:function(t){this._clipMask!=(t=!!t)&&(this._clipMask=t,t&&(this.setFillColor(null),this.setStrokeColor(null)),this._changed(257),this._parent&&this._parent._changed(2048))},getData:function(){return this._data||(this._data={}),this._data},setData:function(t){this._data=t},getPosition:function(t){var e=t?v:b,n=this._position||(this._position=this._getPositionFromBounds());return new e(n.x,n.y,this,"setPosition")},setPosition:function(){this.translate(v.read(arguments).subtract(this.getPosition(!0)))},_getPositionFromBounds:function(t){return this._pivot?this._matrix._transformPoint(this._pivot):(t||this.getBounds()).getCenter(!0)},getPivot:function(){var t=this._pivot;return t?new b(t.x,t.y,this,"setPivot"):null},setPivot:function(){this._pivot=v.read(arguments,0,{clone:!0,readNull:!0}),this._position=a}},u.each({getStrokeBounds:{stroke:!0},getHandleBounds:{handle:!0},getInternalBounds:{internal:!0},getDrawnBounds:{stroke:!0,drawnTextBounds:!0}},function(t,e){this[e]=function(e){return this.getBounds(e,t)}},{beans:!0,getBounds:function(t,e){var n=e||t instanceof C,i=u.set({},n?e:t,this._boundsOptions);i.stroke&&!this.getStrokeScaling()||(i.cacheItem=this);var r=this._getCachedBounds(n&&t,i).rect;return arguments.length?r:new w(r.x,r.y,r.width,r.height,this,"setBounds")},setBounds:function(){var t=M.read(arguments),e=this.getBounds(),n=this._matrix,i=new C,r=t.getCenter();i.translate(r),t.width==e.width&&t.height==e.height||(n.isInvertible()||(n.set(n._backup||(new C).translate(n.getTranslation())),e=this.getBounds()),i.scale(0!==e.width?t.width/e.width:0,0!==e.height?t.height/e.height:0)),r=e.getCenter(),i.translate(-r.x,-r.y),this.transform(i)},_getBounds:function(t,e){var n=this._children;return n&&n.length?(S._updateBoundsCache(this,e.cacheItem),S._getBounds(n,t,e)):new M},_getBoundsCacheKey:function(t,e){return[t.stroke?1:0,t.handle?1:0,t.drawnTextBounds?1:0,e?1:0].join("")},_getCachedBounds:function(t,e,n){t=t&&t._orNullIfIdentity();var i=e.internal&&!n,r=e.cacheItem,o=i?null:this._matrix._orNullIfIdentity(),s=r&&(!t||t.equals(o))&&this._getBoundsCacheKey(e,i),a=this._bounds;if(S._updateBoundsCache(this._parent||this._symbol,r),s&&a&&s in a)return{rect:(d=a[s]).rect.clone(),nonscaling:d.nonscaling};var l=this._getBounds(t||o,e),c=l.rect||l,u=this._style,h=l.nonscaling||u.hasStroke()&&!u.getStrokeScaling();if(s){a||(this._bounds=a={});var d=a[s]={rect:c.clone(),nonscaling:h,internal:i}}return{rect:c,nonscaling:h}},_getStrokeMatrix:function(t,e){var n=this.getStrokeScaling()?null:e&&e.internal?this:this._parent||this._symbol&&this._symbol._item,i=n?n.getViewMatrix().invert():t;return i&&i._shiftless()},statics:{_updateBoundsCache:function(t,e){if(t&&e){var n=e._id,i=t._boundsCache=t._boundsCache||{ids:{},list:[]};i.ids[n]||(i.list.push(e),i.ids[n]=e)}},_clearBoundsCache:function(t){var e=t._boundsCache;if(e){t._bounds=t._position=t._boundsCache=a;for(var n=0,i=e.list,r=i.length;n<r;n++){var o=i[n];o!==t&&(o._bounds=o._position=a,o._boundsCache&&S._clearBoundsCache(o))}}},_getBounds:function(t,e,n){var i=1/0,r=-i,o=i,s=r,a=!1;n=n||{};for(var l=0,c=t.length;l<c;l++){var u=t[l];if(u._visible&&!u.isEmpty(!0)){var h=u._getCachedBounds(e&&e.appended(u._matrix),n,!0),d=h.rect;i=Math.min(d.x,i),o=Math.min(d.y,o),r=Math.max(d.x+d.width,r),s=Math.max(d.y+d.height,s),h.nonscaling&&(a=!0)}}return{rect:isFinite(i)?new M(i,o,r-i,s-o):new M,nonscaling:a}}}}),{beans:!0,_decompose:function(){return this._applyMatrix?null:this._decomposed||(this._decomposed=this._matrix.decompose())},getRotation:function(){var t=this._decompose();return t?t.rotation:0},setRotation:function(t){var e=this.getRotation();if(null!=e&&null!=t){var n=this._decomposed;this.rotate(t-e),n&&(n.rotation=t,this._decomposed=n)}},getScaling:function(){var t=this._decompose(),e=t&&t.scaling;return new b(e?e.x:1,e?e.y:1,this,"setScaling")},setScaling:function(){var t=this.getScaling(),e=v.read(arguments,0,{clone:!0,readNull:!0});if(t&&e&&!t.equals(e)){var n=this.getRotation(),i=this._decomposed,r=new C,o=this.getPosition(!0);r.translate(o),n&&r.rotate(n),r.scale(e.x/t.x,e.y/t.y),n&&r.rotate(-n),r.translate(o.negate()),this.transform(r),i&&(i.scaling=e,this._decomposed=i)}},getMatrix:function(){return this._matrix},setMatrix:function(){var t=this._matrix;t.initialize.apply(t,arguments)},getGlobalMatrix:function(t){var e=this._globalMatrix;if(e)for(var n=this._parent,i=[];n;){if(!n._globalMatrix){e=null;for(var r=0,o=i.length;r<o;r++)i[r]._globalMatrix=null;break}i.push(n),n=n._parent}e||(e=this._globalMatrix=this._matrix.clone(),(n=this._parent)&&e.prepend(n.getGlobalMatrix(!0)));return t?e:e.clone()},getViewMatrix:function(){return this.getGlobalMatrix().prepend(this.getView()._matrix)},getApplyMatrix:function(){return this._applyMatrix},setApplyMatrix:function(t){(this._applyMatrix=this._canApplyMatrix&&!!t)&&this.transform(null,!0)},getTransformContent:"#getApplyMatrix",setTransformContent:"#setApplyMatrix"},{getProject:function(){return this._project},_setProject:function(t,e){if(this._project!==t){this._project&&this._installEvents(!1),this._project=t;for(var n=this._children,i=0,r=n&&n.length;i<r;i++)n[i]._setProject(t);e=!0}e&&this._installEvents(!0)},getView:function(){return this._project._view},_installEvents:function t(e){t.base.call(this,e);for(var n=this._children,i=0,r=n&&n.length;i<r;i++)n[i]._installEvents(e)},getLayer:function(){for(var t=this;t=t._parent;)if(t instanceof N)return t;return null},getParent:function(){return this._parent},setParent:function(t){return t.addChild(this)},_getOwner:"#getParent",getChildren:function(){return this._children},setChildren:function(t){this.removeChildren(),this.addChildren(t)},getFirstChild:function(){return this._children&&this._children[0]||null},getLastChild:function(){return this._children&&this._children[this._children.length-1]||null},getNextSibling:function(){var t=this._getOwner();return t&&t._children[this._index+1]||null},getPreviousSibling:function(){var t=this._getOwner();return t&&t._children[this._index-1]||null},getIndex:function(){return this._index},equals:function(t){return t===this||t&&this._class===t._class&&this._style.equals(t._style)&&this._matrix.equals(t._matrix)&&this._locked===t._locked&&this._visible===t._visible&&this._blendMode===t._blendMode&&this._opacity===t._opacity&&this._clipMask===t._clipMask&&this._guide===t._guide&&this._equals(t)||!1},_equals:function(t){return u.equals(this._children,t._children)},clone:function(t){var e=new this.constructor(S.NO_INSERT),n=this._children,i=u.pick(t?t.insert:a,t===a||!0===t),r=u.pick(t?t.deep:a,!0);n&&e.copyAttributes(this),n&&!r||e.copyContent(this),n||e.copyAttributes(this),i&&e.insertAbove(this);var o=this._name,s=this._parent;if(o&&s){n=s._children;for(var l=o,c=1;n[o];)o=l+" "+c++;o!==l&&e.setName(o)}return e},copyContent:function(t){for(var e=t._children,n=0,i=e&&e.length;n<i;n++)this.addChild(e[n].clone(!1),!0)},copyAttributes:function(t,e){this.setStyle(t._style);for(var n=["_locked","_visible","_blendMode","_opacity","_clipMask","_guide"],i=0,r=n.length;i<r;i++){var o=n[i];t.hasOwnProperty(o)&&(this[o]=t[o])}e||this._matrix.set(t._matrix,!0),this.setApplyMatrix(t._applyMatrix),this.setPivot(t._pivot),this.setSelection(t._selection);var s=t._data,a=t._name;this._data=s?u.clone(s):null,a&&this.setName(a)},rasterize:function(t,e,n){var i=n||this.getStrokeBounds(),r=(t||this.getView().getResolution())/72,o=i.getTopLeft().floor(),s=i.getBottomRight().ceil(),l=new I(s.subtract(o)),c=new E(S.NO_INSERT);if(!l.isZero()){var h=lt.getCanvas(l.multiply(r)),d=h.getContext("2d"),p=(new C).scale(r).translate(o.negate());d.imageSmoothingEnabled=!1,d.save(),p.applyToContext(d),this.draw(d,new u({matrices:[p]})),d.restore(),c.setCanvas(h)}return c.transform((new C).translate(o.add(l.divide(2))).scale(1/r)),(e===a||e)&&c.insertAbove(this),c},contains:function(){var t=this._matrix;return t.isInvertible()&&!!this._contains(t._inverseTransform(v.read(arguments)))},_contains:function(t){var e=this._children;if(e){for(var n=e.length-1;n>=0;n--)if(e[n].contains(t))return!0;return!1}return t.isInside(this.getInternalBounds())},isInside:function(){return M.read(arguments).contains(this.getBounds())},_asPathItem:function(){return new U.Rectangle({rectangle:this.getInternalBounds(),matrix:this._matrix,insert:!1})},intersects:function(t,e){return t instanceof S&&this._asPathItem().getIntersections(t._asPathItem(),null,e,!0).length>0}},new function(){function t(){var t=arguments;return this._hitTest(v.read(t),O.getOptions(t))}function e(){var t=arguments,e=v.read(t),n=O.getOptions(t),i=[];return this._hitTest(e,new u({all:i},n)),i}function n(t,e,n,i){var r=this._children;if(r)for(var o=r.length-1;o>=0;o--){var s=r[o],a=s!==i&&s._hitTest(t,e,n);if(a&&!e.all)return a}return null}return x.inject({hitTest:t,hitTestAll:e,_hitTest:n}),{hitTest:t,hitTestAll:e,_hitTestChildren:n}},{_hitTest:function(t,e,n){if(this._locked||!this._visible||this._guide&&!e.guides||this.isEmpty())return null;var i=this._matrix,r=n?n.appended(i):this.getGlobalMatrix().prepend(this.getView()._matrix),o=Math.max(e.tolerance,1e-12),s=e._tolerancePadding=new I(U._getStrokePadding(o,i._shiftless().invert()));if(!(t=i._inverseTransform(t))||!this._children&&!this.getBounds({internal:!0,stroke:!0,handle:!0}).expand(s.multiply(2))._containsPoint(t))return null;var a,l,c=!(e.guides&&!this._guide||e.selected&&!this.isSelected()||e.type&&e.type!==u.hyphenate(this._class)||e.class&&!(this instanceof e.class)),h=e.match,d=this;function p(t){return t&&h&&!h(t)&&(t=null),t&&e.all&&e.all.push(t),t}function f(e,n){var i=n?a["get"+n]():d.getPosition();if(t.subtract(i).divide(s).length<=1)return new O(e,d,{name:n?u.hyphenate(n):e,point:i})}var g=e.position,m=e.center,y=e.bounds;if(c&&this._parent&&(g||m||y)){if((m||y)&&(a=this.getInternalBounds()),!(l=g&&f("position")||m&&f("center","Center"))&&y)for(var v=["TopLeft","TopRight","BottomLeft","BottomRight","LeftCenter","TopCenter","RightCenter","BottomCenter"],b=0;b<8&&!l;b++)l=f("bounds",v[b]);l=p(l)}return l||(l=this._hitTestChildren(t,e,r)||c&&p(this._hitTestSelf(t,e,r,this.getStrokeScaling()?null:r._shiftless().invert()))||null),l&&l.point&&(l.point=i.transform(l.point)),l},_hitTestSelf:function(t,e){if(e.fill&&this.hasFill()&&this._contains(t))return new O("fill",this)},matches:function(t,e){var n=typeof t;if("object"===n){for(var i in t)if(t.hasOwnProperty(i)&&!this.matches(i,t[i]))return!1;return!0}if("function"===n)return t(this);if("match"===t)return e(this);var r=/^(empty|editable)$/.test(t)?this["is"+u.capitalize(t)]():"type"===t?u.hyphenate(this._class):this[t];if("class"===t){if("function"==typeof e)return this instanceof e;r=this._class}if("function"==typeof e)return!!e(r);if(e){if(e.test)return e.test(r);if(u.isPlainObject(e))return function t(e,n){for(var i in e)if(e.hasOwnProperty(i)){var r=e[i],o=n[i];if(u.isPlainObject(r)&&u.isPlainObject(o)){if(!t(r,o))return!1}else if(!u.equals(r,o))return!1}return!0}(e,r)}return u.equals(r,e)},getItems:function(t){return S._getItems(this,t,this._matrix)},getItem:function(t){return S._getItems(this,t,this._matrix,null,!0)[0]||null},statics:{_getItems:function t(e,n,i,r,o){if(!r){var s="object"==typeof n&&n,a=s&&s.overlapping,l=s&&s.inside,c=(v=a||l)&&M.read([v]);r={items:[],recursive:s&&!1!==s.recursive,inside:!!l,overlapping:!!a,rect:c,path:a&&new U.Rectangle({rectangle:c,insert:!1})},s&&(n=u.filter({},n,{recursive:!0,inside:!0,overlapping:!0}))}var h=e._children,d=r.items;i=(c=r.rect)&&(i||new C);for(var p=0,f=h&&h.length;p<f;p++){var g=h[p],m=i&&i.appended(g._matrix),y=!0;if(c){var v=g.getBounds(m);if(!c.intersects(v))continue;c.contains(v)||r.overlapping&&(v.contains(c)||r.path.intersects(g,m))||(y=!1)}if(y&&g.matches(n)&&(d.push(g),o))break;if(!1!==r.recursive&&t(g,n,m,r,o),o&&d.length>0)break}return d}}},{importJSON:function(t){var e=u.importJSON(t,this);return e!==this?this.addChild(e):e},addChild:function(t){return this.insertChild(a,t)},insertChild:function(t,e){var n=e?this.insertChildren(t,[e]):null;return n&&n[0]},addChildren:function(t){return this.insertChildren(this._children.length,t)},insertChildren:function(t,e){var n=this._children;if(n&&e&&e.length>0){for(var i={},r=(e=u.slice(e)).length-1;r>=0;r--){var o=(c=e[r])&&c._id;!c||i[o]?e.splice(r,1):(c._remove(!1,!0),i[o]=!0)}u.splice(n,e,t,0);for(var s=this._project,a=s._changes,l=(r=0,e.length);r<l;r++){var c,h=(c=e[r])._name;c._parent=this,c._setProject(s,!0),h&&c.setName(h),a&&c._changed(5)}this._changed(11)}else e=null;return e},_insertItem:"#insertChild",_insertAt:function(t,e){var n=t&&t._getOwner(),i=t!==this&&n?this:null;return i&&(i._remove(!1,!0),n._insertItem(t._index+e,i)),i},insertAbove:function(t){return this._insertAt(t,1)},insertBelow:function(t){return this._insertAt(t,0)},sendToBack:function(){var t=this._getOwner();return t?t._insertItem(0,this):null},bringToFront:function(){var t=this._getOwner();return t?t._insertItem(a,this):null},appendTop:"#addChild",appendBottom:function(t){return this.insertChild(0,t)},moveAbove:"#insertAbove",moveBelow:"#insertBelow",addTo:function(t){return t._insertItem(a,this)},copyTo:function(t){return this.clone(!1).addTo(t)},reduce:function(t){var e=this._children;if(e&&1===e.length){var n=e[0].reduce(t);return this._parent?(n.insertAbove(this),this.remove()):n.remove(),n}return this},_removeNamed:function(){var t=this._getOwner();if(t){var e=t._children,n=t._namedChildren,i=this._name,r=n[i],o=r?r.indexOf(this):-1;-1!==o&&(e[i]==this&&delete e[i],r.splice(o,1),r.length?e[i]=r[0]:delete n[i])}},_remove:function(t,e){var n=this._getOwner(),i=this._project,r=this._index;return this._style&&this._style._dispose(),!!n&&(this._name&&this._removeNamed(),null!=r&&(i._activeLayer===this&&(i._activeLayer=this.getNextSibling()||this.getPreviousSibling()),u.splice(n._children,null,r,1)),this._installEvents(!1),t&&i._changes&&this._changed(5),e&&n._changed(11,this),this._parent=null,!0)},remove:function(){return this._remove(!0,!0)},replaceWith:function(t){var e=t&&t.insertBelow(this);return e&&this.remove(),e},removeChildren:function(t,e){if(!this._children)return null;t=t||0,e=u.pick(e,this._children.length);for(var n=u.splice(this._children,null,t,e-t),i=n.length-1;i>=0;i--)n[i]._remove(!0,!1);return n.length>0&&this._changed(11),n},clear:"#removeChildren",reverseChildren:function(){if(this._children){this._children.reverse();for(var t=0,e=this._children.length;t<e;t++)this._children[t]._index=t;this._changed(11)}},isEmpty:function(t){var e=this._children,n=e?e.length:0;if(t){for(var i=0;i<n;i++)if(!e[i].isEmpty(t))return!1;return!0}return!n},isEditable:function(){for(var t=this;t;){if(!t._visible||t._locked)return!1;t=t._parent}return!0},hasFill:function(){return this.getStyle().hasFill()},hasStroke:function(){return this.getStyle().hasStroke()},hasShadow:function(){return this.getStyle().hasShadow()},_getOrder:function(t){function e(t){var e=[];do{e.unshift(t)}while(t=t._parent);return e}for(var n=e(this),i=e(t),r=0,o=Math.min(n.length,i.length);r<o;r++)if(n[r]!=i[r])return n[r]._index<i[r]._index?1:-1;return 0},hasChildren:function(){return this._children&&this._children.length>0},isInserted:function(){return!!this._parent&&this._parent.isInserted()},isAbove:function(t){return-1===this._getOrder(t)},isBelow:function(t){return 1===this._getOrder(t)},isParent:function(t){return this._parent===t},isChild:function(t){return t&&t._parent===this},isDescendant:function(t){for(var e=this;e=e._parent;)if(e===t)return!0;return!1},isAncestor:function(t){return!!t&&t.isDescendant(this)},isSibling:function(t){return this._parent===t._parent},isGroupedWith:function(t){for(var e=this._parent;e;){if(e._parent&&/^(Group|Layer|CompoundPath)$/.test(e._class)&&t.isDescendant(e))return!0;e=e._parent}return!1}},u.each(["rotate","scale","shear","skew"],function(t){var e="rotate"===t;this[t]=function(){var n=arguments,i=(e?u:v).read(n),r=v.read(n,0,{readNull:!0});return this.transform((new C)[t](i,r||this.getPosition(!0)))}},{translate:function(){var t=new C;return this.transform(t.translate.apply(t,arguments))},transform:function(t,e,n){var i=this._matrix,r=t&&!t.isIdentity(),o=n&&this._canApplyMatrix||this._applyMatrix&&(r||!i.isIdentity()||e&&this._children);if(!r&&!o)return this;if(r){!t.isInvertible()&&i.isInvertible()&&(i._backup=i.getValues()),i.prepend(t,!0);var s=this._style,a=s.getFillColor(!0),l=s.getStrokeColor(!0);a&&a.transform(t),l&&l.transform(t)}if(o&&(o=this._transformContent(i,e,n))){var c=this._pivot;c&&i._transformPoint(c,c,!0),i.reset(!0),n&&this._canApplyMatrix&&(this._applyMatrix=!0)}var u=this._bounds,h=this._position;(r||o)&&this._changed(25);var d=r&&u&&t.decompose();if(d&&d.skewing.isZero()&&d.rotation%90==0){for(var p in u){var f=u[p];if(f.nonscaling)delete u[p];else if(o||!f.internal){var g=f.rect;t._transformBounds(g,g)}}this._bounds=u;var m=u[this._getBoundsCacheKey(this._boundsOptions||{})];m&&(this._position=this._getPositionFromBounds(m.rect))}else r&&h&&this._pivot&&(this._position=t._transformPoint(h,h));return this},_transformContent:function(t,e,n){var i=this._children;if(i){for(var r=0,o=i.length;r<o;r++)i[r].transform(t,e,n);return!0}},globalToLocal:function(){return this.getGlobalMatrix(!0)._inverseTransform(v.read(arguments))},localToGlobal:function(){return this.getGlobalMatrix(!0)._transformPoint(v.read(arguments))},parentToLocal:function(){return this._matrix._inverseTransform(v.read(arguments))},localToParent:function(){return this._matrix._transformPoint(v.read(arguments))},fitBounds:function(t,e){t=M.read(arguments);var n=this.getBounds(),i=n.height/n.width,r=t.height/t.width,o=(e?i>r:i<r)?t.width/n.width:t.height/n.height,s=new M(new v,new I(n.width*o,n.height*o));s.setCenter(t.getCenter()),this.setBounds(s)}}),{_setStyles:function(t,e,n,i){var r=this._style,o=this._matrix;if(r.hasFill()&&(t.fillStyle=r.getFillColor().toCanvasStyle(t,o,i)),r.hasStroke()){t.strokeStyle=r.getStrokeColor().toCanvasStyle(t,o,i),t.lineWidth=r.getStrokeWidth();var s=r.getStrokeJoin(),a=r.getStrokeCap(),l=r.getMiterLimit();if(s&&(t.lineJoin=s),a&&(t.lineCap=a),l&&(t.miterLimit=l),dt.support.nativeDash){var c=r.getDashArray(),u=r.getDashOffset();c&&c.length&&("setLineDash"in t?(t.setLineDash(c),t.lineDashOffset=u):(t.mozDash=c,t.mozDashOffset=u))}}if(r.hasShadow()){var h=e.pixelRatio||1,d=n._shiftless().prepend((new C).scale(h,h)),p=d.transform(new v(r.getShadowBlur(),0)),f=d.transform(this.getShadowOffset());t.shadowColor=r.getShadowColor().toCanvasStyle(t),t.shadowBlur=p.getLength(),t.shadowOffsetX=f.x,t.shadowOffsetY=f.y}},draw:function(t,e,n){this._updateVersion=this._project._updateVersion;if(this._visible&&0!==this._opacity){var i=e.matrices,r=e.viewMatrix,o=this._matrix,s=i[i.length-1].appended(o);if(s.isInvertible()){r=r?r.appended(s):s,i.push(s),e.updateMatrix&&(this._globalMatrix=s);var a,l,c,u=this._blendMode,h=m.clamp(this._opacity,0,1),d="normal"===u,p=ct.nativeModes[u],f=d&&1===h||e.dontStart||e.clip||(p||d&&h<1)&&this._canComposite(),g=e.pixelRatio||1;if(!f){var y=this.getStrokeBounds(r);if(!y.width||!y.height)return void i.pop();c=e.offset,l=e.offset=y.getTopLeft().floor(),a=t,t=lt.getContext(y.getSize().ceil().add(1).multiply(g)),1!==g&&t.scale(g,g)}t.save();var v=n?n.appended(o):this._canScaleStroke&&!this.getStrokeScaling(!0)&&r,b=!f&&e.clipItem,I=!v||b;if(f?(t.globalAlpha=h,p&&(t.globalCompositeOperation=u)):I&&t.translate(-l.x,-l.y),I&&(f?o:r).applyToContext(t),b&&e.clipItem.draw(t,e.extend({clip:!0})),v){t.setTransform(g,0,0,g,0,0);var A=e.offset;A&&t.translate(-A.x,-A.y)}this._draw(t,e,r,v),t.restore(),i.pop(),e.clip&&!e.dontFinish&&t.clip(this.getFillRule()),f||(ct.process(u,t,a,h,l.subtract(c).multiply(g)),lt.release(t),e.offset=c)}}},_isUpdated:function(t){var e=this._parent;if(e instanceof G)return e._isUpdated(t);var n=this._updateVersion===t;return!n&&e&&e._visible&&e._isUpdated(t)&&(this._updateVersion=t,n=!0),n},_drawSelection:function(t,e,n,i,r){var o=this._selection,s=1&o,a=2&o||s&&this._selectBounds,l=4&o;if(this._drawSelected||(s=!1),(s||a||l)&&this._isUpdated(r)){var c,u=this.getSelectedColor(!0)||(c=this.getLayer())&&c.getSelectedColor(!0),h=e.appended(this.getGlobalMatrix(!0)),d=n/2;if(t.strokeStyle=t.fillStyle=u?u.toCanvasStyle(t):"#009dec",t.lineWidth=2.5,s&&this._drawSelected(t,h,i),l){var p=this.getPosition(!0),f=this._parent,g=f?f.localToGlobal(p):p,m=g.x,y=g.y;t.beginPath(),t.arc(m,y,d,0,2*Math.PI,!0),t.stroke();for(var v=[[0,-1],[1,0],[0,1],[-1,0]],b=d,I=n+1,A=0;A<4;A++){var M=v[A],w=M[0],C=M[1];t.moveTo(m+w*b,y+C*b),t.lineTo(m+w*I,y+C*I),t.stroke()}}if(a){var T=h._transformCorners(this.getInternalBounds());t.beginPath();for(A=0;A<8;A++)t[A?"lineTo":"moveTo"](T[A],T[++A]);t.closePath(),t.stroke();for(A=0;A<8;A++)t.fillRect(T[A]-d,T[++A]-d,n,n)}}},_canComposite:function(){return!1}},u.each(["down","drag","up","move"],function(t){this["removeOn"+u.capitalize(t)]=function(){var e={};return e[t]=!0,this.removeOn(e)}},{removeOn:function(t){for(var e in t)if(t[e]){var n="mouse"+e,i=this._project,r=i._removeSets=i._removeSets||{};r[n]=r[n]||{},r[n][this._id]=this}return this}}),{tween:function(t,e,n){n||(n=e,e=t,t=null,n||(n=e,e=null));var i=n&&n.easing,r=n&&n.start,o=null!=n&&("number"==typeof n?n:n.duration),s=new st(this,t,e,o,i,r);return o&&this.on("frame",function t(e){s._handleFrame(1e3*e.time),s.running||this.off("frame",t)}),s},tweenTo:function(t,e){return this.tween(null,t,e)},tweenFrom:function(t,e){return this.tween(t,null,e)}}),D=S.extend({_class:"Group",_selectBounds:!1,_selectChildren:!0,_serializeFields:{children:[]},initialize:function(t){this._children=[],this._namedChildren={},this._initialize(t)||this.addChildren(Array.isArray(t)?t:arguments)},_changed:function t(e){t.base.call(this,e),2050&e&&(this._clipItem=a)},_getClipItem:function(){var t=this._clipItem;if(t===a){t=null;for(var e=this._children,n=0,i=e.length;n<i;n++)if(e[n]._clipMask){t=e[n];break}this._clipItem=t}return t},isClipped:function(){return!!this._getClipItem()},setClipped:function(t){var e=this.getFirstChild();e&&e.setClipMask(t)},_getBounds:function t(e,n){var i=this._getClipItem();return i?i._getCachedBounds(i._matrix.prepended(e),u.set({},n,{stroke:!1})):t.base.call(this,e,n)},_hitTestChildren:function t(e,n,i){var r=this._getClipItem();return(!r||r.contains(e))&&t.base.call(this,e,n,i,r)},_draw:function(t,e){var n=e.clip,i=!n&&this._getClipItem();e=e.extend({clipItem:i,clip:!1}),n?(t.beginPath(),e.dontStart=e.dontFinish=!0):i&&i.draw(t,e.extend({clip:!0}));for(var r=this._children,o=0,s=r.length;o<s;o++){var a=r[o];a!==i&&a.draw(t,e)}}}),N=D.extend({_class:"Layer",initialize:function(){D.apply(this,arguments)},_getOwner:function(){return this._parent||null!=this._index&&this._project},isInserted:function t(){return this._parent?t.base.call(this):null!=this._index},activate:function(){this._project._activeLayer=this},_hitTestSelf:function(){}}),_=S.extend({_class:"Shape",_applyMatrix:!1,_canApplyMatrix:!1,_canScaleStroke:!0,_serializeFields:{type:null,size:null,radius:null},initialize:function(t,e){this._initialize(t,e)},_equals:function(t){return this._type===t._type&&this._size.equals(t._size)&&u.equals(this._radius,t._radius)},copyContent:function(t){this.setType(t._type),this.setSize(t._size),this.setRadius(t._radius)},getType:function(){return this._type},setType:function(t){this._type=t},getShape:"#getType",setShape:"#setType",getSize:function(){var t=this._size;return new A(t.width,t.height,this,"setSize")},setSize:function(){var t=I.read(arguments);if(this._size){if(!this._size.equals(t)){var e=this._type,n=t.width,i=t.height;"rectangle"===e?this._radius.set(I.min(this._radius,t.divide(2).abs())):"circle"===e?(n=i=(n+i)/2,this._radius=n/2):"ellipse"===e&&this._radius._set(n/2,i/2),this._size._set(n,i),this._changed(9)}}else this._size=t.clone()},getRadius:function(){var t=this._radius;return"circle"===this._type?t:new A(t.width,t.height,this,"setRadius")},setRadius:function(t){var e=this._type;if("circle"===e){if(t===this._radius)return;var n=2*t;this._radius=t,this._size._set(n,n)}else if(t=I.read(arguments),this._radius){if(this._radius.equals(t))return;if(this._radius.set(t),"rectangle"===e){n=I.max(this._size,t.multiply(2));this._size.set(n)}else"ellipse"===e&&this._size._set(2*t.width,2*t.height)}else this._radius=t.clone();this._changed(9)},isEmpty:function(){return!1},toPath:function(t){var e=new(U[u.capitalize(this._type)])({center:new v,size:this._size,radius:this._radius,insert:!1});return e.copyAttributes(this),dt.settings.applyMatrix&&e.setApplyMatrix(!0),(t===a||t)&&e.insertAbove(this),e},toShape:"#clone",_asPathItem:function(){return this.toPath(!1)},_draw:function(t,e,n,i){var r=this._style,o=r.hasFill(),s=r.hasStroke(),a=e.dontFinish||e.clip,l=!i;if(o||s||a){var c=this._type,u=this._radius,h="circle"===c;if(e.dontStart||t.beginPath(),l&&h)t.arc(0,0,u,0,2*Math.PI,!0);else{var d=h?u:u.width,p=h?u:u.height,f=this._size,g=f.width,m=f.height;if(l&&"rectangle"===c&&0===d&&0===p)t.rect(-g/2,-m/2,g,m);else{var y=g/2,v=m/2,b=.44771525016920644,I=d*b,A=p*b,M=[-y,-v+p,-y,-v+A,-y+I,-v,-y+d,-v,y-d,-v,y-I,-v,y,-v+A,y,-v+p,y,v-p,y,v-A,y-I,v,y-d,v,-y+d,v,-y+I,v,-y,v-A,-y,v-p];i&&i.transform(M,M,32),t.moveTo(M[0],M[1]),t.bezierCurveTo(M[2],M[3],M[4],M[5],M[6],M[7]),y!==d&&t.lineTo(M[8],M[9]),t.bezierCurveTo(M[10],M[11],M[12],M[13],M[14],M[15]),v!==p&&t.lineTo(M[16],M[17]),t.bezierCurveTo(M[18],M[19],M[20],M[21],M[22],M[23]),y!==d&&t.lineTo(M[24],M[25]),t.bezierCurveTo(M[26],M[27],M[28],M[29],M[30],M[31])}}t.closePath()}a||!o&&!s||(this._setStyles(t,e,n,i),o&&(t.fill(r.getFillRule()),t.shadowColor="rgba(0,0,0,0)"),s&&t.stroke())},_canComposite:function(){return!(this.hasFill()&&this.hasStroke())},_getBounds:function(t,e){var n=new M(this._size).setCenter(0,0),i=this._style,r=e.stroke&&i.hasStroke()&&i.getStrokeWidth();return t&&(n=t._transformBounds(n)),r?n.expand(U._getStrokePadding(r,this._getStrokeMatrix(t,e))):n}},new function(){function t(t,e,n){var i=t._radius;if(!i.isZero())for(var r=t._size.divide(2),o=1;o<=4;o++){var s=new v(o>1&&o<4?-1:1,o>2?-1:1),a=s.multiply(r),l=a.subtract(s.multiply(i));if(new M(n?a.add(s.multiply(n)):a,l).contains(e))return{point:l,quadrant:o}}}function e(t,e,n,i){var r=t.divide(e);return(!i||r.isInQuadrant(i))&&r.subtract(r.normalize()).multiply(e).divide(n).length<=1}return{_contains:function e(n){if("rectangle"===this._type){var i=t(this,n);return i?n.subtract(i.point).divide(this._radius).getLength()<=1:e.base.call(this,n)}return n.divide(this.size).getLength()<=.5},_hitTestSelf:function n(i,r,o,s){var a=!1,l=this._style,c=r.stroke&&l.hasStroke(),u=r.fill&&l.hasFill();if(c||u){var h=this._type,d=this._radius,p=c?l.getStrokeWidth()/2:0,f=r._tolerancePadding.add(U._getStrokePadding(p,!l.getStrokeScaling()&&s));if("rectangle"===h){var g=f.multiply(2),m=t(this,i,g);if(m)a=e(i.subtract(m.point),d,f,m.quadrant);else{var y=new M(this._size).setCenter(0,0),v=y.expand(g),b=y.expand(g.negate());a=v._containsPoint(i)&&!b._containsPoint(i)}}else a=e(i,d,f)}return a?new O(c?"stroke":"fill",this):n.base.apply(this,arguments)}}},{statics:new function(){function t(t,e,n,i,r){var o=u.create(_.prototype);return o._type=t,o._size=n,o._radius=i,o._initialize(u.getNamed(r),e),o}return{Circle:function(){var e=arguments,n=v.readNamed(e,"center"),i=u.readNamed(e,"radius");return t("circle",n,new I(2*i),i,e)},Rectangle:function(){var e=arguments,n=M.readNamed(e,"rectangle"),i=I.min(I.readNamed(e,"radius"),n.getSize(!0).divide(2));return t("rectangle",n.getCenter(!0),n.getSize(!0),i,e)},Ellipse:function(){var e=arguments,n=_._readEllipse(e),i=n.radius;return t("ellipse",n.center,i.multiply(2),i,e)},_readEllipse:function(t){var e,n;if(u.hasNamed(t,"radius"))e=v.readNamed(t,"center"),n=I.readNamed(t,"radius");else{var i=M.readNamed(t,"rectangle");e=i.getCenter(!0),n=i.getSize(!0).divide(2)}return{center:e,radius:n}}}}}),E=S.extend({_class:"Raster",_applyMatrix:!1,_canApplyMatrix:!1,_boundsOptions:{stroke:!1,handle:!1},_serializeFields:{crossOrigin:null,source:null},_prioritize:["crossOrigin"],_smoothing:!1,beans:!0,initialize:function(t,e){if(!this._initialize(t,e!==a&&v.read(arguments))){var n,i=typeof t,r="string"===i?c.getElementById(t):"object"===i?t:null;if(r&&r!==S.NO_INSERT)if(r.getContext||null!=r.naturalHeight)n=r;else if(r){var o=I.read(arguments);o.isZero()||(n=lt.getCanvas(o))}n?this.setImage(n):this.setSource(t)}this._size||(this._size=new I,this._loaded=!1)},_equals:function(t){return this.getSource()===t.getSource()},copyContent:function(t){var e=t._image,n=t._canvas;if(e)this._setImage(e);else if(n){var i=lt.getCanvas(t._size);i.getContext("2d").drawImage(n,0,0),this._setImage(i)}this._crossOrigin=t._crossOrigin},getSize:function(){var t=this._size;return new A(t?t.width:0,t?t.height:0,this,"setSize")},setSize:function(){var t=I.read(arguments);if(!t.equals(this._size))if(t.width>0&&t.height>0){var e=this.getElement();this._setImage(lt.getCanvas(t)),e&&this.getContext(!0).drawImage(e,0,0,t.width,t.height)}else this._canvas&&lt.release(this._canvas),this._size=t.clone()},getWidth:function(){return this._size?this._size.width:0},setWidth:function(t){this.setSize(t,this.getHeight())},getHeight:function(){return this._size?this._size.height:0},setHeight:function(t){this.setSize(this.getWidth(),t)},getLoaded:function(){return this._loaded},isEmpty:function(){var t=this._size;return!t||0===t.width&&0===t.height},getResolution:function(){var t=this._matrix,e=new v(0,0).transform(t),n=new v(1,0).transform(t).subtract(e),i=new v(0,1).transform(t).subtract(e);return new I(72/n.getLength(),72/i.getLength())},getPpi:"#getResolution",getImage:function(){return this._image},setImage:function(t){var e=this;function n(t){var n=e.getView(),i=t&&t.type||"load";n&&e.responds(i)&&(dt=n._scope,e.emit(i,new tt(t)))}this._setImage(t),this._loaded?setTimeout(n,0):t&&X.add(t,{load:function(i){e._setImage(t),n(i)},error:n})},_setImage:function(t){this._canvas&&lt.release(this._canvas),t&&t.getContext?(this._image=null,this._canvas=t,this._loaded=!0):(this._image=t,this._canvas=null,this._loaded=!!(t&&t.src&&t.complete)),this._size=new I(t?t.naturalWidth||t.width:0,t?t.naturalHeight||t.height:0),this._context=null,this._changed(1033)},getCanvas:function(){if(!this._canvas){var t=lt.getContext(this._size);try{this._image&&t.drawImage(this._image,0,0),this._canvas=t.canvas}catch(e){lt.release(t)}}return this._canvas},setCanvas:"#setImage",getContext:function(t){return this._context||(this._context=this.getCanvas().getContext("2d")),t&&(this._image=null,this._changed(1025)),this._context},setContext:function(t){this._context=t},getSource:function(){var t=this._image;return t&&t.src||this.toDataURL()},setSource:function(t){var e=new s.Image,n=this._crossOrigin;n&&(e.crossOrigin=n),t&&(e.src=t),this.setImage(e)},getCrossOrigin:function(){var t=this._image;return t&&t.crossOrigin||this._crossOrigin||""},setCrossOrigin:function(t){this._crossOrigin=t;var e=this._image;e&&(e.crossOrigin=t)},getSmoothing:function(){return this._smoothing},setSmoothing:function(t){this._smoothing=t,this._changed(257)},getElement:function(){return this._canvas||this._loaded&&this._image}},{beans:!1,getSubCanvas:function(){var t=M.read(arguments),e=lt.getContext(t.getSize()),n=Math.max(0,t.x),i=Math.max(0,t.y),r=Math.min(this.getCanvas().width,t.x+t.width),o=Math.min(this.getCanvas().height,t.y+t.height);return e.drawImage(this.getCanvas(),n,i,r-n,o-i,n-t.x,i-t.y,r-n,o-i),e.canvas},getSubRaster:function(){var t=M.read(arguments),e=new E(S.NO_INSERT);return e._setImage(this.getSubCanvas(t)),e.translate(t.getCenter().subtract(this.getSize().divide(2))),e._matrix.prepend(this._matrix),e.insertAbove(this),e},toDataURL:function(){var t=this._image,e=t&&t.src;if(/^data:/.test(e))return e;var n=this.getCanvas();return n?n.toDataURL.apply(n,arguments):null},drawImage:function(t){var e=v.read(arguments,1);this.getContext(!0).drawImage(t,e.x,e.y)},getAverageColor:function(t){var e,n;if(t?t instanceof R?(n=t,e=t.getBounds()):"object"==typeof t&&("width"in t?e=new M(t):"x"in t&&(e=new M(t.x-.5,t.y-.5,1,1))):e=this.getBounds(),!e)return null;var i=Math.min(e.width,32),r=Math.min(e.height,32),o=E._sampleContext;o?o.clearRect(0,0,33,33):o=E._sampleContext=lt.getContext(new I(32)),o.save();var s=(new C).scale(i/e.width,r/e.height).translate(-e.x,-e.y);s.applyToContext(o),n&&n.draw(o,new u({clip:!0,matrices:[s]})),this._matrix.applyToContext(o);var a=this.getElement(),l=this._size;a&&o.drawImage(a,-l.width/2,-l.height/2),o.restore();for(var c=o.getImageData(.5,.5,Math.ceil(i),Math.ceil(r)).data,h=[0,0,0],d=0,p=0,f=c.length;p<f;p+=4){var g=c[p+3];d+=g,g/=255,h[0]+=c[p]*g,h[1]+=c[p+1]*g,h[2]+=c[p+2]*g}for(p=0;p<3;p++)h[p]/=d;return d?H.read(h):null},getPixel:function(){var t=v.read(arguments),e=this.getContext().getImageData(t.x,t.y,1,1).data;return new H("rgb",[e[0]/255,e[1]/255,e[2]/255],e[3]/255)},setPixel:function(){var t=arguments,e=v.read(t),n=H.read(t),i=n._convert("rgb"),r=n._alpha,o=this.getContext(!0),s=o.createImageData(1,1),a=s.data;a[0]=255*i[0],a[1]=255*i[1],a[2]=255*i[2],a[3]=null!=r?255*r:255,o.putImageData(s,e.x,e.y)},clear:function(){var t=this._size;this.getContext(!0).clearRect(0,0,t.width+1,t.height+1)},createImageData:function(){var t=I.read(arguments);return this.getContext().createImageData(t.width,t.height)},getImageData:function(){var t=M.read(arguments);return t.isEmpty()&&(t=new M(this._size)),this.getContext().getImageData(t.x,t.y,t.width,t.height)},setImageData:function(t){var e=v.read(arguments,1);this.getContext(!0).putImageData(t,e.x,e.y)},_getBounds:function(t,e){var n=new M(this._size).setCenter(0,0);return t?t._transformBounds(n):n},_hitTestSelf:function(t){if(this._contains(t)){var e=this;return new O("pixel",e,{offset:t.add(e._size.divide(2)).round(),color:{get:function(){return e.getPixel(this.offset)}}})}},_draw:function(t,e,n){var i=this.getElement();i&&i.width>0&&i.height>0&&(t.globalAlpha=m.clamp(this._opacity,0,1),this._setStyles(t,e,n),J.setPrefixed(t,"imageSmoothingEnabled",this._smoothing),t.drawImage(i,-this._size.width/2,-this._size.height/2))},_canComposite:function(){return!0}}),j=S.extend({_class:"SymbolItem",_applyMatrix:!1,_canApplyMatrix:!1,_boundsOptions:{stroke:!0},_serializeFields:{symbol:null},initialize:function(t,e){this._initialize(t,e!==a&&v.read(arguments,1))||this.setDefinition(t instanceof k?t:new k(t))},_equals:function(t){return this._definition===t._definition},copyContent:function(t){this.setDefinition(t._definition)},getDefinition:function(){return this._definition},setDefinition:function(t){this._definition=t,this._changed(9)},getSymbol:"#getDefinition",setSymbol:"#setDefinition",isEmpty:function(){return this._definition._item.isEmpty()},_getBounds:function(t,e){var n=this._definition._item;return n._getCachedBounds(n._matrix.prepended(t),e)},_hitTestSelf:function(t,e,n){var i=e.extend({all:!1}),r=this._definition._item._hitTest(t,i,n);return r&&(r.item=this),r},_draw:function(t,e){this._definition._item.draw(t,e)}}),k=u.extend({_class:"SymbolDefinition",initialize:function(t,e){this._id=y.get(),this.project=dt.project,t&&this.setItem(t,e)},_serialize:function(t,e){return e.add(this,function(){return u.serialize([this._class,this._item],t,!1,e)})},_changed:function(t){8&t&&S._clearBoundsCache(this),1&t&&this.project._changed(t)},getItem:function(){return this._item},setItem:function(t,e){t._symbol&&(t=t.clone()),this._item&&(this._item._symbol=null),this._item=t,t.remove(),t.setSelected(!1),e||t.setPosition(new v),t._symbol=this,this._changed(9)},getDefinition:"#getItem",setDefinition:"#setItem",place:function(t){return new j(this,t)},clone:function(){return new k(this._item.clone(!1))},equals:function(t){return t===this||t&&this._item.equals(t._item)||!1}}),O=u.extend({_class:"HitResult",initialize:function(t,e,n){this.type=t,this.item=e,n&&this.inject(n)},statics:{getOptions:function(t){var e=t&&u.read(t);return new u({type:null,tolerance:dt.settings.hitTolerance,fill:!e,stroke:!e,segments:!e,handles:!1,ends:!1,position:!1,center:!1,bounds:!1,guides:!1,selected:!1},e)}}}),z=u.extend({_class:"Segment",beans:!0,_selection:0,initialize:function(t,e,n,i,r,o){var s,l,c,u,h=arguments.length;h>0&&(null==t||"object"==typeof t?1===h&&t&&"point"in t?(s=t.point,l=t.handleIn,c=t.handleOut,u=t.selection):(s=t,l=e,c=n,u=i):(s=[t,e],l=n!==a?[n,i]:null,c=r!==a?[r,o]:null)),new L(s,this,"_point"),new L(l,this,"_handleIn"),new L(c,this,"_handleOut"),u&&this.setSelection(u)},_serialize:function(t,e){var n=this._point,i=this._selection,r=i||this.hasHandles()?[n,this._handleIn,this._handleOut]:n;return i&&r.push(i),u.serialize(r,t,!0,e)},_changed:function(t){var e=this._path;if(e){var n,i=e._curves,r=this._index;i&&(t&&t!==this._point&&t!==this._handleIn||!(n=r>0?i[r-1]:e._closed?i[i.length-1]:null)||n._changed(),t&&t!==this._point&&t!==this._handleOut||!(n=i[r])||n._changed()),e._changed(41)}},getPoint:function(){return this._point},setPoint:function(){this._point.set(v.read(arguments))},getHandleIn:function(){return this._handleIn},setHandleIn:function(){this._handleIn.set(v.read(arguments))},getHandleOut:function(){return this._handleOut},setHandleOut:function(){this._handleOut.set(v.read(arguments))},hasHandles:function(){return!this._handleIn.isZero()||!this._handleOut.isZero()},isSmooth:function(){var t=this._handleIn,e=this._handleOut;return!t.isZero()&&!e.isZero()&&t.isCollinear(e)},clearHandles:function(){this._handleIn._set(0,0),this._handleOut._set(0,0)},getSelection:function(){return this._selection},setSelection:function(t){var e=this._selection,n=this._path;this._selection=t=t||0,n&&t!==e&&(n._updateSelection(this,e,t),n._changed(257))},_changeSelection:function(t,e){var n=this._selection;this.setSelection(e?n|t:n&~t)},isSelected:function(){return!!(7&this._selection)},setSelected:function(t){this._changeSelection(7,t)},getIndex:function(){return this._index!==a?this._index:null},getPath:function(){return this._path||null},getCurve:function(){var t=this._path,e=this._index;return t?(e>0&&!t._closed&&e===t._segments.length-1&&e--,t.getCurves()[e]||null):null},getLocation:function(){var t=this.getCurve();return t?new P(t,this===t._segment1?0:1):null},getNext:function(){var t=this._path&&this._path._segments;return t&&(t[this._index+1]||this._path._closed&&t[0])||null},smooth:function(t,e,n){var i=t||{},r=i.type,o=i.factor,s=this.getPrevious(),l=this.getNext(),c=(s||this)._point,u=this._point,h=(l||this)._point,d=c.getDistance(u),p=u.getDistance(h);if(r&&"catmull-rom"!==r){if("geometric"!==r)throw new Error("Smoothing method '"+r+"' not supported.");if(s&&l){var f=c.subtract(h),g=o===a?.4:o,m=g*d/(d+p);e||this.setHandleIn(f.multiply(m)),n||this.setHandleOut(f.multiply(m-g))}}else{var y=o===a?.5:o,b=Math.pow(d,y),I=b*b,A=Math.pow(p,y),M=A*A;if(!e&&s){var w=2*M+3*A*b+I,C=3*A*(A+b);this.setHandleIn(0!==C?new v((M*c._x+w*u._x-I*h._x)/C-u._x,(M*c._y+w*u._y-I*h._y)/C-u._y):new v)}if(!n&&l){w=2*I+3*b*A+M,C=3*b*(b+A);this.setHandleOut(0!==C?new v((I*h._x+w*u._x-M*c._x)/C-u._x,(I*h._y+w*u._y-M*c._y)/C-u._y):new v)}}},getPrevious:function(){var t=this._path&&this._path._segments;return t&&(t[this._index-1]||this._path._closed&&t[t.length-1])||null},isFirst:function(){return!this._index},isLast:function(){var t=this._path;return t&&this._index===t._segments.length-1||!1},reverse:function(){var t=this._handleIn,e=this._handleOut,n=t.clone();t.set(e),e.set(n)},reversed:function(){return new z(this._point,this._handleOut,this._handleIn)},remove:function(){return!!this._path&&!!this._path.removeSegment(this._index)},clone:function(){return new z(this._point,this._handleIn,this._handleOut)},equals:function(t){return t===this||t&&this._class===t._class&&this._point.equals(t._point)&&this._handleIn.equals(t._handleIn)&&this._handleOut.equals(t._handleOut)||!1},toString:function(){var t=["point: "+this._point];return this._handleIn.isZero()||t.push("handleIn: "+this._handleIn),this._handleOut.isZero()||t.push("handleOut: "+this._handleOut),"{ "+t.join(", ")+" }"},transform:function(t){this._transformCoordinates(t,new Array(6),!0),this._changed()},interpolate:function(t,e,n){var i=1-n,r=n,o=t._point,s=e._point,a=t._handleIn,l=e._handleIn,c=e._handleOut,u=t._handleOut;this._point._set(i*o._x+r*s._x,i*o._y+r*s._y,!0),this._handleIn._set(i*a._x+r*l._x,i*a._y+r*l._y,!0),this._handleOut._set(i*u._x+r*c._x,i*u._y+r*c._y,!0),this._changed()},_transformCoordinates:function(t,e,n){var i=this._point,r=n&&this._handleIn.isZero()?null:this._handleIn,o=n&&this._handleOut.isZero()?null:this._handleOut,s=i._x,a=i._y,l=2;return e[0]=s,e[1]=a,r&&(e[l++]=r._x+s,e[l++]=r._y+a),o&&(e[l++]=o._x+s,e[l++]=o._y+a),t&&(t._transformCoordinates(e,e,l/2),s=e[0],a=e[1],n?(i._x=s,i._y=a,l=2,r&&(r._x=e[l++]-s,r._y=e[l++]-a),o&&(o._x=e[l++]-s,o._y=e[l++]-a)):(r||(e[l++]=s,e[l++]=a),o||(e[l++]=s,e[l++]=a))),e}}),L=v.extend({initialize:function(t,e,n){var i,r,o;if(t)if((i=t[0])!==a)r=t[1];else{var s=t;(i=s.x)===a&&(i=(s=v.read(arguments)).x),r=s.y,o=s.selected}else i=r=0;this._x=i,this._y=r,this._owner=e,e[n]=this,o&&this.setSelected(!0)},_set:function(t,e){return this._x=t,this._y=e,this._owner._changed(this),this},getX:function(){return this._x},setX:function(t){this._x=t,this._owner._changed(this)},getY:function(){return this._y},setY:function(t){this._y=t,this._owner._changed(this)},isZero:function(){var t=m.isZero;return t(this._x)&&t(this._y)},isSelected:function(){return!!(this._owner._selection&this._getSelection())},setSelected:function(t){this._owner._changeSelection(this._getSelection(),t)},_getSelection:function(){var t=this._owner;return this===t._point?1:this===t._handleIn?2:this===t._handleOut?4:0}}),B=u.extend({_class:"Curve",beans:!0,initialize:function(t,e,n,i,r,o,s,a){var l,c,u,h,d,p,f=arguments.length;3===f?(this._path=t,l=e,c=n):f?1===f?"segment1"in t?(l=new z(t.segment1),c=new z(t.segment2)):"point1"in t?(u=t.point1,d=t.handle1,p=t.handle2,h=t.point2):Array.isArray(t)&&(u=[t[0],t[1]],h=[t[6],t[7]],d=[t[2]-t[0],t[3]-t[1]],p=[t[4]-t[6],t[5]-t[7]]):2===f?(l=new z(t),c=new z(e)):4===f?(u=t,d=e,p=n,h=i):8===f&&(u=[t,e],h=[s,a],d=[n-t,i-e],p=[r-s,o-a]):(l=new z,c=new z),this._segment1=l||new z(u,null,d),this._segment2=c||new z(h,p,null)},_serialize:function(t,e){return u.serialize(this.hasHandles()?[this.getPoint1(),this.getHandle1(),this.getHandle2(),this.getPoint2()]:[this.getPoint1(),this.getPoint2()],t,!0,e)},_changed:function(){this._length=this._bounds=a},clone:function(){return new B(this._segment1,this._segment2)},toString:function(){var t=["point1: "+this._segment1._point];return this._segment1._handleOut.isZero()||t.push("handle1: "+this._segment1._handleOut),this._segment2._handleIn.isZero()||t.push("handle2: "+this._segment2._handleIn),t.push("point2: "+this._segment2._point),"{ "+t.join(", ")+" }"},classify:function(){return B.classify(this.getValues())},remove:function(){var t=!1;if(this._path){var e=this._segment2,n=e._handleOut;(t=e.remove())&&this._segment1._handleOut.set(n)}return t},getPoint1:function(){return this._segment1._point},setPoint1:function(){this._segment1._point.set(v.read(arguments))},getPoint2:function(){return this._segment2._point},setPoint2:function(){this._segment2._point.set(v.read(arguments))},getHandle1:function(){return this._segment1._handleOut},setHandle1:function(){this._segment1._handleOut.set(v.read(arguments))},getHandle2:function(){return this._segment2._handleIn},setHandle2:function(){this._segment2._handleIn.set(v.read(arguments))},getSegment1:function(){return this._segment1},getSegment2:function(){return this._segment2},getPath:function(){return this._path},getIndex:function(){return this._segment1._index},getNext:function(){var t=this._path&&this._path._curves;return t&&(t[this._segment1._index+1]||this._path._closed&&t[0])||null},getPrevious:function(){var t=this._path&&this._path._curves;return t&&(t[this._segment1._index-1]||this._path._closed&&t[t.length-1])||null},isFirst:function(){return!this._segment1._index},isLast:function(){var t=this._path;return t&&this._segment1._index===t._curves.length-1||!1},isSelected:function(){return this.getPoint1().isSelected()&&this.getHandle1().isSelected()&&this.getHandle2().isSelected()&&this.getPoint2().isSelected()},setSelected:function(t){this.getPoint1().setSelected(t),this.getHandle1().setSelected(t),this.getHandle2().setSelected(t),this.getPoint2().setSelected(t)},getValues:function(t){return B.getValues(this._segment1,this._segment2,t)},getPoints:function(){for(var t=this.getValues(),e=[],n=0;n<8;n+=2)e.push(new v(t[n],t[n+1]));return e}},{getLength:function(){return null==this._length&&(this._length=B.getLength(this.getValues(),0,1)),this._length},getArea:function(){return B.getArea(this.getValues())},getLine:function(){return new T(this._segment1._point,this._segment2._point)},getPart:function(t,e){return new B(B.getPart(this.getValues(),t,e))},getPartLength:function(t,e){return B.getLength(this.getValues(),t,e)},divideAt:function(t){return this.divideAtTime(t&&t.curve===this?t.time:this.getTimeAt(t))},divideAtTime:function(t,e){var n=null;if(t>=1e-8&&t<=.99999999){var i=B.subdivide(this.getValues(),t),r=i[0],o=i[1],s=e||this.hasHandles(),a=this._segment1,l=this._segment2,c=this._path;s&&(a._handleOut._set(r[2]-r[0],r[3]-r[1]),l._handleIn._set(o[4]-o[6],o[5]-o[7]));var u=r[6],h=r[7],d=new z(new v(u,h),s&&new v(r[4]-u,r[5]-h),s&&new v(o[2]-u,o[3]-h));c?(c.insert(a._index+1,d),n=this.getNext()):(this._segment2=d,this._changed(),n=new B(d,l))}return n},splitAt:function(t){var e=this._path;return e?e.splitAt(t):null},splitAtTime:function(t){return this.splitAt(this.getLocationAtTime(t))},divide:function(t,e){return this.divideAtTime(t===a?.5:e?t:this.getTimeAt(t))},split:function(t,e){return this.splitAtTime(t===a?.5:e?t:this.getTimeAt(t))},reversed:function(){return new B(this._segment2.reversed(),this._segment1.reversed())},clearHandles:function(){this._segment1._handleOut._set(0,0),this._segment2._handleIn._set(0,0)},statics:{getValues:function(t,e,n,i){var r=t._point,o=t._handleOut,s=e._handleIn,a=e._point,l=r.x,c=r.y,u=a.x,h=a.y,d=i?[l,c,l,c,u,h,u,h]:[l,c,l+o._x,c+o._y,u+s._x,h+s._y,u,h];return n&&n._transformCoordinates(d,d,4),d},subdivide:function(t,e){var n=t[0],i=t[1],r=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7];e===a&&(e=.5);var h=1-e,d=h*n+e*r,p=h*i+e*o,f=h*r+e*s,g=h*o+e*l,m=h*s+e*c,y=h*l+e*u,v=h*d+e*f,b=h*p+e*g,I=h*f+e*m,A=h*g+e*y,M=h*v+e*I,w=h*b+e*A;return[[n,i,d,p,v,b,M,w],[M,w,I,A,m,y,c,u]]},getMonoCurves:function(t,e){var n=[],i=e?0:1,r=t[i+0],o=t[i+2],s=t[i+4],a=t[i+6];if(r>=o==o>=s&&o>=s==s>=a||B.isStraight(t))n.push(t);else{var l=3*(o-s)-r+a,c=2*(r+s)-4*o,u=o-r,h=[],d=m.solveQuadratic(l,c,u,h,1e-8,.99999999);if(d){h.sort();var p=h[0],f=B.subdivide(t,p);n.push(f[0]),d>1&&(p=(h[1]-p)/(1-p),f=B.subdivide(f[1],p),n.push(f[0])),n.push(f[1])}else n.push(t)}return n},solveCubic:function(t,e,n,i,r,o){var s=t[e],a=t[e+2],l=t[e+4],c=t[e+6],u=0;if(!(s<n&&c<n&&a<n&&l<n||s>n&&c>n&&a>n&&l>n)){var h=3*(a-s),d=3*(l-a)-h,p=c-s-h-d;u=m.solveCubic(p,d,h,s-n,i,r,o)}return u},getTimeOf:function(t,e){var n=new v(t[0],t[1]),i=new v(t[6],t[7]),r=1e-7;if(null===(e.isClose(n,1e-12)?0:e.isClose(i,1e-12)?1:null))for(var o=[e.x,e.y],s=[],a=0;a<2;a++)for(var l=B.solveCubic(t,a,o[a],s,0,1),c=0;c<l;c++){var u=s[c];if(e.isClose(B.getPoint(t,u),r))return u}return e.isClose(n,r)?0:e.isClose(i,r)?1:null},getNearestTime:function(t,e){if(B.isStraight(t)){var n=t[0],i=t[1],r=t[6]-n,o=t[7]-i,s=r*r+o*o;if(0===s)return 0;var a=((e.x-n)*r+(e.y-i)*o)/s;return a<1e-12?0:a>.999999999999?1:B.getTimeOf(t,new v(n+a*r,i+a*o))}var l=1/0,c=0;function u(n){if(n>=0&&n<=1){var i=e.getDistance(B.getPoint(t,n),!0);if(i<l)return l=i,c=n,!0}}for(var h=0;h<=100;h++)u(h/100);for(var d=.005;d>1e-8;)u(c-d)||u(c+d)||(d/=2);return c},getPart:function(t,e,n){var i=e>n;if(i){var r=e;e=n,n=r}return e>0&&(t=B.subdivide(t,e)[1]),n<1&&(t=B.subdivide(t,(n-e)/(1-e))[0]),i?[t[6],t[7],t[4],t[5],t[2],t[3],t[0],t[1]]:t},isFlatEnough:function(t,e){var n=t[0],i=t[1],r=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=3*r-2*n-l,h=3*o-2*i-c,d=3*s-2*l-n,p=3*a-2*c-i;return Math.max(u*u,d*d)+Math.max(h*h,p*p)<=16*e*e},getArea:function(t){var e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7];return 3*((l-n)*(i+o)-(a-e)*(r+s)+r*(e-o)-i*(n-s)+l*(o+e/3)-a*(s+n/3))/20},getBounds:function(t){for(var e=t.slice(0,2),n=e.slice(),i=[0,0],r=0;r<2;r++)B._addBounds(t[r],t[r+2],t[r+4],t[r+6],r,0,e,n,i);return new M(e[0],e[1],n[0]-e[0],n[1]-e[1])},_addBounds:function(t,e,n,i,r,o,s,a,l){function c(t,e){var n=t-e,i=t+e;n<s[r]&&(s[r]=n),i>a[r]&&(a[r]=i)}o/=2;var u=s[r]-o,h=a[r]+o;if(t<u||e<u||n<u||i<u||t>h||e>h||n>h||i>h)if(e<t!=e<i&&n<t!=n<i)c(t,o),c(i,o);else{var d=3*(e-n)-t+i,p=2*(t+n)-4*e,f=e-t,g=m.solveQuadratic(d,p,f,l);c(i,0);for(var y=0;y<g;y++){var v=l[y],b=1-v;1e-8<=v&&v<=.99999999&&c(b*b*b*t+3*b*b*v*e+3*b*v*v*n+v*v*v*i,o)}}}}},u.each(["getBounds","getStrokeBounds","getHandleBounds"],function(t){this[t]=function(){this._bounds||(this._bounds={});var e=this._bounds[t];return e||(e=this._bounds[t]=U[t]([this._segment1,this._segment2],!1,this._path)),e.clone()}},{}),u.each({isStraight:function(t,e,n,i){if(e.isZero()&&n.isZero())return!0;var r=i.subtract(t);if(r.isZero())return!1;if(r.isCollinear(e)&&r.isCollinear(n)){var o=new T(t,i);if(o.getDistance(t.add(e))<1e-7&&o.getDistance(i.add(n))<1e-7){var s=r.dot(r),a=r.dot(e)/s,l=r.dot(n)/s;return a>=0&&a<=1&&l<=0&&l>=-1}}return!1},isLinear:function(t,e,n,i){var r=i.subtract(t).divide(3);return e.equals(r)&&n.negate().equals(r)}},function(t,e){this[e]=function(e){var n=this._segment1,i=this._segment2;return t(n._point,n._handleOut,i._handleIn,i._point,e)},this.statics[e]=function(e,n){var i=e[0],r=e[1],o=e[6],s=e[7];return t(new v(i,r),new v(e[2]-i,e[3]-r),new v(e[4]-o,e[5]-s),new v(o,s),n)}},{statics:{},hasHandles:function(){return!this._segment1._handleOut.isZero()||!this._segment2._handleIn.isZero()},hasLength:function(t){return(!this.getPoint1().equals(this.getPoint2())||this.hasHandles())&&this.getLength()>(t||0)},isCollinear:function(t){return t&&this.isStraight()&&t.isStraight()&&this.getLine().isCollinear(t.getLine())},isHorizontal:function(){return this.isStraight()&&Math.abs(this.getTangentAtTime(.5).y)<1e-8},isVertical:function(){return this.isStraight()&&Math.abs(this.getTangentAtTime(.5).x)<1e-8}}),{beans:!1,getLocationAt:function(t,e){return this.getLocationAtTime(e?t:this.getTimeAt(t))},getLocationAtTime:function(t){return null!=t&&t>=0&&t<=1?new P(this,t):null},getTimeAt:function(t,e){return B.getTimeAt(this.getValues(),t,e)},getParameterAt:"#getTimeAt",getTimesWithTangent:function(){var t=v.read(arguments);return t.isZero()?[]:B.getTimesWithTangent(this.getValues(),t)},getOffsetAtTime:function(t){return this.getPartLength(0,t)},getLocationOf:function(){return this.getLocationAtTime(this.getTimeOf(v.read(arguments)))},getOffsetOf:function(){var t=this.getLocationOf.apply(this,arguments);return t?t.getOffset():null},getTimeOf:function(){return B.getTimeOf(this.getValues(),v.read(arguments))},getParameterOf:"#getTimeOf",getNearestLocation:function(){var t=v.read(arguments),e=this.getValues(),n=B.getNearestTime(e,t),i=B.getPoint(e,n);return new P(this,n,i,null,t.getDistance(i))},getNearestPoint:function(){var t=this.getNearestLocation.apply(this,arguments);return t?t.getPoint():t}},new function(){var t=["getPoint","getTangent","getNormal","getWeightedTangent","getWeightedNormal","getCurvature"];return u.each(t,function(t){this[t+"At"]=function(e,n){var i=this.getValues();return B[t](i,n?e:B.getTimeAt(i,e))},this[t+"AtTime"]=function(e){return B[t](this.getValues(),e)}},{statics:{_evaluateMethods:t}})},new function(){function t(t){var e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],c=9*(i-o)+3*(a-e),u=6*(e+o)-12*i,h=3*(i-e),d=9*(r-s)+3*(l-n),p=6*(n+s)-12*r,f=3*(r-n);return function(t){var e=(c*t+u)*t+h,n=(d*t+p)*t+f;return Math.sqrt(e*e+n*n)}}function e(t,e){return Math.max(2,Math.min(16,Math.ceil(32*Math.abs(e-t))))}function n(t,e,n,i){if(null==e||e<0||e>1)return null;var r=t[0],o=t[1],s=t[2],a=t[3],l=t[4],c=t[5],u=t[6],h=t[7],d=m.isZero;d(s-r)&&d(a-o)&&(s=r,a=o),d(l-u)&&d(c-h)&&(l=u,c=h);var p,f,g=3*(s-r),y=3*(l-s)-g,b=u-r-g-y,I=3*(a-o),A=3*(c-a)-I,M=h-o-I-A;if(0===n)p=0===e?r:1===e?u:((b*e+y)*e+g)*e+r,f=0===e?o:1===e?h:((M*e+A)*e+I)*e+o;else{var w=1e-8,C=1-w;if(e<w?(p=g,f=I):e>C?(p=3*(u-l),f=3*(h-c)):(p=(3*b*e+2*y)*e+g,f=(3*M*e+2*A)*e+I),i){0===p&&0===f&&(e<w||e>C)&&(p=l-s,f=c-a);var T=Math.sqrt(p*p+f*f);T&&(p/=T,f/=T)}if(3===n){l=6*b*e+2*y,c=6*M*e+2*A;var x=Math.pow(p*p+f*f,1.5);p=0!==x?(p*c-f*l)/x:0,f=0}}return 2===n?new v(f,-p):new v(p,f)}return{statics:{classify:function(t){var e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],l=t[6],c=t[7],u=i*(n-c)+r*(l-e)+e*c-n*l,h=3*(o*(r-n)+s*(e-i)+i*n-r*e),d=h-u,p=d-u+(e*(c-s)+n*(o-l)+l*s-c*o),f=Math.sqrt(p*p+d*d+h*h),g=0!==f?1/f:0,y=m.isZero,v="serpentine";function b(t,e,n){var i=e!==a,r=i&&e>0&&e<1,o=i&&n>0&&n<1;return!i||(r||o)&&("loop"!==t||r&&o)||(t="arch",r=o=!1),{type:t,roots:r||o?r&&o?e<n?[e,n]:[n,e]:[r?e:n]:null}}if(d*=g,h*=g,y(p*=g))return y(d)?b(y(h)?"line":"quadratic"):b(v,h/(3*d));var I=3*d*d-4*p*h;if(y(I))return b("cusp",d/(2*p));var A=I>0?Math.sqrt(I/3):Math.sqrt(-I),M=2*p;return b(I>0?v:"loop",(d+A)/M,(d-A)/M)},getLength:function(n,i,r,o){if(i===a&&(i=0),r===a&&(r=1),B.isStraight(n)){var s=n;r<1&&(s=B.subdivide(s,r)[0],i/=r),i>0&&(s=B.subdivide(s,i)[1]);var l=s[6]-s[0],c=s[7]-s[1];return Math.sqrt(l*l+c*c)}return m.integrate(o||t(n),i,r,e(i,r))},getTimeAt:function(n,i,r){if(r===a&&(r=i<0?1:0),0===i)return r;var o=Math.abs,s=i>0,l=s?r:0,c=s?1:r,u=t(n),h=B.getLength(n,l,c,u),d=o(i)-h;if(o(d)<1e-12)return s?c:l;if(d>1e-12)return null;var p=i/h,f=0;return m.findRoot(function(t){return f+=m.integrate(u,r,t,e(r,t)),r=t,f-i},u,r+p,l,c,32,1e-12)},getPoint:function(t,e){return n(t,e,0,!1)},getTangent:function(t,e){return n(t,e,1,!0)},getWeightedTangent:function(t,e){return n(t,e,1,!1)},getNormal:function(t,e){return n(t,e,2,!0)},getWeightedNormal:function(t,e){return n(t,e,2,!1)},getCurvature:function(t,e){return n(t,e,3,!1).x},getPeaks:function(t){var e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=3*i-e-3*o+t[6],l=3*e-6*i+3*o,c=-3*e+3*i,u=3*r-n-3*s+t[7],h=3*n-6*r+3*s,d=-3*n+3*r,p=[];return m.solveCubic(9*(a*a+u*u),9*(a*l+h*u),2*(l*l+h*h)+3*(c*a+d*u),c*l+h*d,p,1e-8,.99999999),p.sort()}}}},new function(){function t(t,e,n,i,r,o,s){var a=!s&&n.getPrevious()===r,l=!s&&n!==r&&n.getNext()===r,c=1e-8,u=1-c;if(null!==i&&i>=(a?c:0)&&i<=(l?u:1)&&null!==o&&o>=(l?c:0)&&o<=(a?u:1)){var h=new P(n,i,null,s),d=new P(r,o,null,s);h._intersection=d,d._intersection=h,e&&!e(h)||P.insert(t,h,!0)}}function e(i,r,o,s,a,l,c,u,h,d,p,f,g){if(++h>=4096||++u>=40)return h;var m,y,v=r[0],b=r[1],I=r[6],A=r[7],M=T.getSignedDistance,w=M(v,b,I,A,r[2],r[3]),C=M(v,b,I,A,r[4],r[5]),x=w*C>0?3/4:4/9,S=x*Math.min(0,w,C),D=x*Math.max(0,w,C),N=M(v,b,I,A,i[0],i[1]),_=M(v,b,I,A,i[2],i[3]),E=M(v,b,I,A,i[4],i[5]),j=M(v,b,I,A,i[6],i[7]),k=function(t,e,n,i){var r,o=[0,t],s=[1/3,e],a=[2/3,n],l=[1,i],c=e-(2*t+i)/3,u=n-(t+2*i)/3;if(c*u<0)r=[[o,s,l],[o,a,l]];else{var h=c/u;r=[h>=2?[o,s,l]:h<=.5?[o,a,l]:[o,s,a,l],[o,l]]}return(c||u)<0?r.reverse():r}(N,_,E,j),O=k[0],z=k[1];if(0===w&&0===C&&0===N&&0===_&&0===E&&0===j||null==(m=n(O,z,S,D))||null==(y=n(O.reverse(),z.reverse(),S,D)))return h;var L=d+(p-d)*m,P=d+(p-d)*y;if(Math.max(g-f,P-L)<1e-9){var R=(L+P)/2,U=(f+g)/2;t(a,l,c?s:o,c?U:R,c?o:s,c?R:U)}else{i=B.getPart(i,m,y);var G=g-f;if(y-m>.8)if(P-L>G){R=(L+P)/2;h=e(r,(Y=B.subdivide(i,.5))[0],s,o,a,l,!c,u,h,f,g,L,R),h=e(r,Y[1],s,o,a,l,!c,u,h,f,g,R,P)}else{var Y;U=(f+g)/2;h=e((Y=B.subdivide(r,.5))[0],i,s,o,a,l,!c,u,h,f,U,L,P),h=e(Y[1],i,s,o,a,l,!c,u,h,U,g,L,P)}else h=0===G||G>=1e-9?e(r,i,s,o,a,l,!c,u,h,f,g,L,P):e(i,r,o,s,a,l,c,u,h,L,P,f,g)}return h}function n(t,e,n,r){return t[0][1]<n?i(t,!0,n):e[0][1]>r?i(e,!1,r):t[0][0]}function i(t,e,n){for(var i=t[0][0],r=t[0][1],o=1,s=t.length;o<s;o++){var a=t[o][0],l=t[o][1];if(e?l>=n:l<=n)return l===n?a:i+(n-r)*(a-i)/(l-r);i=a,r=l}return null}function r(t,e,n,i,r){var o=m.isZero;if(o(i)&&o(r)){var s=B.getTimeOf(t,new v(e,n));return null===s?[]:[s]}for(var a=Math.atan2(-r,i),l=Math.sin(a),c=Math.cos(a),u=[],h=[],d=0;d<8;d+=2){var p=t[d]-e,f=t[d+1]-n;u.push(p*c-f*l,p*l+f*c)}return B.solveCubic(u,1,0,h,0,1),h}function o(e,n,i,o,s,a,l){for(var c=n[0],u=n[1],h=r(e,c,u,n[6]-c,n[7]-u),d=0,p=h.length;d<p;d++){var f=h[d],g=B.getPoint(e,f),m=B.getTimeOf(n,g);null!==m&&t(s,a,l?o:i,l?m:f,l?i:o,l?f:m)}}function s(e,n,i,r,o,s){var a=T.intersect(e[0],e[1],e[6],e[7],n[0],n[1],n[6],n[7]);a&&t(o,s,i,B.getTimeOf(e,a),r,B.getTimeOf(n,a))}function a(n,i,r,a,l,u){var h=1e-12,d=Math.min,p=Math.max;if(p(n[0],n[2],n[4],n[6])+h>d(i[0],i[2],i[4],i[6])&&d(n[0],n[2],n[4],n[6])-h<p(i[0],i[2],i[4],i[6])&&p(n[1],n[3],n[5],n[7])+h>d(i[1],i[3],i[5],i[7])&&d(n[1],n[3],n[5],n[7])-h<p(i[1],i[3],i[5],i[7])){var f=c(n,i);if(f)for(var g=0;g<2;g++){var m=f[g];t(l,u,r,m[0],a,m[1],!0)}else{var y=B.isStraight(n),b=B.isStraight(i),I=y&&b,A=y&&!b,M=l.length;if((I?s:y||b?o:e)(A?i:n,A?n:i,A?a:r,A?r:a,l,u,A,0,0,0,1,0,1),!I||l.length===M)for(g=0;g<4;g++){var w=g>>1,C=1&g,T=6*w,x=6*C,S=new v(n[T],n[T+1]),D=new v(i[x],i[x+1]);S.isClose(D,h)&&t(l,u,r,w,a,C)}}}return l}function l(e,n,i,r){var o=B.classify(e);if("loop"===o.type){var s=o.roots;t(i,r,n,s[0],n,s[1])}return i}function c(t,e){function n(t){var e=t[6]-t[0],n=t[7]-t[1];return e*e+n*n}var i=Math.abs,r=T.getDistance,o=1e-7,s=B.isStraight(t),a=B.isStraight(e),l=s&&a,c=n(t)<n(e),u=c?e:t,h=c?t:e,d=u[0],p=u[1],f=u[6]-d,g=u[7]-p;if(r(d,p,f,g,h[0],h[1],!0)<o&&r(d,p,f,g,h[6],h[7],!0)<o)!l&&r(d,p,f,g,u[2],u[3],!0)<o&&r(d,p,f,g,u[4],u[5],!0)<o&&r(d,p,f,g,h[2],h[3],!0)<o&&r(d,p,f,g,h[4],h[5],!0)<o&&(s=a=l=!0);else if(l)return null;if(s^a)return null;for(var m=[t,e],y=[],b=0;b<4&&y.length<2;b++){var I=1&b,A=1^I,M=b>>1,w=B.getTimeOf(m[I],new v(m[A][M?6:0],m[A][M?7:1]));if(null!=w){var C=I?[M,w]:[w,M];(!y.length||i(C[0]-y[0][0])>1e-8&&i(C[1]-y[0][1])>1e-8)&&y.push(C)}if(b>2&&!y.length)break}if(2!==y.length)y=null;else if(!l){var x=B.getPart(t,y[0][0],y[1][0]),S=B.getPart(e,y[0][1],y[1][1]);(i(S[2]-x[2])>o||i(S[3]-x[3])>o||i(S[4]-x[4])>o||i(S[5]-x[5])>o)&&(y=null)}return y}return{getIntersections:function(t){var e=this.getValues(),n=t&&t!==this&&t.getValues();return n?a(e,n,this,t,[]):l(e,this,[])},statics:{getOverlaps:c,getIntersections:function(t,e,n,i,r,o){var s=!e;s&&(e=t);for(var c=t.length,u=e.length,h=new Array(c),d=s?h:new Array(u),p=[],g=0;g<c;g++)h[g]=t[g].getValues(i);if(!s)for(g=0;g<u;g++)d[g]=e[g].getValues(r);for(var m=f.findCurveBoundsCollisions(h,d,1e-7),y=0;y<c;y++){var v=t[y],b=h[y];s&&l(b,v,p,n);var I=m[y];if(I)for(var A=0;A<I.length;A++){if(o&&p.length)return p;var M=I[A];if(!s||M>y){var w=e[M];a(b,d[M],v,w,p,n)}}}return p},getCurveLineIntersections:r,getTimesWithTangent:function(t,e){var n=t[0],i=t[1],r=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=e.normalize(),h=u.x,d=u.y,p=3*l-9*s+9*r-3*n,f=3*c-9*a+9*o-3*i,g=6*s-12*r+6*n,y=6*a-12*o+6*i,v=3*r-3*n,b=3*o-3*i,I=2*p*d-2*f*h,A=[];if(Math.abs(I)<m.CURVETIME_EPSILON){if(0!=(I=p*y-f*g)){var M=-(p*b-f*v)/I;M>=0&&M<=1&&A.push(M)}}else{var w=(g*g-4*p*v)*d*d+(-2*g*y+4*f*v+4*p*b)*h*d+(y*y-4*f*b)*h*h,C=g*d-y*h;if(w>=0&&0!=I){var T=Math.sqrt(w),x=-(C+T)/I,S=(-C+T)/I;x>=0&&x<=1&&A.push(x),S>=0&&S<=1&&A.push(S)}}return A}}}}),P=u.extend({_class:"CurveLocation",initialize:function(t,e,n,i,r){if(e>=.99999999){var o=t.getNext();o&&(e=0,t=o)}this._setCurve(t),this._time=e,this._point=n||t.getPointAtTime(e),this._overlap=i,this._distance=r,this._intersection=this._next=this._previous=null},_setPath:function(t){this._path=t,this._version=t?t._version:0},_setCurve:function(t){this._setPath(t._path),this._curve=t,this._segment=null,this._segment1=t._segment1,this._segment2=t._segment2},_setSegment:function(t){var e=t.getCurve();e?this._setCurve(e):(this._setPath(t._path),this._segment1=t,this._segment2=null),this._segment=t,this._time=t===this._segment1?0:1,this._point=t._point.clone()},getSegment:function(){var t=this._segment;if(!t){var e=this.getCurve(),n=this.getTime();0===n?t=e._segment1:1===n?t=e._segment2:null!=n&&(t=e.getPartLength(0,n)<e.getPartLength(n,1)?e._segment1:e._segment2),this._segment=t}return t},getCurve:function(){var t=this._path,e=this;function n(t){var n=t&&t.getCurve();if(n&&null!=(e._time=n.getTimeOf(e._point)))return e._setCurve(n),n}return t&&t._version!==this._version&&(this._time=this._offset=this._curveOffset=this._curve=null),this._curve||n(this._segment)||n(this._segment1)||n(this._segment2.getPrevious())},getPath:function(){var t=this.getCurve();return t&&t._path},getIndex:function(){var t=this.getCurve();return t&&t.getIndex()},getTime:function(){var t=this.getCurve(),e=this._time;return t&&null==e?this._time=t.getTimeOf(this._point):e},getParameter:"#getTime",getPoint:function(){return this._point},getOffset:function(){var t=this._offset;if(null==t){t=0;var e=this.getPath(),n=this.getIndex();if(e&&null!=n)for(var i=e.getCurves(),r=0;r<n;r++)t+=i[r].getLength();this._offset=t+=this.getCurveOffset()}return t},getCurveOffset:function(){var t=this._curveOffset;if(null==t){var e=this.getCurve(),n=this.getTime();this._curveOffset=t=null!=n&&e&&e.getPartLength(0,n)}return t},getIntersection:function(){return this._intersection},getDistance:function(){return this._distance},divide:function(){var t=this.getCurve(),e=t&&t.divideAtTime(this.getTime());return e&&this._setSegment(e._segment1),e},split:function(){var t=this.getCurve(),e=t._path,n=t&&t.splitAtTime(this.getTime());return n&&this._setSegment(e.getLastSegment()),n},equals:function(t,e){var n=this===t;if(!n&&t instanceof P){var i=this.getCurve(),r=t.getCurve(),o=i._path;if(o===r._path){var s=Math.abs,a=s(this.getOffset()-t.getOffset()),l=!e&&this._intersection,c=!e&&t._intersection;n=(a<1e-7||o&&s(o.getLength()-a)<1e-7)&&(!l&&!c||l&&c&&l.equals(c,!0))}}return n},toString:function(){var t=[],e=this.getPoint(),n=g.instance;e&&t.push("point: "+e);var i=this.getIndex();null!=i&&t.push("index: "+i);var r=this.getTime();return null!=r&&t.push("time: "+n.number(r)),null!=this._distance&&t.push("distance: "+n.number(this._distance)),"{ "+t.join(", ")+" }"},isTouching:function(){var t=this._intersection;if(t&&this.getTangent().isCollinear(t.getTangent())){var e=this.getCurve(),n=t.getCurve();return!(e.isStraight()&&n.isStraight()&&e.getLine().intersect(n.getLine()))}return!1},isCrossing:function(){var t=this._intersection;if(!t)return!1;var e=this.getTime(),n=t.getTime(),i=1e-8,r=1-i,o=e>=i&&e<=r,s=n>=i&&n<=r;if(o&&s)return!this.isTouching();var a=this.getCurve(),l=a&&e<i?a.getPrevious():a,c=t.getCurve(),u=c&&n<i?c.getPrevious():c;if(e>r&&(a=a.getNext()),n>r&&(c=c.getNext()),!(l&&a&&u&&c))return!1;var h=[];function d(t,e){var n=t.getValues(),i=B.classify(n).roots||B.getPeaks(n),r=i.length,o=B.getLength(n,e&&r?i[r-1]:0,!e&&r?i[0]:1);h.push(r?o:o/32)}function p(t,e,n){return e<n?t>e&&t<n:t>e||t<n}o||(d(l,!0),d(a,!1)),s||(d(u,!0),d(c,!1));var f=this.getPoint(),g=Math.min.apply(Math,h),m=o?a.getTangentAtTime(e):a.getPointAt(g).subtract(f),y=o?m.negate():l.getPointAt(-g).subtract(f),v=s?c.getTangentAtTime(n):c.getPointAt(g).subtract(f),b=s?v.negate():u.getPointAt(-g).subtract(f),I=y.getAngle(),A=m.getAngle(),M=b.getAngle(),w=v.getAngle();return!!(o?p(I,M,w)^p(A,M,w)&&p(I,w,M)^p(A,w,M):p(M,I,A)^p(w,I,A)&&p(M,A,I)^p(w,A,I))},hasOverlap:function(){return!!this._overlap}},u.each(B._evaluateMethods,function(t){var e=t+"At";this[t]=function(){var t=this.getCurve(),n=this.getTime();return null!=n&&t&&t[e](n,!0)}},{preserve:!0}),new function(){function t(t,e,n){var i=t.length,r=0,o=i-1;function s(n,r){for(var o=n+r;o>=-1&&o<=i;o+=r){var s=t[(o%i+i)%i];if(!e.getPoint().isClose(s.getPoint(),1e-7))break;if(e.equals(s))return s}return null}for(;r<=o;){var a,l=r+o>>>1,c=t[l];if(n&&(a=e.equals(c)?c:s(l,-1)||s(l,1)))return e._overlap&&(a._overlap=a._intersection._overlap=!0),a;var u=e.getPath(),h=c.getPath();(u!==h?u._id-h._id:e.getIndex()+e.getTime()-(c.getIndex()+c.getTime()))<0?o=l-1:r=l+1}return t.splice(r,0,e),e}return{statics:{insert:t,expand:function(e){for(var n=e.slice(),i=e.length-1;i>=0;i--)t(n,e[i]._intersection,!1);return n}}}}),R=S.extend({_class:"PathItem",_selectBounds:!1,_canScaleStroke:!0,beans:!0,initialize:function(){},statics:{create:function(t){var e,n,i;if(u.isPlainObject(t)?(n=t.segments,e=t.pathData):Array.isArray(t)?n=t:"string"==typeof t&&(e=t),n){var r=n[0];i=r&&Array.isArray(r[0])}else e&&(i=(e.match(/m/gi)||[]).length>1||/z\s*\S+/i.test(e));return new(i?G:U)(t)}},_asPathItem:function(){return this},isClockwise:function(){return this.getArea()>=0},setClockwise:function(t){this.isClockwise()!=(t=!!t)&&this.reverse()},setPathData:function(t){var e,n,i,r=t&&t.match(/[mlhvcsqtaz][^mlhvcsqtaz]*/gi),o=!1,s=new v,a=new v;function l(t,n){var i=+e[t];return o&&(i+=s[n]),i}function c(t){return new v(l(t,"x"),l(t+1,"y"))}this.clear();for(var u=0,h=r&&r.length;u<h;u++){var d=r[u],p=d[0],f=p.toLowerCase(),g=(e=d.match(/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g))&&e.length;switch(o=p===f,"z"!==n||/[mz]/.test(f)||this.moveTo(s),f){case"m":case"l":for(var m="m"===f,y=0;y<g;y+=2)this[m?"moveTo":"lineTo"](s=c(y)),m&&(a=s,m=!1);i=s;break;case"h":case"v":var b="h"===f?"x":"y";s=s.clone();for(y=0;y<g;y++)s[b]=l(y,b),this.lineTo(s);i=s;break;case"c":for(y=0;y<g;y+=6)this.cubicCurveTo(c(y),i=c(y+2),s=c(y+4));break;case"s":for(y=0;y<g;y+=4)this.cubicCurveTo(/[cs]/.test(n)?s.multiply(2).subtract(i):s,i=c(y),s=c(y+2)),n=f;break;case"q":for(y=0;y<g;y+=4)this.quadraticCurveTo(i=c(y),s=c(y+2));break;case"t":for(y=0;y<g;y+=2)this.quadraticCurveTo(i=/[qt]/.test(n)?s.multiply(2).subtract(i):s,s=c(y)),n=f;break;case"a":for(y=0;y<g;y+=7)this.arcTo(s=c(y+5),new I(+e[y],+e[y+1]),+e[y+2],+e[y+4],+e[y+3]);break;case"z":this.closePath(1e-12),s=a}n=f}},_canComposite:function(){return!(this.hasFill()&&this.hasStroke())},_contains:function(t){var e=t.isInside(this.getBounds({internal:!0,handle:!0}))?this._getWinding(t):{};return e.onPath||!!("evenodd"===this.getFillRule()?1&e.windingL||1&e.windingR:e.winding)},getIntersections:function(t,e,n,i){var r=this===t||!t,o=this._matrix._orNullIfIdentity(),s=r?o:(n||t._matrix)._orNullIfIdentity();return r||this.getBounds(o).intersects(t.getBounds(s),1e-12)?B.getIntersections(this.getCurves(),!r&&t.getCurves(),e,o,s,i):[]},getCrossings:function(t){return this.getIntersections(t,function(t){return t.isCrossing()})},getNearestLocation:function(){for(var t=v.read(arguments),e=this.getCurves(),n=1/0,i=null,r=0,o=e.length;r<o;r++){var s=e[r].getNearestLocation(t);s._distance<n&&(n=s._distance,i=s)}return i},getNearestPoint:function(){var t=this.getNearestLocation.apply(this,arguments);return t?t.getPoint():t},interpolate:function(t,e,n){var i=!this._children,r=i?"_segments":"_children",o=t[r],s=e[r],a=this[r];if(!o||!s||o.length!==s.length)throw new Error("Invalid operands in interpolate() call: "+t+", "+e);var l=a.length,c=s.length;if(l<c)for(var u=i?z:U,h=l;h<c;h++)this.add(new u);else l>c&&this[i?"removeSegments":"removeChildren"](c,l);for(h=0;h<c;h++)a[h].interpolate(o[h],s[h],n);i&&(this.setClosed(t._closed),this._changed(9))},compare:function(t){var e=!1;if(t){var n=this._children||[this],i=t._children?t._children.slice():[t],r=n.length,o=i.length,s=[],a=0;e=!0;for(var l=f.findItemBoundsCollisions(n,i,m.GEOMETRIC_EPSILON),c=r-1;c>=0&&e;c--){var u=n[c];e=!1;var h=l[c];if(h)for(var d=h.length-1;d>=0&&!e;d--)u.compare(i[h[d]])&&(s[h[d]]||(s[h[d]]=!0,a++),e=!0)}e=e&&a===o}return e}}),U=R.extend({_class:"Path",_serializeFields:{segments:[],closed:!1},initialize:function(t){this._closed=!1,this._segments=[],this._version=0;var e=arguments,n=Array.isArray(t)?"object"==typeof t[0]?t:e:!t||t.size!==a||t.x===a&&t.point===a?null:e;n&&n.length>0?this.setSegments(n):(this._curves=a,this._segmentSelection=0,n||"string"!=typeof t||(this.setPathData(t),t=null)),this._initialize(!n&&t)},_equals:function(t){return this._closed===t._closed&&u.equals(this._segments,t._segments)},copyContent:function(t){this.setSegments(t._segments),this._closed=t._closed},_changed:function t(e){if(t.base.call(this,e),8&e){if(this._length=this._area=a,32&e)this._version++;else if(this._curves)for(var n=0,i=this._curves.length;n<i;n++)this._curves[n]._changed()}else 64&e&&(this._bounds=a)},getStyle:function(){var t=this._parent;return(t instanceof G?t:this)._style},getSegments:function(){return this._segments},setSegments:function(t){var e=this.isFullySelected(),n=t&&t.length;if(this._segments.length=0,this._segmentSelection=0,this._curves=a,n){var i=t[n-1];"boolean"==typeof i&&(this.setClosed(i),n--),this._add(z.readList(t,0,{},n))}e&&this.setFullySelected(!0)},getFirstSegment:function(){return this._segments[0]},getLastSegment:function(){return this._segments[this._segments.length-1]},getCurves:function(){var t=this._curves,e=this._segments;if(!t){var n=this._countCurves();t=this._curves=new Array(n);for(var i=0;i<n;i++)t[i]=new B(this,e[i],e[i+1]||e[0])}return t},getFirstCurve:function(){return this.getCurves()[0]},getLastCurve:function(){var t=this.getCurves();return t[t.length-1]},isClosed:function(){return this._closed},setClosed:function(t){if(this._closed!=(t=!!t)){if(this._closed=t,this._curves){var e=this._curves.length=this._countCurves();t&&(this._curves[e-1]=new B(this,this._segments[e-1],this._segments[0]))}this._changed(41)}}},{beans:!0,getPathData:function(t,e){var n,i,r,o,s,a,l,c,u=this._segments,h=u.length,d=new g(e),p=new Array(6),f=!0,m=[];function y(e,u){if(e._transformCoordinates(t,p),n=p[0],i=p[1],f)m.push("M"+d.pair(n,i)),f=!1;else if(s=p[2],a=p[3],s===n&&a===i&&l===r&&c===o){if(!u){var h=n-r,g=i-o;m.push(0===h?"v"+d.number(g):0===g?"h"+d.number(h):"l"+d.pair(h,g))}}else m.push("c"+d.pair(l-r,c-o)+" "+d.pair(s-r,a-o)+" "+d.pair(n-r,i-o));r=n,o=i,l=p[4],c=p[5]}if(!h)return"";for(var v=0;v<h;v++)y(u[v]);return this._closed&&h>0&&(y(u[0],!0),m.push("z")),m.join("")},isEmpty:function(){return!this._segments.length},_transformContent:function(t){for(var e=this._segments,n=new Array(6),i=0,r=e.length;i<r;i++)e[i]._transformCoordinates(t,n,!0);return!0},_add:function(t,e){for(var n=this._segments,i=this._curves,r=t.length,o=null==e,s=(e=o?n.length:e,0);s<r;s++){var a=t[s];a._path&&(a=t[s]=a.clone()),a._path=this,a._index=e+s,a._selection&&this._updateSelection(a,0,a._selection)}if(o)u.push(n,t);else{n.splice.apply(n,[e,0].concat(t));s=e+r;for(var l=n.length;s<l;s++)n[s]._index=s}if(i){var c=this._countCurves(),h=e>0&&e+r-1===c?e-1:e,d=h,p=Math.min(h+r,c);t._curves&&(i.splice.apply(i,[h,0].concat(t._curves)),d+=t._curves.length);for(s=d;s<p;s++)i.splice(s,0,new B(this,null,null));this._adjustCurves(h,p)}return this._changed(41),t},_adjustCurves:function(t,e){for(var n,i=this._segments,r=this._curves,o=t;o<e;o++)(n=r[o])._path=this,n._segment1=i[o],n._segment2=i[o+1]||i[0],n._changed();(n=r[this._closed&&!t?i.length-1:t-1])&&(n._segment2=i[t]||i[0],n._changed()),(n=r[e])&&(n._segment1=i[e],n._changed())},_countCurves:function(){var t=this._segments.length;return!this._closed&&t>0?t-1:t},add:function(t){var e=arguments;return e.length>1&&"number"!=typeof t?this._add(z.readList(e)):this._add([z.read(e)])[0]},insert:function(t,e){var n=arguments;return n.length>2&&"number"!=typeof e?this._add(z.readList(n,1),t):this._add([z.read(n,1)],t)[0]},addSegment:function(){return this._add([z.read(arguments)])[0]},insertSegment:function(t){return this._add([z.read(arguments,1)],t)[0]},addSegments:function(t){return this._add(z.readList(t))},insertSegments:function(t,e){return this._add(z.readList(e),t)},removeSegment:function(t){return this.removeSegments(t,t+1)[0]||null},removeSegments:function(t,e,n){t=t||0,e=u.pick(e,this._segments.length);var i=this._segments,r=this._curves,o=i.length,s=i.splice(t,e-t),a=s.length;if(!a)return s;for(var l=0;l<a;l++){var c=s[l];c._selection&&this._updateSelection(c,c._selection,0),c._index=c._path=null}l=t;for(var h=i.length;l<h;l++)i[l]._index=l;if(r){var d=t>0&&e===o+(this._closed?1:0)?t-1:t;for(l=(r=r.splice(d,a)).length-1;l>=0;l--)r[l]._path=null;n&&(s._curves=r.slice(1)),this._adjustCurves(d,d)}return this._changed(41),s},clear:"#removeSegments",hasHandles:function(){for(var t=this._segments,e=0,n=t.length;e<n;e++)if(t[e].hasHandles())return!0;return!1},clearHandles:function(){for(var t=this._segments,e=0,n=t.length;e<n;e++)t[e].clearHandles()},getLength:function(){if(null==this._length){for(var t=this.getCurves(),e=0,n=0,i=t.length;n<i;n++)e+=t[n].getLength();this._length=e}return this._length},getArea:function(){var t=this._area;if(null==t){var e=this._segments,n=this._closed;t=0;for(var i=0,r=e.length;i<r;i++){var o=i+1===r;t+=B.getArea(B.getValues(e[i],e[o?0:i+1],null,o&&!n))}this._area=t}return t},isFullySelected:function(){var t=this._segments.length;return this.isSelected()&&t>0&&this._segmentSelection===7*t},setFullySelected:function(t){t&&this._selectSegments(!0),this.setSelected(t)},setSelection:function t(e){1&e||this._selectSegments(!1),t.base.call(this,e)},_selectSegments:function(t){var e=this._segments,n=e.length,i=t?7:0;this._segmentSelection=i*n;for(var r=0;r<n;r++)e[r]._selection=i},_updateSelection:function(t,e,n){t._selection=n,(this._segmentSelection+=n-e)>0&&this.setSelected(!0)},divideAt:function(t){var e,n=this.getLocationAt(t);return n&&(e=n.getCurve().divideAt(n.getCurveOffset()))?e._segment1:null},splitAt:function(t){var e=this.getLocationAt(t),n=e&&e.index,i=e&&e.time;i>.99999999&&(n++,i=0);var r=this.getCurves();if(n>=0&&n<r.length){i>=1e-8&&r[n++].divideAtTime(i);var o,s=this.removeSegments(n,this._segments.length,!0);return this._closed?(this.setClosed(!1),o=this):((o=new U(S.NO_INSERT)).insertAbove(this),o.copyAttributes(this)),o._add(s,0),this.addSegment(s[0]),o}return null},split:function(t,e){var n,i=e===a?t:(n=this.getCurves()[t])&&n.getLocationAtTime(e);return null!=i?this.splitAt(i):null},join:function(t,e){var n=e||0;if(t&&t!==this){var i=t._segments,r=this.getLastSegment(),o=t.getLastSegment();if(!o)return this;r&&r._point.isClose(o._point,n)&&t.reverse();var s=t.getFirstSegment();if(r&&r._point.isClose(s._point,n))r.setHandleOut(s._handleOut),this._add(i.slice(1));else{var a=this.getFirstSegment();a&&a._point.isClose(s._point,n)&&t.reverse(),o=t.getLastSegment(),a&&a._point.isClose(o._point,n)?(a.setHandleIn(o._handleIn),this._add(i.slice(0,i.length-1),0)):this._add(i.slice())}t._closed&&this._add([i[0]]),t.remove()}var l=this.getFirstSegment(),c=this.getLastSegment();return l!==c&&l._point.isClose(c._point,n)&&(l.setHandleIn(c._handleIn),c.remove(),this.setClosed(!0)),this},reduce:function(t){for(var e=this.getCurves(),n=t&&t.simplify,i=n?1e-7:0,r=e.length-1;r>=0;r--){var o=e[r];!o.hasHandles()&&(!o.hasLength(i)||n&&o.isCollinear(o.getNext()))&&o.remove()}return this},reverse:function(){this._segments.reverse();for(var t=0,e=this._segments.length;t<e;t++){var n=this._segments[t],i=n._handleIn;n._handleIn=n._handleOut,n._handleOut=i,n._index=t}this._curves=null,this._changed(9)},flatten:function(t){for(var e=new Y(this,t||.25,256,!0).parts,n=e.length,i=[],r=0;r<n;r++)i.push(new z(e[r].curve.slice(0,2)));!this._closed&&n>0&&i.push(new z(e[n-1].curve.slice(6))),this.setSegments(i)},simplify:function(t){var e=new Z(this).fit(t||2.5);return e&&this.setSegments(e),!!e},smooth:function(t){var e=this,n=t||{},i=n.type||"asymmetric",r=this._segments,o=r.length,s=this._closed;function l(t,n){var i=t&&t.index;if(null!=i){var r=t.path;if(r&&r!==e)throw new Error(t._class+" "+i+" of "+r+" is not part of "+e);n&&t instanceof B&&i++}else i="number"==typeof t?t:n;return Math.min(i<0&&s?i%o:i<0?i+o:i,o-1)}var c=s&&n.from===a&&n.to===a,u=l(n.from,0),h=l(n.to,o-1);if(u>h)if(s)u-=o;else{var d=u;u=h,h=d}if(/^(?:asymmetric|continuous)$/.test(i)){var p="asymmetric"===i,f=Math.min,g=h-u+1,m=g-1,y=c?f(g,4):1,v=y,b=y,I=[];if(s||(v=f(1,u),b=f(1,o-h-1)),(m+=v+b)<=1)return;for(var A=0,M=u-v;A<=m;A++,M++)I[A]=r[(M<0?M+o:M)%o]._point;var w=I[0]._x+2*I[1]._x,C=I[0]._y+2*I[1]._y,T=2,x=m-1,S=[w],D=[C],N=[T],_=[],E=[];for(A=1;A<m;A++){var j=A<x,k=j?4:p?2:7,O=j?4:p?3:8,z=j?2:p?0:1,L=(j||p?1:2)/T;T=N[A]=k-L,w=S[A]=O*I[A]._x+z*I[A+1]._x-L*w,C=D[A]=O*I[A]._y+z*I[A+1]._y-L*C}_[x]=S[x]/N[x],E[x]=D[x]/N[x];for(A=m-2;A>=0;A--)_[A]=(S[A]-_[A+1])/N[A],E[A]=(D[A]-E[A+1])/N[A];_[m]=(3*I[m]._x-_[x])/2,E[m]=(3*I[m]._y-E[x])/2;A=v;var P=m-b;for(M=u;A<=P;A++,M++){var R=r[M<0?M+o:M],U=R._point,G=_[A]-U._x,Y=E[A]-U._y;(c||A<P)&&R.setHandleOut(G,Y),(c||A>v)&&R.setHandleIn(-G,-Y)}}else for(A=u;A<=h;A++)r[A<0?A+o:A].smooth(n,!c&&A===u,!c&&A===h)},toShape:function(t){if(!this._closed)return null;var e,n,i,r,o,s,l,c=this._segments;function u(t,e){var n=c[t],i=n.getNext(),r=c[e],o=r.getNext();return n._handleOut.isZero()&&i._handleIn.isZero()&&r._handleOut.isZero()&&o._handleIn.isZero()&&i._point.subtract(n._point).isCollinear(o._point.subtract(r._point))}function h(t){var e=c[t],n=e.getNext(),i=e._handleOut,r=n._handleIn,o=.5522847498307936;if(i.isOrthogonal(r)){var s=e._point,a=n._point,l=new T(s,i,!0).intersect(new T(a,r,!0),!0);return l&&m.isZero(i.getLength()/l.subtract(s).getLength()-o)&&m.isZero(r.getLength()/l.subtract(a).getLength()-o)}return!1}function d(t,e){return c[t]._point.getDistance(c[e]._point)}if(!this.hasHandles()&&4===c.length&&u(0,2)&&u(1,3)&&(o=c[1],s=o.getPrevious(),l=o.getNext(),s._handleOut.isZero()&&o._handleIn.isZero()&&o._handleOut.isZero()&&l._handleIn.isZero()&&o._point.subtract(s._point).isOrthogonal(l._point.subtract(o._point)))?(e=_.Rectangle,n=new I(d(0,3),d(0,1)),r=c[1]._point.add(c[2]._point).divide(2)):8===c.length&&h(0)&&h(2)&&h(4)&&h(6)&&u(1,5)&&u(3,7)?(e=_.Rectangle,i=(n=new I(d(1,6),d(0,3))).subtract(new I(d(0,7),d(1,2))).divide(2),r=c[3]._point.add(c[4]._point).divide(2)):4===c.length&&h(0)&&h(1)&&h(2)&&h(3)&&(m.isZero(d(0,2)-d(1,3))?(e=_.Circle,i=d(0,2)/2):(e=_.Ellipse,i=new I(d(2,0)/2,d(3,1)/2)),r=c[1]._point),e){var p=this.getPosition(!0),f=new e({center:p,size:n,radius:i,insert:!1});return f.copyAttributes(this,!0),f._matrix.prepend(this._matrix),f.rotate(r.subtract(p).getAngle()+90),(t===a||t)&&f.insertAbove(this),f}return null},toPath:"#clone",compare:function t(e){if(!e||e instanceof G)return t.base.call(this,e);var n=this.getCurves(),i=e.getCurves(),r=n.length,o=i.length;if(!r||!o)return r==o;for(var s,a,l=n[0].getValues(),c=[],u=0,h=0,d=0;d<o;d++){var p=i[d].getValues();if(c.push(p),m=B.getOverlaps(l,p)){s=!d&&m[0][0]>0?o-1:d,a=m[0][1];break}}var f,g=Math.abs;for(p=c[s];l&&p;){var m;if(m=B.getOverlaps(l,p))if(g(m[0][0]-h)<1e-8){1===(h=m[1][0])&&(l=++u<r?n[u].getValues():null,h=0);var y=m[0][1];if(g(y-a)<1e-8){if(f||(f=[s,y]),1===(a=m[1][1])&&(++s>=o&&(s=0),p=c[s]||i[s].getValues(),a=0),!l)return f[0]===s&&f[1]===a;continue}}break}return!1},_hitTestSelf:function(t,e,n,i){var r,o,s,a,l,c,u=this,h=this.getStyle(),d=this._segments,p=d.length,f=this._closed,g=e._tolerancePadding,m=g,y=e.stroke&&(h.hasStroke()||e.hitUnstrokedPaths),v=e.fill&&(h.hasFill()||e.hitUnfilledPaths),b=e.curves,I=y?h.getStrokeWidth()/2:v&&e.tolerance>0||b?0:null;function A(e,n){return t.subtract(e).divide(n).length<=1}function M(t,n,i){if(!e.selected||n.isSelected()){var r=t._point;if(n!==r&&(n=n.add(r)),A(n,m))return new O(i,u,{segment:t,point:n})}}function w(t,n){return(n||e.segments)&&M(t,t._point,"segment")||!n&&e.handles&&(M(t,t._handleIn,"handle-in")||M(t,t._handleOut,"handle-out"))}function C(t){a.add(t)}function T(e){var n,l=f||e._index>0&&e._index<p-1;return"round"===(l?r:o)?A(e._point,m):(a=new U({internal:!0,closed:!0}),l?e.isSmooth()||U._addBevelJoin(e,r,I,s,null,i,C,!0):"square"===o&&U._addSquareCap(e,o,I,null,i,C,!0),a.isEmpty()?void 0:a.contains(t)||(n=a.getNearestLocation(t))&&A(n.getPoint(),g))}if(null!==I&&(I>0?(r=h.getStrokeJoin(),o=h.getStrokeCap(),s=h.getMiterLimit(),m=m.add(U._getStrokePadding(I,i))):r=o="round"),!e.ends||e.segments||f){if(e.segments||e.handles)for(var x=0;x<p;x++)if(c=w(d[x]))return c}else if(c=w(d[0],!0)||w(d[p-1],!0))return c;if(null!==I){if(l=this.getNearestLocation(t)){var S=l.getTime();0===S||1===S&&p>1?T(l.getSegment())||(l=null):A(l.getPoint(),m)||(l=null)}if(!l&&"miter"===r&&p>1)for(x=0;x<p;x++){var D=d[x];if(t.getDistance(D._point)<=s*I&&T(D)){l=D.getLocation();break}}}return!l&&v&&this._contains(t)||l&&!y&&!b?new O("fill",this):l?new O(y?"stroke":"curve",this,{location:l,point:l.getPoint()}):null}},u.each(B._evaluateMethods,function(t){this[t+"At"]=function(e){var n=this.getLocationAt(e);return n&&n[t]()}},{beans:!1,getLocationOf:function(){for(var t=v.read(arguments),e=this.getCurves(),n=0,i=e.length;n<i;n++){var r=e[n].getLocationOf(t);if(r)return r}return null},getOffsetOf:function(){var t=this.getLocationOf.apply(this,arguments);return t?t.getOffset():null},getLocationAt:function(t){if("number"==typeof t){for(var e=this.getCurves(),n=0,i=0,r=e.length;i<r;i++){var o=n,s=e[i];if((n+=s.getLength())>t)return s.getLocationAt(t-o)}if(e.length>0&&t<=this.getLength())return new P(e[e.length-1],1)}else if(t&&t.getPath&&t.getPath()===this)return t;return null},getOffsetsWithTangent:function(){var t=v.read(arguments);if(t.isZero())return[];for(var e=[],n=0,i=this.getCurves(),r=0,o=i.length;r<o;r++){for(var s=i[r],a=s.getTimesWithTangent(t),l=0,c=a.length;l<c;l++){var u=n+s.getOffsetAtTime(a[l]);e.indexOf(u)<0&&e.push(u)}n+=s.length}return e}}),new function(){function t(t,e,n){var i,r,o,s,a,l,c,u,h=e._segments,d=h.length,p=new Array(6),f=!0;function g(e){if(n)e._transformCoordinates(n,p),i=p[0],r=p[1];else{var h=e._point;i=h._x,r=h._y}if(f)t.moveTo(i,r),f=!1;else{if(n)a=p[2],l=p[3];else{var d=e._handleIn;a=i+d._x,l=r+d._y}a===i&&l===r&&c===o&&u===s?t.lineTo(i,r):t.bezierCurveTo(c,u,a,l,i,r)}if(o=i,s=r,n)c=p[4],u=p[5];else{d=e._handleOut;c=o+d._x,u=s+d._y}}for(var m=0;m<d;m++)g(h[m]);e._closed&&d>0&&g(h[0])}return{_draw:function(e,n,i,r){var o=n.dontStart,s=n.dontFinish||n.clip,a=this.getStyle(),l=a.hasFill(),c=a.hasStroke(),u=a.getDashArray(),h=!dt.support.nativeDash&&c&&u&&u.length;function d(t){return u[(t%h+h)%h]}if(o||e.beginPath(),(l||c&&!h||s)&&(t(e,this,r),this._closed&&e.closePath()),!s&&(l||c)&&(this._setStyles(e,n,i,r),l&&(e.fill(a.getFillRule()),e.shadowColor="rgba(0,0,0,0)"),c)){if(h){o||e.beginPath();var p,f=new Y(this,.25,32,!1,r),g=f.length,m=-a.getDashOffset(),y=0;for(m%=g;m>0;)m-=d(y--)+d(y--);for(;m<g;)p=m+d(y++),(m>0||p>0)&&f.drawPart(e,Math.max(m,0),Math.max(p,0)),m=p+d(y++)}e.stroke()}},_drawSelected:function(e,n){e.beginPath(),t(e,this,n),e.stroke(),function(t,e,n,i,r){if(!(i<=0))for(var o,s,a=i/2,l=new Array(6),c=0,u=e.length;c<u;c++){var h=e[c],d=h._selection;h._transformCoordinates(n,l),o=l[0],s=l[1],2&d&&!r&&f(2),4&d&&!r&&f(4),t.beginPath(),t.arc(o,s,a,0,2*Math.PI,!0),t.stroke();var p=t.fillStyle;1&d||(t.fillStyle="rgba(255, 255, 255, 0.5)"),t.fill(),t.fillStyle=p}function f(e){var n=l[e],i=l[e+1];o==n&&s==i||(t.beginPath(),t.moveTo(o,s),t.lineTo(n,i),t.moveTo(n-a,i),t.lineTo(n,i+a),t.lineTo(n+a,i),t.lineTo(n,i-a),t.closePath(),t.stroke())}}(e,this._segments,n,dt.settings.handleSize,this.isFullySelected())}}},new function(){function t(t){var e=t._segments;if(!e.length)throw new Error("Use a moveTo() command first");return e[e.length-1]}return{moveTo:function(){var t=this._segments;1===t.length&&this.removeSegment(0),t.length||this._add([new z(v.read(arguments))])},moveBy:function(){throw new Error("moveBy() is unsupported on Path items.")},lineTo:function(){this._add([new z(v.read(arguments))])},cubicCurveTo:function(){var e=arguments,n=v.read(e),i=v.read(e),r=v.read(e),o=t(this);o.setHandleOut(n.subtract(o._point)),this._add([new z(r,i.subtract(r))])},quadraticCurveTo:function(){var e=arguments,n=v.read(e),i=v.read(e),r=t(this)._point;this.cubicCurveTo(n.add(r.subtract(n).multiply(1/3)),n.add(i.subtract(n).multiply(1/3)),i)},curveTo:function(){var e=arguments,n=v.read(e),i=v.read(e),r=u.pick(u.read(e),.5),o=1-r,s=t(this)._point,a=n.subtract(s.multiply(o*o)).subtract(i.multiply(r*r)).divide(2*r*o);if(a.isNaN())throw new Error("Cannot put a curve through points with parameter = "+r);this.quadraticCurveTo(a,i)},arcTo:function(){var e,n,i,r,o=arguments,s=Math.abs,a=Math.sqrt,l=t(this),c=l._point,h=v.read(o),d=u.peek(o);if("boolean"==typeof(b=u.pick(d,!0)))var p=(M=c.add(h).divide(2)).add(M.subtract(c).rotate(b?-90:90));else if(u.remain(o)<=2)p=h,h=v.read(o);else if(!c.equals(h)){var f=I.read(o),g=m.isZero;if(g(f.width)||g(f.height))return this.lineTo(h);var y=u.read(o),b=!!u.read(o),A=!!u.read(o),M=c.add(h).divide(2),w=(F=c.subtract(M).rotate(-y)).x,x=F.y,S=s(f.width),D=s(f.height),N=S*S,_=D*D,E=w*w,j=x*x,k=a(E/N+j/_);if(k>1&&(N=(S*=k)*S,_=(D*=k)*D),s(k=(N*_-N*j-_*E)/(N*j+_*E))<1e-12&&(k=0),k<0)throw new Error("Cannot create an arc with the given arguments");e=new v(S*x/D,-D*w/S).multiply((A===b?-1:1)*a(k)).rotate(y).add(M),n=(i=(r=(new C).translate(e).rotate(y).scale(S,D))._inverseTransform(c)).getDirectedAngle(r._inverseTransform(h)),!b&&n>0?n-=360:b&&n<0&&(n+=360)}if(p){var O=new T(c.add(p).divide(2),p.subtract(c).rotate(90),!0),L=new T(p.add(h).divide(2),h.subtract(p).rotate(90),!0),B=new T(c,h),P=B.getSide(p);if(!(e=O.intersect(L,!0))){if(!P)return this.lineTo(h);throw new Error("Cannot create an arc with the given arguments")}n=(i=c.subtract(e)).getDirectedAngle(h.subtract(e));var R=B.getSide(e,!0);0===R?n=P*s(n):P===R&&(n+=n<0?360:-360)}if(n){for(var U=s(n),G=U>=360?4:Math.ceil((U-1e-7)/90),Y=n/G,Z=Y*Math.PI/360,W=4/3*Math.sin(Z)/(1+Math.cos(Z)),Q=[],H=0;H<=G;H++){var F=h,V=null;if(H<G&&(V=i.rotate(90).multiply(W),r?(F=r._transformPoint(i),V=r._transformPoint(i.add(V)).subtract(F)):F=e.add(i)),H){var q=i.rotate(-90).multiply(W);r&&(q=r._transformPoint(i.add(q)).subtract(F)),Q.push(new z(F,q,V))}else l.setHandleOut(V);i=i.rotate(Y)}this._add(Q)}},lineBy:function(){var e=v.read(arguments),n=t(this)._point;this.lineTo(n.add(e))},curveBy:function(){var e=arguments,n=v.read(e),i=v.read(e),r=u.read(e),o=t(this)._point;this.curveTo(o.add(n),o.add(i),r)},cubicCurveBy:function(){var e=arguments,n=v.read(e),i=v.read(e),r=v.read(e),o=t(this)._point;this.cubicCurveTo(o.add(n),o.add(i),o.add(r))},quadraticCurveBy:function(){var e=arguments,n=v.read(e),i=v.read(e),r=t(this)._point;this.quadraticCurveTo(r.add(n),r.add(i))},arcBy:function(){var e=arguments,n=t(this)._point,i=n.add(v.read(e)),r=u.pick(u.peek(e),!0);"boolean"==typeof r?this.arcTo(i,r):this.arcTo(i,n.add(v.read(e)))},closePath:function(t){this.setClosed(!0),this.join(this,t)}}},{_getBounds:function(t,e){var n=e.handle?"getHandleBounds":e.stroke?"getStrokeBounds":"getBounds";return U[n](this._segments,this._closed,this,t,e)},statics:{getBounds:function(t,e,n,i,r,o){var s=t[0];if(!s)return new M;var a=new Array(6),l=s._transformCoordinates(i,new Array(6)),c=l.slice(0,2),u=c.slice(),h=new Array(2);function d(t){t._transformCoordinates(i,a);for(var e=0;e<2;e++)B._addBounds(l[e],l[e+4],a[e+2],a[e],e,o?o[e]:0,c,u,h);var n=l;l=a,a=n}for(var p=1,f=t.length;p<f;p++)d(t[p]);return e&&d(s),new M(c[0],c[1],u[0]-c[0],u[1]-c[1])},getStrokeBounds:function(t,e,n,i,r){var o=n.getStyle(),s=o.hasStroke(),a=o.getStrokeWidth(),l=s&&n._getStrokeMatrix(i,r),c=s&&U._getStrokePadding(a,l),u=U.getBounds(t,e,n,i,r,c);if(!s)return u;var h=a/2,d=o.getStrokeJoin(),p=o.getStrokeCap(),f=o.getMiterLimit(),g=new M(new I(c));function m(t){u=u.include(t)}function y(t){u=u.unite(g.setCenter(t._point.transform(i)))}function v(t,e){"round"===e||t.isSmooth()?y(t):U._addBevelJoin(t,e,h,f,i,l,m)}function b(t,e){"round"===e?y(t):U._addSquareCap(t,e,h,i,l,m)}var A=t.length-(e?0:1);if(A>0){for(var w=1;w<A;w++)v(t[w],d);e?v(t[0],d):(b(t[0],p),b(t[t.length-1],p))}return u},_getStrokePadding:function(t,e){if(!e)return[t,t];var n=new v(t,0).transform(e),i=new v(0,t).transform(e),r=n.getAngleInRadians(),o=n.getLength(),s=i.getLength(),a=Math.sin(r),l=Math.cos(r),c=Math.tan(r),u=Math.atan2(s*c,o),h=Math.atan2(s,c*o);return[Math.abs(o*Math.cos(u)*l+s*Math.sin(u)*a),Math.abs(s*Math.sin(h)*l+o*Math.cos(h)*a)]},_addBevelJoin:function(t,e,n,i,r,o,s,a){var l=t.getCurve(),c=l.getPrevious(),u=l.getPoint1().transform(r),h=c.getNormalAtTime(1).multiply(n).transform(o),d=l.getNormalAtTime(0).multiply(n).transform(o),p=h.getDirectedAngle(d);if((p<0||p>=180)&&(h=h.negate(),d=d.negate()),a&&s(u),s(u.add(h)),"miter"===e){var f=new T(u.add(h),new v(-h.y,h.x),!0).intersect(new T(u.add(d),new v(-d.y,d.x),!0),!0);f&&u.getDistance(f)<=i*n&&s(f)}s(u.add(d))},_addSquareCap:function(t,e,n,i,r,o,s){var a=t._point.transform(i),l=t.getLocation(),c=l.getNormal().multiply(0===l.getTime()?n:-n).transform(r);"square"===e&&(s&&(o(a.subtract(c)),o(a.add(c))),a=a.add(c.rotate(-90))),o(a.add(c)),o(a.subtract(c))},getHandleBounds:function(t,e,n,i,r){var o,s,a=n.getStyle();if(r.stroke&&a.hasStroke()){var l=n._getStrokeMatrix(i,r),c=a.getStrokeWidth()/2,u=c;"miter"===a.getStrokeJoin()&&(u=c*a.getMiterLimit()),"square"===a.getStrokeCap()&&(u=Math.max(u,c*Math.SQRT2)),o=U._getStrokePadding(c,l),s=U._getStrokePadding(u,l)}for(var h=new Array(6),d=1/0,p=-d,f=d,g=p,m=0,y=t.length;m<y;m++){t[m]._transformCoordinates(i,h);for(var v=0;v<6;v+=2){var b=v?o:s,I=b?b[0]:0,A=b?b[1]:0,w=h[v],C=h[v+1],T=w-I,x=w+I,S=C-A,D=C+A;T<d&&(d=T),x>p&&(p=x),S<f&&(f=S),D>g&&(g=D)}}return new M(d,f,p-d,g-f)}}});U.inject({statics:new function(){var t=.5522847498307936,e=[new z([-1,0],[0,t],[0,-t]),new z([0,-1],[-t,0],[t,0]),new z([1,0],[0,-t],[0,t]),new z([0,1],[t,0],[-t,0])];function n(t,e,n){var i=u.getNamed(n),r=new U(i&&0==i.insert&&S.NO_INSERT);return r._add(t),r._closed=e,r.set(i,{insert:!0})}function i(t,i,r){for(var o=new Array(4),s=0;s<4;s++){var a=e[s];o[s]=new z(a._point.multiply(i).add(t),a._handleIn.multiply(i),a._handleOut.multiply(i))}return n(o,!0,r)}return{Line:function(){var t=arguments;return n([new z(v.readNamed(t,"from")),new z(v.readNamed(t,"to"))],!1,t)},Circle:function(){var t=arguments,e=v.readNamed(t,"center"),n=u.readNamed(t,"radius");return i(e,new I(n),t)},Rectangle:function(){var e,i=arguments,r=M.readNamed(i,"rectangle"),o=I.readNamed(i,"radius",0,{readNull:!0}),s=r.getBottomLeft(!0),a=r.getTopLeft(!0),l=r.getTopRight(!0),c=r.getBottomRight(!0);if(!o||o.isZero())e=[new z(s),new z(a),new z(l),new z(c)];else{var u=(o=I.min(o,r.getSize(!0).divide(2))).width,h=o.height,d=u*t,p=h*t;e=[new z(s.add(u,0),null,[-d,0]),new z(s.subtract(0,h),[0,p]),new z(a.add(0,h),null,[0,-p]),new z(a.add(u,0),[-d,0],null),new z(l.subtract(u,0),null,[d,0]),new z(l.add(0,h),[0,-p],null),new z(c.subtract(0,h),null,[0,p]),new z(c.subtract(u,0),[d,0])]}return n(e,!0,i)},RoundRectangle:"#Rectangle",Ellipse:function(){var t=arguments,e=_._readEllipse(t);return i(e.center,e.radius,t)},Oval:"#Ellipse",Arc:function(){var t=arguments,e=v.readNamed(t,"from"),n=v.readNamed(t,"through"),i=v.readNamed(t,"to"),r=u.getNamed(t),o=new U(r&&0==r.insert&&S.NO_INSERT);return o.moveTo(e),o.arcTo(n,i),o.set(r)},RegularPolygon:function(){for(var t=arguments,e=v.readNamed(t,"center"),i=u.readNamed(t,"sides"),r=u.readNamed(t,"radius"),o=360/i,s=i%3==0,a=new v(0,s?-r:r),l=s?-1:.5,c=new Array(i),h=0;h<i;h++)c[h]=new z(e.add(a.rotate((h+l)*o)));return n(c,!0,t)},Star:function(){for(var t=arguments,e=v.readNamed(t,"center"),i=2*u.readNamed(t,"points"),r=u.readNamed(t,"radius1"),o=u.readNamed(t,"radius2"),s=360/i,a=new v(0,-1),l=new Array(i),c=0;c<i;c++)l[c]=new z(e.add(a.rotate(s*c).multiply(c%2?o:r)));return n(l,!0,t)}}}});var G=R.extend({_class:"CompoundPath",_serializeFields:{children:[]},beans:!0,initialize:function(t){this._children=[],this._namedChildren={},this._initialize(t)||("string"==typeof t?this.setPathData(t):this.addChildren(Array.isArray(t)?t:arguments))},insertChildren:function t(e,n){var i=n,r=i[0];r&&"number"==typeof r[0]&&(i=[i]);for(var o=n.length-1;o>=0;o--){var s=i[o];i!==n||s instanceof U||(i=u.slice(i)),Array.isArray(s)?i[o]=new U({segments:s,insert:!1}):s instanceof G&&(i.splice.apply(i,[o,1].concat(s.removeChildren())),s.remove())}return t.base.call(this,e,i)},reduce:function t(e){for(var n=this._children,i=n.length-1;i>=0;i--){var r;(r=n[i].reduce(e)).isEmpty()&&r.remove()}return n.length?t.base.call(this):((r=new U(S.NO_INSERT)).copyAttributes(this),r.insertAbove(this),this.remove(),r)},isClosed:function(){for(var t=this._children,e=0,n=t.length;e<n;e++)if(!t[e]._closed)return!1;return!0},setClosed:function(t){for(var e=this._children,n=0,i=e.length;n<i;n++)e[n].setClosed(t)},getFirstSegment:function(){var t=this.getFirstChild();return t&&t.getFirstSegment()},getLastSegment:function(){var t=this.getLastChild();return t&&t.getLastSegment()},getCurves:function(){for(var t=this._children,e=[],n=0,i=t.length;n<i;n++)u.push(e,t[n].getCurves());return e},getFirstCurve:function(){var t=this.getFirstChild();return t&&t.getFirstCurve()},getLastCurve:function(){var t=this.getLastChild();return t&&t.getLastCurve()},getArea:function(){for(var t=this._children,e=0,n=0,i=t.length;n<i;n++)e+=t[n].getArea();return e},getLength:function(){for(var t=this._children,e=0,n=0,i=t.length;n<i;n++)e+=t[n].getLength();return e},getPathData:function(t,e){for(var n=this._children,i=[],r=0,o=n.length;r<o;r++){var s=n[r],a=s._matrix;i.push(s.getPathData(t&&!a.isIdentity()?t.appended(a):t,e))}return i.join("")},_hitTestChildren:function t(e,n,i){return t.base.call(this,e,n.class===U||"path"===n.type||n.hitUnfilledPaths?n:u.set({},n,{fill:!1}),i)},_draw:function(t,e,n,i){var r=this._children;if(r.length){e=e.extend({dontStart:!0,dontFinish:!0}),t.beginPath();for(var o=0,s=r.length;o<s;o++)r[o].draw(t,e,i);if(!e.clip){this._setStyles(t,e,n,i);var a=this._style;a.hasFill()&&(t.fill(a.getFillRule()),t.shadowColor="rgba(0,0,0,0)"),a.hasStroke()&&t.stroke()}}},_drawSelected:function(t,e,n){for(var i=this._children,r=0,o=i.length;r<o;r++){var s=i[r],a=s._matrix;n[s._id]||s._drawSelected(t,a.isIdentity()?e:e.appended(a))}}},new function(){function t(t,e){var n=t._children;if(e&&!n.length)throw new Error("Use a moveTo() command first");return n[n.length-1]}return u.each(["lineTo","cubicCurveTo","quadraticCurveTo","curveTo","arcTo","lineBy","cubicCurveBy","quadraticCurveBy","curveBy","arcBy"],function(e){this[e]=function(){var n=t(this,!0);n[e].apply(n,arguments)}},{moveTo:function(){var e=t(this),n=e&&e.isEmpty()?e:new U(S.NO_INSERT);n!==e&&this.addChild(n),n.moveTo.apply(n,arguments)},moveBy:function(){var e=t(this,!0),n=e&&e.getLastSegment(),i=v.read(arguments);this.moveTo(n?i.add(n._point):i)},closePath:function(e){t(this,!0).closePath(e)}})},u.each(["reverse","flatten","simplify","smooth"],function(t){this[t]=function(e){for(var n,i=this._children,r=0,o=i.length;r<o;r++)n=i[r][t](e)||n;return n}},{}));R.inject(new function(){var t=Math.min,e=Math.max,n=Math.abs,i={unite:{1:!0,2:!0},intersect:{2:!0},subtract:{1:!0},exclude:{1:!0,"-1":!0}};function r(t){return t._children||[t]}function o(t,e){var n=t.clone(!1).reduce({simplify:!0}).transform(null,!0,!0);if(e){for(var i=r(n),o=0,s=i.length;o<s;o++){(t=i[o])._closed||t.isEmpty()||(t.closePath(1e-12),t.getFirstSegment().setHandleIn(0,0),t.getLastSegment().setHandleOut(0,0))}n=n.resolveCrossings().reorient("nonzero"===n.getFillRule(),!0)}return n}function s(t,e,n,i,r){var o=new G(S.NO_INSERT);return o.addChildren(t,!0),o=o.reduce({simplify:e}),r&&0==r.insert||o.insertAbove(i&&n.isSibling(i)&&n.getIndex()<i.getIndex()?i:n),o.copyAttributes(n,!0),o}function l(t){return t.hasOverlap()||t.isCrossing()}function c(t,e,n,a){if(a&&(0==a.trace||a.stroke)&&/^(subtract|intersect)$/.test(n))return h(t,e,n);var c=o(t,!0),d=e&&t!==e&&o(e,!0),p=i[n];p[n]=!0,d&&(p.subtract||p.exclude)^d.isClockwise()^c.isClockwise()&&d.reverse();var m,v=y(P.expand(c.getIntersections(d,l))),A=r(c),M=d&&r(d),w=[],C=[];function T(t){for(var e=0,n=t.length;e<n;e++){var i=t[e];u.push(w,i._segments),u.push(C,i.getCurves()),i._overlapsOnly=!0}}function x(t){for(var e=[],n=0,i=t&&t.length;n<i;n++)e.push(C[t[n]]);return e}if(v.length){T(A),M&&T(M);for(var S=new Array(C.length),D=0,N=C.length;D<N;D++)S[D]=C[D].getValues();var _=f.findCurveBoundsCollisions(S,S,0,!0),E={};for(D=0;D<C.length;D++){var j=C[D],k=j._path._id;(E[k]=E[k]||{})[j.getIndex()]={hor:x(_[D].hor),ver:x(_[D].ver)}}for(D=0,N=v.length;D<N;D++)b(v[D]._segment,c,d,E,p);for(D=0,N=w.length;D<N;D++){var O=w[D],z=O._intersection;O._winding||b(O,c,d,E,p),z&&z._overlap||(O._path._overlapsOnly=!1)}m=I(w,p)}else m=g(M?A.concat(M):A.slice(),function(t){return!!p[t]});return s(m,!0,t,e,a)}function h(t,e,n){var i=o(t),r=o(e),a=i.getIntersections(r,l),c="subtract"===n,u="divide"===n,h={},d=[];function p(t){if(!h[t._id]&&(u||r.contains(t.getPointAt(t.getLength()/2))^c))return d.unshift(t),h[t._id]=!0}for(var f=a.length-1;f>=0;f--){var g=a[f].split();g&&(p(g)&&g.getFirstSegment().setHandleIn(0,0),i.getLastSegment().setHandleOut(0,0))}return p(i),s(d,!1,t,e)}function d(t,e){for(var n=t;n;){if(n===e)return;n=n._previous}for(;t._next&&t._next!==e;)t=t._next;if(!t._next){for(;e._previous;)e=e._previous;t._next=e,e._previous=t}}function p(t){for(var e=t.length-1;e>=0;e--)t[e].clearHandles()}function g(t,e,i){var r=t&&t.length;if(r){var o=u.each(t,function(t,e){this[t._id]={container:null,winding:t.isClockwise()?1:-1,index:e}},{}),s=t.slice().sort(function(t,e){return n(e.getArea())-n(t.getArea())}),a=s[0],l=f.findItemBoundsCollisions(s,null,m.GEOMETRIC_EPSILON);null==i&&(i=a.isClockwise());for(var c=0;c<r;c++){var h=s[c],d=o[h._id],p=0,g=l[c];if(g)for(var y=null,v=g.length-1;v>=0;v--)if(g[v]<c){y=y||h.getInteriorPoint();var b=s[g[v]];if(b.contains(y)){var I=o[b._id];p=I.winding,d.winding+=p,d.container=I.exclude?I.container:b;break}}if(e(d.winding)===e(p))d.exclude=!0,t[d.index]=null;else{var A=d.container;h.setClockwise(A?!A.isClockwise():i)}}}return t}function y(t,e,n){var i,r,o,s=e&&[],a=1e-8,l=1-a,c=!1,u=n||[],h=n&&{};function f(t){return t._path._id+"."+t._segment1._index}for(var g=(n&&n.length)-1;g>=0;g--){(m=n[g])._path&&(h[f(m)]=!0)}for(g=t.length-1;g>=0;g--){var m,y,v=t[g],b=v._time,I=b,A=e&&!e(v);if((m=v._curve)&&(m!==r?(c=!m.hasHandles()||h&&h[f(m)],i=[],o=null,r=m):o>=a&&(b/=o)),A)i&&i.push(v);else{if(e&&s.unshift(v),o=I,b<a)y=m._segment1;else if(b>l)y=m._segment2;else{var M=m.divideAtTime(b,!0);c&&u.push(m,M),y=M._segment1;for(var w=i.length-1;w>=0;w--){var C=i[w];C._time=(C._time-b)/(1-b)}}v._setSegment(y);var T=y._intersection,x=v._intersection;if(T){d(T,x);for(var S=T;S;)d(S._intersection,T),S=S._next}else y._intersection=x}}return n||p(u),s||t}function v(i,r,o,s,a){var l,c,u=Array.isArray(r)?r:r[o?"hor":"ver"],h=o?1:0,d=1^h,p=[i.x,i.y],f=p[h],g=p[d],m=1e-6,y=f-1e-9,b=f+1e-9,I=0,A=0,M=0,w=0,C=!1,T=!1,x=1,S=[];function D(n){var c=n[d+0],u=n[d+6];if(!(g<t(c,u)||g>e(c,u))){var p=n[h+0],I=n[h+2],A=n[h+4],T=n[h+6];if(c!==u){var D=g===c?0:g===u||y>e(p,I,A,T)||b<t(p,I,A,T)?1:B.solveCubic(n,d,g,S,0,1)>0?S[0]:1,N=0===D?p:1===D?T:B.getPoint(n,D)[o?"y":"x"],_=c>u?1:-1,E=l[d]>l[d+6]?1:-1,j=l[h+6];return g!==c?(N<y?M+=_:N>b?w+=_:C=!0,N>f-m&&N<f+m&&(x/=2)):(_!==E?p<y?M+=_:p>b&&(w+=_):p!=j&&(j<b&&N>b?(w+=_,C=!0):j>y&&N<y&&(M+=_,C=!0)),x/=4),l=n,!a&&N>y&&N<b&&0===B.getTangent(n,D)[o?"x":"y"]&&v(i,r,!o,s,!0)}(p<b&&T>y||T<b&&p>y)&&(C=!0)}}function N(n){var i=n[d+0],r=n[d+2],s=n[d+4],a=n[d+6];if(g<=e(i,r,s,a)&&g>=t(i,r,s,a))for(var l,c=n[h+0],u=n[h+2],p=n[h+4],f=n[h+6],m=y>e(c,u,p,f)||b<t(c,u,p,f)?[n]:B.getMonoCurves(n,o),v=0,I=m.length;v<I;v++)if(l=D(m[v]))return l}for(var _=0,E=u.length;_<E;_++){var j,k=u[_],O=k._path,z=k.getValues();if(!(_&&u[_-1]._path===O||(l=null,O._closed||(c=B.getValues(O.getLastCurve().getSegment2(),k.getSegment1(),null,!s))[d]!==c[d+6]&&(l=c),l))){l=z;for(var L=O.getLastCurve();L&&L!==k;){var P=L.getValues();if(P[d]!==P[d+6]){l=P;break}L=L.getPrevious()}}if(j=N(z))return j;if(_+1===E||u[_+1]._path!==O){if(c&&(j=N(c)))return j;!C||M||w||(M=w=O.isClockwise(s)^o?1:-1),I+=M,A+=w,M=w=0,C&&(T=!0,C=!1),c=null}}return I=n(I),A=n(A),{winding:e(I,A),windingL:I,windingR:A,quality:x,onPath:T}}function b(t,e,i,r,o){var s=[],a=t,l=0;do{if(b=t.getCurve()){var c=b.getLength();s.push({segment:t,curve:b,length:c}),l+=c}t=t.getNext()}while(t&&!t._intersection&&t!==a);for(var u=[.5,.25,.75],h={winding:0,quality:-1},d=0;d<u.length&&h.quality<.5;d++){c=l*u[d];for(var p=0,f=s.length;p<f;p++){var g=s[p],y=g.length;if(c<=y){var b,I=(b=g.curve)._path,A=I._parent,M=A instanceof G?A:I,w=m.clamp(b.getTimeAt(c),.001,.999),C=b.getPointAtTime(w),T=n(b.getTangentAtTime(w).y)<Math.SQRT1_2,x=null;if(o.subtract&&i){var S=(M===e?i:e)._getWinding(C,T,!0);if(M===e&&S.winding||M===i&&!S.winding){if(S.quality<1)continue;x={winding:0,quality:1}}}(x=x||v(C,r[I._id][b.getIndex()],T,!0)).quality>h.quality&&(h=x);break}c-=y}}for(p=s.length-1;p>=0;p--)s[p].segment._winding=h}function I(t,e){var n,i=[];function r(t){var n;return!(!t||t._visited||e&&(!e[(n=t._winding||{}).winding]||e.unite&&2===n.winding&&n.windingL&&n.windingR))}function o(t){if(t)for(var e=0,i=n.length;e<i;e++)if(t===n[e])return!0;return!1}function s(t){for(var e=t._segments,n=0,i=e.length;n<i;n++)e[n]._visited=!0}function a(t,e){var i=t._intersection,s=i,a=[];function l(i,s){for(;i&&i!==s;){var l=i._segment,c=l&&l._path;if(c){var u=l.getNext()||c.getFirstSegment(),h=u._intersection;l!==t&&(o(l)||o(u)||u&&r(l)&&(r(u)||h&&r(h._segment)))&&a.push(l),e&&n.push(l)}i=i._next}}if(e&&(n=[t]),i){for(l(i);i&&i._previous;)i=i._previous;l(i,s)}return a}t.sort(function(t,e){var n=t._intersection,i=e._intersection,r=!(!n||!n._overlap),o=!(!i||!i._overlap),s=t._path,a=e._path;return r^o?r?1:-1:!n^!i?n?1:-1:s!==a?s._id-a._id:t._index-e._index});for(var l=0,c=t.length;l<c;l++){var u,h,d,p=t[l],f=r(p),g=null,m=!1,y=!0,v=[];if(f&&p._path._overlapsOnly){var b=p._path,I=p._intersection._segment._path;b.compare(I)&&(b.getArea()&&i.push(b.clone(!1)),s(b),s(I),f=!1)}for(;f;){var A=!g,M=a(p,A),w=M.shift(),C=!(m=!A&&(o(p)||o(w)))&&w;if(A&&(g=new U(S.NO_INSERT),u=null),m){(p.isFirst()||p.isLast())&&(y=p._path._closed),p._visited=!0;break}if(C&&u&&(v.push(u),u=null),u||(C&&M.push(p),u={start:g._segments.length,crossings:M,visited:h=[],handleIn:d}),C&&(p=w),!r(p)){g.removeSegments(u.start);for(var T=0,x=h.length;T<x;T++)h[T]._visited=!1;h.length=0;do{(p=u&&u.crossings.shift())&&p._path||(p=null,(u=v.pop())&&(h=u.visited,d=u.handleIn))}while(u&&!r(p));if(!p)break}var D=p.getNext();g.add(new z(p._point,d,D&&p._handleOut)),p._visited=!0,h.push(p),p=D||p._path.getFirstSegment(),d=D&&D._handleIn}m&&(y&&(g.getFirstSegment().setHandleIn(d),g.setClosed(y)),0!==g.getArea()&&i.push(g))}return i}return{_getWinding:function(t,e,n){return v(t,this.getCurves(),e,n)},unite:function(t,e){return c(this,t,"unite",e)},intersect:function(t,e){return c(this,t,"intersect",e)},subtract:function(t,e){return c(this,t,"subtract",e)},exclude:function(t,e){return c(this,t,"exclude",e)},divide:function(t,e){return e&&(0==e.trace||e.stroke)?h(this,t,"divide"):s([this.subtract(t,e),this.intersect(t,e)],!0,this,t,e)},resolveCrossings:function(){var t=this._children,e=t||[this];function n(t,e){var n=t&&t._intersection;return n&&n._overlap&&n._path===e}var i=!1,r=!1,o=this.getIntersections(null,function(t){return t.hasOverlap()&&(i=!0)||t.isCrossing()&&(r=!0)}),s=i&&r&&[];if(o=P.expand(o),i)for(var a=y(o,function(t){return t.hasOverlap()},s),l=a.length-1;l>=0;l--){var c=a[l],h=c._path,d=c._segment,f=d.getPrevious(),g=d.getNext();n(f,h)&&n(g,h)&&(d.remove(),f._handleOut._set(0,0),g._handleIn._set(0,0),f===d||f.getCurve().hasLength()||(g._handleIn.set(f._handleIn),f.remove()))}r&&(y(o,i&&function(t){var e=t.getCurve(),n=t.getSegment(),i=t._intersection,r=i._curve,o=i._segment;if(e&&r&&e._path&&r._path)return!0;n&&(n._intersection=null),o&&(o._intersection=null)},s),s&&p(s),e=I(u.each(e,function(t){u.push(this,t._segments)},[])));var m,v=e.length;return v>1&&t?(e!==t&&this.setChildren(e),m=this):1!==v||t||(e[0]!==this&&this.setSegments(e[0].removeSegments()),m=this),m||((m=new G(S.NO_INSERT)).addChildren(e),(m=m.reduce()).copyAttributes(this),this.replaceWith(m)),m},reorient:function(t,e){var n=this._children;return n&&n.length?this.setChildren(g(this.removeChildren(),function(e){return!!(t?e:1&e)},e)):e!==a&&this.setClockwise(e),this},getInteriorPoint:function(){var n=this.getBounds().getCenter(!0);if(!this.contains(n)){for(var i=this.getCurves(),r=n.y,o=[],s=[],a=0,l=i.length;a<l;a++){var c=i[a].getValues(),u=c[1],h=c[3],d=c[5],p=c[7];if(r>=t(u,h,d,p)&&r<=e(u,h,d,p))for(var f=B.getMonoCurves(c),g=0,m=f.length;g<m;g++){var y=f[g],v=y[1],b=y[7];if(v!==b&&(r>=v&&r<=b||r>=b&&r<=v)){var I=r===v?y[0]:r===b?y[6]:1===B.solveCubic(y,1,r,s,0,1)?B.getPoint(y,s[0]).x:(y[0]+y[6])/2;o.push(I)}}}o.length>1&&(o.sort(function(t,e){return t-e}),n.x=(o[0]+o[1])/2)}return n}}});var Y=u.extend({_class:"PathFlattener",initialize:function(t,e,n,i,r){var o,s=[],a=[],l=0,c=1/(n||32),u=t._segments,h=u[0];function d(t,e){var n=B.getValues(t,e,r);s.push(n),p(n,t._index,0,1)}function p(t,n,r,o){if(!(o-r>c)||i&&B.isStraight(t)||B.isFlatEnough(t,e||.25)){var s=t[6]-t[0],u=t[7]-t[1],h=Math.sqrt(s*s+u*u);h>0&&(l+=h,a.push({offset:l,curve:t,index:n,time:o}))}else{var d=B.subdivide(t,.5),f=(r+o)/2;p(d[0],n,r,f),p(d[1],n,f,o)}}for(var f=1,g=u.length;f<g;f++)d(h,o=u[f]),h=o;t._closed&&d(o||h,u[0]),this.curves=s,this.parts=a,this.length=l,this.index=0},_get:function(t){for(var e,n=this.parts,i=n.length,r=this.index;e=r,r&&!(n[--r].offset<t););for(;e<i;e++){var o=n[e];if(o.offset>=t){this.index=e;var s=n[e-1],a=s&&s.index===o.index?s.time:0,l=s?s.offset:0;return{index:o.index,time:a+(o.time-a)*(t-l)/(o.offset-l)}}}return{index:n[i-1].index,time:1}},drawPart:function(t,e,n){for(var i=this._get(e),r=this._get(n),o=i.index,s=r.index;o<=s;o++){var a=B.getPart(this.curves[o],o===i.index?i.time:0,o===r.index?r.time:1);o===i.index&&t.moveTo(a[0],a[1]),t.bezierCurveTo.apply(t,a.slice(2))}}},u.each(B._evaluateMethods,function(t){this[t+"At"]=function(e){var n=this._get(e);return B[t](this.curves[n.index],n.time)}},{})),Z=u.extend({initialize:function(t){for(var e,n=this.points=[],i=t._segments,r=t._closed,o=0,s=i.length;o<s;o++){var a=i[o].point;e&&e.equals(a)||n.push(e=a.clone())}r&&(n.unshift(n[n.length-1]),n.push(n[1])),this.closed=r},fit:function(t){var e=this.points,n=e.length,i=null;return n>0&&(i=[new z(e[0])],n>1&&(this.fitCubic(i,t,0,n-1,e[1].subtract(e[0]),e[n-2].subtract(e[n-1])),this.closed&&(i.shift(),i.pop()))),i},fitCubic:function(t,e,n,i,r,o){var s=this.points;if(i-n!==1){for(var a,l=this.chordLengthParameterize(n,i),c=Math.max(e,e*e),u=!0,h=0;h<=4;h++){var d=this.generateBezier(n,i,l,r,o),p=this.findMaxError(n,i,d,l);if(p.error<e&&u)return void this.addCurve(t,d);if(a=p.index,p.error>=c)break;u=this.reparameterize(n,i,l,d),c=p.error}var f=s[a-1].subtract(s[a+1]);this.fitCubic(t,e,n,a,r,f),this.fitCubic(t,e,a,i,f.negate(),o)}else{var g=s[n],m=s[i],y=g.getDistance(m)/3;this.addCurve(t,[g,g.add(r.normalize(y)),m.add(o.normalize(y)),m])}},addCurve:function(t,e){t[t.length-1].setHandleOut(e[1].subtract(e[0])),t.push(new z(e[3],e[2].subtract(e[3])))},generateBezier:function(t,e,n,i,r){for(var o=1e-12,s=Math.abs,a=this.points,l=a[t],c=a[e],u=[[0,0],[0,0]],h=[0,0],d=0,p=e-t+1;d<p;d++){var f=n[d],g=1-f,m=3*f*g,y=g*g*g,v=m*g,b=m*f,I=f*f*f,A=i.normalize(v),M=r.normalize(b),w=a[t+d].subtract(l.multiply(y+v)).subtract(c.multiply(b+I));u[0][0]+=A.dot(A),u[0][1]+=A.dot(M),u[1][0]=u[0][1],u[1][1]+=M.dot(M),h[0]+=A.dot(w),h[1]+=M.dot(w)}var C,T,x=u[0][0]*u[1][1]-u[1][0]*u[0][1];if(s(x)>o){var S=u[0][0]*h[1]-u[1][0]*h[0];C=(h[0]*u[1][1]-h[1]*u[0][1])/x,T=S/x}else{var D=u[0][0]+u[0][1],N=u[1][0]+u[1][1];C=T=s(D)>o?h[0]/D:s(N)>o?h[1]/N:0}var _,E,j=c.getDistance(l),k=o*j;if(C<k||T<k)C=T=j/3;else{var O=c.subtract(l);_=i.normalize(C),E=r.normalize(T),_.dot(O)-E.dot(O)>j*j&&(C=T=j/3,_=E=null)}return[l,l.add(_||i.normalize(C)),c.add(E||r.normalize(T)),c]},reparameterize:function(t,e,n,i){for(var r=t;r<=e;r++)n[r-t]=this.findRoot(i,this.points[r],n[r-t]);r=1;for(var o=n.length;r<o;r++)if(n[r]<=n[r-1])return!1;return!0},findRoot:function(t,e,n){for(var i=[],r=[],o=0;o<=2;o++)i[o]=t[o+1].subtract(t[o]).multiply(3);for(o=0;o<=1;o++)r[o]=i[o+1].subtract(i[o]).multiply(2);var s=this.evaluate(3,t,n),a=this.evaluate(2,i,n),l=this.evaluate(1,r,n),c=s.subtract(e),u=a.dot(a)+c.dot(l);return m.isMachineZero(u)?n:n-c.dot(a)/u},evaluate:function(t,e,n){for(var i=e.slice(),r=1;r<=t;r++)for(var o=0;o<=t-r;o++)i[o]=i[o].multiply(1-n).add(i[o+1].multiply(n));return i[0]},chordLengthParameterize:function(t,e){for(var n=[0],i=t+1;i<=e;i++)n[i-t]=n[i-t-1]+this.points[i].getDistance(this.points[i-1]);i=1;for(var r=e-t;i<=r;i++)n[i]/=n[r];return n},findMaxError:function(t,e,n,i){for(var r=Math.floor((e-t+1)/2),o=0,s=t+1;s<e;s++){var a=this.evaluate(3,n,i[s-t]).subtract(this.points[s]),l=a.x*a.x+a.y*a.y;l>=o&&(o=l,r=s)}return{error:o,index:r}}}),W=S.extend({_class:"TextItem",_applyMatrix:!1,_canApplyMatrix:!1,_serializeFields:{content:null},_boundsOptions:{stroke:!1,handle:!1},initialize:function(t){this._content="",this._lines=[];var e=t&&u.isPlainObject(t)&&t.x===a&&t.y===a;this._initialize(e&&t,!e&&v.read(arguments))},_equals:function(t){return this._content===t._content},copyContent:function(t){this.setContent(t._content)},getContent:function(){return this._content},setContent:function(t){this._content=""+t,this._lines=this._content.split(/\r\n|\n|\r/gm),this._changed(521)},isEmpty:function(){return!this._content},getCharacterStyle:"#getStyle",setCharacterStyle:"#setStyle",getParagraphStyle:"#getStyle",setParagraphStyle:"#setStyle"}),Q=W.extend({_class:"PointText",initialize:function(){W.apply(this,arguments)},getPoint:function(){var t=this._matrix.getTranslation();return new b(t.x,t.y,this,"setPoint")},setPoint:function(){var t=v.read(arguments);this.translate(t.subtract(this._matrix.getTranslation()))},_draw:function(t,e,n){if(this._content){this._setStyles(t,e,n);var i=this._lines,r=this._style,o=r.hasFill(),s=r.hasStroke(),a=r.getLeading(),l=t.shadowColor;t.font=r.getFontStyle(),t.textAlign=r.getJustification();for(var c=0,u=i.length;c<u;c++){t.shadowColor=l;var h=i[c];o&&(t.fillText(h,0,0),t.shadowColor="rgba(0,0,0,0)"),s&&t.strokeText(h,0,0),t.translate(0,a)}}},_getBounds:function(t,e){var n=e.drawnTextBounds?this._getDrawnTextSize():this._getMeasuredTextSize();return t?t._transformBounds(n,n):n},_getMeasuredTextSize:function(){var t=this._style,e=this._lines,n=e.length,i=t.getJustification(),r=t.getLeading(),o=this.getView().getTextWidth(t.getFontStyle(),e),s=0;return"left"!==i&&(s-=o/("center"===i?2:1)),new M(s,n?-.75*r:0,o,n*r)},_getDrawnTextSize:function(){var t=this._style,e=this._lines,n=e.length,i=t.getLeading(),r=t.getJustification(),o=ut.create("svg",{version:"1.1",xmlns:ut.svg}),s=ut.create("text");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),o.appendChild(s);for(var a=0;a<n;a++){var l=ut.create("tspan",{x:"0",dy:0===a?"0":i+"px"});l.textContent=this._lines[a],s.appendChild(l)}var u,h=c.createElement("span");h.style.visibility="hidden",h.style.whiteSpace="pre",h.style.fontSize=this.fontSize+"px",h.style.fontFamily=this.font,h.style.lineHeight=this.leading/this.fontSize;try{h.appendChild(o),c.body.appendChild(h),u=o.getBBox()}finally{c.body.removeChild(h)}var d=this.strokeWidth/2,p=u.width+2*d,f=u.height+2*d,g=u.x-d,m=u.y-d;"left"!==r&&(g-=this.getView().getTextWidth(t.getFontStyle(),e)/("center"===r?2:1));return new M(g,m,p+1,Math.max(f,n*i))},_hitTestSelf:function(t,e){if(e.fill&&(this.hasFill()||e.hitUnfilledPaths)&&this._contains(t))return new O("fill",this)}}),H=u.extend(new function(){var t,e={gray:["gray"],rgb:["red","green","blue"],hsb:["hue","saturation","brightness"],hsl:["hue","saturation","lightness"],gradient:["gradient","origin","destination","highlight"]},n={},i={transparent:[0,0,0,0]};var r=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]],o={"rgb-hsb":function(t,e,n){var i=Math.max(t,e,n),r=i-Math.min(t,e,n);return[0===r?0:60*(i==t?(e-n)/r+(e<n?6:0):i==e?(n-t)/r+2:(t-e)/r+4),0===i?0:r/i,i]},"hsb-rgb":function(t,e,n){var i,o=(t=(t/60%6+6)%6)-(i=Math.floor(t)),s=[n,n*(1-e),n*(1-e*o),n*(1-e*(1-o))];return[s[(i=r[i])[0]],s[i[1]],s[i[2]]]},"rgb-hsl":function(t,e,n){var i=Math.max(t,e,n),r=Math.min(t,e,n),o=i-r,s=0===o,a=(i+r)/2;return[s?0:60*(i==t?(e-n)/o+(e<n?6:0):i==e?(n-t)/o+2:(t-e)/o+4),s?0:a<.5?o/(i+r):o/(2-i-r),a]},"hsl-rgb":function(t,e,n){if(0===e)return[n,n,n];for(var i=[(t=(t/360%1+1)%1)+1/3,t,t-1/3],r=n<.5?n*(1+e):n+e-n*e,o=2*n-r,s=[],a=0;a<3;a++){var l=i[a];l<0&&(l+=1),l>1&&(l-=1),s[a]=6*l<1?o+6*(r-o)*l:2*l<1?r:3*l<2?o+(r-o)*(2/3-l)*6:o}return s},"rgb-gray":function(t,e,n){return[.2989*t+.587*e+.114*n]},"gray-rgb":function(t){return[t,t,t]},"gray-hsb":function(t){return[0,0,t]},"gray-hsl":function(t){return[0,0,t]},"gradient-rgb":function(){return[]},"rgb-gradient":function(){return[]}};return u.each(e,function(t,i){n[i]=[],u.each(t,function(t,r){var o=u.capitalize(t),s=/^(hue|saturation)$/.test(t),a=n[i][r]="gradient"===i?"gradient"===t?function(t){var e=this._components[0];return e!==(t=F.read(Array.isArray(t)?t:arguments,0,{readNull:!0}))&&(e&&e._removeOwner(this),t&&t._addOwner(this)),t}:function(){return v.read(arguments,0,{readNull:"highlight"===t,clone:!0})}:function(t){return null==t||isNaN(t)?0:+t};this["get"+o]=function(){return this._type===i||s&&/^hs[bl]$/.test(this._type)?this._components[r]:this._convert(i)[r]},this["set"+o]=function(t){this._type===i||s&&/^hs[bl]$/.test(this._type)||(this._components=this._convert(i),this._properties=e[i],this._type=i),this._components[r]=a.call(this,t),this._changed()}},this)},{_class:"Color",_readIndex:!0,initialize:function r(o){var s,a,c,h,d=arguments,p=this.__read,f=0;Array.isArray(o)&&(o=(d=o)[0]);var g=null!=o&&typeof o;if("string"===g&&o in e&&(s=o,o=d[1],Array.isArray(o)?(a=o,c=d[2]):(p&&(f=1),d=u.slice(d,1),g=typeof o)),!a){if(h="number"===g?d:"object"===g&&null!=o.length?o:null){s||(s=h.length>=3?"rgb":"gray");var m=e[s].length;c=h[m],p&&(f+=h===arguments?m+(null!=c?1:0):1),h.length>m&&(h=u.slice(h,0,m))}else if("string"===g){var y=function(e){var n,r=e.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})?$/i)||e.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])?$/i),o="rgb";if(r){var s=r[4]?4:3;n=new Array(s);for(var a=0;a<s;a++){var c=r[a+1];n[a]=parseInt(1==c.length?c+c:c,16)/255}}else if(r=e.match(/^(rgb|hsl)a?\((.*)\)$/)){o=r[1],n=r[2].trim().split(/[,\s]+/g);for(var u="hsl"===o,h=(a=0,Math.min(n.length,4));a<h;a++){var d=n[a];if(c=parseFloat(d),u)if(0===a){var p=d.match(/([a-z]*)$/)[1];c*={turn:360,rad:180/Math.PI,grad:.9}[p]||1}else a<3&&(c/=100);else a<3&&(c/=/%$/.test(d)?100:255);n[a]=c}}else{var f=i[e];if(!f)if(l){t||((t=lt.getContext(1,1)).globalCompositeOperation="copy"),t.fillStyle="rgba(0,0,0,0)",t.fillStyle=e,t.fillRect(0,0,1,1);var g=t.getImageData(0,0,1,1).data;f=i[e]=[g[0]/255,g[1]/255,g[2]/255]}else f=[0,0,0];n=f.slice()}return[o,n]}(o);s=y[0],4===(a=y[1]).length&&(c=a[3],a.length--)}else if("object"===g)if(o.constructor===r){if(s=o._type,a=o._components.slice(),c=o._alpha,"gradient"===s)for(var v=1,b=a.length;v<b;v++){var I=a[v];I&&(a[v]=I.clone())}}else if(o.constructor===F)s="gradient",h=d;else{var A=e[s="hue"in o?"lightness"in o?"hsl":"hsb":"gradient"in o||"stops"in o||"radial"in o?"gradient":"gray"in o?"gray":"rgb"],M=n[s];this._components=a=[];for(v=0,b=A.length;v<b;v++){null==(w=o[A[v]])&&!v&&"gradient"===s&&"stops"in o&&(w={stops:o.stops,radial:o.radial}),null!=(w=M[v].call(this,w))&&(a[v]=w)}c=o.alpha}p&&s&&(f=1)}if(this._type=s||"rgb",!a){this._components=a=[];for(v=0,b=(M=n[this._type]).length;v<b;v++){var w;null!=(w=M[v].call(this,h&&h[v]))&&(a[v]=w)}}return this._components=a,this._properties=e[this._type],this._alpha=c,p&&(this.__read=f),this},set:"#initialize",_serialize:function(t,e){var n=this.getComponents();return u.serialize(/^(gray|rgb)$/.test(this._type)?n:[this._type].concat(n),t,!0,e)},_changed:function(){this._canvasStyle=null,this._owner&&(this._setter?this._owner[this._setter](this):this._owner._changed(129))},_convert:function(t){var e;return this._type===t?this._components.slice():(e=o[this._type+"-"+t])?e.apply(this,this._components):o["rgb-"+t].apply(this,o[this._type+"-rgb"].apply(this,this._components))},convert:function(t){return new H(t,this._convert(t),this._alpha)},getType:function(){return this._type},setType:function(t){this._components=this._convert(t),this._properties=e[t],this._type=t},getComponents:function(){var t=this._components.slice();return null!=this._alpha&&t.push(this._alpha),t},getAlpha:function(){return null!=this._alpha?this._alpha:1},setAlpha:function(t){this._alpha=null==t?null:Math.min(Math.max(t,0),1),this._changed()},hasAlpha:function(){return null!=this._alpha},equals:function(t){var e=u.isPlainValue(t,!0)?H.read(arguments):t;return e===this||e&&this._class===e._class&&this._type===e._type&&this.getAlpha()===e.getAlpha()&&u.equals(this._components,e._components)||!1},toString:function(){for(var t=this._properties,e=[],n="gradient"===this._type,i=g.instance,r=0,o=t.length;r<o;r++){var s=this._components[r];null!=s&&e.push(t[r]+": "+(n?s:i.number(s)))}return null!=this._alpha&&e.push("alpha: "+i.number(this._alpha)),"{ "+e.join(", ")+" }"},toCSS:function(t){var e=this._convert("rgb"),n=t||null==this._alpha?1:this._alpha;function i(t){return Math.round(255*(t<0?0:t>1?1:t))}return e=[i(e[0]),i(e[1]),i(e[2])],n<1&&e.push(n<0?0:n),t?"#"+((1<<24)+(e[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1):(4==e.length?"rgba(":"rgb(")+e.join(",")+")"},toCanvasStyle:function(t,e,n){var i="gradient"===this._type&&n;if(this._canvasStyle&&!i)return this._canvasStyle;if("gradient"!==this._type)return this._canvasStyle=this.toCSS();var r,o=this._components,s=o[0],a=s._stops,l=o[1],c=o[2],u=o[3],h=e&&e.inverted();if(h&&(l=h._transformPoint(l),c=h._transformPoint(c),u&&(u=h._transformPoint(u))),n&&(l=n._transformPoint(l),c=n._transformPoint(c),u&&(u=n._transformPoint(u))),s._radial){var d=c.getDistance(l);if(u){var p=u.subtract(l);p.getLength()>d&&(u=l.add(p.normalize(d-.1)))}var f=u||l;r=t.createRadialGradient(f.x,f.y,0,l.x,l.y,d)}else r=t.createLinearGradient(l.x,l.y,c.x,c.y);for(var g=0,m=a.length;g<m;g++){var y=a[g],v=y._offset;r.addColorStop(null==v?g/(m-1):v,y._color.toCanvasStyle())}return i||(this._canvasStyle=r),r},transform:function(t){if("gradient"===this._type){for(var e=this._components,n=1,i=e.length;n<i;n++){var r=e[n];t._transformPoint(r,r,!0)}this._changed()}},statics:{_types:e,random:function(){var t=Math.random;return new H(t(),t(),t())},_setOwner:function(t,e,n){return t&&(t._owner&&e&&t._owner!==e&&(t=t.clone()),!t._owner^!e&&(t._owner=e||null,t._setter=n||null)),t}}})},new function(){return u.each({add:function(t,e){return t+e},subtract:function(t,e){return t-e},multiply:function(t,e){return t*e},divide:function(t,e){return t/e}},function(t,e){this[e]=function(e){e=H.read(arguments);for(var n=this._type,i=this._components,r=e._convert(n),o=0,s=i.length;o<s;o++)r[o]=t(i[o],r[o]);return new H(n,r,null!=this._alpha?t(this._alpha,e.getAlpha()):null)}},{})}),F=u.extend({_class:"Gradient",initialize:function(t,e){this._id=y.get(),t&&u.isPlainObject(t)&&(this.set(t),t=e=null),null==this._stops&&this.setStops(t||["white","black"]),null==this._radial&&this.setRadial("string"==typeof e&&"radial"===e||e||!1)},_serialize:function(t,e){return e.add(this,function(){return u.serialize([this._stops,this._radial],t,!0,e)})},_changed:function(){for(var t=0,e=this._owners&&this._owners.length;t<e;t++)this._owners[t]._changed()},_addOwner:function(t){this._owners||(this._owners=[]),this._owners.push(t)},_removeOwner:function(t){var e=this._owners?this._owners.indexOf(t):-1;-1!=e&&(this._owners.splice(e,1),this._owners.length||(this._owners=a))},clone:function(){for(var t=[],e=0,n=this._stops.length;e<n;e++)t[e]=this._stops[e].clone();return new F(t,this._radial)},getStops:function(){return this._stops},setStops:function(t){if(t.length<2)throw new Error("Gradient stop list needs to contain at least two stops.");var e=this._stops;if(e)for(var n=0,i=e.length;n<i;n++)e[n]._owner=a;for(n=0,i=(e=this._stops=V.readList(t,0,{clone:!0})).length;n<i;n++)e[n]._owner=this;this._changed()},getRadial:function(){return this._radial},setRadial:function(t){this._radial=t,this._changed()},equals:function(t){if(t===this)return!0;if(t&&this._class===t._class){var e=this._stops,n=t._stops,i=e.length;if(i===n.length){for(var r=0;r<i;r++)if(!e[r].equals(n[r]))return!1;return!0}}return!1}}),V=u.extend({_class:"GradientStop",initialize:function(t,e){var n=t,i=e;"object"==typeof t&&e===a&&(Array.isArray(t)&&"number"!=typeof t[0]?(n=t[0],i=t[1]):("color"in t||"offset"in t||"rampPoint"in t)&&(n=t.color,i=t.offset||t.rampPoint||0)),this.setColor(n),this.setOffset(i)},clone:function(){return new V(this._color.clone(),this._offset)},_serialize:function(t,e){var n=this._color,i=this._offset;return u.serialize(null==i?[n]:[n,i],t,!0,e)},_changed:function(){this._owner&&this._owner._changed(129)},getOffset:function(){return this._offset},setOffset:function(t){this._offset=t,this._changed()},getRampPoint:"#getOffset",setRampPoint:"#setOffset",getColor:function(){return this._color},setColor:function(){H._setOwner(this._color,null),this._color=H._setOwner(H.read(arguments,0),this,"setColor"),this._changed()},equals:function(t){return t===this||t&&this._class===t._class&&this._color.equals(t._color)&&this._offset==t._offset||!1}}),q=u.extend(new function(){var t={fillColor:null,fillRule:"nonzero",strokeColor:null,strokeWidth:1,strokeCap:"butt",strokeJoin:"miter",strokeScaling:!0,miterLimit:10,dashOffset:0,dashArray:[],shadowColor:null,shadowBlur:0,shadowOffset:new v,selectedColor:null},e=u.set({},t,{fontFamily:"sans-serif",fontWeight:"normal",fontSize:12,leading:null,justification:"left"}),n=u.set({},e,{fillColor:new H}),i={strokeWidth:193,strokeCap:193,strokeJoin:193,strokeScaling:201,miterLimit:193,fontFamily:9,fontWeight:9,fontSize:9,font:9,leading:9,justification:9},r={beans:!0},o={_class:"Style",beans:!0,initialize:function(i,r,o){this._values={},this._owner=r,this._project=r&&r._project||o||dt.project,this._defaults=!r||r instanceof D?e:r instanceof W?n:t,i&&this.set(i)}};return u.each(e,function(t,e){var n=/Color$/.test(e),s="shadowOffset"===e,l=u.capitalize(e),c=i[e],h="set"+l,d="get"+l;o[h]=function(t){var i=this._owner,r=i&&i._children,o=r&&r.length>0&&!(i instanceof G);if(o)for(var s=0,a=r.length;s<a;s++)r[s]._style[h](t);if(("selectedColor"===e||!o)&&e in this._defaults){var l=this._values[e];l!==t&&(n&&(l&&(H._setOwner(l,null),l._canvasStyle=null),t&&t.constructor===H&&(t=H._setOwner(t,i,o&&h))),this._values[e]=t,i&&i._changed(c||129))}},o[d]=function(t){var i=this._owner,r=i&&i._children,o=r&&r.length>0&&!(i instanceof G);if(o&&!t)for(var l=0,c=r.length;l<c;l++){var p=r[l]._style[d]();if(l){if(!u.equals(f,p))return a}else f=p}else if(e in this._defaults){var f;if((f=this._values[e])===a)(f=this._defaults[e])&&f.clone&&(f=f.clone());else{var g=n?H:s?v:null;!g||f&&f.constructor===g||(this._values[e]=f=g.read([f],0,{readNull:!0,clone:!0}))}}return f&&n&&(f=H._setOwner(f,i,o&&h)),f},r[d]=function(t){return this._style[d](t)},r[h]=function(t){this._style[h](t)}}),u.each({Font:"FontFamily",WindingRule:"FillRule"},function(t,e){var n="get"+e,i="set"+e;o[n]=r[n]="#get"+t,o[i]=r[i]="#set"+t}),S.inject(r),o},{set:function(t){var e=t instanceof q,n=e?t._values:t;if(n)for(var i in n)if(i in this._defaults){var r=n[i];this[i]=r&&e&&r.clone?r.clone():r}},equals:function(t){function e(t,e,n){var i=t._values,r=e._values,o=e._defaults;for(var s in i){var l=i[s],c=r[s];if(!(n&&s in r||u.equals(l,c===a?o[s]:c)))return!1}return!0}return t===this||t&&this._class===t._class&&e(this,t)&&e(t,this,!0)||!1},_dispose:function(){var t;(t=this.getFillColor())&&(t._canvasStyle=null),(t=this.getStrokeColor())&&(t._canvasStyle=null),(t=this.getShadowColor())&&(t._canvasStyle=null)},hasFill:function(){var t=this.getFillColor();return!!t&&t.alpha>0},hasStroke:function(){var t=this.getStrokeColor();return!!t&&t.alpha>0&&this.getStrokeWidth()>0},hasShadow:function(){var t=this.getShadowColor();return!!t&&t.alpha>0&&(this.getShadowBlur()>0||!this.getShadowOffset().isZero())},getView:function(){return this._project._view},getFontStyle:function(){var t=this.getFontSize();return this.getFontWeight()+" "+t+(/[a-z]/i.test(t+"")?" ":"px ")+this.getFontFamily()},getFont:"#getFontFamily",setFont:"#setFontFamily",getLeading:function t(){var e=t.base.call(this),n=this.getFontSize();return/pt|em|%|px/.test(n)&&(n=this.getView().getPixelSize(n)),null!=e?e:1.2*n}}),J=new function(){function t(t,e,n,i){for(var r=["","webkit","moz","Moz","ms","o"],o=e[0].toUpperCase()+e.substring(1),s=0;s<6;s++){var a=r[s],l=a?a+o:e;if(l in t){if(!n)return t[l];t[l]=i;break}}}return{getStyles:function(t){var e=t&&9!==t.nodeType?t.ownerDocument:t,n=e&&e.defaultView;return n&&n.getComputedStyle(t,"")},getBounds:function(t,e){var n,i=t.ownerDocument,r=i.body,o=i.documentElement;try{n=t.getBoundingClientRect()}catch(t){n={left:0,top:0,width:0,height:0}}var s=n.left-(o.clientLeft||r.clientLeft||0),a=n.top-(o.clientTop||r.clientTop||0);if(!e){var l=i.defaultView;s+=l.pageXOffset||o.scrollLeft||r.scrollLeft,a+=l.pageYOffset||o.scrollTop||r.scrollTop}return new M(s,a,n.width,n.height)},getViewportBounds:function(t){var e=t.ownerDocument,n=e.defaultView,i=e.documentElement;return new M(0,0,n.innerWidth||i.clientWidth,n.innerHeight||i.clientHeight)},getOffset:function(t,e){return J.getBounds(t,e).getPoint()},getSize:function(t){return J.getBounds(t,!0).getSize()},isInvisible:function(t){return J.getSize(t).equals(new I(0,0))},isInView:function(t){return!J.isInvisible(t)&&J.getViewportBounds(t).intersects(J.getBounds(t,!0))},isInserted:function(t){return c.body.contains(t)},getPrefixed:function(e,n){return e&&t(e,n)},setPrefixed:function(e,n,i){if("object"==typeof n)for(var r in n)t(e,r,!0,n[r]);else t(e,n,!0,i)}}},X={add:function(t,e){if(t)for(var n in e)for(var i=e[n],r=n.split(/[\s,]+/g),o=0,s=r.length;o<s;o++){var a=r[o],l=t===c&&("touchstart"===a||"touchmove"===a)&&{passive:!1};t.addEventListener(a,i,l)}},remove:function(t,e){if(t)for(var n in e)for(var i=e[n],r=n.split(/[\s,]+/g),o=0,s=r.length;o<s;o++)t.removeEventListener(r[o],i,!1)},getPoint:function(t){var e=t.targetTouches?t.targetTouches.length?t.targetTouches[0]:t.changedTouches[0]:t;return new v(e.pageX||e.clientX+c.documentElement.scrollLeft,e.pageY||e.clientY+c.documentElement.scrollTop)},getTarget:function(t){return t.target||t.srcElement},getRelatedTarget:function(t){return t.relatedTarget||t.toElement},getOffset:function(t,e){return X.getPoint(t).subtract(J.getOffset(e||X.getTarget(t)))}};X.requestAnimationFrame=new function(){var t,e=J.getPrefixed(l,"requestAnimationFrame"),n=!1,i=[];function r(){var t=i;i=[];for(var o=0,s=t.length;o<s;o++)t[o]();(n=e&&i.length)&&e(r)}return function(o){i.push(o),e?n||(e(r),n=!0):t||(t=setInterval(r,1e3/60))}};var K=u.extend(h,{_class:"View",initialize:function t(e,n){function i(t){return n[t]||parseInt(n.getAttribute(t),10)}function r(){var t=J.getSize(n);return t.isNaN()||t.isZero()?new I(i("width"),i("height")):t}var o;if(l&&n){this._id=n.getAttribute("id"),null==this._id&&n.setAttribute("id",this._id="paper-view-"+t._id++),X.add(n,this._viewEvents);var s="none";if(J.setPrefixed(n.style,{userDrag:s,userSelect:s,touchCallout:s,contentZooming:s,tapHighlightColor:"rgba(0,0,0,0)"}),d.hasAttribute(n,"resize")){var a=this;X.add(l,this._windowEvents={resize:function(){a.setViewSize(r())}})}if(o=r(),d.hasAttribute(n,"stats")&&"undefined"!=typeof Stats){this._stats=new Stats;var u=this._stats.domElement,h=u.style,p=J.getOffset(n);h.position="absolute",h.left=p.x+"px",h.top=p.y+"px",c.body.appendChild(u)}}else o=new I(n),n=null;this._project=e,this._scope=e._scope,this._element=n,this._pixelRatio||(this._pixelRatio=l&&l.devicePixelRatio||1),this._setElementSize(o.width,o.height),this._viewSize=o,t._views.push(this),t._viewsById[this._id]=this,(this._matrix=new C)._owner=this,t._focused||(t._focused=this),this._frameItems={},this._frameItemCount=0,this._itemEvents={native:{},virtual:{}},this._autoUpdate=!dt.agent.node,this._needsUpdate=!1},remove:function(){if(!this._project)return!1;K._focused===this&&(K._focused=null),K._views.splice(K._views.indexOf(this),1),delete K._viewsById[this._id];var t=this._project;return t._view===this&&(t._view=null),X.remove(this._element,this._viewEvents),X.remove(l,this._windowEvents),this._element=this._project=null,this.off("frame"),this._animate=!1,this._frameItems={},!0},_events:u.each(S._itemHandlers.concat(["onResize","onKeyDown","onKeyUp"]),function(t){this[t]={}},{onFrame:{install:function(){this.play()},uninstall:function(){this.pause()}}}),_animate:!1,_time:0,_count:0,getAutoUpdate:function(){return this._autoUpdate},setAutoUpdate:function(t){this._autoUpdate=t,t&&this.requestUpdate()},update:function(){},draw:function(){this.update()},requestUpdate:function(){if(!this._requested){var t=this;X.requestAnimationFrame(function(){if(t._requested=!1,t._animate){t.requestUpdate();var e=t._element;J.getPrefixed(c,"hidden")&&"true"!==d.getAttribute(e,"keepalive")||!J.isInView(e)||t._handleFrame()}t._autoUpdate&&t.update()}),this._requested=!0}},play:function(){this._animate=!0,this.requestUpdate()},pause:function(){this._animate=!1},_handleFrame:function(){dt=this._scope;var t=Date.now()/1e3,e=this._last?t-this._last:0;this._last=t,this.emit("frame",new u({delta:e,time:this._time+=e,count:this._count++})),this._stats&&this._stats.update()},_animateItem:function(t,e){var n=this._frameItems;e?(n[t._id]={item:t,time:0,count:0},1===++this._frameItemCount&&this.on("frame",this._handleFrameItems)):(delete n[t._id],0===--this._frameItemCount&&this.off("frame",this._handleFrameItems))},_handleFrameItems:function(t){for(var e in this._frameItems){var n=this._frameItems[e];n.item.emit("frame",new u(t,{time:n.time+=t.delta,count:n.count++}))}},_changed:function(){this._project._changed(4097),this._bounds=this._decomposed=a},getElement:function(){return this._element},getPixelRatio:function(){return this._pixelRatio},getResolution:function(){return 72*this._pixelRatio},getViewSize:function(){var t=this._viewSize;return new A(t.width,t.height,this,"setViewSize")},setViewSize:function(){var t=I.read(arguments),e=t.subtract(this._viewSize);e.isZero()||(this._setElementSize(t.width,t.height),this._viewSize.set(t),this._changed(),this.emit("resize",{size:t,delta:e}),this._autoUpdate&&this.update())},_setElementSize:function(t,e){var n=this._element;n&&(n.width!==t&&(n.width=t),n.height!==e&&(n.height=e))},getBounds:function(){return this._bounds||(this._bounds=this._matrix.inverted()._transformBounds(new M(new v,this._viewSize))),this._bounds},getSize:function(){return this.getBounds().getSize()},isVisible:function(){return J.isInView(this._element)},isInserted:function(){return J.isInserted(this._element)},getPixelSize:function(t){var e,n=this._element;if(n){var i=n.parentNode,r=c.createElement("div");r.style.fontSize=t,i.appendChild(r),e=parseFloat(J.getStyles(r).fontSize),i.removeChild(r)}else e=parseFloat(e);return e},getTextWidth:function(t,e){return 0}},u.each(["rotate","scale","shear","skew"],function(t){var e="rotate"===t;this[t]=function(){var n=arguments,i=(e?u:v).read(n),r=v.read(n,0,{readNull:!0});return this.transform((new C)[t](i,r||this.getCenter(!0)))}},{_decompose:function(){return this._decomposed||(this._decomposed=this._matrix.decompose())},translate:function(){var t=new C;return this.transform(t.translate.apply(t,arguments))},getCenter:function(){return this.getBounds().getCenter()},setCenter:function(){var t=v.read(arguments);this.translate(this.getCenter().subtract(t))},getZoom:function(){var t=this._decompose().scaling;return(t.x+t.y)/2},setZoom:function(t){this.transform((new C).scale(t/this.getZoom(),this.getCenter()))},getRotation:function(){return this._decompose().rotation},setRotation:function(t){var e=this.getRotation();null!=e&&null!=t&&this.rotate(t-e)},getScaling:function(){var t=this._decompose().scaling;return new b(t.x,t.y,this,"setScaling")},setScaling:function(){var t=this.getScaling(),e=v.read(arguments,0,{clone:!0,readNull:!0});t&&e&&this.scale(e.x/t.x,e.y/t.y)},getMatrix:function(){return this._matrix},setMatrix:function(){var t=this._matrix;t.initialize.apply(t,arguments)},transform:function(t){this._matrix.append(t)},scrollBy:function(){this.translate(v.read(arguments).negate())}}),{projectToView:function(){return this._matrix._transformPoint(v.read(arguments))},viewToProject:function(){return this._matrix._inverseTransform(v.read(arguments))},getEventPoint:function(t){return this.viewToProject(X.getOffset(t,this._element))}},{statics:{_views:[],_viewsById:{},_id:0,create:function(t,e){return c&&"string"==typeof e&&(e=c.getElementById(e)),new(l?$:K)(t,e)}}},new function(){if(l){var t,e,n,i,r,o=!1,s=!1,a=l.navigator;a.pointerEnabled||a.msPointerEnabled?(n="pointerdown MSPointerDown",i="pointermove MSPointerMove",r="pointerup pointercancel MSPointerUp MSPointerCancel"):(n="touchstart",i="touchmove",r="touchend touchcancel","ontouchstart"in l&&a.userAgent.match(/mobile|tablet|ip(ad|hone|od)|android|silk/i)||(n+=" mousedown",i+=" mousemove",r+=" mouseup"));var u={},h={mouseout:function(t){var e=K._focused,n=X.getRelatedTarget(t);if(e&&(!n||"HTML"===n.nodeName)){var i=X.getOffset(t,e._element),r=i.x,o=Math.abs,s=o(r),a=s-(1<<25);i.x=o(a)<s?a*(r<0?-1:1):r,S(e,t,e.viewToProject(i))}},scroll:x};u[n]=function(t){var e=K._focused=T(t);o||(o=!0,e._handleMouseEvent("mousedown",t))},h[i]=function(n){var i=K._focused;if(!s){var r=T(n);r?i!==r&&(i&&S(i,n),t||(t=i),i=K._focused=e=r):e&&e===i&&(t&&!t.isInserted()&&(t=null),i=K._focused=t,t=null,x())}i&&S(i,n)},h[n]=function(){s=!0},h[r]=function(t){var e=K._focused;e&&o&&e._handleMouseEvent("mouseup",t),s=o=!1},X.add(c,h),X.add(l,{load:x});var d,p,f,g,m,y,v,b,I=!1,A=!1,M={doubleclick:"click",mousedrag:"mousemove"},w=!1,C={mousedown:{mousedown:1,mousedrag:1,click:1,doubleclick:1},mouseup:{mouseup:1,mousedrag:1,click:1,doubleclick:1},mousemove:{mousedrag:1,mousemove:1,mouseenter:1,mouseleave:1}};return{_viewEvents:u,_handleMouseEvent:function(t,e,n){var i=this._itemEvents,r=i.native[t],s="mousemove"===t,a=this._scope.tool,l=this;function c(t){return i.virtual[t]||l.responds(t)||a&&a.responds(t)}s&&o&&c("mousedrag")&&(t="mousedrag"),n||(n=this.getEventPoint(e));var u=this.getBounds().contains(n),h=r&&u&&l._project.hitTest(n,{tolerance:0,fill:!0,stroke:!0}),M=h&&h.item||null,C=!1,T={};if(T[t.substr(5)]=!0,r&&M!==g&&(g&&D(g,null,"mouseleave",e,n),M&&D(M,null,"mouseenter",e,n),g=M),w^u&&(D(this,null,u?"mouseenter":"mouseleave",e,n),C=!0),!u&&!T.drag||n.equals(p)||(N(this,M,s?t:"mousemove",e,n,p),C=!0),w=u,T.down&&u||T.up&&d){if(N(this,M,t,e,n,d),T.down){if(b=M===y&&Date.now()-v<300,f=y=M,!A&&M){for(var x=M;x&&!x.responds("mousedrag");)x=x._parent;x&&(m=M)}d=n}else T.up&&(A||M!==f||(v=Date.now(),N(this,M,b?"doubleclick":"click",e,n,d),b=!1),f=m=null);w=!1,C=!0}p=n,C&&a&&(I=a._handleMouseEvent(t,e,n,T)||I),!1!==e.cancelable&&(I&&!T.move||T.down&&c("mouseup"))&&e.preventDefault()},_handleKeyEvent:function(t,e,n,i){var r,o=this._scope,s=o.tool;function a(s){s.responds(t)&&(dt=o,s.emit(t,r=r||new et(t,e,n,i)))}this.isVisible()&&(a(this),s&&s.responds(t)&&a(s))},_countItemEvent:function(t,e){var n=this._itemEvents,i=n.native,r=n.virtual;for(var o in C)i[o]=(i[o]||0)+(C[o][t]||0)*e;r[t]=(r[t]||0)+e},statics:{updateFocus:x,_resetState:function(){o=s=I=w=!1,t=e=d=p=f=g=m=y=v=b=null}}}}function T(t){var e=X.getTarget(t);return e.getAttribute&&K._viewsById[e.getAttribute("id")]}function x(){var t=K._focused;if(!t||!t.isVisible())for(var n=0,i=K._views.length;n<i;n++)if((t=K._views[n]).isVisible()){K._focused=e=t;break}}function S(t,e,n){t._handleMouseEvent("mousemove",e,n)}function D(t,e,n,i,r,o,s){var a,l=!1;function c(t,n){if(t.responds(n)){if(a||(a=new it(n,i,r,e||t,o?r.subtract(o):null)),t.emit(n,a)&&(I=!0,a.prevented&&(A=!0),a.stopped))return l=!0}else{var s=M[n];if(s)return c(t,s)}}for(;t&&t!==s&&!c(t,n);)t=t._parent;return l}function N(t,e,n,i,r,o){return t._project.removeOn(n),A=I=!1,m&&D(m,null,n,i,r,o)||e&&e!==m&&!e.isDescendant(m)&&D(e,null,"mousedrag"===n?"mousemove":n,i,r,o,m)||D(t,m||e||t,n,i,r,o)}}),$=K.extend({_class:"CanvasView",initialize:function(t,e){if(!(e instanceof l.HTMLCanvasElement)){var n=I.read(arguments,1);if(n.isZero())throw new Error("Cannot create CanvasView with the provided argument: "+u.slice(arguments,1));e=lt.getCanvas(n)}var i=this._context=e.getContext("2d");if(i.save(),this._pixelRatio=1,!/^off|false$/.test(d.getAttribute(e,"hidpi"))){var r=l.devicePixelRatio||1,o=J.getPrefixed(i,"backingStorePixelRatio")||1;this._pixelRatio=r/o}K.call(this,t,e),this._needsUpdate=!0},remove:function t(){return this._context.restore(),t.base.call(this)},_setElementSize:function t(e,n){var i=this._pixelRatio;if(t.base.call(this,e*i,n*i),1!==i){var r=this._element,o=this._context;if(!d.hasAttribute(r,"resize")){var s=r.style;s.width=e+"px",s.height=n+"px"}o.restore(),o.save(),o.scale(i,i)}},getContext:function(){return this._context},getPixelSize:function t(e){var n,i=dt.agent;if(i&&i.firefox)n=t.base.call(this,e);else{var r=this._context,o=r.font;r.font=e+" serif",n=parseFloat(r.font),r.font=o}return n},getTextWidth:function(t,e){var n=this._context,i=n.font,r=0;n.font=t;for(var o=0,s=e.length;o<s;o++)r=Math.max(r,n.measureText(e[o]).width);return n.font=i,r},update:function(){if(!this._needsUpdate)return!1;var t=this._project,e=this._context,n=this._viewSize;return e.clearRect(0,0,n.width+1,n.height+1),t&&t.draw(e,this._matrix,this._pixelRatio),this._needsUpdate=!1,!0}}),tt=u.extend({_class:"Event",initialize:function(t){this.event=t,this.type=t&&t.type},prevented:!1,stopped:!1,preventDefault:function(){this.prevented=!0,this.event.preventDefault()},stopPropagation:function(){this.stopped=!0,this.event.stopPropagation()},stop:function(){this.stopPropagation(),this.preventDefault()},getTimeStamp:function(){return this.event.timeStamp},getModifiers:function(){return nt.modifiers}}),et=tt.extend({_class:"KeyEvent",initialize:function(t,e,n,i){this.type=t,this.event=e,this.key=n,this.character=i},toString:function(){return"{ type: '"+this.type+"', key: '"+this.key+"', character: '"+this.character+"', modifiers: "+this.getModifiers()+" }"}}),nt=new function(){var t,e,n={"\t":"tab"," ":"space","\b":"backspace","":"delete",Spacebar:"space",Del:"delete",Win:"meta",Esc:"escape"},i={tab:"\t",space:" ",enter:"\r"},r={},o={},s=new u({shift:!1,control:!1,alt:!1,meta:!1,capsLock:!1,space:!1}).inject({option:{get:function(){return this.alt}},command:{get:function(){var t=dt&&dt.agent;return t&&t.mac?this.meta:this.control}}});function h(t){var e=t.key||t.keyIdentifier;return e=/^U\+/.test(e)?String.fromCharCode(parseInt(e.substr(2),16)):/^Arrow[A-Z]/.test(e)?e.substr(5):"Unidentified"===e||e===a?String.fromCharCode(t.keyCode):e,n[e]||(e.length>1?u.hyphenate(e):e.toLowerCase())}function d(e,n,i,a){var l,c=K._focused;if(r[n]=e,e?o[n]=i:delete o[n],n.length>1&&(l=u.camelize(n))in s){s[l]=e;var h=dt&&dt.agent;if("meta"===l&&h&&h.mac)if(e)t={};else{for(var p in t)p in o&&d(!1,p,t[p],a);t=null}}else e&&t&&(t[n]=i);c&&c._handleKeyEvent(e?"keydown":"keyup",a,n,i)}return X.add(c,{keydown:function(t){var n=h(t),r=dt&&dt.agent;n.length>1||r&&r.chrome&&(t.altKey||r.mac&&t.metaKey||!r.mac&&t.ctrlKey)?d(!0,n,i[n]||(n.length>1?"":n),t):e=n},keypress:function(t){if(e){var n=h(t),i=t.charCode,r=i>=32?String.fromCharCode(i):n.length>1?"":n;n!==e&&(n=r.toLowerCase()),d(!0,n,r,t),e=null}},keyup:function(t){var e=h(t);e in o&&d(!1,e,o[e],t)}}),X.add(l,{blur:function(t){for(var e in o)d(!1,e,o[e],t)}}),{modifiers:s,isDown:function(t){return!!r[t]}}},it=tt.extend({_class:"MouseEvent",initialize:function(t,e,n,i,r){this.type=t,this.event=e,this.point=n,this.target=i,this.delta=r},toString:function(){return"{ type: '"+this.type+"', point: "+this.point+", target: "+this.target+(this.delta?", delta: "+this.delta:"")+", modifiers: "+this.getModifiers()+" }"}}),rt=tt.extend({_class:"ToolEvent",_item:null,initialize:function(t,e,n){this.tool=t,this.type=e,this.event=n},_choosePoint:function(t,e){return t||(e?e.clone():null)},getPoint:function(){return this._choosePoint(this._point,this.tool._point)},setPoint:function(t){this._point=t},getLastPoint:function(){return this._choosePoint(this._lastPoint,this.tool._lastPoint)},setLastPoint:function(t){this._lastPoint=t},getDownPoint:function(){return this._choosePoint(this._downPoint,this.tool._downPoint)},setDownPoint:function(t){this._downPoint=t},getMiddlePoint:function(){return!this._middlePoint&&this.tool._lastPoint?this.tool._point.add(this.tool._lastPoint).divide(2):this._middlePoint},setMiddlePoint:function(t){this._middlePoint=t},getDelta:function(){return!this._delta&&this.tool._lastPoint?this.tool._point.subtract(this.tool._lastPoint):this._delta},setDelta:function(t){this._delta=t},getCount:function(){return this.tool[/^mouse(down|up)$/.test(this.type)?"_downCount":"_moveCount"]},setCount:function(t){this.tool[/^mouse(down|up)$/.test(this.type)?"downCount":"count"]=t},getItem:function(){if(!this._item){var t=this.tool._scope.project.hitTest(this.getPoint());if(t){for(var e=t.item,n=e._parent;/^(Group|CompoundPath)$/.test(n._class);)e=n,n=n._parent;this._item=e}}return this._item},setItem:function(t){this._item=t},toString:function(){return"{ type: "+this.type+", point: "+this.getPoint()+", count: "+this.getCount()+", modifiers: "+this.getModifiers()+" }"}}),ot=p.extend({_class:"Tool",_list:"tools",_reference:"tool",_events:["onMouseDown","onMouseUp","onMouseDrag","onMouseMove","onActivate","onDeactivate","onEditOptions","onKeyDown","onKeyUp"],initialize:function(t){p.call(this),this._moveCount=-1,this._downCount=-1,this.set(t)},getMinDistance:function(){return this._minDistance},setMinDistance:function(t){this._minDistance=t,null!=t&&null!=this._maxDistance&&t>this._maxDistance&&(this._maxDistance=t)},getMaxDistance:function(){return this._maxDistance},setMaxDistance:function(t){this._maxDistance=t,null!=this._minDistance&&null!=t&&t<this._minDistance&&(this._minDistance=t)},getFixedDistance:function(){return this._minDistance==this._maxDistance?this._minDistance:null},setFixedDistance:function(t){this._minDistance=this._maxDistance=t},_handleMouseEvent:function(t,e,n,i){dt=this._scope,i.drag&&!this.responds(t)&&(t="mousemove");var r=i.move||i.drag,o=this.responds(t),s=this.minDistance,a=this.maxDistance,l=!1,c=this;function u(t,e){var o=n,s=r?c._point:c._downPoint||o;if(r){if(c._moveCount>=0&&o.equals(s))return!1;if(s&&(null!=t||null!=e)){var a=o.subtract(s),l=a.getLength();if(l<(t||0))return!1;e&&(o=s.add(a.normalize(Math.min(l,e))))}c._moveCount++}return c._point=o,c._lastPoint=s||o,i.down&&(c._moveCount=-1,c._downPoint=o,c._downCount++),!0}function h(){o&&(l=c.emit(t,new rt(c,t,e))||l)}if(i.down)u(),h();else if(i.up)u(null,a),h();else if(o)for(;u(s,a);)h();return l}}),st=u.extend(h,{_class:"Tween",statics:{easings:{linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:2*(2-t)*t-1},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t}}},initialize:function t(e,n,i,r,o,s){this.object=e;var a=typeof o,l="function"===a;this.type=l?a:"string"===a?o:"linear",this.easing=l?o:t.easings[this.type],this.duration=r,this.running=!1,this._then=null,this._startTime=null;var c=n||i;this._keys=c?Object.keys(c):[],this._parsedKeys=this._parseKeys(this._keys),this._from=c&&this._getState(n),this._to=c&&this._getState(i),!1!==s&&this.start()},then:function(t){return this._then=t,this},start:function(){return this._startTime=null,this.running=!0,this},stop:function(){return this.running=!1,this},update:function(t){if(this.running){t>1&&(t=1,this.running=!1);for(var e=this.easing(t),n=this._keys,i=function(n){return"function"==typeof n?n(e,t):n},r=0,o=n&&n.length;r<o;r++){var s=n[r],a=i(this._from[s]),l=i(this._to[s]),c=a&&l&&a.__add&&l.__add?l.__subtract(a).__multiply(e).__add(a):(l-a)*e+a;this._setProperty(this._parsedKeys[s],c)}!this.running&&this._then&&this._then(this.object),this.responds("update")&&this.emit("update",new u({progress:t,factor:e}))}return this},_events:{onUpdate:{}},_handleFrame:function(t){var e=this._startTime,n=e?(t-e)/this.duration:0;e||(this._startTime=t),this.update(n)},_getState:function(t){for(var e=this._keys,n={},i=0,r=e.length;i<r;i++){var o,s=e[i],a=this._parsedKeys[s],l=this._getProperty(a);if(t){var c=this._resolveValue(l,t[s]);this._setProperty(a,c),o=(o=this._getProperty(a))&&o.clone?o.clone():o,this._setProperty(a,l)}else o=l&&l.clone?l.clone():l;n[s]=o}return n},_resolveValue:function(t,e){if(e){if(Array.isArray(e)&&2===e.length){var n=e[0];return n&&n.match&&n.match(/^[+\-\*\/]=/)?this._calculate(t,n[0],e[1]):e}if("string"==typeof e){var i=e.match(/^[+\-*/]=(.*)/);if(i){var r=JSON.parse(i[1].replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g,'"$2": '));return this._calculate(t,e[0],r)}}}return e},_calculate:function(t,e,n){return dt.PaperScript.calculateBinary(t,e,n)},_parseKeys:function(t){for(var e={},n=0,i=t.length;n<i;n++){var r=t[n],o=r.replace(/\.([^.]*)/g,"/$1").replace(/\[['"]?([^'"\]]*)['"]?\]/g,"/$1");e[r]=o.split("/")}return e},_getProperty:function(t,e){for(var n=this.object,i=0,r=t.length-(e||0);i<r&&n;i++)n=n[t[i]];return n},_setProperty:function(t,e){var n=this._getProperty(t,1);n&&(n[t[t.length-1]]=e)}}),at=function(t){var e=new s.XMLHttpRequest;return e.open((t.method||"get").toUpperCase(),t.url,u.pick(t.async,!0)),t.mimeType&&e.overrideMimeType(t.mimeType),e.onload=function(){var n=e.status;0===n||200===n?t.onLoad&&t.onLoad.call(e,e.responseText):e.onerror()},e.onerror=function(){var n=e.status,i='Could not load "'+t.url+'" (Status: '+n+")";if(!t.onError)throw new Error(i);t.onError(i,n)},e.send(null)},lt={canvases:[],getCanvas:function(t,e){if(!l)return null;var n,i=!0;"object"==typeof t&&(e=t.height,t=t.width),this.canvases.length?n=this.canvases.pop():(n=c.createElement("canvas"),i=!1);var r=n.getContext("2d");if(!r)throw new Error("Canvas "+n+" is unable to provide a 2D context.");return n.width===t&&n.height===e?i&&r.clearRect(0,0,t+1,e+1):(n.width=t,n.height=e),r.save(),n},getContext:function(t,e){var n=this.getCanvas(t,e);return n?n.getContext("2d"):null},release:function(t){var e=t&&t.canvas?t.canvas:t;e&&e.getContext&&(e.getContext("2d").restore(),this.canvases.push(e))}},ct=new function(){var t,e,n,i,r,o,s,a,l,c,h,d=Math.min,p=Math.max,f=Math.abs;function g(t,e,n){return.2989*t+.587*e+.114*n}function m(t,e,n,i){var r=i-g(t,e,n),o=(i=g(l=t+r,c=e+r,h=n+r),d(l,c,h)),s=p(l,c,h);if(o<0){var a=i-o;l=i+(l-i)*i/a,c=i+(c-i)*i/a,h=i+(h-i)*i/a}if(s>255){var u=255-i,f=s-i;l=i+(l-i)*u/f,c=i+(c-i)*u/f,h=i+(h-i)*u/f}}function y(t,e,n){return p(t,e,n)-d(t,e,n)}function v(t,e,n,i){var r,o=[t,e,n],s=p(t,e,n),a=d(t,e,n);r=0===d(a=a===t?0:a===e?1:2,s=s===t?0:s===e?1:2)?1===p(a,s)?2:1:0,o[s]>o[a]?(o[r]=(o[r]-o[a])*i/(o[s]-o[a]),o[s]=i):o[r]=o[s]=0,o[a]=0,l=o[0],c=o[1],h=o[2]}var b={multiply:function(){l=r*t/255,c=o*e/255,h=s*n/255},screen:function(){l=r+t-r*t/255,c=o+e-o*e/255,h=s+n-s*n/255},overlay:function(){l=r<128?2*r*t/255:255-2*(255-r)*(255-t)/255,c=o<128?2*o*e/255:255-2*(255-o)*(255-e)/255,h=s<128?2*s*n/255:255-2*(255-s)*(255-n)/255},"soft-light":function(){var i=t*r/255;l=i+r*(255-(255-r)*(255-t)/255-i)/255,c=(i=e*o/255)+o*(255-(255-o)*(255-e)/255-i)/255,h=(i=n*s/255)+s*(255-(255-s)*(255-n)/255-i)/255},"hard-light":function(){l=t<128?2*t*r/255:255-2*(255-t)*(255-r)/255,c=e<128?2*e*o/255:255-2*(255-e)*(255-o)/255,h=n<128?2*n*s/255:255-2*(255-n)*(255-s)/255},"color-dodge":function(){l=0===r?0:255===t?255:d(255,255*r/(255-t)),c=0===o?0:255===e?255:d(255,255*o/(255-e)),h=0===s?0:255===n?255:d(255,255*s/(255-n))},"color-burn":function(){l=255===r?255:0===t?0:p(0,255-255*(255-r)/t),c=255===o?255:0===e?0:p(0,255-255*(255-o)/e),h=255===s?255:0===n?0:p(0,255-255*(255-s)/n)},darken:function(){l=r<t?r:t,c=o<e?o:e,h=s<n?s:n},lighten:function(){l=r>t?r:t,c=o>e?o:e,h=s>n?s:n},difference:function(){(l=r-t)<0&&(l=-l),(c=o-e)<0&&(c=-c),(h=s-n)<0&&(h=-h)},exclusion:function(){l=r+t*(255-r-r)/255,c=o+e*(255-o-o)/255,h=s+n*(255-s-s)/255},hue:function(){v(t,e,n,y(r,o,s)),m(l,c,h,g(r,o,s))},saturation:function(){v(r,o,s,y(t,e,n)),m(l,c,h,g(r,o,s))},luminosity:function(){m(r,o,s,g(t,e,n))},color:function(){m(t,e,n,g(r,o,s))},add:function(){l=d(r+t,255),c=d(o+e,255),h=d(s+n,255)},subtract:function(){l=p(r-t,0),c=p(o-e,0),h=p(s-n,0)},average:function(){l=(r+t)/2,c=(o+e)/2,h=(s+n)/2},negation:function(){l=255-f(255-t-r),c=255-f(255-e-o),h=255-f(255-n-s)}},I=this.nativeModes=u.each(["source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","lighter","darker","copy","xor"],function(t){this[t]=!0},{}),A=lt.getContext(1,1);A&&(u.each(b,function(t,e){var n="darken"===e,i=!1;A.save();try{A.fillStyle=n?"#300":"#a00",A.fillRect(0,0,1,1),A.globalCompositeOperation=e,A.globalCompositeOperation===e&&(A.fillStyle=n?"#a00":"#300",A.fillRect(0,0,1,1),i=A.getImageData(0,0,1,1).data[0]!==n?170:51)}catch(t){}A.restore(),I[e]=i}),lt.release(A)),this.process=function(u,d,p,f,g){var m=d.canvas,y="normal"===u;if(y||I[u])p.save(),p.setTransform(1,0,0,1,0,0),p.globalAlpha=f,y||(p.globalCompositeOperation=u),p.drawImage(m,g.x,g.y),p.restore();else{var v=b[u];if(!v)return;for(var A=p.getImageData(g.x,g.y,m.width,m.height),M=A.data,w=d.getImageData(0,0,m.width,m.height).data,C=0,T=M.length;C<T;C+=4){t=w[C],r=M[C],e=w[C+1],o=M[C+1],n=w[C+2],s=M[C+2],i=w[C+3],a=M[C+3],v();var x=i*f/255,S=1-x;M[C]=x*l+S*r,M[C+1]=x*c+S*o,M[C+2]=x*h+S*s,M[C+3]=i*f+S*a}p.putImageData(A,g.x,g.y)}}},ut=new function(){var t="http://www.w3.org/2000/svg",e="http://www.w3.org/2000/xmlns",n="http://www.w3.org/1999/xlink",i={href:n,xlink:e,xmlns:e+"/","xmlns:xlink":e+"/"};function r(t,e,n){for(var r in e){var o=e[r],s=i[r];"number"==typeof o&&n&&(o=n.number(o)),s?t.setAttributeNS(s,r,o):t.setAttribute(r,o)}return t}return{svg:t,xmlns:e,xlink:n,create:function(e,n,i){return r(c.createElementNS(t,e),n,i)},get:function(t,e){var n=i[e],r=n?t.getAttributeNS(n,e):t.getAttribute(e);return"null"===r?null:r},set:r}},ht=u.each({fillColor:["fill","color"],fillRule:["fill-rule","string"],strokeColor:["stroke","color"],strokeWidth:["stroke-width","number"],strokeCap:["stroke-linecap","string"],strokeJoin:["stroke-linejoin","string"],strokeScaling:["vector-effect","lookup",{true:"none",false:"non-scaling-stroke"},function(t,e){return!e&&(t instanceof R||t instanceof _||t instanceof W)}],miterLimit:["stroke-miterlimit","number"],dashArray:["stroke-dasharray","array"],dashOffset:["stroke-dashoffset","number"],fontFamily:["font-family","string"],fontWeight:["font-weight","string"],fontSize:["font-size","number"],justification:["text-anchor","lookup",{left:"start",center:"middle",right:"end"}],opacity:["opacity","number"],blendMode:["mix-blend-mode","style"]},function(t,e){var n=u.capitalize(e),i=t[2];this[e]={type:t[1],property:e,attribute:t[0],toSVG:i,fromSVG:i&&u.each(i,function(t,e){this[t]=e},{}),exportFilter:t[3],get:"get"+n,set:"set"+n}},{});new function(){var t;function e(e,n,i){var r,o=new u,s=e.getTranslation();n&&(e.isInvertible()?(r=(e=e._shiftless())._inverseTransform(s),s=null):r=new v,o[i?"cx":"x"]=r.x,o[i?"cy":"y"]=r.y);if(!e.isIdentity()){var a=e.decompose();if(a){var l=[],c=a.rotation,h=a.scaling,d=a.skewing;s&&!s.isZero()&&l.push("translate("+t.point(s)+")"),c&&l.push("rotate("+t.number(c)+")"),m.isZero(h.x-1)&&m.isZero(h.y-1)||l.push("scale("+t.point(h)+")"),d.x&&l.push("skewX("+t.number(d.x)+")"),d.y&&l.push("skewY("+t.number(d.y)+")"),o.transform=l.join(" ")}else o.transform="matrix("+e.getValues().join(",")+")"}return o}function n(n,i){for(var r=e(n._matrix),o=n._children,s=ut.create("g",r,t),a=0,l=o.length;a<l;a++){var c=o[a],u=p(c,i);if(u)if(c.isClipMask()){var d=ut.create("clipPath");d.appendChild(u),h(c,d,"clip"),ut.set(s,{"clip-path":"url(#"+d.id+")"})}else s.appendChild(u)}return s}function i(n){var i=n._type,r=n._radius,o=e(n._matrix,!0,"rectangle"!==i);if("rectangle"===i){i="rect";var s=n._size,a=s.width,l=s.height;o.x-=a/2,o.y-=l/2,o.width=a,o.height=l,r.isZero()&&(r=null)}return r&&("circle"===i?o.r=r:(o.rx=r.width,o.ry=r.height)),ut.create(i,o,t)}var r,o={Group:n,Layer:n,Raster:function(n,i){var r=e(n._matrix,!0),o=n.getSize(),s=n.getImage();return r.x-=o.width/2,r.y-=o.height/2,r.width=o.width,r.height=o.height,r.href=0==i.embedImages&&s&&s.src||n.toDataURL(),ut.create("image",r,t)},Path:function(n,r){var o=r.matchShapes;if(o){var s=n.toShape(!1);if(s)return i(s)}var a,l=n._segments,c=l.length,u=e(n._matrix);if(o&&c>=2&&!n.hasHandles())if(c>2){a=n._closed?"polygon":"polyline";for(var h=[],d=0;d<c;d++)h.push(t.point(l[d]._point));u.points=h.join(" ")}else{a="line";var p=l[0]._point,f=l[1]._point;u.set({x1:p.x,y1:p.y,x2:f.x,y2:f.y})}else a="path",u.d=n.getPathData(null,r.precision);return ut.create(a,u,t)},Shape:i,CompoundPath:function(n,i){var r=e(n._matrix),o=n.getPathData(null,i.precision);return o&&(r.d=o),ut.create("path",r,t)},SymbolItem:function(n,i){var r=e(n._matrix,!0),o=n._definition,s=c(o,"symbol"),a=o._item,l=a.getStrokeBounds();return s||((s=ut.create("symbol",{viewBox:t.rectangle(l)})).appendChild(p(a,i)),h(o,s,"symbol")),r.href="#"+s.id,r.x+=l.x,r.y+=l.y,r.width=l.width,r.height=l.height,r.overflow="visible",ut.create("use",r,t)},PointText:function(n){var i=ut.create("text",e(n._matrix,!1),t);i.setAttribute("font-size",n.fontSize),i.setAttribute("xml:space","preserve");for(var r=0;r<n._lines.length;r++){var o=ut.create("tspan",{x:"0",dy:0===r?"0":n.getLeading()+"px"},t);o.textContent=n._lines[r]?n._lines[r]:" ",i.appendChild(o)}return i}};function l(n,i,r){var o={},s=!r&&n.getParent(),l=[];return null!=n._name&&(o.id=n._name),u.each(ht,function(i){var r=i.get,d=i.type,p=n[r]();if(p!==a&&(i.exportFilter?i.exportFilter(n,p):!s||!u.equals(s[r](),p)||n instanceof dt.PointText)){if("color"===d&&null!=p){var f=p.getAlpha();f<1&&(o[i.attribute+"-opacity"]=f)}"style"===d?l.push(i.attribute+": "+p):o[i.attribute]=null==p?"none":"color"===d?p.gradient?function(n,i){var r=c(n,"color");if(!r){var o,s=n.getGradient(),a=s._radial,l=n.getOrigin(),u=n.getDestination();if(a){o={cx:l.x,cy:l.y,r:l.getDistance(u)};var d=n.getHighlight();d&&(o.fx=d.x,o.fy=d.y)}else o={x1:l.x,y1:l.y,x2:u.x,y2:u.y};i instanceof dt.PointText&&(o.gradientTransform=e(i._matrix.clone().invert(),!1,t).transform),o.gradientUnits="userSpaceOnUse",r=ut.create((a?"radial":"linear")+"Gradient",o,t);for(var p=s._stops,f=0,g=p.length;f<g;f++){var m=p[f],y=m._color,v=y.getAlpha(),b=m._offset;o={offset:null==b?f/(g-1):b},y&&(o["stop-color"]=y.toCSS(!0)),v<1&&(o["stop-opacity"]=v),r.appendChild(ut.create("stop",o,t))}h(n,r,"color")}return"url(#"+r.id+")"}(p,n):p.toCSS(!0):"array"===d?p.join(","):"lookup"===d?i.toSVG[p]:p}}),l.length&&(o.style=l.join(";")),1===o.opacity&&delete o.opacity,n._visible||(o.visibility="hidden"),ut.set(i,o,t)}function c(t,e){return r||(r={ids:{},svgs:{}}),t&&r.svgs[e+"-"+(t._id||t.__id||(t.__id=y.get("svg")))]}function h(t,e,n){r||c();var i=r.ids[n]=(r.ids[n]||0)+1;e.id=n+"-"+i,r.svgs[n+"-"+(t._id||t.__id)]=e}function d(t,e){var n=t,i=null;if(r){for(var o in n="svg"===t.nodeName.toLowerCase()&&t,r.svgs)i||(n||(n=ut.create("svg")).appendChild(t),i=n.insertBefore(ut.create("defs"),n.firstChild)),i.appendChild(r.svgs[o]);r=null}return e.asString?(new s.XMLSerializer).serializeToString(n):n}function p(t,e,n){var i=o[t._class],r=i&&i(t,e);if(r){var s=e.onExport;s&&(r=s(t,r,e)||r);var a=JSON.stringify(t._data);a&&"{}"!==a&&"null"!==a&&r.setAttribute("data-paper-data",a)}return r&&l(t,r,n)}function f(e){return e||(e={}),t=new g(e.precision),e}S.inject({exportSVG:function(t){return d(p(this,t=f(t),!0),t)}}),x.inject({exportSVG:function(n){n=f(n);var i=this._children,r=this.getView(),o=u.pick(n.bounds,"view"),s=n.matrix||"view"===o&&r._matrix,a=s&&C.read([s]),l="view"===o?new M([0,0],r.getViewSize()):"content"===o?S._getBounds(i,a,{stroke:!0,drawnTextBounds:!0}).rect:M.read([o],0,{readNull:!0}),c={version:"1.1",xmlns:ut.svg,"xmlns:xlink":ut.xlink};l&&(c.width=l.width,c.height=l.height,(l.x||0===l.x||l.y||0===l.y)&&(c.viewBox=t.rectangle(l)));var h=ut.create("svg",c,t),g=h;a&&!a.isIdentity()&&(g=h.appendChild(ut.create("g",e(a),t)));for(var m=0,y=i.length;m<y;m++)g.appendChild(p(i[m],n,!0));return d(h,n)}})},new function(){var t,e={};function n(e,n,i,r,o,s){var a=ut.get(e,n)||s,l=null==a?r?null:i?"":0:i?a:parseFloat(a);return/%\s*$/.test(a)?l/100*(o?1:t[/x|^width/.test(n)?"width":"height"]):l}function i(t,e,i,r,o,s,a){return e=n(t,e||"x",!1,r,o,s),i=n(t,i||"y",!1,r,o,a),!r||null!=e&&null!=i?new v(e,i):null}function r(t,e,i,r,o){return e=n(t,e||"width",!1,r,o),i=n(t,i||"height",!1,r,o),!r||null!=e&&null!=i?new I(e,i):null}function o(t,e,n){return"none"===t?null:"number"===e?parseFloat(t):"array"===e?t?t.split(/[\s,]+/g).map(parseFloat):[]:"color"===e?w(t)||t:"lookup"===e?n[t]:t}function h(t,e,n,i){var r=t.childNodes,o="clippath"===e,s="defs"===e,a=new D,l=a._project,c=l._currentStyle,u=[];if(o||s||(a=A(a,t,i),l._currentStyle=a._style.clone()),i)for(var h=t.querySelectorAll("defs"),d=0,p=h.length;d<p;d++)T(h[d],n,!1);for(d=0,p=r.length;d<p;d++){var f,g=r[d];1!==g.nodeType||/^defs$/i.test(g.nodeName)||!(f=T(g,n,!1))||f instanceof k||u.push(f)}return a.addChildren(u),o&&(a=A(a.reduce(),t,i)),l._currentStyle=c,(o||s)&&(a.remove(),a=null),a}function d(t,e){for(var n=t.getAttribute("points").match(/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g),i=[],r=0,o=n.length;r<o;r+=2)i.push(new v(parseFloat(n[r]),parseFloat(n[r+1])));var s=new U(i);return"polygon"===e&&s.closePath(),s}function p(t,r){var o,s=(n(t,"href",!0)||"").substring(1),a="radialgradient"===r;if(s)(o=e[s].getGradient())._radial^a&&((o=o.clone())._radial=a);else{for(var l=t.childNodes,c=[],u=0,h=l.length;u<h;u++){var d=l[u];1===d.nodeType&&c.push(A(new V,d))}o=new F(c,a)}var p,f,g,m="userSpaceOnUse"!==n(t,"gradientUnits",!0);return a?(f=(p=i(t,"cx","cy",!1,m,"50%","50%")).add(n(t,"r",!1,!1,m,"50%"),0),g=i(t,"fx","fy",!0,m)):(p=i(t,"x1","y1",!1,m,"0%","0%"),f=i(t,"x2","y2",!1,m,"100%","0%")),A(new H(o,p,f,g),t)._scaleToBounds=m,null}var f={"#document":function(t,e,n,i){for(var r=t.childNodes,o=0,s=r.length;o<s;o++){var a=r[o];if(1===a.nodeType)return T(a,n,i)}},g:h,svg:h,clippath:h,polygon:d,polyline:d,path:function(t){return R.create(t.getAttribute("d"))},lineargradient:p,radialgradient:p,image:function(t){var e=new E(n(t,"href",!0));return e.on("load",function(){var e=r(t);this.setSize(e);var n=i(t).add(e.divide(2));this._matrix.append((new C).translate(n))}),e},symbol:function(t,e,n,i){return new k(h(t,e,n,i),!0)},defs:h,use:function(t){var r=(n(t,"href",!0)||"").substring(1),o=e[r],s=i(t);return o?o instanceof k?o.place(s):o.clone().translate(s):null},circle:function(t){return new _.Circle(i(t,"cx","cy"),n(t,"r"))},ellipse:function(t){return new _.Ellipse({center:i(t,"cx","cy"),radius:r(t,"rx","ry")})},rect:function(t){return new _.Rectangle(new M(i(t),r(t)),r(t,"rx","ry"))},line:function(t){return new U.Line(i(t,"x1","y1"),i(t,"x2","y2"))},text:function(t){var e=parseFloat(t.getAttribute("font-size")),n=t.getAttribute("alignment-baseline");if(0===t.childElementCount)return(c=new Q).setContent(t.textContent.trim()||""),c.translate(0,c._style.getLeading()),isNaN(e)||c.setFontSize(e),c;for(var i=[],r=1.2,o=0;o<t.childNodes.length;o++){var s=t.childNodes[o];if(s.getAttribute){i.push(s.textContent);var a=s.getAttribute("dy");if(a){var l=parseFloat(a);isNaN(l)||(a.endsWith("em")?r=l:a.endsWith("px")&&!isNaN(e)&&(r=l/e))}}}var c=new Q;return isNaN(e)||c.setFontSize(e),c.setLeading(c.fontSize*r),"text-before-edge"===n&&(c.setContent(" "),c.translate(0,c.bounds.height)),c.setContent(i.join("\n")),c},switch:h};function g(t,e,n,i){if(t.transform){for(var r=(i.getAttribute(n)||"").split(/\)\s*/g),o=new C,s=0,a=r.length;s<a;s++){var l=r[s];if(!l)break;for(var c=l.split(/\(\s*/),u=c[0],h=c[1].split(/[\s,]+/g),d=0,p=h.length;d<p;d++)h[d]=parseFloat(h[d]);switch(u){case"matrix":o.append(new C(h[0],h[1],h[2],h[3],h[4],h[5]));break;case"rotate":o.rotate(h[0],h[1]||0,h[2]||0);break;case"translate":o.translate(h[0],h[1]||0);break;case"scale":o.scale(h);break;case"skewX":o.skew(h[0],0);break;case"skewY":o.skew(0,h[0])}}t.transform(o)}}function m(t,e,n){var i="fill-opacity"===n?"getFillColor":"getStrokeColor",r=t[i]&&t[i]();r&&r.setAlpha(parseFloat(e))}var y=u.set(u.each(ht,function(t){this[t.attribute]=function(e,n){if(e[t.set]&&(e[t.set](o(n,t.type,t.fromSVG)),"color"===t.type)){var i=e[t.get]();if(i&&i._scaleToBounds){var r=e.getBounds();i.transform((new C).translate(r.getPoint()).scale(r.getSize()))}}}},{}),{id:function(t,n){e[n]=t},"clip-path":function(t,e){var n=w(e);if(n){if((n=n.clone()).setClipMask(!0),!(t instanceof D))return new D(n,t);t.insertChild(0,n)}},gradientTransform:g,transform:g,"fill-opacity":m,"stroke-opacity":m,visibility:function(t,e){t.setVisible&&t.setVisible("visible"===e)},display:function(t,e){t.setVisible&&t.setVisible(null!==e)},"stop-color":function(t,e){t.setColor&&t.setColor(e)},"stop-opacity":function(t,e){t._color&&t._color.setAlpha(parseFloat(e))},offset:function(t,e){if(t.setOffset){var n=e.match(/(.*)%$/);t.setOffset(n?n[1]/100:parseFloat(e))}},viewBox:function(t,e,n,i,s){var a,l=new M(o(e,"array")),c=r(i,null,null,!0);if(t instanceof D){var u=c?c.divide(l.getSize()):1,h=(new C).scale(u).translate(l.getPoint().negate());a=t}else t instanceof k&&(c&&l.setSize(c),a=t._item);if(a){if("visible"!==b(i,"overflow",s)){var d=new _.Rectangle(l);d.setClipMask(!0),a.addChild(d)}h&&a.transform(h)}},"fill-rule":function(t,e){"evenodd"!==e&&"nonzero"!==e||(t.fillRule=e)}});function b(t,e,n){var i=t.attributes[e],r=i&&i.value;if(!r&&t.style){var o=u.camelize(e);(r=t.style[o])||n.node[o]===n.parent[o]||(r=n.node[o])}return r?"none"===r?null:r:a}function A(t,e,n){var i=e.parentNode,r={node:J.getStyles(e)||{},parent:!n&&!/^defs$/i.test(i.tagName)&&J.getStyles(i)||{}};return u.each(y,function(n,i){var o=b(e,i,r);t=o!==a&&n(t,o,i,e,r)||t}),t}function w(t){var n=t&&t.match(/\((?:["'#]*)([^"')]+)/),i=n&&n[1],r=i&&e[l?i.replace(l.location.href.split("#")[0]+"#",""):i];return r&&r._scaleToBounds&&((r=r.clone())._scaleToBounds=!0),r}function T(n,i,o){var s,a,l,h=n.nodeName.toLowerCase(),d="#document"!==h,p=c.body;o&&d&&(t=dt.getView().getSize(),t=r(n,null,null,!0)||t,s=ut.create("svg",{style:"stroke-width: 1px; stroke-miterlimit: 10"}),a=n.parentNode,l=n.nextSibling,s.appendChild(n),p.appendChild(s));var g=dt.settings,m=g.applyMatrix,y=g.insertItems;g.applyMatrix=!1,g.insertItems=!1;var v=f[h],b=v&&v(n,h,i,o)||null;if(g.insertItems=y,g.applyMatrix=m,b){!d||b instanceof D||(b=A(b,n,o));var I=i.onImport,M=d&&n.getAttribute("data-paper-data");I&&(b=I(n,b,i)||b),i.expandShapes&&b instanceof _&&(b.remove(),b=b.toPath()),M&&(b._data=JSON.parse(M))}return s&&(p.removeChild(s),a&&(l?a.insertBefore(n,l):a.appendChild(n))),o&&(e={},b&&u.pick(i.applyMatrix,m)&&b.matrix.apply(!0,!0)),b}function N(t,e,n){if(!t)return null;e="function"==typeof e?{onLoad:e}:e||{};var i=dt,r=null;function o(o){try{var c="object"==typeof o?o:(new s.DOMParser).parseFromString(o,"image/svg+xml");if(!c.nodeName)throw c=null,new Error("Unsupported SVG source: "+t);dt=i,r=T(c,e,!0),e&&!1===e.insert||n._insertItem(a,r);var u=e.onLoad;u&&u(r,o)}catch(t){l(t)}}function l(t,n){var i=e.onError;if(!i)throw new Error(t);i(t,n)}if("string"!=typeof t||/^[\s\S]*</.test(t)){if("undefined"!=typeof File&&t instanceof File){var u=new FileReader;return u.onload=function(){o(u.result)},u.onerror=function(){l(u.error)},u.readAsText(t)}o(t)}else{var h=c.getElementById(t);h?o(h):at({url:t,async:!0,onLoad:o,onError:l})}return r}S.inject({importSVG:function(t,e){return N(t,e,this)}}),x.inject({importSVG:function(t,e){return this.activate(),N(t,e,this)}})},u.exports.PaperScript=function(){var t,e,h,p=this,f=p.acorn;if(!f)try{f=n(630)}catch(t){}f||(f=t=e={},h=function(t){"use strict";var e,n,i,r;t.version="0.5.0",t.parse=function(t,r){return n=String(t),i=n.length,s(r),Ht(),function(t){y=v=a,e.locations&&(b=new Qt),I=M=null,A=[],Kt();var n=t||ue(),i=!0;for(t||(n.body=[]);d!==_;){var r=Me();n.body.push(r),i&&pe(r)&&ae(!0),i=!1}return de(n,"Program")}(e.program)};var o=t.defaultOptions={ecmaVersion:5,strictSemicolons:!1,allowTrailingCommas:!0,forbidReserved:!1,allowReturnOutsideFunction:!1,locations:!1,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null};function s(t){for(var n in e=t||{},o)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=o[n]);r=e.sourceFile||null}var a,l,c,u,h,d,p,f,g,m,y,v,b,I,A,M,w=t.getLineInfo=function(t,e){for(var n=1,i=0;;){Yt.lastIndex=i;var r=Yt.exec(t);if(!(r&&r.index<e))break;++n,i=r.index+r[0].length}return{line:n,column:e-i}};function C(t,e){var i=w(n,t);e+=" ("+i.line+":"+i.column+")";var r=new SyntaxError(e);throw r.pos=t,r.loc=i,r.raisedAt=a,r}t.tokenize=function(t,r){n=String(t),i=n.length,s(r),Ht();var o={};function y(t){return v=c,Kt(t),o.start=l,o.end=c,o.startLoc=u,o.endLoc=h,o.type=d,o.value=p,o}return y.jumpTo=function(t,i){var r;if(a=t,e.locations)for(g=1,m=Yt.lastIndex=0;(r=Yt.exec(n))&&r.index<t;)++g,m=r.index+r[0].length;f=i,Jt()},y};var T=[],x={type:"num"},S={type:"regexp"},D={type:"string"},N={type:"name"},_={type:"eof"},E={keyword:"break"},j={keyword:"case",beforeExpr:!0},k={keyword:"catch"},O={keyword:"continue"},z={keyword:"debugger"},L={keyword:"default"},B={keyword:"do",isLoop:!0},P={keyword:"else",beforeExpr:!0},R={keyword:"finally"},U={keyword:"for",isLoop:!0},G={keyword:"function"},Y={keyword:"if"},Z={keyword:"return",beforeExpr:!0},W={keyword:"switch"},Q={keyword:"throw",beforeExpr:!0},H={keyword:"try"},F={keyword:"var"},V={keyword:"while",isLoop:!0},q={keyword:"with"},J={keyword:"new",beforeExpr:!0},X={keyword:"this"},K={keyword:"null",atomValue:null},$={keyword:"true",atomValue:!0},tt={keyword:"false",atomValue:!1},et={keyword:"in",binop:7,beforeExpr:!0},nt={break:E,case:j,catch:k,continue:O,debugger:z,default:L,do:B,else:P,finally:R,for:U,function:G,if:Y,return:Z,switch:W,throw:Q,try:H,var:F,while:V,with:q,null:K,true:$,false:tt,new:J,in:et,instanceof:{keyword:"instanceof",binop:7,beforeExpr:!0},this:X,typeof:{keyword:"typeof",prefix:!0,beforeExpr:!0},void:{keyword:"void",prefix:!0,beforeExpr:!0},delete:{keyword:"delete",prefix:!0,beforeExpr:!0}},it={type:"[",beforeExpr:!0},rt={type:"]"},ot={type:"{",beforeExpr:!0},st={type:"}"},at={type:"(",beforeExpr:!0},lt={type:")"},ct={type:",",beforeExpr:!0},ut={type:";",beforeExpr:!0},ht={type:":",beforeExpr:!0},dt={type:"."},pt={type:"?",beforeExpr:!0},ft={binop:10,beforeExpr:!0},gt={isAssign:!0,beforeExpr:!0},mt={isAssign:!0,beforeExpr:!0},yt={postfix:!0,prefix:!0,isUpdate:!0},vt={prefix:!0,beforeExpr:!0},bt={binop:1,beforeExpr:!0},It={binop:2,beforeExpr:!0},At={binop:3,beforeExpr:!0},Mt={binop:4,beforeExpr:!0},wt={binop:5,beforeExpr:!0},Ct={binop:6,beforeExpr:!0},Tt={binop:7,beforeExpr:!0},xt={binop:8,beforeExpr:!0},St={binop:9,prefix:!0,beforeExpr:!0},Dt={binop:10,beforeExpr:!0};for(var Nt in t.tokTypes={bracketL:it,bracketR:rt,braceL:ot,braceR:st,parenL:at,parenR:lt,comma:ct,semi:ut,colon:ht,dot:dt,question:pt,slash:ft,eq:gt,name:N,eof:_,num:x,regexp:S,string:D},nt)t.tokTypes["_"+Nt]=nt[Nt];function _t(t){t=t.split(" ");var e="",n=[];t:for(var i=0;i<t.length;++i){for(var r=0;r<n.length;++r)if(n[r][0].length==t[i].length){n[r].push(t[i]);continue t}n.push([t[i]])}function o(t){if(1==t.length)return e+="return str === "+JSON.stringify(t[0])+";";e+="switch(str){";for(var n=0;n<t.length;++n)e+="case "+JSON.stringify(t[n])+":";e+="return true}return false;"}if(n.length>3){for(n.sort(function(t,e){return e.length-t.length}),e+="switch(str.length){",i=0;i<n.length;++i){var s=n[i];e+="case "+s[0].length+":",o(s)}e+="}"}else o(t);return new Function("str",e)}var Et,jt=_t("abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile"),kt=_t("class enum extends super const export import"),Ot=_t("implements interface let package private protected public static yield"),zt=_t("eval arguments"),Lt=_t("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"),Bt=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Pt="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Rt=new RegExp("["+Pt+"]"),Ut=new RegExp("["+Pt+"̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ؚؠ-ىٲ-ۓۧ-ۨۻ-ۼܰ-݊ࠀ-ࠔࠛ-ࠣࠥ-ࠧࠩ-࠭ࡀ-ࡗࣤ-ࣾऀ-ःऺ-़ा-ॏ॑-ॗॢ-ॣ०-९ঁ-ঃ়া-ৄেৈৗয়-ৠਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୟ-ୠ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఁ-ఃె-ైొ-్ౕౖౢ-ౣ౦-౯ಂಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢ-ೣ೦-೯ംഃെ-ൈൗൢ-ൣ൦-൯ංඃ්ා-ුූෘ-ෟෲෳิ-ฺเ-ๅ๐-๙ິ-ູ່-ໍ໐-໙༘༙༠-༩༹༵༷ཁ-ཇཱ-྄྆-྇ྍ-ྗྙ-ྼ࿆က-ဩ၀-၉ၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜎ-ᜐᜠ-ᜰᝀ-ᝐᝲᝳក-ឲ៝០-៩᠋-᠍᠐-᠙ᤠ-ᤫᤰ-᤻ᥑ-ᥭᦰ-ᧀᧈ-ᧉ᧐-᧙ᨀ-ᨕᨠ-ᩓ᩠-᩿᩼-᪉᪐-᪙ᭆ-ᭋ᭐-᭙᭫-᭳᮰-᮹᯦-᯳ᰀ-ᰢ᱀-᱉ᱛ-ᱽ᳐-᳒ᴀ-ᶾḁ-ἕ‌‍‿⁀⁔⃐-⃥⃜⃡-⃰ⶁ-ⶖⷠ-ⷿ〡-〨゙゚Ꙁ-ꙭꙴ-꙽ꚟ꛰-꛱ꟸ-ꠀ꠆ꠋꠣ-ꠧꢀ-ꢁꢴ-꣄꣐-꣙ꣳ-ꣷ꤀-꤉ꤦ-꤭ꤰ-ꥅꦀ-ꦃ꦳-꧀ꨀ-ꨧꩀ-ꩁꩌ-ꩍ꩐-꩙ꩻꫠ-ꫩꫲ-ꫳꯀ-ꯡ꯬꯭꯰-꯹ﬠ-ﬨ︀-️︠-︦︳︴﹍-﹏0-9_]"),Gt=/[\n\r\u2028\u2029]/,Yt=/\r\n|[\n\r\u2028\u2029]/g,Zt=t.isIdentifierStart=function(t){return t<65?36===t:t<91||(t<97?95===t:t<123||t>=170&&Rt.test(String.fromCharCode(t)))},Wt=t.isIdentifierChar=function(t){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||t>=170&&Ut.test(String.fromCharCode(t))))};function Qt(){this.line=g,this.column=a-m}function Ht(){g=1,a=m=0,f=!0,Jt()}function Ft(t,n){c=a,e.locations&&(h=new Qt),d=t,Jt(),p=n,f=t.beforeExpr}function Vt(){var t,i=e.onComment&&e.locations&&new Qt,r=a,o=n.indexOf("*/",a+=2);if(-1===o&&C(a-2,"Unterminated comment"),a=o+2,e.locations)for(Yt.lastIndex=r;(t=Yt.exec(n))&&t.index<a;)++g,m=t.index+t[0].length;e.onComment&&e.onComment(!0,n.slice(r+2,o),r,a,i,e.locations&&new Qt)}function qt(){for(var t=a,r=e.onComment&&e.locations&&new Qt,o=n.charCodeAt(a+=2);a<i&&10!==o&&13!==o&&8232!==o&&8233!==o;)++a,o=n.charCodeAt(a);e.onComment&&e.onComment(!1,n.slice(t+2,a),t,a,r,e.locations&&new Qt)}function Jt(){for(;a<i;){var t=n.charCodeAt(a);if(32===t)++a;else if(13===t)++a,10===(r=n.charCodeAt(a))&&++a,e.locations&&(++g,m=a);else if(10===t||8232===t||8233===t)++a,e.locations&&(++g,m=a);else if(t>8&&t<14)++a;else if(47===t){var r;if(42===(r=n.charCodeAt(a+1)))Vt();else{if(47!==r)break;qt()}}else if(160===t)++a;else{if(!(t>=5760&&Bt.test(String.fromCharCode(t))))break;++a}}}function Xt(t){switch(t){case 46:return function(){var t=n.charCodeAt(a+1);return t>=48&&t<=57?ne(!0):(++a,Ft(dt))}();case 40:return++a,Ft(at);case 41:return++a,Ft(lt);case 59:return++a,Ft(ut);case 44:return++a,Ft(ct);case 91:return++a,Ft(it);case 93:return++a,Ft(rt);case 123:return++a,Ft(ot);case 125:return++a,Ft(st);case 58:return++a,Ft(ht);case 63:return++a,Ft(pt);case 48:var r=n.charCodeAt(a+1);if(120===r||88===r)return function(){a+=2;var t=ee(16);return null==t&&C(l+2,"Expected hexadecimal number"),Zt(n.charCodeAt(a))&&C(a,"Identifier directly after number"),Ft(x,t)}();case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return ne(!1);case 34:case 39:return function(t){a++;for(var r="";;){a>=i&&C(l,"Unterminated string constant");var o=n.charCodeAt(a);if(o===t)return++a,Ft(D,r);if(92===o){o=n.charCodeAt(++a);var s=/^[0-7]+/.exec(n.slice(a,a+3));for(s&&(s=s[0]);s&&parseInt(s,8)>255;)s=s.slice(0,-1);if("0"===s&&(s=null),++a,s)M&&C(a-2,"Octal literal in strict mode"),r+=String.fromCharCode(parseInt(s,8)),a+=s.length-1;else switch(o){case 110:r+="\n";break;case 114:r+="\r";break;case 120:r+=String.fromCharCode(ie(2));break;case 117:r+=String.fromCharCode(ie(4));break;case 85:r+=String.fromCharCode(ie(8));break;case 116:r+="\t";break;case 98:r+="\b";break;case 118:r+="\v";break;case 102:r+="\f";break;case 48:r+="\0";break;case 13:10===n.charCodeAt(a)&&++a;case 10:e.locations&&(m=a,++g);break;default:r+=String.fromCharCode(o)}}else 13!==o&&10!==o&&8232!==o&&8233!==o||C(l,"Unterminated string constant"),r+=String.fromCharCode(o),++a}}(t);case 47:return function(){var t=n.charCodeAt(a+1);return f?(++a,te()):61===t?$t(mt,2):$t(ft,1)}();case 37:case 42:return 61===n.charCodeAt(a+1)?$t(mt,2):$t(Dt,1);case 124:case 38:return function(t){var e=n.charCodeAt(a+1);return e===t?$t(124===t?bt:It,2):61===e?$t(mt,2):$t(124===t?At:wt,1)}(t);case 94:return 61===n.charCodeAt(a+1)?$t(mt,2):$t(Mt,1);case 43:case 45:return function(t){var e=n.charCodeAt(a+1);return e===t?45==e&&62==n.charCodeAt(a+2)&&Gt.test(n.slice(v,a))?(a+=3,qt(),Jt(),Kt()):$t(yt,2):61===e?$t(mt,2):$t(St,1)}(t);case 60:case 62:return function(t){var e=n.charCodeAt(a+1),i=1;return e===t?(i=62===t&&62===n.charCodeAt(a+2)?3:2,61===n.charCodeAt(a+i)?$t(mt,i+1):$t(xt,i)):33==e&&60==t&&45==n.charCodeAt(a+2)&&45==n.charCodeAt(a+3)?(a+=4,qt(),Jt(),Kt()):(61===e&&(i=61===n.charCodeAt(a+2)?3:2),$t(Tt,i))}(t);case 61:case 33:return function(t){return 61===n.charCodeAt(a+1)?$t(Ct,61===n.charCodeAt(a+2)?3:2):$t(61===t?gt:vt,1)}(t);case 126:return $t(vt,1)}return!1}function Kt(t){if(t?a=l+1:l=a,e.locations&&(u=new Qt),t)return te();if(a>=i)return Ft(_);var r=n.charCodeAt(a);if(Zt(r)||92===r)return oe();var o=Xt(r);if(!1===o){var s=String.fromCharCode(r);if("\\"===s||Rt.test(s))return oe();C(a,"Unexpected character '"+s+"'")}return o}function $t(t,e){var i=n.slice(a,a+e);a+=e,Ft(t,i)}function te(){for(var t,e,r=a;;){a>=i&&C(r,"Unterminated regular expression");var o=n.charAt(a);if(Gt.test(o)&&C(r,"Unterminated regular expression"),t)t=!1;else{if("["===o)e=!0;else if("]"===o&&e)e=!1;else if("/"===o&&!e)break;t="\\"===o}++a}var s=n.slice(r,a);++a;var l=re();l&&!/^[gmsiy]*$/.test(l)&&C(r,"Invalid regexp flag");try{var c=new RegExp(s,l)}catch(t){t instanceof SyntaxError&&C(r,t.message),C(t)}return Ft(S,c)}function ee(t,e){for(var i=a,r=0,o=0,s=null==e?1/0:e;o<s;++o){var l,c=n.charCodeAt(a);if((l=c>=97?c-97+10:c>=65?c-65+10:c>=48&&c<=57?c-48:1/0)>=t)break;++a,r=r*t+l}return a===i||null!=e&&a-i!==e?null:r}function ne(t){var e=a,i=!1,r=48===n.charCodeAt(a);t||null!==ee(10)||C(e,"Invalid number"),46===n.charCodeAt(a)&&(++a,ee(10),i=!0);var o=n.charCodeAt(a);69!==o&&101!==o||(43!==(o=n.charCodeAt(++a))&&45!==o||++a,null===ee(10)&&C(e,"Invalid number"),i=!0),Zt(n.charCodeAt(a))&&C(a,"Identifier directly after number");var s,l=n.slice(e,a);return i?s=parseFloat(l):r&&1!==l.length?/[89]/.test(l)||M?C(e,"Invalid number"):s=parseInt(l,8):s=parseInt(l,10),Ft(x,s)}function ie(t){var e=ee(16,t);return null===e&&C(l,"Bad character escape sequence"),e}function re(){Et=!1;for(var t,e=!0,i=a;;){var r=n.charCodeAt(a);if(Wt(r))Et&&(t+=n.charAt(a)),++a;else{if(92!==r)break;Et||(t=n.slice(i,a)),Et=!0,117!=n.charCodeAt(++a)&&C(a,"Expecting Unicode escape sequence \\uXXXX"),++a;var o=ie(4),s=String.fromCharCode(o);s||C(a-1,"Invalid Unicode escape"),(e?Zt(o):Wt(o))||C(a-4,"Invalid Unicode escape"),t+=s}e=!1}return Et?t:n.slice(i,a)}function oe(){var t=re(),e=N;return!Et&&Lt(t)&&(e=nt[t]),Ft(e,t)}function se(){y=l,v=c,b=h,Kt()}function ae(t){if(M=t,a=l,e.locations)for(;a<m;)m=n.lastIndexOf("\n",m-2)+1,--g;Jt(),Kt()}function le(){this.type=null,this.start=l,this.end=null}function ce(){this.start=u,this.end=null,null!==r&&(this.source=r)}function ue(){var t=new le;return e.locations&&(t.loc=new ce),e.directSourceFile&&(t.sourceFile=e.directSourceFile),e.ranges&&(t.range=[l,0]),t}function he(t){var n=new le;return n.start=t.start,e.locations&&(n.loc=new ce,n.loc.start=t.loc.start),e.ranges&&(n.range=[t.range[0],0]),n}function de(t,n){return t.type=n,t.end=v,e.locations&&(t.loc.end=b),e.ranges&&(t.range[1]=v),t}function pe(t){return e.ecmaVersion>=5&&"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"use strict"===t.expression.value}function fe(t){if(d===t)return se(),!0}function ge(){return!e.strictSemicolons&&(d===_||d===st||Gt.test(n.slice(v,l)))}function me(){fe(ut)||ge()||ve()}function ye(t){d===t?se():ve()}function ve(){C(l,"Unexpected token")}function be(t){"Identifier"!==t.type&&"MemberExpression"!==t.type&&C(t.start,"Assigning to rvalue"),M&&"Identifier"===t.type&&zt(t.name)&&C(t.start,"Assigning to "+t.name+" in strict mode")}var Ie={kind:"loop"},Ae={kind:"switch"};function Me(){(d===ft||d===mt&&"/="==p)&&Kt(!0);var t=d,i=ue();switch(t){case E:case O:se();var r=t===E;fe(ut)||ge()?i.label=null:d!==N?ve():(i.label=Be(),me());for(var o=0;o<A.length;++o){var s=A[o];if(null==i.label||s.name===i.label.name){if(null!=s.kind&&(r||"loop"===s.kind))break;if(i.label&&r)break}}return o===A.length&&C(i.start,"Unsyntactic "+t.keyword),de(i,r?"BreakStatement":"ContinueStatement");case z:return se(),me(),de(i,"DebuggerStatement");case B:return se(),A.push(Ie),i.body=Me(),A.pop(),ye(V),i.test=we(),me(),de(i,"DoWhileStatement");case U:if(se(),A.push(Ie),ye(at),d===ut)return Te(i,null);if(d===F){var a=ue();return se(),Se(a,!0),de(a,"VariableDeclaration"),1===a.declarations.length&&fe(et)?xe(i,a):Te(i,a)}return a=De(!1,!0),fe(et)?(be(a),xe(i,a)):Te(i,a);case G:return se(),ze(i,!0);case Y:return se(),i.test=we(),i.consequent=Me(),i.alternate=fe(P)?Me():null,de(i,"IfStatement");case Z:return I||e.allowReturnOutsideFunction||C(l,"'return' outside of function"),se(),fe(ut)||ge()?i.argument=null:(i.argument=De(),me()),de(i,"ReturnStatement");case W:se(),i.discriminant=we(),i.cases=[],ye(ot),A.push(Ae);for(var c,u;d!=st;)if(d===j||d===L){var h=d===j;c&&de(c,"SwitchCase"),i.cases.push(c=ue()),c.consequent=[],se(),h?c.test=De():(u&&C(y,"Multiple default clauses"),u=!0,c.test=null),ye(ht)}else c||ve(),c.consequent.push(Me());return c&&de(c,"SwitchCase"),se(),A.pop(),de(i,"SwitchStatement");case Q:return se(),Gt.test(n.slice(v,l))&&C(v,"Illegal newline after throw"),i.argument=De(),me(),de(i,"ThrowStatement");case H:if(se(),i.block=Ce(),i.handler=null,d===k){var f=ue();se(),ye(at),f.param=Be(),M&&zt(f.param.name)&&C(f.param.start,"Binding "+f.param.name+" in strict mode"),ye(lt),f.guard=null,f.body=Ce(),i.handler=de(f,"CatchClause")}return i.guardedHandlers=T,i.finalizer=fe(R)?Ce():null,i.handler||i.finalizer||C(i.start,"Missing catch or finally clause"),de(i,"TryStatement");case F:return se(),Se(i),me(),de(i,"VariableDeclaration");case V:return se(),i.test=we(),A.push(Ie),i.body=Me(),A.pop(),de(i,"WhileStatement");case q:return M&&C(l,"'with' in strict mode"),se(),i.object=we(),i.body=Me(),de(i,"WithStatement");case ot:return Ce();case ut:return se(),de(i,"EmptyStatement");default:var g=p,m=De();if(t===N&&"Identifier"===m.type&&fe(ht)){for(o=0;o<A.length;++o)A[o].name===g&&C(m.start,"Label '"+g+"' is already declared");var b=d.isLoop?"loop":d===W?"switch":null;return A.push({name:g,kind:b}),i.body=Me(),A.pop(),i.label=m,de(i,"LabeledStatement")}return i.expression=m,me(),de(i,"ExpressionStatement")}}function we(){ye(at);var t=De();return ye(lt),t}function Ce(t){var e,n=ue(),i=!0,r=!1;for(n.body=[],ye(ot);!fe(st);){var o=Me();n.body.push(o),i&&t&&pe(o)&&(e=r,ae(r=!0)),i=!1}return r&&!e&&ae(!1),de(n,"BlockStatement")}function Te(t,e){return t.init=e,ye(ut),t.test=d===ut?null:De(),ye(ut),t.update=d===lt?null:De(),ye(lt),t.body=Me(),A.pop(),de(t,"ForStatement")}function xe(t,e){return t.left=e,t.right=De(),ye(lt),t.body=Me(),A.pop(),de(t,"ForInStatement")}function Se(t,e){for(t.declarations=[],t.kind="var";;){var n=ue();if(n.id=Be(),M&&zt(n.id.name)&&C(n.id.start,"Binding "+n.id.name+" in strict mode"),n.init=fe(gt)?De(!0,e):null,t.declarations.push(de(n,"VariableDeclarator")),!fe(ct))break}return t}function De(t,e){var n=Ne(e);if(!t&&d===ct){var i=he(n);for(i.expressions=[n];fe(ct);)i.expressions.push(Ne(e));return de(i,"SequenceExpression")}return n}function Ne(t){var e=function(t){var e=function(t){return _e(Ee(),-1,t)}(t);if(fe(pt)){var n=he(e);return n.test=e,n.consequent=De(!0),ye(ht),n.alternate=De(!0,t),de(n,"ConditionalExpression")}return e}(t);if(d.isAssign){var n=he(e);return n.operator=p,n.left=e,se(),n.right=Ne(t),be(e),de(n,"AssignmentExpression")}return e}function _e(t,e,n){var i=d.binop;if(null!=i&&(!n||d!==et)&&i>e){var r=he(t);r.left=t,r.operator=p;var o=d;return se(),r.right=_e(Ee(),i,n),_e(de(r,o===bt||o===It?"LogicalExpression":"BinaryExpression"),e,n)}return t}function Ee(){if(d.prefix){var t=ue(),e=d.isUpdate;return t.operator=p,t.prefix=!0,f=!0,se(),t.argument=Ee(),e?be(t.argument):M&&"delete"===t.operator&&"Identifier"===t.argument.type&&C(t.start,"Deleting local variable in strict mode"),de(t,e?"UpdateExpression":"UnaryExpression")}for(var n=je(ke());d.postfix&&!ge();)(t=he(n)).operator=p,t.prefix=!1,t.argument=n,be(n),se(),n=de(t,"UpdateExpression");return n}function je(t,e){var n;return fe(dt)?((n=he(t)).object=t,n.property=Be(!0),n.computed=!1,je(de(n,"MemberExpression"),e)):fe(it)?((n=he(t)).object=t,n.property=De(),n.computed=!0,ye(rt),je(de(n,"MemberExpression"),e)):!e&&fe(at)?((n=he(t)).callee=t,n.arguments=Le(lt,!1),je(de(n,"CallExpression"),e)):t}function ke(){switch(d){case X:var t=ue();return se(),de(t,"ThisExpression");case N:return Be();case x:case D:case S:return(t=ue()).value=p,t.raw=n.slice(l,c),se(),de(t,"Literal");case K:case $:case tt:return(t=ue()).value=d.atomValue,t.raw=d.keyword,se(),de(t,"Literal");case at:var i=u,r=l;se();var o=De();return o.start=r,o.end=c,e.locations&&(o.loc.start=i,o.loc.end=h),e.ranges&&(o.range=[r,c]),ye(lt),o;case it:return t=ue(),se(),t.elements=Le(rt,!0,!0),de(t,"ArrayExpression");case ot:return function(){var t=ue(),n=!0,i=!1;for(t.properties=[],se();!fe(st);){if(n)n=!1;else if(ye(ct),e.allowTrailingCommas&&fe(st))break;var r,o={key:Oe()},s=!1;if(fe(ht)?(o.value=De(!0),r=o.kind="init"):e.ecmaVersion>=5&&"Identifier"===o.key.type&&("get"===o.key.name||"set"===o.key.name)?(s=i=!0,r=o.kind=o.key.name,o.key=Oe(),d!==at&&ve(),o.value=ze(ue(),!1)):ve(),"Identifier"===o.key.type&&(M||i))for(var a=0;a<t.properties.length;++a){var l=t.properties[a];if(l.key.name===o.key.name){var c=r==l.kind||s&&"init"===l.kind||"init"===r&&("get"===l.kind||"set"===l.kind);c&&!M&&"init"===r&&"init"===l.kind&&(c=!1),c&&C(o.key.start,"Redefinition of property")}}t.properties.push(o)}return de(t,"ObjectExpression")}();case G:return t=ue(),se(),ze(t,!1);case J:return function(){var t=ue();return se(),t.callee=je(ke(),!0),fe(at)?t.arguments=Le(lt,!1):t.arguments=T,de(t,"NewExpression")}();default:ve()}}function Oe(){return d===x||d===D?ke():Be(!0)}function ze(t,e){d===N?t.id=Be():e?ve():t.id=null,t.params=[];var n=!0;for(ye(at);!fe(lt);)n?n=!1:ye(ct),t.params.push(Be());var i=I,r=A;if(I=!0,A=[],t.body=Ce(!0),I=i,A=r,M||t.body.body.length&&pe(t.body.body[0]))for(var o=t.id?-1:0;o<t.params.length;++o){var s=o<0?t.id:t.params[o];if((Ot(s.name)||zt(s.name))&&C(s.start,"Defining '"+s.name+"' in strict mode"),o>=0)for(var a=0;a<o;++a)s.name===t.params[a].name&&C(s.start,"Argument name clash in strict mode")}return de(t,e?"FunctionDeclaration":"FunctionExpression")}function Le(t,n,i){for(var r=[],o=!0;!fe(t);){if(o)o=!1;else if(ye(ct),n&&e.allowTrailingCommas&&fe(t))break;i&&d===ct?r.push(null):r.push(De(!0))}return r}function Be(t){var i=ue();return t&&"everywhere"==e.forbidReserved&&(t=!1),d===N?(!t&&(e.forbidReserved&&(3===e.ecmaVersion?jt:kt)(p)||M&&Ot(p))&&-1==n.slice(l,c).indexOf("\\")&&C(l,"The keyword '"+p+"' is reserved"),i.name=p):t&&d.keyword?i.name=d.keyword:ve(),f=!1,se(),de(i,"Identifier")}},"object"==typeof t&&"object"==typeof e?h(t):(i=[t],(o="function"==typeof(r=h)?r.apply(t,i):r)===a||(e.exports=o)),f.version||(f=null));function g(t,e){return(p.acorn||f).parse(t,e)}var m={"+":"__add","-":"__subtract","*":"__multiply","/":"__divide","%":"__modulo","==":"__equals","!=":"__equals"},y={"-":"__negate","+":"__self"},b=u.each(["add","subtract","multiply","divide","modulo","equals","negate"],function(t){this["__"+t]="#"+t},{__self:function(){return this}});function A(t,e,n){var i=m[e];if(t&&t[i]){var r=t[i](n);return"!="===e?!r:r}switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n;case"%":return t%n;case"==":return t==n;case"!=":return t!=n}}function M(t,e){var n=y[t];if(e&&e[n])return e[n]();switch(t){case"+":return+e;case"-":return-e}}function w(t,e){if(!t)return"";var n=[];function i(t){for(var e=0,i=n.length;e<i;e++){var r=n[e];if(r[0]>=t)break;t+=r[1]}return t}function r(e){return t.substring(i(e.range[0]),i(e.range[1]))}function o(e,r){for(var o=i(e.range[0]),s=i(e.range[1]),a=0,l=n.length-1;l>=0;l--)if(o>n[l][0]){a=l+1;break}n.splice(a,0,[o,r.length-s+o]),t=t.substring(0,o)+r+t.substring(s)}function a(e,n){switch(e.type){case"UnaryExpression":if(e.operator in y&&"Literal"!==e.argument.type){var s=r(e.argument);o(e,'$__("'+e.operator+'", '+s+")")}break;case"BinaryExpression":if(e.operator in m&&"Literal"!==e.left.type){var a=r(e.left),l=r(e.right),c=function(e,n){return t.substring(i(e.range[1]),i(n.range[0]))}(e.left,e.right),u=e.operator;o(e,"__$__("+a+","+c.replace(new RegExp("\\"+u),'"'+u+'"')+", "+l+")")}break;case"UpdateExpression":case"AssignmentExpression":var h=n&&n.type;if(!("ForStatement"===h||"BinaryExpression"===h&&/^[=!<>]/.test(n.operator)||"MemberExpression"===h&&n.computed))if("UpdateExpression"===e.type){var d=(s=r(e.argument))+" = "+(p="__$__("+s+', "'+e.operator[0]+'", 1)');e.prefix?d="("+d+")":"AssignmentExpression"!==h&&"VariableDeclarator"!==h&&"BinaryExpression"!==h||(r(n.left||n.id)===s&&(d=p),d=s+"; "+d),o(e,d)}else if(/^.=$/.test(e.operator)&&"Literal"!==e.left.type){a=r(e.left),l=r(e.right);var p=a+" = __$__("+a+', "'+e.operator[0]+'", '+l+")";o(e,/^\(.*\)$/.test(r(e))?"("+p+")":p)}}}var u,h=(e=e||{}).url||"",d=e.sourceMaps,p=e.paperFeatures||{},f=e.source||t,v=e.offset||0,b=dt.agent,I=b.versionNumber,A=!1,M=/\r\n|\n|\r/gm;if(d&&(b.chrome&&I>=30||b.webkit&&I>=537.76||b.firefox&&I>=23||b.node)){if(b.node)v-=2;else if(l&&h&&!l.location.href.indexOf(h)){var w=c.getElementsByTagName("html")[0].innerHTML;v=w.substr(0,w.indexOf(t)+1).match(M).length+1}var C=["AA"+function(t){var e="";for(t=(Math.abs(t)<<1)+(t<0?1:0);t||!e;){var n=31&t;(t>>=5)&&(n|=32),e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[n]}return e}((A=v>0&&!(b.chrome&&I>=36||b.safari&&I>=600||b.firefox&&I>=40||b.node))?0:v)+"A"];C.length=(t.match(M)||[]).length+1+(A?v:0),u={version:3,file:h,names:[],mappings:C.join(";AACA"),sourceRoot:"",sources:[h],sourcesContent:[f]}}return!1===p.operatorOverloading&&!1===p.moduleExports||function t(e,n,i){if(e){for(var s in e)if("range"!==s&&"loc"!==s){var l=e[s];if(Array.isArray(l))for(var c=0,u=l.length;c<u;c++)t(l[c],e,i);else l&&"object"==typeof l&&t(l,e,i)}!1!==i.operatorOverloading&&a(e,n),!1!==i.moduleExports&&function(t){switch(t.type){case"ExportDefaultDeclaration":o({range:[t.start,t.declaration.start]},"module.exports = ");break;case"ExportNamedDeclaration":var e=t.declaration,n=t.specifiers;if(e){var i=e.declarations;i&&(i.forEach(function(t){o(t,"module.exports."+r(t))}),o({range:[t.start,e.start+e.kind.length]},""))}else if(n){var s=n.map(function(t){var e=r(t);return"module.exports."+e+" = "+e+"; "}).join("");s&&o(t,s)}}}(e)}}(g(t,{ranges:!0,preserveParens:!0,sourceType:"module"}),null,p),u&&(A&&(t=new Array(v+1).join("\n")+t),/^(inline|both)$/.test(d)&&(t+="\n//# sourceMappingURL=data:application/json;base64,"+s.btoa(unescape(encodeURIComponent(JSON.stringify(u))))),t+="\n//# sourceURL="+(h||"paperscript")),{url:h,source:f,code:t,map:u}}function C(t,e,n){dt=e;var i,r=e.getView(),o=/\btool\.\w+|\s+on(?:Key|Mouse)(?:Up|Down|Move|Drag)\b/.test(t)&&!/\bnew\s+Tool\b/.test(t)?new ot:null,s=o?o._events:[],a=["onFrame","onResize"].concat(s),l=[],h=[],d="object"==typeof t?t:w(t,n);function p(e,n){for(var i in e)!n&&/^_/.test(i)||!new RegExp("([\\b\\s\\W]|^)"+i.replace(/\$/g,"\\$")+"\\b").test(t)||(l.push(i),h.push(e[i]))}t=d.code,p({__$__:A,$__:M,paper:e,tool:o},!0),p(e),t="var module = { exports: {} }; "+t,(y=u.each(a,function(e){new RegExp("\\s+"+e+"\\b").test(t)&&(l.push(e),this.push("module.exports."+e+" = "+e+";"))},[]).join("\n"))&&(t+="\n"+y),t+="\nreturn module.exports;";var f=dt.agent;if(c&&(f.chrome||f.firefox&&f.versionNumber<40)){var g=c.createElement("script"),m=c.head||c.getElementsByTagName("head")[0];f.firefox&&(t="\n"+t),g.appendChild(c.createTextNode("document.__paperscript__ = function("+l+") {"+t+"\n}")),m.appendChild(g),i=c.__paperscript__,delete c.__paperscript__,m.removeChild(g)}else i=Function(l,t);var y,b=(y=i&&i.apply(e,h))||{};return u.each(s,function(t){var e=b[t];e&&(o[t]=e)}),r&&(b.onResize&&r.setOnResize(b.onResize),r.emit("resize",{size:r.size,delta:new v}),b.onFrame&&r.setOnFrame(b.onFrame),r.requestUpdate()),y}function T(t){if(/^text\/(?:x-|)paperscript$/.test(t.type)&&"true"!==d.getAttribute(t,"ignore")){var e=d.getAttribute(t,"canvas"),n=c.getElementById(e),i=t.src||t.getAttribute("data-src"),r=d.hasAttribute(t,"async"),o="data-paper-scope";if(!n)throw new Error('Unable to find canvas with id "'+e+'"');var s=d.get(n.getAttribute(o))||(new d).setup(n);return n.setAttribute(o,s._id),i?at({url:i,async:r,mimeType:"text/plain",onLoad:function(t){C(t,s,i)}}):C(t.innerHTML,s,t.baseURI),t.setAttribute("data-paper-ignore","true"),s}}function x(){u.each(c&&c.getElementsByTagName("script"),T)}return v.inject(b),I.inject(b),H.inject(b),l&&("complete"===c.readyState?setTimeout(x):X.add(l,{load:x})),{compile:w,execute:C,load:function(t){return t?T(t):x()},parse:g,calculateBinary:A,calculateUnary:M}}.call(this);var dt=new(d.inject(u.exports,{Base:u,Numerical:m,Key:nt,DomEvent:X,DomElement:J,document:c,window:l,Symbol:k,PlacedSymbol:j}));return dt.agent.node&&n(946)(dt),(o="function"==typeof(r=dt)?r.call(e,n,e,t):r)===a||(t.exports=o),dt}).call(this,"object"==typeof self?self:null)},630:function(t,e){!function(t){"use strict";var e=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],n=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],i="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",r="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",o={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},s="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",a={5:s,"5module":s+" export import",6:s+" const class extends export import super"},l=/^in(stanceof)?$/,c=new RegExp("["+r+"]"),u=new RegExp("["+r+i+"]");function h(t,e){for(var n=65536,i=0;i<e.length;i+=2){if((n+=e[i])>t)return!1;if((n+=e[i+1])>=t)return!0}return!1}function d(t,e){return t<65?36===t:t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&c.test(String.fromCharCode(t)):!1!==e&&h(t,n)))}function p(t,i){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&u.test(String.fromCharCode(t)):!1!==i&&(h(t,n)||h(t,e)))))}var f=function(t,e){void 0===e&&(e={}),this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=e.binop||null,this.updateContext=null};function g(t,e){return new f(t,{beforeExpr:!0,binop:e})}var m={beforeExpr:!0},y={startsExpr:!0},v={};function b(t,e){return void 0===e&&(e={}),e.keyword=t,v[t]=new f(t,e)}var I={num:new f("num",y),regexp:new f("regexp",y),string:new f("string",y),name:new f("name",y),privateId:new f("privateId",y),eof:new f("eof"),bracketL:new f("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new f("]"),braceL:new f("{",{beforeExpr:!0,startsExpr:!0}),braceR:new f("}"),parenL:new f("(",{beforeExpr:!0,startsExpr:!0}),parenR:new f(")"),comma:new f(",",m),semi:new f(";",m),colon:new f(":",m),dot:new f("."),question:new f("?",m),questionDot:new f("?."),arrow:new f("=>",m),template:new f("template"),invalidTemplate:new f("invalidTemplate"),ellipsis:new f("...",m),backQuote:new f("`",y),dollarBraceL:new f("${",{beforeExpr:!0,startsExpr:!0}),eq:new f("=",{beforeExpr:!0,isAssign:!0}),assign:new f("_=",{beforeExpr:!0,isAssign:!0}),incDec:new f("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new f("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:g("||",1),logicalAND:g("&&",2),bitwiseOR:g("|",3),bitwiseXOR:g("^",4),bitwiseAND:g("&",5),equality:g("==/!=/===/!==",6),relational:g("</>/<=/>=",7),bitShift:g("<</>>/>>>",8),plusMin:new f("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:g("%",10),star:g("*",10),slash:g("/",10),starstar:new f("**",{beforeExpr:!0}),coalesce:g("??",1),_break:b("break"),_case:b("case",m),_catch:b("catch"),_continue:b("continue"),_debugger:b("debugger"),_default:b("default",m),_do:b("do",{isLoop:!0,beforeExpr:!0}),_else:b("else",m),_finally:b("finally"),_for:b("for",{isLoop:!0}),_function:b("function",y),_if:b("if"),_return:b("return",m),_switch:b("switch"),_throw:b("throw",m),_try:b("try"),_var:b("var"),_const:b("const"),_while:b("while",{isLoop:!0}),_with:b("with"),_new:b("new",{beforeExpr:!0,startsExpr:!0}),_this:b("this",y),_super:b("super",y),_class:b("class",y),_extends:b("extends",m),_export:b("export"),_import:b("import",y),_null:b("null",y),_true:b("true",y),_false:b("false",y),_in:b("in",{beforeExpr:!0,binop:7}),_instanceof:b("instanceof",{beforeExpr:!0,binop:7}),_typeof:b("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:b("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:b("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},A=/\r\n?|\n|\u2028|\u2029/,M=new RegExp(A.source,"g");function w(t){return 10===t||13===t||8232===t||8233===t}function C(t,e,n){void 0===n&&(n=t.length);for(var i=e;i<n;i++){var r=t.charCodeAt(i);if(w(r))return i<n-1&&13===r&&10===t.charCodeAt(i+1)?i+2:i+1}return-1}var T=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,x=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,S=Object.prototype,D=S.hasOwnProperty,N=S.toString,_=Object.hasOwn||function(t,e){return D.call(t,e)},E=Array.isArray||function(t){return"[object Array]"===N.call(t)},j=Object.create(null);function k(t){return j[t]||(j[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function O(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}var z=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,L=function(t,e){this.line=t,this.column=e};L.prototype.offset=function(t){return new L(this.line,this.column+t)};var B=function(t,e,n){this.start=e,this.end=n,null!==t.sourceFile&&(this.source=t.sourceFile)};function P(t,e){for(var n=1,i=0;;){var r=C(t,i,e);if(r<0)return new L(n,e-i);++n,i=r}}var R={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},U=!1;function G(t){var e={};for(var n in R)e[n]=t&&_(t,n)?t[n]:R[n];if("latest"===e.ecmaVersion?e.ecmaVersion=1e8:null==e.ecmaVersion?(!U&&"object"==typeof console&&console.warn&&(U=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),null==e.allowReserved&&(e.allowReserved=e.ecmaVersion<5),t&&null!=t.allowHashBang||(e.allowHashBang=e.ecmaVersion>=14),E(e.onToken)){var i=e.onToken;e.onToken=function(t){return i.push(t)}}return E(e.onComment)&&(e.onComment=Y(e,e.onComment)),e}function Y(t,e){return function(n,i,r,o,s,a){var l={type:n?"Block":"Line",value:i,start:r,end:o};t.locations&&(l.loc=new B(this,s,a)),t.ranges&&(l.range=[r,o]),e.push(l)}}var Z=1,W=2,Q=4,H=8,F=16,V=32,q=64,J=128,X=256,K=512,$=Z|W|X;function tt(t,e){return W|(t?Q:0)|(e?H:0)}var et=0,nt=1,it=2,rt=3,ot=4,st=5,at=function(t,e,n){this.options=t=G(t),this.sourceFile=t.sourceFile,this.keywords=k(a[t.ecmaVersion>=6?6:"module"===t.sourceType?"5module":5]);var i="";!0!==t.allowReserved&&(i=o[t.ecmaVersion>=6?6:5===t.ecmaVersion?5:3],"module"===t.sourceType&&(i+=" await")),this.reservedWords=k(i);var r=(i?i+" ":"")+o.strict;this.reservedWordsStrict=k(r),this.reservedWordsStrictBind=k(r+" "+o.strictBind),this.input=String(e),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf("\n",n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(A).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=I.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===t.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&t.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(Z),this.regexpState=null,this.privateNameStack=[]},lt={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};at.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)},lt.inFunction.get=function(){return(this.currentVarScope().flags&W)>0},lt.inGenerator.get=function(){return(this.currentVarScope().flags&H)>0},lt.inAsync.get=function(){return(this.currentVarScope().flags&Q)>0},lt.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t].flags;if(e&(X|K))return!1;if(e&W)return(e&Q)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},lt.allowSuper.get=function(){return(this.currentThisScope().flags&q)>0||this.options.allowSuperOutsideMethod},lt.allowDirectSuper.get=function(){return(this.currentThisScope().flags&J)>0},lt.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},lt.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t].flags;if(e&(X|K)||e&W&&!(e&F))return!0}return!1},lt.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&X)>0},at.extend=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];for(var n=this,i=0;i<t.length;i++)n=t[i](n);return n},at.parse=function(t,e){return new this(e,t).parse()},at.parseExpressionAt=function(t,e,n){var i=new this(n,t,e);return i.nextToken(),i.parseExpression()},at.tokenizer=function(t,e){return new this(e,t)},Object.defineProperties(at.prototype,lt);var ct=at.prototype,ut=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ct.strictDirective=function(t){if(this.options.ecmaVersion<5)return!1;for(;;){x.lastIndex=t,t+=x.exec(this.input)[0].length;var e=ut.exec(this.input.slice(t));if(!e)return!1;if("use strict"===(e[1]||e[2])){x.lastIndex=t+e[0].length;var n=x.exec(this.input),i=n.index+n[0].length,r=this.input.charAt(i);return";"===r||"}"===r||A.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(r)||"!"===r&&"="===this.input.charAt(i+1))}t+=e[0].length,x.lastIndex=t,t+=x.exec(this.input)[0].length,";"===this.input[t]&&t++}},ct.eat=function(t){return this.type===t&&(this.next(),!0)},ct.isContextual=function(t){return this.type===I.name&&this.value===t&&!this.containsEsc},ct.eatContextual=function(t){return!!this.isContextual(t)&&(this.next(),!0)},ct.expectContextual=function(t){this.eatContextual(t)||this.unexpected()},ct.canInsertSemicolon=function(){return this.type===I.eof||this.type===I.braceR||A.test(this.input.slice(this.lastTokEnd,this.start))},ct.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},ct.semicolon=function(){this.eat(I.semi)||this.insertSemicolon()||this.unexpected()},ct.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0},ct.expect=function(t){this.eat(t)||this.unexpected()},ct.unexpected=function(t){this.raise(null!=t?t:this.start,"Unexpected token")};var ht=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ct.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var n=e?t.parenthesizedAssign:t.parenthesizedBind;n>-1&&this.raiseRecoverable(n,e?"Assigning to rvalue":"Parenthesized pattern")}},ct.checkExpressionErrors=function(t,e){if(!t)return!1;var n=t.shorthandAssign,i=t.doubleProto;if(!e)return n>=0||i>=0;n>=0&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")},ct.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},ct.isSimpleAssignTarget=function(t){return"ParenthesizedExpression"===t.type?this.isSimpleAssignTarget(t.expression):"Identifier"===t.type||"MemberExpression"===t.type};var dt=at.prototype;dt.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==I.eof;){var n=this.parseStatement(null,!0,e);t.body.push(n)}if(this.inModule)for(var i=0,r=Object.keys(this.undefinedExports);i<r.length;i+=1){var o=r[i];this.raiseRecoverable(this.undefinedExports[o].start,"Export '"+o+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var pt={kind:"loop"},ft={kind:"switch"};dt.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;x.lastIndex=this.pos;var e=x.exec(this.input),n=this.pos+e[0].length,i=this.input.charCodeAt(n);if(91===i||92===i)return!0;if(t)return!1;if(123===i||i>55295&&i<56320)return!0;if(d(i,!0)){for(var r=n+1;p(i=this.input.charCodeAt(r),!0);)++r;if(92===i||i>55295&&i<56320)return!0;var o=this.input.slice(n,r);if(!l.test(o))return!0}return!1},dt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;x.lastIndex=this.pos;var t,e=x.exec(this.input),n=this.pos+e[0].length;return!(A.test(this.input.slice(this.pos,n))||"function"!==this.input.slice(n,n+8)||n+8!==this.input.length&&(p(t=this.input.charCodeAt(n+8))||t>55295&&t<56320))},dt.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return!1;x.lastIndex=this.pos;var n=x.exec(this.input),i=this.pos+n[0].length;if(A.test(this.input.slice(this.pos,i)))return!1;if(t){var r,o=i+5;if("using"!==this.input.slice(i,o)||o===this.input.length||p(r=this.input.charCodeAt(o))||r>55295&&r<56320)return!1;x.lastIndex=o;var s=x.exec(this.input);if(s&&A.test(this.input.slice(o,o+s[0].length)))return!1}if(e){var a,l=i+2;if(!("of"!==this.input.slice(i,l)||l!==this.input.length&&(p(a=this.input.charCodeAt(l))||a>55295&&a<56320)))return!1}var c=this.input.charCodeAt(i);return d(c,!0)||92===c},dt.isAwaitUsing=function(t){return this.isUsingKeyword(!0,t)},dt.isUsing=function(t){return this.isUsingKeyword(!1,t)},dt.parseStatement=function(t,e,n){var i,r=this.type,o=this.startNode();switch(this.isLet(t)&&(r=I._var,i="let"),r){case I._break:case I._continue:return this.parseBreakContinueStatement(o,r.keyword);case I._debugger:return this.parseDebuggerStatement(o);case I._do:return this.parseDoStatement(o);case I._for:return this.parseForStatement(o);case I._function:return t&&(this.strict||"if"!==t&&"label"!==t)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(o,!1,!t);case I._class:return t&&this.unexpected(),this.parseClass(o,!0);case I._if:return this.parseIfStatement(o);case I._return:return this.parseReturnStatement(o);case I._switch:return this.parseSwitchStatement(o);case I._throw:return this.parseThrowStatement(o);case I._try:return this.parseTryStatement(o);case I._const:case I._var:return i=i||this.value,t&&"var"!==i&&this.unexpected(),this.parseVarStatement(o,i);case I._while:return this.parseWhileStatement(o);case I._with:return this.parseWithStatement(o);case I.braceL:return this.parseBlock(!0,o);case I.semi:return this.parseEmptyStatement(o);case I._export:case I._import:if(this.options.ecmaVersion>10&&r===I._import){x.lastIndex=this.pos;var s=x.exec(this.input),a=this.pos+s[0].length,l=this.input.charCodeAt(a);if(40===l||46===l)return this.parseExpressionStatement(o,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),r===I._import?this.parseImport(o):this.parseExport(o,n);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(o,!0,!t);var c=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(c)return e&&"script"===this.options.sourceType&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),"await using"===c&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(o,!1,c),this.semicolon(),this.finishNode(o,"VariableDeclaration");var u=this.value,h=this.parseExpression();return r===I.name&&"Identifier"===h.type&&this.eat(I.colon)?this.parseLabeledStatement(o,u,h,t):this.parseExpressionStatement(o,h)}},dt.parseBreakContinueStatement=function(t,e){var n="break"===e;this.next(),this.eat(I.semi)||this.insertSemicolon()?t.label=null:this.type!==I.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var r=this.labels[i];if(null==t.label||r.name===t.label.name){if(null!=r.kind&&(n||"loop"===r.kind))break;if(t.label&&n)break}}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,n?"BreakStatement":"ContinueStatement")},dt.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")},dt.parseDoStatement=function(t){return this.next(),this.labels.push(pt),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(I._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(I.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")},dt.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(pt),this.enterScope(0),this.expect(I.parenL),this.type===I.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var n=this.isLet();if(this.type===I._var||this.type===I._const||n){var i=this.startNode(),r=n?"let":this.value;return this.next(),this.parseVar(i,!0,r),this.finishNode(i,"VariableDeclaration"),this.parseForAfterInit(t,i,e)}var o=this.isContextual("let"),s=!1,a=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(a){var l=this.startNode();return this.next(),"await using"===a&&this.next(),this.parseVar(l,!0,a),this.finishNode(l,"VariableDeclaration"),this.parseForAfterInit(t,l,e)}var c=this.containsEsc,u=new ht,h=this.start,d=e>-1?this.parseExprSubscripts(u,"await"):this.parseExpression(!0,u);return this.type===I._in||(s=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===I._in&&this.unexpected(e),t.await=!0):s&&this.options.ecmaVersion>=8&&(d.start!==h||c||"Identifier"!==d.type||"async"!==d.name?this.options.ecmaVersion>=9&&(t.await=!1):this.unexpected()),o&&s&&this.raise(d.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(d,!1,u),this.checkLValPattern(d),this.parseForIn(t,d)):(this.checkExpressionErrors(u,!0),e>-1&&this.unexpected(e),this.parseFor(t,d))},dt.parseForAfterInit=function(t,e,n){return(this.type===I._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===e.declarations.length?(this.options.ecmaVersion>=9&&(this.type===I._in?n>-1&&this.unexpected(n):t.await=n>-1),this.parseForIn(t,e)):(n>-1&&this.unexpected(n),this.parseFor(t,e))},dt.parseFunctionStatement=function(t,e,n){return this.next(),this.parseFunction(t,mt|(n?0:yt),!1,e)},dt.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(I._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")},dt.parseReturnStatement=function(t){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(I.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")},dt.parseSwitchStatement=function(t){var e;this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(I.braceL),this.labels.push(ft),this.enterScope(0);for(var n=!1;this.type!==I.braceR;)if(this.type===I._case||this.type===I._default){var i=this.type===I._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),i?e.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),n=!0,e.test=null),this.expect(I.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")},dt.parseThrowStatement=function(t){return this.next(),A.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var gt=[];dt.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e="Identifier"===t.type;return this.enterScope(e?V:0),this.checkLValPattern(t,e?ot:it),this.expect(I.parenR),t},dt.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===I._catch){var e=this.startNode();this.next(),this.eat(I.parenL)?e.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0)),e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(I._finally)?this.parseBlock():null,t.handler||t.finalizer||this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")},dt.parseVarStatement=function(t,e,n){return this.next(),this.parseVar(t,!1,e,n),this.semicolon(),this.finishNode(t,"VariableDeclaration")},dt.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(pt),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")},dt.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")},dt.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")},dt.parseLabeledStatement=function(t,e,n,i){for(var r=0,o=this.labels;r<o.length;r+=1)o[r].name===e&&this.raise(n.start,"Label '"+e+"' is already declared");for(var s=this.type.isLoop?"loop":this.type===I._switch?"switch":null,a=this.labels.length-1;a>=0;a--){var l=this.labels[a];if(l.statementStart!==t.start)break;l.statementStart=this.start,l.kind=s}return this.labels.push({name:e,kind:s,statementStart:this.start}),t.body=this.parseStatement(i?-1===i.indexOf("label")?i+"label":i:"label"),this.labels.pop(),t.label=n,this.finishNode(t,"LabeledStatement")},dt.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")},dt.parseBlock=function(t,e,n){for(void 0===t&&(t=!0),void 0===e&&(e=this.startNode()),e.body=[],this.expect(I.braceL),t&&this.enterScope(0);this.type!==I.braceR;){var i=this.parseStatement(null);e.body.push(i)}return n&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")},dt.parseFor=function(t,e){return t.init=e,this.expect(I.semi),t.test=this.type===I.semi?null:this.parseExpression(),this.expect(I.semi),t.update=this.type===I.parenR?null:this.parseExpression(),this.expect(I.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")},dt.parseForIn=function(t,e){var n=this.type===I._in;return this.next(),"VariableDeclaration"===e.type&&null!=e.declarations[0].init&&(!n||this.options.ecmaVersion<8||this.strict||"var"!==e.kind||"Identifier"!==e.declarations[0].id.type)&&this.raise(e.start,(n?"for-in":"for-of")+" loop variable declaration may not have an initializer"),t.left=e,t.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(I.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,n?"ForInStatement":"ForOfStatement")},dt.parseVar=function(t,e,n,i){for(t.declarations=[],t.kind=n;;){var r=this.startNode();if(this.parseVarId(r,n),this.eat(I.eq)?r.init=this.parseMaybeAssign(e):i||"const"!==n||this.type===I._in||this.options.ecmaVersion>=6&&this.isContextual("of")?i||"using"!==n&&"await using"!==n||!(this.options.ecmaVersion>=17)||this.type===I._in||this.isContextual("of")?i||"Identifier"===r.id.type||e&&(this.type===I._in||this.isContextual("of"))?r.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.raise(this.lastTokEnd,"Missing initializer in "+n+" declaration"):this.unexpected(),t.declarations.push(this.finishNode(r,"VariableDeclarator")),!this.eat(I.comma))break}return t},dt.parseVarId=function(t,e){t.id="using"===e||"await using"===e?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,"var"===e?nt:it,!1)};var mt=1,yt=2,vt=4;function bt(t,e){var n=e.key.name,i=t[n],r="true";return"MethodDefinition"!==e.type||"get"!==e.kind&&"set"!==e.kind||(r=(e.static?"s":"i")+e.kind),"iget"===i&&"iset"===r||"iset"===i&&"iget"===r||"sget"===i&&"sset"===r||"sset"===i&&"sget"===r?(t[n]="true",!1):!!i||(t[n]=r,!1)}function It(t,e){var n=t.computed,i=t.key;return!n&&("Identifier"===i.type&&i.name===e||"Literal"===i.type&&i.value===e)}dt.parseFunction=function(t,e,n,i,r){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===I.star&&e&yt&&this.unexpected(),t.generator=this.eat(I.star)),this.options.ecmaVersion>=8&&(t.async=!!i),e&mt&&(t.id=e&vt&&this.type!==I.name?null:this.parseIdent(),!t.id||e&yt||this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?nt:it:rt));var o=this.yieldPos,s=this.awaitPos,a=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(tt(t.async,t.generator)),e&mt||(t.id=this.type===I.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,n,!1,r),this.yieldPos=o,this.awaitPos=s,this.awaitIdentPos=a,this.finishNode(t,e&mt?"FunctionDeclaration":"FunctionExpression")},dt.parseFunctionParams=function(t){this.expect(I.parenL),t.params=this.parseBindingList(I.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},dt.parseClass=function(t,e){this.next();var n=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var i=this.enterClassBody(),r=this.startNode(),o=!1;for(r.body=[],this.expect(I.braceL);this.type!==I.braceR;){var s=this.parseClassElement(null!==t.superClass);s&&(r.body.push(s),"MethodDefinition"===s.type&&"constructor"===s.kind?(o&&this.raiseRecoverable(s.start,"Duplicate constructor in the same class"),o=!0):s.key&&"PrivateIdentifier"===s.key.type&&bt(i,s)&&this.raiseRecoverable(s.key.start,"Identifier '#"+s.key.name+"' has already been declared"))}return this.strict=n,this.next(),t.body=this.finishNode(r,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")},dt.parseClassElement=function(t){if(this.eat(I.semi))return null;var e=this.options.ecmaVersion,n=this.startNode(),i="",r=!1,o=!1,s="method",a=!1;if(this.eatContextual("static")){if(e>=13&&this.eat(I.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===I.star?a=!0:i="static"}if(n.static=a,!i&&e>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==I.star||this.canInsertSemicolon()?i="async":o=!0),!i&&(e>=9||!o)&&this.eat(I.star)&&(r=!0),!i&&!o&&!r){var l=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?s=l:i=l)}if(i?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=i,this.finishNode(n.key,"Identifier")):this.parseClassElementName(n),e<13||this.type===I.parenL||"method"!==s||r||o){var c=!n.static&&It(n,"constructor"),u=c&&t;c&&"method"!==s&&this.raise(n.key.start,"Constructor can't have get/set modifier"),n.kind=c?"constructor":s,this.parseClassMethod(n,r,o,u)}else this.parseClassField(n);return n},dt.isClassElementNameStart=function(){return this.type===I.name||this.type===I.privateId||this.type===I.num||this.type===I.string||this.type===I.bracketL||this.type.keyword},dt.parseClassElementName=function(t){this.type===I.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),t.computed=!1,t.key=this.parsePrivateIdent()):this.parsePropertyName(t)},dt.parseClassMethod=function(t,e,n,i){var r=t.key;"constructor"===t.kind?(e&&this.raise(r.start,"Constructor can't be a generator"),n&&this.raise(r.start,"Constructor can't be an async method")):t.static&&It(t,"prototype")&&this.raise(r.start,"Classes may not have a static property named prototype");var o=t.value=this.parseMethod(e,n,i);return"get"===t.kind&&0!==o.params.length&&this.raiseRecoverable(o.start,"getter should have no params"),"set"===t.kind&&1!==o.params.length&&this.raiseRecoverable(o.start,"setter should have exactly one param"),"set"===t.kind&&"RestElement"===o.params[0].type&&this.raiseRecoverable(o.params[0].start,"Setter cannot use rest params"),this.finishNode(t,"MethodDefinition")},dt.parseClassField=function(t){return It(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&It(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(I.eq)?(this.enterScope(K|q),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")},dt.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(X|q);this.type!==I.braceR;){var n=this.parseStatement(null);t.body.push(n)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")},dt.parseClassId=function(t,e){this.type===I.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,it,!1)):(!0===e&&this.unexpected(),t.id=null)},dt.parseClassSuper=function(t){t.superClass=this.eat(I._extends)?this.parseExprSubscripts(null,!1):null},dt.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared},dt.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,n=t.used;if(this.options.checkPrivateFields)for(var i=this.privateNameStack.length,r=0===i?null:this.privateNameStack[i-1],o=0;o<n.length;++o){var s=n[o];_(e,s.name)||(r?r.used.push(s):this.raiseRecoverable(s.start,"Private field '#"+s.name+"' must be declared in an enclosing class"))}},dt.parseExportAllDeclaration=function(t,e){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseModuleExportName(),this.checkExport(e,t.exported,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==I.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")},dt.parseExport=function(t,e){if(this.next(),this.eat(I.star))return this.parseExportAllDeclaration(t,e);if(this.eat(I._default))return this.checkExport(e,"default",this.lastTokStart),t.declaration=this.parseExportDefaultDeclaration(),this.finishNode(t,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())t.declaration=this.parseExportDeclaration(t),"VariableDeclaration"===t.declaration.type?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id,t.declaration.id.start),t.specifiers=[],t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[]);else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==I.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause());else{for(var n=0,i=t.specifiers;n<i.length;n+=1){var r=i[n];this.checkUnreserved(r.local),this.checkLocalExport(r.local),"Literal"===r.local.type&&this.raise(r.local.start,"A string literal cannot be used as an exported binding without `from`.")}t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[])}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")},dt.parseExportDeclaration=function(t){return this.parseStatement(null)},dt.parseExportDefaultDeclaration=function(){var t;if(this.type===I._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,mt|vt,!1,t)}if(this.type===I._class){var n=this.startNode();return this.parseClass(n,"nullableID")}var i=this.parseMaybeAssign();return this.semicolon(),i},dt.checkExport=function(t,e,n){t&&("string"!=typeof e&&(e="Identifier"===e.type?e.name:e.value),_(t,e)&&this.raiseRecoverable(n,"Duplicate export '"+e+"'"),t[e]=!0)},dt.checkPatternExport=function(t,e){var n=e.type;if("Identifier"===n)this.checkExport(t,e,e.start);else if("ObjectPattern"===n)for(var i=0,r=e.properties;i<r.length;i+=1){var o=r[i];this.checkPatternExport(t,o)}else if("ArrayPattern"===n)for(var s=0,a=e.elements;s<a.length;s+=1){var l=a[s];l&&this.checkPatternExport(t,l)}else"Property"===n?this.checkPatternExport(t,e.value):"AssignmentPattern"===n?this.checkPatternExport(t,e.left):"RestElement"===n&&this.checkPatternExport(t,e.argument)},dt.checkVariableExport=function(t,e){if(t)for(var n=0,i=e;n<i.length;n+=1){var r=i[n];this.checkPatternExport(t,r.id)}},dt.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},dt.parseExportSpecifier=function(t){var e=this.startNode();return e.local=this.parseModuleExportName(),e.exported=this.eatContextual("as")?this.parseModuleExportName():e.local,this.checkExport(t,e.exported,e.exported.start),this.finishNode(e,"ExportSpecifier")},dt.parseExportSpecifiers=function(t){var e=[],n=!0;for(this.expect(I.braceL);!this.eat(I.braceR);){if(n)n=!1;else if(this.expect(I.comma),this.afterTrailingComma(I.braceR))break;e.push(this.parseExportSpecifier(t))}return e},dt.parseImport=function(t){return this.next(),this.type===I.string?(t.specifiers=gt,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===I.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")},dt.parseImportSpecifier=function(){var t=this.startNode();return t.imported=this.parseModuleExportName(),this.eatContextual("as")?t.local=this.parseIdent():(this.checkUnreserved(t.imported),t.local=t.imported),this.checkLValSimple(t.local,it),this.finishNode(t,"ImportSpecifier")},dt.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,it),this.finishNode(t,"ImportDefaultSpecifier")},dt.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,it),this.finishNode(t,"ImportNamespaceSpecifier")},dt.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===I.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(I.comma)))return t;if(this.type===I.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(I.braceL);!this.eat(I.braceR);){if(e)e=!1;else if(this.expect(I.comma),this.afterTrailingComma(I.braceR))break;t.push(this.parseImportSpecifier())}return t},dt.parseWithClause=function(){var t=[];if(!this.eat(I._with))return t;this.expect(I.braceL);for(var e={},n=!0;!this.eat(I.braceR);){if(n)n=!1;else if(this.expect(I.comma),this.afterTrailingComma(I.braceR))break;var i=this.parseImportAttribute(),r="Identifier"===i.key.type?i.key.name:i.key.value;_(e,r)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+r+"'"),e[r]=!0,t.push(i)}return t},dt.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===I.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(I.colon),this.type!==I.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")},dt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===I.string){var t=this.parseLiteral(this.value);return z.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(!0)},dt.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)},dt.isDirectiveCandidate=function(t){return this.options.ecmaVersion>=5&&"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"string"==typeof t.expression.value&&('"'===this.input[t.start]||"'"===this.input[t.start])};var At=at.prototype;At.toAssignable=function(t,e,n){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&"await"===t.name&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",n&&this.checkPatternErrors(n,!0);for(var i=0,r=t.properties;i<r.length;i+=1){var o=r[i];this.toAssignable(o,e),"RestElement"!==o.type||"ArrayPattern"!==o.argument.type&&"ObjectPattern"!==o.argument.type||this.raise(o.argument.start,"Unexpected token")}break;case"Property":"init"!==t.kind&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",n&&this.checkPatternErrors(n,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),"AssignmentPattern"===t.argument.type&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==t.operator&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,n);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else n&&this.checkPatternErrors(n,!0);return t},At.toAssignableList=function(t,e){for(var n=t.length,i=0;i<n;i++){var r=t[i];r&&this.toAssignable(r,e)}if(n){var o=t[n-1];6===this.options.ecmaVersion&&e&&o&&"RestElement"===o.type&&"Identifier"!==o.argument.type&&this.unexpected(o.argument.start)}return t},At.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")},At.parseRestBinding=function(){var t=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==I.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")},At.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case I.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(I.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case I.braceL:return this.parseObj(!0)}return this.parseIdent()},At.parseBindingList=function(t,e,n,i){for(var r=[],o=!0;!this.eat(t);)if(o?o=!1:this.expect(I.comma),e&&this.type===I.comma)r.push(null);else{if(n&&this.afterTrailingComma(t))break;if(this.type===I.ellipsis){var s=this.parseRestBinding();this.parseBindingListItem(s),r.push(s),this.type===I.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}r.push(this.parseAssignableListItem(i))}return r},At.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e},At.parseBindingListItem=function(t){return t},At.parseMaybeDefault=function(t,e,n){if(n=n||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(I.eq))return n;var i=this.startNodeAt(t,e);return i.left=n,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")},At.checkLValSimple=function(t,e,n){void 0===e&&(e=et);var i=e!==et;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(i?"Binding ":"Assigning to ")+t.name+" in strict mode"),i&&(e===it&&"let"===t.name&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),n&&(_(n,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),n[t.name]=!0),e!==st&&this.declareName(t.name,e,t.start));break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":i&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,n);default:this.raise(t.start,(i?"Binding":"Assigning to")+" rvalue")}},At.checkLValPattern=function(t,e,n){switch(void 0===e&&(e=et),t.type){case"ObjectPattern":for(var i=0,r=t.properties;i<r.length;i+=1){var o=r[i];this.checkLValInnerPattern(o,e,n)}break;case"ArrayPattern":for(var s=0,a=t.elements;s<a.length;s+=1){var l=a[s];l&&this.checkLValInnerPattern(l,e,n)}break;default:this.checkLValSimple(t,e,n)}},At.checkLValInnerPattern=function(t,e,n){switch(void 0===e&&(e=et),t.type){case"Property":this.checkLValInnerPattern(t.value,e,n);break;case"AssignmentPattern":this.checkLValPattern(t.left,e,n);break;case"RestElement":this.checkLValPattern(t.argument,e,n);break;default:this.checkLValPattern(t,e,n)}};var Mt=function(t,e,n,i,r){this.token=t,this.isExpr=!!e,this.preserveSpace=!!n,this.override=i,this.generator=!!r},wt={b_stat:new Mt("{",!1),b_expr:new Mt("{",!0),b_tmpl:new Mt("${",!1),p_stat:new Mt("(",!1),p_expr:new Mt("(",!0),q_tmpl:new Mt("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new Mt("function",!1),f_expr:new Mt("function",!0),f_expr_gen:new Mt("function",!0,!1,null,!0),f_gen:new Mt("function",!1,!1,null,!0)},Ct=at.prototype;Ct.initialContext=function(){return[wt.b_stat]},Ct.curContext=function(){return this.context[this.context.length-1]},Ct.braceIsBlock=function(t){var e=this.curContext();return e===wt.f_expr||e===wt.f_stat||(t!==I.colon||e!==wt.b_stat&&e!==wt.b_expr?t===I._return||t===I.name&&this.exprAllowed?A.test(this.input.slice(this.lastTokEnd,this.start)):t===I._else||t===I.semi||t===I.eof||t===I.parenR||t===I.arrow||(t===I.braceL?e===wt.b_stat:t!==I._var&&t!==I._const&&t!==I.name&&!this.exprAllowed):!e.isExpr)},Ct.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if("function"===e.token)return e.generator}return!1},Ct.updateContext=function(t){var e,n=this.type;n.keyword&&t===I.dot?this.exprAllowed=!1:(e=n.updateContext)?e.call(this,t):this.exprAllowed=n.beforeExpr},Ct.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)},I.parenR.updateContext=I.braceR.updateContext=function(){if(1!==this.context.length){var t=this.context.pop();t===wt.b_stat&&"function"===this.curContext().token&&(t=this.context.pop()),this.exprAllowed=!t.isExpr}else this.exprAllowed=!0},I.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?wt.b_stat:wt.b_expr),this.exprAllowed=!0},I.dollarBraceL.updateContext=function(){this.context.push(wt.b_tmpl),this.exprAllowed=!0},I.parenL.updateContext=function(t){var e=t===I._if||t===I._for||t===I._with||t===I._while;this.context.push(e?wt.p_stat:wt.p_expr),this.exprAllowed=!0},I.incDec.updateContext=function(){},I._function.updateContext=I._class.updateContext=function(t){!t.beforeExpr||t===I._else||t===I.semi&&this.curContext()!==wt.p_stat||t===I._return&&A.test(this.input.slice(this.lastTokEnd,this.start))||(t===I.colon||t===I.braceL)&&this.curContext()===wt.b_stat?this.context.push(wt.f_stat):this.context.push(wt.f_expr),this.exprAllowed=!1},I.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},I.backQuote.updateContext=function(){this.curContext()===wt.q_tmpl?this.context.pop():this.context.push(wt.q_tmpl),this.exprAllowed=!1},I.star.updateContext=function(t){if(t===I._function){var e=this.context.length-1;this.context[e]===wt.f_expr?this.context[e]=wt.f_expr_gen:this.context[e]=wt.f_gen}this.exprAllowed=!0},I.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==I.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var Tt=at.prototype;function xt(t){return"Identifier"===t.type||"ParenthesizedExpression"===t.type&&xt(t.expression)}function St(t){return"MemberExpression"===t.type&&"PrivateIdentifier"===t.property.type||"ChainExpression"===t.type&&St(t.expression)||"ParenthesizedExpression"===t.type&&St(t.expression)}Tt.checkPropClash=function(t,e,n){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===t.type||this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var i,r=t.key;switch(r.type){case"Identifier":i=r.name;break;case"Literal":i=String(r.value);break;default:return}var o=t.kind;if(this.options.ecmaVersion>=6)"__proto__"===i&&"init"===o&&(e.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),e.proto=!0);else{var s=e[i="$"+i];s?("init"===o?this.strict&&s.init||s.get||s.set:s.init||s[o])&&this.raiseRecoverable(r.start,"Redefinition of property"):s=e[i]={init:!1,get:!1,set:!1},s[o]=!0}}},Tt.parseExpression=function(t,e){var n=this.start,i=this.startLoc,r=this.parseMaybeAssign(t,e);if(this.type===I.comma){var o=this.startNodeAt(n,i);for(o.expressions=[r];this.eat(I.comma);)o.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(o,"SequenceExpression")}return r},Tt.parseMaybeAssign=function(t,e,n){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var i=!1,r=-1,o=-1,s=-1;e?(r=e.parenthesizedAssign,o=e.trailingComma,s=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new ht,i=!0);var a=this.start,l=this.startLoc;this.type!==I.parenL&&this.type!==I.name||(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===t);var c=this.parseMaybeConditional(t,e);if(n&&(c=n.call(this,c,a,l)),this.type.isAssign){var u=this.startNodeAt(a,l);return u.operator=this.value,this.type===I.eq&&(c=this.toAssignable(c,!1,e)),i||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=c.start&&(e.shorthandAssign=-1),this.type===I.eq?this.checkLValPattern(c):this.checkLValSimple(c),u.left=c,this.next(),u.right=this.parseMaybeAssign(t),s>-1&&(e.doubleProto=s),this.finishNode(u,"AssignmentExpression")}return i&&this.checkExpressionErrors(e,!0),r>-1&&(e.parenthesizedAssign=r),o>-1&&(e.trailingComma=o),c},Tt.parseMaybeConditional=function(t,e){var n=this.start,i=this.startLoc,r=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return r;if(this.eat(I.question)){var o=this.startNodeAt(n,i);return o.test=r,o.consequent=this.parseMaybeAssign(),this.expect(I.colon),o.alternate=this.parseMaybeAssign(t),this.finishNode(o,"ConditionalExpression")}return r},Tt.parseExprOps=function(t,e){var n=this.start,i=this.startLoc,r=this.parseMaybeUnary(e,!1,!1,t);return this.checkExpressionErrors(e)||r.start===n&&"ArrowFunctionExpression"===r.type?r:this.parseExprOp(r,n,i,-1,t)},Tt.parseExprOp=function(t,e,n,i,r){var o=this.type.binop;if(null!=o&&(!r||this.type!==I._in)&&o>i){var s=this.type===I.logicalOR||this.type===I.logicalAND,a=this.type===I.coalesce;a&&(o=I.logicalAND.binop);var l=this.value;this.next();var c=this.start,u=this.startLoc,h=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,r),c,u,o,r),d=this.buildBinary(e,n,t,h,l,s||a);return(s&&this.type===I.coalesce||a&&(this.type===I.logicalOR||this.type===I.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(d,e,n,i,r)}return t},Tt.buildBinary=function(t,e,n,i,r,o){"PrivateIdentifier"===i.type&&this.raise(i.start,"Private identifier can only be left side of binary expression");var s=this.startNodeAt(t,e);return s.left=n,s.operator=r,s.right=i,this.finishNode(s,o?"LogicalExpression":"BinaryExpression")},Tt.parseMaybeUnary=function(t,e,n,i){var r,o=this.start,s=this.startLoc;if(this.isContextual("await")&&this.canAwait)r=this.parseAwait(i),e=!0;else if(this.type.prefix){var a=this.startNode(),l=this.type===I.incDec;a.operator=this.value,a.prefix=!0,this.next(),a.argument=this.parseMaybeUnary(null,!0,l,i),this.checkExpressionErrors(t,!0),l?this.checkLValSimple(a.argument):this.strict&&"delete"===a.operator&&xt(a.argument)?this.raiseRecoverable(a.start,"Deleting local variable in strict mode"):"delete"===a.operator&&St(a.argument)?this.raiseRecoverable(a.start,"Private fields can not be deleted"):e=!0,r=this.finishNode(a,l?"UpdateExpression":"UnaryExpression")}else if(e||this.type!==I.privateId){if(r=this.parseExprSubscripts(t,i),this.checkExpressionErrors(t))return r;for(;this.type.postfix&&!this.canInsertSemicolon();){var c=this.startNodeAt(o,s);c.operator=this.value,c.prefix=!1,c.argument=r,this.checkLValSimple(r),this.next(),r=this.finishNode(c,"UpdateExpression")}}else(i||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),r=this.parsePrivateIdent(),this.type!==I._in&&this.unexpected();return n||!this.eat(I.starstar)?r:e?void this.unexpected(this.lastTokStart):this.buildBinary(o,s,r,this.parseMaybeUnary(null,!1,!1,i),"**",!1)},Tt.parseExprSubscripts=function(t,e){var n=this.start,i=this.startLoc,r=this.parseExprAtom(t,e);if("ArrowFunctionExpression"===r.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return r;var o=this.parseSubscripts(r,n,i,!1,e);return t&&"MemberExpression"===o.type&&(t.parenthesizedAssign>=o.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=o.start&&(t.parenthesizedBind=-1),t.trailingComma>=o.start&&(t.trailingComma=-1)),o},Tt.parseSubscripts=function(t,e,n,i,r){for(var o=this.options.ecmaVersion>=8&&"Identifier"===t.type&&"async"===t.name&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,s=!1;;){var a=this.parseSubscript(t,e,n,i,o,s,r);if(a.optional&&(s=!0),a===t||"ArrowFunctionExpression"===a.type){if(s){var l=this.startNodeAt(e,n);l.expression=a,a=this.finishNode(l,"ChainExpression")}return a}t=a}},Tt.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(I.arrow)},Tt.parseSubscriptAsyncArrow=function(t,e,n,i){return this.parseArrowExpression(this.startNodeAt(t,e),n,!0,i)},Tt.parseSubscript=function(t,e,n,i,r,o,s){var a=this.options.ecmaVersion>=11,l=a&&this.eat(I.questionDot);i&&l&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var c=this.eat(I.bracketL);if(c||l&&this.type!==I.parenL&&this.type!==I.backQuote||this.eat(I.dot)){var u=this.startNodeAt(e,n);u.object=t,c?(u.property=this.parseExpression(),this.expect(I.bracketR)):this.type===I.privateId&&"Super"!==t.type?u.property=this.parsePrivateIdent():u.property=this.parseIdent("never"!==this.options.allowReserved),u.computed=!!c,a&&(u.optional=l),t=this.finishNode(u,"MemberExpression")}else if(!i&&this.eat(I.parenL)){var h=new ht,d=this.yieldPos,p=this.awaitPos,f=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(I.parenR,this.options.ecmaVersion>=8,!1,h);if(r&&!l&&this.shouldParseAsyncArrow())return this.checkPatternErrors(h,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=d,this.awaitPos=p,this.awaitIdentPos=f,this.parseSubscriptAsyncArrow(e,n,g,s);this.checkExpressionErrors(h,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=f||this.awaitIdentPos;var m=this.startNodeAt(e,n);m.callee=t,m.arguments=g,a&&(m.optional=l),t=this.finishNode(m,"CallExpression")}else if(this.type===I.backQuote){(l||o)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var y=this.startNodeAt(e,n);y.tag=t,y.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(y,"TaggedTemplateExpression")}return t},Tt.parseExprAtom=function(t,e,n){this.type===I.slash&&this.readRegexp();var i,r=this.potentialArrowAt===this.start;switch(this.type){case I._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type!==I.parenL||this.allowDirectSuper||this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==I.dot&&this.type!==I.bracketL&&this.type!==I.parenL&&this.unexpected(),this.finishNode(i,"Super");case I._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case I.name:var o=this.start,s=this.startLoc,a=this.containsEsc,l=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!a&&"async"===l.name&&!this.canInsertSemicolon()&&this.eat(I._function))return this.overrideContext(wt.f_expr),this.parseFunction(this.startNodeAt(o,s),0,!1,!0,e);if(r&&!this.canInsertSemicolon()){if(this.eat(I.arrow))return this.parseArrowExpression(this.startNodeAt(o,s),[l],!1,e);if(this.options.ecmaVersion>=8&&"async"===l.name&&this.type===I.name&&!a&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return l=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(I.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(o,s),[l],!0,e)}return l;case I.regexp:var c=this.value;return(i=this.parseLiteral(c.value)).regex={pattern:c.pattern,flags:c.flags},i;case I.num:case I.string:return this.parseLiteral(this.value);case I._null:case I._true:case I._false:return(i=this.startNode()).value=this.type===I._null?null:this.type===I._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case I.parenL:var u=this.start,h=this.parseParenAndDistinguishExpression(r,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(h)&&(t.parenthesizedAssign=u),t.parenthesizedBind<0&&(t.parenthesizedBind=u)),h;case I.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(I.bracketR,!0,!0,t),this.finishNode(i,"ArrayExpression");case I.braceL:return this.overrideContext(wt.b_expr),this.parseObj(!1,t);case I._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case I._class:return this.parseClass(this.startNode(),!1);case I._new:return this.parseNew();case I.backQuote:return this.parseTemplate();case I._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},Tt.parseExprAtomDefault=function(){this.unexpected()},Tt.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===I.parenL&&!t)return this.parseDynamicImport(e);if(this.type===I.dot){var n=this.startNodeAt(e.start,e.loc&&e.loc.start);return n.name="import",e.meta=this.finishNode(n,"Identifier"),this.parseImportMeta(e)}this.unexpected()},Tt.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(I.parenR)?t.options=null:(this.expect(I.comma),this.afterTrailingComma(I.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(I.parenR)||(this.expect(I.comma),this.afterTrailingComma(I.parenR)||this.unexpected())));else if(!this.eat(I.parenR)){var e=this.start;this.eat(I.comma)&&this.eat(I.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")},Tt.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),"meta"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),"module"===this.options.sourceType||this.options.allowImportExportEverywhere||this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")},Tt.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),110===e.raw.charCodeAt(e.raw.length-1)&&(e.bigint=null!=e.value?e.value.toString():e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")},Tt.parseParenExpression=function(){this.expect(I.parenL);var t=this.parseExpression();return this.expect(I.parenR),t},Tt.shouldParseArrow=function(t){return!this.canInsertSemicolon()},Tt.parseParenAndDistinguishExpression=function(t,e){var n,i=this.start,r=this.startLoc,o=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var s,a=this.start,l=this.startLoc,c=[],u=!0,h=!1,d=new ht,p=this.yieldPos,f=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==I.parenR;){if(u?u=!1:this.expect(I.comma),o&&this.afterTrailingComma(I.parenR,!0)){h=!0;break}if(this.type===I.ellipsis){s=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===I.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}c.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var g=this.lastTokEnd,m=this.lastTokEndLoc;if(this.expect(I.parenR),t&&this.shouldParseArrow(c)&&this.eat(I.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=p,this.awaitPos=f,this.parseParenArrowList(i,r,c,e);c.length&&!h||this.unexpected(this.lastTokStart),s&&this.unexpected(s),this.checkExpressionErrors(d,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=f||this.awaitPos,c.length>1?((n=this.startNodeAt(a,l)).expressions=c,this.finishNodeAt(n,"SequenceExpression",g,m)):n=c[0]}else n=this.parseParenExpression();if(this.options.preserveParens){var y=this.startNodeAt(i,r);return y.expression=n,this.finishNode(y,"ParenthesizedExpression")}return n},Tt.parseParenItem=function(t){return t},Tt.parseParenArrowList=function(t,e,n,i){return this.parseArrowExpression(this.startNodeAt(t,e),n,!1,i)};var Dt=[];Tt.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===I.dot){var e=this.startNodeAt(t.start,t.loc&&t.loc.start);e.name="new",t.meta=this.finishNode(e,"Identifier"),this.next();var n=this.containsEsc;return t.property=this.parseIdent(!0),"target"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),n&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(t.start,"'new.target' can only be used in functions and class static block"),this.finishNode(t,"MetaProperty")}var i=this.start,r=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),i,r,!0,!1),this.eat(I.parenL)?t.arguments=this.parseExprList(I.parenR,this.options.ecmaVersion>=8,!1):t.arguments=Dt,this.finishNode(t,"NewExpression")},Tt.parseTemplateElement=function(t){var e=t.isTagged,n=this.startNode();return this.type===I.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),n.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),n.tail=this.type===I.backQuote,this.finishNode(n,"TemplateElement")},Tt.parseTemplate=function(t){void 0===t&&(t={});var e=t.isTagged;void 0===e&&(e=!1);var n=this.startNode();this.next(),n.expressions=[];var i=this.parseTemplateElement({isTagged:e});for(n.quasis=[i];!i.tail;)this.type===I.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(I.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(I.braceR),n.quasis.push(i=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(n,"TemplateLiteral")},Tt.isAsyncProp=function(t){return!t.computed&&"Identifier"===t.key.type&&"async"===t.key.name&&(this.type===I.name||this.type===I.num||this.type===I.string||this.type===I.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===I.star)&&!A.test(this.input.slice(this.lastTokEnd,this.start))},Tt.parseObj=function(t,e){var n=this.startNode(),i=!0,r={};for(n.properties=[],this.next();!this.eat(I.braceR);){if(i)i=!1;else if(this.expect(I.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(I.braceR))break;var o=this.parseProperty(t,e);t||this.checkPropClash(o,r,e),n.properties.push(o)}return this.finishNode(n,t?"ObjectPattern":"ObjectExpression")},Tt.parseProperty=function(t,e){var n,i,r,o,s=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(I.ellipsis))return t?(s.argument=this.parseIdent(!1),this.type===I.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(s,"RestElement")):(s.argument=this.parseMaybeAssign(!1,e),this.type===I.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(s,"SpreadElement"));this.options.ecmaVersion>=6&&(s.method=!1,s.shorthand=!1,(t||e)&&(r=this.start,o=this.startLoc),t||(n=this.eat(I.star)));var a=this.containsEsc;return this.parsePropertyName(s),!t&&!a&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(s)?(i=!0,n=this.options.ecmaVersion>=9&&this.eat(I.star),this.parsePropertyName(s)):i=!1,this.parsePropertyValue(s,t,n,i,r,o,e,a),this.finishNode(s,"Property")},Tt.parseGetterSetter=function(t){var e=t.key.name;this.parsePropertyName(t),t.value=this.parseMethod(!1),t.kind=e;var n="get"===t.kind?0:1;if(t.value.params.length!==n){var i=t.value.start;"get"===t.kind?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else"set"===t.kind&&"RestElement"===t.value.params[0].type&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")},Tt.parsePropertyValue=function(t,e,n,i,r,o,s,a){(n||i)&&this.type===I.colon&&this.unexpected(),this.eat(I.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,s),t.kind="init"):this.options.ecmaVersion>=6&&this.type===I.parenL?(e&&this.unexpected(),t.method=!0,t.value=this.parseMethod(n,i),t.kind="init"):e||a||!(this.options.ecmaVersion>=5)||t.computed||"Identifier"!==t.key.type||"get"!==t.key.name&&"set"!==t.key.name||this.type===I.comma||this.type===I.braceR||this.type===I.eq?this.options.ecmaVersion>=6&&!t.computed&&"Identifier"===t.key.type?((n||i)&&this.unexpected(),this.checkUnreserved(t.key),"await"!==t.key.name||this.awaitIdentPos||(this.awaitIdentPos=r),e?t.value=this.parseMaybeDefault(r,o,this.copyNode(t.key)):this.type===I.eq&&s?(s.shorthandAssign<0&&(s.shorthandAssign=this.start),t.value=this.parseMaybeDefault(r,o,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.kind="init",t.shorthand=!0):this.unexpected():((n||i)&&this.unexpected(),this.parseGetterSetter(t))},Tt.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(I.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(I.bracketR),t.key;t.computed=!1}return t.key=this.type===I.num||this.type===I.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},Tt.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)},Tt.parseMethod=function(t,e,n){var i=this.startNode(),r=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=t),this.options.ecmaVersion>=8&&(i.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(tt(e,i.generator)|q|(n?J:0)),this.expect(I.parenL),i.params=this.parseBindingList(I.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,!1,!0,!1),this.yieldPos=r,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(i,"FunctionExpression")},Tt.parseArrowExpression=function(t,e,n,i){var r=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.enterScope(tt(n,!1)|F),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1,i),this.yieldPos=r,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(t,"ArrowFunctionExpression")},Tt.parseFunctionBody=function(t,e,n,i){var r=e&&this.type!==I.braceL,o=this.strict,s=!1;if(r)t.body=this.parseMaybeAssign(i),t.expression=!0,this.checkParams(t,!1);else{var a=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);o&&!a||(s=this.strictDirective(this.end))&&a&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list");var l=this.labels;this.labels=[],s&&(this.strict=!0),this.checkParams(t,!o&&!s&&!e&&!n&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,st),t.body=this.parseBlock(!1,void 0,s&&!o),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=l}this.exitScope()},Tt.isSimpleParamList=function(t){for(var e=0,n=t;e<n.length;e+=1)if("Identifier"!==n[e].type)return!1;return!0},Tt.checkParams=function(t,e){for(var n=Object.create(null),i=0,r=t.params;i<r.length;i+=1){var o=r[i];this.checkLValInnerPattern(o,nt,e?null:n)}},Tt.parseExprList=function(t,e,n,i){for(var r=[],o=!0;!this.eat(t);){if(o)o=!1;else if(this.expect(I.comma),e&&this.afterTrailingComma(t))break;var s=void 0;n&&this.type===I.comma?s=null:this.type===I.ellipsis?(s=this.parseSpread(i),i&&this.type===I.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):s=this.parseMaybeAssign(!1,i),r.push(s)}return r},Tt.checkUnreserved=function(t){var e=t.start,n=t.end,i=t.name;this.inGenerator&&"yield"===i&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===i&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().flags&$||"arguments"!==i||this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),!this.inClassStaticBlock||"arguments"!==i&&"await"!==i||this.raise(e,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(e,"Unexpected keyword '"+i+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(e,n).indexOf("\\")||(this.strict?this.reservedWordsStrict:this.reservedWords).test(i)&&(this.inAsync||"await"!==i||this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+i+"' is reserved"))},Tt.parseIdent=function(t){var e=this.parseIdentNode();return this.next(!!t),this.finishNode(e,"Identifier"),t||(this.checkUnreserved(e),"await"!==e.name||this.awaitIdentPos||(this.awaitIdentPos=e.start)),e},Tt.parseIdentNode=function(){var t=this.startNode();return this.type===I.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,"class"!==t.name&&"function"!==t.name||this.lastTokEnd===this.lastTokStart+1&&46===this.input.charCodeAt(this.lastTokStart)||this.context.pop(),this.type=I.name):this.unexpected(),t},Tt.parsePrivateIdent=function(){var t=this.startNode();return this.type===I.privateId?t.name=this.value:this.unexpected(),this.next(),this.finishNode(t,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(t.start,"Private field '#"+t.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(t)),t},Tt.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===I.semi||this.canInsertSemicolon()||this.type!==I.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(I.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")},Tt.parseAwait=function(t){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,!0,!1,t),this.finishNode(e,"AwaitExpression")};var Nt=at.prototype;Nt.raise=function(t,e){var n=P(this.input,t);e+=" ("+n.line+":"+n.column+")",this.sourceFile&&(e+=" in "+this.sourceFile);var i=new SyntaxError(e);throw i.pos=t,i.loc=n,i.raisedAt=this.pos,i},Nt.raiseRecoverable=Nt.raise,Nt.curPosition=function(){if(this.options.locations)return new L(this.curLine,this.pos-this.lineStart)};var _t=at.prototype,Et=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};_t.enterScope=function(t){this.scopeStack.push(new Et(t))},_t.exitScope=function(){this.scopeStack.pop()},_t.treatFunctionsAsVarInScope=function(t){return t.flags&W||!this.inModule&&t.flags&Z},_t.declareName=function(t,e,n){var i=!1;if(e===it){var r=this.currentScope();i=r.lexical.indexOf(t)>-1||r.functions.indexOf(t)>-1||r.var.indexOf(t)>-1,r.lexical.push(t),this.inModule&&r.flags&Z&&delete this.undefinedExports[t]}else if(e===ot)this.currentScope().lexical.push(t);else if(e===rt){var o=this.currentScope();i=this.treatFunctionsAsVar?o.lexical.indexOf(t)>-1:o.lexical.indexOf(t)>-1||o.var.indexOf(t)>-1,o.functions.push(t)}else for(var s=this.scopeStack.length-1;s>=0;--s){var a=this.scopeStack[s];if(a.lexical.indexOf(t)>-1&&!(a.flags&V&&a.lexical[0]===t)||!this.treatFunctionsAsVarInScope(a)&&a.functions.indexOf(t)>-1){i=!0;break}if(a.var.push(t),this.inModule&&a.flags&Z&&delete this.undefinedExports[t],a.flags&$)break}i&&this.raiseRecoverable(n,"Identifier '"+t+"' has already been declared")},_t.checkLocalExport=function(t){-1===this.scopeStack[0].lexical.indexOf(t.name)&&-1===this.scopeStack[0].var.indexOf(t.name)&&(this.undefinedExports[t.name]=t)},_t.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},_t.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&($|K|X))return e}},_t.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&($|K|X)&&!(e.flags&F))return e}};var jt=function(t,e,n){this.type="",this.start=e,this.end=0,t.options.locations&&(this.loc=new B(t,n)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[e,0])},kt=at.prototype;function Ot(t,e,n,i){return t.type=e,t.end=n,this.options.locations&&(t.loc.end=i),this.options.ranges&&(t.range[1]=n),t}kt.startNode=function(){return new jt(this,this.start,this.startLoc)},kt.startNodeAt=function(t,e){return new jt(this,t,e)},kt.finishNode=function(t,e){return Ot.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)},kt.finishNodeAt=function(t,e,n,i){return Ot.call(this,t,e,n,i)},kt.copyNode=function(t){var e=new jt(this,t.start,this.startLoc);for(var n in t)e[n]=t[n];return e};var zt="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Lt=zt+" Extended_Pictographic",Bt=Lt+" EBase EComp EMod EPres ExtPict",Pt={9:zt,10:Lt,11:Lt,12:Bt,13:Bt,14:Bt},Rt={9:"",10:"",11:"",12:"",13:"",14:"Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"},Ut="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Gt="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Yt=Gt+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Zt=Yt+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Wt=Zt+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Qt=Wt+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Ht={9:Gt,10:Yt,11:Zt,12:Wt,13:Qt,14:Qt+" Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz"},Ft={};function Vt(t){var e=Ft[t]={binary:k(Pt[t]+" "+Ut),binaryOfStrings:k(Rt[t]),nonBinary:{General_Category:k(Ut),Script:k(Ht[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}for(var qt=0,Jt=[9,10,11,12,13,14];qt<Jt.length;qt+=1)Vt(Jt[qt]);var Xt=at.prototype,Kt=function(t,e){this.parent=t,this.base=e||this};Kt.prototype.separatedFrom=function(t){for(var e=this;e;e=e.parent)for(var n=t;n;n=n.parent)if(e.base===n.base&&e!==n)return!0;return!1},Kt.prototype.sibling=function(){return new Kt(this.parent,this.base)};var $t=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Ft[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function te(t){for(var e in t)return!0;return!1}function ee(t){return 105===t||109===t||115===t}function ne(t){return 36===t||t>=40&&t<=43||46===t||63===t||t>=91&&t<=94||t>=123&&t<=125}function ie(t){return d(t,!0)||36===t||95===t}function re(t){return p(t,!0)||36===t||95===t||8204===t||8205===t}function oe(t){return t>=65&&t<=90||t>=97&&t<=122}function se(t){return t>=0&&t<=1114111}$t.prototype.reset=function(t,e,n){var i=-1!==n.indexOf("v"),r=-1!==n.indexOf("u");this.start=0|t,this.source=e+"",this.flags=n,i&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=r&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=r&&this.parser.options.ecmaVersion>=9)},$t.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},$t.prototype.at=function(t,e){void 0===e&&(e=!1);var n=this.source,i=n.length;if(t>=i)return-1;var r=n.charCodeAt(t);if(!e&&!this.switchU||r<=55295||r>=57344||t+1>=i)return r;var o=n.charCodeAt(t+1);return o>=56320&&o<=57343?(r<<10)+o-56613888:r},$t.prototype.nextIndex=function(t,e){void 0===e&&(e=!1);var n=this.source,i=n.length;if(t>=i)return i;var r,o=n.charCodeAt(t);return!e&&!this.switchU||o<=55295||o>=57344||t+1>=i||(r=n.charCodeAt(t+1))<56320||r>57343?t+1:t+2},$t.prototype.current=function(t){return void 0===t&&(t=!1),this.at(this.pos,t)},$t.prototype.lookahead=function(t){return void 0===t&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},$t.prototype.advance=function(t){void 0===t&&(t=!1),this.pos=this.nextIndex(this.pos,t)},$t.prototype.eat=function(t,e){return void 0===e&&(e=!1),this.current(e)===t&&(this.advance(e),!0)},$t.prototype.eatChars=function(t,e){void 0===e&&(e=!1);for(var n=this.pos,i=0,r=t;i<r.length;i+=1){var o=r[i],s=this.at(n,e);if(-1===s||s!==o)return!1;n=this.nextIndex(n,e)}return this.pos=n,!0},Xt.validateRegExpFlags=function(t){for(var e=t.validFlags,n=t.flags,i=!1,r=!1,o=0;o<n.length;o++){var s=n.charAt(o);-1===e.indexOf(s)&&this.raise(t.start,"Invalid regular expression flag"),n.indexOf(s,o+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),"u"===s&&(i=!0),"v"===s&&(r=!0)}this.options.ecmaVersion>=15&&i&&r&&this.raise(t.start,"Invalid regular expression flag")},Xt.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&te(t.groupNames)&&(t.switchN=!0,this.regexp_pattern(t))},Xt.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames=Object.create(null),t.backReferenceNames.length=0,t.branchID=null,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,n=t.backReferenceNames;e<n.length;e+=1){var i=n[e];t.groupNames[i]||t.raise("Invalid named capture referenced")}},Xt.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new Kt(t.branchID,null)),this.regexp_alternative(t);t.eat(124);)e&&(t.branchID=t.branchID.sibling()),this.regexp_alternative(t);e&&(t.branchID=t.branchID.parent),this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")},Xt.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););},Xt.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):!!(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))&&(this.regexp_eatQuantifier(t),!0)},Xt.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!n,!0}return t.pos=e,!1},Xt.regexp_eatQuantifier=function(t,e){return void 0===e&&(e=!1),!!this.regexp_eatQuantifierPrefix(t,e)&&(t.eat(63),!0)},Xt.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)},Xt.regexp_eatBracedQuantifier=function(t,e){var n=t.pos;if(t.eat(123)){var i=0,r=-1;if(this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(r=t.lastIntValue),t.eat(125)))return-1!==r&&r<i&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=n}return!1},Xt.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)},Xt.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1},Xt.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(t),i=t.eat(45);if(n||i){for(var r=0;r<n.length;r++){var o=n.charAt(r);n.indexOf(o,r+1)>-1&&t.raise("Duplicate regular expression modifiers")}if(i){var s=this.regexp_eatModifiers(t);n||s||58!==t.current()||t.raise("Invalid regular expression modifiers");for(var a=0;a<s.length;a++){var l=s.charAt(a);(s.indexOf(l,a+1)>-1||n.indexOf(l)>-1)&&t.raise("Duplicate regular expression modifiers")}}}}if(t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}}t.pos=e}return!1},Xt.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):63===t.current()&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1},Xt.regexp_eatModifiers=function(t){for(var e="",n=0;-1!==(n=t.current())&&ee(n);)e+=O(n),t.advance();return e},Xt.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)},Xt.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1},Xt.regexp_eatSyntaxCharacter=function(t){var e=t.current();return!!ne(e)&&(t.lastIntValue=e,t.advance(),!0)},Xt.regexp_eatPatternCharacters=function(t){for(var e=t.pos,n=0;-1!==(n=t.current())&&!ne(n);)t.advance();return t.pos!==e},Xt.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return!(-1===e||36===e||e>=40&&e<=43||46===e||63===e||91===e||94===e||124===e||(t.advance(),0))},Xt.regexp_groupSpecifier=function(t){if(t.eat(63)){this.regexp_eatGroupName(t)||t.raise("Invalid group");var e=this.options.ecmaVersion>=16,n=t.groupNames[t.lastStringValue];if(n)if(e)for(var i=0,r=n;i<r.length;i+=1)r[i].separatedFrom(t.branchID)||t.raise("Duplicate capture group name");else t.raise("Duplicate capture group name");e?(n||(t.groupNames[t.lastStringValue]=[])).push(t.branchID):t.groupNames[t.lastStringValue]=!0}},Xt.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1},Xt.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=O(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=O(t.lastIntValue);return!0}return!1},Xt.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,n=this.options.ecmaVersion>=11,i=t.current(n);return t.advance(n),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(t,n)&&(i=t.lastIntValue),ie(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)},Xt.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,n=this.options.ecmaVersion>=11,i=t.current(n);return t.advance(n),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(t,n)&&(i=t.lastIntValue),re(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)},Xt.regexp_eatAtomEscape=function(t){return!!(this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t))||(t.switchU&&(99===t.current()&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)},Xt.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var n=t.lastIntValue;if(t.switchU)return n>t.maxBackReference&&(t.maxBackReference=n),!0;if(n<=t.numCapturingParens)return!0;t.pos=e}return!1},Xt.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1},Xt.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)},Xt.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1},Xt.regexp_eatZero=function(t){return 48===t.current()&&!me(t.lookahead())&&(t.lastIntValue=0,t.advance(),!0)},Xt.regexp_eatControlEscape=function(t){var e=t.current();return 116===e?(t.lastIntValue=9,t.advance(),!0):110===e?(t.lastIntValue=10,t.advance(),!0):118===e?(t.lastIntValue=11,t.advance(),!0):102===e?(t.lastIntValue=12,t.advance(),!0):114===e&&(t.lastIntValue=13,t.advance(),!0)},Xt.regexp_eatControlLetter=function(t){var e=t.current();return!!oe(e)&&(t.lastIntValue=e%32,t.advance(),!0)},Xt.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){void 0===e&&(e=!1);var n=t.pos,i=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var r=t.lastIntValue;if(i&&r>=55296&&r<=56319){var o=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var s=t.lastIntValue;if(s>=56320&&s<=57343)return t.lastIntValue=1024*(r-55296)+(s-56320)+65536,!0}t.pos=o,t.lastIntValue=r}return!0}if(i&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&se(t.lastIntValue))return!0;i&&t.raise("Invalid unicode escape"),t.pos=n}return!1},Xt.regexp_eatIdentityEscape=function(t){if(t.switchU)return!!this.regexp_eatSyntaxCharacter(t)||!!t.eat(47)&&(t.lastIntValue=47,!0);var e=t.current();return!(99===e||t.switchN&&107===e||(t.lastIntValue=e,t.advance(),0))},Xt.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do{t.lastIntValue=10*t.lastIntValue+(e-48),t.advance()}while((e=t.current())>=48&&e<=57);return!0}return!1};var ae=0,le=1,ce=2;function ue(t){return 100===t||68===t||115===t||83===t||119===t||87===t}function he(t){return oe(t)||95===t}function de(t){return he(t)||me(t)}function pe(t){return 33===t||t>=35&&t<=38||t>=42&&t<=44||46===t||t>=58&&t<=64||94===t||96===t||126===t}function fe(t){return 40===t||41===t||45===t||47===t||t>=91&&t<=93||t>=123&&t<=125}function ge(t){return 33===t||35===t||37===t||38===t||44===t||45===t||t>=58&&t<=62||64===t||96===t||126===t}function me(t){return t>=48&&t<=57}function ye(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function ve(t){return t>=65&&t<=70?t-65+10:t>=97&&t<=102?t-97+10:t-48}function be(t){return t>=48&&t<=55}Xt.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(ue(e))return t.lastIntValue=-1,t.advance(),le;var n=!1;if(t.switchU&&this.options.ecmaVersion>=9&&((n=80===e)||112===e)){var i;if(t.lastIntValue=-1,t.advance(),t.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return n&&i===ce&&t.raise("Invalid property name"),i;t.raise("Invalid property name")}return ae},Xt.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var n=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,n,i),le}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var r=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,r)}return ae},Xt.regexp_validateUnicodePropertyNameAndValue=function(t,e,n){_(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(n)||t.raise("Invalid property value")},Xt.regexp_validateUnicodePropertyNameOrValue=function(t,e){return t.unicodeProperties.binary.test(e)?le:t.switchV&&t.unicodeProperties.binaryOfStrings.test(e)?ce:void t.raise("Invalid property name")},Xt.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";he(e=t.current());)t.lastStringValue+=O(e),t.advance();return""!==t.lastStringValue},Xt.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";de(e=t.current());)t.lastStringValue+=O(e),t.advance();return""!==t.lastStringValue},Xt.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)},Xt.regexp_eatCharacterClass=function(t){if(t.eat(91)){var e=t.eat(94),n=this.regexp_classContents(t);return t.eat(93)||t.raise("Unterminated character class"),e&&n===ce&&t.raise("Negated character class may contain strings"),!0}return!1},Xt.regexp_classContents=function(t){return 93===t.current()?le:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),le)},Xt.regexp_nonEmptyClassRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var n=t.lastIntValue;!t.switchU||-1!==e&&-1!==n||t.raise("Invalid character class"),-1!==e&&-1!==n&&e>n&&t.raise("Range out of order in character class")}}},Xt.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var n=t.current();(99===n||be(n))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var i=t.current();return 93!==i&&(t.lastIntValue=i,t.advance(),!0)},Xt.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)},Xt.regexp_classSetExpression=function(t){var e,n=le;if(this.regexp_eatClassSetRange(t));else if(e=this.regexp_eatClassSetOperand(t)){e===ce&&(n=ce);for(var i=t.pos;t.eatChars([38,38]);)38!==t.current()&&(e=this.regexp_eatClassSetOperand(t))?e!==ce&&(n=le):t.raise("Invalid character in character class");if(i!==t.pos)return n;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(i!==t.pos)return n}else t.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(t)){if(!(e=this.regexp_eatClassSetOperand(t)))return n;e===ce&&(n=ce)}},Xt.regexp_eatClassSetRange=function(t){var e=t.pos;if(this.regexp_eatClassSetCharacter(t)){var n=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassSetCharacter(t)){var i=t.lastIntValue;return-1!==n&&-1!==i&&n>i&&t.raise("Range out of order in character class"),!0}t.pos=e}return!1},Xt.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?le:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)},Xt.regexp_eatNestedClass=function(t){var e=t.pos;if(t.eat(91)){var n=t.eat(94),i=this.regexp_classContents(t);if(t.eat(93))return n&&i===ce&&t.raise("Negated character class may contain strings"),i;t.pos=e}if(t.eat(92)){var r=this.regexp_eatCharacterClassEscape(t);if(r)return r;t.pos=e}return null},Xt.regexp_eatClassStringDisjunction=function(t){var e=t.pos;if(t.eatChars([92,113])){if(t.eat(123)){var n=this.regexp_classStringDisjunctionContents(t);if(t.eat(125))return n}else t.raise("Invalid escape");t.pos=e}return null},Xt.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===ce&&(e=ce);return e},Xt.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return 1===e?le:ce},Xt.regexp_eatClassSetCharacter=function(t){var e=t.pos;if(t.eat(92))return!(!this.regexp_eatCharacterEscape(t)&&!this.regexp_eatClassSetReservedPunctuator(t)&&(t.eat(98)?(t.lastIntValue=8,0):(t.pos=e,1)));var n=t.current();return!(n<0||n===t.lookahead()&&pe(n)||fe(n)||(t.advance(),t.lastIntValue=n,0))},Xt.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return!!ge(e)&&(t.lastIntValue=e,t.advance(),!0)},Xt.regexp_eatClassControlLetter=function(t){var e=t.current();return!(!me(e)&&95!==e||(t.lastIntValue=e%32,t.advance(),0))},Xt.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1},Xt.regexp_eatDecimalDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;me(n=t.current());)t.lastIntValue=10*t.lastIntValue+(n-48),t.advance();return t.pos!==e},Xt.regexp_eatHexDigits=function(t){var e=t.pos,n=0;for(t.lastIntValue=0;ye(n=t.current());)t.lastIntValue=16*t.lastIntValue+ve(n),t.advance();return t.pos!==e},Xt.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var n=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=64*e+8*n+t.lastIntValue:t.lastIntValue=8*e+n}else t.lastIntValue=e;return!0}return!1},Xt.regexp_eatOctalDigit=function(t){var e=t.current();return be(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)},Xt.regexp_eatFixedHexDigits=function(t,e){var n=t.pos;t.lastIntValue=0;for(var i=0;i<e;++i){var r=t.current();if(!ye(r))return t.pos=n,!1;t.lastIntValue=16*t.lastIntValue+ve(r),t.advance()}return!0};var Ie=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new B(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},Ae=at.prototype;function Me(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function we(t){return"function"!=typeof BigInt?null:BigInt(t.replace(/_/g,""))}Ae.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Ie(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},Ae.getToken=function(){return this.next(),new Ie(this)},"undefined"!=typeof Symbol&&(Ae[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===I.eof,value:e}}}}),Ae.nextToken=function(){var t=this.curContext();return t&&t.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(I.eof):t.override?t.override(this):void this.readToken(this.fullCharCodeAtPos())},Ae.readToken=function(t){return d(t,this.options.ecmaVersion>=6)||92===t?this.readWord():this.getTokenFromCode(t)},Ae.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);if(t<=55295||t>=56320)return t;var e=this.input.charCodeAt(this.pos+1);return e<=56319||e>=57344?t:(t<<10)+e-56613888},Ae.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,n=this.input.indexOf("*/",this.pos+=2);if(-1===n&&this.raise(this.pos-2,"Unterminated comment"),this.pos=n+2,this.options.locations)for(var i=void 0,r=e;(i=C(this.input,r,this.pos))>-1;)++this.curLine,r=this.lineStart=i;this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,n),e,this.pos,t,this.curPosition())},Ae.skipLineComment=function(t){for(var e=this.pos,n=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!w(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,n,this.curPosition())},Ae.skipSpace=function(){t:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break t}break;default:if(!(t>8&&t<14||t>=5760&&T.test(String.fromCharCode(t))))break t;++this.pos}}},Ae.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=t,this.value=e,this.updateContext(n)},Ae.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===t&&46===e?(this.pos+=3,this.finishToken(I.ellipsis)):(++this.pos,this.finishToken(I.dot))},Ae.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===t?this.finishOp(I.assign,2):this.finishOp(I.slash,1)},Ae.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),n=1,i=42===t?I.star:I.modulo;return this.options.ecmaVersion>=7&&42===t&&42===e&&(++n,i=I.starstar,e=this.input.charCodeAt(this.pos+2)),61===e?this.finishOp(I.assign,n+1):this.finishOp(i,n)},Ae.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?this.options.ecmaVersion>=12&&61===this.input.charCodeAt(this.pos+2)?this.finishOp(I.assign,3):this.finishOp(124===t?I.logicalOR:I.logicalAND,2):61===e?this.finishOp(I.assign,2):this.finishOp(124===t?I.bitwiseOR:I.bitwiseAND,1)},Ae.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(I.assign,2):this.finishOp(I.bitwiseXOR,1)},Ae.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?45!==e||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!A.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(I.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===e?this.finishOp(I.assign,2):this.finishOp(I.plusMin,1)},Ae.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),n=1;return e===t?(n=62===t&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+n)?this.finishOp(I.assign,n+1):this.finishOp(I.bitShift,n)):33!==e||60!==t||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===e&&(n=2),this.finishOp(I.relational,n)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},Ae.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return 61===e?this.finishOp(I.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===t&&62===e&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(I.arrow)):this.finishOp(61===t?I.eq:I.prefix,1)},Ae.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(46===e){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(I.questionDot,2)}if(63===e)return t>=12&&61===this.input.charCodeAt(this.pos+2)?this.finishOp(I.assign,3):this.finishOp(I.coalesce,2)}return this.finishOp(I.question,1)},Ae.readToken_numberSign=function(){var t=35;if(this.options.ecmaVersion>=13&&(++this.pos,d(t=this.fullCharCodeAtPos(),!0)||92===t))return this.finishToken(I.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+O(t)+"'")},Ae.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(I.parenL);case 41:return++this.pos,this.finishToken(I.parenR);case 59:return++this.pos,this.finishToken(I.semi);case 44:return++this.pos,this.finishToken(I.comma);case 91:return++this.pos,this.finishToken(I.bracketL);case 93:return++this.pos,this.finishToken(I.bracketR);case 123:return++this.pos,this.finishToken(I.braceL);case 125:return++this.pos,this.finishToken(I.braceR);case 58:return++this.pos,this.finishToken(I.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(I.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(120===e||88===e)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===e||79===e)return this.readRadixNumber(8);if(98===e||66===e)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(I.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+O(t)+"'")},Ae.finishOp=function(t,e){var n=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,n)},Ae.readRegexp=function(){for(var t,e,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(A.test(i)&&this.raise(n,"Unterminated regular expression"),t)t=!1;else{if("["===i)e=!0;else if("]"===i&&e)e=!1;else if("/"===i&&!e)break;t="\\"===i}++this.pos}var r=this.input.slice(n,this.pos);++this.pos;var o=this.pos,s=this.readWord1();this.containsEsc&&this.unexpected(o);var a=this.regexpState||(this.regexpState=new $t(this));a.reset(n,r,s),this.validateRegExpFlags(a),this.validateRegExpPattern(a);var l=null;try{l=new RegExp(r,s)}catch(t){}return this.finishToken(I.regexp,{pattern:r,flags:s,value:l})},Ae.readInt=function(t,e,n){for(var i=this.options.ecmaVersion>=12&&void 0===e,r=n&&48===this.input.charCodeAt(this.pos),o=this.pos,s=0,a=0,l=0,c=null==e?1/0:e;l<c;++l,++this.pos){var u=this.input.charCodeAt(this.pos),h=void 0;if(i&&95===u)r&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===a&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===l&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),a=u;else{if((h=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0)>=t)break;a=u,s=s*t+h}}return i&&95===a&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===o||null!=e&&this.pos-o!==e?null:s},Ae.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var n=this.readInt(t);return null==n&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(n=we(this.input.slice(e,this.pos)),++this.pos):d(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(I.num,n)},Ae.readNumber=function(t){var e=this.pos;t||null!==this.readInt(10,void 0,!0)||this.raise(e,"Invalid number");var n=this.pos-e>=2&&48===this.input.charCodeAt(e);n&&this.strict&&this.raise(e,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!n&&!t&&this.options.ecmaVersion>=11&&110===i){var r=we(this.input.slice(e,this.pos));return++this.pos,d(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(I.num,r)}n&&/[89]/.test(this.input.slice(e,this.pos))&&(n=!1),46!==i||n||(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),69!==i&&101!==i||n||(43!==(i=this.input.charCodeAt(++this.pos))&&45!==i||++this.pos,null===this.readInt(10)&&this.raise(e,"Invalid number")),d(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var o=Me(this.input.slice(e,this.pos),n);return this.finishToken(I.num,o)},Ae.readCodePoint=function(){var t;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var e=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(e,"Code point out of bounds")}else t=this.readHexChar(4);return t},Ae.readString=function(t){for(var e="",n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===t)break;92===i?(e+=this.input.slice(n,this.pos),e+=this.readEscapedChar(!1),n=this.pos):8232===i||8233===i?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(w(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(n,this.pos++),this.finishToken(I.string,e)};var Ce={};Ae.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t!==Ce)throw t;this.readInvalidTemplateToken()}this.inTemplateElement=!1},Ae.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ce;this.raise(t,e)},Ae.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var n=this.input.charCodeAt(this.pos);if(96===n||36===n&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==I.template&&this.type!==I.invalidTemplate?(t+=this.input.slice(e,this.pos),this.finishToken(I.template,t)):36===n?(this.pos+=2,this.finishToken(I.dollarBraceL)):(++this.pos,this.finishToken(I.backQuote));if(92===n)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(w(n)){switch(t+=this.input.slice(e,this.pos),++this.pos,n){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:t+="\n";break;default:t+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}},Ae.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(I.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},Ae.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return O(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(i,8);return r>255&&(i=i.slice(0,-1),r=parseInt(i,8)),this.pos+=i.length-1,e=this.input.charCodeAt(this.pos),"0"===i&&56!==e&&57!==e||!this.strict&&!t||this.invalidStringToken(this.pos-1-i.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(r)}return w(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}},Ae.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return null===n&&this.invalidStringToken(e,"Bad character escape sequence"),n},Ae.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,n=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var r=this.fullCharCodeAtPos();if(p(r,i))this.pos+=r<=65535?1:2;else{if(92!==r)break;this.containsEsc=!0,t+=this.input.slice(n,this.pos);var o=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var s=this.readCodePoint();(e?d:p)(s,i)||this.invalidStringToken(o,"Invalid Unicode escape"),t+=O(s),n=this.pos}e=!1}return t+this.input.slice(n,this.pos)},Ae.readWord=function(){var t=this.readWord1(),e=I.name;return this.keywords.test(t)&&(e=v[t]),this.finishToken(e,t)};var Te="8.15.0";function xe(t,e){return at.parse(t,e)}function Se(t,e,n){return at.parseExpressionAt(t,e,n)}function De(t,e){return at.tokenizer(t,e)}at.acorn={Parser:at,version:Te,defaultOptions:R,Position:L,SourceLocation:B,getLineInfo:P,Node:jt,TokenType:f,tokTypes:I,keywordTypes:v,TokContext:Mt,tokContexts:wt,isIdentifierChar:p,isIdentifierStart:d,Token:Ie,isNewLine:w,lineBreak:A,lineBreakG:M,nonASCIIwhitespace:T},t.Node=jt,t.Parser=at,t.Position=L,t.SourceLocation=B,t.TokContext=Mt,t.Token=Ie,t.TokenType=f,t.defaultOptions=R,t.getLineInfo=P,t.isIdentifierChar=p,t.isIdentifierStart=d,t.isNewLine=w,t.keywordTypes=v,t.lineBreak=A,t.lineBreakG=M,t.nonASCIIwhitespace=T,t.parse=xe,t.parseExpressionAt=Se,t.tokContexts=wt,t.tokTypes=I,t.tokenizer=De,t.version=Te}(e)},551:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,"/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n/* layout contants from `layout-constants.js`, minus 1px */\n\n.button-group_button-group_-xrlY {\n display: -webkit-inline-box;\n display: -webkit-inline-flex;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n -ms-flex-direction: row;\n flex-direction: row;\n padding: 0 .25rem;\n}\n","",{version:3,sources:["webpack://./src/css/units.css","webpack://./src/components/button-group/button-group.css"],names:[],mappings:"AAAA;;oDAEoD;;AAEpD;;;;kFAIkF;;AAelF,0DAA0D;;ACrB1D;IACI,2BAAoB;IAApB,4BAAoB;IAApB,2BAAoB;IAApB,oBAAoB;IACpB,8BAAmB;IAAnB,6BAAmB;IAAnB,2BAAmB;QAAnB,uBAAmB;YAAnB,mBAAmB;IACnB,iBAAqB;AACzB",sourcesContent:["/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n$space: 0.5rem;\n$grid-unit: .25rem;\n\n$sprites-per-row: 5;\n\n$menu-bar-height: 3rem;\n$sprite-info-height: 6rem;\n$stage-menu-height: 2.75rem;\n\n$library-header-height: 4.375rem;\n\n$form-radius: calc($space / 2);\n\n/* layout contants from `layout-constants.js`, minus 1px */\n$full-size: 1095px;\n$full-size-paint: 1256px;\n",'@import "../../css/units";\n\n.button-group {\n display: inline-flex;\n flex-direction: row;\n padding: 0 $grid-unit;\n}\n'],sourceRoot:""}]),r.locals={"button-group":"button-group_button-group_-xrlY",buttonGroup:"button-group_button-group_-xrlY"},t.exports=r},559:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,"/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* 35% transparent version of looks-secondary */\n\n.button_button_9jFbh {\n background: none;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.button_button_9jFbh:active {\n background-color: hsla(260, 60%, 60%, 0.35);\n}\n\n.button_highlighted_Ek-Iy.button_button_9jFbh {\n background-color: hsla(260, 60%, 60%, 0.35);\n}\n\n.button_mod-disabled_wDlGR {\n cursor: auto;\n opacity: .5;\n}\n\n.button_mod-disabled_wDlGR:active {\n background: none;\n}\n","",{version:3,sources:["webpack://./src/css/colors.css","webpack://./src/components/button/button.css"],names:[],mappings:"AAAA;;oDAEoD;;AASL,+CAA+C;;ACT9F;IACI,gBAAgB;IAChB,eAAe;IACf,yBAAiB;OAAjB,sBAAiB;QAAjB,qBAAiB;YAAjB,iBAAiB;AACrB;;AACA;IACI,2CAAoC;AACxC;;AACA;IACI,2CAAoC;AACxC;;AACA;IACI,YAAY;IACZ,WAAW;AACf;;AACA;IACI,gBAAgB;AACpB",sourcesContent:["/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n$ui-pane-border: #D9D9D9;\n$ui-pane-gray: #F9F9F9;\n$ui-background-blue: #e8edf1;\n\n$text-primary: #575e75;\n\n$looks-secondary: #855CD6;\n$looks-transparent: hsla(260, 60%, 60%, 0.35); /* 35% transparent version of looks-secondary */\n\n$red-primary: #FF661A;\n$red-tertiary: #E64D00;\n\n$sound-primary: #CF63CF;\n$sound-tertiary: #A63FA6;\n\n$control-primary: #FFAB19;\n\n$data-primary: #FF8C1A;\n\n$form-border: #E9EEF2;\n",'@import "../../css/colors.css";\n\n.button {\n background: none;\n cursor: pointer;\n user-select: none;\n}\n.button:active {\n background-color: $looks-transparent;\n}\n.highlighted.button {\n background-color: $looks-transparent;\n}\n.mod-disabled {\n cursor: auto;\n opacity: .5;\n}\n.mod-disabled:active {\n background: none;\n}\n'],sourceRoot:""}]),r.locals={button:"button_button_9jFbh",highlighted:"button_highlighted_Ek-Iy","mod-disabled":"button_mod-disabled_wDlGR",modDisabled:"button_mod-disabled_wDlGR"},t.exports=r},227:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,'.color-button_color-button_Dmf-d {\n height: 2rem;\n width: 3rem;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n}\n\n.color-button_color-button-swatch_wuoIu {\n position: relative;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n cursor: pointer;\n -webkit-flex-basis: 2rem;\n -ms-flex-preferred-size: 2rem;\n flex-basis: 2rem;\n -webkit-flex-shrink: 0;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n height: 100%;\n border: 1px solid rgba(0, 0, 0, 0.25);\n}\n\n[dir="ltr"] .color-button_color-button-swatch_wuoIu {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n}\n\n[dir="rtl"] .color-button_color-button-swatch_wuoIu {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n}\n\n.color-button_color-button-arrow_B709Q {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n cursor: pointer;\n -webkit-flex-basis: 1rem;\n -ms-flex-preferred-size: 1rem;\n flex-basis: 1rem;\n -webkit-flex-shrink: 0;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n height: 100%;\n\n border: 1px solid rgba(0, 0, 0, 0.25);\n\n -webkit-box-align: center;\n\n -webkit-align-items: center;\n\n -ms-flex-align: center;\n\n align-items: center;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n -ms-flex-pack: center;\n justify-content: center;\n color: #575e75;\n font-size: 0.75rem;\n}\n\n[dir="ltr"] .color-button_color-button-arrow_B709Q {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n border-left: none;\n}\n\n[dir="rtl"] .color-button_color-button-arrow_B709Q {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n border-right: none;\n}\n\n.color-button_swatch-icon_zmoVW {\n width: 1.75rem;\n margin: auto;\n /* Make sure it appears above the outline box */\n z-index: 2;\n}\n\n.color-button_outline-swatch_4u4Q0:after {\n content: "";\n position: absolute;\n top: calc(0.5rem);\n left: calc(0.5rem);\n width: 0.75rem;\n height: 0.75rem;\n background: white;\n border: 1px solid rgba(0, 0, 0, 0.25);\n /* Make sure it appears below the transparent icon */\n z-index: 1;\n}\n',"",{version:3,sources:["webpack://./src/components/color-button/color-button.css"],names:[],mappings:"AAAA;IACI,YAAY;IACZ,WAAW;IACX,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;AACjB;;AAEA;IACI,kBAAkB;IAClB,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,eAAe;IACf,wBAAgB;QAAhB,6BAAgB;YAAhB,gBAAgB;IAChB,sBAAc;QAAd,oBAAc;YAAd,cAAc;IACd,YAAY;IACZ,qCAAqC;AACzC;;AAEA;IACI,2BAA2B;IAC3B,8BAA8B;AAClC;;AAEA;IACI,4BAA4B;IAC5B,+BAA+B;AACnC;;AAEA;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,yBAAiB;OAAjB,sBAAiB;QAAjB,qBAAiB;YAAjB,iBAAiB;IACjB,eAAe;IACf,wBAAgB;QAAhB,6BAAgB;YAAhB,gBAAgB;IAChB,sBAAc;QAAd,oBAAc;YAAd,cAAc;IACd,YAAY;;IAEZ,qCAAqC;;IAErC,yBAAmB;;IAAnB,2BAAmB;;QAAnB,sBAAmB;;YAAnB,mBAAmB;IACnB,wBAAuB;IAAvB,+BAAuB;QAAvB,qBAAuB;YAAvB,uBAAuB;IACvB,cAAc;IACd,kBAAkB;AACtB;;AAEA;IACI,4BAA4B;IAC5B,+BAA+B;IAC/B,iBAAiB;AACrB;;AAEA;IACI,2BAA2B;IAC3B,8BAA8B;IAC9B,kBAAkB;AACtB;;AAEA;IACI,cAAc;IACd,YAAY;IACZ,+CAA+C;IAC/C,UAAU;AACd;;AAEA;IACI,WAAW;IACX,kBAAkB;IAClB,iBAAiB;IACjB,kBAAkB;IAClB,cAAc;IACd,eAAe;IACf,iBAAiB;IACjB,qCAAqC;IACrC,oDAAoD;IACpD,UAAU;AACd",sourcesContent:['.color-button {\n height: 2rem;\n width: 3rem;\n display: flex;\n}\n\n.color-button-swatch {\n position: relative;\n display: flex;\n cursor: pointer;\n flex-basis: 2rem;\n flex-shrink: 0;\n height: 100%;\n border: 1px solid rgba(0, 0, 0, 0.25);\n}\n\n[dir="ltr"] .color-button-swatch {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n}\n\n[dir="rtl"] .color-button-swatch {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n}\n\n.color-button-arrow {\n display: flex;\n user-select: none;\n cursor: pointer;\n flex-basis: 1rem;\n flex-shrink: 0;\n height: 100%;\n\n border: 1px solid rgba(0, 0, 0, 0.25);\n\n align-items: center;\n justify-content: center;\n color: #575e75;\n font-size: 0.75rem;\n}\n\n[dir="ltr"] .color-button-arrow {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n border-left: none;\n}\n\n[dir="rtl"] .color-button-arrow {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n border-right: none;\n}\n\n.swatch-icon {\n width: 1.75rem;\n margin: auto;\n /* Make sure it appears above the outline box */\n z-index: 2;\n}\n\n.outline-swatch:after {\n content: "";\n position: absolute;\n top: calc(0.5rem);\n left: calc(0.5rem);\n width: 0.75rem;\n height: 0.75rem;\n background: white;\n border: 1px solid rgba(0, 0, 0, 0.25);\n /* Make sure it appears below the transparent icon */\n z-index: 1;\n}\n'],sourceRoot:""}]),r.locals={"color-button":"color-button_color-button_Dmf-d",colorButton:"color-button_color-button_Dmf-d","color-button-swatch":"color-button_color-button-swatch_wuoIu",colorButtonSwatch:"color-button_color-button-swatch_wuoIu","color-button-arrow":"color-button_color-button-arrow_B709Q",colorButtonArrow:"color-button_color-button-arrow_B709Q","swatch-icon":"color-button_swatch-icon_zmoVW",swatchIcon:"color-button_swatch-icon_zmoVW","outline-swatch":"color-button_outline-swatch_4u4Q0",outlineSwatch:"color-button_outline-swatch_4u4Q0"},t.exports=r},939:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,'/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* 35% transparent version of looks-secondary */\n\n/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n/* layout contants from `layout-constants.js`, minus 1px */\n\n/* Popover styles */\n\n.Popover-body {\n background: white;\n border: 1px solid #ddd;\n padding: 4px;\n border-radius: 4px;\n padding: 4px;\n -webkit-box-shadow: 0px 0px 8px 1px rgba(0, 0, 0, .3);\n box-shadow: 0px 0px 8px 1px rgba(0, 0, 0, .3);\n}\n\n.Popover-tipShape {\n fill: white;\n stroke: #ddd;\n}\n\n.color-picker_clickable_toCkq {\n cursor: pointer;\n}\n\n.color-picker_swatch-row_L3tax {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n -ms-flex-direction: row;\n flex-direction: row;\n -webkit-box-pack: justify;\n -webkit-justify-content: space-between;\n -ms-flex-pack: justify;\n justify-content: space-between;\n}\n\n.color-picker_row-header_bsOiG {\n font-family: "Helvetica Neue", Helvetica, sans-serif;\n font-size: 0.65rem;\n color: #575E75;\n margin: 8px;\n}\n\n[dir="ltr"] .color-picker_label-readout_jRRx1 {\n margin-left: 10px;\n}\n\n[dir="rtl"] .color-picker_label-readout_jRRx1 {\n margin-right: 10px;\n}\n\n.color-picker_label-name_Fh33x {\n font-weight: bold;\n}\n\n.color-picker_divider_kSFdY {\n border-top: 1px solid #ddd;\n margin: 8px;\n}\n\n.color-picker_swap-button_KUpPw {\n margin-left: 8px;\n margin-right: 8px;\n}\n\n.color-picker_swatches_aTL2C {\n margin: 8px;\n}\n\n.color-picker_swatch_s2mbW {\n width: 1.5rem;\n height: 1.5rem;\n border: 1px solid #ddd;\n border-radius: 4px;\n -webkit-box-sizing: content-box;\n box-sizing: content-box;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -webkit-align-items: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.color-picker_large-swatch-icon_rQJGb {\n width: 1.75rem;\n margin: auto;\n}\n\n.color-picker_large-swatch_nfBy1 {\n width: 2rem;\n height: 2rem;\n}\n\n.color-picker_active-swatch_9gUEo {\n border: 1px solid #855CD6;\n -webkit-box-shadow: 0px 0px 0px 3px hsla(260, 60%, 60%, 0.35);\n box-shadow: 0px 0px 0px 3px hsla(260, 60%, 60%, 0.35);\n}\n\n.color-picker_swatch-icon_xKjWO {\n width: 1.5rem;\n height: 1.5rem;\n}\n\n.color-picker_inactive-gradient_SY3ld {\n -webkit-filter: saturate(0%);\n filter: saturate(0%);\n}\n\n.color-picker_gradient-picker-row_fHjyz {\n -webkit-box-align: center;\n -webkit-align-items: center;\n -ms-flex-align: center;\n align-items: center;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n -ms-flex-direction: row;\n flex-direction: row;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n -ms-flex-pack: center;\n justify-content: center;\n margin: 8px;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n[dir="ltr"] .color-picker_gradient-picker-row_fHjyz > img + img {\n margin-left: calc(2 * .25rem);\n}\n\n[dir="rtl"] .color-picker_gradient-picker-row_fHjyz > img + img {\n margin-right: calc(2 * .25rem);\n}\n\n[dir="rtl"] .color-picker_gradient-swatches-row_hEq4C {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: reverse;\n -webkit-flex-direction: row-reverse;\n -ms-flex-direction: row-reverse;\n flex-direction: row-reverse;\n}\n',"",{version:3,sources:["webpack://./src/css/colors.css","webpack://./src/css/units.css","webpack://./src/components/color-picker/color-picker.css"],names:[],mappings:"AAAA;;oDAEoD;;AASL,+CAA+C;;ACX9F;;oDAEoD;;AAEpD;;;;kFAIkF;;AAelF,0DAA0D;;ACpB1D,mBAAmB;;AACnB;IACI,iBAAiB;IACjB,sBAAsB;IACtB,YAAY;IACZ,kBAAkB;IAClB,YAAY;IACZ,qDAA6C;YAA7C,6CAA6C;AACjD;;AAEA;IACI,WAAW;IACX,YAAY;AAChB;;AAEA;IACI,eAAe;AACnB;;AAEA;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,8BAAmB;IAAnB,6BAAmB;IAAnB,2BAAmB;QAAnB,uBAAmB;YAAnB,mBAAmB;IACnB,yBAA8B;IAA9B,sCAA8B;QAA9B,sBAA8B;YAA9B,8BAA8B;AAClC;;AAEA;IACI,oDAAoD;IACpD,kBAAkB;IAClB,cAAc;IACd,WAAW;AACf;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI,0BAA0B;IAC1B,WAAW;AACf;;AAEA;IACI,gBAAgB;IAChB,iBAAiB;AACrB;;AAEA;IACI,WAAW;AACf;;AAEA;IACI,aAAa;IACb,cAAc;IACd,sBAAsB;IACtB,kBAAkB;IAClB,+BAAuB;YAAvB,uBAAuB;IACvB,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,yBAAmB;IAAnB,2BAAmB;QAAnB,sBAAmB;YAAnB,mBAAmB;AACvB;;AAEA;IACI,cAAc;IACd,YAAY;AAChB;;AAEA;IACI,WAAW;IACX,YAAY;AAChB;;AAEA;IACI,yBAAkC;IAClC,6DAA8C;YAA9C,qDAA8C;AAClD;;AAEA;IACI,aAAa;IACb,cAAc;AAClB;;AAEA;IACI,4BAAoB;YAApB,oBAAoB;AACxB;;AAEA;IACI,yBAAmB;IAAnB,2BAAmB;QAAnB,sBAAmB;YAAnB,mBAAmB;IACnB,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,8BAAmB;IAAnB,6BAAmB;IAAnB,2BAAmB;QAAnB,uBAAmB;YAAnB,mBAAmB;IACnB,wBAAuB;IAAvB,+BAAuB;QAAvB,qBAAuB;YAAvB,uBAAuB;IACvB,WAAW;IACX,yBAAiB;OAAjB,sBAAiB;QAAjB,qBAAiB;YAAjB,iBAAiB;AACrB;;AAEA;IACI,6BAAiC;AACrC;;AAEA;IACI,8BAAkC;AACtC;;AAEA;IACI,8BAA2B;IAA3B,8BAA2B;IAA3B,mCAA2B;QAA3B,+BAA2B;YAA3B,2BAA2B;AAC/B",sourcesContent:["/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n$ui-pane-border: #D9D9D9;\n$ui-pane-gray: #F9F9F9;\n$ui-background-blue: #e8edf1;\n\n$text-primary: #575e75;\n\n$looks-secondary: #855CD6;\n$looks-transparent: hsla(260, 60%, 60%, 0.35); /* 35% transparent version of looks-secondary */\n\n$red-primary: #FF661A;\n$red-tertiary: #E64D00;\n\n$sound-primary: #CF63CF;\n$sound-tertiary: #A63FA6;\n\n$control-primary: #FFAB19;\n\n$data-primary: #FF8C1A;\n\n$form-border: #E9EEF2;\n","/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n$space: 0.5rem;\n$grid-unit: .25rem;\n\n$sprites-per-row: 5;\n\n$menu-bar-height: 3rem;\n$sprite-info-height: 6rem;\n$stage-menu-height: 2.75rem;\n\n$library-header-height: 4.375rem;\n\n$form-radius: calc($space / 2);\n\n/* layout contants from `layout-constants.js`, minus 1px */\n$full-size: 1095px;\n$full-size-paint: 1256px;\n",'@import "../../css/colors";\n@import "../../css/units";\n\n/* Popover styles */\n:global(.Popover-body) {\n background: white;\n border: 1px solid #ddd;\n padding: 4px;\n border-radius: 4px;\n padding: 4px;\n box-shadow: 0px 0px 8px 1px rgba(0, 0, 0, .3);\n}\n\n:global(.Popover-tipShape) {\n fill: white;\n stroke: #ddd;\n}\n\n.clickable {\n cursor: pointer;\n}\n\n.swatch-row {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n.row-header {\n font-family: "Helvetica Neue", Helvetica, sans-serif;\n font-size: 0.65rem;\n color: #575E75;\n margin: 8px;\n}\n\n[dir="ltr"] .label-readout {\n margin-left: 10px;\n}\n\n[dir="rtl"] .label-readout {\n margin-right: 10px;\n}\n\n.label-name {\n font-weight: bold;\n}\n\n.divider {\n border-top: 1px solid #ddd;\n margin: 8px;\n}\n\n.swap-button {\n margin-left: 8px;\n margin-right: 8px;\n}\n\n.swatches {\n margin: 8px;\n}\n\n.swatch {\n width: 1.5rem;\n height: 1.5rem;\n border: 1px solid #ddd;\n border-radius: 4px;\n box-sizing: content-box;\n display: flex;\n align-items: center;\n}\n\n.large-swatch-icon {\n width: 1.75rem;\n margin: auto;\n}\n\n.large-swatch {\n width: 2rem;\n height: 2rem;\n}\n\n.active-swatch {\n border: 1px solid $looks-secondary;\n box-shadow: 0px 0px 0px 3px $looks-transparent;\n}\n\n.swatch-icon {\n width: 1.5rem;\n height: 1.5rem;\n}\n\n.inactive-gradient {\n filter: saturate(0%);\n}\n\n.gradient-picker-row {\n align-items: center;\n display: flex;\n flex-direction: row;\n justify-content: center;\n margin: 8px;\n user-select: none;\n}\n\n[dir="ltr"] .gradient-picker-row > img + img {\n margin-left: calc(2 * $grid-unit);\n}\n\n[dir="rtl"] .gradient-picker-row > img + img {\n margin-right: calc(2 * $grid-unit);\n}\n\n[dir="rtl"] .gradient-swatches-row {\n flex-direction: row-reverse;\n}\n'],sourceRoot:""}]),r.locals={clickable:"color-picker_clickable_toCkq","swatch-row":"color-picker_swatch-row_L3tax",swatchRow:"color-picker_swatch-row_L3tax","row-header":"color-picker_row-header_bsOiG",rowHeader:"color-picker_row-header_bsOiG","label-readout":"color-picker_label-readout_jRRx1",labelReadout:"color-picker_label-readout_jRRx1","label-name":"color-picker_label-name_Fh33x",labelName:"color-picker_label-name_Fh33x",divider:"color-picker_divider_kSFdY","swap-button":"color-picker_swap-button_KUpPw",swapButton:"color-picker_swap-button_KUpPw",swatches:"color-picker_swatches_aTL2C",swatch:"color-picker_swatch_s2mbW","large-swatch-icon":"color-picker_large-swatch-icon_rQJGb",largeSwatchIcon:"color-picker_large-swatch-icon_rQJGb","large-swatch":"color-picker_large-swatch_nfBy1",largeSwatch:"color-picker_large-swatch_nfBy1","active-swatch":"color-picker_active-swatch_9gUEo",activeSwatch:"color-picker_active-swatch_9gUEo","swatch-icon":"color-picker_swatch-icon_xKjWO",swatchIcon:"color-picker_swatch-icon_xKjWO","inactive-gradient":"color-picker_inactive-gradient_SY3ld",inactiveGradient:"color-picker_inactive-gradient_SY3ld","gradient-picker-row":"color-picker_gradient-picker-row_fHjyz",gradientPickerRow:"color-picker_gradient-picker-row_fHjyz","gradient-swatches-row":"color-picker_gradient-swatches-row_hEq4C",gradientSwatchesRow:"color-picker_gradient-swatches-row_hEq4C"},t.exports=r},409:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,'/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* 35% transparent version of looks-secondary */\n\n.dropdown_dropdown_fuTSY {\n border: 1px solid #E9EEF2;\n border-radius: 5px;\n overflow: visible;\n min-width: 3.5rem;\n color: #855CD6;\n padding: .5rem;\n}\n\n.dropdown_mod-open_elkw8 {\n background-color: #E9EEF2;\n}\n\n.dropdown_dropdown-icon_b0w6V {\n width: .5rem;\n height: .5rem;\n vertical-align: middle;\n padding-bottom: .2rem;\n}\n\n[dir="ltr"] .dropdown_dropdown-icon_b0w6V {\n margin-left: .5rem;\n}\n\n[dir="rtl"] .dropdown_dropdown-icon_b0w6V {\n margin-right: .5rem;\n}\n\n.dropdown_mod-caret-up_BSdAI {\n -webkit-transform: rotate(180deg);\n -ms-transform: rotate(180deg);\n transform: rotate(180deg);\n padding-bottom: 0;\n padding-top: .2rem;\n}\n',"",{version:3,sources:["webpack://./src/css/colors.css","webpack://./src/components/dropdown/dropdown.css"],names:[],mappings:"AAAA;;oDAEoD;;AASL,+CAA+C;;ACP9F;IACI,yBAA8B;IAC9B,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,cAAuB;IACvB,cAAc;AAClB;;AAEA;IACI,yBAA8B;AAClC;;AAEA;IACI,YAAY;IACZ,aAAa;IACb,sBAAsB;IACtB,qBAAqB;AACzB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,mBAAmB;AACvB;;AAEA;IACI,iCAAyB;QAAzB,6BAAyB;YAAzB,yBAAyB;IACzB,iBAAiB;IACjB,kBAAkB;AACtB",sourcesContent:["/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n$ui-pane-border: #D9D9D9;\n$ui-pane-gray: #F9F9F9;\n$ui-background-blue: #e8edf1;\n\n$text-primary: #575e75;\n\n$looks-secondary: #855CD6;\n$looks-transparent: hsla(260, 60%, 60%, 0.35); /* 35% transparent version of looks-secondary */\n\n$red-primary: #FF661A;\n$red-tertiary: #E64D00;\n\n$sound-primary: #CF63CF;\n$sound-tertiary: #A63FA6;\n\n$control-primary: #FFAB19;\n\n$data-primary: #FF8C1A;\n\n$form-border: #E9EEF2;\n",'@import \'../../css/colors.css\';\n\n$arrow-border-width: 14px;\n\n.dropdown {\n border: 1px solid $form-border;\n border-radius: 5px;\n overflow: visible;\n min-width: 3.5rem;\n color: $looks-secondary;\n padding: .5rem;\n}\n\n.mod-open {\n background-color: $form-border;\n}\n\n.dropdown-icon {\n width: .5rem;\n height: .5rem;\n vertical-align: middle;\n padding-bottom: .2rem;\n}\n\n[dir="ltr"] .dropdown-icon {\n margin-left: .5rem;\n}\n\n[dir="rtl"] .dropdown-icon {\n margin-right: .5rem;\n}\n\n.mod-caret-up {\n transform: rotate(180deg);\n padding-bottom: 0;\n padding-top: .2rem;\n}\n'],sourceRoot:""}]),r.locals={dropdown:"dropdown_dropdown_fuTSY","mod-open":"dropdown_mod-open_elkw8",modOpen:"dropdown_mod-open_elkw8","dropdown-icon":"dropdown_dropdown-icon_b0w6V",dropdownIcon:"dropdown_dropdown-icon_b0w6V","mod-caret-up":"dropdown_mod-caret-up_BSdAI",modCaretUp:"dropdown_mod-caret-up_BSdAI"},t.exports=r},957:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,'/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* 35% transparent version of looks-secondary */\n\n/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n/* layout contants from `layout-constants.js`, minus 1px */\n\n.fixed-tools_row_4i\\+0p {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n -ms-flex-direction: row;\n flex-direction: row;\n -webkit-box-align: center;\n -webkit-align-items: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.fixed-tools_costume-input_p5l43 {\n width: 8rem;\n}\n\n[dir="ltr"] .fixed-tools_mod-dashed-border_MnO5C {\n border-right: 1px dashed #D9D9D9;\n padding-right: calc(2 * .25rem);\n}\n\n[dir="rtl"] .fixed-tools_mod-dashed-border_MnO5C {\n border-left: 1px dashed #D9D9D9;\n padding-left: calc(2 * .25rem);\n}\n\n.fixed-tools_mod-unselect_wVcbW {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.fixed-tools_button-group-button_iXqpD {\n display: inline-block;\n border: 1px solid #D9D9D9;\n border-radius: 0;\n padding: .35rem;\n}\n\n[dir="ltr"] .fixed-tools_button-group-button_iXqpD {\n border-left: none;\n}\n\n[dir="rtl"] .fixed-tools_button-group-button_iXqpD {\n border-right: none;\n}\n\n[dir="ltr"] .fixed-tools_button-group-button_iXqpD:last-of-type {\n border-top-right-radius: 0.25rem;\n border-bottom-right-radius: 0.25rem;\n}\n\n[dir="ltr"] .fixed-tools_button-group-button_iXqpD:first-of-type {\n border-left: 1px solid #D9D9D9;\n border-top-left-radius: 0.25rem;\n border-bottom-left-radius: 0.25rem;\n}\n\n[dir="rtl"] .fixed-tools_button-group-button_iXqpD:last-of-type {\n border-top-left-radius: 0.25rem;\n border-bottom-left-radius: 0.25rem;\n}\n\n[dir="rtl"] .fixed-tools_button-group-button_iXqpD:first-of-type {\n border-right: 1px solid #D9D9D9;\n border-top-right-radius: 0.25rem;\n border-bottom-right-radius: 0.25rem;\n}\n\n[dir="ltr"] .fixed-tools_button-group-button_iXqpD.fixed-tools_mod-start-border_yh3uC {\n border-left: 1px solid #D9D9D9;\n}\n\n[dir="rtl"] .fixed-tools_button-group-button_iXqpD.fixed-tools_mod-start-border_yh3uC {\n border-right: 1px solid #D9D9D9;\n}\n\n[dir="ltr"] .fixed-tools_button-group-button_iXqpD.fixed-tools_mod-no-end-border_o0JOq {\n border-right: none;\n}\n\n[dir="rtl"] .fixed-tools_button-group-button_iXqpD.fixed-tools_mod-no-end-border_o0JOq {\n border-left: none;\n}\n\n.fixed-tools_button-group-button-icon_Y6tZ2 {\n width: 1.25rem;\n height: 1.25rem;\n vertical-align: middle;\n}\n\n[dir="rtl"] .fixed-tools_button-group-button-icon_Y6tZ2 {\n -webkit-transform: scaleX(-1);\n -ms-transform: scaleX(-1);\n transform: scaleX(-1);\n}\n\n.fixed-tools_mod-context-menu_auitG {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n\n.fixed-tools_mod-top-divider_R1J5f {\n border-top: 1px solid #D9D9D9;\n}\n\n.fixed-tools_mod-menu-item_me6aV {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n margin: 0 -.25rem;\n min-width: 6.25rem;\n padding: calc(3 * .25rem);\n white-space: nowrap;\n cursor: pointer;\n -webkit-transition: 0.1s ease;\n transition: 0.1s ease;\n -webkit-box-align: center;\n -webkit-align-items: center;\n -ms-flex-align: center;\n align-items: center;\n font-family: "Helvetica Neue", Helvetica, sans-serif;\n}\n\n.fixed-tools_mod-disabled_7U7bI {\n cursor: auto;\n}\n\n.fixed-tools_mod-menu-item_me6aV:hover {\n background: hsla(260, 60%, 60%, 0.35);\n}\n\n.fixed-tools_mod-disabled_7U7bI:hover {\n background-color: transparent;\n}\n\n.fixed-tools_menu-item-icon_NsQ\\+d {\n margin-right: calc(2 * .25rem);\n}\n\n[dir="rtl"] .fixed-tools_menu-item-icon_NsQ\\+d {\n margin-right: 0;\n margin-left: calc(2 * .25rem);\n}\n',"",{version:3,sources:["webpack://./src/css/colors.css","webpack://./src/css/units.css","webpack://./src/components/fixed-tools/fixed-tools.css"],names:[],mappings:"AAAA;;oDAEoD;;AASL,+CAA+C;;ACX9F;;oDAEoD;;AAEpD;;;;kFAIkF;;AAelF,0DAA0D;;ACpB1D;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,8BAAmB;IAAnB,6BAAmB;IAAnB,2BAAmB;QAAnB,uBAAmB;YAAnB,mBAAmB;IACnB,yBAAmB;IAAnB,2BAAmB;QAAnB,sBAAmB;YAAnB,mBAAmB;AACvB;;AAEA;IACI,WAAW;AACf;;AAEA;IACI,gCAAwC;IACxC,+BAAmC;AACvC;;AAEA;IACI,+BAAuC;IACvC,8BAAkC;AACtC;;AAEA;IACI,yBAAiB;OAAjB,sBAAiB;QAAjB,qBAAiB;YAAjB,iBAAiB;AACrB;;AAIA;IACI,qBAAqB;IACrB,yBAAiC;IACjC,gBAAgB;IAChB,eAAe;AACnB;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,gCAAuC;IACvC,mCAA0C;AAC9C;;AAEA;IACI,8BAAsC;IACtC,+BAAsC;IACtC,kCAAyC;AAC7C;;AAEA;IACI,+BAAsC;IACtC,kCAAyC;AAC7C;;AAEA;IACI,+BAAuC;IACvC,gCAAuC;IACvC,mCAA0C;AAC9C;;AAEA;IACI,8BAAsC;AAC1C;;AAEA;IACI,+BAAuC;AAC3C;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI,cAAc;IACd,eAAe;IACf,sBAAsB;AAC1B;;AAEA;IACI,6BAAqB;QAArB,yBAAqB;YAArB,qBAAqB;AACzB;;AAEA;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,4BAAsB;IAAtB,6BAAsB;IAAtB,8BAAsB;QAAtB,0BAAsB;YAAtB,sBAAsB;AAC1B;;AAEA;IACI,6BAAqC;AACzC;;AAEA;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,iBAAqB;IACrB,kBAAkB;IAClB,yBAA6B;IAC7B,mBAAmB;IACnB,eAAe;IACf,6BAAqB;IAArB,qBAAqB;IACrB,yBAAmB;IAAnB,2BAAmB;QAAnB,sBAAmB;YAAnB,mBAAmB;IACnB,oDAAoD;AACxD;;AAEA;IACI,YAAY;AAChB;;AAEA;IACI,qCAA8B;AAClC;;AAEA;IACI,6BAA6B;AACjC;;AAEA;IACI,8BAAkC;AACtC;;AAEA;IACI,eAAe;IACf,6BAAiC;AACrC",sourcesContent:["/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n$ui-pane-border: #D9D9D9;\n$ui-pane-gray: #F9F9F9;\n$ui-background-blue: #e8edf1;\n\n$text-primary: #575e75;\n\n$looks-secondary: #855CD6;\n$looks-transparent: hsla(260, 60%, 60%, 0.35); /* 35% transparent version of looks-secondary */\n\n$red-primary: #FF661A;\n$red-tertiary: #E64D00;\n\n$sound-primary: #CF63CF;\n$sound-tertiary: #A63FA6;\n\n$control-primary: #FFAB19;\n\n$data-primary: #FF8C1A;\n\n$form-border: #E9EEF2;\n","/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n$space: 0.5rem;\n$grid-unit: .25rem;\n\n$sprites-per-row: 5;\n\n$menu-bar-height: 3rem;\n$sprite-info-height: 6rem;\n$stage-menu-height: 2.75rem;\n\n$library-header-height: 4.375rem;\n\n$form-radius: calc($space / 2);\n\n/* layout contants from `layout-constants.js`, minus 1px */\n$full-size: 1095px;\n$full-size-paint: 1256px;\n",'@import "../../css/colors.css";\n@import "../../css/units.css";\n\n.row {\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n\n.costume-input {\n width: 8rem;\n}\n\n[dir="ltr"] .mod-dashed-border {\n border-right: 1px dashed $ui-pane-border;\n padding-right: calc(2 * $grid-unit);\n}\n\n[dir="rtl"] .mod-dashed-border {\n border-left: 1px dashed $ui-pane-border;\n padding-left: calc(2 * $grid-unit);\n}\n\n.mod-unselect {\n user-select: none;\n}\n\n$border-radius: 0.25rem;\n\n.button-group-button {\n display: inline-block;\n border: 1px solid $ui-pane-border;\n border-radius: 0;\n padding: .35rem;\n}\n\n[dir="ltr"] .button-group-button {\n border-left: none;\n}\n\n[dir="rtl"] .button-group-button {\n border-right: none;\n}\n\n[dir="ltr"] .button-group-button:last-of-type {\n border-top-right-radius: $border-radius;\n border-bottom-right-radius: $border-radius;\n}\n\n[dir="ltr"] .button-group-button:first-of-type {\n border-left: 1px solid $ui-pane-border;\n border-top-left-radius: $border-radius;\n border-bottom-left-radius: $border-radius;\n}\n\n[dir="rtl"] .button-group-button:last-of-type {\n border-top-left-radius: $border-radius;\n border-bottom-left-radius: $border-radius;\n}\n\n[dir="rtl"] .button-group-button:first-of-type {\n border-right: 1px solid $ui-pane-border;\n border-top-right-radius: $border-radius;\n border-bottom-right-radius: $border-radius;\n}\n\n[dir="ltr"] .button-group-button.mod-start-border {\n border-left: 1px solid $ui-pane-border;\n}\n\n[dir="rtl"] .button-group-button.mod-start-border {\n border-right: 1px solid $ui-pane-border;\n}\n\n[dir="ltr"] .button-group-button.mod-no-end-border {\n border-right: none;\n}\n\n[dir="rtl"] .button-group-button.mod-no-end-border {\n border-left: none;\n}\n\n.button-group-button-icon {\n width: 1.25rem;\n height: 1.25rem;\n vertical-align: middle;\n}\n\n[dir="rtl"] .button-group-button-icon {\n transform: scaleX(-1);\n}\n\n.mod-context-menu {\n display: flex;\n flex-direction: column;\n}\n\n.mod-top-divider {\n border-top: 1px solid $ui-pane-border;\n}\n\n.mod-menu-item {\n display: flex;\n margin: 0 -$grid-unit;\n min-width: 6.25rem;\n padding: calc(3 * $grid-unit);\n white-space: nowrap;\n cursor: pointer;\n transition: 0.1s ease;\n align-items: center;\n font-family: "Helvetica Neue", Helvetica, sans-serif;\n}\n\n.mod-disabled {\n cursor: auto;\n}\n\n.mod-menu-item:hover {\n background: $looks-transparent;\n}\n\n.mod-disabled:hover {\n background-color: transparent;\n}\n\n.menu-item-icon {\n margin-right: calc(2 * $grid-unit);\n}\n\n[dir="rtl"] .menu-item-icon {\n margin-right: 0;\n margin-left: calc(2 * $grid-unit);\n}\n'],sourceRoot:""}]),r.locals={row:"fixed-tools_row_4i+0p","costume-input":"fixed-tools_costume-input_p5l43",costumeInput:"fixed-tools_costume-input_p5l43","mod-dashed-border":"fixed-tools_mod-dashed-border_MnO5C",modDashedBorder:"fixed-tools_mod-dashed-border_MnO5C","mod-unselect":"fixed-tools_mod-unselect_wVcbW",modUnselect:"fixed-tools_mod-unselect_wVcbW","button-group-button":"fixed-tools_button-group-button_iXqpD",buttonGroupButton:"fixed-tools_button-group-button_iXqpD","mod-start-border":"fixed-tools_mod-start-border_yh3uC",modStartBorder:"fixed-tools_mod-start-border_yh3uC","mod-no-end-border":"fixed-tools_mod-no-end-border_o0JOq",modNoEndBorder:"fixed-tools_mod-no-end-border_o0JOq","button-group-button-icon":"fixed-tools_button-group-button-icon_Y6tZ2",buttonGroupButtonIcon:"fixed-tools_button-group-button-icon_Y6tZ2","mod-context-menu":"fixed-tools_mod-context-menu_auitG",modContextMenu:"fixed-tools_mod-context-menu_auitG","mod-top-divider":"fixed-tools_mod-top-divider_R1J5f",modTopDivider:"fixed-tools_mod-top-divider_R1J5f","mod-menu-item":"fixed-tools_mod-menu-item_me6aV",modMenuItem:"fixed-tools_mod-menu-item_me6aV","mod-disabled":"fixed-tools_mod-disabled_7U7bI",modDisabled:"fixed-tools_mod-disabled_7U7bI","menu-item-icon":"fixed-tools_menu-item-icon_NsQ+d",menuItemIcon:"fixed-tools_menu-item-icon_NsQ+d"},t.exports=r},241:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,'/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* 35% transparent version of looks-secondary */\n\n/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n/* layout contants from `layout-constants.js`, minus 1px */\n\n.font-dropdown_mod-menu-item_dJzxu {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n margin: 0 -.25rem;\n min-width: 6.25rem;\n padding: calc(2 * .25rem);\n padding-left: calc(3 * .25rem);\n padding-right: calc(3 * .25rem);\n white-space: nowrap;\n width: 8.5rem;\n cursor: pointer;\n -webkit-transition: 0.1s ease;\n transition: 0.1s ease;\n -webkit-box-align: center;\n -webkit-align-items: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.font-dropdown_mod-menu-item_dJzxu:hover {\n background: #855CD6;\n color: white;\n}\n\n.font-dropdown_mod-context-menu_HvLHz {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n\n.font-dropdown_mod-unselect_qEbDA {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.font-dropdown_displayed-font-name_KPlzz {\n font-size: .8rem;\n}\n\n.font-dropdown_font-dropdown_ZkGgL {\n -webkit-box-align: center;\n -webkit-align-items: center;\n -ms-flex-align: center;\n align-items: center;\n color: #575e75;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n font-size: 1rem;\n -webkit-box-pack: justify;\n -webkit-justify-content: space-between;\n -ms-flex-pack: justify;\n justify-content: space-between;\n width: 8.5rem;\n height: 2rem;\n}\n\n.font-dropdown_serif_CsAlO {\n font-family: \'Serif\';\n}\n\n.font-dropdown_sans-serif_Hz8vx {\n font-family: \'Sans Serif\';\n}\n\n.font-dropdown_serif_CsAlO {\n font-family: \'Serif\';\n}\n\n.font-dropdown_handwriting_MtiIG {\n font-family: \'Handwriting\';\n}\n\n.font-dropdown_marker_TQrGu {\n font-family: \'Marker\';\n}\n\n.font-dropdown_curly_2f8OQ {\n font-family: \'Curly\';\n}\n\n.font-dropdown_pixel_JGb4D {\n font-family: \'Pixel\';\n}\n\n.font-dropdown_chinese_9gFKG {\n font-family: "Microsoft YaHei", "微软雅黑", STXihei, "华文细黑";\n}\n\n.font-dropdown_japanese_mR7dT {\n font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka, "メイリオ", Meiryo, "MS Pゴシック", "MS PGothic";\n}\n\n.font-dropdown_korean_d2n4y {\n font-family: "Malgun Gothic";\n}\n',"",{version:3,sources:["webpack://./src/css/colors.css","webpack://./src/css/units.css","webpack://./src/components/font-dropdown/font-dropdown.css"],names:[],mappings:"AAAA;;oDAEoD;;AASL,+CAA+C;;ACX9F;;oDAEoD;;AAEpD;;;;kFAIkF;;AAelF,0DAA0D;;ACpB1D;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,iBAAqB;IACrB,kBAAkB;IAClB,yBAA6B;IAC7B,8BAAkC;IAClC,+BAAmC;IACnC,mBAAmB;IACnB,aAAa;IACb,eAAe;IACf,6BAAqB;IAArB,qBAAqB;IACrB,yBAAmB;IAAnB,2BAAmB;QAAnB,sBAAmB;YAAnB,mBAAmB;AACvB;;AAEA;IACI,mBAA4B;IAC5B,YAAY;AAChB;;AAEA;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,4BAAsB;IAAtB,6BAAsB;IAAtB,8BAAsB;QAAtB,0BAAsB;YAAtB,sBAAsB;AAC1B;;AAEA;IACI,yBAAiB;OAAjB,sBAAiB;QAAjB,qBAAiB;YAAjB,iBAAiB;AACrB;;AAEA;IACI,gBAAgB;AACpB;;AAEA;IACI,yBAAmB;IAAnB,2BAAmB;QAAnB,sBAAmB;YAAnB,mBAAmB;IACnB,cAAoB;IACpB,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,eAAe;IACf,yBAA8B;IAA9B,sCAA8B;QAA9B,sBAA8B;YAA9B,8BAA8B;IAC9B,aAAa;IACb,YAAY;AAChB;;AAEA;IACI,oBAAoB;AACxB;;AAEA;IACI,yBAAyB;AAC7B;;AAEA;IACI,oBAAoB;AACxB;;AAEA;IACI,0BAA0B;AAC9B;;AAEA;IACI,qBAAqB;AACzB;;AAEA;IACI,oBAAoB;AACxB;;AAEA;IACI,oBAAoB;AACxB;;AAEA;IACI,uDAAuD;AAC3D;;AAEA;IACI,yGAAyG;AAC7G;;AAEA;IACI,4BAA4B;AAChC",sourcesContent:["/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n$ui-pane-border: #D9D9D9;\n$ui-pane-gray: #F9F9F9;\n$ui-background-blue: #e8edf1;\n\n$text-primary: #575e75;\n\n$looks-secondary: #855CD6;\n$looks-transparent: hsla(260, 60%, 60%, 0.35); /* 35% transparent version of looks-secondary */\n\n$red-primary: #FF661A;\n$red-tertiary: #E64D00;\n\n$sound-primary: #CF63CF;\n$sound-tertiary: #A63FA6;\n\n$control-primary: #FFAB19;\n\n$data-primary: #FF8C1A;\n\n$form-border: #E9EEF2;\n","/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n$space: 0.5rem;\n$grid-unit: .25rem;\n\n$sprites-per-row: 5;\n\n$menu-bar-height: 3rem;\n$sprite-info-height: 6rem;\n$stage-menu-height: 2.75rem;\n\n$library-header-height: 4.375rem;\n\n$form-radius: calc($space / 2);\n\n/* layout contants from `layout-constants.js`, minus 1px */\n$full-size: 1095px;\n$full-size-paint: 1256px;\n",'@import "../../css/colors.css";\n@import "../../css/units.css";\n\n.mod-menu-item {\n display: flex;\n margin: 0 -$grid-unit;\n min-width: 6.25rem;\n padding: calc(2 * $grid-unit);\n padding-left: calc(3 * $grid-unit);\n padding-right: calc(3 * $grid-unit);\n white-space: nowrap;\n width: 8.5rem;\n cursor: pointer;\n transition: 0.1s ease;\n align-items: center;\n}\n\n.mod-menu-item:hover {\n background: $looks-secondary;\n color: white;\n}\n\n.mod-context-menu {\n display: flex;\n flex-direction: column;\n}\n\n.mod-unselect {\n user-select: none;\n}\n\n.displayed-font-name {\n font-size: .8rem;\n}\n\n.font-dropdown {\n align-items: center;\n color: $text-primary;\n display: flex;\n font-size: 1rem;\n justify-content: space-between;\n width: 8.5rem;\n height: 2rem;\n}\n\n.serif {\n font-family: \'Serif\';\n}\n\n.sans-serif {\n font-family: \'Sans Serif\';\n}\n\n.serif {\n font-family: \'Serif\';\n}\n\n.handwriting {\n font-family: \'Handwriting\';\n}\n\n.marker {\n font-family: \'Marker\';\n}\n\n.curly {\n font-family: \'Curly\';\n}\n\n.pixel {\n font-family: \'Pixel\';\n}\n\n.chinese {\n font-family: "Microsoft YaHei", "微软雅黑", STXihei, "华文细黑";\n}\n\n.japanese {\n font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka, "メイリオ", Meiryo, "MS Pゴシック", "MS PGothic";\n}\n\n.korean {\n font-family: "Malgun Gothic";\n}\n'],sourceRoot:""}]),r.locals={"mod-menu-item":"font-dropdown_mod-menu-item_dJzxu",modMenuItem:"font-dropdown_mod-menu-item_dJzxu","mod-context-menu":"font-dropdown_mod-context-menu_HvLHz",modContextMenu:"font-dropdown_mod-context-menu_HvLHz","mod-unselect":"font-dropdown_mod-unselect_qEbDA",modUnselect:"font-dropdown_mod-unselect_qEbDA","displayed-font-name":"font-dropdown_displayed-font-name_KPlzz",displayedFontName:"font-dropdown_displayed-font-name_KPlzz","font-dropdown":"font-dropdown_font-dropdown_ZkGgL",fontDropdown:"font-dropdown_font-dropdown_ZkGgL",serif:"font-dropdown_serif_CsAlO","sans-serif":"font-dropdown_sans-serif_Hz8vx",sansSerif:"font-dropdown_sans-serif_Hz8vx",handwriting:"font-dropdown_handwriting_MtiIG",marker:"font-dropdown_marker_TQrGu",curly:"font-dropdown_curly_2f8OQ",pixel:"font-dropdown_pixel_JGb4D",chinese:"font-dropdown_chinese_9gFKG",japanese:"font-dropdown_japanese_mR7dT",korean:"font-dropdown_korean_d2n4y"},t.exports=r},460:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,'/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* NOTE:\nEdited to add input-range-small\n*/\n\n/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n/* layout contants from `layout-constants.js`, minus 1px */\n\n/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* 35% transparent version of looks-secondary */\n\n.input_input-form_rYjUv {\n height: 2rem;\n padding: 0 0.75rem;\n\n font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;\n font-size: 0.75rem;\n font-weight: bold;\n color: #575e75;\n\n border-width: 1px;\n border-style: solid;\n border-color: #E9EEF2;\n border-radius: 2rem;\n\n outline: none;\n cursor: text;\n -webkit-transition: 0.25s ease-out;\n transition: 0.25s ease-out; /* @todo: standardize with var */\n -webkit-box-shadow: none;\n box-shadow: none;\n\n /*\n For truncating overflowing text gracefully\n Min-width is for a bug: https://css-tricks.com/flexbox-truncated-text\n @todo: move this out into a mixin or a helper component\n */\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n}\n\n.input_input-form_rYjUv:focus {\n border-color: #855CD6;\n -webkit-box-shadow: 0 0 0 .25rem hsla(260, 60%, 60%, 0.35);\n box-shadow: 0 0 0 .25rem hsla(260, 60%, 60%, 0.35);\n}\n\n.input_input-small_XO8vY {\n width: 3rem;\n text-align: center;\n}\n\n.input_input-small-range_BbZnL {\n width: 4rem;\n text-align: center;\n}\n',"",{version:3,sources:["webpack://./src/components/forms/input.css","webpack://./src/css/units.css","webpack://./src/css/colors.css"],names:[],mappings:"AAAA;;oDAEoD;;AAEpD;;CAEC;;ACND;;oDAEoD;;AAEpD;;;;kFAIkF;;AAelF,0DAA0D;;ACvB1D;;oDAEoD;;AASL,+CAA+C;;AFA9F;IACI,YAAY;IACZ,kBAAkB;;IAElB,2DAA2D;IAC3D,kBAAkB;IAClB,iBAAiB;IACjB,cAAoB;;IAEpB,iBAAiB;IACjB,mBAAmB;IACnB,qBAA0B;IAC1B,mBAAmB;;IAEnB,aAAa;IACb,YAAY;IACZ,kCAA0B;IAA1B,0BAA0B,EAAE,gCAAgC;IAC5D,wBAAgB;YAAhB,gBAAgB;;IAEhB;;;;KAIC;IACD,gBAAgB;IAChB,uBAAuB;IACvB,mBAAmB;IACnB,YAAY;AAChB;;AAEA;IACI,qBAA8B;IAC9B,0DAA+C;YAA/C,kDAA+C;AACnD;;AAEA;IACI,WAAW;IACX,kBAAkB;AACtB;;AAEA;IACI,WAAW;IACX,kBAAkB;AACtB",sourcesContent:['/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* NOTE:\nEdited to add input-range-small\n*/\n\n@import "../../css/units.css";\n@import "../../css/colors.css";\n\n.input-form {\n height: 2rem;\n padding: 0 0.75rem;\n\n font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;\n font-size: 0.75rem;\n font-weight: bold;\n color: $text-primary;\n\n border-width: 1px;\n border-style: solid;\n border-color: $form-border;\n border-radius: 2rem;\n\n outline: none;\n cursor: text;\n transition: 0.25s ease-out; /* @todo: standardize with var */\n box-shadow: none;\n\n /*\n For truncating overflowing text gracefully\n Min-width is for a bug: https://css-tricks.com/flexbox-truncated-text\n @todo: move this out into a mixin or a helper component\n */\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n}\n\n.input-form:focus {\n border-color: $looks-secondary;\n box-shadow: 0 0 0 $grid-unit $looks-transparent;\n}\n\n.input-small {\n width: 3rem;\n text-align: center;\n}\n\n.input-small-range {\n width: 4rem;\n text-align: center;\n}\n',"/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n$space: 0.5rem;\n$grid-unit: .25rem;\n\n$sprites-per-row: 5;\n\n$menu-bar-height: 3rem;\n$sprite-info-height: 6rem;\n$stage-menu-height: 2.75rem;\n\n$library-header-height: 4.375rem;\n\n$form-radius: calc($space / 2);\n\n/* layout contants from `layout-constants.js`, minus 1px */\n$full-size: 1095px;\n$full-size-paint: 1256px;\n","/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n$ui-pane-border: #D9D9D9;\n$ui-pane-gray: #F9F9F9;\n$ui-background-blue: #e8edf1;\n\n$text-primary: #575e75;\n\n$looks-secondary: #855CD6;\n$looks-transparent: hsla(260, 60%, 60%, 0.35); /* 35% transparent version of looks-secondary */\n\n$red-primary: #FF661A;\n$red-tertiary: #E64D00;\n\n$sound-primary: #CF63CF;\n$sound-tertiary: #A63FA6;\n\n$control-primary: #FFAB19;\n\n$data-primary: #FF8C1A;\n\n$form-border: #E9EEF2;\n"],sourceRoot:""}]),r.locals={"input-form":"input_input-form_rYjUv",inputForm:"input_input-form_rYjUv","input-small":"input_input-small_XO8vY",inputSmall:"input_input-small_XO8vY","input-small-range":"input_input-small-range_BbZnL",inputSmallRange:"input_input-small-range_BbZnL"},t.exports=r},394:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,'/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n/* layout contants from `layout-constants.js`, minus 1px */\n\n/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* 35% transparent version of looks-secondary */\n\n.label_input-group_RurlE {\n display: -webkit-inline-box;\n display: -webkit-inline-flex;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n -ms-flex-direction: row;\n flex-direction: row;\n -webkit-box-align: center;\n -webkit-align-items: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n[dir="ltr"] .label_input-group_RurlE + .label_input-group_RurlE {\n margin-left: calc(2 * .25rem);\n}\n\n[dir="rtl"] .label_input-group_RurlE + .label_input-group_RurlE {\n margin-right: calc(2 * .25rem);\n}\n\n.label_disabled_SBKdo {\n opacity: 0.3;\n /* Prevent any user actions */\n pointer-events: none;\n}\n\n.label_input-label_P0e01, .label_input-label-secondary_Db6Q8 {\n font-size: 0.625rem;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n cursor: default;\n}\n\n[dir="ltr"] .label_input-label_P0e01, [dir="ltr"] .label_input-label-secondary_Db6Q8{\n margin-right: calc(2 * .25rem);\n}\n\n[dir="rtl"] .label_input-label_P0e01, [dir="ltr"] .label_input-label-secondary_Db6Q8{\n margin-left: calc(2 * .25rem);\n}\n\n.label_input-label_P0e01 {\n font-weight: bold;\n}\n\n@media only screen and (max-width: 1256px) {\n .label_input-group_RurlE {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n -webkit-box-align: start;\n -webkit-align-items: flex-start;\n -ms-flex-align: start;\n align-items: flex-start;\n margin-top: -1rem; /* To align with the non-labeled inputs */\n }\n\n .label_input-label_P0e01 {\n font-weight: normal;\n margin-bottom: 0.25rem;\n }\n}\n',"",{version:3,sources:["webpack://./src/components/forms/label.css","webpack://./src/css/units.css","webpack://./src/css/colors.css","webpack://./src/components/input-group/input-group.css"],names:[],mappings:"AAAA;;oDAEoD;;ACFpD;;oDAEoD;;AAEpD;;;;kFAIkF;;AAelF,0DAA0D;;ACvB1D;;oDAEoD;;AASL,+CAA+C;;ACT9F;IACI,2BAAoB;IAApB,4BAAoB;IAApB,2BAAoB;IAApB,oBAAoB;IACpB,8BAAmB;IAAnB,6BAAmB;IAAnB,2BAAmB;QAAnB,uBAAmB;YAAnB,mBAAmB;IACnB,yBAAmB;IAAnB,2BAAmB;QAAnB,sBAAmB;YAAnB,mBAAmB;AACvB;;AAEA;IACI,6BAAiC;AACrC;;AAEA;IACI,8BAAkC;AACtC;;AAEA;IACI,YAAY;IACZ,6BAA6B;IAC7B,oBAAoB;AACxB;;AHZA;IACI,mBAAmB;IACnB,yBAAiB;OAAjB,sBAAiB;QAAjB,qBAAiB;YAAjB,iBAAiB;IACjB,eAAe;AACnB;;AAEA;IACI,8BAAkC;AACtC;;AAEA;IACI,6BAAiC;AACrC;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI;QACI,oBAAa;QAAb,qBAAa;QAAb,oBAAa;QAAb,aAAa;QACb,4BAAsB;QAAtB,6BAAsB;QAAtB,8BAAsB;YAAtB,0BAAsB;gBAAtB,sBAAsB;QACtB,wBAAuB;QAAvB,+BAAuB;YAAvB,qBAAuB;gBAAvB,uBAAuB;QACvB,iBAAiB,EAAE,yCAAyC;IAChE;;IAEA;QACI,mBAAmB;QACnB,sBAAsB;IAC1B;AACJ",sourcesContent:['/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n@import "../../css/units.css";\n@import "../../css/colors.css";\n@import "../input-group/input-group.css";\n\n.input-label, .input-label-secondary {\n font-size: 0.625rem;\n user-select: none;\n cursor: default;\n}\n\n[dir="ltr"] .input-label, [dir="ltr"] .input-label-secondary{\n margin-right: calc(2 * $grid-unit);\n}\n\n[dir="rtl"] .input-label, [dir="ltr"] .input-label-secondary{\n margin-left: calc(2 * $grid-unit);\n}\n\n.input-label {\n font-weight: bold;\n}\n\n@media only screen and (max-width: $full-size-paint) {\n .input-group {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n margin-top: -1rem; /* To align with the non-labeled inputs */\n }\n\n .input-label {\n font-weight: normal;\n margin-bottom: 0.25rem;\n }\n}\n',"/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n$space: 0.5rem;\n$grid-unit: .25rem;\n\n$sprites-per-row: 5;\n\n$menu-bar-height: 3rem;\n$sprite-info-height: 6rem;\n$stage-menu-height: 2.75rem;\n\n$library-header-height: 4.375rem;\n\n$form-radius: calc($space / 2);\n\n/* layout contants from `layout-constants.js`, minus 1px */\n$full-size: 1095px;\n$full-size-paint: 1256px;\n","/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n$ui-pane-border: #D9D9D9;\n$ui-pane-gray: #F9F9F9;\n$ui-background-blue: #e8edf1;\n\n$text-primary: #575e75;\n\n$looks-secondary: #855CD6;\n$looks-transparent: hsla(260, 60%, 60%, 0.35); /* 35% transparent version of looks-secondary */\n\n$red-primary: #FF661A;\n$red-tertiary: #E64D00;\n\n$sound-primary: #CF63CF;\n$sound-tertiary: #A63FA6;\n\n$control-primary: #FFAB19;\n\n$data-primary: #FF8C1A;\n\n$form-border: #E9EEF2;\n",'@import \'../../css/units.css\';\n\n.input-group {\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n}\n\n[dir="ltr"] .input-group + .input-group {\n margin-left: calc(2 * $grid-unit);\n}\n\n[dir="rtl"] .input-group + .input-group {\n margin-right: calc(2 * $grid-unit);\n}\n\n.disabled {\n opacity: 0.3;\n /* Prevent any user actions */\n pointer-events: none;\n}\n'],sourceRoot:""}]),r.locals={"input-group":"label_input-group_RurlE",inputGroup:"label_input-group_RurlE",disabled:"label_disabled_SBKdo","input-label":"label_input-label_P0e01",inputLabel:"label_input-label_P0e01","input-label-secondary":"label_input-label-secondary_Db6Q8",inputLabelSecondary:"label_input-label-secondary_Db6Q8"},t.exports=r},397:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,".slider_container_FGZoi {\n margin: 8px;\n height: 22px;\n width: 150px;\n position: relative;\n outline: none;\n border-radius: 11px;\n margin-bottom: 20px;\n}\n\n.slider_last_CQwuY {\n margin-bottom: 4px;\n}\n\n.slider_handle_s5s-- {\n left: 100px;\n width: 26px;\n height: 26px;\n margin-top: -2px;\n position: absolute;\n background-color: white;\n border-radius: 100%;\n -webkit-box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.15);\n box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.15);\n -ms-touch-action: none;\n touch-action: none;\n}\n","",{version:3,sources:["webpack://./src/components/forms/slider.css"],names:[],mappings:"AAAA;IACI,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,kBAAkB;IAClB,aAAa;IACb,mBAAmB;IACnB,mBAAmB;AACvB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,WAAW;IACX,WAAW;IACX,YAAY;IACZ,gBAAgB;IAChB,kBAAkB;IAClB,uBAAuB;IACvB,mBAAmB;IACnB,iDAAyC;YAAzC,yCAAyC;IACzC,sBAAkB;QAAlB,kBAAkB;AACtB",sourcesContent:[".container {\n margin: 8px;\n height: 22px;\n width: 150px;\n position: relative;\n outline: none;\n border-radius: 11px;\n margin-bottom: 20px;\n}\n\n.last {\n margin-bottom: 4px;\n}\n\n.handle {\n left: 100px;\n width: 26px;\n height: 26px;\n margin-top: -2px;\n position: absolute;\n background-color: white;\n border-radius: 100%;\n box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.15);\n touch-action: none;\n}\n"],sourceRoot:""}]),r.locals={container:"slider_container_FGZoi",last:"slider_last_CQwuY",handle:"slider_handle_s5s--"},t.exports=r},621:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,'/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n/* layout contants from `layout-constants.js`, minus 1px */\n\n.input-group_input-group_WCF5L {\n display: -webkit-inline-box;\n display: -webkit-inline-flex;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n -ms-flex-direction: row;\n flex-direction: row;\n -webkit-box-align: center;\n -webkit-align-items: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n[dir="ltr"] .input-group_input-group_WCF5L + .input-group_input-group_WCF5L {\n margin-left: calc(2 * .25rem);\n}\n\n[dir="rtl"] .input-group_input-group_WCF5L + .input-group_input-group_WCF5L {\n margin-right: calc(2 * .25rem);\n}\n\n.input-group_disabled_lZ9Wt {\n opacity: 0.3;\n /* Prevent any user actions */\n pointer-events: none;\n}\n',"",{version:3,sources:["webpack://./src/css/units.css","webpack://./src/components/input-group/input-group.css"],names:[],mappings:"AAAA;;oDAEoD;;AAEpD;;;;kFAIkF;;AAelF,0DAA0D;;ACrB1D;IACI,2BAAoB;IAApB,4BAAoB;IAApB,2BAAoB;IAApB,oBAAoB;IACpB,8BAAmB;IAAnB,6BAAmB;IAAnB,2BAAmB;QAAnB,uBAAmB;YAAnB,mBAAmB;IACnB,yBAAmB;IAAnB,2BAAmB;QAAnB,sBAAmB;YAAnB,mBAAmB;AACvB;;AAEA;IACI,6BAAiC;AACrC;;AAEA;IACI,8BAAkC;AACtC;;AAEA;IACI,YAAY;IACZ,6BAA6B;IAC7B,oBAAoB;AACxB",sourcesContent:["/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n$space: 0.5rem;\n$grid-unit: .25rem;\n\n$sprites-per-row: 5;\n\n$menu-bar-height: 3rem;\n$sprite-info-height: 6rem;\n$stage-menu-height: 2.75rem;\n\n$library-header-height: 4.375rem;\n\n$form-radius: calc($space / 2);\n\n/* layout contants from `layout-constants.js`, minus 1px */\n$full-size: 1095px;\n$full-size-paint: 1256px;\n",'@import \'../../css/units.css\';\n\n.input-group {\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n}\n\n[dir="ltr"] .input-group + .input-group {\n margin-left: calc(2 * $grid-unit);\n}\n\n[dir="rtl"] .input-group + .input-group {\n margin-right: calc(2 * $grid-unit);\n}\n\n.disabled {\n opacity: 0.3;\n /* Prevent any user actions */\n pointer-events: none;\n}\n'],sourceRoot:""}]),r.locals={"input-group":"input-group_input-group_WCF5L",inputGroup:"input-group_input-group_WCF5L",disabled:"input-group_disabled_lZ9Wt"},t.exports=r},778:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,"/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n/* layout contants from `layout-constants.js`, minus 1px */\n\n.labeled-icon-button_mod-edit-field_-KCzg {\n background: none;\n border: none;\n display: inline-block;\n padding: .25rem .325rem;\n outline: none;\n border-radius: 0.25rem;\n min-width: 3rem;\n font-size: 0.85rem;\n text-align: center;\n}\n\n.labeled-icon-button_edit-field-icon_aGeBz {\n width: 1.5rem;\n height: 1.5rem;\n -webkit-box-flex: 1;\n -webkit-flex-grow: 1;\n -ms-flex-positive: 1;\n flex-grow: 1;\n vertical-align: middle;\n}\n\n.labeled-icon-button_edit-field-title_\\+LjHl {\n display: block;\n margin-top: .125rem;\n font-size: .625rem;\n}\n","",{version:3,sources:["webpack://./src/css/units.css","webpack://./src/components/labeled-icon-button/labeled-icon-button.css"],names:[],mappings:"AAAA;;oDAEoD;;AAEpD;;;;kFAIkF;;AAelF,0DAA0D;;ACnB1D;IACI,gBAAgB;IAChB,YAAY;IACZ,qBAAqB;IACrB,uBAAuB;IACvB,aAAa;IACb,sBAA6B;IAC7B,eAAe;IACf,kBAAkB;IAClB,kBAAkB;AACtB;;AAEA;IACI,aAAa;IACb,cAAc;IACd,mBAAY;IAAZ,oBAAY;QAAZ,oBAAY;YAAZ,YAAY;IACZ,sBAAsB;AAC1B;;AAEA;IACI,cAAc;IACd,mBAAmB;IACnB,kBAAkB;AACtB",sourcesContent:["/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n$space: 0.5rem;\n$grid-unit: .25rem;\n\n$sprites-per-row: 5;\n\n$menu-bar-height: 3rem;\n$sprite-info-height: 6rem;\n$stage-menu-height: 2.75rem;\n\n$library-header-height: 4.375rem;\n\n$form-radius: calc($space / 2);\n\n/* layout contants from `layout-constants.js`, minus 1px */\n$full-size: 1095px;\n$full-size-paint: 1256px;\n",'@import "../../css/units.css";\n\n$border-radius: 0.25rem;\n\n.mod-edit-field {\n background: none;\n border: none;\n display: inline-block;\n padding: .25rem .325rem;\n outline: none;\n border-radius: $border-radius;\n min-width: 3rem;\n font-size: 0.85rem;\n text-align: center;\n}\n\n.edit-field-icon {\n width: 1.5rem;\n height: 1.5rem;\n flex-grow: 1;\n vertical-align: middle;\n}\n\n.edit-field-title {\n display: block;\n margin-top: .125rem;\n font-size: .625rem;\n}\n'],sourceRoot:""}]),r.locals={"mod-edit-field":"labeled-icon-button_mod-edit-field_-KCzg",modEditField:"labeled-icon-button_mod-edit-field_-KCzg","edit-field-icon":"labeled-icon-button_edit-field-icon_aGeBz",editFieldIcon:"labeled-icon-button_edit-field-icon_aGeBz","edit-field-title":"labeled-icon-button_edit-field-title_+LjHl",editFieldTitle:"labeled-icon-button_edit-field-title_+LjHl"},t.exports=r},745:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,".loupe_eye-dropper_qsEfW {\n position: absolute;\n border-radius: 100%;\n border: 1px solid #222;\n}\n","",{version:3,sources:["webpack://./src/components/loupe/loupe.css"],names:[],mappings:"AAAA;IACI,kBAAkB;IAClB,mBAAmB;IACnB,sBAAsB;AAC1B",sourcesContent:[".eye-dropper {\n position: absolute;\n border-radius: 100%;\n border: 1px solid #222;\n}\n"],sourceRoot:""}]),r.locals={"eye-dropper":"loupe_eye-dropper_qsEfW",eyeDropper:"loupe_eye-dropper_qsEfW"},t.exports=r},761:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,'/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* 35% transparent version of looks-secondary */\n\n/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n/* layout contants from `layout-constants.js`, minus 1px */\n\n.mode-tools_mode-tools_JouAA {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n min-height: 3rem;\n -webkit-box-align: center;\n -webkit-align-items: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.mode-tools_mode-tools-icon_wBvX0 {\n margin-right: calc(2 * .25rem);\n width: 2rem;\n height: 2rem;\n}\n\n[dir="ltr"] .mode-tools_mod-dashed-border_fOwhN {\n border-right: 1px dashed #D9D9D9;\n padding-right: calc(3 * .25rem);\n}\n\n[dir="rtl"] .mode-tools_mod-dashed-border_fOwhN {\n border-left: 1px dashed #D9D9D9;\n padding-left: calc(3 * .25rem);\n}\n\n.mode-tools_mod-labeled-icon-height_KjSSG {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n height: 2.85rem; /* for the second row so the dashed borders are equal in size */\n -webkit-box-align: center;\n -webkit-align-items: center;\n -ms-flex-align: center;\n align-items: center;\n}\n',"",{version:3,sources:["webpack://./src/css/colors.css","webpack://./src/css/units.css","webpack://./src/components/mode-tools/mode-tools.css"],names:[],mappings:"AAAA;;oDAEoD;;AASL,+CAA+C;;ACX9F;;oDAEoD;;AAEpD;;;;kFAIkF;;AAelF,0DAA0D;;ACpB1D;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,gBAAgB;IAChB,yBAAmB;IAAnB,2BAAmB;QAAnB,sBAAmB;YAAnB,mBAAmB;AACvB;;AAEA;IACI,8BAAkC;IAClC,WAAW;IACX,YAAY;AAChB;;AAEA;IACI,gCAAwC;IACxC,+BAAmC;AACvC;;AAEA;IACI,+BAAuC;IACvC,8BAAkC;AACtC;;AAEA;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,eAAe,EAAE,+DAA+D;IAChF,yBAAmB;IAAnB,2BAAmB;QAAnB,sBAAmB;YAAnB,mBAAmB;AACvB",sourcesContent:["/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n$ui-pane-border: #D9D9D9;\n$ui-pane-gray: #F9F9F9;\n$ui-background-blue: #e8edf1;\n\n$text-primary: #575e75;\n\n$looks-secondary: #855CD6;\n$looks-transparent: hsla(260, 60%, 60%, 0.35); /* 35% transparent version of looks-secondary */\n\n$red-primary: #FF661A;\n$red-tertiary: #E64D00;\n\n$sound-primary: #CF63CF;\n$sound-tertiary: #A63FA6;\n\n$control-primary: #FFAB19;\n\n$data-primary: #FF8C1A;\n\n$form-border: #E9EEF2;\n","/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n$space: 0.5rem;\n$grid-unit: .25rem;\n\n$sprites-per-row: 5;\n\n$menu-bar-height: 3rem;\n$sprite-info-height: 6rem;\n$stage-menu-height: 2.75rem;\n\n$library-header-height: 4.375rem;\n\n$form-radius: calc($space / 2);\n\n/* layout contants from `layout-constants.js`, minus 1px */\n$full-size: 1095px;\n$full-size-paint: 1256px;\n",'@import "../../css/colors.css";\n@import "../../css/units.css";\n\n.mode-tools {\n display: flex;\n min-height: 3rem;\n align-items: center;\n}\n\n.mode-tools-icon {\n margin-right: calc(2 * $grid-unit);\n width: 2rem;\n height: 2rem;\n}\n\n[dir="ltr"] .mod-dashed-border {\n border-right: 1px dashed $ui-pane-border;\n padding-right: calc(3 * $grid-unit);\n}\n\n[dir="rtl"] .mod-dashed-border {\n border-left: 1px dashed $ui-pane-border;\n padding-left: calc(3 * $grid-unit);\n}\n\n.mod-labeled-icon-height {\n display: flex;\n height: 2.85rem; /* for the second row so the dashed borders are equal in size */\n align-items: center;\n}\n'],sourceRoot:""}]),r.locals={"mode-tools":"mode-tools_mode-tools_JouAA",modeTools:"mode-tools_mode-tools_JouAA","mode-tools-icon":"mode-tools_mode-tools-icon_wBvX0",modeToolsIcon:"mode-tools_mode-tools-icon_wBvX0","mod-dashed-border":"mode-tools_mod-dashed-border_fOwhN",modDashedBorder:"mode-tools_mod-dashed-border_fOwhN","mod-labeled-icon-height":"mode-tools_mod-labeled-icon-height_KjSSG",modLabeledIconHeight:"mode-tools_mod-labeled-icon-height_KjSSG"},t.exports=r},31:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,'/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* 35% transparent version of looks-secondary */\n\n/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n/* layout contants from `layout-constants.js`, minus 1px */\n\n.paint-editor_editor-container_XJI6D {\n width: 100%;\n height: 100%;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n padding: calc(3 * .25rem);\n}\n\n.paint-editor_row_qNJro {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n -ms-flex-direction: row;\n flex-direction: row;\n -webkit-box-align: center;\n -webkit-align-items: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.paint-editor_editor-container-top_MzEH8 {\n border-bottom: 1px dashed #D9D9D9;\n padding-bottom: calc(2 * .25rem);\n}\n\n.paint-editor_top-align-row_CG9zZ {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n -ms-flex-direction: row;\n flex-direction: row;\n height: 100%;\n padding-top: calc(5 * .25rem);\n min-width: 524px;\n}\n\n.paint-editor_row_qNJro + .paint-editor_row_qNJro {\n margin-top: calc(2 * .25rem);\n}\n\n[dir="ltr"] .paint-editor_mod-dashed-border_d3Y-E {\n border-right: 1px dashed #D9D9D9;\n padding-right: calc(2 * .25rem);\n}\n\n[dir="rtl"] .paint-editor_mod-dashed-border_d3Y-E {\n border-left: 1px dashed #D9D9D9;\n padding-left: calc(2 * .25rem);\n}\n\n.paint-editor_mod-labeled-icon-height_4VotQ {\n height: 2.85rem; /* for the second row so the dashed borders are equal in size */\n}\n\n.paint-editor_button-group-button_71r\\+V {\n display: inline-block;\n border: 1px solid #D9D9D9;\n border-radius: 0;\n padding: .35rem;\n}\n\n[dir="ltr"] .paint-editor_button-group-button_71r\\+V {\n border-left: none;\n}\n\n[dir="rtl"] .paint-editor_button-group-button_71r\\+V {\n border-right: none;\n}\n\n[dir="ltr"] .paint-editor_button-group-button_71r\\+V:last-of-type {\n border-top-right-radius: 0.25rem;\n border-bottom-right-radius: 0.25rem;\n}\n\n[dir="ltr"] .paint-editor_button-group-button_71r\\+V:first-of-type {\n border-left: 1px solid #D9D9D9;\n border-top-left-radius: 0.25rem;\n border-bottom-left-radius: 0.25rem;\n}\n\n[dir="rtl"] .paint-editor_button-group-button_71r\\+V:last-of-type {\n border-top-left-radius: 0.25rem;\n border-bottom-left-radius: 0.25rem;\n}\n\n[dir="rtl"] .paint-editor_button-group-button_71r\\+V:first-of-type {\n border-right: 1px solid #D9D9D9;\n border-top-right-radius: 0.25rem;\n border-bottom-right-radius: 0.25rem;\n}\n\n[dir="ltr"] .paint-editor_button-group-button_71r\\+V.paint-editor_mod-start-border_brl5l {\n border-left: 1px solid #D9D9D9;\n}\n\n[dir="rtl"] .paint-editor_button-group-button_71r\\+V.paint-editor_mod-start-border_brl5l {\n border-right: 1px solid #D9D9D9;\n}\n\n[dir="ltr"].paint-editor_button-group-button_71r\\+V.paint-editor_mod-no-end-border_\\+9EBd {\n border-right: none;\n}\n\n[dir="rtl"].paint-editor_button-group-button_71r\\+V.paint-editor_mod-no-end-border_\\+9EBd {\n border-left: none;\n}\n\n.paint-editor_button-group-button-icon_GOExF {\n width: 1.25rem;\n height: 1.25rem;\n vertical-align: middle;\n}\n\n.paint-editor_mod-mode-tools_kG-2T {\n margin-left: calc(2 * .25rem);\n}\n\n[dir="ltr"] .paint-editor_mod-margin-after_lArV7 {\n margin-right: calc(2 * .25rem);\n}\n\n[dir="rtl"] .paint-editor_mod-margin-after_lArV7 {\n margin-left: calc(2 * .25rem);\n}\n\n.paint-editor_controls-container_WlBVy {\n width: 100%;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -webkit-flex-flow: column;\n -ms-flex-flow: column;\n flex-flow: column;\n -webkit-box-flex: 1;\n -webkit-flex-grow: 1;\n -ms-flex-positive: 1;\n flex-grow: 1;\n margin-left: calc(2 * .25rem);\n margin-right: calc(2 * .25rem);\n}\n\n.paint-editor_canvas-container_Qe1w8 {\n width: 100%;\n -webkit-box-flex: 1;\n -webkit-flex-grow: 1;\n -ms-flex-positive: 1;\n flex-grow: 1;\n min-width: 402px; /* Leave room for the border */\n -webkit-box-sizing: content-box;\n box-sizing: content-box;\n border: 1px solid #e8edf1;\n border-radius: .25rem;\n position: relative;\n overflow: visible;\n}\n\n.paint-editor_mode-selector_ALomU {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n max-width: 7.5rem;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n -ms-flex-direction: row;\n flex-direction: row;\n -webkit-flex-wrap: wrap;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n -webkit-box-align: start;\n -webkit-align-items: flex-start;\n -ms-flex-align: start;\n align-items: flex-start;\n -webkit-align-content: flex-start;\n -ms-flex-line-pack: start;\n align-content: flex-start;\n -webkit-box-pack: justify;\n -webkit-justify-content: space-between;\n -ms-flex-pack: justify;\n justify-content: space-between;\n}\n\n.paint-editor_zoom-controls_QQz-j {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: reverse;\n -webkit-flex-direction: row-reverse;\n -ms-flex-direction: row-reverse;\n flex-direction: row-reverse;\n}\n\n.paint-editor_color-picker-wrapper_KtBg6 {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\n.paint-editor_canvas-controls_yjCGl {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n height: 36px;\n margin-top: .25rem;\n -webkit-box-pack: justify;\n -webkit-justify-content: space-between;\n -ms-flex-pack: justify;\n justify-content: space-between;\n}\n\n.paint-editor_bitmap-button_2te68 {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n border-radius: 5px;\n background-color: #855CD6;\n padding: calc(2 * .25rem);\n line-height: 1.5rem;\n font-size: calc(3 * .25rem);\n font-weight: bold;\n color: white;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n[dir="ltr"] .paint-editor_bitmap-button-icon_uLSWl {\n margin-right: calc(2 * .25rem);\n}\n\n[dir="rtl"] .paint-editor_bitmap-button-icon_uLSWl {\n margin-left: calc(2 * .25rem);\n}\n\n@media only screen and (max-width: 1256px) {\n .paint-editor_editor-container_XJI6D {\n padding: calc(3 * .25rem) .25rem;\n }\n\n .paint-editor_mode-selector_ALomU {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n -webkit-box-pack: start;\n -webkit-justify-content: flex-start;\n -ms-flex-pack: start;\n justify-content: flex-start;\n }\n\n .paint-editor_controls-container_WlBVy {\n margin-right: .25rem;\n margin-left: .25rem;\n }\n}\n\n.paint-editor_text-area_U17Si {\n background: transparent;\n border: none;\n display: none;\n margin: 0px;\n opacity: .8;\n outline: none;\n overflow: hidden;\n padding: 0px;\n position: absolute;\n resize: none;\n -webkit-text-fill-color: transparent;\n text-fill-color: transparent;\n}\n\n.paint-editor_button-text_D-z\\+w {\n width: 100%; /* Fixes button text wrapping in Edge */\n}\n',"",{version:3,sources:["webpack://./src/css/colors.css","webpack://./src/css/units.css","webpack://./src/components/paint-editor/paint-editor.css"],names:[],mappings:"AAAA;;oDAEoD;;AASL,+CAA+C;;ACX9F;;oDAEoD;;AAEpD;;;;kFAIkF;;AAelF,0DAA0D;;ACpB1D;IACI,WAAW;IACX,YAAY;IACZ,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,4BAAsB;IAAtB,6BAAsB;IAAtB,8BAAsB;QAAtB,0BAAsB;YAAtB,sBAAsB;IACtB,yBAA6B;AACjC;;AAEA;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,8BAAmB;IAAnB,6BAAmB;IAAnB,2BAAmB;QAAnB,uBAAmB;YAAnB,mBAAmB;IACnB,yBAAmB;IAAnB,2BAAmB;QAAnB,sBAAmB;YAAnB,mBAAmB;AACvB;;AAEA;IACI,iCAAyC;IACzC,gCAAoC;AACxC;;AAEA;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,8BAAmB;IAAnB,6BAAmB;IAAnB,2BAAmB;QAAnB,uBAAmB;YAAnB,mBAAmB;IACnB,YAAY;IACZ,6BAAiC;IACjC,gBAAgB;AACpB;;AAEA;IACI,4BAAgC;AACpC;;AAEA;IACI,gCAAwC;IACxC,+BAAmC;AACvC;;AAEA;IACI,+BAAuC;IACvC,8BAAkC;AACtC;;AACA;IACI,eAAe,EAAE,+DAA+D;AACpF;;AAIA;IACI,qBAAqB;IACrB,yBAAiC;IACjC,gBAAgB;IAChB,eAAe;AACnB;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,gCAAuC;IACvC,mCAA0C;AAC9C;;AAEA;IACI,8BAAsC;IACtC,+BAAsC;IACtC,kCAAyC;AAC7C;;AAEA;IACI,+BAAsC;IACtC,kCAAyC;AAC7C;;AAEA;IACI,+BAAuC;IACvC,gCAAuC;IACvC,mCAA0C;AAC9C;;AAEA;IACI,8BAAsC;AAC1C;;AAEA;IACI,+BAAuC;AAC3C;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,iBAAiB;AACrB;;AAEA;IACI,cAAc;IACd,eAAe;IACf,sBAAsB;AAC1B;;AAEA;IACI,6BAAiC;AACrC;;AAEA;IACI,8BAAkC;AACtC;;AAEA;IACI,6BAAiC;AACrC;;AAEA;IACI,WAAW;IACX,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,4BAAiB;IAAjB,6BAAiB;IAAjB,yBAAiB;QAAjB,qBAAiB;YAAjB,iBAAiB;IACjB,mBAAY;IAAZ,oBAAY;QAAZ,oBAAY;YAAZ,YAAY;IACZ,6BAAiC;IACjC,8BAAkC;AACtC;;AAEA;IACI,WAAW;IACX,mBAAY;IAAZ,oBAAY;QAAZ,oBAAY;YAAZ,YAAY;IACZ,gBAAgB,EAAE,8BAA8B;IAChD,+BAAuB;YAAvB,uBAAuB;IACvB,yBAAyB;IACzB,qBAAqB;IACrB,kBAAkB;IAClB,iBAAiB;AACrB;;AAEA;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,iBAAiB;IACjB,8BAAmB;IAAnB,6BAAmB;IAAnB,2BAAmB;QAAnB,uBAAmB;YAAnB,mBAAmB;IACnB,uBAAe;QAAf,mBAAe;YAAf,eAAe;IACf,wBAAuB;IAAvB,+BAAuB;QAAvB,qBAAuB;YAAvB,uBAAuB;IACvB,iCAAyB;QAAzB,yBAAyB;YAAzB,yBAAyB;IACzB,yBAA8B;IAA9B,sCAA8B;QAA9B,sBAA8B;YAA9B,8BAA8B;AAClC;;AAEA;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,8BAA2B;IAA3B,8BAA2B;IAA3B,mCAA2B;QAA3B,+BAA2B;YAA3B,2BAA2B;AAC/B;;AAEA;IACI,kBAAkB;IAClB,MAAM;IACN,OAAO;IACP,WAAW;IACX,YAAY;IACZ,oBAAoB;AACxB;;AAEA;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,YAAY;IACZ,kBAAsB;IACtB,yBAA8B;IAA9B,sCAA8B;QAA9B,sBAA8B;YAA9B,8BAA8B;AAClC;;AAEA;IACI,oBAAa;IAAb,qBAAa;IAAb,oBAAa;IAAb,aAAa;IACb,kBAAkB;IAClB,yBAAkC;IAClC,yBAA6B;IAC7B,mBAAmB;IACnB,2BAA+B;IAC/B,iBAAiB;IACjB,YAAY;IACZ,wBAAuB;IAAvB,+BAAuB;QAAvB,qBAAuB;YAAvB,uBAAuB;AAC3B;;AAEA;IACI,8BAAkC;AACtC;;AAEA;IACI,6BAAiC;AACrC;;AAEA;IACI;QACI,gCAAwC;IAC5C;;IAEA;QACI,4BAAsB;QAAtB,6BAAsB;QAAtB,8BAAsB;YAAtB,0BAAsB;gBAAtB,sBAAsB;QACtB,uBAA2B;QAA3B,mCAA2B;YAA3B,oBAA2B;gBAA3B,2BAA2B;IAC/B;;IAEA;QACI,oBAAwB;QACxB,mBAAuB;IAC3B;AACJ;;AAEA;IACI,uBAAuB;IACvB,YAAY;IACZ,aAAa;IACb,WAAW;IACX,WAAW;IACX,aAAa;IACb,gBAAgB;IAChB,YAAY;IACZ,kBAAkB;IAClB,YAAY;IACZ,oCAAoC;IACpC,4BAA4B;AAChC;;AAEA;IACI,WAAW,EAAE,uCAAuC;AACxD",sourcesContent:["/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n$ui-pane-border: #D9D9D9;\n$ui-pane-gray: #F9F9F9;\n$ui-background-blue: #e8edf1;\n\n$text-primary: #575e75;\n\n$looks-secondary: #855CD6;\n$looks-transparent: hsla(260, 60%, 60%, 0.35); /* 35% transparent version of looks-secondary */\n\n$red-primary: #FF661A;\n$red-tertiary: #E64D00;\n\n$sound-primary: #CF63CF;\n$sound-tertiary: #A63FA6;\n\n$control-primary: #FFAB19;\n\n$data-primary: #FF8C1A;\n\n$form-border: #E9EEF2;\n","/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n$space: 0.5rem;\n$grid-unit: .25rem;\n\n$sprites-per-row: 5;\n\n$menu-bar-height: 3rem;\n$sprite-info-height: 6rem;\n$stage-menu-height: 2.75rem;\n\n$library-header-height: 4.375rem;\n\n$form-radius: calc($space / 2);\n\n/* layout contants from `layout-constants.js`, minus 1px */\n$full-size: 1095px;\n$full-size-paint: 1256px;\n",'@import "../../css/colors.css";\n@import "../../css/units.css";\n\n.editor-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n padding: calc(3 * $grid-unit);\n}\n\n.row {\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n\n.editor-container-top {\n border-bottom: 1px dashed $ui-pane-border;\n padding-bottom: calc(2 * $grid-unit);\n}\n\n.top-align-row {\n display: flex;\n flex-direction: row;\n height: 100%;\n padding-top: calc(5 * $grid-unit);\n min-width: 524px;\n}\n\n.row + .row {\n margin-top: calc(2 * $grid-unit);\n}\n\n[dir="ltr"] .mod-dashed-border {\n border-right: 1px dashed $ui-pane-border;\n padding-right: calc(2 * $grid-unit);\n}\n\n[dir="rtl"] .mod-dashed-border {\n border-left: 1px dashed $ui-pane-border;\n padding-left: calc(2 * $grid-unit);\n}\n.mod-labeled-icon-height {\n height: 2.85rem; /* for the second row so the dashed borders are equal in size */\n}\n\n$border-radius: 0.25rem;\n\n.button-group-button {\n display: inline-block;\n border: 1px solid $ui-pane-border;\n border-radius: 0;\n padding: .35rem;\n}\n\n[dir="ltr"] .button-group-button {\n border-left: none;\n}\n\n[dir="rtl"] .button-group-button {\n border-right: none;\n}\n\n[dir="ltr"] .button-group-button:last-of-type {\n border-top-right-radius: $border-radius;\n border-bottom-right-radius: $border-radius;\n}\n\n[dir="ltr"] .button-group-button:first-of-type {\n border-left: 1px solid $ui-pane-border;\n border-top-left-radius: $border-radius;\n border-bottom-left-radius: $border-radius;\n}\n\n[dir="rtl"] .button-group-button:last-of-type {\n border-top-left-radius: $border-radius;\n border-bottom-left-radius: $border-radius;\n}\n\n[dir="rtl"] .button-group-button:first-of-type {\n border-right: 1px solid $ui-pane-border;\n border-top-right-radius: $border-radius;\n border-bottom-right-radius: $border-radius;\n}\n\n[dir="ltr"] .button-group-button.mod-start-border {\n border-left: 1px solid $ui-pane-border;\n}\n\n[dir="rtl"] .button-group-button.mod-start-border {\n border-right: 1px solid $ui-pane-border;\n}\n\n[dir="ltr"].button-group-button.mod-no-end-border {\n border-right: none;\n}\n\n[dir="rtl"].button-group-button.mod-no-end-border {\n border-left: none;\n}\n\n.button-group-button-icon {\n width: 1.25rem;\n height: 1.25rem;\n vertical-align: middle;\n}\n\n.mod-mode-tools {\n margin-left: calc(2 * $grid-unit);\n}\n\n[dir="ltr"] .mod-margin-after {\n margin-right: calc(2 * $grid-unit);\n}\n\n[dir="rtl"] .mod-margin-after {\n margin-left: calc(2 * $grid-unit);\n}\n\n.controls-container {\n width: 100%;\n display: flex;\n flex-flow: column;\n flex-grow: 1;\n margin-left: calc(2 * $grid-unit);\n margin-right: calc(2 * $grid-unit);\n}\n\n.canvas-container {\n width: 100%;\n flex-grow: 1;\n min-width: 402px; /* Leave room for the border */\n box-sizing: content-box;\n border: 1px solid #e8edf1;\n border-radius: .25rem;\n position: relative;\n overflow: visible;\n}\n\n.mode-selector {\n display: flex;\n max-width: 7.5rem;\n flex-direction: row;\n flex-wrap: wrap;\n align-items: flex-start;\n align-content: flex-start;\n justify-content: space-between;\n}\n\n.zoom-controls {\n display: flex;\n flex-direction: row-reverse;\n}\n\n.color-picker-wrapper {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\n.canvas-controls {\n display: flex;\n height: 36px;\n margin-top: $grid-unit;\n justify-content: space-between;\n}\n\n.bitmap-button {\n display: flex;\n border-radius: 5px;\n background-color: $looks-secondary;\n padding: calc(2 * $grid-unit);\n line-height: 1.5rem;\n font-size: calc(3 * $grid-unit);\n font-weight: bold;\n color: white;\n justify-content: center;\n}\n\n[dir="ltr"] .bitmap-button-icon {\n margin-right: calc(2 * $grid-unit);\n}\n\n[dir="rtl"] .bitmap-button-icon {\n margin-left: calc(2 * $grid-unit);\n}\n\n@media only screen and (max-width: $full-size-paint) {\n .editor-container {\n padding: calc(3 * $grid-unit) $grid-unit;\n }\n\n .mode-selector {\n flex-direction: column;\n justify-content: flex-start;\n }\n\n .controls-container {\n margin-right: $grid-unit;\n margin-left: $grid-unit;\n }\n}\n\n.text-area {\n background: transparent;\n border: none;\n display: none;\n margin: 0px;\n opacity: .8;\n outline: none;\n overflow: hidden;\n padding: 0px;\n position: absolute;\n resize: none;\n -webkit-text-fill-color: transparent;\n text-fill-color: transparent;\n}\n\n.button-text {\n width: 100%; /* Fixes button text wrapping in Edge */\n}\n'],sourceRoot:""}]),r.locals={"editor-container":"paint-editor_editor-container_XJI6D",editorContainer:"paint-editor_editor-container_XJI6D",row:"paint-editor_row_qNJro","editor-container-top":"paint-editor_editor-container-top_MzEH8",editorContainerTop:"paint-editor_editor-container-top_MzEH8","top-align-row":"paint-editor_top-align-row_CG9zZ",topAlignRow:"paint-editor_top-align-row_CG9zZ","mod-dashed-border":"paint-editor_mod-dashed-border_d3Y-E",modDashedBorder:"paint-editor_mod-dashed-border_d3Y-E","mod-labeled-icon-height":"paint-editor_mod-labeled-icon-height_4VotQ",modLabeledIconHeight:"paint-editor_mod-labeled-icon-height_4VotQ","button-group-button":"paint-editor_button-group-button_71r+V",buttonGroupButton:"paint-editor_button-group-button_71r+V","mod-start-border":"paint-editor_mod-start-border_brl5l",modStartBorder:"paint-editor_mod-start-border_brl5l","mod-no-end-border":"paint-editor_mod-no-end-border_+9EBd",modNoEndBorder:"paint-editor_mod-no-end-border_+9EBd","button-group-button-icon":"paint-editor_button-group-button-icon_GOExF",buttonGroupButtonIcon:"paint-editor_button-group-button-icon_GOExF","mod-mode-tools":"paint-editor_mod-mode-tools_kG-2T",modModeTools:"paint-editor_mod-mode-tools_kG-2T","mod-margin-after":"paint-editor_mod-margin-after_lArV7",modMarginAfter:"paint-editor_mod-margin-after_lArV7","controls-container":"paint-editor_controls-container_WlBVy",controlsContainer:"paint-editor_controls-container_WlBVy","canvas-container":"paint-editor_canvas-container_Qe1w8",canvasContainer:"paint-editor_canvas-container_Qe1w8","mode-selector":"paint-editor_mode-selector_ALomU",modeSelector:"paint-editor_mode-selector_ALomU","zoom-controls":"paint-editor_zoom-controls_QQz-j",zoomControls:"paint-editor_zoom-controls_QQz-j","color-picker-wrapper":"paint-editor_color-picker-wrapper_KtBg6",colorPickerWrapper:"paint-editor_color-picker-wrapper_KtBg6","canvas-controls":"paint-editor_canvas-controls_yjCGl",canvasControls:"paint-editor_canvas-controls_yjCGl","bitmap-button":"paint-editor_bitmap-button_2te68",bitmapButton:"paint-editor_bitmap-button_2te68","bitmap-button-icon":"paint-editor_bitmap-button-icon_uLSWl",bitmapButtonIcon:"paint-editor_bitmap-button-icon_uLSWl","text-area":"paint-editor_text-area_U17Si",textArea:"paint-editor_text-area_U17Si","button-text":"paint-editor_button-text_D-z+w",buttonText:"paint-editor_button-text_D-z+w"},t.exports=r},705:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,".scrollable-canvas_vertical-scrollbar_JbG46, .scrollable-canvas_horizontal-scrollbar_5fYZS {\n background: rgba(190, 190, 190, 0.8);\n border-radius: calc(8px / 2);\n width: 100%;\n height: 100%;\n}\n.scrollable-canvas_vertical-scrollbar-wrapper_xwleo {\n position: absolute;\n width: calc(8px + 4px);\n right: 0;\n top: 4px;\n height: calc(100% - 8px - 2 * 4px);\n}\n.scrollable-canvas_horizontal-scrollbar-wrapper_Hp\\+nZ {\n position: absolute;\n height: calc(8px + 4px);\n left: 4px;\n bottom: 0;\n width: calc(100% - 8px - 2 * 4px);\n}\n.scrollable-canvas_vertical-scrollbar-hitbox_GMRRn, .scrollable-canvas_horizontal-scrollbar-hitbox_y2af2 {\n position: absolute;\n cursor: pointer;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n.scrollable-canvas_vertical-scrollbar-hitbox_GMRRn {\n width: calc(8px + 4px);\n padding-right: 4px;\n}\n.scrollable-canvas_horizontal-scrollbar-hitbox_y2af2 {\n height: calc(8px + 4px);\n padding-bottom: 4px;\n}\n","",{version:3,sources:["webpack://./src/components/scrollable-canvas/scrollable-canvas.css"],names:[],mappings:"AAGA;IACI,oCAAoC;IACpC,4BAAwC;IACxC,WAAW;IACX,YAAY;AAChB;AACA;IACI,kBAAkB;IAClB,sBAAiD;IACjD,QAAQ;IACR,QAAuB;IACvB,kCAA6D;AACjE;AAEA;IACI,kBAAkB;IAClB,uBAAkD;IAClD,SAAwB;IACxB,SAAS;IACT,iCAA4D;AAChE;AAEA;IACI,kBAAkB;IAClB,eAAe;IACf,8BAAsB;YAAtB,sBAAsB;AAC1B;AAEA;IACI,sBAAiD;IACjD,kBAAiC;AACrC;AAEA;IACI,uBAAkD;IAClD,mBAAkC;AACtC",sourcesContent:["$scrollbar-size: 8px;\n$scrollbar-padding: 4px;\n\n.vertical-scrollbar, .horizontal-scrollbar {\n background: rgba(190, 190, 190, 0.8);\n border-radius: calc($scrollbar-size / 2);\n width: 100%;\n height: 100%;\n}\n.vertical-scrollbar-wrapper {\n position: absolute;\n width: calc($scrollbar-size + $scrollbar-padding);\n right: 0;\n top: $scrollbar-padding;\n height: calc(100% - $scrollbar-size - 2 * $scrollbar-padding);\n}\n\n.horizontal-scrollbar-wrapper {\n position: absolute;\n height: calc($scrollbar-size + $scrollbar-padding);\n left: $scrollbar-padding;\n bottom: 0;\n width: calc(100% - $scrollbar-size - 2 * $scrollbar-padding);\n}\n\n.vertical-scrollbar-hitbox, .horizontal-scrollbar-hitbox {\n position: absolute;\n cursor: pointer;\n box-sizing: border-box;\n}\n\n.vertical-scrollbar-hitbox {\n width: calc($scrollbar-size + $scrollbar-padding);\n padding-right: $scrollbar-padding;\n}\n\n.horizontal-scrollbar-hitbox {\n height: calc($scrollbar-size + $scrollbar-padding);\n padding-bottom: $scrollbar-padding;\n}\n"],sourceRoot:""}]),r.locals={"vertical-scrollbar":"scrollable-canvas_vertical-scrollbar_JbG46",verticalScrollbar:"scrollable-canvas_vertical-scrollbar_JbG46","horizontal-scrollbar":"scrollable-canvas_horizontal-scrollbar_5fYZS",horizontalScrollbar:"scrollable-canvas_horizontal-scrollbar_5fYZS","vertical-scrollbar-wrapper":"scrollable-canvas_vertical-scrollbar-wrapper_xwleo",verticalScrollbarWrapper:"scrollable-canvas_vertical-scrollbar-wrapper_xwleo","horizontal-scrollbar-wrapper":"scrollable-canvas_horizontal-scrollbar-wrapper_Hp+nZ",horizontalScrollbarWrapper:"scrollable-canvas_horizontal-scrollbar-wrapper_Hp+nZ","vertical-scrollbar-hitbox":"scrollable-canvas_vertical-scrollbar-hitbox_GMRRn",verticalScrollbarHitbox:"scrollable-canvas_vertical-scrollbar-hitbox_GMRRn","horizontal-scrollbar-hitbox":"scrollable-canvas_horizontal-scrollbar-hitbox_y2af2",horizontalScrollbarHitbox:"scrollable-canvas_horizontal-scrollbar-hitbox_y2af2"},t.exports=r},665:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,"/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* 35% transparent version of looks-secondary */\n\n/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n/* layout contants from `layout-constants.js`, minus 1px */\n\n.tool-select-base_mod-tool-select_2bgwK {\n display: inline-block;\n margin: .25rem;\n border: none;\n border-radius: .25rem;\n outline: none;\n background: none;\n padding: .25rem;\n font-size: 0.85rem;\n -webkit-transition: 0.2s;\n transition: 0.2s;\n}\n\n.tool-select-base_mod-tool-select_2bgwK.tool-select-base_is-selected_1CGDO {\n background-color: #855CD6;\n}\n\n.tool-select-base_mod-tool-select_2bgwK:focus {\n outline: none;\n}\n\nimg.tool-select-base_tool-select-icon_-gOoV {\n width: 2rem;\n height: 2rem;\n -webkit-box-flex: 1;\n -webkit-flex-grow: 1;\n -ms-flex-positive: 1;\n flex-grow: 1;\n vertical-align: middle;\n}\n\n.tool-select-base_mod-tool-select_2bgwK.tool-select-base_is-selected_1CGDO .tool-select-base_tool-select-icon_-gOoV {\n /* Make the tool icons white while selected by making them black and inverting */\n -webkit-filter: brightness(0) invert(1);\n filter: brightness(0) invert(1);\n}\n\n@media only screen and (max-width: 1256px) {\n .tool-select-base_mod-tool-select_2bgwK {\n margin: 0;\n }\n}\n","",{version:3,sources:["webpack://./src/css/colors.css","webpack://./src/css/units.css","webpack://./src/components/tool-select-base/tool-select-base.css"],names:[],mappings:"AAAA;;oDAEoD;;AASL,+CAA+C;;ACX9F;;oDAEoD;;AAEpD;;;;kFAIkF;;AAelF,0DAA0D;;AClB1D;IACI,qBAAqB;IACrB,cAAkB;IAClB,YAAY;IACZ,qBAA6B;IAC7B,aAAa;IACb,gBAAgB;IAChB,eAAmB;IACnB,kBAAkB;IAClB,wBAAgB;IAAhB,gBAAgB;AACpB;;AAEA;IACI,yBAAkC;AACtC;;AAEA;IACI,aAAa;AACjB;;AAEA;IACI,WAAW;IACX,YAAY;IACZ,mBAAY;IAAZ,oBAAY;QAAZ,oBAAY;YAAZ,YAAY;IACZ,sBAAsB;AAC1B;;AAEA;IACI,gFAAgF;IAChF,uCAA+B;YAA/B,+BAA+B;AACnC;;AAEA;IACI;QACI,SAAS;IACb;AACJ",sourcesContent:["/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n$ui-pane-border: #D9D9D9;\n$ui-pane-gray: #F9F9F9;\n$ui-background-blue: #e8edf1;\n\n$text-primary: #575e75;\n\n$looks-secondary: #855CD6;\n$looks-transparent: hsla(260, 60%, 60%, 0.35); /* 35% transparent version of looks-secondary */\n\n$red-primary: #FF661A;\n$red-tertiary: #E64D00;\n\n$sound-primary: #CF63CF;\n$sound-tertiary: #A63FA6;\n\n$control-primary: #FFAB19;\n\n$data-primary: #FF8C1A;\n\n$form-border: #E9EEF2;\n","/* DO NOT EDIT\n@todo This file is copied from GUI and should be pulled out into a shared library.\nSee https://github.com/LLK/scratch-paint/issues/13 */\n\n/* ACTUALLY, THIS IS EDITED ;)\nTHIS WAS CHANGED ON 10/25/2017 BY @mewtaylor TO ADD A VARIABLE FOR THE SMALLEST\nGRID UNITS.\n\nALSO EDITED ON 11/13/2017 TO ADD IN CONTANTS FOR LAYOUT FROM `layout-contents.js`*/\n\n$space: 0.5rem;\n$grid-unit: .25rem;\n\n$sprites-per-row: 5;\n\n$menu-bar-height: 3rem;\n$sprite-info-height: 6rem;\n$stage-menu-height: 2.75rem;\n\n$library-header-height: 4.375rem;\n\n$form-radius: calc($space / 2);\n\n/* layout contants from `layout-constants.js`, minus 1px */\n$full-size: 1095px;\n$full-size-paint: 1256px;\n","@import '../../css/colors.css';\n@import \"../../css/units.css\";\n\n$border-radius: .25rem;\n\n.mod-tool-select {\n display: inline-block;\n margin: $grid-unit;\n border: none;\n border-radius: $border-radius;\n outline: none;\n background: none;\n padding: $grid-unit;\n font-size: 0.85rem;\n transition: 0.2s;\n}\n\n.mod-tool-select.is-selected {\n background-color: $looks-secondary;\n}\n\n.mod-tool-select:focus {\n outline: none;\n}\n\nimg.tool-select-icon {\n width: 2rem;\n height: 2rem;\n flex-grow: 1;\n vertical-align: middle;\n}\n\n.mod-tool-select.is-selected .tool-select-icon {\n /* Make the tool icons white while selected by making them black and inverting */\n filter: brightness(0) invert(1);\n}\n\n@media only screen and (max-width: $full-size-paint) {\n .mod-tool-select {\n margin: 0;\n }\n}\n"],sourceRoot:""}]),r.locals={"mod-tool-select":"tool-select-base_mod-tool-select_2bgwK",modToolSelect:"tool-select-base_mod-tool-select_2bgwK","is-selected":"tool-select-base_is-selected_1CGDO",isSelected:"tool-select-base_is-selected_1CGDO","tool-select-icon":"tool-select-base_tool-select-icon_-gOoV",toolSelectIcon:"tool-select-base_tool-select-icon_-gOoV"},t.exports=r},765:function(t,e,n){var i=n(991),r=n(314)(i);r.push([t.id,".paper-canvas_paper-canvas_J0bm2 {\n top: 1px; /* leave room for the border */\n left: 1px;\n width: calc(100% - 2px);\n height: calc(100% - 2px);\n margin: auto;\n position: absolute;\n background-color: #D9E3F2;\n}\n","",{version:3,sources:["webpack://./src/containers/paper-canvas.css"],names:[],mappings:"AAAA;IACI,QAAQ,EAAE,8BAA8B;IACxC,SAAS;IACT,uBAAuB;IACvB,wBAAwB;IACxB,YAAY;IACZ,kBAAkB;IAClB,yBAAyB;AAC7B",sourcesContent:[".paper-canvas {\n top: 1px; /* leave room for the border */\n left: 1px;\n width: calc(100% - 2px);\n height: calc(100% - 2px);\n margin: auto;\n position: absolute;\n background-color: #D9E3F2;\n}\n"],sourceRoot:""}]),r.locals={"paper-canvas":"paper-canvas_paper-canvas_J0bm2",paperCanvas:"paper-canvas_paper-canvas_J0bm2"},t.exports=r},314:function(t){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=t(e);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n}).join("")},e.i=function(t,n,i){"string"==typeof t&&(t=[[null,t,""]]);var r={};if(i)for(var o=0;o<this.length;o++){var s=this[o][0];null!=s&&(r[s]=!0)}for(var a=0;a<t.length;a++){var l=[].concat(t[a]);i&&r[l[0]]||(n&&(l[2]?l[2]="".concat(n," and ").concat(l[2]):l[2]=n),e.push(l))}},e}},991:function(t){"use strict";function e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return n(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return n(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}t.exports=function(t){var n=e(t,4),i=n[1],r=n[3];if(!r)return i;if("function"==typeof btoa){var o=btoa(unescape(encodeURIComponent(JSON.stringify(r)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(o),a="/*# ".concat(s," */"),l=r.sources.map(function(t){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(t," */")});return[i].concat(l).concat([a]).join("\n")}return[i].join("\n")}},499:function(t){"use strict";t.exports=function(t){var e,n={};if(!(t instanceof Object)||Array.isArray(t))throw new Error("keyMirror(...): Argument must be an object.");for(e in t)t.hasOwnProperty(e)&&(n[e]=e);return n}},480:function(t,e,n){var i="__lodash_placeholder__",r=32,o=1/0,s=9007199254740991,a=NaN,l=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",r],["partialRight",64],["rearg",256]],c="[object Arguments]",u=/^\s+|\s+$/g,h=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,d=/\{\n\/\* \[wrapped with (.+)\] \*/,p=/,? & /,f=/^[-+]0x[0-9a-f]+$/i,g=/^0b[01]+$/i,m=/^\[object .+?Constructor\]$/,y=/^0o[0-7]+$/i,v=/^(?:0|[1-9]\d*)$/,b=parseInt,I="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,A="object"==typeof self&&self&&self.Object===Object&&self,M=I||A||Function("return this")();function w(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function C(t,e){for(var n=-1,i=t?t.length:0;++n<i&&!1!==e(t[n],n,t););return t}function T(t,e){return!!(t?t.length:0)&&function(t,e,n){if(e!=e)return function(t,e,n,i){var r=t.length,o=n+(i?1:-1);for(;i?o--:++o<r;)if(e(t[o],o,t))return o;return-1}(t,S,n);var i=n-1,r=t.length;for(;++i<r;)if(t[i]===e)return i;return-1}(t,e,0)>-1}function x(t,e){for(var n=-1,i=e.length,r=t.length;++n<i;)t[r+n]=e[n];return t}function S(t){return t!=t}function D(t,e){for(var n=-1,r=t.length,o=0,s=[];++n<r;){var a=t[n];a!==e&&a!==i||(t[n]=i,s[o++]=n)}return s}var N,_,E,j=Function.prototype,k=Object.prototype,O=M["__core-js_shared__"],z=(N=/[^.]+$/.exec(O&&O.keys&&O.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"",L=j.toString,B=k.hasOwnProperty,P=k.toString,R=RegExp("^"+L.call(B).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),U=M.Symbol,G=Object.create,Y=k.propertyIsEnumerable,Z=U?U.isConcatSpreadable:void 0,W=Math.max,Q=Math.min,H=(_=et(Object,"defineProperty"),(E=et.name)&&E.length>2?_:void 0);function F(t,e,n,i,r){var o=-1,s=t.length;for(n||(n=rt),r||(r=[]);++o<s;){var a=t[o];e>0&&n(a)?e>1?F(a,e-1,n,i,r):x(r,a):i||(r[r.length]=a)}return r}function V(t){if(!ht(t)||function(t){return!!z&&z in t}(t))return!1;var e=ut(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?R:m;return e.test(function(t){if(null!=t){try{return L.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function q(t,e){return e=W(void 0===e?t.length-1:e,0),function(){for(var n=arguments,i=-1,r=W(n.length-e,0),o=Array(r);++i<r;)o[i]=n[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=n[i];return s[e]=o,w(t,this,s)}}function J(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n,i=ht(n=t.prototype)?G(n):{},r=t.apply(i,e);return ht(r)?r:i}}function X(t,e,n,i,r,o,s,a,l,c){var u=128&e,h=1&e,d=2&e,p=24&e,f=512&e,g=d?void 0:J(t);return function m(){for(var y=arguments.length,v=Array(y),b=y;b--;)v[b]=arguments[b];if(p)var I=tt(m),A=function(t,e){for(var n=t.length,i=0;n--;)t[n]===e&&i++;return i}(v,I);if(i&&(v=function(t,e,n,i){for(var r=-1,o=t.length,s=n.length,a=-1,l=e.length,c=W(o-s,0),u=Array(l+c),h=!i;++a<l;)u[a]=e[a];for(;++r<s;)(h||r<o)&&(u[n[r]]=t[r]);for(;c--;)u[a++]=t[r++];return u}(v,i,r,p)),o&&(v=function(t,e,n,i){for(var r=-1,o=t.length,s=-1,a=n.length,l=-1,c=e.length,u=W(o-a,0),h=Array(u+c),d=!i;++r<u;)h[r]=t[r];for(var p=r;++l<c;)h[p+l]=e[l];for(;++s<a;)(d||r<o)&&(h[p+n[s]]=t[r++]);return h}(v,o,s,p)),y-=A,p&&y<c){var w=D(v,I);return K(t,e,X,m.placeholder,n,v,w,a,l,c-y)}var C=h?n:this,T=d?C[t]:t;return y=v.length,a?v=function(t,e){var n=t.length,i=Q(e.length,n),r=function(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e}(t);for(;i--;){var o=e[i];t[i]=ot(o,n)?r[o]:void 0}return t}(v,a):f&&y>1&&v.reverse(),u&&l<y&&(v.length=l),this&&this!==M&&this instanceof m&&(T=g||J(T)),T.apply(C,v)}}function K(t,e,n,i,o,s,a,l,c,u){var h=8&e;e|=h?r:64,4&(e&=~(h?64:r))||(e&=-4);var d=n(t,e,o,h?s:void 0,h?a:void 0,h?void 0:s,h?void 0:a,l,c,u);return d.placeholder=i,st(d,t,e)}function $(t,e,n,i,o,s,a,l){var c=2&e;if(!c&&"function"!=typeof t)throw new TypeError("Expected a function");var u=i?i.length:0;if(u||(e&=-97,i=o=void 0),a=void 0===a?a:W(gt(a),0),l=void 0===l?l:gt(l),u-=o?o.length:0,64&e){var h=i,d=o;i=o=void 0}var p=[t,e,n,i,o,h,d,s,a,l];if(t=p[0],e=p[1],n=p[2],i=p[3],o=p[4],!(l=p[9]=null==p[9]?c?0:t.length:W(p[9]-u,0))&&24&e&&(e&=-25),e&&1!=e)f=8==e||16==e?function(t,e,n){var i=J(t);return function r(){for(var o=arguments.length,s=Array(o),a=o,l=tt(r);a--;)s[a]=arguments[a];var c=o<3&&s[0]!==l&&s[o-1]!==l?[]:D(s,l);return(o-=c.length)<n?K(t,e,X,r.placeholder,void 0,s,c,void 0,void 0,n-o):w(this&&this!==M&&this instanceof r?i:t,this,s)}}(t,e,l):e!=r&&33!=e||o.length?X.apply(void 0,p):function(t,e,n,i){var r=1&e,o=J(t);return function e(){for(var s=-1,a=arguments.length,l=-1,c=i.length,u=Array(c+a),h=this&&this!==M&&this instanceof e?o:t;++l<c;)u[l]=i[l];for(;a--;)u[l++]=arguments[++s];return w(h,r?n:this,u)}}(t,e,n,i);else var f=function(t,e,n){var i=1&e,r=J(t);return function e(){return(this&&this!==M&&this instanceof e?r:t).apply(i?n:this,arguments)}}(t,e,n);return st(f,t,e)}function tt(t){return t.placeholder}function et(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return V(n)?n:void 0}function nt(t){var e=t.match(d);return e?e[1].split(p):[]}function it(t,e){var n=e.length,i=n-1;return e[i]=(n>1?"& ":"")+e[i],e=e.join(n>2?", ":" "),t.replace(h,"{\n/* [wrapped with "+e+"] */\n")}function rt(t){return ct(t)||function(t){return function(t){return dt(t)&&function(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=s}(t.length)&&!ut(t)}(t)}(t)&&B.call(t,"callee")&&(!Y.call(t,"callee")||P.call(t)==c)}(t)||!!(Z&&t&&t[Z])}function ot(t,e){return!!(e=null==e?s:e)&&("number"==typeof t||v.test(t))&&t>-1&&t%1==0&&t<e}var st=H?function(t,e,n){var i,r=e+"";return H(t,"toString",{configurable:!0,enumerable:!1,value:(i=it(r,at(nt(r),n)),function(){return i})})}:function(t){return t};function at(t,e){return C(l,function(n){var i="_."+n[0];e&n[1]&&!T(t,i)&&t.push(i)}),t.sort()}var lt=q(function(t,e,n){var i=1;if(n.length){var o=D(n,tt(lt));i|=r}return $(t,i,e,n,o)});var ct=Array.isArray;function ut(t){var e=ht(t)?P.call(t):"";return"[object Function]"==e||"[object GeneratorFunction]"==e}function ht(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function dt(t){return!!t&&"object"==typeof t}function pt(t){return"symbol"==typeof t||dt(t)&&"[object Symbol]"==P.call(t)}function ft(t){return t?(t=function(t){if("number"==typeof t)return t;if(pt(t))return a;if(ht(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ht(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(u,"");var n=g.test(t);return n||y.test(t)?b(t.slice(2),n?2:8):f.test(t)?a:+t}(t))===o||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function gt(t){var e=ft(t),n=e%1;return e==e?n?e-n:e:0}var mt=q(function(t,e){return C(F(e,1),function(e){e=function(t){if("string"==typeof t||pt(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(e),t[e]=lt(t[e],t)}),t});lt.placeholder={},t.exports=mt},687:function(t,e,n){var i="__lodash_hash_undefined__",r=9007199254740991,o="[object Symbol]",s=/^\[object .+?Constructor\]$/,a=/^(?:0|[1-9]\d*)$/,l="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")();function h(t,e){return!!(t?t.length:0)&&function(t,e,n){if(e!=e)return function(t,e,n,i){var r=t.length,o=n+(i?1:-1);for(;i?o--:++o<r;)if(e(t[o],o,t))return o;return-1}(t,g,n);var i=n-1,r=t.length;for(;++i<r;)if(t[i]===e)return i;return-1}(t,e,0)>-1}function d(t,e,n){for(var i=-1,r=t?t.length:0;++i<r;)if(n(e,t[i]))return!0;return!1}function p(t,e){for(var n=-1,i=t?t.length:0,r=Array(i);++n<i;)r[n]=e(t[n],n,t);return r}function f(t,e){for(var n=-1,i=e.length,r=t.length;++n<i;)t[r+n]=e[n];return t}function g(t){return t!=t}function m(t,e){return t.has(e)}function y(t,e){return function(n){return t(e(n))}}var v,b=Array.prototype,I=Function.prototype,A=Object.prototype,M=u["__core-js_shared__"],w=(v=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+v:"",C=I.toString,T=A.hasOwnProperty,x=A.toString,S=RegExp("^"+C.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),D=u.Symbol,N=y(Object.getPrototypeOf,Object),_=A.propertyIsEnumerable,E=b.splice,j=D?D.isConcatSpreadable:void 0,k=Object.getOwnPropertySymbols,O=Math.max,z=V(u,"Map"),L=V(Object,"create");function B(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}function P(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}function R(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}function U(t){var e=-1,n=t?t.length:0;for(this.__data__=new R;++e<n;)this.add(t[e])}function G(t,e){var n=nt(t)||et(t)?function(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}(t.length,String):[],i=n.length,r=!!i;for(var o in t)!e&&!T.call(t,o)||r&&("length"==o||K(o,i))||n.push(o);return n}function Y(t,e){for(var n=t.length;n--;)if(tt(t[n][0],e))return n;return-1}function Z(t,e,n,i,r){var o=-1,s=t.length;for(n||(n=X),r||(r=[]);++o<s;){var a=t[o];e>0&&n(a)?e>1?Z(a,e-1,n,i,r):f(r,a):i||(r[r.length]=a)}return r}function W(t){if(!ot(t)||(e=t,w&&w in e))return!1;var e,n=rt(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?S:s;return n.test(function(t){if(null!=t){try{return C.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function Q(t){if(!ot(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e,n,i,r=(n=(e=t)&&e.constructor,i="function"==typeof n&&n.prototype||A,e===i),o=[];for(var s in t)("constructor"!=s||!r&&T.call(t,s))&&o.push(s);return o}function H(t){return function(t,e,n){var i=e(t);return nt(t)?i:f(i,n(t))}(t,at,J)}function F(t,e){var n,i,r=t.__data__;return("string"==(i=typeof(n=e))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==n:null===n)?r["string"==typeof e?"string":"hash"]:r.map}function V(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return W(n)?n:void 0}B.prototype.clear=function(){this.__data__=L?L(null):{}},B.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},B.prototype.get=function(t){var e=this.__data__;if(L){var n=e[t];return n===i?void 0:n}return T.call(e,t)?e[t]:void 0},B.prototype.has=function(t){var e=this.__data__;return L?void 0!==e[t]:T.call(e,t)},B.prototype.set=function(t,e){return this.__data__[t]=L&&void 0===e?i:e,this},P.prototype.clear=function(){this.__data__=[]},P.prototype.delete=function(t){var e=this.__data__,n=Y(e,t);return!(n<0)&&(n==e.length-1?e.pop():E.call(e,n,1),!0)},P.prototype.get=function(t){var e=this.__data__,n=Y(e,t);return n<0?void 0:e[n][1]},P.prototype.has=function(t){return Y(this.__data__,t)>-1},P.prototype.set=function(t,e){var n=this.__data__,i=Y(n,t);return i<0?n.push([t,e]):n[i][1]=e,this},R.prototype.clear=function(){this.__data__={hash:new B,map:new(z||P),string:new B}},R.prototype.delete=function(t){return F(this,t).delete(t)},R.prototype.get=function(t){return F(this,t).get(t)},R.prototype.has=function(t){return F(this,t).has(t)},R.prototype.set=function(t,e){return F(this,t).set(t,e),this},U.prototype.add=U.prototype.push=function(t){return this.__data__.set(t,i),this},U.prototype.has=function(t){return this.__data__.has(t)};var q=k?y(k,Object):ht,J=k?function(t){for(var e=[];t;)f(e,q(t)),t=N(t);return e}:ht;function X(t){return nt(t)||et(t)||!!(j&&t&&t[j])}function K(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||a.test(t))&&t>-1&&t%1==0&&t<e}function $(t){if("string"==typeof t||function(t){return"symbol"==typeof t||st(t)&&x.call(t)==o}(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function tt(t,e){return t===e||t!=t&&e!=e}function et(t){return function(t){return st(t)&&it(t)}(t)&&T.call(t,"callee")&&(!_.call(t,"callee")||"[object Arguments]"==x.call(t))}var nt=Array.isArray;function it(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}(t.length)&&!rt(t)}function rt(t){var e=ot(t)?x.call(t):"";return"[object Function]"==e||"[object GeneratorFunction]"==e}function ot(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function st(t){return!!t&&"object"==typeof t}function at(t){return it(t)?G(t,!0):Q(t)}var lt,ct,ut=(lt=function(t,e){return null==t?{}:(e=p(Z(e,1),$),function(t,e){return function(t,e,n){for(var i=-1,r=e.length,o={};++i<r;){var s=e[i],a=t[s];n(a,s)&&(o[s]=a)}return o}(t=Object(t),e,function(e,n){return n in t})}(t,function(t,e,n,i){var r,o=-1,s=h,a=!0,l=t.length,c=[],u=e.length;if(!l)return c;n&&(e=p(e,(r=n,function(t){return r(t)}))),i?(s=d,a=!1):e.length>=200&&(s=m,a=!1,e=new U(e));t:for(;++o<l;){var f=t[o],g=n?n(f):f;if(f=i||0!==f?f:0,a&&g==g){for(var y=u;y--;)if(e[y]===g)continue t;c.push(f)}else s(e,g,i)||c.push(f)}return c}(H(t),e)))},ct=O(void 0===ct?lt.length-1:ct,0),function(){for(var t=arguments,e=-1,n=O(t.length-ct,0),i=Array(n);++e<n;)i[e]=t[ct+e];e=-1;for(var r=Array(ct+1);++e<ct;)r[e]=t[e];return r[ct]=i,function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(lt,this,r)});function ht(){return[]}t.exports=ut},982:function(t,e,n){var i=n(699);t.exports=function(t){var e,n,r,o;if(e=/^((?:rgb|hs[lv]|cmyk|xyz|lab)a?)\s*\(([^\)]*)\)/.exec(t)){var s=e[1],a="cmyk"===(l=s.replace(/a$/,""))?4:3;n=i[l],r=e[2].replace(/^\s+|\s+$/g,"").split(/\s*,\s*/).map(function(t,e){return/%$/.test(t)&&e===a?parseFloat(t)/100:(/%$/.test(t),parseFloat(t))}),s===l&&r.push(1),o=void 0===r[a]?1:r[a],r=r.slice(0,a),n[l]=function(){return r}}else if(/^#[A-Fa-f0-9]+$/.test(t)){var l;a=(l=t.replace(/^#/,"")).length;n=i.rgb,r=(r=l.split(3===a?/(.)/:/(..)/)).filter(Boolean).map(function(t){return 3===a?parseInt(t+t,16):parseInt(t,16)}),o=1,n.rgb=function(){return r},r[0]||(r[0]=0),r[1]||(r[1]=0),r[2]||(r[2]=0)}else(n=i.keyword).keyword=function(){return t},r=t,o=1;var c={rgb:void 0,hsl:void 0,hsv:void 0,cmyk:void 0,keyword:void 0,hex:void 0};try{c.rgb=n.rgb(r)}catch(t){}try{c.hsl=n.hsl(r)}catch(t){}try{c.hsv=n.hsv(r)}catch(t){}try{c.cmyk=n.cmyk(r)}catch(t){}try{c.keyword=n.keyword(r)}catch(t){}return c.rgb&&(c.hex="#"+c.rgb.map(function(t){var e=t.toString(16);return 1===e.length?"0"+e:e}).join("")),c.rgb&&(c.rgba=c.rgb.concat(o)),c.hsl&&(c.hsla=c.hsl.concat(o)),c.hsv&&(c.hsva=c.hsv.concat(o)),c.cmyk&&(c.cmyka=c.cmyk.concat(o)),c}},2:function(t){function e(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,s=Math.min(i,r,o),a=Math.max(i,r,o),l=a-s;return a==s?e=0:i==a?e=(r-o)/l:r==a?e=2+(o-i)/l:o==a&&(e=4+(i-r)/l),(e=Math.min(60*e,360))<0&&(e+=360),n=(s+a)/2,[e,100*(a==s?0:n<=.5?l/(a+s):l/(2-a-s)),100*n]}function n(t){var e,n,i=t[0],r=t[1],o=t[2],s=Math.min(i,r,o),a=Math.max(i,r,o),l=a-s;return n=0==a?0:l/a*1e3/10,a==s?e=0:i==a?e=(r-o)/l:r==a?e=2+(o-i)/l:o==a&&(e=4+(i-r)/l),(e=Math.min(60*e,360))<0&&(e+=360),[e,n,a/255*1e3/10]}function i(t){var n=t[0],i=t[1],r=t[2];return[e(t)[0],100*(1/255*Math.min(n,Math.min(i,r))),100*(r=1-1/255*Math.max(n,Math.max(i,r)))]}function o(t){var e,n=t[0]/255,i=t[1]/255,r=t[2]/255;return[100*((1-n-(e=Math.min(1-n,1-i,1-r)))/(1-e)||0),100*((1-i-e)/(1-e)||0),100*((1-r-e)/(1-e)||0),100*e]}function s(t){return w[JSON.stringify(t)]}function a(t){var e=t[0]/255,n=t[1]/255,i=t[2]/255;return[100*(.4124*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]}function l(t){var e=a(t),n=e[0],i=e[1],r=e[2];return i/=100,r/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116)-16,500*(n-i),200*(i-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]}function c(t){var e,n,i,r,o,s=t[0]/360,a=t[1]/100,l=t[2]/100;if(0==a)return[o=255*l,o,o];e=2*l-(n=l<.5?l*(1+a):l+a-l*a),r=[0,0,0];for(var c=0;c<3;c++)(i=s+1/3*-(c-1))<0&&i++,i>1&&i--,o=6*i<1?e+6*(n-e)*i:2*i<1?n:3*i<2?e+(n-e)*(2/3-i)*6:e,r[c]=255*o;return r}function u(t){var e=t[0]/60,n=t[1]/100,i=t[2]/100,r=Math.floor(e)%6,o=e-Math.floor(e),s=255*i*(1-n),a=255*i*(1-n*o),l=255*i*(1-n*(1-o));i*=255;switch(r){case 0:return[i,l,s];case 1:return[a,i,s];case 2:return[s,i,l];case 3:return[s,a,i];case 4:return[l,s,i];case 5:return[i,s,a]}}function h(t){var e,n,i,o,s=t[0]/360,a=t[1]/100,l=t[2]/100,c=a+l;switch(c>1&&(a/=c,l/=c),i=6*s-(e=Math.floor(6*s)),1&e&&(i=1-i),o=a+i*((n=1-l)-a),e){default:case 6:case 0:r=n,g=o,b=a;break;case 1:r=o,g=n,b=a;break;case 2:r=a,g=n,b=o;break;case 3:r=a,g=o,b=n;break;case 4:r=o,g=a,b=n;break;case 5:r=n,g=a,b=o}return[255*r,255*g,255*b]}function d(t){var e=t[0]/100,n=t[1]/100,i=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,e*(1-r)+r)),255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r))]}function p(t){var e,n,i,r=t[0]/100,o=t[1]/100,s=t[2]/100;return n=-.9689*r+1.8758*o+.0415*s,i=.0557*r+-.204*o+1.057*s,e=(e=3.2406*r+-1.5372*o+-.4986*s)>.0031308?1.055*Math.pow(e,1/2.4)-.055:e*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,[255*(e=Math.min(Math.max(0,e),1)),255*(n=Math.min(Math.max(0,n),1)),255*(i=Math.min(Math.max(0,i),1))]}function f(t){var e=t[0],n=t[1],i=t[2];return n/=100,i/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(e-n),200*(n-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]}function m(t){var e,n,i,r,o=t[0],s=t[1],a=t[2];return o<=8?r=(n=100*o/903.3)/100*7.787+16/116:(n=100*Math.pow((o+16)/116,3),r=Math.pow(n/100,1/3)),[e=e/95.047<=.008856?e=95.047*(s/500+r-16/116)/7.787:95.047*Math.pow(s/500+r,3),n,i=i/108.883<=.008859?i=108.883*(r-a/200-16/116)/7.787:108.883*Math.pow(r-a/200,3)]}function y(t){var e,n=t[0],i=t[1],r=t[2];return(e=360*Math.atan2(r,i)/2/Math.PI)<0&&(e+=360),[n,Math.sqrt(i*i+r*r),e]}function v(t){return p(m(t))}function I(t){var e,n=t[0],i=t[1];return e=t[2]/360*2*Math.PI,[n,i*Math.cos(e),i*Math.sin(e)]}function A(t){return M[t]}t.exports={rgb2hsl:e,rgb2hsv:n,rgb2hwb:i,rgb2cmyk:o,rgb2keyword:s,rgb2xyz:a,rgb2lab:l,rgb2lch:function(t){return y(l(t))},hsl2rgb:c,hsl2hsv:function(t){var e=t[0],n=t[1]/100,i=t[2]/100;if(0===i)return[0,0,0];return[e,100*(2*(n*=(i*=2)<=1?i:2-i)/(i+n)),100*((i+n)/2)]},hsl2hwb:function(t){return i(c(t))},hsl2cmyk:function(t){return o(c(t))},hsl2keyword:function(t){return s(c(t))},hsv2rgb:u,hsv2hsl:function(t){var e,n,i=t[0],r=t[1]/100,o=t[2]/100;return e=r*o,[i,100*(e=(e/=(n=(2-r)*o)<=1?n:2-n)||0),100*(n/=2)]},hsv2hwb:function(t){return i(u(t))},hsv2cmyk:function(t){return o(u(t))},hsv2keyword:function(t){return s(u(t))},hwb2rgb:h,hwb2hsl:function(t){return e(h(t))},hwb2hsv:function(t){return n(h(t))},hwb2cmyk:function(t){return o(h(t))},hwb2keyword:function(t){return s(h(t))},cmyk2rgb:d,cmyk2hsl:function(t){return e(d(t))},cmyk2hsv:function(t){return n(d(t))},cmyk2hwb:function(t){return i(d(t))},cmyk2keyword:function(t){return s(d(t))},keyword2rgb:A,keyword2hsl:function(t){return e(A(t))},keyword2hsv:function(t){return n(A(t))},keyword2hwb:function(t){return i(A(t))},keyword2cmyk:function(t){return o(A(t))},keyword2lab:function(t){return l(A(t))},keyword2xyz:function(t){return a(A(t))},xyz2rgb:p,xyz2lab:f,xyz2lch:function(t){return y(f(t))},lab2xyz:m,lab2rgb:v,lab2lch:y,lch2lab:I,lch2xyz:function(t){return m(I(t))},lch2rgb:function(t){return v(I(t))}};var M={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},w={};for(var C in M)w[JSON.stringify(M[C])]=C},699:function(t,e,n){var i=n(2),r=function(){return new c};for(var o in i){r[o+"Raw"]=function(t){return function(e){return"number"==typeof e&&(e=Array.prototype.slice.call(arguments)),i[t](e)}}(o);var s=/(\w+)2(\w+)/.exec(o),a=s[1],l=s[2];(r[a]=r[a]||{})[l]=r[o]=function(t){return function(e){"number"==typeof e&&(e=Array.prototype.slice.call(arguments));var n=i[t](e);if("string"==typeof n||void 0===n)return n;for(var r=0;r<n.length;r++)n[r]=Math.round(n[r]);return n}}(o)}var c=function(){this.convs={}};c.prototype.routeSpace=function(t,e){var n=e[0];return void 0===n?this.getValues(t):("number"==typeof n&&(n=Array.prototype.slice.call(e)),this.setValues(t,n))},c.prototype.setValues=function(t,e){return this.space=t,this.convs={},this.convs[t]=e,this},c.prototype.getValues=function(t){var e=this.convs[t];if(!e){var n=this.space,i=this.convs[n];e=r[n][t](i),this.convs[t]=e}return e},["rgb","hsl","hsv","cmyk","keyword"].forEach(function(t){c.prototype[t]=function(e){return this.routeSpace(t,arguments)}}),t.exports=r},72:function(t){"use strict";var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var o={},s=[],a=0;a<t.length;a++){var l=t[a],c=i.base?l[0]+i.base:l[0],u=o[c]||0,h="".concat(c," ").concat(u);o[c]=u+1;var d=n(h),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(p);else{var f=r(p,i);i.byIndex=a,e.splice(a,0,{identifier:h,updater:f,references:1})}s.push(h)}return s}function r(t,e){var n=e.domAPI(e);n.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,r){var o=i(t=t||[],r=r||{});return function(t){t=t||[];for(var s=0;s<o.length;s++){var a=n(o[s]);e[a].references--}for(var l=i(t,r),c=0;c<o.length;c++){var u=n(o[c]);0===e[u].references&&(e[u].updater(),e.splice(u,1))}o=l}}},659:function(t){"use strict";var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540:function(t){"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},56:function(t,e,n){"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},825:function(t){"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},113:function(t){"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},962:function(t){"use strict";t.exports=s},749:function(t){"use strict";t.exports=e},863:function(e){"use strict";e.exports=t},629:function(t){"use strict";t.exports=n},923:function(t){"use strict";t.exports=o},53:function(t){"use strict";t.exports=l},850:function(t){"use strict";t.exports=i},582:function(t){"use strict";t.exports=c},17:function(t){"use strict";t.exports=a},0:function(t){"use strict";t.exports=u},946:function(){},12:function(){},942:function(t,e){var n;!function(){"use strict";var i={}.hasOwnProperty;function r(){for(var t="",e=0;e<arguments.length;e++){var n=arguments[e];n&&(t=s(t,o(n)))}return t}function o(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return r.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var e="";for(var n in t)i.call(t,n)&&t[n]&&(e=s(e,n));return e}function s(t,e){return e?t?t+" "+e:t+e:t}t.exports?(r.default=r,t.exports=r):void 0===(n=function(){return r}.apply(e,[]))||(t.exports=n)}()}},d={};function p(t){var e=d[t];if(void 0!==e)return e.exports;var n=d[t]={id:t,exports:{}};return h[t].call(n.exports,n,n.exports,p),n.exports}p.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return p.d(e,{a:e}),e},p.d=function(t,e){for(var n in e)p.o(e,n)&&!p.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),p.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},p.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},p.nc=void 0;var f={};return function(){"use strict";p.r(f),p.d(f,{ScratchPaintReducer:function(){return gv},default:function(){return hv}});var t=p(311),e=p.n(t),n=p(863),i=p.n(n),r=p(749),o=p.n(r);o().enable();var s=o()("scratch-paint"),a=p(629),l=p.n(a),c=p(850),u=p(942),h=p.n(u),d=p(923),g=p(480),m=p.n(g),y=p(962),v=p(499),b=p.n(v),I=b()({BITMAP:null,VECTOR:null,BITMAP_SKIP_CONVERT:null,VECTOR_SKIP_CONVERT:null}),A=function(t){return t===I.VECTOR||t===I.VECTOR_SKIP_CONVERT},M=function(t){return t===I.BITMAP||t===I.BITMAP_SKIP_CONVERT};function w(t){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w(t)}function C(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function T(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?C(Object(n),!0).forEach(function(e){x(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function x(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=w(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=w(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==w(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var S={BRUSH:null,ERASER:null,LINE:null,FILL:null,SELECT:null,RESHAPE:null,OVAL:null,RECT:null,ROUNDED_RECT:null,TEXT:null},D={BIT_BRUSH:null,BIT_LINE:null,BIT_OVAL:null,BIT_RECT:null,BIT_TEXT:null,BIT_FILL:null,BIT_ERASER:null,BIT_SELECT:null},N=b()(S),_=b()(D),E=b()(T(T({},S),D)),j=b()({FILL:null,SELECT:null,RESHAPE:null,OVAL:null,RECT:null,LINE:null,BIT_OVAL:null,BIT_RECT:null,BIT_SELECT:null,BIT_FILL:null}),k=function(t){return"Layer"===t.parent.className?t:k(t.parent)},O=function(t){return"PointText"===t.className||"Shape"===t.className||"PlacedSymbol"===t.className||"Raster"===t.className},z=function(t){return"CompoundPath"===t.className},L=function(t){return t&&t.className&&"Group"===t.className},B=function(t){return"PointText"===t.className},P=function(t){return k(t).data.isPGTextItem},R=function(t){return L(t)},U=function(t,n,i){return function(t,n,i,r){if(t.length>0){var o=new(e().Group)(t);bt(n),mt(o,!0);for(var s=0;s<o.children.length;s++)o.children[s].selected=!0;return i(),r(),o}return!1}(It(),t,n,i)},G=function(t,n,i){if(t&&t.children&&R(t)){t.applyMatrix=!0;for(var r=0;r<t.children.length;r++){var o=t.children[r];if(o instanceof e().Group&&o.hasChildren()){if(n){G(o,n,i);continue}1===o.children.length&&(o=o.reduce())}o.applyMatrix=!0,o.insertBelow(t),i&&(o.selected=!0),r--}}},Y=function(t,e,n){if(0!==t.length){for(var i=[],r=0;r<t.length;r++){var o=t[r];R(o)&&!o.data.isPGTextItem?(G(o,!1,e),o.hasChildren()||i.push(o)):e&&(o.selected=!0)}e&&e();for(var s=0;s<i.length;s++)i[s].remove();n&&n()}},Z=function(t,e,n){var i=It();bt(t),Y(i,e,n)},W=function(){return It().length>1},Q=function(){for(var t=It(),e=0;e<t.length;e++){var n=t[e];if(R(n)&&!n.data.isPGTextItem&&n.children&&n.children.length>0)return!0}return!1},H=function(t){return t&&"CompoundPath"===t.className},F=function(t){return!!t.parent&&"CompoundPath"===t.parent.className},V=function(t){var e=t.parent;return H(e)?e:null};function q(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return J(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?J(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function J(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}var X=.3902628565,K=function(t,n){var i=Math.atan2(t.y,t.x);i=Math.round(i/n)*n;var r=Math.cos(i),o=Math.sin(i),s=r*t.x+o*t.y;return new(e().Point)(r*s,o*s)},$=function(t){for(var n=t,i=0;!(n instanceof e().Layer);){if(i++,null===n.parent)return null;n=n.parent}return i},tt=function(t,n){if(null===t||null===n)return null;for(var i=t,r=n,o=$(t),s=$(n);s>o;)r=r.parent,s--;for(;o>s;)i=i.parent,o--;for(;i&&r;){if(r===i)return 0;if(r.parent===i.parent)return r.parent instanceof e().CompoundPath?Math.abs(r.area)-Math.abs(i.area):parseFloat(i.index)-parseFloat(r.index);r=r.parent,i=i.parent}return null},et=function(t,n){if(t instanceof e().Group){var i,r=q(t.children);try{for(r.s();!(i=r.n()).done;){var o=i.value;et(o,n)}}catch(t){r.e(t)}finally{r.f()}}else n(t)},nt=function(t){et(t,function(t){t instanceof e().PathItem&&(t.clockwise=!0)})},it=function(t,n,i){et(t,function(t){t instanceof e().PointText||t.strokeWidth&&(t.strokeWidth=t.strokeWidth*n)}),t.scale(n,i)},rt=function(t,n){var i=n.x-t.x,r=n.y-t.y;i=i||1,r=r||1;var o=n.subtract(t).abs(),s=Math.max(o.x,o.y),a=new(e().Point)(s*i/Math.abs(i),s*r/Math.abs(r)),l=t.add(a.multiply(.5));return{size:a,position:l}};function ot(t){return ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ot(t)}function st(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return at(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?at(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function at(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function lt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function ct(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?lt(Object(n),!0).forEach(function(e){ut(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):lt(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function ut(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=ot(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=ot(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ot(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ht=function(t){var n=ct(ct({},t),{},{match:function(n){return!(n instanceof e().Layer)&&n.layer.data&&n.layer.data.isPaintingLayer&&!n.locked&&!n.isClipMask()&&!(n.data&&n.data.isHelperItem)&&(!t.match||t.match(n))}});return e().project.getItems(n)},dt=function(t){t=t||!1;var n,i=[],r=st(e().project.layers);try{for(r.s();!(n=r.n()).done;){var o,s=st(n.value.children);try{for(s.s();!(o=s.n()).done;){var a=o.value;!t&&a.guide||i.push(a)}}catch(t){s.e(t)}finally{s.f()}}}catch(t){r.e(t)}finally{r.f()}return i},pt=function(){for(var t=dt(),e=[],n=0;n<t.length;n++)t[n].data&&!t[n].data.isHelperItem&&e.push(t[n]);return e},ft=function(t,e){if(t.children)for(var n=0;n<t.children.length;n++){var i=t.children[n];i.children&&i.children.length>0?ft(i,e):i.fullySelected=e}else for(var r=0;r<t.segments.length;r++)t.segments[r].selected=e},gt=function(t,e,n){if(t.fullySelected=n,t.selected=e,H(t)||R(t)){var i=t.children;if(i){var r,o=st(i);try{for(o.s();!(r=o.n()).done;){var s=r.value;R(s)?gt(s,e,n):(s.fullySelected=n,s.selected=e)}}catch(t){o.e(t)}finally{o.f()}}}},mt=function(t,e,n){var i=function(t){var e=t.parent;return R(e)?e:null}(t),r=V(t);if(i)mt(i,e,n);else if(r)gt(r,e,n);else{if(t.data&&t.data.noSelect)return;gt(t,e,n)}},yt=function(){var t=pt();if(0===t.length)return!1;for(var e=0;e<t.length;e++)mt(t[e],!0);return!0},vt=function(){var t=pt();if(0===t.length)return!1;for(var e=0;e<t.length;e++)ft(t[e],!0);return!0},bt=function(t){e().project.deselectAll(),t()},It=function(){var t,n=[],i=st(pt());try{for(i.s();!(t=i.n()).done;){var r=t.value;if(r.selected)n.push(r);else if(r instanceof e().CompoundPath){var o,s=st(r.children);try{for(s.s();!(o=s.n()).done;){if(o.value.selected){n.push(r);break}}}catch(t){s.e(t)}finally{s.f()}}}}catch(t){i.e(t)}finally{i.f()}return n.sort(function(t,e){return parseFloat(t.index)-parseFloat(e.index)}),n},At=function(){for(var t=e().project.selectedItems,n=[],i=0;i<t.length;i++){var r=t[i];r instanceof e().Layer||R(r)||!r.data||r.data.isSelectionBound||n.push(r)}return n.sort(tt),n},Mt=function(){var t,e=[],n=st(At());try{for(n.s();!(t=n.n()).done;){var i=t.value;if(i.segments){var r,o=st(i.segments);try{for(o.s();!(r=o.n()).done;){var s=r.value;s.selected&&e.push(s)}}catch(t){o.e(t)}finally{o.f()}}}}catch(t){n.e(t)}finally{n.f()}return e},wt=function(t,e){if(0===t.length)return!1;for(var n=0;n<t.length;n++)t[n].remove();return e(),!0},Ct=function(t,e){if(t===E.RESHAPE){var n=At();return!!function(t,e){for(var n=[],i=0;i<t.length;i++)if(t[i].segments)for(var r=t[i].segments,o=0;o<r.length;o++){var s=r[o];s.selected&&n.push(s)}for(var a=!1,l=0;l<n.length;l++)n[l].remove(),a=!0;return a&&e(),a}(n,e)||wt(n,e)}var i=It();return wt(i,e)},Tt=function(t,n,i,r,o){if(function(t){return"Path"===t.className}(t)){for(var s=!1,a=0;a<t.segments.length;a++){var l=t.segments[a];if(i.contains(l.point)){if(r!==E.RESHAPE)return n.modifiers.shift&&t.selected?mt(o,!1):mt(o,!0,!0),!1;n.modifiers.shift&&l.selected?l.selected=!1:l.selected=!0,s=!0}}var c=t.getIntersections(i);if(c.length>0&&!s){if(r!==E.RESHAPE)return n.modifiers.shift&&t.selected?mt(t,!1):mt(t,!0),!1;for(var u=0;u<c.length;u++){var h=c[u].curve;u%2!=1&&(n.modifiers.shift?h.selected=!h.selected:h.selected=!0)}}}else if(O(t)&&function(t,n,i){var r=new(e().Path)([n.localToGlobal(n.internalBounds.topLeft),n.localToGlobal(n.internalBounds.topRight),n.localToGlobal(n.internalBounds.bottomRight),n.localToGlobal(n.internalBounds.bottomLeft)]);r.closed=!0,r.guide=!0;for(var o=0;o<r.segments.length;o++){var s=r.segments[o];if(t.contains(s.point)||0===o&&t.getIntersections(r).length>0)return i.modifiers.shift&&n.selected?mt(n,!1):mt(n,!0),r.remove(),!0}r.remove()}(i,t,n))return!1;return!0},xt=function(t,e,n,i,r){for(var o=0;o<t.children.length;o++){var s=t.children[o];R(s)||z(s)?xt(s,e,n,i,r):Tt(s,i,e,r,n)}return!0};function St(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Dt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Dt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}var Nt="#009dec",_t=function(t){t.strokeWidth=1/e().view.zoom,t.opacity=1,t.blendMode="normal",t.guide=!0},Et=function(t){var n=t.segments,i=new(e().Path)(n);return _t(i),t.closed&&(i.closed=!0),i.parent=Le(),i.position=t.position,i.strokeColor=Nt,i.fillColor=null,i.data.isHelperItem=!0,i.data.origItem=t,i.bringToFront(),i},jt=function(t,n){var i=t.internalBounds;n&&(i=i.expand(n));var r=new(e().Path.Rectangle)(i);return r.matrix=t.matrix,_t(r),r.parent=Le(),r.strokeColor=Nt,r.fillColor=null,r.data.isHelperItem=!0,r.data.origItem=t,r.bringToFront(),r},kt=function(){return Nt},Ot=function(t){var e,n=St(dt(!0));try{for(n.s();!(e=n.n()).done;){var i,r=e.value,o=St(t);try{for(o.s();!(i=o.n()).done;){var s=i.value;r.data&&r.data[s]&&r.remove()}}catch(t){o.e(t)}finally{o.f()}}}catch(t){n.e(t)}finally{n.f()}},zt=function(){Ot(["isHitPoint"])},Lt=function(t){if(zt(),t){var n=e().Path.Circle(t,4/e().view.zoom);n.strokeWidth=1/e().view.zoom,n.strokeColor=Nt,n.fillColor=new(e().Color)(1,1,1,.5),n.parent=Le(),n.data.isHitPoint=!0,n.data.isHelperItem=!0}};function Bt(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Pt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Pt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}var Rt=function(t,e,n){var i=~~t.x,r=~~e.x,o=~~t.y,s=~~e.y,a=Math.abs(r-i),l=Math.abs(s-o),c=i<r?1:-1,u=o<s?1:-1,h=a-l;for(n(i,o);i!==r||o!==s;){var d=2*h;d>-l&&(h-=l,i+=c),d<a&&(h+=a,o+=u),n(i,o)}},Ut=function(t,e,n){var i=(-e+Math.sqrt(e*e-4*t*n))/2/t,r=(-e-Math.sqrt(e*e-4*t*n))/2/t;return i>r?[i,r]:[r,i]},Gt=function(t,e){var n=~~t.centerX,i=~~t.centerY,r=~~Math.abs(t.radiusX)-.5,o=~~Math.abs(t.radiusY)-.5,s=t.shearSlope,a=t.isFilled,l=t.drawFn;if(s===1/0||r<1||o<1)return!1;var c,u=1/r/r+s*s/o/o,h=-2*s/o/o,d=1/o/o,p=(-2*u-h)/(2*d+h),f=(-2*u+h)/(-2*d+h),g=function(t,r){for(var o,s,c,p=t,f=Ut(u,h*p,d*p*p-1);r(f[0],p);)o=Math.floor(p),s=Math.floor(f[0]),c=Math.floor(f[1]),a?(e.fillRect(n-s-1,i+o,s-c+1,1),e.fillRect(n+c,i-o-1,s-c+1,1)):(l(n-s-1,i+o),l(n+s,i-o-1)),p--,f=Ut(u,h*p,d*p*p-1);return s||o?{x:s,y:o}:null},m=function(t,r){for(var o,s,c,p=t,f=Ut(d,h*p,u*p*p-1);r(p,f[0]);)o=Math.floor(p),s=Math.floor(f[0]),c=Math.floor(f[1]),a?(e.fillRect(n-o-1,i+c,1,s-c+1),e.fillRect(n+o,i-s-1,1,s-c+1)):(l(n-o-1,i+s),l(n+o,i-s-1)),p++,f=Ut(d,h*p,u*p*p-1);return o||s?{x:o,y:s}:null};if(p>f){var y=!1;p>0&&(y=!0),c=g(y?-o:o,function(t,e){return 0===t&&e>0||!(0===t&&e<0)&&e/t>p}),g((c=m(c?.5-c.x:.5,function(t,e){return e/t>f})||{x:-c.x-.5,y:-c.y-.5}).y-.5,function(t,e){return y?e>-o:e>o})}else c=m(.5,function(t,e){return e/t>f}),m(.5-(c=g(c?c.y-.5:o,function(t,e){return 0===t&&e>0||!(0===t&&e<0)&&e/t>p})||c).x,function(t){return t<0});return!0},Yt=function(t,e,n){t=~~t;var i=document.createElement("canvas"),r=Math.ceil(t/2);i.width=2*r,i.height=2*r;var o=i.getContext("2d");if(o.imageSmoothingEnabled=!1,o.fillStyle=n?"white":e,t<=5){var s=0;t%2&&(s=1),n?(o.fillStyle=kt(),o.fillRect(s,s,t,t),o.fillStyle="white",o.fillRect(s+1,s+1,t-2,t-2)):o.fillRect(s,s,t,t)}else Gt({centerX:t/2,centerY:t/2,radiusX:t/2,radiusY:t/2,shearSlope:0,isFilled:!0},o),n&&(o.fillStyle=kt(),Gt({centerX:t/2,centerY:t/2,radiusX:t/2,radiusY:t/2,shearSlope:0,isFilled:!1,drawFn:function(t,e){return o.fillRect(t,e,1,1)}},o));return i},Zt=function(t,e,n){for(var i=0;i<e;++i)if(0!==t.data[(n*e<<2)+(i<<2)+3])return!1;return!0},Wt=function(t,e,n,i,r){for(var o=i;o<r;++o)if(0!==t.data[(o*e<<2)+(n<<2)+3])return!1;return!0},Qt=function(t,n){for(var i=n||t.bounds,r=i.width,o=t.getImageData(i),s=0,a=o.height,l=0,c=o.width;s<a&&Zt(o,r,s);)++s;for(;a-1>s&&Zt(o,r,a-1);)--a;for(;l<c&&Wt(o,r,l,s,a);)++l;for(;c-1>l&&Wt(o,r,c-1,s,a);)--c;return s===a&&(s=a=o.height/2),l===c&&(l=c=o.width/2),new(e().Rectangle)(l+i.left,s+i.top,c-l,a-s)},Ht=function(t){var n,i,r=(n=Ee(),(i=Qt(n)).width&&i.height?n.getSubRaster(Qt(n)):null);return r?(t?e().project.activeLayer.addChild(r):r.remove(),r):null},Ft=function(t,e,n){return n.getImageData(t,e,1,1).data},Vt=function(t,e,n,i){var r=4*(e*n.width+t);return n.data[r+0]===i[0]&&n.data[r+1]===i[1]&&n.data[r+2]===i[2]&&n.data[r+3]===i[3]},qt=function(t,e,n,i){var r=4*(e*n.width+t);n.data[r+0]=i[0],n.data[r+1]=i[1],n.data[r+2]=i[2],n.data[r+3]=i[3]},Jt=function(t,e,n,i,r,o,s){for(;e>0&&Vt(t,e-1,n,o);)e--;for(var a=!1,l=!1;e<n.height&&Vt(t,e,n,o);e++)qt(t,e,n,r),qt(t,e,i,r),t>0&&(Vt(t-1,e,n,o)?a||(s.push([t-1,e]),a=!0):a=!1),t<n.width-1&&(Vt(t+1,e,n,o)?l||(s.push([t+1,e]),l=!0):l=!1)},Xt=function(t){var e=document.createElement("canvas");e.width=1,e.height=1;var n=e.getContext("2d");return n.fillStyle=t,n.fillRect(0,0,1,1),n.getImageData(0,0,1,1).data},Kt=function(t,n){if(0!==t.matrix.b||0!==t.matrix.c)for(var i=t.matrix.transform(new(e().Point)(-t.size.width/2,-t.size.height/2)),r=t.matrix.transform(new(e().Point)(t.size.width/2,-t.size.height/2)),o=t.matrix.transform(new(e().Point)(-t.size.width/2,t.size.height/2)),s=t.matrix.transform(new(e().Point)(t.size.width/2,t.size.height/2)),a=t.matrix.transform(new(e().Point)),l=[i,r,o,s].sort(function(t,e){return t.x-e.x}),c=function(t,e,n){return e.x===t.x?a.x>t.x?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY:(e.y-t.y)/(e.x-t.x)*(n-t.x)+t.y},u=Math.round(l[0].x);u<Math.round(l[3].x);u++){var h=[c(i,r,u+.5),c(i,o,u+.5),c(s,r,u+.5),c(s,o,u+.5)].sort(function(t,e){return t-e});n.fillRect(u,Math.round(h[1]),1,Math.max(1,Math.round(h[2])-Math.round(h[1])))}else{var d=t.size.width*t.matrix.a,p=t.size.height*t.matrix.d;n.fillRect(Math.round(t.matrix.tx-d/2),Math.round(t.matrix.ty-p/2),Math.round(d),Math.round(p))}},$t=function(t){var e=Ne(t.width,t.height),n=e.getContext("2d");return n.save(),n.scale(-1,1),n.drawImage(t,0,0,-e.width,e.height),n.restore(),e},te=function(t){var e=Ne(t.width,t.height),n=e.getContext("2d");return n.save(),n.scale(1,-1),n.drawImage(t,0,0,e.width,-e.height),n.restore(),e},ee=function(t,e){var n=Ne(Math.round(t.width*Math.abs(e.x)),t.height);return e.x<0&&(t=$t(t)),n.getContext("2d").drawImage(t,0,0,n.width,n.height),n=Ne((t=n).width,Math.round(t.height*Math.abs(e.y))),e.y<0&&(t=te(t)),n.getContext("2d").drawImage(t,0,0,n.width,n.height),n},ne=function(t,n){var i,r;t.matrix.isInvertible()&&(r=(i=t).matrix.decompose(),Math.abs(r.scaling.x)<1&&Math.abs(r.scaling.y)<1&&0!==r.scaling.x&&0!==r.scaling.y&&(i.canvas=ee(i.canvas,r.scaling),i.data&&i.data.expanded&&(i.data.expanded.canvas=ee(i.data.expanded.canvas,r.scaling)),i.matrix.append((new(e().Matrix)).scale(new(e().Point)(1/r.scaling.x,1/r.scaling.y)))),function(t,n){var i=Ne(),r=i.getContext("2d"),o=new(e().Shape.Rectangle)(new(e().Point),t.size);o.matrix=t.matrix,Kt(o,r),o.remove(),r.globalCompositeOperation="source-in";var s=t.matrix;r.transform(s.a,s.b,s.c,s.d,s.tx,s.ty);var a=t.canvas;t.data&&t.data.expanded&&(a=t.data.expanded.canvas),r.transform(1,0,0,1,-a.width/2,-a.height/2),r.drawImage(a,0,0),n.drawImage(i,new(e().Point))}(t,n))},ie=function(t,e){if(!t)return null;if("gradient"===t.type){var n,i=t.origin,r=t.destination;if(t.gradient.radial){var o=t.highlight,s=o||i,a=r.getDistance(i);if(o){var l=o.subtract(i);l.getLength()>a&&(o=i.add(l.normalize(a-.1)))}n=e.createRadialGradient(s.x,s.y,0,i.x,i.y,a)}else n=e.createLinearGradient(i.x,i.y,r.x,r.y);for(var c=t.gradient.stops,u=0,h=c.length;u<h;u++){var d=c[u],p=d.offset;n.addColorStop(p||u/(h-1),d.color.toCSS())}return n}return t.toCSS()},re=function(t,n){var i=Math.abs(t.size.width/2),r=Math.abs(t.size.height/2),o=n.getContext("2d"),s=0===t.strokeWidth,a=ie(s?t.fillColor:t.strokeColor,o);if(a){o.fillStyle=a;var l=function(t,e){var n=t.position.x,i=t.position.y,r=t.radiusX,o=t.radiusY,s=t.matrix,a=t.isFilled,l=t.thickness,c=null;if(!s.isInvertible())return!1;var u,h,d=s.clone().invert(),p=e.fillStyle instanceof CanvasGradient,f=e.canvas,g=f.width,m=f.height;if(p&&(h=Ne(g,m),u=e,e=h.getContext("2d")),!a){var y=Yt(l,p?"black":e.fillStyle),v=Math.ceil(l/2);c=function(t,n){e.drawImage(y,~~t-v,~~n-v)}}var b=d.a*d.a/r/r+d.b*d.b/o/o,I=2*d.a*d.c/r/r+2*d.b*d.d/o/o,A=d.c*d.c/r/r+d.d*d.d/o/o,M=1/Math.sqrt(A),w=Math.sqrt(-4*A/(I*I-4*b*A)),C=Gt({centerX:n,centerY:i,radiusX:w,radiusY:M,shearSlope:I/2/A,isFilled:a,drawFn:c},e);return p&&C&&(e.globalCompositeOperation="source-in",e.fillStyle=u.fillStyle,e.fillRect(0,0,g,m),u.drawImage(h,0,0)),C}({position:t.position,radiusX:i,radiusY:r,matrix:t.matrix,isFilled:s,thickness:t.strokeWidth/e().view.zoom},o);return l}},oe=function(t,n){var i=Ne(),r=i.getContext("2d"),o=0===t.strokeWidth,s=ie(o?t.fillColor:t.strokeColor,r);s&&(r.fillStyle=s,o?Kt(t,r):function(t,n,i){var r,o,s=Yt(n,i.fillStyle),a=Math.ceil(n/2),l=function(t,e){i.drawImage(s,~~t-a,~~e-a)},c=i.fillStyle instanceof CanvasGradient,u=i.canvas,h=u.width,d=u.height;c&&(o=Ne(h,d),r=i,i=o.getContext("2d"));var p=t.matrix.transform(new(e().Point)(-t.size.width/2,-t.size.height/2)),f=t.matrix.transform(new(e().Point)(t.size.width/2,-t.size.height/2)),g=t.matrix.transform(new(e().Point)(-t.size.width/2,t.size.height/2)),m=t.matrix.transform(new(e().Point)(t.size.width/2,t.size.height/2));Rt(p,f,l),Rt(p,g,l),Rt(m,f,l),Rt(m,g,l),c&&(i.globalCompositeOperation="source-in",i.fillStyle=r.fillStyle,i.fillRect(0,0,h,d),r.drawImage(o,0,0))}(t,t.strokeWidth/e().view.zoom,r),n.drawImage(i,new(e().Point)))},se=function(t){bt(t);var e=Ht(!0);e&&(e.selected=!0),_e()};function ae(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return le(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?le(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function le(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}var ce=960,ue=720,he=new(e().Point)(ce/2,ue/2),de=.333,pe=new(e().Rectangle)(0,0,ce,ue),fe=new(e().Rectangle)(-ce/4,-ue/4,1.5*ce,1.5*ue),ge=pe,me=function(t){var n=dt(),i=pe;t||(i=i.unite(e().view.bounds));var r,o=ae(n);try{for(o.s();!(r=o.n()).done;){var s=r.value;i=i.unite(s.bounds.expand(50))}}catch(t){o.e(t)}finally{o.f()}var a=(i=i.intersect(fe.expand(50))).top,l=i.left,c=i.bottom,u=i.right,h=0,d=0;i.width<e().view.bounds.width&&(l-=h=(e().view.bounds.width-i.width)/2,u+=h),i.height<e().view.bounds.height&&(a-=d=(e().view.bounds.height-i.height)/2,c+=d),ge=new(e().Rectangle)(l,a,u-l,c-a)},ye=function(){var t=e().project.view.bounds,n=t.left,i=t.right,r=t.top,o=t.bottom;n<ge.left&&e().project.view.scrollBy(new(e().Point)(ge.left-n,0)),r<ge.top&&e().project.view.scrollBy(new(e().Point)(0,ge.top-r)),o>ge.bottom&&e().project.view.scrollBy(new(e().Point)(0,ge.bottom-o)),i>ge.right&&e().project.view.scrollBy(new(e().Point)(ge.right-i,0)),me()},ve=function(){je()&&je().dragCrosshair&&je().dragCrosshair.scale(xe/je().dragCrosshair.bounds.width/e().view.zoom),ke()&&ke().dragCrosshair&&ke().dragCrosshair.scale(xe/ke().dragCrosshair.bounds.width/e().view.zoom)},be=function(t,n){var i=e().view,r=i.center,o=Math.max(de,i.zoom+t),s=i.zoom/o,a=n.subtract(r),l=n.subtract(a.multiply(s)).subtract(r);i.zoom=o,i.translate(l.multiply(-1)),me(!0),ye(),ve()},Ie=function(t){var n,i=It();if(i.length>0){var r,o=null,s=ae(i);try{for(s.s();!(r=s.n()).done;){var a=r.value;o=o?o.unite(a.bounds):a.bounds}}catch(t){s.e(t)}finally{s.f()}n=o.center}else n=e().project.view.center;be(t,n)},Ae=function(){e().project.view.zoom=.5,me(!0),ve(),ye()},Me=function(t,n){e().project.view.scrollBy(new(e().Point)(t,n)),ye()},we=function(t){return t?pe:e().view.bounds.unite(pe).intersect(fe)};function Ce(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Te(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Te(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Te(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}var xe=16,Se=function(t){var n,i=Ce(e().project.layers);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(r.data&&r.data[t])return r}}catch(t){i.e(t)}finally{i.f()}},De=function(){return Se("isPaintingLayer")},Ne=function(t,e){var n=document.createElement("canvas");return n.width=t||ce,n.height=e||ue,n.getContext("2d").imageSmoothingEnabled=!1,n},_e=function(){var t=Se("isRasterLayer");t.removeChildren();var n=new(e().Raster)(Ne());n.canvas.getContext("2d").imageSmoothingEnabled=!1,n.parent=t,n.guide=!0,n.locked=!0,n.position=he},Ee=function(){return 0===Se("isRasterLayer").children.length&&_e(),Se("isRasterLayer").children[0]},je=function(){return Se("isDragCrosshairLayer")},ke=function(){return Se("isBackgroundGuideLayer")},Oe=function(t,e){t.bitmapBackground.visible=M(e),t.vectorBackground.visible=A(e)},ze=function(){var t=new(e().Layer);return t.data.isGuideLayer=!0,t},Le=function(){var t=Se("isGuideLayer");return t||(t=ze(),De().activate()),t},Be=function(t){if(t.locked=!0,t.guide=!0,L(t))for(var e=0;e<t.children.length;e++)Be(t.children[e])},Pe=function(t){var e,n=ke(),i=je(),r=Se("isOutlineLayer"),o=Le();return i.remove(),r.remove(),o.remove(),n.remove(),t&&(e=Se("isRasterLayer")).remove(),{dragCrosshairLayer:i,outlineLayer:r,guideLayer:o,backgroundGuideLayer:n,rasterLayer:e}},Re=function(t){var n=t.backgroundGuideLayer,i=t.dragCrosshairLayer,r=t.outlineLayer,o=t.guideLayer,a=t.rasterLayer;a&&!a.index&&(e().project.addLayer(a),a.sendToBack()),n.index||(e().project.addLayer(n),n.sendToBack()),i.index||(e().project.addLayer(i),i.bringToFront()),r.index||(e().project.addLayer(r),r.bringToFront()),o.index||(e().project.addLayer(o),o.bringToFront()),e().project.activeLayer!==De()&&(s.error("Wrong active layer"),s.error(e().project.activeLayer.data))},Ue=function(t,n,i,r){for(var o=0,s=0,a=[];o<t;)a.push(new(e().Point)(o,s)),o++,a.push(new(e().Point)(o,s)),s=0===s?n:0;for(s=n-1,o=t;s>0;)a.push(new(e().Point)(o,s)),o=0===o?t:0,a.push(new(e().Point)(o,s)),s--;var l=new(e().Shape.Rectangle)(new(e().Point)(0,0),new(e().Point)(ce/8,ue/8));l.fillColor="#fff",l.guide=!0,l.locked=!0,l.position=he;var c=new(e().Path)(a);c.fillRule="evenodd",c.fillColor=i,c.opacity=r,c.guide=!0,c.locked=!0,c.position=he;var u=new(e().Shape.Rectangle)(fe);u.position=he,u.guide=!0,u.locked=!0,u.scale(1/8);var h=new(e().Group)([l,c,u]);return u.clipMask=!0,h},Ge=function(t,n){var i=new(e().Group),r=new(e().Path.Line)(new(e().Point)(0,-7),new(e().Point)(0,7));r.strokeWidth=6,r.strokeColor="white",r.strokeCap="round",i.addChild(r);var o=new(e().Path.Line)(new(e().Point)(-7,0),new(e().Point)(7,0));o.strokeWidth=6,o.strokeColor="white",o.strokeCap="round",i.addChild(o);var s=new(e().Shape.Circle)(new(e().Point)(0,0),5.5);s.strokeWidth=6,s.strokeColor="white",i.addChild(s);var a=new(e().Path.Line)(new(e().Point)(0,-7),new(e().Point)(0,7));a.strokeWidth=2,a.strokeColor="black",a.strokeCap="round",i.addChild(a);var l=new(e().Path.Line)(new(e().Point)(-7,0),new(e().Point)(7,0));l.strokeWidth=2,l.strokeColor="black",l.strokeCap="round",i.addChild(l);var c=new(e().Shape.Circle)(new(e().Point)(0,0),5.5);c.strokeWidth=2,c.strokeColor="black",i.addChild(c),Be(i),i.position=he,i.opacity=t,i.parent=n,i.applyMatrix=!1,n.dragCrosshair=i,i.scale(xe/i.bounds.width/e().view.zoom)},Ye=function(t){var n=function(t){var n=new(e().Layer);n.locked=!0;var i=new(e().Shape.Rectangle)(fe);i.fillColor="#ECF1F9",i.position=he;var r=Ue(fe.width/8,fe.height/8+1,"#D9E3F2",.55);r.position=he,r.scaling=new(e().Point)(8,8);var o=new(e().Group);o.addChild(i),o.addChild(r),Be(o),n.vectorBackground=o;var s=Ue(ce/8,ue/8,"#D9E3F2",.55);return s.position=he,s.scaling=new(e().Point)(8,8),s.guide=!0,s.locked=!0,n.bitmapBackground=s,Oe(n,t),Ge(.16,n),n.data.isBackgroundGuideLayer=!0,n}(t);(new(e().Layer)).data.isRasterLayer=!0,_e();var i,r=((i=new(e().Layer)).data.isPaintingLayer=!0,i),o=function(){var t=new(e().Layer);return Ge(.75,t),t.data.isDragCrosshairLayer=!0,t.visible=!1,t}(),s=function(){var t=new(e().Layer),n=new(e().Shape.Rectangle)(pe.expand(1));n.strokeWidth=2,n.strokeColor="white",Be(n);var i=new(e().Shape.Rectangle)(pe.expand(5));return i.strokeWidth=2,i.strokeColor="#4280D7",i.opacity=.25,Be(i),t.data.isOutlineLayer=!0,t}(),a=ze();n.sendToBack(),o.bringToFront(),s.bringToFront(),a.bringToFront(),r.activate()},Ze=function(t,n){n||s.error("Format must be specified.");var i=Pe();t({json:e().project.exportJSON({asString:!1}),paintEditorFormat:n}),Re(i)},We=function(t,n,i,r){for(var o=e().project.layers.length-1;o>=0;o--){var s=e().project.layers[o];s.data.isBackgroundGuideLayer||s.data.isDragCrosshairLayer||s.data.isOutlineLayer||(s.removeChildren(),s.remove())}e().project.importJSON(t.json),n();var a=[],l=function(){if(Ee().loaded){for(var t=0,e=a;t<e.length;t++){if(!e[t].loaded)return}i(!0)}};if(r){var c=At();1===c.length&&c[0]instanceof e().Raster&&(a.push(c[0]),c[0].data&&c[0].data.expanded instanceof e().Raster&&a.push(c[0].data.expanded))}Ee().onLoad=l;for(var u=0,h=a;u<h.length;u++){var d=h[u];d.onLoad=l,d.loaded&&d.onLoad()}},Qe="scratch-paint/undo/UNDO",He="scratch-paint/undo/REDO",Fe="scratch-paint/undo/SNAPSHOT",Ve="scratch-paint/undo/CLEAR",qe={stack:[],pointer:-1},Je=function(t){return{type:Fe,snapshot:t}},Xe="scratch-paint/select/CHANGE_SELECTED_ITEMS",Ke="scratch-paint/select/REDRAW_SELECTION_BOX",$e=[],tn=function(t,e){return{type:Xe,selectedItems:t,bitmapMode:e}},en=function(){return{type:Xe,selectedItems:[]}},nn="scratch-paint/hover/CHANGE_HOVERED",rn=function(t){return{type:nn,hoveredItemId:t}},on=function(){return{type:nn,hoveredItemId:null}},sn="scratch-paint/clipboard/SET",an="scratch-paint/clipboard/INCREMENT_PASTE_OFFSET",ln="scratch-paint/clipboard/CLEAR_PASTE_OFFSET",cn={items:[],pasteOffset:0},un="scratch-paint/formats/CHANGE_FORMAT",hn=function(t){return{type:un,format:t}},dn="scratch-paint/view/UPDATE_VIEW_BOUNDS",pn=new(e().Matrix),fn=function(t){return{type:dn,viewBounds:t.clone()}};function gn(t){return gn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gn(t)}function mn(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=gn(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=gn(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==gn(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var yn="scratch-paint/zoom-levels/SAVE_ZOOM_LEVEL",vn="scratch-paint/zoom-levels/SET_ZOOM_LEVEL_ID",bn={},In=p(72),An=p.n(In),Mn=p(825),wn=p.n(Mn),Cn=p(659),Tn=p.n(Cn),xn=p(56),Sn=p.n(xn),Dn=p(540),Nn=p.n(Dn),_n=p(113),En=p.n(_n),jn=p(765),kn=p.n(jn),On={};On.styleTagTransform=En(),On.setAttributes=Sn(),On.insert=Tn().bind(null,"head"),On.domAPI=wn(),On.insertStyleElement=Nn();An()(kn(),On);var zn=kn()&&kn().locals?kn().locals:void 0;function Ln(t){return Ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ln(t)}function Bn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Pn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Pn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function Rn(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Un(i.key),i)}}function Un(t){var e=function(t,e){if("object"!=Ln(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Ln(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ln(e)?e:e+""}function Gn(t,e,n){return e=Zn(e),function(t,e){if(e&&("object"==Ln(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Yn()?Reflect.construct(e,n||[],Zn(t).constructor):e.apply(t,n))}function Yn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Yn=function(){return!!t})()}function Zn(t){return Zn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zn(t)}function Wn(t,e){return Wn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wn(t,e)}var Qn=function(t){function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e=Gn(this,n,[t]),m()(e,["clearQueuedImport","setCanvas","importSvg","initializeSvg","maybeZoomToFit","switchCostume","onViewResize","recalibrateSize"]),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Wn(t,e)}(n,t),function(t,e,n){return e&&Rn(t.prototype,e),n&&Rn(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"componentDidMount",value:function(){e().setup(this.canvas),e().view.on("resize",this.onViewResize),Ae(),this.props.zoomLevelId?(this.props.setZoomLevelId(this.props.zoomLevelId),this.props.zoomLevels[this.props.zoomLevelId]?this.shouldZoomToFit=this.props.zoomLevels[this.props.zoomLevelId]:this.shouldZoomToFit=!0):this.props.updateViewBounds(e().view.matrix);var t=this.canvas.getContext("2d");t.webkitImageSmoothingEnabled=!1,t.imageSmoothingEnabled=!1,e().settings.handleSize=0,Ye(this.props.format),this.importImage(this.props.imageFormat,this.props.image,this.props.rotationCenterX,this.props.rotationCenterY)}},{key:"componentWillReceiveProps",value:function(t){var e;this.props.imageId!==t.imageId&&this.switchCostume(t.imageFormat,t.image,t.rotationCenterX,t.rotationCenterY,this.props.zoomLevelId,t.zoomLevelId),this.props.format!==t.format&&(this.recalibrateSize(),e=t.format,Oe(ke(),e))}},{key:"componentWillUnmount",value:function(){this.clearQueuedImport(),this.shouldZoomToFit||this.props.saveZoomLevel(),e().remove()}},{key:"clearQueuedImport",value:function(){this.queuedImport&&(window.clearTimeout(this.queuedImport),this.queuedImport=null),this.queuedImageToLoad&&(this.queuedImageToLoad.src="",this.queuedImageToLoad.onload=null,this.queuedImageToLoad=null)}},{key:"switchCostume",value:function(t,n,i,r,o,s){o&&o!==s&&this.props.saveZoomLevel(),s&&o!==s&&(this.props.zoomLevels[s]?this.shouldZoomToFit=this.props.zoomLevels[s]:this.shouldZoomToFit=!0,this.props.setZoomLevelId(s));var a,l=Bn(e().project.layers);try{for(l.s();!(a=l.n()).done;){var c=a.value;c.data.isRasterLayer?_e():c.data.isBackgroundGuideLayer||c.data.isDragCrosshairLayer||c.data.isOutlineLayer||c.removeChildren()}}catch(t){l.e(t)}finally{l.f()}this.props.clearUndo(),this.props.clearSelectedItems(),this.props.clearHoveredItem(),this.props.clearPasteOffset(),this.importImage(t,n,i,r)}},{key:"importImage",value:function(t,n,i,r){var o=this;if(this.clearQueuedImport(),!n)return this.props.changeFormat(I.VECTOR_SKIP_CONVERT),Ze(this.props.undoSnapshot,I.VECTOR_SKIP_CONVERT),void this.recalibrateSize();if("jpg"===t||"png"===t){this.props.changeFormat(I.BITMAP_SKIP_CONVERT);var a=new(e().Shape.Rectangle)(Ee().getBounds());a.guide=!0,a.locked=!0,a.setPosition(he),a.clipMask=!0;var l=new Image;this.queuedImageToLoad=l,l.onload=function(){o.queuedImageToLoad&&(o.queuedImageToLoad=null,void 0===i&&(i=l.width/2),void 0===r&&(r=l.height/2),Ee().drawImage(l,ce/2-i,ue/2-r),Ee().drawImage(l,ce/2-i,ue/2-r),o.maybeZoomToFit(!0),Ze(o.props.undoSnapshot,I.BITMAP_SKIP_CONVERT),o.recalibrateSize())},l.src=n}else"svg"===t?(this.props.changeFormat(I.VECTOR_SKIP_CONVERT),this.importSvg(n,i,r)):(s.error("Didn't recognize format: ".concat(t,". Use 'jpg', 'png' or 'svg'.")),this.props.changeFormat(I.VECTOR_SKIP_CONVERT),Ze(this.props.undoSnapshot,I.VECTOR_SKIP_CONVERT),this.recalibrateSize())}},{key:"maybeZoomToFit",value:function(t){this.shouldZoomToFit instanceof e().Matrix?(e().view.matrix=this.shouldZoomToFit,this.props.updateViewBounds(e().view.matrix),ve()):!0===this.shouldZoomToFit&&function(t){var n;if(Ae(),t)n=Qt(Ee()).expand(50);else{var i,r=ae(dt());try{for(r.s();!(i=r.n()).done;){var o=i.value;n=n?n.unite(o.bounds):o.bounds}}catch(t){r.e(t)}finally{r.f()}}if(n&&n.width&&n.height){var a=e().view.element,l=e().view.zoom*Math.max(1.5*n.width/a.clientWidth,1.5*n.height/a.clientHeight);(l=Math.max(Math.min(1,l),.125))<1&&(e().view.center=n.center,e().view.zoom=e().view.zoom/l,ve(),ye())}else s.warn("No bounds!")}(t),this.shouldZoomToFit=!1,me(),this.props.updateViewBounds(e().view.matrix)}},{key:"importSvg",value:function(t,n,i){var r=this,o=(t=(t=t.split(/<\s*svg:/).join("<")).split(/<\/\s*svg:/).join("</")).match(/<svg [^>]*>/);o&&-1===o[0].indexOf("xmlns=")&&(t=t.replace("<svg ",'<svg xmlns="http://www.w3.org/2000/svg" ')),t=y.sanitizeSvg.sanitizeSvgText(t);var a=(new DOMParser).parseFromString(t,"text/xml"),l=function(t){for(var e=!1,n=t.querySelectorAll("[data-paper-data]"),i=0;i<n.length;i++)try{JSON.parse(n[i].getAttribute("data-paper-data"))}catch(t){n[i].removeAttribute("data-paper-data"),e=!0}return e}(a),c=a.documentElement.attributes.viewBox?a.documentElement.attributes.viewBox.value.match(/\S+/g):null;if(c)for(var u=0;u<c.length;u++)c[u]=parseFloat(c[u]);l&&(t=(new XMLSerializer).serializeToString(a)),e().project.importSVG(t,{expandShapes:!0,onLoad:function(o){if(!o)return s.error("SVG import failed:"),s.info(t),this.props.changeFormat(I.VECTOR_SKIP_CONVERT),void Ze(r.props.undoSnapshot,I.VECTOR_SKIP_CONVERT);o.remove(),r.queuedImport=r.recalibrateSize(function(){r.props.updateViewBounds(e().view.matrix),r.initializeSvg(o,n,i,c)})}})}},{key:"initializeSvg",value:function(t,n,i,r){this.queuedImport&&(this.queuedImport=null);var o,s=t.bounds.width,a=t.bounds.height;if(t.clipped){var l,c=Bn(t.children);try{for(c.s();!(l=c.n()).done;){var u=l.value;if(u.isClipMask()){o=u;break}}}catch(t){c.e(t)}finally{c.f()}o.clipMask=!1}else o=new(e().Shape.Rectangle)(t.bounds);if(o.guide=!0,o.locked=!0,o.matrix=new(e().Matrix),o.size.height=fe.height,o.size.width=fe.width,o.setPosition(he),e().project.activeLayer.addChild(o),o.clipMask=!0,t instanceof e().Group&&1===t.children.length&&(t=t.reduce()),nt(t),it(t,2,new(e().Point)),void 0!==n&&void 0!==i){var h=new(e().Point)(n,i);r&&r.length>=2&&!isNaN(r[0])&&!isNaN(r[1])&&(h=h.subtract(r[0],r[1])),t.translate(he.subtract(h.multiply(2)))}else t.translate(he.subtract(s,a));if(e().project.activeLayer.insertChild(0,t),R(t)){var d,p=Bn(t.children);try{for(p.s();!(d=p.n()).done;){var f=d.value;R(f)&&0===f.children.length&&f.remove()}}catch(t){p.e(t)}finally{p.f()}Y([t])}Ze(this.props.undoSnapshot,I.VECTOR_SKIP_CONVERT),this.maybeZoomToFit()}},{key:"onViewResize",value:function(){me(!0),ye(),this.recalibrateSize(),this.props.updateViewBounds(e().view.matrix)}},{key:"recalibrateSize",value:function(t){return window.setTimeout(function(){if(e().view){var n=e().DomElement.getSize(e().view.element);n.width=Math.round(n.width),n.height=Math.round(n.height),e().view.setViewSize(n),t&&t()}},0)}},{key:"setCanvas",value:function(t){this.canvas=t,this.props.canvasRef&&this.props.canvasRef(t)}},{key:"render",value:function(){return l().createElement("canvas",{className:zn.paperCanvas,ref:this.setCanvas,style:{cursor:this.props.cursor},resize:"true"})}}])}(l().Component);Qn.propTypes={canvasRef:i().func,changeFormat:i().func.isRequired,clearHoveredItem:i().func.isRequired,clearPasteOffset:i().func.isRequired,clearSelectedItems:i().func.isRequired,clearUndo:i().func.isRequired,cursor:i().string,format:i().oneOf(Object.keys(I)),image:i().oneOfType([i().string,i().instanceOf(HTMLImageElement)]),imageFormat:i().string,imageId:i().string,rotationCenterX:i().number,rotationCenterY:i().number,saveZoomLevel:i().func.isRequired,setZoomLevelId:i().func.isRequired,undoSnapshot:i().func.isRequired,updateViewBounds:i().func.isRequired,zoomLevelId:i().string,zoomLevels:i().shape({currentZoomLevelId:i().string})};var Hn=(0,c.connect)(function(t){return{mode:t.scratchPaint.mode,cursor:t.scratchPaint.cursor,format:t.scratchPaint.format,zoomLevels:t.scratchPaint.zoomLevels}},function(t){return{undoSnapshot:function(e){t(Je(e))},clearUndo:function(){t({type:Ve})},clearSelectedItems:function(){t(en())},clearHoveredItem:function(){t(on())},clearPasteOffset:function(){t({type:ln})},changeFormat:function(e){t(hn(e))},saveZoomLevel:function(){var n;t(((n=e().view.matrix)instanceof e().Matrix||s.warn("Not a matrix: ".concat(n)),{type:yn,zoomLevel:new(e().Matrix)(n)}))},setZoomLevelId:function(e){t(function(t){return{type:vn,zoomLevelId:t}}(e))},updateViewBounds:function(e){t(fn(e))}}})(Qn),Fn=p(705),Vn=p.n(Fn),qn={};qn.styleTagTransform=En(),qn.setAttributes=Sn(),qn.insert=Tn().bind(null,"head"),qn.domAPI=wn(),qn.insertStyleElement=Nn();An()(Vn(),qn);var Jn=Vn()&&Vn().locals?Vn().locals:void 0,Xn=function(t){return l().createElement("div",{className:t.style},t.children,l().createElement("div",{className:Jn.horizontalScrollbarWrapper,style:{pointerEvents:"none"}},l().createElement("div",{className:Jn.horizontalScrollbarHitbox,style:{width:"".concat(t.horizontalScrollLengthPercent,"%"),left:"".concat(t.horizontalScrollStartPercent,"%"),pointerEvents:"auto",display:"".concat(t.hideScrollbars||Math.abs(t.horizontalScrollLengthPercent-100)<1e-8?"none":"block")},onMouseDown:t.onHorizontalScrollbarMouseDown,onTouchStart:t.onHorizontalScrollbarMouseDown},l().createElement("div",{className:Jn.horizontalScrollbar}))),l().createElement("div",{className:Jn.verticalScrollbarWrapper,style:{pointerEvents:"none"}},l().createElement("div",{className:Jn.verticalScrollbarHitbox,style:{height:"".concat(t.verticalScrollLengthPercent,"%"),top:"".concat(t.verticalScrollStartPercent,"%"),pointerEvents:"auto",display:"".concat(t.hideScrollbars||Math.abs(t.verticalScrollLengthPercent-100)<1e-8?"none":"block")},onMouseDown:t.onVerticalScrollbarMouseDown,onTouchStart:t.onVerticalScrollbarMouseDown},l().createElement("div",{className:Jn.verticalScrollbar}))))};Xn.propTypes={children:i().node.isRequired,hideScrollbars:i().bool,horizontalScrollLengthPercent:i().number,horizontalScrollStartPercent:i().number,onHorizontalScrollbarMouseDown:i().func.isRequired,onVerticalScrollbarMouseDown:i().func.isRequired,style:i().string,verticalScrollLengthPercent:i().number,verticalScrollStartPercent:i().number};var Kn=Xn,$n=function(t){return t.touches&&t.touches[0]?{x:t.touches[0].clientX,y:t.touches[0].clientY}:t.changedTouches&&t.changedTouches[0]?{x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY}:{x:t.clientX,y:t.clientY}};function ti(t){return ti="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ti(t)}function ei(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,ni(i.key),i)}}function ni(t){var e=function(t,e){if("object"!=ti(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=ti(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ti(e)?e:e+""}function ii(t,e,n){return e=oi(e),function(t,e){if(e&&("object"==ti(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ri()?Reflect.construct(e,n||[],oi(t).constructor):e.apply(t,n))}function ri(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ri=function(){return!!t})()}function oi(t){return oi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},oi(t)}function si(t,e){return si=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},si(t,e)}var ai=function(t){function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e=ii(this,n,[t]),m()(e,["handleHorizontalScrollbarMouseDown","handleHorizontalScrollbarMouseMove","handleHorizontalScrollbarMouseUp","handleVerticalScrollbarMouseDown","handleVerticalScrollbarMouseMove","handleVerticalScrollbarMouseUp","handleWheel"]),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&si(t,e)}(n,t),function(t,e,n){return e&&ei(t.prototype,e),n&&ei(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"componentDidMount",value:function(){this.props.canvas&&this.props.canvas.addEventListener("wheel",this.handleWheel)}},{key:"componentWillReceiveProps",value:function(t){t.canvas&&(this.props.canvas&&this.props.canvas.removeEventListener("wheel",this.handleWheel),t.canvas.addEventListener("wheel",this.handleWheel))}},{key:"handleHorizontalScrollbarMouseDown",value:function(t){this.initialMouseX=$n(t).x,this.initialScreenX=e().view.matrix.tx,window.addEventListener("mousemove",this.handleHorizontalScrollbarMouseMove),window.addEventListener("touchmove",this.handleHorizontalScrollbarMouseMove,{passive:!1}),window.addEventListener("mouseup",this.handleHorizontalScrollbarMouseUp),window.addEventListener("touchend",this.handleHorizontalScrollbarMouseUp),t.preventDefault()}},{key:"handleHorizontalScrollbarMouseMove",value:function(t){var n=this.initialMouseX-$n(t).x;e().view.matrix.tx=this.initialScreenX+n*e().view.zoom*2,ye(),this.props.updateViewBounds(e().view.matrix),t.preventDefault()}},{key:"handleHorizontalScrollbarMouseUp",value:function(){window.removeEventListener("mousemove",this.handleHorizontalScrollbarMouseMove),window.removeEventListener("touchmove",this.handleHorizontalScrollbarMouseMove,{passive:!1}),window.removeEventListener("mouseup",this.handleHorizontalScrollbarMouseUp),window.removeEventListener("touchend",this.handleHorizontalScrollbarMouseUp),this.initialMouseX=null,this.initialScreenX=null,event.preventDefault()}},{key:"handleVerticalScrollbarMouseDown",value:function(t){this.initialMouseY=$n(t).y,this.initialScreenY=e().view.matrix.ty,window.addEventListener("mousemove",this.handleVerticalScrollbarMouseMove),window.addEventListener("touchmove",this.handleVerticalScrollbarMouseMove,{passive:!1}),window.addEventListener("mouseup",this.handleVerticalScrollbarMouseUp),window.addEventListener("touchend",this.handleVerticalScrollbarMouseUp),t.preventDefault()}},{key:"handleVerticalScrollbarMouseMove",value:function(t){var n=this.initialMouseY-$n(t).y;e().view.matrix.ty=this.initialScreenY+n*e().view.zoom*2,ye(),this.props.updateViewBounds(e().view.matrix),t.preventDefault()}},{key:"handleVerticalScrollbarMouseUp",value:function(t){window.removeEventListener("mousemove",this.handleVerticalScrollbarMouseMove),window.removeEventListener("touchmove",this.handleVerticalScrollbarMouseMove,{passive:!1}),window.removeEventListener("mouseup",this.handleVerticalScrollbarMouseUp),window.removeEventListener("touchend",this.handleVerticalScrollbarMouseUp),this.initialMouseY=null,this.initialScreenY=null,t.preventDefault()}},{key:"handleWheel",value:function(t){var n=1===t.deltaMode?15:1,i=t.deltaX*n,r=t.deltaY*n,o=this.props.canvas.getBoundingClientRect(),s=t.clientX-o.left,a=t.clientY-o.top,l=e().view.viewToProject(new(e().Point)(s,a));if(t.metaKey||t.ctrlKey)be(-r/1e3,l),this.props.updateViewBounds(e().view.matrix),this.props.redrawSelectionBox();else if(t.shiftKey&&0===t.deltaX){var c=r/e().view.zoom;Me(c,0),this.props.updateViewBounds(e().view.matrix)}else{var u=i/e().view.zoom,h=r/e().view.zoom;Me(u,h),this.props.updateViewBounds(e().view.matrix),e().tool&&e().tool.view._handleMouseEvent("mousemove",t,l)}t.preventDefault()}},{key:"render",value:function(){var t=0,n=0,i=0,r=0;if(e().project){var o=ge,s=e().view.bounds,a=s.x,c=s.y,u=s.width,h=s.height;t=Math.min(100,100*u/o.width),n=Math.min(100,100*h/o.height);var d=(a+u/2-o.x)/o.width,p=(c+h/2-o.y)/o.height;i=Math.max(0,100*p-n/2),r=Math.max(0,100*d-t/2)}return l().createElement(Kn,{hideScrollbars:this.props.hideScrollbars,horizontalScrollLengthPercent:t,horizontalScrollStartPercent:r,style:this.props.style,verticalScrollLengthPercent:n,verticalScrollStartPercent:i,onHorizontalScrollbarMouseDown:this.handleHorizontalScrollbarMouseDown,onVerticalScrollbarMouseDown:this.handleVerticalScrollbarMouseDown},this.props.children)}}],[{key:"ZOOM_INCREMENT",get:function(){return.5}}])}(l().Component);ai.propTypes={canvas:i().instanceOf(Element),children:i().node.isRequired,hideScrollbars:i().bool,redrawSelectionBox:i().func.isRequired,style:i().string,updateViewBounds:i().func.isRequired};var li=(0,c.connect)(function(t){return{viewBounds:t.scratchPaint.viewBounds}},function(t){return{redrawSelectionBox:function(){t({type:Ke})},updateViewBounds:function(e){t(fn(e))}}})(ai),ci=b()({SOLID:null,HORIZONTAL:null,VERTICAL:null,RADIAL:null});function ui(t){return ui="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ui(t)}function hi(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function di(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?hi(Object(n),!0).forEach(function(e){pi(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):hi(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function pi(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=ui(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=ui(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ui(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var fi=/^#([0-9a-f]{3}){1,2}$/i,gi=function(t){return!(!fi.test(t)&&null!==t&&t!==Di)||(s.warn("Invalid hex color code: ".concat(t)),!1)},mi=function(t){var e=t.changePrimaryColorAction,n=t.changeSecondaryColorAction,i=t.changeGradientTypeAction,r=t.clearGradientAction,o=t.defaultColor,a=t.selectionPrimaryColorKey,l=t.selectionSecondaryColorKey,c=t.selectionGradientTypeKey;return function(t,u){switch(void 0===t&&(t={primary:o,secondary:null,gradientType:ci.SOLID}),u.type){case e:return gi(u.color)?di(di({},t),{},{primary:u.color}):t;case n:return gi(u.color)?di(di({},t),{},{secondary:u.color}):t;case Xe:if(!u.selectedItems||!u.selectedItems.length)return t;var h=Bi(u.selectedItems,u.bitmapMode),d=di({},t);return a in h&&(d.primary=h[a]),c in h&&(d.gradientType=h[c]),!(l in h)||h[c]===ci.SOLID&&h[l]!==Di||(d.secondary=h[l]),d;case i:return u.gradientType in ci?di(di({},t),{},{gradientType:u.gradientType}):(s.warn("Gradient type does not exist: ".concat(u.gradientType)),t);case r:return di(di({},t),{},{secondary:null,gradientType:ci.SOLID});default:return t}}},yi="scratch-paint/fill-style/CHANGE_FILL_COLOR",vi="scratch-paint/fill-style/CHANGE_FILL_COLOR_2",bi="scratch-paint/fill-style/CHANGE_FILL_GRADIENT_TYPE",Ii="scratch-paint/fill-style/CLEAR_FILL_GRADIENT",Ai="#9966FF",Mi=mi({changePrimaryColorAction:yi,changeSecondaryColorAction:vi,changeGradientTypeAction:bi,clearGradientAction:Ii,defaultColor:Ai,selectionPrimaryColorKey:"fillColor",selectionSecondaryColorKey:"fillColor2",selectionGradientTypeKey:"fillGradientType"}),wi=function(t){return{type:yi,color:t}},Ci=function(t){return{type:vi,color:t}},Ti=function(){return{type:Ii}};function xi(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Si(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Si(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Si(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}var Di="scratch-paint/style-path/mixed",Ni=function(t,n){return(!t||"gradient"!==t.type)&&(!t&&!n||t&&n&&t.toCSS()===new(e().Color)(n).toCSS())},_i=function(t){var e=At();if(t){var n=ht({match:function(e){return e.id===t}});n.length&&e.push(n[0])}return e},Ei=function(t){var n=new(e().Color)(t);return n.alpha=0,n.toCSS()},ji=function(t){if(t===Di)return null;var n=new(e().Color)(t);if(!t||0===n.alpha)return Ai;n.type="hsb";var i=n.saturation<=.15;return(i||n.brightness<=.4)&&(n.brightness=n.brightness<.55?1:.1),i||(n.hue-=72),n.toCSS(!0)},ki=function(t,n,i,r,o,s){if(i===ci.SOLID)return t;var a,l;switch(null===t&&(t=Ei(n)),null===n&&(n=Ei(t)),s||(s=.01),i){case ci.HORIZONTAL:a=r.leftCenter.clone(),l=r.rightCenter.clone();var c=Math.abs(l.x-a.x);if(c<s){var u=(s-c)/2;l.x+=u,a.x-=u}break;case ci.VERTICAL:a=r.topCenter.clone(),l=r.bottomCenter.clone();var h=Math.abs(l.y-a.y);if(h<s){var d=(s-h)/2;l.y+=d,a.y-=d}break;case ci.RADIAL:var p=Math.max(r.width,r.height)/2;l=(a=o||r.center).add(new(e().Point)(Math.max(p,s/2),0))}return{gradient:{stops:[t,n],radial:i===ci.RADIAL},origin:a,destination:l}},Oi=function(t,n,i,r,o){var s,a=!1,l=xi(_i(o));try{for(l.s();!(s=l.n()).done;){var c=s.value;c.parent instanceof e().CompoundPath&&(c=c.parent);var u=r?"strokeColor":"fillColor",h=c[u];if(!i&&h&&h.gradient&&2!==!h.gradient.stops.length){if(!Ni(h.gradient.stops[n].color,t)){a=!0;var d=0===n?1:0;null===t&&(t=Ei(h.gradient.stops[d].color.toCSS()));var p=[0,0];p[n]=t,0===h.gradient.stops[d].color.alpha?p[d]=Ei(t):p[d]=h.gradient.stops[d].color.toCSS(),h.gradient={stops:p,radial:h.gradient.radial}}}else Ni(h,t)||(a=!0,B(c)&&!t?c[u]="rgba(0,0,0,0)":c[u]=t)}}catch(t){l.e(t)}finally{l.f()}return a},zi=function(t,n){var i,r=!1,o=xi(_i(n));try{for(o.s();!(i=o.n()).done;){var s=i.value;s.parent instanceof e().CompoundPath&&(s=s.parent),R(s)||s.strokeWidth!==t&&(s.strokeWidth=t,r=!0)}}catch(t){o.e(t)}finally{o.f()}return r},Li=function(t){var e={};return 2===t.stops.length?(t.radial?e.gradientType=ci.RADIAL:e.gradientType=ci.HORIZONTAL,e.primary=0===t.stops[0].color.alpha?null:t.stops[0].color.toCSS(),e.secondary=0===t.stops[1].color.alpha?null:t.stops[1].color.toCSS()):(t.stops.length<2&&s.warn("Gradient has ".concat(t.stops.length," stop(s)")),e.primary=Di,e.secondary=Di),e},Bi=function(t,n){var i,r,o,s,a,l,c,u,h,d=!0,p=xi(t);try{for(p.s();!(h=p.n()).done;){var f=h.value;f.parent instanceof e().CompoundPath&&(f=f.parent);var g=void 0,m=void 0,y=void 0,v=void 0,b=ci.SOLID,I=ci.SOLID;if(!R(f)){if(f.fillColor)if(B(f)&&0===f.fillColor.alpha)g=null;else if("gradient"===f.fillColor.type){var A=Li(f.fillColor.gradient),M=A.primary,w=A.secondary,C=A.gradientType;g=M,m=w,b=C}else g=0===f.fillColor.alpha?null:f.fillColor.toCSS(),m=null;if(f.strokeColor)if("gradient"===f.strokeColor.type){var T=Li(f.strokeColor.gradient),x=T.primary,S=T.secondary,D=T.gradientType,N=x,_=S,E=D;f.strokeWidth||(N=null,E=ci.SOLID),n?(g=N,m=_,b=E):(y=N,v=_,I=E)}else{var j=0!==f.strokeColor.alpha&&f.strokeWidth?f.strokeColor.toCSS():null;n?g=j:y=j}else y=null,v=null;d&&(d=!1,i=g,r=m,o=y,s=v,c=b,u=I,a=y||v?f.strokeWidth:0,f.strokeWidth&&f.data&&f.data.zoomLevel&&(l=f.strokeWidth/f.data.zoomLevel)),g!==i&&(i=Di),m!==r&&(r=Di),b!==c&&(c=ci.SOLID,i=Di,r=Di),I!==u&&(u=ci.SOLID,o=Di,s=Di),y!==o&&(o=Di),v!==s&&(s=Di),a!==(y||v?f.strokeWidth:0)&&(a=null)}}}catch(t){p.e(t)}finally{p.f()}if(t&&t.length){var k=t[0];if(k.parent instanceof e().CompoundPath&&(k=k.parent),c!==ci.SOLID){var O=n&&k.strokeColor?k.strokeColor:k.fillColor,z=O.destination.subtract(O.origin);90===Math.abs(z.angle)&&(c=ci.VERTICAL)}if(u!==ci.SOLID){var L=k.strokeColor.destination.subtract(k.strokeColor.origin);90===Math.abs(L.angle)&&(u=ci.VERTICAL)}}return n?{fillColor:i||null,fillColor2:r||null,fillGradientType:c,thickness:l}:{fillColor:i||null,fillColor2:r||null,fillGradientType:c,strokeColor:o||null,strokeColor2:s||null,strokeGradientType:u,strokeWidth:a||null===a?a:0}},Pi=function(t,e){e.isEraser?t.fillColor="white":e.fillColor?t.fillColor=e.fillColor:t.fillColor="black"},Ri=function(t,e){e.isEraser?(t.fillColor="white",t.strokeColor="cornflowerblue",t.strokeWidth=1):e.fillColor?t.fillColor=e.fillColor:t.fillColor="black"},Ui=function(t,e){for(var n=0,i=["fillColor","strokeColor"];n<i.length;n++){var r=i[n];if(null===e[r])t[r]=null;else if(e[r].gradientType===ci.SOLID)t[r]=e[r].primary;else{var o=e[r],s=o.primary,a=o.secondary,l=o.gradientType;t[r]=ki(s,a,l,t.bounds,null,e.strokeWidth)}}Object.prototype.hasOwnProperty.call(e,"strokeWidth")&&(t.strokeWidth=e.strokeWidth)},Gi="scratch-paint/modes/CHANGE_MODE",Yi=E.SELECT,Zi=function(t){return{type:Gi,mode:t}},Wi=p(559),Qi=p.n(Wi),Hi={};Hi.styleTagTransform=En(),Hi.setAttributes=Sn(),Hi.insert=Tn().bind(null,"head"),Hi.domAPI=wn(),Hi.insertStyleElement=Nn();An()(Qi(),Hi);var Fi=Qi()&&Qi().locals?Qi().locals:void 0;function Vi(t){return Vi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vi(t)}var qi=["className","highlighted","onClick","children"];function Ji(){return Ji=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ji.apply(null,arguments)}function Xi(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=Vi(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Vi(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Vi(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ki=function(t){var e=t.className,n=t.highlighted,i=t.onClick,r=t.children,o=function(t,e){if(null==t)return{};var n,i,r=function(t,e){if(null==t)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;n[i]=t[i]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)n=o[i],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}(t,qi),s=o.disabled||!1;return!1===s&&(o.onClick=i),l().createElement("span",Ji({className:h()(Fi.button,e,Xi(Xi({},Fi.modDisabled,s),Fi.highlighted,n)),role:"button"},o),r)};Ki.propTypes={children:i().node,className:i().string,disabled:i().oneOfType([i().string,i().bool]),highlighted:i().bool,onClick:i().func.isRequired};var $i=Ki,tr=p(665),er=p.n(tr),nr={};nr.styleTagTransform=En(),nr.setAttributes=Sn(),nr.insert=Tn().bind(null,"head"),nr.domAPI=wn(),nr.insertStyleElement=Nn();An()(er(),nr);var ir=er()&&er().locals?er().locals:void 0;function rr(t){return rr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rr(t)}function or(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=rr(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=rr(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==rr(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var sr=function(t){var e=(0,d.useIntl)();return l().createElement($i,{className:h()(t.className,ir.modToolSelect,or({},ir.isSelected,t.isSelected)),disabled:t.disabled,title:e.formatMessage(t.imgDescriptor),onClick:t.onMouseDown},l().createElement("img",{alt:e.formatMessage(t.imgDescriptor),className:ir.toolSelectIcon,draggable:!1,src:t.imgSrc}))};sr.propTypes={className:i().string,disabled:i().bool,imgDescriptor:i().shape({defaultMessage:i().string,description:i().string,id:i().string}).isRequired,imgSrc:i().string.isRequired,isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var ar=sr,lr=(0,d.defineMessages)({brush:{id:"paint.brushMode.brush",defaultMessage:"Brush"},eraser:{id:"paint.eraserMode.eraser",defaultMessage:"Eraser"},fill:{id:"paint.fillMode.fill",defaultMessage:"Fill"},line:{id:"paint.lineMode.line",defaultMessage:"Line"},oval:{id:"paint.ovalMode.oval",defaultMessage:"Circle"},rect:{id:"paint.rectMode.rect",defaultMessage:"Rectangle"},reshape:{id:"paint.reshapeMode.reshape",defaultMessage:"Reshape"},roundedRect:{id:"paint.roundedRectMode.roundedRect",defaultMessage:"Rounded Rectangle"},select:{id:"paint.selectMode.select",defaultMessage:"Select"},text:{id:"paint.textMode.text",defaultMessage:"Text"}}),cr="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ5LjMgKDUxMTY3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5icnVzaDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJicnVzaCIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPHBhdGggZD0iTTkuNTAwNjI2NjMsMTEuNDk4MTczNCBMMTAuNDk5NTczNCwxMS40OTgxNzM0IEwxMC40OTk1NzM0LDE0LjQ5OTAxMzQgTDkuNDk5NjI2NjksMTQuNDk5MDEzNCBMOS40OTk2MjY2OSwxMS40OTkxNzM0IEw2LjQ5OTc4NjY4LDExLjQ5OTE3MzQgTDYuNDk5Nzg2NjgsMTAuNDk5MjI2NyBMOS41MDA2MjY2MywxMC40OTkyMjY3IEw5LjUwMDYyNjYzLDExLjQ5ODE3MzQgWiBNMTMuNDk5MjEzNCwzLjUgTDE2LjUwMDA1MzMsMy41IEwxNi41MDAwNTMzLDQuNDk5OTQ2NjcgTDE3LjUsNC40OTk5NDY2NyBMMTcuNSw3LjQ5OTc4NjY4IEwxNi41MDAwNTMzLDcuNDk5Nzg2NjggTDE2LjUwMDA1MzMsOC40OTg3MzM0IEwxNS40OTkxMDY3LDguNDk4NzMzNCBMMTUuNDk5MTA2Nyw5LjQ5ODY4MDA3IEwxNC40OTkxNiw5LjQ5ODY4MDA3IEwxNC40OTkxNiwxMC40OTg2MjY3IEwxMi40OTkyNjY3LDEwLjQ5ODYyNjcgTDEyLjQ5OTI2NjcsMTEuNDk4NTczNCBMMTEuNDk5MzIsMTEuNDk4NTczNCBMMTEuNDk5MzIsMTAuNDk4NjI2NyBMMTAuNDk5MzczNCwxMC40OTg2MjY3IEwxMC40OTkzNzM0LDkuNDk4NjgwMDcgTDkuNDk5NDI2Nyw5LjQ5ODY4MDA3IEw5LjQ5OTQyNjcsNy40OTk3ODY2OCBMMTAuNDk5MzczNCw3LjQ5OTc4NjY4IEwxMC40OTkzNzM0LDYuNDk5ODQwMDEgTDExLjQ5OTMyLDYuNDk5ODQwMDEgTDExLjQ5OTMyLDUuNDk5ODkzMzQgTDEyLjQ5OTI2NjcsNS40OTk4OTMzNCBMMTIuNDk5MjY2Nyw0LjQ5OTk0NjY3IEwxMy40OTkyMTM0LDQuNDk5OTQ2NjcgTDEzLjQ5OTIxMzQsMy41IFogTTUuNDk5NTQwMDIsMTEuNDk4NzczNCBMNi40OTk0ODY2OSwxMS40OTg3NzM0IEw2LjQ5OTQ4NjY5LDEyLjQ5OTcyIEw3LjUwMDQzMzMxLDEyLjQ5OTcyIEw3LjUwMDQzMzMxLDEzLjQ5OTY2NjcgTDguNTAwMzc5OTgsMTMuNDk5NjY2NyBMOC41MDAzNzk5OCwxNC40OTk2MTM0IEw5LjUwMDMyNjY1LDE0LjQ5OTYxMzQgTDkuNTAwMzI2NjUsMTUuNDk5NTYgTDguNTAwMzc5OTgsMTUuNDk5NTYgTDguNTAwMzc5OTgsMTYuNDk4NTA2NyBMNC40OTk1OTMzNiwxNi40OTg1MDY3IEw0LjQ5OTU5MzM2LDE1LjQ5OTU2IEwzLjQ5OTY0NjY5LDE1LjQ5OTU2IEwzLjQ5OTY0NjY5LDEzLjQ5OTY2NjcgTDUuNDk5NTQwMDIsMTMuNDk5NjY2NyBMNS40OTk1NDAwMiwxMS40OTg3NzM0IFogTTIuNSwxMy40OTkwNjY3IEwyLjUsMTIuNDk5MTIgTDMuNDk5OTQ2NjcsMTIuNDk5MTIgTDMuNDk5OTQ2NjcsMTMuNDk5MDY2NyBMMi41LDEzLjQ5OTA2NjcgWiIgaWQ9IkNvbWJpbmVkLVNoYXBlIiBmaWxsPSIjNTc1RTc1Ij48L3BhdGg+CiAgICA8L2c+Cjwvc3ZnPg==",ur=function(t){return l().createElement(ar,{imgDescriptor:lr.brush,imgSrc:cr,isSelected:t.isSelected,onMouseDown:t.onMouseDown})};ur.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var hr=ur;function dr(t){return dr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dr(t)}function pr(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,fr(i.key),i)}}function fr(t){var e=function(t,e){if("object"!=dr(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=dr(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==dr(e)?e:e+""}function gr(t,e,n){return e=yr(e),function(t,e){if(e&&("object"==dr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,mr()?Reflect.construct(e,n||[],yr(t).constructor):e.apply(t,n))}function mr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(mr=function(){return!!t})()}function yr(t){return yr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yr(t)}function vr(t,e){return vr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vr(t,e)}var br=function(t){function n(t,e){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(i=gr(this,n)).onUpdateImage=t,i.isEraser=e,i.onMouseMove=i.handleMouseMove,i.onMouseDown=i.handleMouseDown,i.onMouseDrag=i.handleMouseDrag,i.onMouseUp=i.handleMouseUp,i.colorState=null,i.active=!1,i.lastPoint=null,i.cursorPreview=null,i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vr(t,e)}(n,t),function(t,e,n){return e&&pr(t.prototype,e),n&&pr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"setColor",value:function(t){this.color=t,this.tmpCanvas=Yt(this.size,this.color,this.isEraser||!this.color)}},{key:"setBrushSize",value:function(t){this.size=Math.max(1,~~t),this.tmpCanvas=Yt(this.size,this.color,this.isEraser||!this.color)}},{key:"draw",value:function(t,n){var i=Math.ceil(this.size/2),r=Ee().getContext("2d");!this.isEraser&&this.color||(r.globalCompositeOperation="destination-out"),Ee().drawImage(this.tmpCanvas,new(e().Point)(~~t-i,~~n-i)),!this.isEraser&&this.color||(r.globalCompositeOperation="source-over")}},{key:"updateCursorIfNeeded",value:function(){this.size&&(this.cursorPreview&&!this.cursorPreview.parent&&(this.cursorPreview=null),this.cursorPreview&&this.lastSize===this.size&&this.lastColor===this.color||(this.cursorPreview&&this.cursorPreview.remove(),this.tmpCanvas=Yt(this.size,this.color,this.isEraser||!this.color),this.cursorPreview=new(e().Raster)(this.tmpCanvas),this.cursorPreview.guide=!0,this.cursorPreview.parent=Le(),this.cursorPreview.data.isHelperItem=!0),this.lastSize=this.size,this.lastColor=this.color)}},{key:"handleMouseMove",value:function(t){this.updateCursorIfNeeded(),this.cursorPreview.position=new(e().Point)(~~t.point.x,~~t.point.y)}},{key:"handleMouseDown",value:function(t){t.event.button>0||(this.active=!0,this.cursorPreview&&this.cursorPreview.remove(),this.draw(t.point.x,t.point.y),this.lastPoint=t.point)}},{key:"handleMouseDrag",value:function(t){t.event.button>0||!this.active||(Rt(this.lastPoint,t.point,this.draw.bind(this)),this.lastPoint=t.point)}},{key:"handleMouseUp",value:function(t){t.event.button>0||!this.active||(Rt(this.lastPoint,t.point,this.draw.bind(this)),this.onUpdateImage(),this.lastPoint=null,this.active=!1,this.updateCursorIfNeeded(),this.cursorPreview.position=new(e().Point)(~~t.point.x,~~t.point.y))}},{key:"deactivateTool",value:function(){this.active=!1,this.tmpCanvas=null,this.cursorPreview&&(this.cursorPreview.remove(),this.cursorPreview=null)}}])}(e().Tool),Ir=br;function Ar(t){return Ar="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ar(t)}function Mr(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,wr(i.key),i)}}function wr(t){var e=function(t,e){if("object"!=Ar(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Ar(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ar(e)?e:e+""}function Cr(t,e,n){return e=xr(e),function(t,e){if(e&&("object"==Ar(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Tr()?Reflect.construct(e,n||[],xr(t).constructor):e.apply(t,n))}function Tr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Tr=function(){return!!t})()}function xr(t){return xr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xr(t)}function Sr(t,e){return Sr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Sr(t,e)}var Dr=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=Cr(this,e,[t]),m()(n,["activateTool","deactivateTool"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Sr(t,e)}(e,t),function(t,e,n){return e&&Mr(t.prototype,e),n&&Mr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidMount",value:function(){this.props.isBitBrushModeActive&&this.activateTool(this.props)}},{key:"componentWillReceiveProps",value:function(t){this.tool&&t.color!==this.props.color&&this.tool.setColor(t.color),this.tool&&t.bitBrushSize!==this.props.bitBrushSize&&this.tool.setBrushSize(t.bitBrushSize),t.isBitBrushModeActive&&!this.props.isBitBrushModeActive?this.activateTool():!t.isBitBrushModeActive&&this.props.isBitBrushModeActive&&this.deactivateTool()}},{key:"shouldComponentUpdate",value:function(t){return t.isBitBrushModeActive!==this.props.isBitBrushModeActive}},{key:"componentWillUnmount",value:function(){this.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){bt(this.props.clearSelectedItems),this.props.clearGradient();var t=this.props.color;t&&t!==Di||(this.props.onChangeFillColor(Ai),t=Ai),this.tool=new Ir(this.props.onUpdateImage),this.tool.setColor(t),this.tool.setBrushSize(this.props.bitBrushSize),this.tool.activate()}},{key:"deactivateTool",value:function(){this.tool.deactivateTool(),this.tool.remove(),this.tool=null}},{key:"render",value:function(){return l().createElement(hr,{isSelected:this.props.isBitBrushModeActive,onMouseDown:this.props.handleMouseDown})}}])}(l().Component);Dr.propTypes={bitBrushSize:i().number.isRequired,clearGradient:i().func.isRequired,clearSelectedItems:i().func.isRequired,color:i().string,handleMouseDown:i().func.isRequired,isBitBrushModeActive:i().bool.isRequired,onChangeFillColor:i().func.isRequired,onUpdateImage:i().func.isRequired};var Nr=(0,c.connect)(function(t){return{bitBrushSize:t.scratchPaint.bitBrushSize,color:t.scratchPaint.color.fillColor.primary,isBitBrushModeActive:t.scratchPaint.mode===E.BIT_BRUSH}},function(t){return{clearSelectedItems:function(){t(en())},clearGradient:function(){t(Ti())},handleMouseDown:function(){t(Zi(E.BIT_BRUSH))},onChangeFillColor:function(e){t(wi(e))}}})(Dr),_r="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ5LjMgKDUxMTY3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5saW5lPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9ImxpbmUiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIGQ9Ik0xMiw3Ljk5OCBMMTIsNiBMMTQsNiBMMTQsOCBMMTIuMDAyLDggTDEyLjAwMiwxMCBMMTAsMTAgTDEwLDcuOTk4IEwxMiw3Ljk5OCBaIE04LDEyIEw4LDEwIEwxMCwxMCBMMTAsMTIgTDgsMTIgWiBNMTQsNiBMMTQsNCBMMTYsNCBMMTYsNiBMMTQsNiBaIE00LDE2IEw0LDE0IEw2LDE0IEw2LDE2IEw0LDE2IFogTTYsMTQgTDYsMTIgTDgsMTIgTDgsMTQgTDYsMTQgWiIgaWQ9IkNvbWJpbmVkLVNoYXBlIiBmaWxsPSIjNTc1RTc1Ij48L3BhdGg+CiAgICA8L2c+Cjwvc3ZnPg==",Er=function(t){return l().createElement(ar,{imgDescriptor:lr.line,imgSrc:_r,isSelected:t.isSelected,onMouseDown:t.onMouseDown})};Er.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var jr=Er;function kr(t){return kr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kr(t)}function Or(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,zr(i.key),i)}}function zr(t){var e=function(t,e){if("object"!=kr(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=kr(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==kr(e)?e:e+""}function Lr(t,e,n){return e=Pr(e),function(t,e){if(e&&("object"==kr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Br()?Reflect.construct(e,n||[],Pr(t).constructor):e.apply(t,n))}function Br(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Br=function(){return!!t})()}function Pr(t){return Pr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pr(t)}function Rr(t,e){return Rr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Rr(t,e)}var Ur=function(t){function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(e=Lr(this,n)).onUpdateImage=t,e.onMouseMove=e.handleMouseMove,e.onMouseDown=e.handleMouseDown,e.onMouseDrag=e.handleMouseDrag,e.onMouseUp=e.handleMouseUp,e.colorState=null,e.active=!1,e.startPoint=null,e.cursorPreview=null,e.drawTarget=null,e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Rr(t,e)}(n,t),function(t,e,n){return e&&Or(t.prototype,e),n&&Or(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"setColor",value:function(t){this.color=t,this.tmpCanvas=Yt(this.size,this.color)}},{key:"setLineSize",value:function(t){this.size=Math.max(1,~~t),this.tmpCanvas=Yt(this.size,this.color)}},{key:"draw",value:function(t,n){var i=Math.ceil(this.size/2);this.drawTarget.drawImage(this.tmpCanvas,new(e().Point)(~~t-i,~~n-i))}},{key:"updateCursorIfNeeded",value:function(){this.size&&(this.cursorPreview&&!this.cursorPreview.parent&&(this.cursorPreview=null),this.cursorPreview&&this.lastSize===this.size&&this.lastColor===this.color||(this.cursorPreview&&this.cursorPreview.remove(),this.tmpCanvas=Yt(this.size,this.color),this.cursorPreview=new(e().Raster)(this.tmpCanvas),this.cursorPreview.guide=!0,this.cursorPreview.parent=Le(),this.cursorPreview.data.isHelperItem=!0),this.lastSize=this.size,this.lastColor=this.color)}},{key:"handleMouseMove",value:function(t){this.updateCursorIfNeeded(),this.cursorPreview.position=new(e().Point)(~~t.point.x,~~t.point.y)}},{key:"handleMouseDown",value:function(t){if(!(t.event.button>0)){this.active=!0,this.cursorPreview&&this.cursorPreview.remove();var n=Ne();this.drawTarget=new(e().Raster)(n),this.drawTarget.parent=Le(),this.drawTarget.guide=!0,this.drawTarget.locked=!0,this.drawTarget.position=Ee().position,this.draw(t.point.x,t.point.y),this.startPoint=t.point}}},{key:"handleMouseDrag",value:function(t){t.event.button>0||!this.active||(this.drawTarget.canvas.getContext("2d").clearRect(0,0,ce,ue),Rt(this.startPoint,t.point,this.draw.bind(this)))}},{key:"handleMouseUp",value:function(t){t.event.button>0||!this.active||(this.drawTarget.remove(),this.drawTarget=Ee(),Rt(this.startPoint,t.point,this.draw.bind(this)),this.drawTarget=null,this.onUpdateImage(),this.lastPoint=null,this.active=!1,this.updateCursorIfNeeded(),this.cursorPreview.position=new(e().Point)(~~t.point.x,~~t.point.y))}},{key:"deactivateTool",value:function(){this.active=!1,this.tmpCanvas=null,this.cursorPreview&&(this.cursorPreview.remove(),this.cursorPreview=null)}}])}(e().Tool),Gr=Ur;function Yr(t){return Yr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yr(t)}function Zr(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Wr(i.key),i)}}function Wr(t){var e=function(t,e){if("object"!=Yr(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Yr(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Yr(e)?e:e+""}function Qr(t,e,n){return e=Fr(e),function(t,e){if(e&&("object"==Yr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Hr()?Reflect.construct(e,n||[],Fr(t).constructor):e.apply(t,n))}function Hr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Hr=function(){return!!t})()}function Fr(t){return Fr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Fr(t)}function Vr(t,e){return Vr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vr(t,e)}var qr=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=Qr(this,e,[t]),m()(n,["activateTool","deactivateTool"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Vr(t,e)}(e,t),function(t,e,n){return e&&Zr(t.prototype,e),n&&Zr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidMount",value:function(){this.props.isBitLineModeActive&&this.activateTool(this.props)}},{key:"componentWillReceiveProps",value:function(t){this.tool&&t.color!==this.props.color&&this.tool.setColor(t.color),this.tool&&t.bitBrushSize!==this.props.bitBrushSize&&this.tool.setLineSize(t.bitBrushSize),t.isBitLineModeActive&&!this.props.isBitLineModeActive?this.activateTool():!t.isBitLineModeActive&&this.props.isBitLineModeActive&&this.deactivateTool()}},{key:"shouldComponentUpdate",value:function(t){return t.isBitLineModeActive!==this.props.isBitLineModeActive}},{key:"componentWillUnmount",value:function(){this.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){bt(this.props.clearSelectedItems),this.props.clearGradient();var t=this.props.color;t&&t!==Di||(this.props.onChangeFillColor(Ai),t=Ai),this.tool=new Gr(this.props.onUpdateImage),this.tool.setColor(t),this.tool.setLineSize(this.props.bitBrushSize),this.tool.activate()}},{key:"deactivateTool",value:function(){this.tool.deactivateTool(),this.tool.remove(),this.tool=null}},{key:"render",value:function(){return l().createElement(jr,{isSelected:this.props.isBitLineModeActive,onMouseDown:this.props.handleMouseDown})}}])}(l().Component);qr.propTypes={bitBrushSize:i().number.isRequired,clearGradient:i().func.isRequired,clearSelectedItems:i().func.isRequired,color:i().string,handleMouseDown:i().func.isRequired,isBitLineModeActive:i().bool.isRequired,onChangeFillColor:i().func.isRequired,onUpdateImage:i().func.isRequired};var Jr=(0,c.connect)(function(t){return{bitBrushSize:t.scratchPaint.bitBrushSize,color:t.scratchPaint.color.fillColor.primary,isBitLineModeActive:t.scratchPaint.mode===E.BIT_LINE}},function(t){return{clearSelectedItems:function(){t(en())},clearGradient:function(){t(Ti())},handleMouseDown:function(){t(Zi(E.BIT_LINE))},onChangeFillColor:function(e){t(wi(e))}}})(qr),Xr=n.PropTypes.shape({primary:n.PropTypes.string,secondary:n.PropTypes.string,gradientType:n.PropTypes.oneOf(Object.keys(ci)).isRequired}),Kr={DEFAULT:"default",GRAB:"grab",GRABBING:"grabbing",NONE:"none",RESIZE_EW:"ew-resize",RESIZE_NS:"ns-resize",RESIZE_NESW:"nesw-resize",RESIZE_NWSE:"nwse-resize"},$r="scratch-paint/eye-dropper/ACTIVATE_COLOR_PICKER",to="scratch-paint/eye-dropper/DEACTIVATE_COLOR_PICKER",eo={active:!1,callback:function(){},previousTool:null},no=function(){return{type:to}},io="scratch-paint/cursor/CHANGE_CURSOR",ro=Kr.DEFAULT,oo=function(t){return{type:io,cursorString:t}};function so(t){return so="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},so(t)}function ao(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return lo(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lo(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function lo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function co(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,uo(i.key),i)}}function uo(t){var e=function(t,e){if("object"!=so(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=so(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==so(e)?e:e+""}var ho=1e-4,po=function(){return function(t,e,n){return e&&co(t.prototype,e),n&&co(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.isBitmap=e in _,this.active=!1,this.boundsPath=null,this.pivot=null,this.origPivot=null,this.corner=null,this.origSize=null,this.origCenter=null,this.itemGroup=null,this.itemToInsertBelow=null,this.lastPoint=null,this.onUpdateImage=n},[{key:"onMouseDown",value:function(t,n,i){if(!this.active){this.active=!0;var r=t.item.data.index;this.pivot=n.bounds[this._getOpposingRectCornerNameByIndex(r)].clone(),this.origPivot=n.bounds[this._getOpposingRectCornerNameByIndex(r)].clone(),this.corner=n.bounds[this._getRectCornerNameByIndex(r)].clone(),this.selectionAnchor=n.selectionAnchor,this.origSize=this.corner.subtract(this.pivot),this.origCenter=n.bounds.center,this.isCorner=this._isCorner(r),this.centered=!1,this.lastSx=1,this.lastSy=1,this.boundsPath=n;var o=ht({match:function(t){var e,n=ao(i);try{for(n.s();!(e=n.n()).done;){if(!e.value.isBelow(t))return!1}}catch(t){n.e(t)}finally{n.f()}return!0}});o.length>0&&(this.itemToInsertBelow=o[0]),this.itemGroup=new(e().Group)(i),this.itemGroup.addChild(n),this.itemGroup.insertBelow(this.itemToInsertBelow),this.itemGroup.data.isHelperItem=!0}}},{key:"onMouseDrag",value:function(t){if(this.active){var e=t.point,n=we(this.isBitmap);e.x=Math.max(n.left,Math.min(e.x,n.right)),e.y=Math.max(n.top,Math.min(e.y,n.bottom)),this.lastPoint||(this.lastPoint=t.lastPoint);var i=e.subtract(this.lastPoint);this.lastPoint=e,t.modifiers.alt?(this.centered=!0,this.itemGroup.position=this.origCenter,this.pivot=this.origCenter):(this.centered&&(this.centered=!1,this.itemGroup.scale(1/this.lastSx,1/this.lastSy,this.pivot),this.selectionAnchor&&this.selectionAnchor.scale(this.lastSx,this.lastSy),this.lastSx=1,this.lastSy=1),this.pivot=this.origPivot),this.corner=this.corner.add(i);var r=this.corner.subtract(this.pivot);t.modifiers.alt&&(r=r.multiply(2));var o=1,s=1;Math.abs(this.origSize.x)>1e-7&&(o=r.x/this.origSize.x),Math.abs(this.origSize.y)>1e-7&&(s=r.y/this.origSize.y);var a=o>0?1:-1,l=s>0?1:-1;this.isCorner&&!t.modifiers.shift&&(o=s=Math.max(Math.abs(o),Math.abs(s)),o*=a,s*=l),o=a*Math.max(Math.abs(o),ho),s=l*Math.max(Math.abs(s),ho),this.itemGroup.scale(o/this.lastSx,s/this.lastSy,this.pivot),this.selectionAnchor&&this.selectionAnchor.scale(this.lastSx/o,this.lastSy/s),this.lastSx=o,this.lastSy=s}}},{key:"onMouseUp",value:function(){if(this.active&&(this.lastPoint=null,this.pivot=null,this.origPivot=null,this.corner=null,this.origSize=null,this.origCenter=null,this.lastSx=1,this.lastSy=1,this.centered=!1,this.itemGroup)){this.boundsPath.remove(),this.boundsPath=null;for(var t=0;t<this.itemGroup.children.length;t++){var e=this.itemGroup.children[t];e.data.isPGTextItem&&(e.data.wasScaled=!0)}if(this.itemToInsertBelow){for(;0<this.itemGroup.children.length;)this.itemGroup.children[0].insertBelow(this.itemToInsertBelow);this.itemToInsertBelow=null}else this.itemGroup.layer&&this.itemGroup.layer.addChildren(this.itemGroup.children);this.itemGroup.remove(),this.onUpdateImage(),this.active=!1}}},{key:"_getRectCornerNameByIndex",value:function(t){switch(t){case 0:return"bottomLeft";case 1:return"leftCenter";case 2:return"topLeft";case 3:return"topCenter";case 4:return"topRight";case 5:return"rightCenter";case 6:return"bottomRight";case 7:return"bottomCenter"}}},{key:"_getOpposingRectCornerNameByIndex",value:function(t){switch(t){case 0:return"topRight";case 1:return"rightCenter";case 2:return"bottomRight";case 3:return"bottomCenter";case 4:return"bottomLeft";case 5:return"leftCenter";case 6:return"topLeft";case 7:return"topCenter"}}},{key:"_isCorner",value:function(t){switch(t){case 0:case 2:case 4:case 6:return!0;default:return!1}}}])}();function fo(t){return fo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fo(t)}function go(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return mo(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mo(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function mo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function yo(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,vo(i.key),i)}}function vo(t){var e=function(t,e){if("object"!=fo(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=fo(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==fo(e)?e:e+""}var bo=function(){return function(t,e,n){return e&&yo(t.prototype,e),n&&yo(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.rotItems=[],this.rotGroupPivot=null,this.prevRot=90,this.onUpdateImage=e},[{key:"onMouseDown",value:function(t,n,i){this.rotGroupPivot=n.bounds.center;var r,o=go(i);try{for(o.s();!(r=o.n()).done;){var s=r.value;s.parent instanceof e().Layer&&this.rotItems.push(s)}}catch(t){o.e(t)}finally{o.f()}this.prevRot=90}},{key:"onMouseDrag",value:function(t){var e=t.point.subtract(this.rotGroupPivot).angle;t.modifiers.shift&&(e=45*Math.round(e/45));for(var n=0;n<this.rotItems.length;n++){this.rotItems[n].rotate(e-this.prevRot,this.rotGroupPivot)}this.prevRot=e}},{key:"onMouseUp",value:function(t){t.event.button>0||(this.rotItems.length=0,this.rotGroupPivot=null,this.prevRot=90,this.onUpdateImage())}}])}();function Io(t){return Io="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Io(t)}function Ao(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Mo(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mo(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Mo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function wo(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Co(i.key),i)}}function Co(t){var e=function(t,e){if("object"!=Io(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Io(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Io(e)?e:e+""}var To=function(){return function(t,e,n){return e&&wo(t.prototype,e),n&&wo(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,i,r,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.mode=e,this.setSelectedItems=n,this.clearSelectedItems=i,this.selectedItems=null,this.selectionCenter=null,this.onUpdateImage=r,this.switchToTextTool=o,this.boundsPath=null,this.firstDrag=!1},[{key:"onMouseDown",value:function(t){var n=t.hitResult.item;if(!t.subselect){var i=k(t.hitResult.item);n=z(i)||R(i)?i:t.hitResult.item}if(n.selected)if(t.doubleClicked){if(!t.multiselect){if(this.switchToTextTool&&n instanceof e().PointText)return void this.switchToTextTool();bt(this.clearSelectedItems)}this._select(n,!0,t.subselect,!0)}else t.multiselect&&this._select(n,!1,t.subselect);else t.multiselect||bt(this.clearSelectedItems),this._select(n,!0,t.subselect);if(t.clone&&function(t,e){for(var n=t?At():It(),i=0;i<n.length;i++){var r=n[i];r.clone(),r.selected=!1}e()}(t.subselect,this.onUpdateImage),this.selectedItems=this.mode===E.RESHAPE?At():It(),0!==this.selectedItems.length){var r,o,s=Ao(this.selectedItems);try{for(s.s();!(o=s.n()).done;){var a=o.value;r=r?r.unite(a.bounds):a.bounds}}catch(t){s.e(t)}finally{s.f()}this.selectionCenter=r.center,this.boundsPath&&this.selectedItems.push(this.boundsPath),this.firstDrag=!0}}},{key:"setBoundsPath",value:function(t){this.boundsPath=t}},{key:"_select",value:function(t,e,n,i){n?(t.selected=!1,i?t.fullySelected=e:t.selected=e):mt(t,e),this.setSelectedItems()}},{key:"onMouseDrag",value:function(t){var n=t.point,i=we(this.mode in _);n.x=Math.max(i.left,Math.min(n.x,i.right)),n.y=Math.max(i.top,Math.min(n.y,i.bottom));var r,o,s,a,l,c,u=n.subtract(t.downPoint);if(t.modifiers.shift||this.mode===E.RESHAPE||(o=this.selectionCenter.add(u),s=he,a=4/e().view.zoom,l=Math.abs(o.x-s.x),c=Math.abs(o.y-s.y),l<a&&c<a&&(r=he.subtract(this.selectionCenter))),0!==this.selectedItems.length){var h,d,p=Ao(this.selectedItems);try{for(p.s();!(d=p.n()).done;){var f=d.value;f.data.origPos||(f.data.origPos=f.position),r?f.position=f.data.origPos.add(r):t.modifiers.shift?f.position=f.data.origPos.add(K(u,Math.PI/4)):f.position=f.data.origPos.add(u),h=h?h.unite(f.bounds):f.bounds}}catch(t){p.e(t)}finally{p.f()}this.firstDrag&&(je().visible=!0,this.firstDrag=!1);var g=1,m=this.selectionCenter.add(u);if(he.y<h.top&&he.x<h.left||he.y>h.bottom&&he.x<h.left||he.y<h.top&&he.x>h.right||he.y>h.bottom&&he.x>h.right){var y=Math.max(he.x-h.right,h.left-he.x),v=Math.max(he.y-h.bottom,h.top-he.y),b=Math.sqrt(y*y+v*v);g=Math.max(0,1-b/(10/e().view.zoom))}else he.y<h.top||he.y>h.bottom?g=Math.max(0,1-(Math.abs(he.y-m.y)-h.height/2)/(10/e().view.zoom)):(he.x<h.left||he.x>h.right)&&(g=Math.max(0,1-(Math.abs(he.x-m.x)-h.width/2)/(10/e().view.zoom)));je().opacity=.75*g}}},{key:"onMouseUp",value:function(){this.firstDrag=!1;var t,e=!1,n=Ao(this.selectedItems);try{for(n.s();!(t=n.n()).done;){var i=t.value;i.data.origPos&&(i.position.equals(i.data.origPos)||(e=!0),delete i.data.origPos)}}catch(t){n.e(t)}finally{n.f()}this.selectedItems=null,this.selectionCenter=null,e&&this.onUpdateImage(),je().visible=!1}}])}();function xo(t){return xo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xo(t)}function So(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Do(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Do(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Do(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function No(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,_o(i.key),i)}}function _o(t){var e=function(t,e){if("object"!=xo(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=xo(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==xo(e)?e:e+""}var Eo=b()({SCALE:null,ROTATE:null,MOVE:null}),jo=function(){return function(t,e,n){return e&&No(t.prototype,e),n&&No(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,i,r,o,s){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.dispatchSetCursor=r,this.onUpdateImage=o,this.mode=null,this.boundsPath=null,this.boundsScaleHandles=[],this.boundsRotHandles=[],this._modeMap={},this._modeMap[Eo.SCALE]=new po(e,o),this._modeMap[Eo.ROTATE]=new bo(o),this._modeMap[Eo.MOVE]=new To(e,n,i,o,s),this._currentCursor=null},[{key:"onSelectionChanged",value:function(t){t&&t.length?this.setSelectionBounds():this.removeBoundsPath()}},{key:"onMouseDown",value:function(t,e,n,i,r){if(!(t.event.button>0)){var o=this._determineMode(t,n,r),s=o.hitResult,a=o.mode;if(!s)return n||this.removeBoundsPath(),!1;this.mode=a;var l={hitResult:s,clone:e,multiselect:n,doubleClicked:i};return this.mode===Eo.MOVE?(this._modeMap[this.mode].onMouseDown(l),this.removeBoundsHandles()):this.mode===Eo.SCALE?(this._modeMap[this.mode].onMouseDown(s,this.boundsPath,It()),this.removeBoundsHandles()):this.mode===Eo.ROTATE&&(this.setCursor(Kr.GRABBING),this._modeMap[this.mode].onMouseDown(s,this.boundsPath,It()),this.removeBoundsPath()),!0}}},{key:"onMouseMove",value:function(t,e){this._updateCursor(t,e)}},{key:"_updateCursor",value:function(t,e){var n=this._determineMode(t,!1,e),i=n.mode,r=n.hitResult;r?i===Eo.MOVE?this.setCursor(Kr.DEFAULT):i===Eo.ROTATE?this.setCursor(Kr.GRAB):i===Eo.SCALE&&(this.setSelectionBounds(),this._impreciseEqual(r.item.position.x,this.boundsPath.position.x)?this.setCursor(Kr.RESIZE_NS):this._impreciseEqual(r.item.position.y,this.boundsPath.position.y)?this.setCursor(Kr.RESIZE_EW):r.item.position.equals(this.boundsPath.bounds.bottomLeft)||r.item.position.equals(this.boundsPath.bounds.topRight)?this.setCursor(Kr.RESIZE_NESW):this.setCursor(Kr.RESIZE_NWSE)):this.setCursor(Kr.DEFAULT)}},{key:"_impreciseEqual",value:function(t,e){return Math.abs(t-e)<1e-8}},{key:"_determineMode",value:function(t,n,i){for(var r,o=e().project.hitTestAll(t.point,i),s=o[0],a=0;a<o.length;a++){if(o[a].item.data&&o[a].item.data.isScaleHandle){s=o[a],r=Eo.SCALE;break}o[a].item.data&&o[a].item.data.isRotHandle&&(s=o[a],r=Eo.ROTATE)}return r||(r=Eo.MOVE),{mode:r,hitResult:s}}},{key:"onMouseDrag",value:function(t){t.event.button>0||!this.mode||(this._modeMap[this.mode].onMouseDrag(t),this.mode===Eo.MOVE&&this.setCursor(Kr.GRABBING))}},{key:"onMouseUp",value:function(t,e){t.event.button>0||!this.mode||(this._modeMap[this.mode].onMouseUp(t),this.setSelectionBounds(),this.mode=null,this._updateCursor(t,e))}},{key:"setSelectionBounds",value:function(){this.removeBoundsPath();var t=It();if(!(t.length<=0)){var n,i=null,r=So(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o instanceof e().Raster&&!1===o.loaded)return void(o.onLoad=this.setSelectionBounds.bind(this));i=i?i.unite(o.bounds):o.bounds}}catch(t){r.e(t)}finally{r.f()}if(!this.boundsPath){this.boundsPath=new(e().Group),this.boundsRect=e().Path.Rectangle(i),this.boundsRect.curves[0].divideAtTime(.5),this.boundsRect.curves[2].divideAtTime(.5),this.boundsRect.curves[4].divideAtTime(.5),this.boundsRect.curves[6].divideAtTime(.5),this.boundsPath.addChild(this.boundsRect);var s=new(e().Path.Rectangle)({point:[-1,-6],size:[2,12],radius:1,insert:!1}),a=new(e().Path.Rectangle)({point:[-6,-1],size:[12,2],radius:1,insert:!1}),l=s.unite(a);this.boundsPath.addChild(l),this.boundsPath.selectionAnchor=l,this._modeMap[Eo.MOVE].setBoundsPath(this.boundsPath)}Be(this.boundsPath),this.boundsPath.data.isSelectionBound=!0,this.boundsPath.data.isHelperItem=!0,this.boundsPath.fillColor=null,this.boundsPath.parent=Le(),this.boundsPath.strokeWidth=1/e().view.zoom,this.boundsPath.strokeColor=kt(),this.boundsPath.selectionAnchor.scale(12/e().view.zoom/this.boundsPath.selectionAnchor.bounds.width),this.boundsPath.selectionAnchor.position=i.center;var c=new(e().Path.Circle)({center:new(e().Point)(0,0),radius:5.5/e().view.zoom,fillColor:"black",opacity:.12,data:{isHelperItem:!0,noSelect:!0,noHover:!0}}),u=new(e().Path.Circle)({center:new(e().Point)(0,0),radius:4/e().view.zoom,fillColor:kt(),data:{isScaleHandle:!0,isHelperItem:!0,noSelect:!0,noHover:!0}}),h=new(e().Group)([c,u]);h.parent=Le();for(var d=0;d<this.boundsRect.segments.length;d++){var p=this.boundsRect.segments[d];if(7===d){var f=new(e().Point)(0,20),g=new(e().Path)("M19.28,1.09C19.28.28,19,0,18.2,0c-1.67,0-3.34,0-5,0-.34,0-.88.24-1,.47a1.4,1.4,0,0,0,.36,1.08,15.27,15.27,0,0,0,1.46,1.36A6.4,6.4,0,0,1,6.52,4,5.85,5.85,0,0,1,5.24,3,15.27,15.27,0,0,0,6.7,1.61,1.4,1.4,0,0,0,7.06.54C7,.3,6.44.07,6.1.06c-1.67,0-3.34,0-5,0C.28,0,0,.31,0,1.12c0,1.67,0,3.34,0,5a1.23,1.23,0,0,0,.49,1,1.22,1.22,0,0,0,1-.31A14.38,14.38,0,0,0,2.84,5.26l.73.62a9.45,9.45,0,0,0,7.34,2,9.45,9.45,0,0,0,4.82-2.05l.73-.62a14.38,14.38,0,0,0,1.29,1.51,1.22,1.22,0,0,0,1,.31,1.23,1.23,0,0,0,.49-1C19.31,4.43,19.29,2.76,19.28,1.09Z");g.translate(p.point.add(f).add(-10.5,-5));var m=new(e().Path.Rectangle)(p.point.add(f).subtract(1,0),p.point),y=g.unite(m);m.remove(),g.remove(),y.scale(1/e().view.zoom,p.point),y.data={offset:f,isRotHandle:!0,isHelperItem:!0,noSelect:!0,noHover:!0},y.fillColor=kt(),y.parent=Le(),this.boundsRotHandles[d]=y}this.boundsScaleHandles[d]=h.clone(),this.boundsScaleHandles[d].position=p.point;var v,b=So(this.boundsScaleHandles[d].children);try{for(b.s();!(v=b.n()).done;){v.value.data.index=d}}catch(t){b.e(t)}finally{b.f()}this.boundsScaleHandles[d].data={index:d,isScaleHandle:!0,isHelperItem:!0,noSelect:!0,noHover:!0}}h.remove()}}},{key:"removeBoundsPath",value:function(){Ot(["isSelectionBound","isRotHandle","isScaleHandle"]),this.boundsPath=null,this.boundsRect=null,this.boundsScaleHandles.length=0,this.boundsRotHandles.length=0}},{key:"removeBoundsHandles",value:function(){Ot(["isRotHandle","isScaleHandle"]),this.boundsScaleHandles.length=0,this.boundsRotHandles.length=0}},{key:"deactivateTool",value:function(){this.removeBoundsPath(),this.setCursor(Kr.DEFAULT)}},{key:"setCursor",value:function(t){this._currentCursor!==t&&(this.dispatchSetCursor(t),this._currentCursor=t)}}])}();function ko(t){return ko="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ko(t)}function Oo(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return zo(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zo(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function zo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function Lo(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Bo(i.key),i)}}function Bo(t){var e=function(t,e){if("object"!=ko(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=ko(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ko(e)?e:e+""}var Po=function(){return function(t,e,n){return e&&Lo(t.prototype,e),n&&Lo(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.boundingBoxTool=n,this.onUpdateImage=i,this.boundingBoxTool.isBitmap=e in _},[{key:"onKeyDown",value:function(t){if(!(t.event.target instanceof HTMLInputElement)){var n=1/e().view.zoom;t.modifiers.shift&&(n*=15);var i=It();if(0!==i.length){var r,o,s=Oo(i);try{for(s.s();!(o=s.n()).done;){var a=o.value;r=r?r.unite(a.bounds):a.bounds}}catch(t){s.e(t)}finally{s.f()}var l,c=we(this.boundingBoxTool.isBitmap),u=c.bottom-r.top-1,h=c.top-r.bottom+1,d=c.left-r.right+1,p=c.right-r.left-1;if("up"===t.key?l=new(e().Point)(0,Math.min(u,Math.max(-n,h))):"down"===t.key?l=new(e().Point)(0,Math.max(h,Math.min(n,u))):"left"===t.key?l=new(e().Point)(Math.min(p,Math.max(-n,d)),0):"right"===t.key&&(l=new(e().Point)(Math.max(d,Math.min(n,p)),0)),l){var f,g=Oo(i);try{for(g.s();!(f=g.n()).done;){f.value.translate(l)}}catch(t){g.e(t)}finally{g.f()}this.boundingBoxTool.setSelectionBounds(),t.preventDefault()}}}}},{key:"onKeyUp",value:function(t){0!==It().length&&("up"!==t.key&&"down"!==t.key&&"left"!==t.key&&"right"!==t.key||this.onUpdateImage())}}])}();function Ro(t){return Ro="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ro(t)}function Uo(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Go(i.key),i)}}function Go(t){var e=function(t,e){if("object"!=Ro(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Ro(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ro(e)?e:e+""}function Yo(t,e,n){return e=Wo(e),function(t,e){if(e&&("object"==Ro(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Zo()?Reflect.construct(e,n||[],Wo(t).constructor):e.apply(t,n))}function Zo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Zo=function(){return!!t})()}function Wo(t){return Wo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wo(t)}function Qo(t,e){return Qo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qo(t,e)}var Ho=function(t){function n(t,e,i,r){var o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(o=Yo(this,n)).setSelectedItems=t,o.clearSelectedItems=e,o.onUpdateImage=r,o.boundingBoxTool=new jo(E.BIT_OVAL,t,e,i,r);var s=new Po(E.BIT_OVAL,o.boundingBoxTool,r);return o.onMouseDown=o.handleMouseDown,o.onMouseDrag=o.handleMouseDrag,o.onMouseMove=o.handleMouseMove,o.onMouseUp=o.handleMouseUp,o.onKeyUp=s.onKeyUp,o.onKeyDown=s.onKeyDown,o.oval=null,o.color=null,o.active=!1,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qo(t,e)}(n,t),function(t,e,n){return e&&Uo(t.prototype,e),n&&Uo(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"getHitOptions",value:function(){return{segments:!1,stroke:!0,curves:!1,fill:!0,guide:!1,match:function(t){return t.item.data&&(t.item.data.isScaleHandle||t.item.data.isRotHandle)||t.item.selected},tolerance:n.TOLERANCE/e().view.zoom}}},{key:"onSelectionChanged",value:function(t){this.boundingBoxTool.onSelectionChanged(t),this.oval&&this.oval.isInserted()||!t||1!==t.length||"ellipse"!==t[0].shape?this.oval&&this.oval.isInserted()&&!this.oval.selected&&this.commitOval():(this.oval=t[0],this.oval.data.zoomLevel!==e().view.zoom&&(this.oval.strokeWidth=this.oval.strokeWidth/this.oval.data.zoomLevel*e().view.zoom,this.oval.data.zoomLevel=e().view.zoom,this.thickness=this.oval.strokeWidth),this.filled=0===this.oval.strokeWidth)}},{key:"styleOval",value:function(){Ui(this.oval,{fillColor:this.filled?this.color:null,strokeColor:this.filled?null:this.color,strokeWidth:this.filled?0:this.thickness})}},{key:"setColor",value:function(t){this.color=t,this.oval&&this.styleOval()}},{key:"setFilled",value:function(t){this.filled!==t&&(this.filled=t,this.oval&&this.oval.isInserted()&&(this.styleOval(),this.onUpdateImage()))}},{key:"setThickness",value:function(t){this.thickness!==t*e().view.zoom&&(this.thickness=t*e().view.zoom,this.oval&&this.oval.isInserted()&&!this.filled&&(this.oval.strokeWidth=this.thickness),this.oval&&this.oval.isInserted()&&(this.oval.data.zoomLevel=e().view.zoom,this.onUpdateImage()))}},{key:"handleMouseDown",value:function(t){t.event.button>0||(this.active=!0,this.boundingBoxTool.onMouseDown(t,!1,!1,!1,this.getHitOptions())?this.isBoundingBoxMode=!0:(this.isBoundingBoxMode=!1,bt(this.clearSelectedItems),this.commitOval(),this.oval=new(e().Shape.Ellipse)({point:t.downPoint,size:0,strokeScaling:!1}),this.styleOval(),this.oval.data={zoomLevel:e().view.zoom}))}},{key:"handleMouseDrag",value:function(t){if(!(t.event.button>0)&&this.active)if(this.isBoundingBoxMode)this.boundingBoxTool.onMouseDrag(t);else{var n=new(e().Point)(t.downPoint.x,t.downPoint.y),i=new(e().Point)(t.point.x,t.point.y),r=rt(t.downPoint,t.point);t.modifiers.shift?this.oval.size=r.size.abs():this.oval.size=n.subtract(i),t.modifiers.alt?this.oval.position=n:t.modifiers.shift?this.oval.position=r.position:this.oval.position=n.subtract(this.oval.size.multiply(.5)),this.styleOval()}}},{key:"handleMouseMove",value:function(t){this.boundingBoxTool.onMouseMove(t,this.getHitOptions())}},{key:"handleMouseUp",value:function(t){if(!(t.event.button>0)&&this.active){if(this.isBoundingBoxMode)return this.boundingBoxTool.onMouseUp(t),void(this.isBoundingBoxMode=null);this.oval&&(Math.abs(this.oval.size.width*this.oval.size.height)<n.TOLERANCE/e().view.zoom?(this.oval.remove(),this.oval=null):(this.oval.size=new(e().Point)(Math.abs(this.oval.size.width),Math.abs(this.oval.size.height)),this.oval.selected=!0,this.styleOval(),this.setSelectedItems())),this.active=!1,this.onUpdateImage()}}},{key:"commitOval",value:function(){this.oval&&this.oval.isInserted()&&(re(this.oval,Ee()),this.oval.remove(),this.oval=null)}},{key:"deactivateTool",value:function(){this.commitOval(),this.boundingBoxTool.deactivateTool()}}],[{key:"TOLERANCE",get:function(){return 2}}])}(e().Tool),Fo=Ho,Vo="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ5LjMgKDUxMTY3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5vdmFsPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9Im92YWwiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwb2x5Z29uIGlkPSJQYWdlLTEiIGZpbGw9IiM1NzVFNzUiIHBvaW50cz0iNi42NjY2NjY2NyA0IDYuNjY2NjY2NjcgNS4zMzMzMzMzMyA1LjMzMzMzMzMzIDUuMzMzMzMzMzMgNS4zMzMzMzMzMyA2LjY2NjY2NjY3IDQgNi42NjY2NjY2NyA0IDEzLjMzMzMzMzMgNS4zMzMzMzMzMyAxMy4zMzMzMzMzIDUuMzMzMzMzMzMgMTQuNjY2NjY2NyA2LjY2NjY2NjY3IDE0LjY2NjY2NjcgNi42NjY2NjY2NyAxNiAxMy4zMzMzMzMzIDE2IDEzLjMzMzMzMzMgMTQuNjY2NjY2NyAxNC42NjY2NjY3IDE0LjY2NjY2NjcgMTQuNjY2NjY2NyAxMy4zMzMzMzMzIDE2IDEzLjMzMzMzMzMgMTYgNi42NjY2NjY2NyAxNC42NjY2NjY3IDYuNjY2NjY2NjcgMTQuNjY2NjY2NyA1LjMzMzMzMzMzIDEzLjMzMzMzMzMgNS4zMzMzMzMzMyAxMy4zMzMzMzMzIDQiPjwvcG9seWdvbj4KICAgIDwvZz4KPC9zdmc+",qo=function(t){return l().createElement(ar,{imgDescriptor:lr.oval,imgSrc:Vo,isSelected:t.isSelected,onMouseDown:t.onMouseDown})};qo.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var Jo=qo;function Xo(t){return Xo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xo(t)}function Ko(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,$o(i.key),i)}}function $o(t){var e=function(t,e){if("object"!=Xo(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Xo(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Xo(e)?e:e+""}function ts(t,e,n){return e=ns(e),function(t,e){if(e&&("object"==Xo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,es()?Reflect.construct(e,n||[],ns(t).constructor):e.apply(t,n))}function es(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(es=function(){return!!t})()}function ns(t){return ns=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ns(t)}function is(t,e){return is=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},is(t,e)}var rs=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=ts(this,e,[t]),m()(n,["activateTool","deactivateTool"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&is(t,e)}(e,t),function(t,e,n){return e&&Ko(t.prototype,e),n&&Ko(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidMount",value:function(){this.props.isOvalModeActive&&this.activateTool(this.props)}},{key:"componentWillReceiveProps",value:function(t){this.tool&&(t.color!==this.props.color&&this.tool.setColor(t.color),t.selectedItems!==this.props.selectedItems&&this.tool.onSelectionChanged(t.selectedItems),t.filled!==this.props.filled&&this.tool.setFilled(t.filled),t.thickness===this.props.thickness&&t.zoom===this.props.zoom||this.tool.setThickness(t.thickness)),t.isOvalModeActive&&!this.props.isOvalModeActive?this.activateTool():!t.isOvalModeActive&&this.props.isOvalModeActive&&this.deactivateTool()}},{key:"shouldComponentUpdate",value:function(t){return t.isOvalModeActive!==this.props.isOvalModeActive}},{key:"componentWillUnmount",value:function(){this.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){bt(this.props.clearSelectedItems),this.props.color.primary!==Di&&null!==this.props.color.primary||this.props.onChangeFillColor(Ai),this.tool=new Fo(this.props.setSelectedItems,this.props.clearSelectedItems,this.props.setCursor,this.props.onUpdateImage),this.tool.setColor(this.props.color),this.tool.setFilled(this.props.filled),this.tool.setThickness(this.props.thickness),this.tool.activate()}},{key:"deactivateTool",value:function(){this.tool.deactivateTool(),this.tool.remove(),this.tool=null}},{key:"render",value:function(){return l().createElement(Jo,{isSelected:this.props.isOvalModeActive,onMouseDown:this.props.handleMouseDown})}}])}(l().Component);rs.propTypes={clearSelectedItems:i().func.isRequired,color:Xr,filled:i().bool,handleMouseDown:i().func.isRequired,isOvalModeActive:i().bool.isRequired,onChangeFillColor:i().func.isRequired,onUpdateImage:i().func.isRequired,selectedItems:i().arrayOf(i().instanceOf(e().Item)),setCursor:i().func.isRequired,setSelectedItems:i().func.isRequired,thickness:i().number.isRequired,zoom:i().number.isRequired};var os=(0,c.connect)(function(t){return{color:t.scratchPaint.color.fillColor,filled:t.scratchPaint.fillBitmapShapes,isOvalModeActive:t.scratchPaint.mode===E.BIT_OVAL,selectedItems:t.scratchPaint.selectedItems,thickness:t.scratchPaint.bitBrushSize,zoom:t.scratchPaint.viewBounds.scaling.x}},function(t){return{clearSelectedItems:function(){t(en())},setCursor:function(e){t(oo(e))},setSelectedItems:function(){t(tn(At(),!0))},handleMouseDown:function(){t(Zi(E.BIT_OVAL))},onChangeFillColor:function(e){t(wi(e))}}})(rs);function ss(t){return ss="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ss(t)}function as(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,ls(i.key),i)}}function ls(t){var e=function(t,e){if("object"!=ss(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=ss(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ss(e)?e:e+""}function cs(t,e,n){return e=hs(e),function(t,e){if(e&&("object"==ss(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,us()?Reflect.construct(e,n||[],hs(t).constructor):e.apply(t,n))}function us(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(us=function(){return!!t})()}function hs(t){return hs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hs(t)}function ds(t,e){return ds=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ds(t,e)}var ps=function(t){function n(t,e,i,r){var o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(o=cs(this,n)).setSelectedItems=t,o.clearSelectedItems=e,o.onUpdateImage=r,o.boundingBoxTool=new jo(E.BIT_RECT,t,e,i,r);var s=new Po(E.BIT_RECT,o.boundingBoxTool,r);return o.onMouseDown=o.handleMouseDown,o.onMouseDrag=o.handleMouseDrag,o.onMouseMove=o.handleMouseMove,o.onMouseUp=o.handleMouseUp,o.onKeyUp=s.onKeyUp,o.onKeyDown=s.onKeyDown,o.rect=null,o.color=null,o.active=!1,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ds(t,e)}(n,t),function(t,e,n){return e&&as(t.prototype,e),n&&as(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"getHitOptions",value:function(){return{segments:!1,stroke:!0,curves:!1,fill:!0,guide:!1,match:function(t){return t.item.data&&(t.item.data.isScaleHandle||t.item.data.isRotHandle)||t.item.selected},tolerance:n.TOLERANCE/e().view.zoom}}},{key:"onSelectionChanged",value:function(t){this.boundingBoxTool.onSelectionChanged(t),this.rect&&this.rect.isInserted()||!t||1!==t.length||"rectangle"!==t[0].shape?this.rect&&this.rect.isInserted()&&!this.rect.selected&&this.commitRect():(this.rect=t[0],this.rect.data.zoomLevel!==e().view.zoom&&(this.rect.strokeWidth=this.rect.strokeWidth/this.rect.data.zoomLevel*e().view.zoom,this.rect.data.zoomLevel=e().view.zoom,this.thickness=this.rect.strokeWidth),this.filled=0===this.rect.strokeWidth)}},{key:"styleRect",value:function(){Ui(this.rect,{fillColor:this.filled?this.color:null,strokeColor:this.filled?null:this.color,strokeWidth:this.filled?0:this.thickness})}},{key:"setColor",value:function(t){this.color=t,this.rect&&this.styleRect()}},{key:"setFilled",value:function(t){this.filled!==t&&(this.filled=t,this.rect&&this.rect.isInserted()&&(this.styleRect(),this.onUpdateImage()))}},{key:"setThickness",value:function(t){this.thickness!==t*e().view.zoom&&(this.thickness=t*e().view.zoom,this.rect&&this.rect.isInserted()&&!this.filled&&(this.rect.strokeWidth=this.thickness),this.rect&&this.rect.isInserted()&&(this.rect.data.zoomLevel=e().view.zoom,this.onUpdateImage()))}},{key:"handleMouseDown",value:function(t){t.event.button>0||(this.active=!0,this.boundingBoxTool.onMouseDown(t,!1,!1,!1,this.getHitOptions())?this.isBoundingBoxMode=!0:(this.isBoundingBoxMode=!1,bt(this.clearSelectedItems),this.commitRect()))}},{key:"handleMouseDrag",value:function(t){if(!(t.event.button>0)&&this.active)if(this.isBoundingBoxMode)this.boundingBoxTool.onMouseDrag(t);else{var n=t.point.subtract(t.downPoint),i=new(e().Rectangle)(t.downPoint,t.point),r=rt(t.downPoint,t.point);t.modifiers.shift&&(i.size=r.size.abs()),this.rect&&this.rect.remove(),this.rect=new(e().Shape.Rectangle)(i),this.rect.strokeJoin="round",this.rect.strokeScaling=!1,this.rect.data={zoomLevel:e().view.zoom},this.styleRect(),t.modifiers.alt?this.rect.position=t.downPoint:t.modifiers.shift?this.rect.position=r.position:this.rect.position=t.downPoint.add(n.multiply(.5))}}},{key:"handleMouseMove",value:function(t){this.boundingBoxTool.onMouseMove(t,this.getHitOptions())}},{key:"handleMouseUp",value:function(t){if(!(t.event.button>0)&&this.active){if(this.isBoundingBoxMode)return this.boundingBoxTool.onMouseUp(t),void(this.isBoundingBoxMode=null);this.rect&&(Math.abs(this.rect.size.width*this.rect.size.height)<n.TOLERANCE/e().view.zoom?(this.rect.remove(),this.rect=null):(this.rect.size=new(e().Point)(Math.abs(this.rect.size.width),Math.abs(this.rect.size.height)),this.rect.selected=!0,this.styleRect(),this.setSelectedItems())),this.active=!1,this.onUpdateImage()}}},{key:"commitRect",value:function(){this.rect&&this.rect.isInserted()&&(oe(this.rect,Ee()),this.rect.remove(),this.rect=null)}},{key:"deactivateTool",value:function(){this.commitRect(),this.boundingBoxTool.deactivateTool()}}],[{key:"TOLERANCE",get:function(){return 2}}])}(e().Tool),fs=ps,gs="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ5LjMgKDUxMTY3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5yZWN0YW5nZTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJyZWN0YW5nZSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPHJlY3QgaWQ9InJlY3RhbmdsZS1pY29uIiBmaWxsPSIjNTc1RTc1IiB4PSI0IiB5PSI0IiB3aWR0aD0iMTIiIGhlaWdodD0iMTIiPjwvcmVjdD4KICAgIDwvZz4KPC9zdmc+",ms=function(t){return l().createElement(ar,{imgDescriptor:lr.rect,imgSrc:gs,isSelected:t.isSelected,onMouseDown:t.onMouseDown})};ms.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var ys=ms;function vs(t){return vs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vs(t)}function bs(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Is(i.key),i)}}function Is(t){var e=function(t,e){if("object"!=vs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=vs(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vs(e)?e:e+""}function As(t,e,n){return e=ws(e),function(t,e){if(e&&("object"==vs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ms()?Reflect.construct(e,n||[],ws(t).constructor):e.apply(t,n))}function Ms(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ms=function(){return!!t})()}function ws(t){return ws=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ws(t)}function Cs(t,e){return Cs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cs(t,e)}var Ts=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=As(this,e,[t]),m()(n,["activateTool","deactivateTool"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cs(t,e)}(e,t),function(t,e,n){return e&&bs(t.prototype,e),n&&bs(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidMount",value:function(){this.props.isRectModeActive&&this.activateTool(this.props)}},{key:"componentWillReceiveProps",value:function(t){this.tool&&(t.color!==this.props.color&&this.tool.setColor(t.color),t.selectedItems!==this.props.selectedItems&&this.tool.onSelectionChanged(t.selectedItems),t.filled!==this.props.filled&&this.tool.setFilled(t.filled),t.thickness===this.props.thickness&&t.zoom===this.props.zoom||this.tool.setThickness(t.thickness)),t.isRectModeActive&&!this.props.isRectModeActive?this.activateTool():!t.isRectModeActive&&this.props.isRectModeActive&&this.deactivateTool()}},{key:"shouldComponentUpdate",value:function(t){return t.isRectModeActive!==this.props.isRectModeActive}},{key:"componentWillUnmount",value:function(){this.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){bt(this.props.clearSelectedItems),this.props.color.primary!==Di&&null!==this.props.color.primary||this.props.onChangeFillColor(Ai),this.tool=new fs(this.props.setSelectedItems,this.props.clearSelectedItems,this.props.setCursor,this.props.onUpdateImage),this.tool.setColor(this.props.color),this.tool.setFilled(this.props.filled),this.tool.setThickness(this.props.thickness),this.tool.activate()}},{key:"deactivateTool",value:function(){this.tool.deactivateTool(),this.tool.remove(),this.tool=null}},{key:"render",value:function(){return l().createElement(ys,{isSelected:this.props.isRectModeActive,onMouseDown:this.props.handleMouseDown})}}])}(l().Component);Ts.propTypes={clearSelectedItems:i().func.isRequired,color:Xr,filled:i().bool,handleMouseDown:i().func.isRequired,isRectModeActive:i().bool.isRequired,onChangeFillColor:i().func.isRequired,onUpdateImage:i().func.isRequired,selectedItems:i().arrayOf(i().instanceOf(e().Item)),setCursor:i().func.isRequired,setSelectedItems:i().func.isRequired,thickness:i().number.isRequired,zoom:i().number.isRequired};var xs=(0,c.connect)(function(t){return{color:t.scratchPaint.color.fillColor,filled:t.scratchPaint.fillBitmapShapes,isRectModeActive:t.scratchPaint.mode===E.BIT_RECT,selectedItems:t.scratchPaint.selectedItems,thickness:t.scratchPaint.bitBrushSize,zoom:t.scratchPaint.viewBounds.scaling.x}},function(t){return{clearSelectedItems:function(){t(en())},setCursor:function(e){t(oo(e))},setSelectedItems:function(){t(tn(At(),!0))},handleMouseDown:function(){t(Zi(E.BIT_RECT))},onChangeFillColor:function(e){t(wi(e))}}})(Ts),Ss=function(t){return l().createElement(ar,{imgDescriptor:lr.fill,imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ5LjMgKDUxMTY3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5maWxsPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9ImZpbGwiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIGQ9Ik0xMC43MDAwNjM0LDUuODAxMzc0NDYgTDkuMjk5Nzk2MTQsNS44MDEzNzQ0NiBMOS4yOTk3OTYxNCw4LjU5OTk0ODk1IEw3Ljg5OTgwODkxLDguNTk5OTQ4OTUgTDcuODk5ODA4OTEsNC4zOTk5ODcyNCBMNi40OTk4MjE2Nyw0LjM5OTk4NzI0IEw2LjQ5OTgyMTY3LDUuODAxMzc0NDYgTDUuMDk5ODM0NDMsNS44MDEzNzQ0NiBMNS4wOTk4MzQ0MywzIEw5LjI5OTc5NjE0LDMgTDkuMjk5Nzk2MTQsNC4zOTk5ODcyNCBMMTAuNzAxMTgzNCw0LjM5OTk4NzI0IEwxMC43MDExODM0LDUuODAxMjM0NDYgTDEyLjEwMDA1MDYsNS44MDEyMzQ0NiBMMTIuMTAwMDUwNiw3LjIwMTIyMTcgTDEwLjcwMDA2MzQsNy4yMDEyMjE3IEwxMC43MDAwNjM0LDUuODAxMzc0NDYgWiBNNS4xMDAxMTQ0Myw4LjYwMTIwODk0IEw1LjEwMDExNDQzLDcuMjAxMjIxNyBMNi41MDAxMDE2Nyw3LjIwMTIyMTcgTDYuNTAwMTAxNjcsOC42MDEyMDg5NCBMNS4xMDAxMTQ0Myw4LjYwMTIwODk0IFogTTE2LjMwMDAxMjMsMTYuOTk5NzMyNCBMMTYuMzAwMDEyMywxMC4wMDExOTYyIEwxNy42OTk5OTk2LDEwLjAwMTE5NjIgTDE3LjY5OTk5OTYsMTYuOTk5NzMyNCBMMTYuMzAwMDEyMywxNi45OTk3MzI0IFogTTEyLjEwMDMzMDYsNy4yMDA4MDE3MSBMMTMuNTAwMzE3OSw3LjIwMDgwMTcxIEwxMy41MDAzMTc5LDguNjAwNzg4OTQgTDE2LjMwMDI5MjMsOC42MDA3ODg5NCBMMTYuMzAwMjkyMywxMC4wMDA3NzYyIEwxNC45MDAzMDUxLDEwLjAwMDc3NjIgTDE0LjkwMDMwNTEsMTEuMzU3MzYzOCBMMTMuNTAwMzE3OSwxMS4zNTczNjM4IEwxMy41MDAzMTc5LDEyLjc1ODc1MSBMMTIuMTAwMzMwNiwxMi43NTg3NTEgTDEyLjEwMDMzMDYsMTQuMTU4NzM4MyBMMTAuNzAwMzQzNCwxNC4xNTg3MzgzIEwxMC43MDAzNDM0LDE1LjU1ODcyNTUgTDkuMjk4OTU2MTUsMTUuNTU4NzI1NSBMOS4yOTg5NTYxNSwxNi45NTg3MTI4IEw3Ljg5ODk2ODkxLDE2Ljk1ODcxMjggTDcuODk4OTY4OTEsMTUuNTU4NzI1NSBMNi40OTg5ODE2OCwxNS41NTg3MjU1IEw2LjQ5ODk4MTY4LDE0LjE1ODczODMgTDUuMTAwMzk0NDIsMTQuMTU4NzM4MyBMNS4xMDAzOTQ0MiwxMi43NTg3NTEgTDMuNzAwNDA3MTksMTIuNzU4NzUxIEwzLjcwMDQwNzE5LDExLjM1NzM2MzggTDYuNDk4OTgxNjgsMTEuMzU3MzYzOCBMNi40OTg5ODE2OCwxMS4zNzEzNjM3IEw5LjI5ODk1NjE1LDExLjM3MTM2MzcgTDkuMjk4OTU2MTUsMTAuMDAwNzc2MiBMMTIuMTAwMzMwNiwxMC4wMDA3NzYyIEwxMi4xMDAzMzA2LDcuMjAwODAxNzEgWiBNMy42OTk5ODcxOSw4LjYwMDY0ODk1IEw1LjA5OTk3NDQzLDguNjAwNjQ4OTUgTDUuMDk5OTc0NDMsMTAuMDAwNjM2MiBMMy42OTk5ODcxOSwxMC4wMDA2MzYyIEwzLjY5OTk4NzE5LDExLjM1NzIyMzggTDIuMjk5OTk5OTUsMTEuMzU3MjIzOCBMMi4yOTk5OTk5NSw5Ljk1NzIzNjU4IEwzLjY5OTk4NzE5LDkuOTU3MjM2NTggTDMuNjk5OTg3MTksOC42MDA2NDg5NSBaIiBpZD0iQ29tYmluZWQtU2hhcGUiIGZpbGw9IiM1NzVFNzUiPjwvcGF0aD4KICAgIDwvZz4KPC9zdmc+",isSelected:t.isSelected,onMouseDown:t.onMouseDown})};Ss.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var Ds=Ss,Ns=function(t){return{type:bi,gradientType:t}};function _s(t){return _s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_s(t)}function Es(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,js(i.key),i)}}function js(t){var e=function(t,e){if("object"!=_s(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=_s(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_s(e)?e:e+""}function ks(t,e,n){return e=zs(e),function(t,e){if(e&&("object"==_s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Os()?Reflect.construct(e,n||[],zs(t).constructor):e.apply(t,n))}function Os(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Os=function(){return!!t})()}function zs(t){return zs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zs(t)}function Ls(t,e){return Ls=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ls(t,e)}var Bs=function(t){function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(e=ks(this,n)).onUpdateImage=t,e.onMouseDown=e.handleMouseDown,e.onMouseDrag=e.handleMouseDrag,e.color=null,e.color2=null,e.gradientType=null,e.active=!1,e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ls(t,e)}(n,t),function(t,e,n){return e&&Es(t.prototype,e),n&&Es(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"setColor",value:function(t){this.color=t}},{key:"setColor2",value:function(t){this.color2=t}},{key:"setGradientType",value:function(t){this.gradientType=t}},{key:"handleMouseDown",value:function(t){this.paint(t)}},{key:"handleMouseDrag",value:function(t){this.paint(t)}},{key:"paint",value:function(t){var n=this,i=Ee().getContext("2d"),r=i,o=this.color;this.gradientType!==ci.SOLID?(r=Ne().getContext("2d"),o="black"):o||(o="rgba(0,0,0,0)");var s=!1;if(s=t.event.shiftKey?function(t,e,n,i,r){t=~~t,e=~~e;var o=Xt(n),s=Ft(t,e,i),a=i.getImageData(0,0,i.canvas.width,i.canvas.height),l=a;if(r!==i&&(l=new ImageData(i.canvas.width,i.canvas.height)),s[0]===o[0]&&s[1]===o[1]&&s[2]===o[2]&&s[3]===o[3])return!1;for(var c=0;c<a.width;c++)for(var u=0;u<a.height;u++)Vt(c,u,a,s)&&qt(c,u,l,o);return r.putImageData(l,0,0),!0}(t.point.x,t.point.y,o,i,r):function(t,e,n,i,r){t=~~t,e=~~e;var o=Xt(n),s=Ft(t,e,i),a=i.getImageData(0,0,i.canvas.width,i.canvas.height),l=a;if(r!==i&&(l=new ImageData(i.canvas.width,i.canvas.height)),s[0]===o[0]&&s[1]===o[1]&&s[2]===o[2]&&s[3]===o[3])return!1;for(var c=[[t,e]];c.length;){var u=c.pop();Jt(u[0],u[1],a,l,o,s,c)}return r.putImageData(l,0,0),!0}(t.point.x,t.point.y,o,i,r),s&&this.gradientType!==ci.SOLID){var a=new(e().Raster)({insert:!1});a.canvas=r.canvas,a.onLoad=function(){a.position=Ee().position,Ee().getContext().globalCompositeOperation="destination-out",Ee().drawImage(a.canvas,new(e().Point)),Ee().getContext().globalCompositeOperation="source-over";var i=Qt(a);if(i.area){var r=new(e().Shape.Rectangle)({insert:!1,rectangle:{topLeft:i.topLeft,bottomRight:i.bottomRight}});r.fillColor=ki(n.color,n.color2,n.gradientType,r.bounds,t.point);var o=r.rasterize(Ee().resolution.width,!1);a.getContext().globalCompositeOperation="source-in",a.drawImage(o.canvas,o.bounds.topLeft),Ee().drawImage(a.canvas,new(e().Point)),n.onUpdateImage()}}}else s&&this.onUpdateImage()}},{key:"deactivateTool",value:function(){}}])}(e().Tool),Ps=Bs;function Rs(t){return Rs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rs(t)}function Us(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Gs(i.key),i)}}function Gs(t){var e=function(t,e){if("object"!=Rs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Rs(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Rs(e)?e:e+""}function Ys(t,e,n){return e=Ws(e),function(t,e){if(e&&("object"==Rs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Zs()?Reflect.construct(e,n||[],Ws(t).constructor):e.apply(t,n))}function Zs(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Zs=function(){return!!t})()}function Ws(t){return Ws=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ws(t)}function Qs(t,e){return Qs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qs(t,e)}var Hs=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=Ys(this,e,[t]),m()(n,["activateTool","deactivateTool"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qs(t,e)}(e,t),function(t,e,n){return e&&Us(t.prototype,e),n&&Us(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidMount",value:function(){this.props.isFillModeActive&&this.activateTool(this.props)}},{key:"componentWillReceiveProps",value:function(t){this.tool&&(t.color!==this.props.color&&this.tool.setColor(t.color),t.color2!==this.props.color2&&this.tool.setColor2(t.color2),t.fillModeGradientType!==this.props.fillModeGradientType&&this.tool.setGradientType(t.fillModeGradientType)),t.isFillModeActive&&!this.props.isFillModeActive?this.activateTool():!t.isFillModeActive&&this.props.isFillModeActive&&this.deactivateTool()}},{key:"shouldComponentUpdate",value:function(t){return t.isFillModeActive!==this.props.isFillModeActive}},{key:"componentWillUnmount",value:function(){this.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){bt(this.props.clearSelectedItems);var t=this.props.color;this.props.color===Di&&(t=Ai,this.props.onChangeFillColor(Ai,0));var e=this.props.fillModeGradientType?this.props.fillModeGradientType:this.props.styleGradientType,n=this.props.color2;e!==this.props.styleGradientType&&(this.props.styleGradientType===ci.SOLID&&(n=ji(t),this.props.onChangeFillColor(n,1)),this.props.changeGradientType(e)),this.props.color2===Di&&(n=ji(),this.props.onChangeFillColor(n,1)),this.tool=new Ps(this.props.onUpdateImage),this.tool.setColor(t),this.tool.setColor2(n),this.tool.setGradientType(e),this.tool.activate()}},{key:"deactivateTool",value:function(){this.tool.deactivateTool(),this.tool.remove(),this.tool=null}},{key:"render",value:function(){return l().createElement(Ds,{isSelected:this.props.isFillModeActive,onMouseDown:this.props.handleMouseDown})}}])}(l().Component);Hs.propTypes={changeGradientType:i().func.isRequired,clearSelectedItems:i().func.isRequired,color:i().string,color2:i().string,styleGradientType:i().oneOf(Object.keys(ci)).isRequired,fillModeGradientType:i().oneOf(Object.keys(ci)),handleMouseDown:i().func.isRequired,isFillModeActive:i().bool.isRequired,onChangeFillColor:i().func.isRequired,onUpdateImage:i().func.isRequired};var Fs=(0,c.connect)(function(t){return{fillModeGradientType:t.scratchPaint.fillMode.gradientType,color:t.scratchPaint.color.fillColor.primary,color2:t.scratchPaint.color.fillColor.secondary,styleGradientType:t.scratchPaint.color.fillColor.gradientType,isFillModeActive:t.scratchPaint.mode===E.BIT_FILL}},function(t){return{clearSelectedItems:function(){t(en())},changeGradientType:function(e){t(Ns(e))},handleMouseDown:function(){t(Zi(E.BIT_FILL))},onChangeFillColor:function(e,n){0===n?t(wi(e)):1===n&&t(Ci(e))}}})(Hs),Vs="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ5LjMgKDUxMTY3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5lcmFzZXI8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iZXJhc2VyIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8cGF0aCBkPSJNOS4zMDAyMjkwNCwxNC4xOTk2OTQ2IEw3Ljg5OTg0NzIzLDE0LjE5OTY5NDYgTDcuODk5ODQ3MjMsMTIuNzk5NzMyNyBMNi40OTk4ODU0MSwxMi43OTk3MzI3IEw2LjQ5OTg4NTQxLDExLjM5OTc3MDkgTDUuMDk5OTIzNTksMTEuMzk5NzcwOSBMNS4wOTk5MjM1OSw5Ljk5ODQwOTEzIEwzLjY5OTk2MTc3LDkuOTk4NDA5MTMgTDMuNjk5OTYxNzcsOC41OTk4NDcyOCBMMi4yOTk5OTk5NSw4LjU5OTg0NzI4IEwyLjI5OTk5OTk1LDcuMTk5ODg1NDYgTDMuNjk5OTYxNzcsNy4xOTk4ODU0NiBMMy42OTk5NjE3Nyw1Ljc5OTkyMzY0IEw1LjA5OTkyMzU5LDUuNzk5OTIzNjQgTDUuMDk5OTIzNTksNC4zOTk5NjE4MiBMNi40OTk4ODU0MSw0LjM5OTk2MTgyIEw2LjQ5OTg4NTQxLDMgTDcuODk5ODQ3MjMsMyBMNy44OTk4NDcyMyw0LjM5OTk2MTgyIEw5LjMwMTIwOTAxLDQuMzk5OTYxODIgTDkuMzAxMjA5MDEsNS43OTk5MjM2NCBMMTAuNzAxMTcwOCw1Ljc5OTkyMzY0IEwxMC43MDExNzA4LDcuMTk5ODg1NDYgTDEyLjEwMTEzMjYsNy4xOTk4ODU0NiBMMTIuMTAxMTMyNiw4LjU5OTg0NzI4IEwxMy40OTk2OTQ1LDguNTk5ODQ3MjggTDEzLjQ5OTY5NDUsOS45OTg0MDkxMyBMMTIuMTAxMTMyNiw5Ljk5ODQwOTEzIEwxMi4xMDExMzI2LDExLjM5OTc3MDkgTDEwLjcwMTE3MDgsMTEuMzk5NzcwOSBMMTAuNzAxMTcwOCwxMi43OTk3MzI3IEw5LjMwMTIwOTAxLDEyLjc5OTczMjcgTDkuMzAxMjA5MDEsMTQuMTk5NTU0NiBMMTAuNzAwMTkwOSwxNC4xOTk1NTQ2IEwxMC43MDAxOTA5LDE1LjU5OTUxNjQgTDkuMzAwMjI5MDQsMTUuNTk5NTE2NCBMOS4zMDAyMjkwNCwxNC4xOTk2OTQ2IFogTTEwLjcwMDE5MDksMTYuOTk5NDc4MiBMMTAuNzAwMTkwOSwxNS41OTk1MTY0IEwxNC45MDAwNzYzLDE1LjU5OTUxNjQgTDE0LjkwMDA3NjMsMTYuOTk5NDc4MiBMMTAuNzAwMTkwOSwxNi45OTk0NzgyIFogTTE0LjkwMDA3NjMsMTUuNTk5NTE2NCBMMTQuOTAwMDc2MywxNC4xOTk1NTQ2IEwxNi4zMDAwMzgxLDE0LjE5OTU1NDYgTDE2LjMwMDAzODEsMTUuNTk5NTE2NCBMMTQuOTAwMDc2MywxNS41OTk1MTY0IFogTTE0LjkwMDA3NjMsMTIuNzk5NTkyNyBMMTQuOTAwMDc2MywxMS4zOTk2MzA5IEwxNi4zMDAwMzgxLDExLjM5OTYzMDkgTDE2LjMwMDAzODEsMTIuNzk5NTkyNyBMMTQuOTAwMDc2MywxMi43OTk1OTI3IFogTTE2LjMwMDAzODEsMTQuMTk5NTU0NiBMMTYuMzAwMDM4MSwxMi43OTk1OTI3IEwxNy43LDEyLjc5OTU5MjcgTDE3LjcsMTQuMTk5NTU0NiBMMTYuMzAwMDM4MSwxNC4xOTk1NTQ2IFogTTEzLjUwMDExNDUsMTEuMzk5NjMwOSBMMTMuNTAwMTE0NSw5Ljk5ODI2OTE0IEwxNC45MDAwNzYzLDkuOTk4MjY5MTQgTDE0LjkwMDA3NjMsMTEuMzk5NjMwOSBMMTMuNTAwMTE0NSwxMS4zOTk2MzA5IFoiIGlkPSJDb21iaW5lZC1TaGFwZSIgZmlsbD0iIzU3NUU3NSI+PC9wYXRoPgogICAgPC9nPgo8L3N2Zz4=",qs=function(t){return l().createElement(ar,{imgDescriptor:lr.eraser,imgSrc:Vs,isSelected:t.isSelected,onMouseDown:t.onMouseDown})};qs.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var Js=qs;function Xs(t){return Xs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xs(t)}function Ks(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,$s(i.key),i)}}function $s(t){var e=function(t,e){if("object"!=Xs(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Xs(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Xs(e)?e:e+""}function ta(t,e,n){return e=na(e),function(t,e){if(e&&("object"==Xs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ea()?Reflect.construct(e,n||[],na(t).constructor):e.apply(t,n))}function ea(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ea=function(){return!!t})()}function na(t){return na=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},na(t)}function ia(t,e){return ia=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ia(t,e)}var ra=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=ta(this,e,[t]),m()(n,["activateTool","deactivateTool"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ia(t,e)}(e,t),function(t,e,n){return e&&Ks(t.prototype,e),n&&Ks(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidMount",value:function(){this.props.isBitEraserModeActive&&this.activateTool(this.props)}},{key:"componentWillReceiveProps",value:function(t){this.tool&&t.bitEraserSize!==this.props.bitEraserSize&&this.tool.setBrushSize(t.bitEraserSize),t.isBitEraserModeActive&&!this.props.isBitEraserModeActive?this.activateTool():!t.isBitEraserModeActive&&this.props.isBitEraserModeActive&&this.deactivateTool()}},{key:"shouldComponentUpdate",value:function(t){return t.isBitEraserModeActive!==this.props.isBitEraserModeActive}},{key:"componentWillUnmount",value:function(){this.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){bt(this.props.clearSelectedItems),this.tool=new Ir(this.props.onUpdateImage,!0),this.tool.setBrushSize(this.props.bitEraserSize),this.tool.activate()}},{key:"deactivateTool",value:function(){this.tool.deactivateTool(),this.tool.remove(),this.tool=null}},{key:"render",value:function(){return l().createElement(Js,{isSelected:this.props.isBitEraserModeActive,onMouseDown:this.props.handleMouseDown})}}])}(l().Component);ra.propTypes={bitEraserSize:i().number.isRequired,clearSelectedItems:i().func.isRequired,handleMouseDown:i().func.isRequired,isBitEraserModeActive:i().bool.isRequired,onUpdateImage:i().func.isRequired};var oa=(0,c.connect)(function(t){return{bitEraserSize:t.scratchPaint.bitEraserSize,isBitEraserModeActive:t.scratchPaint.mode===E.BIT_ERASER}},function(t){return{clearSelectedItems:function(){t(en())},handleMouseDown:function(){t(Zi(E.BIT_ERASER))}}})(ra);function sa(t){return sa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sa(t)}function aa(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,la(i.key),i)}}function la(t){var e=function(t,e){if("object"!=sa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=sa(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==sa(e)?e:e+""}var ca=function(){return function(t,e,n){return e&&aa(t.prototype,e),n&&aa(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.selectionRect=null,this.mode=e,this.setSelectedItems=n,this.clearSelectedItems=i},[{key:"onMouseDown",value:function(t){t||(bt(this.clearSelectedItems),this.clearSelectedItems())}},{key:"onMouseDrag",value:function(t){t.event.button>0||(this.selectionRect&&this.selectionRect.remove(),this.selectionRect=function(t,n){var i=new(e().Point)(.5/e().view.zoom,.5/e().view.zoom),r=t.downPoint.add(i),o=t.point.add(i),s=new(e().Path.Rectangle)(r,o),a=1/e().view.zoom;return _t(s),n||(n="#aaaaaa"),s.parent=Le(),s.strokeColor=n,s.data.isRectSelect=!0,s.data.isHelperItem=!0,s.dashArray=[3*a,3*a],s}(t))}},{key:"onMouseUpVector",value:function(t){t.event.button>0||this.selectionRect&&(!function(t,e,n){for(var i=pt(),r=0;r<i.length;r++){var o=i[r];n===E.RESHAPE&&P(k(o))||(R(o)||z(o)?xt(o,e,o,t,n):Tt(o,t,e,n,o))}}(t,this.selectionRect,this.mode),this.selectionRect.remove(),this.selectionRect=null,this.setSelectedItems())}},{key:"onMouseUpBitmap",value:function(t){if(!(t.event.button>0)&&this.selectionRect){var n=new(e().Rectangle)({from:new(e().Point)(Math.max(0,Math.round(this.selectionRect.bounds.topLeft.x)),Math.max(0,Math.round(this.selectionRect.bounds.topLeft.y))),to:new(e().Point)(Math.min(ce,Math.round(this.selectionRect.bounds.bottomRight.x)),Math.min(ue,Math.round(this.selectionRect.bounds.bottomRight.y)))});if((n=Qt(Ee(),n)).area){var i=Ee().getSubRaster(n);i.parent=e().project.activeLayer,i.canvas.getContext("2d").imageSmoothingEnabled=!1,i.selected=!0;var r=Ee().getSubRaster(n.expand(4));r.remove(),i.data={expanded:r},Ee().getContext(!0).clearRect(n.x,n.y,n.width,n.height),this.setSelectedItems()}this.selectionRect.remove(),this.selectionRect=null}}}])}(),ua=ca;function ha(t){return ha="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ha(t)}function da(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,pa(i.key),i)}}function pa(t){var e=function(t,e){if("object"!=ha(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=ha(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ha(e)?e:e+""}function fa(t,e,n){return e=ma(e),function(t,e){if(e&&("object"==ha(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ga()?Reflect.construct(e,n||[],ma(t).constructor):e.apply(t,n))}function ga(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ga=function(){return!!t})()}function ma(t){return ma=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ma(t)}function ya(t,e){return ya=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ya(t,e)}var va=function(t){function n(t,e,i,r){var o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(o=fa(this,n)).onUpdateImage=r,o.boundingBoxTool=new jo(E.BIT_SELECT,t,e,i,r);var s=new Po(E.BIT_SELECT,o.boundingBoxTool,r);return o.selectionBoxTool=new ua(E.BIT_SELECT,t,e),o.selectionBoxMode=!1,o.selection=null,o.active=!1,o.onMouseDown=o.handleMouseDown,o.onMouseDrag=o.handleMouseDrag,o.onMouseMove=o.handleMouseMove,o.onMouseUp=o.handleMouseUp,o.onKeyUp=s.onKeyUp,o.onKeyDown=s.onKeyDown,o.boundingBoxTool.setSelectionBounds(),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ya(t,e)}(n,t),function(t,e,n){return e&&da(t.prototype,e),n&&da(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"onSelectionChanged",value:function(t){this.boundingBoxTool.onSelectionChanged(t),this.selection&&this.selection.parent&&!this.selection.selected&&this.commitSelection(),(!this.selection||!this.selection.parent)&&t&&1===t.length&&t[0]instanceof e().Raster&&(this.selection=t[0])}},{key:"getHitOptions",value:function(){return{segments:!0,stroke:!0,curves:!0,fill:!0,guide:!1,tolerance:n.TOLERANCE/e().view.zoom,match:function(t){return!t.item.data||!t.item.data.isHelperItem||(t.item.data.isScaleHandle||t.item.data.isRotHandle)}}}},{key:"handleMouseDown",value:function(t){t.event.button>0||(this.active=!0,this.boundingBoxTool.onMouseDown(t,t.modifiers.alt,t.modifiers.shift,!1,this.getHitOptions())||(this.commitSelection(),this.selectionBoxMode=!0,this.selectionBoxTool.onMouseDown(t.modifiers.shift)))}},{key:"handleMouseDrag",value:function(t){t.event.button>0||!this.active||(this.selectionBoxMode?this.selectionBoxTool.onMouseDrag(t):this.boundingBoxTool.onMouseDrag(t))}},{key:"handleMouseMove",value:function(t){this.boundingBoxTool.onMouseMove(t,this.getHitOptions())}},{key:"handleMouseUp",value:function(t){t.event.button>0||!this.active||(this.selectionBoxMode?this.selectionBoxTool.onMouseUpBitmap(t):this.boundingBoxTool.onMouseUp(t),this.selectionBoxMode=!1,this.active=!1)}},{key:"commitSelection",value:function(){this.selection&&this.selection.parent&&(ne(this.selection,Ee()),this.selection.remove(),this.selection=null,this.onUpdateImage())}},{key:"deactivateTool",value:function(){this.commitSelection(),this.boundingBoxTool.deactivateTool(),this.boundingBoxTool=null,this.selectionBoxTool=null}}],[{key:"TOLERANCE",get:function(){return 2}}])}(e().Tool),ba=function(t){return l().createElement(ar,{imgDescriptor:lr.select,imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ5LjMgKDUxMTY3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5tYXJxdWVlPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9Im1hcnF1ZWUiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIGQ9Ik00LjUsNC4xODE4NjExNiBMNC41LDMgTDUuNjgxODYxMTYsMyBMNS42ODE4NjExNiw0LjE4MTg2MTE2IEw0LjUsNC4xODE4NjExNiBaIE0xMS41OTExNjcsNC4xODE4NjExNiBMMTEuNTkxMTY3LDMgTDEyLjc3MzAyODEsMyBMMTIuNzczMDI4MSw0LjE4MTg2MTE2IEwxMS41OTExNjcsNC4xODE4NjExNiBaIE00LjUsMTMuNjM2NzUwNCBMNC41LDEyLjQ1MzcwNzQgTDUuNjgxODYxMTYsMTIuNDUzNzA3NCBMNS42ODE4NjExNiwxMy42MzY3NTA0IEw0LjUsMTMuNjM2NzUwNCBaIE05LjIyNjk3MTg5LDYuNTQ1NzAxNjYgTDEwLjQxMDAxNDksNi41NDU3MDE2NiBMMTAuNDEwMDE0OSw3LjcyNzU2MjgyIEwxMS41OTE4NzYxLDcuNzI3NTYyODIgTDExLjU5MTg3NjEsOC45MDk0MjM5OCBMMTIuNzczNzM3Miw4LjkwOTQyMzk4IEwxMi43NzM3MzcyLDEwLjA5MTI4NTEgTDEzLjk1NTU5ODQsMTAuMDkxMjg1MSBMMTMuOTU1NTk4NCwxMS4yNzMxNDYzIEwxNS4xMzYyNzc3LDExLjI3MzE0NjMgTDE1LjEzNjI3NzcsMTIuNDUzODI1NiBMMTYuMzE4MTM4OCwxMi40NTM4MjU2IEwxNi4zMTgxMzg4LDEzLjYzNjg2ODYgTDE3LjUsMTMuNjM2ODY4NiBMMTcuNSwxNC44MTg3Mjk4IEwxMi43NzM3MzcyLDE0LjgxODcyOTggTDEyLjc3MzczNzIsMTYuMDAwNTkwOSBMMTEuNTkxODc2MSwxNi4wMDA1OTA5IEwxMS41OTE4NzYxLDE3LjE4MjQ1MjEgTDEwLjQxMDAxNDksMTcuMTgyNDUyMSBMMTAuNDEwMDE0OSwxOC4zNjQzMTMyIEw5LjIyNjk3MTg5LDE4LjM2NDMxMzIgTDkuMjI2OTcxODksNi41NDU3MDE2NiBaIE0xMy45NTQ4ODkzLDguOTA5MzA1NzkgTDEzLjk1NDg4OTMsNy43Mjc0NDQ2MyBMMTUuMTM2NzUwNCw3LjcyNzQ0NDYzIEwxNS4xMzY3NTA0LDguOTA5MzA1NzkgTDEzLjk1NDg4OTMsOC45MDkzMDU3OSBaIE02Ljg2MzcyMjMyLDQuMTgxODYxMTYgTDYuODYzNzIyMzIsMyBMOC4wNDU1ODM0OCwzIEw4LjA0NTU4MzQ4LDQuMTgxODYxMTYgTDYuODYzNzIyMzIsNC4xODE4NjExNiBaIE00LjUsMTEuMjczMDI4MSBMNC41LDEwLjA5MTE2NyBMNS42ODE4NjExNiwxMC4wOTExNjcgTDUuNjgxODYxMTYsMTEuMjczMDI4MSBMNC41LDExLjI3MzAyODEgWiBNMTMuOTU0ODg5Myw0LjE4MTg2MTE2IEwxMy45NTQ4ODkzLDMgTDE1LjEzNjc1MDQsMyBMMTUuMTM2NzUwNCw0LjE4MTg2MTE2IEwxMy45NTQ4ODkzLDQuMTgxODYxMTYgWiBNOS4yMjc0NDQ2Myw0LjE4MTg2MTE2IEw5LjIyNzQ0NDYzLDMgTDEwLjQxMDQ4NzcsMyBMMTAuNDEwNDg3Nyw0LjE4MTg2MTE2IEw5LjIyNzQ0NDYzLDQuMTgxODYxMTYgWiBNNC41LDguOTA5MzA1NzkgTDQuNSw3LjcyNzQ0NDYzIEw1LjY4MTg2MTE2LDcuNzI3NDQ0NjMgTDUuNjgxODYxMTYsOC45MDkzMDU3OSBMNC41LDguOTA5MzA1NzkgWiBNNC41LDYuNTQ1NTgzNDggTDQuNSw1LjM2MzcyMjMyIEw1LjY4MTg2MTE2LDUuMzYzNzIyMzIgTDUuNjgxODYxMTYsNi41NDU1ODM0OCBMNC41LDYuNTQ1NTgzNDggWiBNMTMuOTU0ODg5Myw2LjU0NTU4MzQ4IEwxMy45NTQ4ODkzLDUuMzYzNzIyMzIgTDE1LjEzNjc1MDQsNS4zNjM3MjIzMiBMMTUuMTM2NzUwNCw2LjU0NTU4MzQ4IEwxMy45NTQ4ODkzLDYuNTQ1NTgzNDggWiBNNi44NjM3MjIzMiwxMy42MzY3NTA0IEw2Ljg2MzcyMjMyLDEyLjQ1MzcwNzQgTDguMDQ1NTgzNDgsMTIuNDUzNzA3NCBMOC4wNDU1ODM0OCwxMy42MzY3NTA0IEw2Ljg2MzcyMjMyLDEzLjYzNjc1MDQgWiIgaWQ9IkNvbWJpbmVkLVNoYXBlIiBmaWxsPSIjNTc1RTc1Ij48L3BhdGg+CiAgICA8L2c+Cjwvc3ZnPg==",isSelected:t.isSelected,onMouseDown:t.onMouseDown})};ba.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var Ia=ba;function Aa(t){return Aa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Aa(t)}function Ma(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,wa(i.key),i)}}function wa(t){var e=function(t,e){if("object"!=Aa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Aa(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Aa(e)?e:e+""}function Ca(t,e,n){return e=xa(e),function(t,e){if(e&&("object"==Aa(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ta()?Reflect.construct(e,n||[],xa(t).constructor):e.apply(t,n))}function Ta(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ta=function(){return!!t})()}function xa(t){return xa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xa(t)}function Sa(t,e){return Sa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Sa(t,e)}var Da=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=Ca(this,e,[t]),m()(n,["activateTool","deactivateTool"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Sa(t,e)}(e,t),function(t,e,n){return e&&Ma(t.prototype,e),n&&Ma(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidMount",value:function(){this.props.isSelectModeActive&&this.activateTool(this.props)}},{key:"componentWillReceiveProps",value:function(t){this.tool&&t.selectedItems!==this.props.selectedItems&&this.tool.onSelectionChanged(t.selectedItems),t.isSelectModeActive&&!this.props.isSelectModeActive?this.activateTool():!t.isSelectModeActive&&this.props.isSelectModeActive&&this.deactivateTool()}},{key:"shouldComponentUpdate",value:function(t){return t.isSelectModeActive!==this.props.isSelectModeActive}},{key:"componentWillUnmount",value:function(){this.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){this.props.clearGradient(),this.tool=new va(this.props.setSelectedItems,this.props.clearSelectedItems,this.props.setCursor,this.props.onUpdateImage),this.tool.activate()}},{key:"deactivateTool",value:function(){this.tool.deactivateTool(),this.tool.remove(),this.tool=null}},{key:"render",value:function(){return l().createElement(Ia,{isSelected:this.props.isSelectModeActive,onMouseDown:this.props.handleMouseDown})}}])}(l().Component);Da.propTypes={clearGradient:i().func.isRequired,clearSelectedItems:i().func.isRequired,handleMouseDown:i().func.isRequired,isSelectModeActive:i().bool.isRequired,onUpdateImage:i().func.isRequired,selectedItems:i().arrayOf(i().instanceOf(e().Item)),setCursor:i().func.isRequired,setSelectedItems:i().func.isRequired};var Na=(0,c.connect)(function(t){return{isSelectModeActive:t.scratchPaint.mode===E.BIT_SELECT,selectedItems:t.scratchPaint.selectedItems}},function(t){return{clearGradient:function(){t(Ti())},clearSelectedItems:function(){t(en())},setCursor:function(e){t(oo(e))},setSelectedItems:function(){t(tn(At()))},handleMouseDown:function(){t(Zi(E.BIT_SELECT))}}})(Da),_a=p(17),Ea=p.n(_a);function ja(t){return ja="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ja(t)}var ka=["alignContent","alignItems","alignSelf","basis","children","className","componentRef","direction","element","grow","height","justifyContent","width","wrap","shrink","style"];function Oa(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function za(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=ja(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=ja(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ja(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var La,Ba,Pa,Ra,Ua=(La=601,Ba=987654321,Pa=4294967295,Ra=function(){var t=((Ba=36969*(65535&Ba)+(Ba>>16)&Pa)<<16)+(La=18e3*(65535&La)+(La>>16)&Pa)&Pa;return 1+(t/=4294967296)},function(){var t=Math.max(parseInt(100*Ra(),10)%256,1),e=Math.max(parseInt(100*Ra(),10)%256,1),n=Math.max(parseInt(100*Ra(),10)%256,1);return"rgb(".concat(t,",").concat(e,",").concat(n,")")}),Ga=function(t){var e=t.alignContent,n=t.alignItems,i=t.alignSelf,r=t.basis,o=t.children,s=t.className,a=t.componentRef,c=t.direction,u=t.element,h=t.grow,d=t.height,p=t.justifyContent,f=t.width,g=t.wrap,m=t.shrink,y=t.style,v=function(t,e){if(null==t)return{};var n,i,r=function(t,e){if(null==t)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;n[i]=t[i]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)n=o[i],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}(t,ka);return l().createElement(u,function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Oa(Object(n),!0).forEach(function(e){za(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Oa(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({className:s,ref:a,style:Object.assign({alignContent:e,alignItems:n,alignSelf:i,flexBasis:r,flexDirection:c,flexGrow:h,flexShrink:m,flexWrap:g,justifyContent:p,width:f,height:d},process.env.DEBUG?{backgroundColor:Ua(),outline:"1px solid black"}:{},y)},v),o)};Ga.propTypes={alignContent:i().oneOf(["flex-start","flex-end","center","space-between","space-around","stretch"]),alignItems:i().oneOf(["flex-start","flex-end","center","baseline","stretch"]),alignSelf:i().oneOf(["auto","flex-start","flex-end","center","baseline","stretch"]),basis:i().oneOfType([i().number,i().oneOf(["auto"])]),children:i().node,className:i().string,componentRef:i().func,direction:i().oneOf(["row","row-reverse","column","column-reverse"]),element:i().string,grow:i().number,height:i().oneOfType([i().number,i().string]),justifyContent:i().oneOf(["flex-start","flex-end","center","space-between","space-around"]),shrink:i().number,style:Ea(),width:i().oneOfType([i().number,i().string]),wrap:i().oneOf(["nowrap","wrap","wrap-reverse"])},Ga.defaultProps={element:"div",style:{}};var Ya=Ga,Za=p(551),Wa=p.n(Za),Qa={};Qa.styleTagTransform=En(),Qa.setAttributes=Sn(),Qa.insert=Tn().bind(null,"head"),Qa.domAPI=wn(),Qa.insertStyleElement=Nn();An()(Wa(),Qa);var Ha=Wa()&&Wa().locals?Wa().locals:void 0,Fa=function(t){return l().createElement("div",{className:h()(t.className,Ha.buttonGroup)},t.children)};Fa.propTypes={children:i().node.isRequired,className:i().string};var Va=Fa;function qa(t){return qa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qa(t)}function Ja(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Xa(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xa(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Xa(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function Ka(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,$a(i.key),i)}}function $a(t){var e=function(t,e){if("object"!=qa(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=qa(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==qa(e)?e:e+""}var tl=function(){return function(t,e,n){return e&&Ka(t.prototype,e),n&&Ka(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.lastVec=null,this.lastPoint=null,this.finalPath=null,this.smoothed=0,this.smoothingThreshold=20,this.steps=0,this.endCaps=[]},[{key:"onBroadMouseDown",value:function(t,n,i){this.steps=0,this.smoothed=0,this.lastVec=null,n.minDistance=Math.min(5,Math.max(2/e().view.zoom,i.brushSize/2)),n.maxDistance=i.brushSize,t.event.button>0||(this.finalPath=new(e().Path.Circle)({center:t.point,radius:i.brushSize/2}),Pi(this.finalPath,i),this.lastPoint=t.point)}},{key:"onBroadMouseDrag",value:function(t,n,i){this.steps++;var r=t.delta.normalize(i.brushSize/2);if(this.lastVec){var o=this.lastVec.getDirectedAngle(r);if(Math.abs(o)>126){this.simplify(1),this.smoothed++;var s=new(e().Path.Circle)(this.lastPoint,i.brushSize/2);s.fillColor=i.fillColor;var a=new(e().Path.Rectangle)(this.lastPoint.subtract(new(e().Point)(-i.brushSize/2,0)),this.lastPoint.subtract(new(e().Point)(i.brushSize/2,this.lastVec.length)));a.fillColor=i.fillColor,a.rotate(this.lastVec.angle-90,this.lastPoint);var l=new(e().Path.Rectangle)(t.point.subtract(new(e().Point)(-i.brushSize/2,0)),t.point.subtract(new(e().Point)(i.brushSize/2,t.delta.length)));l.fillColor=i.fillColor,l.rotate(r.angle-90,t.point),this.endCaps.push(this.union(s,this.union(a,l)))}}if(r.angle+=90,1===this.steps){this.finalPath.remove(),this.finalPath=new(e().Path);var c=t.delta.normalize(i.brushSize/2);this.finalPath.add(new(e().Segment)(this.lastPoint.subtract(c),c.rotate(-90),c.rotate(90))),Pi(this.finalPath,i),this.finalPath.insert(0,new(e().Segment)(this.lastPoint.subtract(r))),this.finalPath.add(new(e().Segment)(this.lastPoint.add(r)))}if(this.lastVec){var u=this.lastVec.normalize(i.brushSize/2).rotate(90),h=new(e().Point)(u.x+r.x,u.y+r.y).normalize(i.brushSize/2);this.finalPath.segments[0].point=this.lastPoint.subtract(h),this.finalPath.segments[this.finalPath.segments.length-1].point=this.lastPoint.add(h)}this.finalPath.add(t.point.add(r)),this.finalPath.insert(0,t.point.subtract(r)),this.finalPath.segments.length>this.smoothed+2*this.smoothingThreshold&&this.simplify(1),this.lastVec=t.delta,this.lastPoint=t.point}},{key:"simplify",value:function(t){var n=this.finalPath.segments.length,i=Math.floor((n-this.smoothed)/2)+1,r=Math.min(i+1,Math.floor(n/2)),o=Math.max(n-1-i,Math.floor(n/2)+1);if(!(r<=1||o>=n-1)){var s=new(e().Path)(this.finalPath.segments.slice(1,r)),a=new(e().Path)(this.finalPath.segments.slice(r,o)),l=new(e().Path)(this.finalPath.segments.slice(o,n-1)),c=s.segments[s.segments.length-1],u=l.segments[0];s.simplify(t),l.simplify(t);var h=s.segments[s.segments.length-1],d=l.segments[0];h.handleOut=c.handleOut,d.handleIn=u.handleIn,this.finalPath.removeSegments(1,this.finalPath.segments.length-1),this.finalPath.insertSegments(1,s.segments.concat(a.segments).concat(l.segments)),s.remove(),l.remove(),a.remove(),this.smoothed=Math.max(2,this.finalPath.segments.length)}}},{key:"union",value:function(t,e){var n=t.unite(e);return t.remove(),e.remove(),n}},{key:"onBroadMouseUp",value:function(t,n,i){if(0===this.steps)return this.endCaps.length=0,this.finalPath;var r=this.lastVec;if(!t.point.equals(this.lastPoint)){var o=(r=t.point.subtract(this.lastPoint)).normalize(i.brushSize/2);o.angle+=90;var a=t.point.add(o),l=t.point.subtract(o);this.finalPath.add(a),this.finalPath.insert(0,l)}this.simplify(1);var c=r.normalize(i.brushSize/2);this.finalPath.add(new(e().Segment)(t.point.add(c),c.rotate(90),c.rotate(-90))),this.finalPath.closePath();var u=this.finalPath.resolveCrossings().reorient(!0,!0).reduce({simplify:!0});u!==this.finalPath&&(u.copyAttributes(this.finalPath),u.fillColor=this.finalPath.fillColor,this.finalPath.remove(),this.finalPath=u);var h,d=Ja(this.endCaps);try{for(d.s();!(h=d.n()).done;){var p=h.value,f=this.union(this.finalPath,p);f.area>=this.finalPath.area&&(!(f instanceof e().CompoundPath)||this.finalPath instanceof e().CompoundPath)?this.finalPath=f:(this.finalPath.insertAbove(f),f.remove(),s.warn("Skipping a merge."))}}catch(t){d.e(t)}finally{d.f()}return this.endCaps.length=0,this.finalPath}}])}(),el=tl;function nl(t){return nl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nl(t)}function il(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,rl(i.key),i)}}function rl(t){var e=function(t,e){if("object"!=nl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=nl(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==nl(e)?e:e+""}var ol=function(){return function(t,e,n){return e&&il(t.prototype,e),n&&il(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.lastPoint=null,this.finalPath=null,this.firstCircle=null},[{key:"onSegmentMouseDown",value:function(t,n,i){t.event.button>0||(n.minDistance=2/e().view.zoom,n.maxDistance=i.brushSize,this.firstCircle=new(e().Path.Circle)({center:t.point,radius:i.brushSize/2}),this.finalPath=this.firstCircle,Pi(this.finalPath,i),this.lastPoint=t.point)}},{key:"onSegmentMouseDrag",value:function(t,n,i){if(!(t.event.button>0)){var r=t.delta.normalize(i.brushSize/2),o=r.clone();o.length=i.brushSize/2,o.angle+=90;var s=new(e().Path);Pi(s,i),s.add(new(e().Segment)(this.lastPoint.subtract(r),o.multiply(-1),o)),r.angle+=90,s.add(t.lastPoint.add(r)),s.insert(0,t.lastPoint.subtract(r)),s.add(t.point.add(r)),s.insert(0,t.point.subtract(r)),r.angle-=90,s.add(new(e().Segment)(t.point.add(r),o,o.multiply(-1))),s.closed=!0,s.flatten(Math.min(5,i.brushSize/5)),this.lastPoint=t.point;var a=this.finalPath.unite(s);s.remove(),this.finalPath.remove(),this.finalPath=a}}},{key:"onSegmentMouseUp",value:function(t){if(!(t.event.button>0)){if(this.finalPath.segments&&this.finalPath.segments.length>4){this.finalPath.closed=!1,this.finalPath.simplify(2),this.finalPath.closed=!0;var e=this.finalPath.unite(this.firstCircle);this.finalPath.remove(),this.finalPath=e}return this.finalPath}}}])}(),sl=ol;function al(t){return al="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},al(t)}function ll(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return cl(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cl(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function cl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function ul(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function hl(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ul(Object(n),!0).forEach(function(e){dl(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ul(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function dl(t,e,n){return(e=fl(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pl(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,fl(i.key),i)}}function fl(t){var e=function(t,e){if("object"!=al(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=al(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==al(e)?e:e+""}var gl=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.broadBrushHelper=new el,this.segmentBrushHelper=new sl,this.onUpdateImage=e,this.clearSelectedItems=n,this.strokeColor=null,this.brushSize=null,this.fillColor=null}return function(t,e,n){return e&&pl(t.prototype,e),n&&pl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(t,[{key:"setOptions",value:function(t){var e=this.options?this.options.fillColor:"black",n=this.options?this.options.strokeColor:null,i=this.options?this.options.strokeWidth:null;this.options=hl(hl({},t),{},{fillColor:t.fillColor===Di?e:t.fillColor,strokeColor:t.strokeColor===Di?n:t.strokeColor,strokeWidth:null===t.strokeWidth?i:t.strokeWidth}),this.resizeCursorIfNeeded()}},{key:"activateTool",value:function(n){this.tool=new(e().Tool),this.cursorPreviewLastPoint=new(e().Point)(-1e4,-1e4),this.setOptions(n),this.tool.active=!1,this.tool.fixedDistance=1;var i=this;this.tool.onMouseMove=function(t){i.resizeCursorIfNeeded(t.point),Ri(i.cursorPreview,i.options),i.cursorPreview.bringToFront(),i.cursorPreview.position=t.point},this.tool.onMouseDown=function(e){i.resizeCursorIfNeeded(e.point),e.event.button>0||(this.active=!0,i.options.brushSize<t.THRESHOLD?(i.brush=t.BROAD,i.broadBrushHelper.onBroadMouseDown(e,i.tool,i.options)):(i.brush=t.SEGMENT,i.segmentBrushHelper.onSegmentMouseDown(e,i.tool,i.options)),i.cursorPreview.bringToFront(),i.cursorPreview.position=e.point)},this.tool.onMouseDrag=function(e){e.event.button>0||!this.active||(i.brush===t.BROAD?i.broadBrushHelper.onBroadMouseDrag(e,i.tool,i.options):i.brush===t.SEGMENT?i.segmentBrushHelper.onSegmentMouseDrag(e,i.tool,i.options):s.warn("Brush type does not exist: ".concat(i.brush)),i.cursorPreview.bringToFront(),i.cursorPreview.position=e.point)},this.tool.onMouseUp=function(e){var n;e.event.button>0||!this.active||(i.brush===t.BROAD?n=i.broadBrushHelper.onBroadMouseUp(e,i.tool,i.options):i.brush===t.SEGMENT?n=i.segmentBrushHelper.onSegmentMouseUp(e,i.tool,i.options):s.warn("Brush type does not exist: ".concat(i.brush)),i.options.isEraser?i.mergeEraser(n):i.mergeBrush(n),i.cursorPreview.remove(),i.onUpdateImage(),i.cursorPreview.parent=Le(),i.brush=null,this.fixedDistance=1,this.active=!1)},this.tool.activate()}},{key:"resizeCursorIfNeeded",value:function(t){this.options&&(this.cursorPreview&&!this.cursorPreview.parent&&(this.cursorPreview=null),this.cursorPreview&&this.brushSize===this.options.brushSize&&this.fillColor===this.options.fillColor&&this.strokeColor===this.options.strokeColor&&this.cursorPreviewLastPoint.equals(t)||(void 0!==t&&(this.cursorPreviewLastPoint=t),this.cursorPreview||(this.cursorPreview=new(e().Shape.Ellipse)({point:this.cursorPreviewLastPoint,size:this.options.brushSize/2}),this.cursorPreview.parent=Le(),this.cursorPreview.data.isHelperItem=!0,Be(this.cursorPreview)),this.cursorPreview.position=this.cursorPreviewLastPoint,this.cursorPreview.radius=this.options.brushSize/2,this.brushSize=this.options.brushSize,this.fillColor=this.options.fillColor,this.strokeColor=this.options.strokeColor,Ri(this.cursorPreview,this.options)))}},{key:"mergeBrush",value:function(t){var n,i=this,r=ht({match:function(n){return i.isMergeable(t,n)&&n.parent instanceof e().Layer}}),o=t;for(n=r.length-1;n>=0&&!this.touches(r[n],t);n--);for(var s=n;n>=0;n--)if(this.touches(r[n],t))if(r[n].getFillColor()){if(this.colorMatch(r[n],t)){for(var a=s;a>n;a--)this.touches(r[a],r[n]);var l=o.unite(r[n]);l.strokeColor=r[n].strokeColor,l.strokeWidth=r[n].strokeWidth,o===t?l.insertAbove(r[n]):(l.insertAbove(o),s--),o.remove(),o=l,r[n].remove(),r.splice(n,1)}}else;}},{key:"mergeEraser",value:function(t){var n=this,i=ht({match:function(e){return e.selected&&n.isMergeable(t,e)&&n.touches(t,e)&&!F(e)},class:e().PathItem});0===i.length&&(bt(this.clearSelectedItems),i=ht({match:function(e){return n.isMergeable(t,e)&&n.touches(t,e)&&!F(e)},class:e().PathItem}));for(var r=i.length-1;r>=0;r--)if(!(i[r]instanceof e().Path)||i[r].fillColor&&0!==i[r].fillColor._alpha){var o=i[r].subtract(t);o.insertBelow(i[r]);var s=[];if(i[r]instanceof e().Path&&!i[r].closed){for(var a=i[r].clone(),l=a.getIntersections(t),c=l.length-1;c>=0;c--){var u=a.splitAt(l[c]);u.insertAbove(a),s.push(u)}s.push(a)}for(var h=s.length-1;h>=0;h--){var d=s[h].getLocationAt(s[h].length/2).point;(t.contains(d)||o.contains(d))&&(s[h].remove(),s.splice(h,1))}o.children&&(this.separateCompoundPath(o),o.remove()),i[r].remove()}else{for(var p=[],f=i[r],g=f.getIntersections(t),m=g.length-1;m>=0;m--){var y=f.splitAt(g[m]);y&&(y.insertAbove(f),p.push(y))}p.push(f);for(var v=p.length-1;v>=0;v--){var b=p[v].getLocationAt(p[v].length/2).point;t.contains(b)&&(p[v].remove(),p.splice(v,1))}t.remove()}t.remove()}},{key:"separateCompoundPath",value:function(t){t.isClockwise()||t.reverse();for(var e=[],n=[],i=t.children.length-1;i>=0;i--){var r=t.children[i];r.isClockwise()?e.push(r):n.push(r)}e.sort(function(t,e){return t.area-e.area}),n.sort(function(t,e){return Math.abs(t.area)-Math.abs(e.area)});for(var o=0;o<e.length;o++){var s=e[o];s.copyAttributes(t),s.fillColor=t.fillColor,s.strokeColor=t.strokeColor,s.strokeWidth=t.strokeWidth,s.insertAbove(t);for(var a=s,l=n.length-1;l>=0;l--){var c=n[l];if(this.firstEnclosesSecond(s,c)){var u=a.subtract(c);u.insertAbove(t),a.remove(),a=u,c.remove(),n.splice(l,1)}}}}},{key:"colorMatch",value:function(t,e){return t.getFillColor().equals(e.getFillColor())&&(e.getStrokeColor()===t.getStrokeColor()||e.getStrokeColor()&&e.getStrokeColor().equals(t.getStrokeColor()))&&e.getStrokeWidth()===t.getStrokeWidth()&&this.touches(t,e)}},{key:"touches",value:function(t,e){return!!(t&&e&&t.intersects(e))||(this.firstEnclosesSecond(t,e)||this.firstEnclosesSecond(e,t))}},{key:"firstEnclosesSecond",value:function(t,e){return!!(t&&e&&e.firstSegment&&e.firstSegment.point&&t.hitTest(e.firstSegment.point))}},{key:"matchesAnyChild",value:function(t,e){var n,i=ll(t.children);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(r.children&&this.matchesAnyChild(e,r))return!0;if(e===r)return!0}}catch(t){i.e(t)}finally{i.f()}return!1}},{key:"isMergeable",value:function(t,n){if(n instanceof e().PathItem)return(!t.children||!this.matchesAnyChild(t,n))&&n!==t}},{key:"deactivateTool",value:function(){this.cursorPreview&&(this.cursorPreview.remove(),this.cursorPreview=null),this.tool.remove(),this.tool=null}}],[{key:"BROAD",get:function(){return"broadbrush"}},{key:"SEGMENT",get:function(){return"segmentbrush"}},{key:"THRESHOLD",get:function(){return 30/e().view.zoom}}])}(),ml=gl,yl="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+YnJ1c2g8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPgogICAgICAgIDxnIGlkPSJicnVzaCIgc3Ryb2tlPSIjNTc1RTc1IiBzdHJva2Utd2lkdGg9IjAuNSIgZmlsbD0iIzU3NUU3NSI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMi41Nzg3MjI1LDExLjIxMDIwMjYgQzExLjYxOTYyODQsMTIuMTY5Mjk2NyAxMC45MTI5Mjc0LDEyLjY2MTQ2MzQgMTAuMzU3NjYyNCwxMi44NTA3NTgzIEMxMC4xOTM2MDY5LDEyLjM0NTk3MTkgOS45MTU5NzQzNywxMS44NzkwNDQ1IDkuNTI0NzY0OTQsMTEuNDg3ODM1MSBDOS4xMjA5MzU4NSwxMS4wOTY2MjU3IDguNjU0MDA4NDYsMTAuODE4OTkzMiA4LjE0OTIyMjA5LDEwLjY0MjMxNzkgQzguMzUxMTM2NjQsMTAuMDg3MDUyOSA4Ljg0MzMwMzM1LDkuMzgwMzUyMDMgOS43ODk3Nzc3OCw4LjQzMzg3NzU5IEMxMi4wNjEzMTY0LDYuMTQ5NzE5MjkgMTYuMDk5NjA3NCwzLjM2MDc3NDYxIDE2Ljg2OTQwNjYsNC4xMzA1NzM4MiBDMTcuNjM5MjA1OCw0LjkwMDM3MzAzIDE0Ljg1MDI2MTEsOC45Mzg2NjM5NiAxMi41Nzg3MjI1LDExLjIxMDIwMjYgWiBNOC4zOTEyNDMzNCwxNS40MTIwMTA0IEM4LjAxNTY5MTk3LDE1Ljc3NDg2NTcgNy41MzExMDk1NSwxNS45NjIxNDU5IDcuMDQ2NTI3MTMsMTUuOTg1NTU1OSBMNy4wNDY1MjcxMywxNS45OTcyNjA5IEw2LjkyNTM4MTUzLDE1Ljk5NzI2MDkgQzMuNjc4Njc5MzQsMTYuMTE0MzExIDIuMjYxMjc1NzcsMTIuNDM4OTM3OSAzLjM3NTgxNTMzLDEyLjgyNTIwMzIgQzQuODQxNjc3MTQsMTMuMzI4NTE4NiA1LjQzNjUwMjA1LDEyLjYwMjgwOCA1LjQ1OTUxOTcyLDEyLjU3OTM5OCBDNi4yNzExOTUyNywxMS44MDY4NjczIDcuNTc5NTY3NzksMTEuODA2ODY3MyA4LjM5MTI0MzM0LDEyLjU3OTM5OCBDOS4yMDI5MTg4OSwxMy4zNjM2MzM3IDkuMjAyOTE4ODksMTQuNjM5NDc5OCA4LjM5MTI0MzM0LDE1LjQxMjAxMDQgWiIgaWQ9ImJ1cnNoLWljb24iPjwvcGF0aD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg==",vl=function(t){return l().createElement(ar,{imgDescriptor:lr.brush,imgSrc:yl,isSelected:t.isSelected,onMouseDown:t.onMouseDown})};vl.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var bl=vl;function Il(t){return Il="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Il(t)}function Al(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function Ml(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Al(Object(n),!0).forEach(function(e){wl(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Al(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function wl(t,e,n){return(e=Tl(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Cl(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Tl(i.key),i)}}function Tl(t){var e=function(t,e){if("object"!=Il(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Il(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Il(e)?e:e+""}function xl(t,e,n){return e=Dl(e),function(t,e){if(e&&("object"==Il(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Sl()?Reflect.construct(e,n||[],Dl(t).constructor):e.apply(t,n))}function Sl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Sl=function(){return!!t})()}function Dl(t){return Dl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Dl(t)}function Nl(t,e){return Nl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Nl(t,e)}var _l=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=xl(this,e,[t]),m()(n,["activateTool","deactivateTool"]),n.blob=new ml(n.props.onUpdateImage,n.props.clearSelectedItems),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Nl(t,e)}(e,t),function(t,e,n){return e&&Cl(t.prototype,e),n&&Cl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidMount",value:function(){this.props.isBrushModeActive&&this.activateTool(this.props)}},{key:"componentWillReceiveProps",value:function(t){if(t.isBrushModeActive&&!this.props.isBrushModeActive)this.activateTool();else if(!t.isBrushModeActive&&this.props.isBrushModeActive)this.deactivateTool();else if(t.isBrushModeActive&&this.props.isBrushModeActive){var e=t.colorState,n=e.fillColor,i=e.strokeColor,r=e.strokeWidth;this.blob.setOptions(Ml({isEraser:!1,fillColor:n.primary,strokeColor:i.primary,strokeWidth:r},t.brushModeState))}}},{key:"shouldComponentUpdate",value:function(t){return t.isBrushModeActive!==this.props.isBrushModeActive}},{key:"componentWillUnmount",value:function(){this.blob.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){bt(this.props.clearSelectedItems),this.props.clearGradient();var t=this.props.colorState.fillColor.primary;t!==Di&&null!==t||this.props.onChangeFillColor(Ai),this.blob.activateTool(Ml(Ml({isEraser:!1},this.props.colorState),this.props.brushModeState))}},{key:"deactivateTool",value:function(){this.blob.deactivateTool()}},{key:"render",value:function(){return l().createElement(bl,{isSelected:this.props.isBrushModeActive,onMouseDown:this.props.handleMouseDown})}}])}(l().Component);_l.propTypes={brushModeState:i().shape({brushSize:i().number.isRequired}),clearGradient:i().func.isRequired,clearSelectedItems:i().func.isRequired,colorState:i().shape({fillColor:Xr,strokeColor:Xr,strokeWidth:i().number}).isRequired,handleMouseDown:i().func.isRequired,isBrushModeActive:i().bool.isRequired,onChangeFillColor:i().func.isRequired,onUpdateImage:i().func.isRequired};var El=(0,c.connect)(function(t){return{brushModeState:t.scratchPaint.brushMode,colorState:t.scratchPaint.color,isBrushModeActive:t.scratchPaint.mode===E.BRUSH}},function(t){return{clearSelectedItems:function(){t(en())},clearGradient:function(){t(Ti())},handleMouseDown:function(){t(Zi(E.BRUSH))},onChangeFillColor:function(e){t(wi(e))}}})(_l),jl="scratch-paint/eraser-mode/CHANGE_ERASER_SIZE",kl={brushSize:40},Ol=function(t){return{type:jl,brushSize:t}},zl="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+ZXJhc2VyPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9ImVyYXNlciIgZmlsbD0iIzU3NUU3NSI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMy41MzcwMDYxLDE0LjgyOTE1OTcgTDEwLjk2NjA1NDUsMTQuODI5MTU5NyBMOC4zMDE2MTM4LDEyLjE2NDcxOSBMMTEuMTY4NjE0NCw5LjI5NzcxODQyIEwxNS4xMjYzMjE2LDEzLjI1NTQyNTcgTDEzLjUzNzAwNjEsMTQuODI5MTU5NyBaIE0xNi43Nzc5NjMzLDEyLjY5NDQ5MDggTDExLjE2ODYxNDQsNy4xMDA3MjM0MyBMOC4zMDE2MTM4LDQuMjMzNzIyODcgQzguMDA1NTY0ODMsMy45MjIwOTIzOCA3LjUwNjk1NjA0LDMuOTIyMDkyMzggNy4xOTUzMjU1NCw0LjIzMzcyMjg3IEwzLjIyMjAzNjczLDguMjA3MDExNjkgQzIuOTI1OTg3NzYsOC41MDMwNjA2NiAyLjkyNTk4Nzc2LDkuMDAxNjY5NDUgMy4yMjIwMzY3Myw5LjI5NzcxODQyIEw2LjEwNDYxODgxLDEyLjE2NDcxOSBMMTAuMDkzNDg5MSwxNi4xNTM1ODkzIEMxMC4yMzM3MjI5LDE2LjMwOTQwNDYgMTAuNDM2MjgyNywxNi4zODczMTIyIDEwLjYzODg0MjUsMTYuMzg3MzEyMiBMMTMuODY0MjE4MSwxNi4zODczMTIyIEMxNC4wNjY3NzgsMTYuMzg3MzEyMiAxNC4yNjkzMzc4LDE2LjMwOTQwNDYgMTQuNDA5NTcxNSwxNi4xNTM1ODkzIEwxNi43Nzc5NjMzLDEzLjgwMDc3OTEgQzE3LjA3NDAxMjIsMTMuNTA0NzMwMSAxNy4wNzQwMTIyLDEzLjAwNjEyMTMgMTYuNzc3OTYzMywxMi42OTQ0OTA4IEwxNi43Nzc5NjMzLDEyLjY5NDQ5MDggWiIgaWQ9ImVyYXNlci1pY29uIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",Ll=function(t){return l().createElement(ar,{imgDescriptor:lr.eraser,imgSrc:zl,isSelected:t.isSelected,onMouseDown:t.onMouseDown})};Ll.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var Bl=Ll;function Pl(t){return Pl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pl(t)}function Rl(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function Ul(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Rl(Object(n),!0).forEach(function(e){Gl(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Rl(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Gl(t,e,n){return(e=Zl(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Yl(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Zl(i.key),i)}}function Zl(t){var e=function(t,e){if("object"!=Pl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Pl(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Pl(e)?e:e+""}function Wl(t,e,n){return e=Hl(e),function(t,e){if(e&&("object"==Pl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ql()?Reflect.construct(e,n||[],Hl(t).constructor):e.apply(t,n))}function Ql(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ql=function(){return!!t})()}function Hl(t){return Hl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Hl(t)}function Fl(t,e){return Fl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fl(t,e)}var Vl=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=Wl(this,e,[t]),m()(n,["activateTool","deactivateTool"]),n.blob=new ml(n.props.onUpdateImage,n.props.clearSelectedItems),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Fl(t,e)}(e,t),function(t,e,n){return e&&Yl(t.prototype,e),n&&Yl(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidMount",value:function(){this.props.isEraserModeActive&&this.activateTool()}},{key:"componentWillReceiveProps",value:function(t){t.isEraserModeActive&&!this.props.isEraserModeActive?this.activateTool():!t.isEraserModeActive&&this.props.isEraserModeActive?this.deactivateTool():t.isEraserModeActive&&this.props.isEraserModeActive&&this.blob.setOptions(Ul({isEraser:!0},t.eraserModeState))}},{key:"shouldComponentUpdate",value:function(t){return t.isEraserModeActive!==this.props.isEraserModeActive}},{key:"componentWillUnmount",value:function(){this.blob.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){this.blob.activateTool(Ul({isEraser:!0},this.props.eraserModeState))}},{key:"deactivateTool",value:function(){this.blob.deactivateTool()}},{key:"render",value:function(){return l().createElement(Bl,{isSelected:this.props.isEraserModeActive,onMouseDown:this.props.handleMouseDown})}}])}(l().Component);Vl.propTypes={clearSelectedItems:i().func.isRequired,eraserModeState:i().shape({brushSize:i().number.isRequired}),handleMouseDown:i().func.isRequired,isEraserModeActive:i().bool.isRequired,onUpdateImage:i().func.isRequired};var ql=(0,c.connect)(function(t){return{eraserModeState:t.scratchPaint.eraserMode,isEraserModeActive:t.scratchPaint.mode===E.ERASER}},function(t){return{clearSelectedItems:function(){t(en())},changeBrushSize:function(e){t(Ol(e))},handleMouseDown:function(){t(Zi(E.ERASER))}}})(Vl),Jl="scratch-paint/color-index/CHANGE_COLOR_INDEX",Xl=function(t){return{type:Jl,index:t}};function Kl(t){return Kl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kl(t)}function $l(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=Kl(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Kl(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Kl(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var tc="scratch-paint/modals/OPEN_MODAL",ec="scratch-paint/modals/CLOSE_MODAL",nc="fillColor",ic="strokeColor",rc=$l($l({},nc,!1),ic,!1),oc=function(t){return{type:tc,modal:t}},sc=function(t){return{type:ec,modal:t}},ac=p(982),lc=p.n(ac),cc=i().shape({locale:i().string.isRequired,formatMessage:i().func.isRequired}),uc=p(53),hc=p.n(uc),dc="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+bm8tZmlsbDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZS1saW5lY2FwPSJzcXVhcmUiPgogICAgICAgIDxnIGlkPSJuby1maWxsIiBzdHJva2U9IiNGRjY2MUEiIHN0cm9rZS13aWR0aD0iMiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0zLDE3IEwxNywzIiBpZD0iTGluZSI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",pc="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+bWl4ZWQtZmlsbDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGZpbGwtb3BhY2l0eT0iMC43NSI+CiAgICAgICAgPGcgaWQ9Im1peGVkLWZpbGwiPgogICAgICAgICAgICA8ZyBpZD0ibWl4ZWQtZmlsbC1pY29uIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyLjAwMDAwMCwgMi41MDAwMDApIj4KICAgICAgICAgICAgICAgIDxjaXJjbGUgaWQ9ImJsdWUiIGZpbGw9IiM0Qzk3RkYiIGN4PSI0LjUiIGN5PSIxMC41IiByPSI0LjUiPjwvY2lyY2xlPgogICAgICAgICAgICAgICAgPGNpcmNsZSBpZD0icmVkIiBmaWxsPSIjRkY1NTAwIiBjeD0iOCIgY3k9IjQuNSIgcj0iNC41Ij48L2NpcmNsZT4KICAgICAgICAgICAgICAgIDxjaXJjbGUgaWQ9InllbGxvdyIgZmlsbD0iI0ZGQkYwMCIgY3g9IjExLjQwOTk5OTgiIGN5PSIxMC41IiByPSI0LjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4K",fc=p(227),gc=p.n(fc),mc={};mc.styleTagTransform=En(),mc.setAttributes=Sn(),mc.insert=Tn().bind(null,"head"),mc.domAPI=wn(),mc.insertStyleElement=Nn();An()(gc(),mc);var yc=gc()&&gc().locals?gc().locals:void 0;function vc(t){return vc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vc(t)}function bc(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=vc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=vc(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vc(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ic=function(t,e,n){if(t===Di||n!==ci.SOLID&&e===Di)return"white";switch(null===t&&(t="white"),null===e&&(e="white"),n){case ci.SOLID:return t;case ci.HORIZONTAL:return"linear-gradient(to right, ".concat(t,", ").concat(e,")");case ci.VERTICAL:return"linear-gradient(".concat(t,", ").concat(e,")");case ci.RADIAL:return"radial-gradient(".concat(t,", ").concat(e,")");default:s.error("Unrecognized gradient type: ".concat(n))}},Ac=function(t){return l().createElement("div",{className:yc.colorButton,onClick:t.onClick},l().createElement("div",{className:h()(yc.colorButtonSwatch,bc({},yc.outlineSwatch,t.outline&&!(t.color===Di))),style:{background:Ic(t.color,t.color2,t.gradientType)}},null!==t.color||t.gradientType!==ci.SOLID&&null!==t.color2?t.color===Di||t.gradientType!==ci.SOLID&&t.color2===Di?l().createElement("img",{className:yc.swatchIcon,draggable:!1,src:pc}):null:l().createElement("img",{className:yc.swatchIcon,draggable:!1,src:dc})),l().createElement("div",{className:yc.colorButtonArrow},"▾"))};Ac.propTypes={color:i().string,color2:i().string,gradientType:i().oneOf(Object.keys(ci)).isRequired,onClick:i().func.isRequired,outline:i().bool.isRequired},Ac.defaultProps={outline:!1};var Mc=Ac,wc=p(397),Cc=p.n(wc),Tc={};Tc.styleTagTransform=En(),Tc.setAttributes=Sn(),Tc.insert=Tn().bind(null,"head"),Tc.domAPI=wn(),Tc.insertStyleElement=Nn();An()(Cc(),Tc);var xc=Cc()&&Cc().locals?Cc().locals:void 0;function Sc(t){return Sc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sc(t)}function Dc(t,e,n){return(e=_c(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Nc(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,_c(i.key),i)}}function _c(t){var e=function(t,e){if("object"!=Sc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Sc(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Sc(e)?e:e+""}function Ec(t,e,n){return e=kc(e),function(t,e){if(e&&("object"==Sc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,jc()?Reflect.construct(e,n||[],kc(t).constructor):e.apply(t,n))}function jc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(jc=function(){return!!t})()}function kc(t){return kc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},kc(t)}function Oc(t,e){return Oc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Oc(t,e)}var zc=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=Ec(this,e,[t]),m()(n,["handleMouseDown","handleMouseUp","handleMouseMove","handleClickBackground","setBackground","setHandle"]),n.handleClickOffset=0,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Oc(t,e)}(e,t),function(t,e,n){return e&&Nc(t.prototype,e),n&&Nc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"handleMouseDown",value:function(t){document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("touchmove",this.handleMouseMove,{passive:!1}),document.addEventListener("touchend",this.handleMouseUp),this.handleClickOffset=$n(t).x-this.handle.getBoundingClientRect().left}},{key:"handleMouseUp",value:function(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("touchmove",this.handleMouseMove,{passive:!1}),document.removeEventListener("touchend",this.handleMouseUp)}},{key:"handleMouseMove",value:function(t){t.preventDefault(),this.props.onChange(this.scaleMouseToSliderPosition(t))}},{key:"handleClickBackground",value:function(t){t.target===this.background&&(this.handleClickOffset=13,this.props.onChange(this.scaleMouseToSliderPosition(t)))}},{key:"scaleMouseToSliderPosition",value:function(t){var e=$n(t).x,n=this.background.getBoundingClientRect(),i=e-n.left-this.handleClickOffset;return Math.max(0,Math.min(100,100*i/(n.width-26)))}},{key:"setBackground",value:function(t){this.background=t}},{key:"setHandle",value:function(t){this.handle=t}},{key:"render",value:function(){var t=13+this.props.value/100*124-13;return l().createElement("div",{className:h()(Dc(Dc({},xc.container,!0),xc.last,this.props.lastSlider)),ref:this.setBackground,style:{backgroundImage:this.props.background},onClick:this.handleClickBackground},l().createElement("div",{className:xc.handle,ref:this.setHandle,style:{left:"".concat(t,"px")},onMouseDown:this.handleMouseDown,onTouchStart:this.handleMouseDown}))}}])}(l().Component);zc.propTypes={background:i().string,lastSlider:i().bool,onChange:i().func.isRequired,value:i().number.isRequired},zc.defaultProps={background:"yellow"};var Lc=zc,Bc=p(778),Pc=p.n(Bc),Rc={};Rc.styleTagTransform=En(),Rc.setAttributes=Sn(),Rc.insert=Tn().bind(null,"head"),Rc.domAPI=wn(),Rc.insertStyleElement=Nn();An()(Pc(),Rc);var Uc=Pc()&&Pc().locals?Pc().locals:void 0,Gc=["className","hideLabel","imgAlt","imgSrc","onClick","title"];function Yc(){return Yc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Yc.apply(null,arguments)}var Zc=function(t){var e=t.className,n=t.hideLabel,i=t.imgAlt,r=t.imgSrc,o=t.onClick,s=t.title,a=function(t,e){if(null==t)return{};var n,i,r=function(t,e){if(null==t)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;n[i]=t[i]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)n=o[i],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}(t,Gc);return l().createElement($i,Yc({className:h()(e,Uc.modEditField),onClick:o},a),l().createElement("img",{alt:i||s,className:Uc.editFieldIcon,draggable:!1,src:r,title:s}),!n&&l().createElement("span",{className:Uc.editFieldTitle},s))};Zc.propTypes={className:i().string,hideLabel:i().bool,highlighted:i().bool,imgAlt:i().string,imgSrc:i().string.isRequired,onClick:i().func.isRequired,title:i().string.isRequired};var Wc=Zc,Qc=p(939),Hc=p.n(Qc),Fc={};Fc.styleTagTransform=En(),Fc.setAttributes=Sn(),Fc.insert=Tn().bind(null,"head"),Fc.domAPI=wn(),Fc.insertStyleElement=Nn();An()(Hc(),Fc);var Vc=Hc()&&Hc().locals?Hc().locals:void 0;function qc(t){return qc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qc(t)}function Jc(t,e,n){return(e=Kc(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xc(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Kc(i.key),i)}}function Kc(t){var e=function(t,e){if("object"!=qc(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=qc(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==qc(e)?e:e+""}function $c(t,e,n){return e=eu(e),function(t,e){if(e&&("object"==qc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,tu()?Reflect.construct(e,n||[],eu(t).constructor):e.apply(t,n))}function tu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(tu=function(){return!!t})()}function eu(t){return eu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},eu(t)}function nu(t,e){return nu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nu(t,e)}var iu=function(t,e,n){return lc()("hsv(".concat(3.6*t,", ").concat(e,", ").concat(n,")")).hex},ru=(0,d.defineMessages)({swap:{id:"paint.colorPicker.swap",defaultMessage:"Swap"}}),ou=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),$c(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&nu(t,e)}(e,t),function(t,e,n){return e&&Xc(t.prototype,e),n&&Xc(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"_makeBackground",value:function(t){for(var e=[],n=100;n>=0;n-=10)switch(t){case"hue":e.push(iu(n,this.props.saturation,this.props.brightness));break;case"saturation":e.push(iu(this.props.hue,n,this.props.brightness));break;case"brightness":e.push(iu(this.props.hue,this.props.saturation,n));break;default:throw new Error("Unknown channel for color sliders: ".concat(t))}return e[0]+=" 0 ".concat(13,"px"),e[e.length-1]+=" ".concat(137,"px 100%"),"linear-gradient(to left, ".concat(e.join(","),")")}},{key:"render",value:function(){return l().createElement("div",{className:Vc.colorPickerContainer,dir:this.props.rtl?"rtl":"ltr"},this.props.shouldShowGradientTools?l().createElement("div",null,l().createElement("div",{className:Vc.row},l().createElement("div",{className:Vc.gradientPickerRow},l().createElement("img",{className:h()(Jc(Jc({},Vc.inactiveGradient,this.props.gradientType!==ci.SOLID),Vc.clickable,!0)),draggable:!1,src:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUwLjIgKDU1MDQ3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5maWxsLXNvbGlkLWVuYWJsZWQ8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iZmlsbC1zb2xpZC1lbmFibGVkIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBzdHJva2Utb3BhY2l0eT0iMC4xNSI+CiAgICAgICAgPHJlY3QgaWQ9IlNvbGlkIiBzdHJva2U9IiMwMDAwMDAiIGZpbGw9IiM4NTVDRDYiIHg9IjAuNSIgeT0iMC41IiB3aWR0aD0iMTkiIGhlaWdodD0iMTkiIHJ4PSI0Ij48L3JlY3Q+CiAgICA8L2c+Cjwvc3ZnPgo=",onClick:this.props.onChangeGradientTypeSolid}),l().createElement("img",{className:h()(Jc(Jc({},Vc.inactiveGradient,this.props.gradientType!==ci.HORIZONTAL),Vc.clickable,!0)),draggable:!1,src:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUwLjIgKDU1MDQ3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5maWxsLWhvcnotZ3JhZGllbnQtZW5hYmxlZDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxsaW5lYXJHcmFkaWVudCB4MT0iMTAwJSIgeTE9IjUwJSIgeDI9IjAlIiB5Mj0iNTAlIiBpZD0ibGluZWFyR3JhZGllbnQtMSI+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNGRkZGRkYiIG9mZnNldD0iMCUiPjwvc3RvcD4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzg1NUNENiIgb2Zmc2V0PSIxMDAlIj48L3N0b3A+CiAgICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxnIGlkPSJmaWxsLWhvcnotZ3JhZGllbnQtZW5hYmxlZCIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3Ryb2tlLW9wYWNpdHk9IjAuMTUiPgogICAgICAgIDxyZWN0IGlkPSJIb3Jpem9udGFsIiBzdHJva2U9IiMwMDAwMDAiIGZpbGw9InVybCgjbGluZWFyR3JhZGllbnQtMSkiIHg9IjAuNSIgeT0iMC41IiB3aWR0aD0iMTkiIGhlaWdodD0iMTkiIHJ4PSI0Ij48L3JlY3Q+CiAgICA8L2c+Cjwvc3ZnPgo=",onClick:this.props.onChangeGradientTypeHorizontal}),l().createElement("img",{className:h()(Jc(Jc({},Vc.inactiveGradient,this.props.gradientType!==ci.VERTICAL),Vc.clickable,!0)),draggable:!1,src:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUxICg1NzQ2MikgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+ZmlsbC12ZXJ0LWdyYWRpZW50LWVuYWJsZWQ8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8bGluZWFyR3JhZGllbnQgeDE9IjUwJSIgeTE9IjEwMCUiIHgyPSI1MCUiIHkyPSIzLjA2MTYxN2UtMTUlIiBpZD0ibGluZWFyR3JhZGllbnQtMSI+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNGRkZGRkYiIG9mZnNldD0iMCUiPjwvc3RvcD4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzg1NUNENiIgb2Zmc2V0PSIxMDAlIj48L3N0b3A+CiAgICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxnIGlkPSJmaWxsLXZlcnQtZ3JhZGllbnQtZW5hYmxlZCIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3Ryb2tlLW9wYWNpdHk9IjAuMTUiPgogICAgICAgIDxyZWN0IGlkPSJWZXJ0aWNhbCIgc3Ryb2tlPSIjMDAwMDAwIiBmaWxsPSJ1cmwoI2xpbmVhckdyYWRpZW50LTEpIiB4PSIwLjUiIHk9IjAuNSIgd2lkdGg9IjE5IiBoZWlnaHQ9IjE5IiByeD0iNCI+PC9yZWN0PgogICAgPC9nPgo8L3N2Zz4K",onClick:this.props.onChangeGradientTypeVertical}),l().createElement("img",{className:h()(Jc(Jc({},Vc.inactiveGradient,this.props.gradientType!==ci.RADIAL),Vc.clickable,!0)),draggable:!1,src:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUxICg1NzQ2MikgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+ZmlsbC1yYWRpYWwtZW5hYmxlZDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPgogICAgICAgIDxyYWRpYWxHcmFkaWVudCBjeD0iNTAlIiBjeT0iNTAlIiBmeD0iNTAlIiBmeT0iNTAlIiByPSIzOS4zODk2NDg0JSIgaWQ9InJhZGlhbEdyYWRpZW50LTEiPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjODU1Q0Q2IiBvZmZzZXQ9IjAlIj48L3N0b3A+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNGRkZGRkYiIG9mZnNldD0iMTAwJSI+PC9zdG9wPgogICAgICAgIDwvcmFkaWFsR3JhZGllbnQ+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0iZmlsbC1yYWRpYWwtZW5hYmxlZCIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3Ryb2tlLW9wYWNpdHk9IjAuMTUiPgogICAgICAgIDxyZWN0IGlkPSJSYWRpYWwiIHN0cm9rZT0iIzAwMDAwMCIgZmlsbD0idXJsKCNyYWRpYWxHcmFkaWVudC0xKSIgeD0iMC41IiB5PSIwLjUiIHdpZHRoPSIxOSIgaGVpZ2h0PSIxOSIgcng9IjQiPjwvcmVjdD4KICAgIDwvZz4KPC9zdmc+Cg==",onClick:this.props.onChangeGradientTypeRadial}))),l().createElement("div",{className:Vc.divider}),this.props.gradientType===ci.SOLID?null:l().createElement("div",{className:Vc.row},l().createElement("div",{className:h()(Vc.gradientPickerRow,Vc.gradientSwatchesRow)},l().createElement("div",{className:h()(Jc(Jc(Jc(Jc({},Vc.clickable,!0),Vc.swatch,!0),Vc.largeSwatch,!0),Vc.activeSwatch,0===this.props.colorIndex)),style:{backgroundColor:null===this.props.color||this.props.color===Di?"white":this.props.color},onClick:this.props.onSelectColor},null===this.props.color?l().createElement("img",{className:Vc.largeSwatchIcon,draggable:!1,src:dc}):this.props.color===Di?l().createElement("img",{className:Vc.largeSwatchIcon,draggable:!1,src:pc}):null),l().createElement(Wc,{className:Vc.swapButton,imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUwLjIgKDU1MDQ3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5zd2FwPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9InN3YXAiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJTd2FwLXYyIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyLjAwMDAwMCwgMi4wMDAwMDApIiBmaWxsPSIjODU1Q0Q2Ij4KICAgICAgICAgICAgPHBhdGggZD0iTTMuNjk0MjQ1OTcsMi4wMDY4MjE1MSBMNy45NTY2MzYwOCwyLjY2NDk4MjMxIEM4LjQ0NTM2MjIyLDIuNzM1ODg5MTMgOC43OTAwODg3LDMuMjQ0MDU0NzMgOC43MTc2NTI1LDMuNzk1ODU1MjkgQzguNjYxNzk4MDksNC4yNDEyOTU2MSA4LjM0MTUwNzkyLDQuNTg3NjQ4MTkgNy45NTY2MzYwOCw0LjY0MTI4Mjg0IEwzLjY5NDI0NTk3LDUuMzAxMjYxNzYgTDMuNjk0MjQ1OTcsNi43OTY2Njg1NiBDMy42OTQyNDU5Nyw3LjIyMzkyNzY0IDMuMjM3ODEwNjcsNy40Mjg0NjY1NyAyLjk3MjUwMjE5LDcuMTM0ODM5NTggTDAuMTIwNDM2MDg0LDMuOTc0MDMxNDIgQy0wLjA0MDE0NTM2MTQsMy43ODc2NzM3MyAtMC4wNDAxNDUzNjE0LDMuNDg0MDQ3MDYgMC4xMjA0MzYwODQsMy4zMDU4NzA5MyBMMi45NzI1MDIxOSwwLjEzNTk3MjE1MyBDMy4yMzc4MTA2NywtMC4xNTc2NTQ4MzQgMy42OTQyNDU5NywwLjA1NTk3NDcwNzggMy42OTQyNDU5NywwLjQ3NDE0MzE3MyBMMy42OTQyNDU5NywyLjAwNjgyMTUxIFogTTEyLjMwNTc1NCwxMC43MzQwOTQyIEwxMi4zMDU3NTQsOS4yMDE0MTU5IEMxMi4zMDU3NTQsOC43ODMyNDc0NCAxMi43NjIxODkzLDguNTY5NjE3ODkgMTMuMDI3NDk3OCw4Ljg2MzI0NDg4IEwxNS44Nzk1NjM5LDEyLjAzMzE0MzcgQzE2LjA0MDE0NTQsMTIuMjExMzE5OCAxNi4wNDAxNDU0LDEyLjUxNDk0NjUgMTUuODc5NTYzOSwxMi43MDEzMDQxIEwxMy4wMjc0OTc4LDE1Ljg2MjExMjMgQzEyLjc2MjE4OTMsMTYuMTU1NzM5MyAxMi4zMDU3NTQsMTUuOTUxMjAwNCAxMi4zMDU3NTQsMTUuNTIzOTQxMyBMMTIuMzA1NzU0LDE0LjAyODUzNDUgTDguMDQzMzYzOTIsMTMuMzY4NTU1NiBDNy42NTg0OTIwOCwxMy4zMTQ5MjA5IDcuMzM4MjAxOTEsMTIuOTY4NTY4MyA3LjI4MjM0NzUsMTIuNTIzMTI4IEM3LjIwOTkxMTMsMTEuOTcxMzI3NSA3LjU1NDYzNzc4LDExLjQ2MzE2MTkgOC4wNDMzNjM5MiwxMS4zOTIyNTUgTDEyLjMwNTc1NCwxMC43MzQwOTQyIFoiIGlkPSJTd2FwLXYxIj48L3BhdGg+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMS4yNzI3MjczLDEuNDU0NTQ1NDUgTDEzLjQ1NDU0NTUsMS40NTQ1NDU0NSBDMTQuMDU2NzI3MywxLjQ1NDU0NTQ1IDE0LjU0NTQ1NDUsMS45NDMyNzI3MyAxNC41NDU0NTQ1LDIuNTQ1NDU0NTUgTDE0LjU0NTQ1NDUsNC43MjcyNzI3MyBDMTQuNTQ1NDU0NSw1LjMzMDU0NTQ1IDE0LjA1NjcyNzMsNS44MTgxODE4MiAxMy40NTQ1NDU1LDUuODE4MTgxODIgTDExLjI3MjcyNzMsNS44MTgxODE4MiBDMTAuNjcwNTQ1NSw1LjgxODE4MTgyIDEwLjE4MTgxODIsNS4zMzA1NDU0NSAxMC4xODE4MTgyLDQuNzI3MjcyNzMgTDEwLjE4MTgxODIsMi41NDU0NTQ1NSBDMTAuMTgxODE4MiwxLjk0MzI3MjczIDEwLjY3MDU0NTUsMS40NTQ1NDU0NSAxMS4yNzI3MjczLDEuNDU0NTQ1NDUiIGlkPSJGaWxsLTYiIGZpbGwtb3BhY2l0eT0iMC41Ij48L3BhdGg+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0yLjU0NTQ1NDU1LDEwLjE4MTgxODIgTDQuNzI3MjcyNzMsMTAuMTgxODE4MiBDNS4zMjk0NTQ1NSwxMC4xODE4MTgyIDUuODE4MTgxODIsMTAuNjcwNTQ1NSA1LjgxODE4MTgyLDExLjI3MjcyNzMgTDUuODE4MTgxODIsMTMuNDU0NTQ1NSBDNS44MTgxODE4MiwxNC4wNTc4MTgyIDUuMzI5NDU0NTUsMTQuNTQ1NDU0NSA0LjcyNzI3MjczLDE0LjU0NTQ1NDUgTDIuNTQ1NDU0NTUsMTQuNTQ1NDU0NSBDMS45NDMyNzI3MywxNC41NDU0NTQ1IDEuNDU0NTQ1NDUsMTQuMDU3ODE4MiAxLjQ1NDU0NTQ1LDEzLjQ1NDU0NTUgTDEuNDU0NTQ1NDUsMTEuMjcyNzI3MyBDMS40NTQ1NDU0NSwxMC42NzA1NDU1IDEuOTQzMjcyNzMsMTAuMTgxODE4MiAyLjU0NTQ1NDU1LDEwLjE4MTgxODIiIGlkPSJGaWxsLTYtQ29weSIgZmlsbC1vcGFjaXR5PSIwLjUiPjwvcGF0aD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPgo=",title:this.props.intl.formatMessage(ru.swap),onClick:this.props.onSwap}),l().createElement("div",{className:h()(Jc(Jc(Jc(Jc({},Vc.clickable,!0),Vc.swatch,!0),Vc.largeSwatch,!0),Vc.activeSwatch,1===this.props.colorIndex)),style:{backgroundColor:null===this.props.color2||this.props.color2===Di?"white":this.props.color2},onClick:this.props.onSelectColor2},null===this.props.color2?l().createElement("img",{className:Vc.largeSwatchIcon,draggable:!1,src:dc}):this.props.color2===Di?l().createElement("img",{className:Vc.largeSwatchIcon,draggable:!1,src:pc}):null)))):null,l().createElement("div",{className:Vc.row},l().createElement("div",{className:Vc.rowHeader},l().createElement("span",{className:Vc.labelName},l().createElement(d.FormattedMessage,{defaultMessage:"Color",id:"paint.paintEditor.hue"})),l().createElement("span",{className:Vc.labelReadout},Math.round(this.props.hue))),l().createElement("div",{className:Vc.rowSlider},l().createElement(Lc,{background:this._makeBackground("hue"),value:this.props.hue,onChange:this.props.onHueChange}))),l().createElement("div",{className:Vc.row},l().createElement("div",{className:Vc.rowHeader},l().createElement("span",{className:Vc.labelName},l().createElement(d.FormattedMessage,{defaultMessage:"Saturation",id:"paint.paintEditor.saturation"})),l().createElement("span",{className:Vc.labelReadout},Math.round(this.props.saturation))),l().createElement("div",{className:Vc.rowSlider},l().createElement(Lc,{background:this._makeBackground("saturation"),value:this.props.saturation,onChange:this.props.onSaturationChange}))),l().createElement("div",{className:Vc.row},l().createElement("div",{className:Vc.rowHeader},l().createElement("span",{className:Vc.labelName},l().createElement(d.FormattedMessage,{defaultMessage:"Brightness",id:"paint.paintEditor.brightness"})),l().createElement("span",{className:Vc.labelReadout},Math.round(this.props.brightness))),l().createElement("div",{className:Vc.rowSlider},l().createElement(Lc,{lastSlider:!0,background:this._makeBackground("brightness"),value:this.props.brightness,onChange:this.props.onBrightnessChange}))),l().createElement("div",{className:Vc.swatchRow},l().createElement("div",{className:Vc.swatches},this.props.mode===E.BIT_LINE||this.props.mode===E.BIT_RECT||this.props.mode===E.BIT_OVAL||this.props.mode===E.BIT_TEXT?null:l().createElement("div",{className:h()(Jc(Jc(Jc({},Vc.clickable,!0),Vc.swatch,!0),Vc.activeSwatch,0===this.props.colorIndex&&null===this.props.color||1===this.props.colorIndex&&null===this.props.color2)),onClick:this.props.onTransparent},l().createElement("img",{className:Vc.swatchIcon,draggable:!1,src:dc}))),l().createElement("div",{className:Vc.swatches},l().createElement("div",{className:h()(Jc(Jc(Jc({},Vc.clickable,!0),Vc.swatch,!0),Vc.activeSwatch,this.props.isEyeDropping)),onClick:this.props.onActivateEyeDropper},l().createElement("img",{className:Vc.swatchIcon,draggable:!1,src:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+ZXllLWRyb3BwZXI8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iZXllLWRyb3BwZXIiIGZpbGw9IiM1NzVFNzUiPgogICAgICAgICAgICA8cGF0aCBkPSJNOS4xNTMzNDYwNSwxMi40ODI0OTYyIEM5LjAzMzk0MDQ0LDEyLjYxODg3MzcgOC44ODA0MTg5NSwxMi43MDQxMDk2IDguNjA3NDkxODYsMTIuNzcyMjk4MyBDNy45MDgxMTYxOCwxMi45MjU3MjMgNy4yNDI4NTYzOSwxMy41NTY0Njg4IDcuMDM4MTYxMDcsMTQuMjU1NDAzMyBDNi45Njk5MjkzLDE0LjQ3NzAxNjcgNi43NDgxNzYwMywxNC43MTU2NzczIDYuNTA5MzY0ODMsMTQuODM1MDA3NiBMNC43MzUzMzg3MSwxNS42NzAzMTk2IEM0LjY1MDA0OSwxNS43MDQ0MTQgNC41ODE4MTcyMiwxNS43MjE0NjEyIDQuNTQ3NzAxMzQsMTUuNzIxNDYxMiBMNC4yNzQ3NzQyNCwxNS40NjU3NTM0IEM0LjI3NDc3NDI0LDE1LjQ0ODcwNjIgNC4yNzQ3NzQyNCwxNS4zODA1MTc1IDQuMzI1OTQ4MDcsMTUuMjYxMTg3MiBMNS4xNjE3ODczLDEzLjQ3MTIzMjkgQzUuMjY0MTM0OTYsMTMuMjQ5NjE5NSA1LjUwMjk0NjE3LDEzLjAyODAwNjEgNS43NDE3NTczNywxMi45NTk4MTc0IEM2LjQ0MTEzMzA1LDEyLjczODIwNCA3LjA3MjI3Njk2LDEyLjA5MDQxMSA3LjI1OTkxNDMzLDExLjIzODA1MTggQzcuMjk0MDMwMjIsMTEuMTAxNjc0MyA3LjM3OTMxOTk0LDEwLjk2NTI5NjggNy40OTg3MjU1NCwxMC44Mjg5MTkzIEwxMS40MzkxMTA1LDYuOTA4MDY2OTcgTDEzLjA5MzczMSw4LjU2MTY0Mzg0IEw5LjE1MzM0NjA1LDEyLjQ4MjQ5NjIgWiBNMTYuNjA3NjY3Myw1LjI4ODU4NDQ3IEMxNi44NjM1MzY1LDUuMDMyODc2NzEgMTcsNC42NzQ4ODU4NCAxNyw0LjMzMzk0MjE2IEMxNywzLjk5Mjk5ODQ4IDE2Ljg2MzUzNjUsMy42NTIwNTQ3OSAxNi42MDc2NjczLDMuMzk2MzQ3MDMgQzE2LjA3ODg3MTEsMi44Njc4ODQzMiAxNS4yNDMwMzE4LDIuODY3ODg0MzIgMTQuNzE0MjM1NiwzLjM5NjM0NzAzIEwxMy4yMzAxOTQ1LDQuODc5NDUyMDUgTDEzLjA1OTYxNTEsNC43MDg5ODAyMSBMMTIuNTEzNzYwOSw0LjE2MzQ3MDMyIEMxMi4xNzI2MDIsMy44MjI1MjY2NCAxMS42MDk2ODk5LDMuODIyNTI2NjQgMTEuMjY4NTMxLDQuMTYzNDcwMzIgTDEwLjYwMzI3MTIsNC44MTEyNjMzMiBDMTAuMjc5MTcwMyw1LjE1MjIwNyAxMC4yNjIxMTI0LDUuNjQ2NTc1MzQgMTAuNTUyMDk3NCw1Ljk4NzUxOTAzIEw2LjU5NDY1NDU0LDkuOTI1NDE4NTcgQzYuMzA0NjY5NTEsMTAuMjMyMjY3OSA2LjA5OTk3NDE4LDEwLjU5MDI1ODggNS45ODA1Njg1OCwxMS4xMDE2NzQzIEM1LjkyOTM5NDc1LDExLjM1NzM4MiA1LjYzOTQwOTcxLDExLjY0NzE4NDIgNS4zNjY0ODI2MiwxMS43MzI0MjAxIEM0LjgwMzU3MDQ5LDExLjkwMjg5MTkgNC4yNTc3MTYzLDEyLjM4MDIxMzEgNC4wMDE4NDcxNSwxMi45NDI3NzAyIEwzLjE2NjAwNzkyLDE0LjcxNTY3NzMgQzIuODkzMDgwODMsMTUuMzEyMzI4OCAyLjk2MTMxMjYsMTUuOTI2MDI3NCAzLjMzNjU4NzM2LDE2LjMxODExMjYgTDMuNjc3NzQ2MjMsMTYuNjU5MDU2MyBDMy44OTk0OTk0OSwxNi44ODA2Njk3IDQuMjA2NTQyNDcsMTcgNC41NDc3MDEzNCwxNyBDNC43Njk0NTQ2LDE3IDUuMDI1MzIzNzUsMTYuOTMxODExMyA1LjI2NDEzNDk2LDE2LjgyOTUyODIgTDcuMDU1MjE5MDEsMTUuOTk0MjE2MSBDNy42MTgxMzExNCwxNS43MjE0NjEyIDguMDk1NzUzNTYsMTUuMTkyOTk4NSA4LjI2NjMzMjk5LDE0LjYzMDQ0MTQgQzguMzM0NTY0NzcsMTQuMzU3Njg2NSA4LjY0MTYwNzc1LDE0LjA2Nzg4NDMgOS4wNTA5OTgzOSwxMy45ODI2NDg0IEM5LjQwOTIxNTIsMTMuODk3NDEyNSA5Ljc2NzQzMjAxLDEzLjY5Mjg0NjMgMTAuMDU3NDE3LDEzLjM4NTk5NyBMMTQuMDE0ODU5OSw5LjQ0ODA5NzQxIEMxNC4zNTYwMTg4LDkuNzM3ODk5NTQgMTQuODY3NzU3MSw5LjcwMzgwNTE4IDE1LjE3NDgwMDEsOS4zNzk5MDg2OCBMMTUuODQwMDU5OSw4LjczMjExNTY4IEMxNi4xODEyMTg3LDguMzkxMTcxOTkgMTYuMTgxMjE4Nyw3LjgyODYxNDkyIDE1Ljg0MDA1OTksNy40ODc2NzEyMyBMMTUuMjYwMDg5OCw2LjkwODA2Njk3IEwxNS4xMjM2MjYyLDYuNzcxNjg5NSBMMTYuNjA3NjY3Myw1LjI4ODU4NDQ3IFoiIGlkPSJleWUtZHJvcHBlci1pY29uIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="})))))}}])}(l().Component);ou.propTypes={brightness:i().number.isRequired,color:i().string,color2:i().string,colorIndex:i().number.isRequired,gradientType:i().oneOf(Object.keys(ci)).isRequired,hue:i().number.isRequired,intl:cc.isRequired,isEyeDropping:i().bool.isRequired,mode:i().oneOf(Object.keys(E)),onActivateEyeDropper:i().func.isRequired,onBrightnessChange:i().func.isRequired,onChangeGradientTypeHorizontal:i().func.isRequired,onChangeGradientTypeRadial:i().func.isRequired,onChangeGradientTypeSolid:i().func.isRequired,onChangeGradientTypeVertical:i().func.isRequired,onHueChange:i().func.isRequired,onSaturationChange:i().func.isRequired,onSelectColor:i().func.isRequired,onSelectColor2:i().func.isRequired,onSwap:i().func,onTransparent:i().func.isRequired,rtl:i().bool.isRequired,saturation:i().number.isRequired,shouldShowGradientTools:i().bool.isRequired};var su=(0,d.injectIntl)(ou);function au(t){return au="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},au(t)}function lu(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,cu(i.key),i)}}function cu(t){var e=function(t,e){if("object"!=au(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=au(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==au(e)?e:e+""}function uu(t,e,n){return e=du(e),function(t,e){if(e&&("object"==au(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,hu()?Reflect.construct(e,n||[],du(t).constructor):e.apply(t,n))}function hu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(hu=function(){return!!t})()}function du(t){return du=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},du(t)}function pu(t,e){return pu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},pu(t,e)}var fu=function(t){function n(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e=uu(this,n,[t]),m()(e,["getHsv","handleChangeGradientTypeHorizontal","handleChangeGradientTypeRadial","handleChangeGradientTypeSolid","handleChangeGradientTypeVertical","handleHueChange","handleSaturationChange","handleBrightnessChange","handleTransparent","handleActivateEyeDropper"]);var i=0===t.colorIndex?t.color:t.color2,r=e.getHsv(i);return e.state={hue:r[0],saturation:r[1],brightness:r[2]},e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&pu(t,e)}(n,t),function(t,e,n){return e&&lu(t.prototype,e),n&&lu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"componentWillReceiveProps",value:function(t){var e=0===t.colorIndex?this.props.color:this.props.color2,n=0===t.colorIndex?t.color:t.color2;if(this.props.isEyeDropping&&e!==n||this.props.colorIndex!==t.colorIndex){var i=this.getHsv(n);this.setState({hue:i[0],saturation:i[1],brightness:i[2]})}}},{key:"getHsv",value:function(t){var e,n;return null===t||t===Di?[50,100,100]:(e=t,(n=lc()(e).hsv)[0]=n[0]/3.6,0===n[1]&&0===n[2]&&(n[1]=100),n)}},{key:"handleHueChange",value:function(t){var e=this;this.setState({hue:t},function(){e.handleColorChange()})}},{key:"handleSaturationChange",value:function(t){var e=this;this.setState({saturation:t},function(){e.handleColorChange()})}},{key:"handleBrightnessChange",value:function(t){var e=this;this.setState({brightness:t},function(){e.handleColorChange()})}},{key:"handleColorChange",value:function(){var t,e,n;this.props.onChangeColor((t=this.state.hue,e=this.state.saturation,n=this.state.brightness,lc()("hsv(".concat(3.6*t,", ").concat(e,", ").concat(n,")")).hex))}},{key:"handleTransparent",value:function(){this.props.onChangeColor(null)}},{key:"handleActivateEyeDropper",value:function(){this.props.onActivateEyeDropper(e().tool,this.props.onChangeColor)}},{key:"handleChangeGradientTypeHorizontal",value:function(){this.props.onChangeGradientType(ci.HORIZONTAL)}},{key:"handleChangeGradientTypeRadial",value:function(){this.props.onChangeGradientType(ci.RADIAL)}},{key:"handleChangeGradientTypeSolid",value:function(){this.props.onChangeGradientType(ci.SOLID)}},{key:"handleChangeGradientTypeVertical",value:function(){this.props.onChangeGradientType(ci.VERTICAL)}},{key:"render",value:function(){return l().createElement(su,{brightness:this.state.brightness,color:this.props.color,color2:this.props.color2,colorIndex:this.props.colorIndex,gradientType:this.props.gradientType,hue:this.state.hue,isEyeDropping:this.props.isEyeDropping,mode:this.props.mode,rtl:this.props.rtl,saturation:this.state.saturation,shouldShowGradientTools:this.props.shouldShowGradientTools,onActivateEyeDropper:this.handleActivateEyeDropper,onBrightnessChange:this.handleBrightnessChange,onChangeGradientTypeHorizontal:this.handleChangeGradientTypeHorizontal,onChangeGradientTypeRadial:this.handleChangeGradientTypeRadial,onChangeGradientTypeSolid:this.handleChangeGradientTypeSolid,onChangeGradientTypeVertical:this.handleChangeGradientTypeVertical,onHueChange:this.handleHueChange,onSaturationChange:this.handleSaturationChange,onSelectColor:this.props.onSelectColor,onSelectColor2:this.props.onSelectColor2,onSwap:this.props.onSwap,onTransparent:this.handleTransparent})}}])}(l().Component);fu.propTypes={color:i().string,color2:i().string,colorIndex:i().number.isRequired,gradientType:i().oneOf(Object.keys(ci)).isRequired,isEyeDropping:i().bool.isRequired,mode:i().oneOf(Object.keys(E)),onActivateEyeDropper:i().func.isRequired,onChangeColor:i().func.isRequired,onChangeGradientType:i().func,onSelectColor:i().func.isRequired,onSelectColor2:i().func.isRequired,onSwap:i().func,rtl:i().bool.isRequired,shouldShowGradientTools:i().bool.isRequired};var gu=(0,c.connect)(function(t){return{colorIndex:t.scratchPaint.fillMode.colorIndex,isEyeDropping:t.scratchPaint.color.eyeDropper.active,mode:t.scratchPaint.mode,rtl:t.scratchPaint.layout.rtl}},function(t){return{clearSelectedItems:function(){t(en())},onActivateEyeDropper:function(e,n){t(function(t,e){return{type:$r,callback:e,previousMode:t}}(e,n))},onSelectColor:function(){t(Xl(0))},onSelectColor2:function(){t(Xl(1))}}})(fu),mu=p(621),yu=p.n(mu),vu={};vu.styleTagTransform=En(),vu.setAttributes=Sn(),vu.insert=Tn().bind(null,"head"),vu.domAPI=wn(),vu.insertStyleElement=Nn();An()(yu(),vu);var bu=yu()&&yu().locals?yu().locals:void 0;function Iu(t){return Iu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Iu(t)}function Au(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=Iu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Iu(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Iu(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Mu=function(t){return l().createElement("div",{className:h()(t.className,bu.inputGroup,Au({},bu.disabled,t.disabled)),dir:t.rtl?"rtl":""},t.children)};Mu.propTypes={children:i().node.isRequired,className:i().string,disabled:i().bool,rtl:i().bool};var wu=Mu,Cu=p(394),Tu=p.n(Cu),xu={};xu.styleTagTransform=En(),xu.setAttributes=Sn(),xu.insert=Tn().bind(null,"head"),xu.domAPI=wn(),xu.insertStyleElement=Nn();An()(Tu(),xu);var Su=Tu()&&Tu().locals?Tu().locals:void 0,Du=function(t){return l().createElement("label",{className:Su.inputGroup},l().createElement("span",{className:t.secondary?Su.inputLabelSecondary:Su.inputLabel},t.text),t.children)};Du.propTypes={children:i().node,secondary:i().bool,text:i().string.isRequired},Du.defaultProps={secondary:!1};var Nu=Du,_u=function(t){return l().createElement(wu,{className:t.className,disabled:t.disabled},l().createElement(hc(),{body:l().createElement(gu,{color:t.color,color2:t.color2,gradientType:t.gradientType,shouldShowGradientTools:t.shouldShowGradientTools,onChangeColor:t.onChangeColor,onChangeGradientType:t.onChangeGradientType,onSwap:t.onSwap}),isOpen:t.colorModalVisible,preferPlace:"below",onOuterAction:t.onCloseColor},l().createElement(Nu,{text:t.label},l().createElement(Mc,{color:t.color,color2:t.color2,gradientType:t.gradientType,onClick:t.onOpenColor,outline:t.outline}))))};_u.propTypes={className:i().string,disabled:i().bool.isRequired,color:i().string,color2:i().string,colorModalVisible:i().bool.isRequired,gradientType:i().oneOf(Object.keys(ci)).isRequired,label:i().string.isRequired,onChangeColor:i().func.isRequired,onChangeGradientType:i().func.isRequired,onCloseColor:i().func.isRequired,onOpenColor:i().func.isRequired,onSwap:i().func.isRequired,outline:i().bool.isRequired,shouldShowGradientTools:i().bool.isRequired};var Eu=_u;function ju(t){return ju="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ju(t)}function ku(){return ku=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},ku.apply(null,arguments)}function Ou(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,zu(i.key),i)}}function zu(t){var e=function(t,e){if("object"!=ju(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=ju(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ju(e)?e:e+""}function Lu(t,e,n){return e=Pu(e),function(t,e){if(e&&("object"==ju(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Bu()?Reflect.construct(e,n||[],Pu(t).constructor):e.apply(t,n))}function Bu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Bu=function(){return!!t})()}function Pu(t){return Pu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pu(t)}function Ru(t,e){return Ru=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ru(t,e)}var Uu=function(t,n){var r=function(i){function r(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),e=Lu(this,r,[t]),m()(e,["handleChangeColor","handleChangeGradientType","handleCloseColor","handleSwap"]),e._hasChanged=!1,e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ru(t,e)}(r,i),function(t,e,n){return e&&Ou(t.prototype,e),n&&Ou(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(r,[{key:"componentWillReceiveProps",value:function(t){var e=this.props,n=e.colorModalVisible,i=e.onUpdateImage;n&&!t.colorModalVisible&&(this._hasChanged&&i(),this._hasChanged=!1)}},{key:"handleChangeColor",value:function(t){if(n){var e=this.props.gradientType===ci.SOLID?null===this.props.color:null===this.props.color&&null===this.props.color2,i=1===this.props.colorIndex?this.props.color:this.props.color2,r=this.props.gradientType===ci.SOLID?null===t:null===t&&null===i;e&&!r?(this._hasChanged=zi(1,this.props.textEditTarget)||this._hasChanged,this.props.onChangeStrokeWidth(1)):!e&&r&&(this._hasChanged=zi(0,this.props.textEditTarget)||this._hasChanged,this.props.onChangeStrokeWidth(0))}var o=M(this.props.format),s=Oi(t,this.props.colorIndex,this.props.gradientType===ci.SOLID,n||o&&!this.props.fillBitmapShapes,this.props.textEditTarget);this._hasChanged=this._hasChanged||s,this.props.onChangeColor(t,this.props.colorIndex)}},{key:"handleChangeGradientType",value:function(t){var i=M(this.props.format),r=function(t,n,i){var r,o=!1,s=xi(_i(i));try{for(s.s();!(r=s.n()).done;){var a=r.value;a.parent instanceof e().CompoundPath&&(a=a.parent);var l=n?"strokeColor":"fillColor",c=a[l],u=c&&c.gradient,h=void 0;h=null===c||0===c.alpha?null:u?c.gradient.stops[0]&&0!==c.gradient.stops[0].color.alpha?c.gradient.stops[0].color.toCSS():null:c.toCSS();var d=void 0;if(d=u&&c.gradient.stops[1]?0===c.gradient.stops[1].color.alpha?null:c.gradient.stops[1].color.toCSS():ji(h),t!==ci.SOLID){var p=u;if(n&&(p=u&&a.strokeWidth>0),!p){var f=!c||c.gradient&&c.gradient.stops&&0===c.gradient.stops[0].color.alpha,g=n&&0===a.strokeWidth;(f||g)&&(h||d)&&(n&&(a.strokeWidth=1),h="black",d="white")}null===h&&(h=Ei(d)),null===d&&(d=Ei(h));var m=!1;switch(t){case ci.RADIAL:m=!(p&&c.gradient.radial);break;case ci.HORIZONTAL:m=!(p&&!c.gradient.radial&&Math.abs(c.origin.y-c.destination.y)<1e-8);break;case ci.VERTICAL:m=!(p&&!c.gradient.radial&&Math.abs(c.origin.x-c.destination.x)<1e-8)}m&&(o=!0,a[l]=ki(h,d,t,a.bounds,null,a.strokeWidth))}else c&&c.gradient&&(o=!0,a[l]=h)}}catch(t){s.e(t)}finally{s.f()}return o}(t,n||i&&!this.props.fillBitmapShapes,this.props.textEditTarget);this._hasChanged=this._hasChanged||r;var o=At().length>0;o&&r&&this.props.setSelectedItems(this.props.format),this.props.gradientType===ci.SOLID&&t!==ci.SOLID&&(o||this.props.onChangeColor(ji(this.props.color),1),this.props.onChangeColorIndex(1)),this.props.onChangeGradientType&&this.props.onChangeGradientType(t)}},{key:"handleCloseColor",value:function(){this.props.isEyeDropping||(this.props.onCloseColor(),this.props.onChangeColorIndex(0))}},{key:"handleSwap",value:function(){if(At().length){var t=M(this.props.format),e=function(t,e){var n,i=!1,r=xi(_i(e));try{for(r.s();!(n=r.n()).done;){var o=n.value;if(!F(o)){var s=t?o.strokeColor:o.fillColor;if(s&&s.gradient&&2!==!s.gradient.stops.length&&!s.gradient.stops[0].color.equals(s.gradient.stops[1].color)){i=!0;var a=[s.gradient.stops[1].color.toCSS(),s.gradient.stops[0].color.toCSS()];s.gradient={stops:a,radial:s.gradient.radial}}}}}catch(t){r.e(t)}finally{r.f()}return i}(n||t&&!this.props.fillBitmapShapes,this.props.textEditTarget);this.props.setSelectedItems(this.props.format),this._hasChanged=this._hasChanged||e}else{var i=this.props.color,r=this.props.color2;i=null===i||i===Di?i:lc()(i).hex,r=null===r||r===Di?r:lc()(r).hex,this.props.onChangeColor(i,1),this.props.onChangeColor(r,0)}}},{key:"render",value:function(){return l().createElement(Eu,ku({},this.props,{label:this.props.intl.formatMessage(t),outline:n,onChangeColor:this.handleChangeColor,onChangeGradientType:this.handleChangeGradientType,onCloseColor:this.handleCloseColor,onSwap:this.handleSwap}))}}])}(l().Component);return r.propTypes={colorIndex:i().number.isRequired,disabled:i().bool.isRequired,color:i().string,color2:i().string,colorModalVisible:i().bool.isRequired,fillBitmapShapes:i().bool.isRequired,format:i().oneOf(Object.keys(I)),gradientType:i().oneOf(Object.keys(ci)).isRequired,intl:cc,isEyeDropping:i().bool.isRequired,onChangeColorIndex:i().func.isRequired,onChangeColor:i().func.isRequired,onChangeGradientType:i().func,onChangeStrokeWidth:i().func,onCloseColor:i().func.isRequired,onUpdateImage:i().func.isRequired,setSelectedItems:i().func.isRequired,textEditTarget:i().number},(0,d.injectIntl)(r)},Gu=Uu((0,d.defineMessages)({label:{id:"paint.paintEditor.fill",defaultMessage:"Fill"}}).label,!1),Yu=(0,c.connect)(function(t){return{colorIndex:t.scratchPaint.fillMode.colorIndex,disabled:t.scratchPaint.mode===E.LINE,color:t.scratchPaint.color.fillColor.primary,color2:t.scratchPaint.color.fillColor.secondary,colorModalVisible:t.scratchPaint.modals.fillColor,fillBitmapShapes:t.scratchPaint.fillBitmapShapes,format:t.scratchPaint.format,gradientType:t.scratchPaint.color.fillColor.gradientType,isEyeDropping:t.scratchPaint.color.eyeDropper.active,mode:t.scratchPaint.mode,shouldShowGradientTools:t.scratchPaint.mode in j,textEditTarget:t.scratchPaint.textEditTarget}},function(t){return{onChangeColorIndex:function(e){t(Xl(e))},onChangeColor:function(e,n){0===n?t(wi(e)):1===n&&t(Ci(e))},onOpenColor:function(){t(oc(nc))},onCloseColor:function(){t(sc(nc))},onChangeGradientType:function(e){t(Ns(e))},setSelectedItems:function(e){t(tn(At(),M(e)))}}})(Gu);function Zu(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Wu(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wu(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Wu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}var Qu=function(t,n,i){var r=n.match;n.match=function(t){return(!t.item.data||!t.item.data.noHover)&&(!r||r(t))};var o,s=e().project.hitTestAll(t.point,n);if(0===s.length)return null;var a,l=Zu(s);try{for(l.s();!(a=l.n()).done;){var c=a.value;(!o||tt(o.item,c.item)<0)&&(o=c)}}catch(t){l.e(t)}finally{l.f()}var u,h=o.item;return!h||h.selected?null:((u=O(h)?jt(h):!i&&function(t){var e=k(t);return R(e)}(h)?jt(k(h)):Et(h)).data.hitResult=o,u)};function Hu(t){return Hu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hu(t)}function Fu(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Vu(i.key),i)}}function Vu(t){var e=function(t,e){if("object"!=Hu(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Hu(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Hu(e)?e:e+""}function qu(t,e,n){return e=Xu(e),function(t,e){if(e&&("object"==Hu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ju()?Reflect.construct(e,n||[],Xu(t).constructor):e.apply(t,n))}function Ju(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ju=function(){return!!t})()}function Xu(t){return Xu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xu(t)}function Ku(t,e){return Ku=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ku(t,e)}var $u=function(t){function n(t,e,i){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(r=qu(this,n)).setHoveredItem=t,r.clearHoveredItem=e,r.onUpdateImage=i,r.onMouseDown=r.handleMouseDown,r.onMouseMove=r.handleMouseMove,r.onMouseUp=r.handleMouseUp,r.fillColor=null,r.fillColor2=null,r.gradientType=null,r.fillItem=null,r.fillProperty=null,r.addedFillItem=null,r.fillItemOrigColor=null,r.prevHoveredItemId=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ku(t,e)}(n,t),function(t,e,n){return e&&Fu(t.prototype,e),n&&Fu(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"getHitOptions",value:function(){return{segments:!1,stroke:!0,curves:!1,fill:!0,guide:!1,match:function(t){var n,i=t.item.hasFill()||t.item.closed||(n=t.item)instanceof e().Path&&n.segments.length>2&&n.lastSegment.point.getDistance(n.firstSegment.point)<8;return!(!(t.item instanceof e().Path)||!i&&"fill"===t.type)||(t.item instanceof e().PointText||void 0)},hitUnfilledPaths:!0,hitUnstrokedPaths:this.gradientType===ci.SOLID&&null===this.fillColor,tolerance:n.TOLERANCE/e().view.zoom}}},{key:"setFillColor",value:function(t){this.fillColor=t}},{key:"setFillColor2",value:function(t){this.fillColor2=t}},{key:"setGradientType",value:function(t){this.gradientType=t}},{key:"setPrevHoveredItemId",value:function(t){this.prevHoveredItemId=t}},{key:"updateFillPreview",value:function(t){var n=Qu(t,this.getHitOptions(),!0);(!n&&this.prevHoveredItemId||n&&!this.prevHoveredItemId||n&&this.prevHoveredItemId&&n.id!==this.prevHoveredItemId)&&this.setHoveredItem(n?n.id:null);var i=n?n.data.origItem:null,r=n?n.data.hitResult.type:null;if(i!==this.fillItem||r!==this.fillProperty){if(this.fillItem&&(this.addedFillItem?(this.addedFillItem.remove(),this.addedFillItem=null):this._setFillItemColor(this.fillItemOrigColor),this.fillItemOrigColor=null,this.fillItem=null,this.fillProperty=null),i){this.fillItem=i,this.fillProperty=r;var o="fill"===r?"fillColor":"strokeColor";if(this.fillItemOrigColor=i[o],i.parent instanceof e().CompoundPath&&i.area<0&&"fill"===r){if(!this.fillColor)return this.fillItem=null,this.fillProperty=null,void(this.fillItemOrigColor=null);this.addedFillItem=i.clone(),this.addedFillItem.setClockwise(!0),this.addedFillItem.data.noHover=!0,this.addedFillItem.data.origItem=i,function(t,e){var n,i=t.position,r=t.area,o=q(t.segments);try{for(o.s();!(n=o.n()).done;){var s=n.value,a=s.point.subtract(i).normalize().multiply(e);s.point=s.point.add(a),t.area<r&&(s.point=s.point.subtract(a.multiply(2))),r=t.area}}catch(t){o.e(t)}finally{o.f()}}(this.addedFillItem,.1),this.addedFillItem.insertAbove(i.parent)}else this.fillItem.parent instanceof e().CompoundPath&&(this.fillItemOrigColor=i.parent[o]);this._setFillItemColor(this.fillColor,this.fillColor2,this.gradientType,t.point)}}else this.gradientType===ci.RADIAL&&this._setFillItemColor(this.fillColor,this.fillColor2,this.gradientType,t.point)}},{key:"handleMouseDown",value:function(t){this.updateFillPreview(t)}},{key:"handleMouseMove",value:function(t){this.updateFillPreview(t)}},{key:"handleMouseUp",value:function(t){if(!(t.event.button>0)&&this.fillItem){if(this.addedFillItem&&this._noStroke(this.fillItem.parent)&&"gradient"!==this.addedFillItem.fillColor.type&&this.fillItem.parent.fillColor.toCSS()===this.addedFillItem.fillColor.toCSS()){this.addedFillItem.remove(),this.addedFillItem=null;var n=this.fillItem.parent;this.fillItem.remove(),(n=n.reduce()).fillColor=this.fillColor}else if(this.addedFillItem)this.addedFillItem.data.noHover=!1;else if(!this.fillColor&&this.fillItem.data&&this.fillItem.data.origItem){var i=this.fillItem.parent;this.fillItem.remove(),i instanceof e().Layer||1!==i.children.length||i.reduce()}this.clearHoveredItem(),this.fillItem=null,this.fillProperty=null,this.addedFillItem=null,this.fillItemOrigColor=null,this.onUpdateImage()}}},{key:"_noStroke",value:function(t){return!t.strokeColor||0===t.strokeColor.alpha||0===t.strokeWidth}},{key:"_setFillItemColor",value:function(t,e,n,i){var r=this._getFillItem();if(r){var o="fill"===this.fillProperty?"fillColor":"strokeColor";n&&n!==ci.SOLID?r[o]=ki(t,e,n,r.bounds,i,r.strokeWidth):r[o]=t}}},{key:"_getFillItem",value:function(){return this.addedFillItem?this.addedFillItem:this.fillItem&&this.fillItem.parent instanceof e().CompoundPath?this.fillItem.parent:this.fillItem}},{key:"deactivateTool",value:function(){this.fillItem&&(this._setFillItemColor(this.fillItemOrigColor),this.fillItemOrigColor=null,this.fillItem=null,this.fillProperty=null),this.clearHoveredItem(),this.setHoveredItem=null,this.clearHoveredItem=null}}],[{key:"TOLERANCE",get:function(){return 2}}])}(e().Tool),th=$u,eh=function(t){return l().createElement(ar,{imgDescriptor:lr.fill,imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0OC4xICg0NzI1MCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+ZmlsbDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJmaWxsIiBmaWxsPSIjNTc1RTc1Ij4KICAgICAgICAgICAgPHBhdGggZD0iTTE0LjA0NTA5NjksOS42OTM0OTUwNCBMMTQuMDMwNjgxOCw5LjY3OTE2MjA3IEMxMy40Mzk2NjI5LDkuMzYzODM2ODIgMTIuNTE3MDk2OCw4LjY5MDE4NzQzIDExLjQyMTU0OTYsNy42MDA4ODIwMyBDMTEuMDkwMDAyNCw3LjI3MTIyMzgxIDEwLjc4NzI4NTQsNi45NTU4OTg1NyAxMC41NDIyMjg4LDYuNjU0OTA2MjggQzEwLjcxNTIxLDYuNDM5OTExOCAxMC44ODgxOTExLDYuMjI0OTE3MzEgMTEuMDYxMTcyMiw2LjAwOTkyMjgyIEMxMS4zNzgzMDQzLDYuMjY3OTE2MjEgMTEuNzI0MjY2Niw2LjU4MzI0MTQ2IDEyLjA4NDY0NCw2Ljk0MTU2NTYgQzEyLjMxNTI4NTUsNy4xNzA4OTMwNSAxMi41MDI2ODE3LDcuMzcxNTU0NTggMTIuNjkwMDc4LDcuNTcyMjE2MSBDMTIuNzE4OTA4MSw3LjYxNTIxNDk5IDEyLjc2MjE1MzQsNy42NTgyMTM4OSAxMi44MTk4MTM4LDcuNzAxMjEyNzkgQzEzLjYyNzA1OTEsOC42MTg1MjI2IDE0LjEwMjc1NzMsOS4zNjM4MzY4MiAxNC4zMTg5ODM3LDkuNzkzODI1OCBDMTQuMzE4OTgzNyw5LjgwODE1ODc3IDE0LjMzMzM5ODgsOS44MjI0OTE3MyAxNC4zMzMzOTg4LDkuODM2ODI0NyBDMTQuMjQ2OTA4Miw5Ljc5MzgyNTggMTQuMTQ2MDAyNSw5Ljc1MDgyNjkgMTQuMDQ1MDk2OSw5LjY5MzQ5NTA0IE0xMC41OTk4ODkyLDEwLjA2NjE1MjEgQzkuNzM0OTgzNSwxMC41MzkxNCA4LjkxMzMyMzA5LDEwLjk4MzQ2MiA3LjYxNTk2NDU1LDEwLjY4MjQ2OTcgQzYuMTc0NDU1MDYsMTAuMzUyODExNSA1LjQ4MjUzMDUsOS43NjUxNTk4NyA1LjE5NDIyODYxLDkuNDIxMTY4NjkgTDguMzA3ODg5MSw1LjQwNzkzODI2IEM4LjUyNDExNTUzLDUuODM3OTI3MjMgOC44NDEyNDc2Miw2LjI4MjI0OTE3IDkuMTcyNzk0OCw2LjY5NzkwNTE4IEM4LjgyNjgzMjUyLDcuMjEzODkxOTUgOC41NTI5NDU3Miw3LjY0Mzg4MDkzIDguNDIzMjA5ODYsNy44NDQ1NDI0NSBDOC4yNzkwNTg5MSw4LjA4ODIwMjg3IDguMzUxMTM0MzksOC40MTc4NjEwOCA4LjYxMDYwNjEsOC41NzU1MjM3IEM4LjY5NzA5NjY3LDguNjMyODU1NTcgOC43OTgwMDIzMyw4LjY2MTUyMTUgOC44ODQ0OTI5LDguNjYxNTIxNSBDOS4wNzE4ODkxMyw4LjY2MTUyMTUgOS4yNDQ4NzAyNyw4LjU2MTE5MDc0IDkuMzQ1Nzc1OTQsOC40MDM1MjgxMSBDOS41MDQzNDE5OCw4LjEzMTIwMTc2IDkuNjkxNzM4MjEsNy44NDQ1NDI0NSA5Ljg5MzU0OTU0LDcuNTU3ODgzMTMgQzEwLjE5NjI2NjUsNy45MDE4NzQzMSAxMC40NzAxNTMzLDguMTc0MjAwNjYgMTAuNjU3NTQ5Niw4LjM2MDUyOTIyIEMxMS4wNzU1ODczLDguNzc2MTg1MjMgMTEuNDkzNjI1MSw5LjE0ODg0MjM0IDExLjg5NzI0NzcsOS40Nzg1MDA1NSBDMTEuNDIxNTQ5Niw5LjYwNzQ5NzI0IDExLjAwMzUxMTksOS44NTExNTc2NiAxMC41OTk4ODkyLDEwLjA2NjE1MjEgTTEwLjIxMDY4MTYsNS4zMzYyNzM0MyBDMTAuMDk1MzYwOSw1LjQ5MzkzNjA1IDkuOTY1NjI1MDIsNS42NTE1OTg2OCA5Ljg1MDMwNDI2LDUuNzk0OTI4MzQgQzkuNTA0MzQxOTgsNS4zMzYyNzM0MyA5LjI4ODExNTU2LDQuOTYzNjE2MzIgOS4xNzI3OTQ4LDQuNzA1NjIyOTMgQzkuNDE3ODUxNDEsNC44MDU5NTM2OSA5Ljc2MzgxMzY5LDUuMDIwOTQ4MTggMTAuMjEwNjgxNiw1LjMzNjI3MzQzIE0xMy41MTE3Mzg0LDQuMDc0OTcyNDQgQzEzLjY3MDMwNDQsNC4wNzQ5NzI0NCAxMy44NDMyODU1LDQuMTAzNjM4MzcgMTMuODcyMTE1Nyw0LjE3NTMwMzIgQzE0LjA0NTA5NjksNC40OTA2Mjg0NSAxMy42MjcwNTkxLDUuNDkzOTM2MDUgMTMuMDY0ODcwNCw2LjM5NjkxMjkgTDEyLjg0ODY0NCw2LjE4MTkxODQxIEMxMi42MTgwMDI1LDUuOTUyNTkwOTYgMTIuMjI4Nzk0OSw1LjU5NDI2NjgxIDExLjc4MTkyNyw1LjIwNzI3Njc0IEMxMi40NDUwMjEzLDQuNTMzNjI3MzQgMTMuMDUwNDU1Myw0LjA3NDk3MjQ0IDEzLjUxMTczODQsNC4wNzQ5NzI0NCBNMTYuNTUzMzIzNCwxMi4xNTg3NjUyIEMxNi4zMzcwOTcsMTEuNTk5Nzc5NSAxNS45OTExMzQ3LDExLjA5ODEyNTcgMTUuNTg3NTEyLDEwLjY2ODEzNjcgQzE1LjU0NDI2NjcsMTAuNjEwODA0OSAxNS40ODY2MDY0LDEwLjU2NzgwNiAxNS40Mjg5NDYsMTAuNTI0ODA3MSBDMTUuNjc0MDAyNiw5Ljk5NDQ4NzMyIDE1LjI3MDM3OTksOS4yMzQ4NDAxMyAxNC45MjQ0MTc3LDguNjkwMTg3NDMgQzE0LjY1MDUzMDksOC4yNDU4NjU0OSAxNC4yNzU3Mzg0LDcuNzQ0MjExNjkgMTMuODI4ODcwNSw3LjI0MjU1Nzg4IEMxNC4zOTEwNTkyLDYuMzgyNTc5OTMgMTUuMzU2ODcwNSw0LjY3Njk1NyAxNC44Mzc5MjcxLDMuNjczNjQ5MzkgQzE0LjY3OTM2MSwzLjM3MjY1NzExIDE0LjMxODk4MzcsMyAxMy41MTE3Mzg0LDMgTDEzLjQ5NzMyMzMsMyBDMTIuNjc1NjYyOSwzIDExLjc2NzUxMTksMy42NTkzMTY0MyAxMC45NDU4NTE1LDQuNTE5Mjk0MzggQzEwLjAyMzI4NTQsMy44NDU2NDQ5OCA5LjAxNDIyODc1LDMuMzE1MzI1MjUgOC40MDg3OTQ3NywzLjY1OTMxNjQzIEM4LjM1MTEzNDM5LDMuNjg3OTgyMzYgOC4yNzkwNTg5MSwzLjcxNjY0ODI5IDguMjM1ODEzNjMsMy43NzM5ODAxNSBDOC4yMjEzOTg1MywzLjc4ODMxMzEyIDguMTkyNTY4MzUsMy44MDI2NDYwOSA4LjE3ODE1MzI1LDMuODMxMzEyMDIgQzguMTYzNzM4MTYsMy44NDU2NDQ5OCA4LjE0OTMyMzA2LDMuODU5OTc3OTUgOC4xMzQ5MDc5NywzLjg4ODY0Mzg4IEw4LjEyMDQ5Mjg3LDMuOTE3MzA5ODEgTDQuMTI3NTExNTgsOS4wNDg1MTE1OCBDNC4xMTMwOTY0OSw5LjA0ODUxMTU4IDQuMTEzMDk2NDksOS4wNDg1MTE1OCA0LjA5ODY4MTM5LDkuMDYyODQ0NTQgTDMuMjA0OTQ1NTEsMTAuMjIzODE0OCBMMy4xNjE3MDAyMywxMC4yNjY4MTM3IEMzLjExODQ1NDk0LDEwLjMwOTgxMjYgMy4wODk2MjQ3NSwxMC4zNjcxNDQ0IDMuMDc1MjA5NjYsMTAuNDEwMTQzMyBMMy4wNzUyMDk2NiwxMC40MjQ0NzYzIEMyLjYyODM0MTcxLDExLjM0MTc4NjEgNC4yODYwNzc2MywxMy4xMzM0MDY4IDUuMDY0NDkyNzUsMTMuOTIxNzIgQzUuNzU2NDE3MzEsMTQuNjA5NzAyMyA3LjI4NDQxNzM3LDE2IDguMjM1ODEzNjMsMTYgQzguNDM3NjI0OTYsMTYgOC41OTYxOTEsMTUuOTQyNjY4MSA4Ljc0MDM0MTk1LDE1LjgxMzY3MTQgTDE0LjI2MTMyMzMsMTEuNTU2NzgwNiBDMTQuMjkwMTUzNSwxMS41NDI0NDc2IDE0LjMwNDU2ODYsMTEuNTEzNzgxNyAxNC4zMzMzOTg4LDExLjQ4NTExNTggQzE0LjM2MjIyOSwxMS41MTM3ODE3IDE0LjM3NjY0NDEsMTEuNTU2NzgwNiAxNC4zOTEwNTkyLDExLjU4NTQ0NjUgQzE0LjU2NDA0MDMsMTEuOTI5NDM3NyAxNC42NzkzNjEsMTIuMjg3NzYxOSAxNC42OTM3NzYxLDEyLjY3NDc1MTkgQzE0LjczNzAyMTQsMTMuMDYxNzQyIDE0LjcwODE5MTIsMTMuNDYzMDY1IDE0LjY1MDUzMDksMTMuODUwMDU1MSBMMTQuNjUwNTMwOSwxMy44NjQzODgxIEMxNC42MzYxMTU4LDEzLjk3OTA1MTggMTQuNjM2MTE1OCwxNC4wNzkzODI2IDE0LjY1MDUzMDksMTQuMTk0MDQ2MyBDMTQuNzUxNDM2NSwxNC44MzkwMjk4IDE1LjM1Njg3MDUsMTUuMjgzMzUxNyAxNS45OTExMzQ3LDE1LjE4MzAyMDkgQzE2LjYzOTgxNCwxNS4wODI2OTAyIDE3LjA4NjY4MTksMTQuNDgwNzA1NiAxNi45ODU3NzYyLDEzLjgzNTcyMjIgQzE2Ljg5OTI4NTcsMTMuMjc2NzM2NSAxNi43ODM5NjQ5LDEyLjcwMzQxNzkgMTYuNTUzMzIzNCwxMi4xNTg3NjUyIiBpZD0iRmlsbC0xIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",isSelected:t.isSelected,onMouseDown:t.onMouseDown})};eh.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var nh=eh;function ih(t){return ih="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ih(t)}function rh(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,oh(i.key),i)}}function oh(t){var e=function(t,e){if("object"!=ih(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=ih(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ih(e)?e:e+""}function sh(t,e,n){return e=lh(e),function(t,e){if(e&&("object"==ih(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ah()?Reflect.construct(e,n||[],lh(t).constructor):e.apply(t,n))}function ah(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ah=function(){return!!t})()}function lh(t){return lh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lh(t)}function ch(t,e){return ch=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ch(t,e)}var uh=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=sh(this,e,[t]),m()(n,["activateTool","deactivateTool"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ch(t,e)}(e,t),function(t,e,n){return e&&rh(t.prototype,e),n&&rh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidMount",value:function(){this.props.isFillModeActive&&this.activateTool(this.props)}},{key:"componentWillReceiveProps",value:function(t){this.tool&&(t.fillColor!==this.props.fillColor&&this.tool.setFillColor(t.fillColor),t.fillColor2!==this.props.fillColor2&&this.tool.setFillColor2(t.fillColor2),t.hoveredItemId!==this.props.hoveredItemId&&this.tool.setPrevHoveredItemId(t.hoveredItemId),t.fillModeGradientType!==this.props.fillModeGradientType&&this.tool.setGradientType(t.fillModeGradientType)),t.isFillModeActive&&!this.props.isFillModeActive?this.activateTool():!t.isFillModeActive&&this.props.isFillModeActive&&this.deactivateTool()}},{key:"shouldComponentUpdate",value:function(t){return t.isFillModeActive!==this.props.isFillModeActive}},{key:"componentWillUnmount",value:function(){this.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){bt(this.props.clearSelectedItems);var t=this.props.fillColor;this.props.fillColor===Di&&(t=Ai,this.props.onChangeFillColor(Ai,0));var e=this.props.fillModeGradientType?this.props.fillModeGradientType:this.props.fillStyleGradientType,n=this.props.fillColor2;e!==this.props.fillStyleGradientType&&(this.props.fillStyleGradientType===ci.SOLID&&(n=ji(t),this.props.onChangeFillColor(n,1)),this.props.changeGradientType(e)),this.props.fillColor2===Di&&(n=ji(t),this.props.onChangeFillColor(n,1)),this.tool=new th(this.props.setHoveredItem,this.props.clearHoveredItem,this.props.onUpdateImage),this.tool.setFillColor(t),this.tool.setFillColor2(n),this.tool.setGradientType(e),this.tool.setPrevHoveredItemId(this.props.hoveredItemId),this.tool.activate()}},{key:"deactivateTool",value:function(){this.tool.deactivateTool(),this.tool.remove(),this.tool=null}},{key:"render",value:function(){return l().createElement(nh,{isSelected:this.props.isFillModeActive,onMouseDown:this.props.handleMouseDown})}}])}(l().Component);uh.propTypes={changeGradientType:i().func.isRequired,clearHoveredItem:i().func.isRequired,clearSelectedItems:i().func.isRequired,fillColor:i().string,fillColor2:i().string,fillStyleGradientType:i().oneOf(Object.keys(ci)).isRequired,fillModeGradientType:i().oneOf(Object.keys(ci)),handleMouseDown:i().func.isRequired,hoveredItemId:i().number,isFillModeActive:i().bool.isRequired,onChangeFillColor:i().func.isRequired,onUpdateImage:i().func.isRequired,setHoveredItem:i().func.isRequired};var hh=(0,c.connect)(function(t){return{fillModeGradientType:t.scratchPaint.fillMode.gradientType,fillColor:t.scratchPaint.color.fillColor.primary,fillColor2:t.scratchPaint.color.fillColor.secondary,fillStyleGradientType:t.scratchPaint.color.fillColor.gradientType,hoveredItemId:t.scratchPaint.hoveredItemId,isFillModeActive:t.scratchPaint.mode===E.FILL}},function(t){return{setHoveredItem:function(e){t(rn(e))},clearHoveredItem:function(){t(on())},clearSelectedItems:function(){t(en())},changeGradientType:function(e){t(Ns(e))},handleMouseDown:function(){t(Zi(E.FILL))},onChangeFillColor:function(e,n){0===n?t(wi(e)):1===n&&t(Ci(e))}}})(uh),dh=function(t,n,i){return t.getDistance(n,!0)<Math.pow(i/e().view.zoom,2)},ph=function(t,n,i){for(var r=ht({class:e().Path}),o=r.length-1;o>=0;o--)if(!r[o].closed&&r[o].parent instanceof e().Layer&&(!i||r[o]!==i)){if(r[o].firstSegment&&dh(r[o].firstSegment.point,t,n))return{path:r[o],segment:r[o].firstSegment,isFirst:!0};if(r[o].lastSegment&&dh(r[o].lastSegment.point,t,n))return{path:r[o],segment:r[o].lastSegment,isFirst:!1}}return null},fh="scratch-paint/stroke-width/CHANGE_STROKE_WIDTH",gh=100,mh=function(t){return{type:fh,strokeWidth:t}};function yh(t){return yh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yh(t)}function vh(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function bh(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?vh(Object(n),!0).forEach(function(e){Ih(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vh(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Ih(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=yh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=yh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==yh(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ah="scratch-paint/stroke-style/CHANGE_STROKE_COLOR",Mh="scratch-paint/stroke-style/CHANGE_STROKE_COLOR_2",wh="scratch-paint/stroke-style/CHANGE_STROKE_GRADIENT_TYPE",Ch="scratch-paint/stroke-style/CLEAR_STROKE_GRADIENT",Th=mi({changePrimaryColorAction:Ah,changeSecondaryColorAction:Mh,changeGradientTypeAction:wh,clearGradientAction:Ch,defaultColor:"#000000",selectionPrimaryColorKey:"strokeColor",selectionSecondaryColorKey:"strokeColor2",selectionGradientTypeKey:"strokeGradientType"}),xh=function(t){return{type:Ah,color:t}},Sh=function(t){return{type:Mh,color:t}},Dh=function(t){return{type:wh,gradientType:t}},Nh=function(){return{type:Ch}},_h=function(t){return l().createElement(ar,{imgDescriptor:lr.line,imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+bGluZTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZS1saW5lY2FwPSJzcXVhcmUiPgogICAgICAgIDxnIGlkPSJsaW5lIiBzdHJva2U9IiM1NzVFNzUiIHN0cm9rZS13aWR0aD0iMiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik01LDE1IEwxNSw1IiBpZD0iTGluZSI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",isSelected:t.isSelected,onMouseDown:t.onMouseDown})};_h.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var Eh=_h;function jh(t){return jh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jh(t)}function kh(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Oh(i.key),i)}}function Oh(t){var e=function(t,e){if("object"!=jh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=jh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==jh(e)?e:e+""}function zh(t,e,n){return e=Bh(e),function(t,e){if(e&&("object"==jh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Lh()?Reflect.construct(e,n||[],Bh(t).constructor):e.apply(t,n))}function Lh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Lh=function(){return!!t})()}function Bh(t){return Bh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bh(t)}function Ph(t,e){return Ph=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ph(t,e)}var Rh=function(t){function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e=zh(this,n,[t]),m()(e,["activateTool","deactivateTool","drawHitPoint","onMouseDown","onMouseMove","onMouseDrag","onMouseUp"]),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ph(t,e)}(n,t),function(t,e,n){return e&&kh(t.prototype,e),n&&kh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"componentDidMount",value:function(){this.props.isLineModeActive&&this.activateTool()}},{key:"componentWillReceiveProps",value:function(t){t.isLineModeActive&&!this.props.isLineModeActive?this.activateTool():!t.isLineModeActive&&this.props.isLineModeActive&&this.deactivateTool()}},{key:"shouldComponentUpdate",value:function(t){return t.isLineModeActive!==this.props.isLineModeActive}},{key:"componentWillUnmount",value:function(){this.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){bt(this.props.clearSelectedItems);var t=this.props.colorState.strokeColor.primary,i=this.props.colorState.strokeColor.secondary;t!==Di&&(null!==t||null!==i&&i!==Di)||this.props.onChangeStrokeColor(n.DEFAULT_COLOR),i===Di&&this.props.clearStrokeGradient(),this.props.colorState.strokeWidth||this.props.onChangeStrokeWidth(1),this.tool=new(e().Tool),this.active=!1,this.path=null,this.hitResult=null;var r=this;this.tool.onMouseDown=function(t){t.event.button>0||r.onMouseDown(t)},this.tool.onMouseMove=function(t){r.onMouseMove(t)},this.tool.onMouseDrag=function(t){t.event.button>0||r.onMouseDrag(t)},this.tool.onMouseUp=function(t){t.event.button>0||r.onMouseUp(t)},this.tool.activate()}},{key:"onMouseDown",value:function(t){t.event.button>0||(this.active=!0,this.hitResult=ph(t.point,n.SNAP_TOLERANCE),this.hitResult&&(this.path=this.hitResult.path,Ui(this.path,{fillColor:null,strokeColor:this.props.colorState.strokeColor,strokeWidth:this.props.colorState.strokeWidth}),this.hitResult.isFirst&&this.path.reverse(),this.path.lastSegment.handleOut=null,this.path.add(this.hitResult.segment.point)),this.path||(this.path=new(e().Path),this.path.strokeCap="round",Ui(this.path,{fillColor:null,strokeColor:this.props.colorState.strokeColor,strokeWidth:this.props.colorState.strokeWidth}),this.path.add(t.point),this.path.add(t.point)))}},{key:"drawHitPoint",value:function(t){if(t){var e=t.path;t.isFirst?Lt(e.firstSegment.point):Lt(e.lastSegment.point)}}},{key:"onMouseMove",value:function(t){this.hitResult&&zt(),this.hitResult=ph(t.point,n.SNAP_TOLERANCE),this.drawHitPoint(this.hitResult)}},{key:"onMouseDrag",value:function(t){if(!(t.event.button>0)&&this.active){this.hitResult&&(zt(),this.hitResult=null);var e=t.point;if(t.modifiers.shift){var i=t.point.subtract(this.path.lastSegment.previous.point);e=this.path.lastSegment.previous.point.add(K(i,Math.PI/4))}if(this.path&&!this.path.closed&&this.path.segments.length>3&&dh(this.path.firstSegment.point,e,n.SNAP_TOLERANCE)?this.hitResult={path:this.path,segment:this.path.firstSegment,isFirst:!0}:this.hitResult=ph(e,n.SNAP_TOLERANCE,this.path),this.hitResult&&t.modifiers.shift){var r=this.hitResult.segment.point.subtract(this.path.lastSegment.previous.point),o=e.subtract(this.path.lastSegment.previous.point);r.normalize().getDistance(o.normalize())>.01&&(this.hitResult=null)}this.hitResult?(this.drawHitPoint(this.hitResult),this.path.lastSegment.point=this.hitResult.segment.point):this.path.lastSegment.point=e,Ui(this.path,{fillColor:null,strokeColor:this.props.colorState.strokeColor,strokeWidth:this.props.colorState.strokeWidth})}}},{key:"onMouseUp",value:function(t){if(!(t.event.button>0)&&this.active){if(this.path.segments.length<2||2===this.path.segments.length&&dh(this.path.firstSegment.point,t.point,n.SNAP_TOLERANCE)&&!this.hitResult)return this.path.remove(),void(this.path=null);if(!this.hitResult&&dh(this.path.lastSegment.point,this.path.segments[this.path.segments.length-2].point,n.SNAP_TOLERANCE))return this.path.removeSegment(this.path.segments.length-1),void(this.path=null);this.hitResult&&(this.path.removeSegment(this.path.segments.length-1),this.path.firstSegment.point.equals(this.hitResult.segment.point)?(this.path.firstSegment.handleIn=null,this.path.closed=!0):(this.hitResult.isFirst||this.hitResult.path.reverse(),this.hitResult.path.firstSegment.handleIn=null,this.path.join(this.hitResult.path)),zt(),this.hitResult=null),Ui(this.path,{fillColor:null,strokeColor:this.props.colorState.strokeColor,strokeWidth:this.props.colorState.strokeWidth}),this.path&&(this.props.onUpdateImage(),this.path=null),this.active=!1}}},{key:"deactivateTool",value:function(){this.tool.remove(),this.tool=null,this.hitResult&&(zt(),this.hitResult=null),this.path&&(this.path=null)}},{key:"render",value:function(){return l().createElement(Eh,{isSelected:this.props.isLineModeActive,onMouseDown:this.props.handleMouseDown})}}],[{key:"SNAP_TOLERANCE",get:function(){return 6}},{key:"DEFAULT_COLOR",get:function(){return"#000000"}}])}(l().Component);Rh.propTypes={clearSelectedItems:i().func.isRequired,clearStrokeGradient:i().func.isRequired,colorState:i().shape({fillColor:Xr,strokeColor:Xr,strokeWidth:i().number}).isRequired,handleMouseDown:i().func.isRequired,isLineModeActive:i().bool.isRequired,onChangeStrokeColor:i().func.isRequired,onChangeStrokeWidth:i().func.isRequired,onUpdateImage:i().func.isRequired};var Uh=(0,c.connect)(function(t){return{colorState:t.scratchPaint.color,isLineModeActive:t.scratchPaint.mode===E.LINE}},function(t){return{clearSelectedItems:function(){t(en())},clearStrokeGradient:function(){t(Nh())},handleMouseDown:function(){t(Zi(E.LINE))},onChangeStrokeColor:function(e){t(xh(e))},onChangeStrokeWidth:function(e){t(mh(e))}}})(Rh);function Gh(t){return Gh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gh(t)}function Yh(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Zh(i.key),i)}}function Zh(t){var e=function(t,e){if("object"!=Gh(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Gh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Gh(e)?e:e+""}function Wh(t,e,n){return e=Hh(e),function(t,e){if(e&&("object"==Gh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Qh()?Reflect.construct(e,n||[],Hh(t).constructor):e.apply(t,n))}function Qh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Qh=function(){return!!t})()}function Hh(t){return Hh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Hh(t)}function Fh(t,e){return Fh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fh(t,e)}var Vh=20,qh=function(t){function n(t,i,r,o,s,a,l,c){var u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),u=Wh(this,n);var h=(c?Ee().layer:e().project.activeLayer).rasterize(216*e().view.zoom,!1,e().view.bounds),d=ke().rasterize(216*e().view.zoom,!1,e().view.bounds);u.bufferCanvas=Ne(3*t.width,3*t.height);var p=u.bufferCanvas.getContext("2d");u.colorCanvas=Ne(3*t.width,3*t.height);var f=u.colorCanvas.getContext("2d");return d.onLoad=function(){p.drawImage(d.canvas,0,0),h.onLoad=function(){f.drawImage(h.canvas,0,0),p.drawImage(u.colorCanvas,0,0),u.bufferLoaded=!0},h.loaded&&h.onLoad()},u.onMouseDown=u.handleMouseDown,u.onMouseUp=u.handleMouseUp,u.onMouseMove=u.handleMouseMove,u.canvas=t,u.pixelRatio=o,u.zoom=s,u.offsetX=a,u.offsetY=l,u.width=i*u.zoom*u.pixelRatio,u.height=r*u.zoom*u.pixelRatio,u.rect=t.getBoundingClientRect(),u.colorString="",u.pickX=-1,u.pickY=-1,u.hideLoupe=!0,u}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Fh(t,e)}(n,t),function(t,e,n){return e&&Yh(t.prototype,e),n&&Yh(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"handleMouseMove",value:function(t){this.pickX=(t.point.x-this.offsetX)*this.zoom*this.pixelRatio,this.pickY=(t.point.y-this.offsetY)*this.zoom*this.pixelRatio,this.hideLoupe=this.pickX>this.width||this.pickX<0||this.pickY>this.height||this.pickY<0}},{key:"handleMouseDown",value:function(t){this.handleMouseMove(t)}},{key:"handleMouseUp",value:function(){if(!this.hideLoupe){var t=this.getColorInfo(this.pickX,this.pickY,this.hideLoupe);if(!t)return;if(0===t.color[3])return void(this.colorString=null);var e=t.color[0],n=t.color[1],i=t.color[2],r=function(t){var e=t.toString(16);return 1===e.length?"0".concat(e):e};this.colorString="#".concat(r(e)).concat(r(n)).concat(r(i))}}},{key:"getColorInfo",value:function(t,e,n){var i=t/this.pixelRatio,r=e/this.pixelRatio;if(!this.bufferLoaded)return null;var o=this.colorCanvas.getContext("2d"),s=this.bufferCanvas.getContext("2d");return{x:t,y:e,color:o.getImageData(3*i,3*r,1,1).data,data:s.getImageData(3*(i-Vh),3*(r-Vh),120,120).data,hideLoupe:n}}}])}(e().Tool),Jh=p(745),Xh=p.n(Jh),Kh={};Kh.styleTagTransform=En(),Kh.setAttributes=Sn(),Kh.insert=Tn().bind(null,"head"),Kh.domAPI=wn(),Kh.insertStyleElement=Nn();An()(Xh(),Kh);var $h=Xh()&&Xh().locals?Xh().locals:void 0;function td(t){return td="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},td(t)}var ed=["colorInfo","pixelRatio"];function nd(){return nd=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},nd.apply(null,arguments)}function id(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,rd(i.key),i)}}function rd(t){var e=function(t,e){if("object"!=td(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=td(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==td(e)?e:e+""}function od(t,e,n){return e=ad(e),function(t,e){if(e&&("object"==td(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,sd()?Reflect.construct(e,n||[],ad(t).constructor):e.apply(t,n))}function sd(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(sd=function(){return!!t})()}function ad(t){return ad=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ad(t)}function ld(t,e){return ld=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ld(t,e)}var cd=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=od(this,e,[t]),m()(n,["setCanvas"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ld(t,e)}(e,t),function(t,e,n){return e&&id(t.prototype,e),n&&id(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidUpdate",value:function(){this.draw()}},{key:"draw",value:function(){var t=60,e=120,n=this.props.colorInfo.color,i=this.canvas.getContext("2d");this.canvas.width=e,this.canvas.height=e,i.fillStyle="white",i.fillRect(0,0,e,e);var r=document.createElement("canvas");r.width=e,r.height=e;var o=r.getContext("2d"),s=o.createImageData(e,e);this.props.colorInfo.data.length===s.data.length?s.data.set(this.props.colorInfo.data):console.warn("Image data size mismatch drawing loupe"),o.putImageData(s,0,0),i.drawImage(r,0,0),i.lineWidth=1,i.strokeStyle="black",i.fillStyle="rgba(".concat(n[0],", ").concat(n[1],", ").concat(n[2],", ").concat(n[3],")"),i.beginPath(),i.rect(57.5,57.5,5,5),i.fill(),i.stroke(),i.strokeStyle="rgba(".concat(n[0],", ").concat(n[1],", ").concat(n[2],", ").concat(n[3],")"),i.lineWidth=15,i.beginPath(),i.moveTo(e,e),i.arc(t,t,t,0,2*Math.PI),i.stroke()}},{key:"setCanvas",value:function(t){this.canvas=t,this.canvas&&this.draw()}},{key:"render",value:function(){var t=this.props,e=t.colorInfo,n=t.pixelRatio,i=function(t,e){if(null==t)return{};var n,i,r=function(t,e){if(null==t)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;n[i]=t[i]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)n=o[i],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}(t,ed),r=120;return l().createElement(Ya,nd({},i,{className:$h.eyeDropper,componentRef:this.setCanvas,element:"canvas",height:40,style:{top:e.y/n-60,left:e.x/n-60,width:r,height:r},width:40}))}}])}(l().Component);cd.propTypes={colorInfo:i().shape({color:i().instanceOf(Uint8ClampedArray),x:i().number,y:i().number,data:i().instanceOf(Uint8ClampedArray)}),pixelRatio:i().number.isRequired};var ud=cd,hd=p(582),dd=p.n(hd);function pd(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return fd(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fd(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function fd(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}var gd=function(){var t=It();return!(0===t.length||!t[0].previousSibling)},md=function(){var t=It();return!(0===t.length||!t[t.length-1].nextSibling)};function yd(t){return yd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yd(t)}function vd(){return vd=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},vd.apply(null,arguments)}function bd(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Id(i.key),i)}}function Id(t){var e=function(t,e){if("object"!=yd(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=yd(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==yd(e)?e:e+""}function Ad(t,e,n){return e=wd(e),function(t,e){if(e&&("object"==yd(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Md()?Reflect.construct(e,n||[],wd(t).constructor):e.apply(t,n))}function Md(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Md=function(){return!!t})()}function wd(t){return wd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wd(t)}function Cd(t,e){return Cd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cd(t,e)}var Td=p(409),xd=p.n(Td),Sd={};Sd.styleTagTransform=En(),Sd.setAttributes=Sn(),Sd.insert=Tn().bind(null,"head"),Sd.domAPI=wn(),Sd.insertStyleElement=Nn();An()(xd(),Sd);var Dd=xd()&&xd().locals?xd().locals:void 0;function Nd(t){return Nd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nd(t)}function _d(){return _d=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},_d.apply(null,arguments)}function Ed(t,e,n){return(e=kd(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jd(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,kd(i.key),i)}}function kd(t){var e=function(t,e){if("object"!=Nd(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Nd(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nd(e)?e:e+""}function Od(t,e,n){return e=Ld(e),function(t,e){if(e&&("object"==Nd(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,zd()?Reflect.construct(e,n||[],Ld(t).constructor):e.apply(t,n))}function zd(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(zd=function(){return!!t})()}function Ld(t){return Ld=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ld(t)}function Bd(t,e){return Bd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Bd(t,e)}var Pd=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=Od(this,e,[t]),m()(n,["handleClosePopover","handleToggleOpenState","isOpen"]),n.state={isOpen:!1},n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Bd(t,e)}(e,t),function(t,e,n){return e&&jd(t.prototype,e),n&&jd(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"handleClosePopover",value:function(){this.setState({isOpen:!1})}},{key:"handleToggleOpenState",value:function(){var t=!this.state.isOpen;this.setState({isOpen:t}),t&&this.props.onOpen&&this.props.onOpen()}},{key:"isOpen",value:function(){return this.state.isOpen}},{key:"render",value:function(){return l().createElement(hc(),_d({body:this.props.popoverContent,isOpen:this.state.isOpen,preferPlace:"below",onOuterAction:this.props.onOuterAction?this.props.onOuterAction:this.handleClosePopover},this.props),l().createElement("div",{className:h()(Dd.dropdown,this.props.className,Ed(Ed({},Dd.modOpen,this.state.isOpen),Dd.modClosed,!this.state.isOpen)),onClick:this.handleToggleOpenState},this.props.children,l().createElement("img",{className:h()(Dd.dropdownIcon,Ed({},Dd.modCaretUp,this.state.isOpen)),draggable:!1,src:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjhweCIgaGVpZ2h0PSI1cHgiIHZpZXdCb3g9IjAgMCA4IDUiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQzLjIgKDM5MDY5KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5kcm9wZG93bi1jYXJldDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJkcm9wZG93bi1jYXJldCIgZmlsbD0iIzg1NUNENiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik00LDUgQzMuNzI1MjA3MDgsNSAzLjQ1MTYzMDA2LDQuODk2OTUwNDUgMy4yNDEyNzk3Myw0LjY4OTY1MzExIEwwLjMxNDYxMzU3MiwxLjgwNjY2MjI3IEMtMC4xMDQ4NzExOTEsMS4zOTMyNjU4MyAtMC4xMDQ4NzExOTEsMC43MjQ2NDIwMjMgMC4zMTQ2MTM1NzIsMC4zMTAwNDczMzEgQzAuNzMyODgyNDM4LC0wLjEwMzM0OTExIDcuMjY3MTE3NTYsLTAuMTAzMzQ5MTEgNy42ODUzODY0MywwLjMxMDA0NzMzMSBDOC4xMDQ4NzExOSwwLjcyMzQ0Mzc3MiA4LjEwNDg3MTE5LDEuMzkzMjY1ODMgNy42ODUzODY0MywxLjgwNjY2MjI3IEw0Ljc1OTkzNjE3LDQuNjg5NjUzMTEgQzQuNTQ5NTg1ODMsNC44OTY5NTA0NSA0LjI3NjAwODgyLDUgNCw1Ij48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4K"})))}}])}(l().Component);Pd.propTypes={children:i().node.isRequired,className:i().string,onOpen:i().func,onOuterAction:i().func,popoverContent:i().node.isRequired};var Rd=Pd,Ud=p(460),Gd=p.n(Ud),Yd={};Yd.styleTagTransform=En(),Yd.setAttributes=Sn(),Yd.insert=Tn().bind(null,"head"),Yd.domAPI=wn(),Yd.insertStyleElement=Nn();An()(Gd(),Yd);var Zd=Gd()&&Gd().locals?Gd().locals:void 0;function Wd(t){return Wd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wd(t)}var Qd=["small","range"];function Hd(){return Hd=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Hd.apply(null,arguments)}function Fd(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=Wd(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Wd(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wd(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Vd=function(t){var e=t.small,n=t.range,i=function(t,e){if(null==t)return{};var n,i,r=function(t,e){if(null==t)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;n[i]=t[i]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)n=o[i],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}(t,Qd);return l().createElement("input",Hd({},i,{className:h()(Zd.inputForm,t.className,Fd(Fd({},Zd.inputSmall,e&&!n),Zd.inputSmallRange,e&&n))}))};Vd.propTypes={className:i().string,range:i().bool,small:i().bool},Vd.defaultProps={range:!1,small:!1};var qd=Vd,Jd=1274,Xd=["ab","ca","cy","de","et","el","ga","gd","gl","mi","nl","ja","ja-Hira","nb","nn","rap","th","sr","sk","sl","fi","sv","sw","vi","tr","uk"],Kd=function(t){return Xd.includes(t)},$d=p(957),tp=p.n($d),ep={};ep.styleTagTransform=En(),ep.setAttributes=Sn(),ep.insert=Tn().bind(null,"head"),ep.domAPI=wn(),ep.insertStyleElement=Nn();An()(tp(),ep);var np=tp()&&tp().locals?tp().locals:void 0,ip="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+c2VuZC1iYWNrPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9InNlbmQtYmFjayI+CiAgICAgICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwLjAwMDAwMCwgMTAuMDAwMDAwKSByb3RhdGUoMTgwLjAwMDAwMCkgdHJhbnNsYXRlKC0xMC4wMDAwMDAsIC0xMC4wMDAwMDApIHRyYW5zbGF0ZSgyLjAwMDAwMCwgMy4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMi4zNDc2NzM2LDUuOTI1NDk3MjMgTDEwLjI0MDczNzYsNS45MjU0OTcyMyBMOS4zMzYwMTYxMSwxMi43NjM1OTgxIEM5LjIzODA3NjAzLDEzLjU0NzY2NjEgOC41NDAyNTI5NSwxNC4xMDAzNjk4IDcuNzgxMjE3MzIsMTMuOTg0Njg3NiBDNy4xNjkwOTE4MSwxMy44OTQ3MTI2IDYuNjkxNjMzOTEsMTMuMzgwNTY5NyA2LjYxNjk1NDYsMTIuNzYzNTk4MSBMNS43MTIyMzMxLDUuOTI1NDk3MjMgTDMuNjU0MjY3MTQsNS45MjU0OTcyMyBDMy4wNjc4NTA5LDUuOTI1NDk3MjMgMi43ODUwNDg5Miw1LjE5Mjg0MzU2IDMuMTkwMjc2LDQuNzY4Njc1NjQgTDcuNTM1MTQyODYsMC4xOTI4MDM1OTcgQzcuNzkyMjM1NTgsLTAuMDY0MjY3ODY1OCA4LjIwOTcwNTE3LC0wLjA2NDI2Nzg2NTggOC40NTMzMzExMywwLjE5MjgwMzU5NyBMMTIuODEyODg5LDQuNzY4Njc1NjQgQzEzLjIxNjg5MTgsNS4xOTI4NDM1NiAxMi45MjMwNzE2LDUuOTI1NDk3MjMgMTIuMzQ3NjczNiw1LjkyNTQ5NzIzIiBpZD0iRmlsbC0xIiBmaWxsPSIjODU1Q0Q2Ij48L3BhdGg+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTIsOCBMMTYsOCIgaWQ9IlN0cm9rZS02IiBzdHJva2U9IiM1NzVFNzUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTEyLDEwIEwxNSwxMCIgaWQ9IlN0cm9rZS02LUNvcHkiIHN0cm9rZT0iIzU3NUU3NSIgb3BhY2l0eT0iMC43NSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48L3BhdGg+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTIsMTIgTDE0LDEyIiBpZD0iU3Ryb2tlLTYtQ29weS0yIiBzdHJva2U9IiM1NzVFNzUiIG9wYWNpdHk9IjAuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48L3BhdGg+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMCw4IEw0LDgiIGlkPSJTdHJva2UtMTAiIHN0cm9rZT0iIzU3NUU3NSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48L3BhdGg+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMSwxMCBMNCwxMCIgaWQ9IlN0cm9rZS0xMC1Db3B5IiBzdHJva2U9IiM1NzVFNzUiIG9wYWNpdHk9IjAuNzUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTIsMTIgTDQsMTIiIGlkPSJTdHJva2UtMTAtQ29weS0yIiBzdHJva2U9IiM1NzVFNzUiIG9wYWNpdHk9IjAuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48L3BhdGg+CiAgICAgICAgICAgIDwvZz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPgo=",rp="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+c2VuZC1mcm9udDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJzZW5kLWZyb250Ij4KICAgICAgICAgICAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMi4wMDAwMDAsIDMuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTIuMzQ3NjczNiw1LjkyNTQ5NzIzIEwxMC4yNDA3Mzc2LDUuOTI1NDk3MjMgTDkuMzM2MDE2MTEsMTIuNzYzNTk4MSBDOS4yMzgwNzYwMywxMy41NDc2NjYxIDguNTQwMjUyOTUsMTQuMTAwMzY5OCA3Ljc4MTIxNzMyLDEzLjk4NDY4NzYgQzcuMTY5MDkxODEsMTMuODk0NzEyNiA2LjY5MTYzMzkxLDEzLjM4MDU2OTcgNi42MTY5NTQ2LDEyLjc2MzU5ODEgTDUuNzEyMjMzMSw1LjkyNTQ5NzIzIEwzLjY1NDI2NzE0LDUuOTI1NDk3MjMgQzMuMDY3ODUwOSw1LjkyNTQ5NzIzIDIuNzg1MDQ4OTIsNS4xOTI4NDM1NiAzLjE5MDI3Niw0Ljc2ODY3NTY0IEw3LjUzNTE0Mjg2LDAuMTkyODAzNTk3IEM3Ljc5MjIzNTU4LC0wLjA2NDI2Nzg2NTggOC4yMDk3MDUxNywtMC4wNjQyNjc4NjU4IDguNDUzMzMxMTMsMC4xOTI4MDM1OTcgTDEyLjgxMjg4OSw0Ljc2ODY3NTY0IEMxMy4yMTY4OTE4LDUuMTkyODQzNTYgMTIuOTIzMDcxNiw1LjkyNTQ5NzIzIDEyLjM0NzY3MzYsNS45MjU0OTcyMyIgaWQ9IkZpbGwtMSIgZmlsbD0iIzg1NUNENiI+PC9wYXRoPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTEyLDggTDE2LDgiIGlkPSJTdHJva2UtNiIgc3Ryb2tlPSIjNTc1RTc1IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMiwxMCBMMTUsMTAiIGlkPSJTdHJva2UtNi1Db3B5IiBzdHJva2U9IiM1NzVFNzUiIG9wYWNpdHk9IjAuNzUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTEyLDEyIEwxNCwxMiIgaWQ9IlN0cm9rZS02LUNvcHktMiIgc3Ryb2tlPSIjNTc1RTc1IiBvcGFjaXR5PSIwLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTAsOCBMNCw4IiBpZD0iU3Ryb2tlLTEwIiBzdHJva2U9IiM1NzVFNzUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PC9wYXRoPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTEsMTAgTDQsMTAiIGlkPSJTdHJva2UtMTAtQ29weSIgc3Ryb2tlPSIjNTc1RTc1IiBvcGFjaXR5PSIwLjc1IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0yLDEyIEw0LDEyIiBpZD0iU3Ryb2tlLTEwLUNvcHktMiIgc3Ryb2tlPSIjNTc1RTc1IiBvcGFjaXR5PSIwLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PC9wYXRoPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4K";function op(t){return op="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},op(t)}function sp(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=op(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=op(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==op(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ap=function(t){var e=function(e){function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e=Ad(this,n,[t]),m()(e,["handleChange","handleKeyPress","handleFlush"]),e.state={value:null},e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cd(t,e)}(n,e),function(t,e,n){return e&&bd(t.prototype,e),n&&bd(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"handleKeyPress",value:function(t){"Enter"===t.key&&(this.handleFlush(),t.target.blur())}},{key:"handleFlush",value:function(){var t="number"==typeof this.props.value,e=!t||!isNaN(this.state.value);null!==this.state.value&&e&&this.props.onSubmit(t?Number(this.state.value):this.state.value),this.setState({value:null})}},{key:"handleChange",value:function(t){this.setState({value:t.target.value})}},{key:"render",value:function(){var e=null===this.state.value?this.props.value:this.state.value;return l().createElement(t,vd({},this.props,{value:e,onBlur:this.handleFlush,onChange:this.handleChange,onKeyPress:this.handleKeyPress}))}}])}(l().Component);return e.propTypes={onSubmit:i().func.isRequired,value:i().oneOfType([i().string,i().number])},e}(qd),lp=(0,d.defineMessages)({costume:{id:"paint.paintEditor.costume",defaultMessage:"Costume"},group:{id:"paint.paintEditor.group",defaultMessage:"Group"},ungroup:{id:"paint.paintEditor.ungroup",defaultMessage:"Ungroup"},undo:{id:"paint.paintEditor.undo",defaultMessage:"Undo"},redo:{id:"paint.paintEditor.redo",defaultMessage:"Redo"},forward:{id:"paint.paintEditor.forward",defaultMessage:"Forward"},backward:{id:"paint.paintEditor.backward",defaultMessage:"Backward"},front:{id:"paint.paintEditor.front",defaultMessage:"Front"},back:{id:"paint.paintEditor.back",defaultMessage:"Back"},more:{id:"paint.paintEditor.more",defaultMessage:"More"}}),cp=function(t){var e=!t.canRedo(),n=!t.canUndo(),i=(0,d.useIntl)();return l().createElement("div",{className:np.row},l().createElement(wu,null,l().createElement(dd(),{minWidth:Jd},l().createElement(Nu,{text:i.formatMessage(lp.costume)},l().createElement(ap,{className:np.costumeInput,type:"text",value:t.name,onSubmit:t.onUpdateName}))),l().createElement(dd(),{maxWidth:Jd-1},l().createElement(ap,{className:np.costumeInput,type:"text",value:t.name,onSubmit:t.onUpdateName}))),l().createElement(wu,null,l().createElement(Va,null,l().createElement($i,{className:h()(np.buttonGroupButton,sp({},np.modNoEndBorder,!e)),disabled:n,onClick:t.onUndo},l().createElement("img",{alt:i.formatMessage(lp.undo),className:h()(np.buttonGroupButtonIcon,np.undoIcon),draggable:!1,src:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+dW5kbzwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJ1bmRvIiBmaWxsPSIjODU1Q0Q2Ij4KICAgICAgICAgICAgPHBhdGggZD0iTTE1LjU1ODE2MzUsMTIuNzcwMDY1MSBMMTEuODQwMzk3MiwxNi40OTQxMzE1IEMxMS41NjEwOTIyLDE2Ljc2NzEzNjQgMTEuMTgzMDg1NCwxNi45MjExMzkxIDEwLjc5MDM3ODQsMTYuOTIxMTM5MSBDMTAuMzk5MDcxNSwxNi45MjExMzkxIDEwLjAyMTA2NDcsMTYuNzY3MTM2NCA5Ljc0MDM1OTcxLDE2LjQ5NDEzMTUgTDYuMDIzOTkzNDIsMTIuNzcwMDY1MSBDNS41OTY5ODU4LDEyLjM0MzA1NzQgNS40NzA5ODM1NSwxMS43MDYwNDYxIDUuNzAxOTg3NjcsMTEuMTUzMDM2MiBDNS45MzI5OTE3OSwxMC42MDAwMjYzIDYuNDY1MDAxMjgsMTAuMjQzMDIgNy4wNjcwMTIwMiwxMC4yNDMwMiBMOC40MDQwMzU4NywxMC4yNDMwMiBDOC4zNjkwMzUyNSw5LjkyMTAxNDIzIDguMjc4MDMzNjIsOS41NTcwMDc3NCA4LjEyNDAzMDg4LDkuMTcyMDAwODcgQzguMDc1NzMwMDIsOS4wNTk5OTg4NyA4LjAyNjAyOTEzLDguOTQ3OTk2ODggNy45NzAwMjgxMyw4LjgzNTk5NDg4IEM3Ljg5MzAyNjc2LDguNzA5OTkyNjMgNy45MDA3MjY4OSw4LjY3NDk5MjAxIDcuNzk1MDI1MDEsOC41MjA5ODkyNiBDNy42MjcwMjIwMSw4LjI2ODk4NDc2IDcuNDczMDE5MjYsOC4wNzk5ODEzOSA3LjI5MDMxNjAxLDcuODYyOTc3NTIgQzYuOTIwMDA5NCw3LjQ2Mzk3MDQgNi40NzIwMDE0MSw3LjEyMDk2NDI5IDUuOTk1OTkyOTIsNi44Njg5NTk3OSBDNS41MTI5ODQzLDYuNjE2OTU1MyA1LjAwODk3NTMxLDYuNDYyOTUyNTUgNC41NjA5NjczMiw2LjM3ODk1MTA1IEM0LjExOTk1OTQ1LDYuMzAxOTQ5NjggMy43MTM5NTIyMSw2LjI5NDk0OTU1IDMuNDc1OTQ3OTYsNi4yOTQ5NDk1NSBDMy4zNTY5NDU4NCw2LjI4Nzk0OTQzIDMuMjAyOTQzMSw2LjMxNTk0OTkzIDMuMTI1OTQxNzIsNi4zMjI5NTAwNSBDMy4wNDE5NDAyMiw2LjMyOTk1MDE4IDIuOTkyOTM5MzUsNi4zMzY5NTAzIDIuOTkyOTM5MzUsNi4zMzY5NTAzIEMyLjQ5NTkzMDQ4LDYuMzg1OTUxMTcgMi4wNDc5MjI0OSw2LjAyMTk0NDY4IDEuOTk4OTIxNjIsNS41MjQ5MzU4MiBDMS45NTY5MjA4Nyw1LjEwNDkyODMyIDIuMjAxOTI1MjQsNC43MjY5MjE1OCAyLjU3MjkzMTg2LDQuNTg2OTE5MDggQzIuNTcyOTMxODYsNC41ODY5MTkwOCAyLjYyMTkzMjczLDQuNTY1OTE4NzEgMi42OTg5MzQxLDQuNTM3OTE4MjEgQzIuNzg5OTM1NzMsNC41MDk5MTc3MSAyLjg3MzkzNzIzLDQuNDYwOTE2ODQgMy4wNjk5NDA3Miw0LjQwNDkxNTg0IEMzLjQ2MTk0NzcyLDQuMjg1OTEzNzEgMy45NTg5NTY1OCw0LjE1OTkxMTQ3IDQuNjA5OTY4MTksNC4wOTY5MTAzNCBDNS4yNTM5Nzk2OCw0LjA0MDkwOTM0IDYuMDMwOTkzNTQsNC4wNTQ5MDk1OSA2Ljg1MDcwODE2LDQuMjIyOTEyNTkgQzcuNjY5MDIyNzYsNC4zOTc5MTU3MSA4LjUzMDAzODEyLDQuNzI2OTIxNTggOS4zMjgwNTIzNSw1LjIwMjkzMDA3IEM5LjcwNjA1OTEsNS40NDc5MzQ0NCAxMC4xMTIwNjYzLDUuNzM0OTM5NTYgMTAuNDI3MDcyLDYuMDE0OTQ0NTYgQzEwLjU2NzA3NDUsNi4xMTk5NDY0MyAxMC44MDUwNzg3LDYuMzU3OTUwNjggMTAuOTQ1MDgxMiw2LjUwNDk1MzMgQzExLjEwNjA4NDEsNi42NzI5NTYyOSAxMS4yNTMwODY3LDYuODQwOTU5MjkgMTEuNDAwNzg5Myw3LjAxNTk2MjQxIEMxMS45NjcwOTk0LDcuNzE1OTc0OSAxMi4zODcxMDY5LDguNDcxOTg4MzkgMTIuNjYwMTExOCw5LjE1ODAwMDYyIEMxMi44MjExMTQ3LDkuNTUwMDA3NjIgMTIuOTMzMTE2Nyw5LjkyMTAxNDIzIDEzLjAxNzExODIsMTAuMjQzMDIgTDE0LjUxNTE0NDksMTAuMjQzMDIgQzE1LjExNzE1NTYsMTAuMjQzMDIgMTUuNjQ5MTY1MSwxMC42MDAwMjYzIDE1Ljg4MDE2OTIsMTEuMTUzMDM2MiBDMTYuMTExMTczNCwxMS43MDYwNDYxIDE1Ljk4NTE3MTEsMTIuMzQzMDU3NCAxNS41NTgxNjM1LDEyLjc3MDA2NTEiIGlkPSJGaWxsLTEiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDguOTk0MjQ3LCAxMC40OTQyNDcpIHNjYWxlKC0xLCAxKSByb3RhdGUoLTQ1LjAwMDAwMCkgdHJhbnNsYXRlKC04Ljk5NDI0NywgLTEwLjQ5NDI0NykgIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4K"})),l().createElement($i,{className:h()(np.buttonGroupButton,sp({},np.modStartBorder,!e)),disabled:e,onClick:t.onRedo},l().createElement("img",{alt:i.formatMessage(lp.redo),className:np.buttonGroupButtonIcon,draggable:!1,src:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+cmVkbzwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJyZWRvIiBmaWxsPSIjODU1Q0Q2Ij4KICAgICAgICAgICAgPHBhdGggZD0iTTE3LjU1ODE2MzUsMTIuNzcwMDY1MSBMMTMuODQwMzk3MiwxNi40OTQxMzE1IEMxMy41NjEwOTIyLDE2Ljc2NzEzNjQgMTMuMTgzMDg1NCwxNi45MjExMzkxIDEyLjc5MDM3ODQsMTYuOTIxMTM5MSBDMTIuMzk5MDcxNSwxNi45MjExMzkxIDEyLjAyMTA2NDcsMTYuNzY3MTM2NCAxMS43NDAzNTk3LDE2LjQ5NDEzMTUgTDguMDIzOTkzNDIsMTIuNzcwMDY1MSBDNy41OTY5ODU4LDEyLjM0MzA1NzQgNy40NzA5ODM1NSwxMS43MDYwNDYxIDcuNzAxOTg3NjcsMTEuMTUzMDM2MiBDNy45MzI5OTE3OSwxMC42MDAwMjYzIDguNDY1MDAxMjgsMTAuMjQzMDIgOS4wNjcwMTIwMiwxMC4yNDMwMiBMMTAuNDA0MDM1OSwxMC4yNDMwMiBDMTAuMzY5MDM1Miw5LjkyMTAxNDIzIDEwLjI3ODAzMzYsOS41NTcwMDc3NCAxMC4xMjQwMzA5LDkuMTcyMDAwODcgQzEwLjA3NTczLDkuMDU5OTk4ODcgMTAuMDI2MDI5MSw4Ljk0Nzk5Njg4IDkuOTcwMDI4MTMsOC44MzU5OTQ4OCBDOS44OTMwMjY3Niw4LjcwOTk5MjYzIDkuOTAwNzI2ODksOC42NzQ5OTIwMSA5Ljc5NTAyNTAxLDguNTIwOTg5MjYgQzkuNjI3MDIyMDEsOC4yNjg5ODQ3NiA5LjQ3MzAxOTI2LDguMDc5OTgxMzkgOS4yOTAzMTYwMSw3Ljg2Mjk3NzUyIEM4LjkyMDAwOTQsNy40NjM5NzA0IDguNDcyMDAxNDEsNy4xMjA5NjQyOSA3Ljk5NTk5MjkyLDYuODY4OTU5NzkgQzcuNTEyOTg0Myw2LjYxNjk1NTMgNy4wMDg5NzUzMSw2LjQ2Mjk1MjU1IDYuNTYwOTY3MzIsNi4zNzg5NTEwNSBDNi4xMTk5NTk0NSw2LjMwMTk0OTY4IDUuNzEzOTUyMjEsNi4yOTQ5NDk1NSA1LjQ3NTk0Nzk2LDYuMjk0OTQ5NTUgQzUuMzU2OTQ1ODQsNi4yODc5NDk0MyA1LjIwMjk0MzEsNi4zMTU5NDk5MyA1LjEyNTk0MTcyLDYuMzIyOTUwMDUgQzUuMDQxOTQwMjIsNi4zMjk5NTAxOCA0Ljk5MjkzOTM1LDYuMzM2OTUwMyA0Ljk5MjkzOTM1LDYuMzM2OTUwMyBDNC40OTU5MzA0OCw2LjM4NTk1MTE3IDQuMDQ3OTIyNDksNi4wMjE5NDQ2OCAzLjk5ODkyMTYyLDUuNTI0OTM1ODIgQzMuOTU2OTIwODcsNS4xMDQ5MjgzMiA0LjIwMTkyNTI0LDQuNzI2OTIxNTggNC41NzI5MzE4Niw0LjU4NjkxOTA4IEM0LjU3MjkzMTg2LDQuNTg2OTE5MDggNC42MjE5MzI3Myw0LjU2NTkxODcxIDQuNjk4OTM0MSw0LjUzNzkxODIxIEM0Ljc4OTkzNTczLDQuNTA5OTE3NzEgNC44NzM5MzcyMyw0LjQ2MDkxNjg0IDUuMDY5OTQwNzIsNC40MDQ5MTU4NCBDNS40NjE5NDc3Miw0LjI4NTkxMzcxIDUuOTU4OTU2NTgsNC4xNTk5MTE0NyA2LjYwOTk2ODE5LDQuMDk2OTEwMzQgQzcuMjUzOTc5NjgsNC4wNDA5MDkzNCA4LjAzMDk5MzU0LDQuMDU0OTA5NTkgOC44NTA3MDgxNiw0LjIyMjkxMjU5IEM5LjY2OTAyMjc2LDQuMzk3OTE1NzEgMTAuNTMwMDM4MSw0LjcyNjkyMTU4IDExLjMyODA1MjQsNS4yMDI5MzAwNyBDMTEuNzA2MDU5MSw1LjQ0NzkzNDQ0IDEyLjExMjA2NjMsNS43MzQ5Mzk1NiAxMi40MjcwNzIsNi4wMTQ5NDQ1NiBDMTIuNTY3MDc0NSw2LjExOTk0NjQzIDEyLjgwNTA3ODcsNi4zNTc5NTA2OCAxMi45NDUwODEyLDYuNTA0OTUzMyBDMTMuMTA2MDg0MSw2LjY3Mjk1NjI5IDEzLjI1MzA4NjcsNi44NDA5NTkyOSAxMy40MDA3ODkzLDcuMDE1OTYyNDEgQzEzLjk2NzA5OTQsNy43MTU5NzQ5IDE0LjM4NzEwNjksOC40NzE5ODgzOSAxNC42NjAxMTE4LDkuMTU4MDAwNjIgQzE0LjgyMTExNDcsOS41NTAwMDc2MiAxNC45MzMxMTY3LDkuOTIxMDE0MjMgMTUuMDE3MTE4MiwxMC4yNDMwMiBMMTYuNTE1MTQ0OSwxMC4yNDMwMiBDMTcuMTE3MTU1NiwxMC4yNDMwMiAxNy42NDkxNjUxLDEwLjYwMDAyNjMgMTcuODgwMTY5MiwxMS4xNTMwMzYyIEMxOC4xMTExNzM0LDExLjcwNjA0NjEgMTcuOTg1MTcxMSwxMi4zNDMwNTc0IDE3LjU1ODE2MzUsMTIuNzcwMDY1MSIgaWQ9IkZpbGwtMSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuOTk0MjQ3LCAxMC40OTQyNDcpIHJvdGF0ZSgtNDUuMDAwMDAwKSB0cmFuc2xhdGUoLTEwLjk5NDI0NywgLTEwLjQ5NDI0NykgIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4K"})))),A(t.format)?l().createElement(wu,{className:np.modDashedBorder},l().createElement(Wc,{disabled:!W(),hideLabel:Kd(i.locale),imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+Z3JvdXA8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iZ3JvdXAiIHN0cm9rZS13aWR0aD0iMC43NSI+CiAgICAgICAgICAgIDxnIGlkPSJncm91cC1pY29uIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyLjAwMDAwMCwgMi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtMiIgc3Ryb2tlPSIjODU1Q0Q2IiBmaWxsPSIjRkZGRkZGIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHg9IjAiIHk9IjAiIHdpZHRoPSIzIiBoZWlnaHQ9IjMiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtMi1Db3B5LTIiIHN0cm9rZT0iIzg1NUNENiIgZmlsbD0iI0ZGRkZGRiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiB4PSIxMyIgeT0iMCIgd2lkdGg9IjMiIGhlaWdodD0iMyI+PC9yZWN0PgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS0yLUNvcHkiIHN0cm9rZT0iIzg1NUNENiIgZmlsbD0iI0ZGRkZGRiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiB4PSIwIiB5PSIxMyIgd2lkdGg9IjMiIGhlaWdodD0iMyI+PC9yZWN0PgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS0yLUNvcHktMyIgc3Ryb2tlPSIjODU1Q0Q2IiBmaWxsPSIjRkZGRkZGIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHg9IjEzIiB5PSIxMyIgd2lkdGg9IjMiIGhlaWdodD0iMyI+PC9yZWN0PgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTEuNSwzIEwxLjUsMTMiIGlkPSJMaW5lIiBzdHJva2U9IiM4NTVDRDYiIHN0cm9rZS1saW5lY2FwPSJzcXVhcmUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xNC41LDMgTDE0LjUsMTMiIGlkPSJMaW5lLUNvcHkiIHN0cm9rZT0iIzg1NUNENiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSI+PC9wYXRoPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTEzLDEuNSBMMywxLjUiIGlkPSJMaW5lLUNvcHktMiIgc3Ryb2tlPSIjODU1Q0Q2IiBzdHJva2UtbGluZWNhcD0ic3F1YXJlIj48L3BhdGg+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTMsMTQuNSBMMywxNC41IiBpZD0iTGluZS1Db3B5LTMiIHN0cm9rZT0iIzg1NUNENiIgc3Ryb2tlLWxpbmVjYXA9InNxdWFyZSI+PC9wYXRoPgogICAgICAgICAgICAgICAgPGcgaWQ9Ikdyb3VwIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg4LjAwMDAwMCwgOC4wMDAwMDApIHJvdGF0ZSgxODAuMDAwMDAwKSB0cmFuc2xhdGUoLTguMDAwMDAwLCAtOC4wMDAwMDApIHRyYW5zbGF0ZSg0LjAwMDAwMCwgNC4wMDAwMDApIiBzdHJva2U9IiM1NzVFNzUiPgogICAgICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtMy1Db3B5IiBmaWxsPSIjRkZGRkZGIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg1LjUwMDAwMCwgNS41MDAwMDApIHJvdGF0ZSgxODAuMDAwMDAwKSB0cmFuc2xhdGUoLTUuNTAwMDAwLCAtNS41MDAwMDApICIgeD0iMyIgeT0iMyIgd2lkdGg9IjUiIGhlaWdodD0iNSIgcng9IjAuNSI+PC9yZWN0PgogICAgICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtMyIgZmlsbD0iIzU3NUU3NSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMi41MDAwMDAsIDIuNTAwMDAwKSByb3RhdGUoMTgwLjAwMDAwMCkgdHJhbnNsYXRlKC0yLjUwMDAwMCwgLTIuNTAwMDAwKSAiIHg9IjAiIHk9IjAiIHdpZHRoPSI1IiBoZWlnaHQ9IjUiIHJ4PSIwLjUiPjwvcmVjdD4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==",title:i.formatMessage(lp.group),onClick:t.onGroup}),l().createElement(Wc,{disabled:!Q(),hideLabel:Kd(i.locale),imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+dW5ncm91cDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJ1bmdyb3VwIiBzdHJva2Utd2lkdGg9IjAuNzUiPgogICAgICAgICAgICA8ZyBpZD0idW5ncm91cC1pY29uIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMC4wMDAwMDAsIDEwLjAwMDAwMCkgcm90YXRlKDE4MC4wMDAwMDApIHRyYW5zbGF0ZSgtMTAuMDAwMDAwLCAtMTAuMDAwMDAwKSB0cmFuc2xhdGUoMi4wMDAwMDAsIDIuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTMtQ29weSIgc3Ryb2tlPSIjNTc1RTc1IiBmaWxsPSIjRkZGRkZGIiB4PSI2LjUiIHk9IjYuNSIgd2lkdGg9IjgiIGhlaWdodD0iOCIgcng9IjAuNSI+PC9yZWN0PgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS0zIiBzdHJva2U9IiM1NzVFNzUiIGZpbGw9IiM1NzVFNzUiIHg9IjEuNSIgeT0iMS41IiB3aWR0aD0iOCIgaGVpZ2h0PSI4IiByeD0iMC41Ij48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTIiIHN0cm9rZT0iIzg1NUNENiIgZmlsbD0iI0ZGRkZGRiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiB4PSIwIiB5PSIwIiB3aWR0aD0iMyIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTItQ29weS0yIiBzdHJva2U9IiM4NTVDRDYiIGZpbGw9IiNGRkZGRkYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgeD0iOCIgeT0iMCIgd2lkdGg9IjMiIGhlaWdodD0iMyI+PC9yZWN0PgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS0yLUNvcHkiIHN0cm9rZT0iIzg1NUNENiIgZmlsbD0iI0ZGRkZGRiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiB4PSIwIiB5PSI4IiB3aWR0aD0iMyIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTItQ29weS0zIiBzdHJva2U9IiM4NTVDRDYiIGZpbGw9IiNGRkZGRkYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgeD0iOCIgeT0iOCIgd2lkdGg9IjMiIGhlaWdodD0iMyI+PC9yZWN0PgogICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS0yLUNvcHktNCIgc3Ryb2tlPSIjODU1Q0Q2IiBmaWxsPSIjRkZGRkZGIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHg9IjEzIiB5PSI1IiB3aWR0aD0iMyIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTItQ29weS01IiBzdHJva2U9IiM4NTVDRDYiIGZpbGw9IiNGRkZGRkYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgeD0iMTMiIHk9IjEzIiB3aWR0aD0iMyIgaGVpZ2h0PSIzIj48L3JlY3Q+CiAgICAgICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTItQ29weS02IiBzdHJva2U9IiM4NTVDRDYiIGZpbGw9IiNGRkZGRkYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgeD0iNSIgeT0iMTMiIHdpZHRoPSIzIiBoZWlnaHQ9IjMiPjwvcmVjdD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==",title:i.formatMessage(lp.ungroup),onClick:t.onUngroup})):null,A(t.format)?l().createElement(wu,{className:np.modDashedBorder},l().createElement(Wc,{disabled:!md(),hideLabel:Kd(i.locale),imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+c2VuZC1mb3J3YXJkPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9InNlbmQtZm9yd2FyZCI+CiAgICAgICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIuMDAwMDAwLCAzLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTEyLjM0NzY3MzYsNS45MjU0OTcyMyBMMTAuMjQwNzM3Niw1LjkyNTQ5NzIzIEw5LjMzNjAxNjExLDEyLjc2MzU5ODEgQzkuMjM4MDc2MDMsMTMuNTQ3NjY2MSA4LjU0MDI1Mjk1LDE0LjEwMDM2OTggNy43ODEyMTczMiwxMy45ODQ2ODc2IEM3LjE2OTA5MTgxLDEzLjg5NDcxMjYgNi42OTE2MzM5MSwxMy4zODA1Njk3IDYuNjE2OTU0NiwxMi43NjM1OTgxIEw1LjcxMjIzMzEsNS45MjU0OTcyMyBMMy42NTQyNjcxNCw1LjkyNTQ5NzIzIEMzLjA2Nzg1MDksNS45MjU0OTcyMyAyLjc4NTA0ODkyLDUuMTkyODQzNTYgMy4xOTAyNzYsNC43Njg2NzU2NCBMNy41MzUxNDI4NiwwLjE5MjgwMzU5NyBDNy43OTIyMzU1OCwtMC4wNjQyNjc4NjU4IDguMjA5NzA1MTcsLTAuMDY0MjY3ODY1OCA4LjQ1MzMzMTEzLDAuMTkyODAzNTk3IEwxMi44MTI4ODksNC43Njg2NzU2NCBDMTMuMjE2ODkxOCw1LjE5Mjg0MzU2IDEyLjkyMzA3MTYsNS45MjU0OTcyMyAxMi4zNDc2NzM2LDUuOTI1NDk3MjMiIGlkPSJGaWxsLTEiIGZpbGw9IiM4NTVDRDYiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMiw4IEwxNiw4IiBpZD0iU3Ryb2tlLTYiIHN0cm9rZT0iIzU3NUU3NSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48L3BhdGg+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMCw4IEw0LDgiIGlkPSJTdHJva2UtMTAiIHN0cm9rZT0iIzU3NUU3NSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48L3BhdGg+CiAgICAgICAgICAgIDwvZz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPgo=",title:i.formatMessage(lp.forward),onClick:t.onSendForward}),l().createElement(Wc,{disabled:!gd(),hideLabel:Kd(i.locale),imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+c2VuZC1iYWNrd2FyZDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJzZW5kLWJhY2t3YXJkIj4KICAgICAgICAgICAgPGcgaWQ9InNlbmQtZm9yd2FyZCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuMDAwMDAwLCAxMC4wMDAwMDApIHJvdGF0ZSgxODAuMDAwMDAwKSB0cmFuc2xhdGUoLTEwLjAwMDAwMCwgLTEwLjAwMDAwMCkgdHJhbnNsYXRlKDIuMDAwMDAwLCAzLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTEyLjM0NzY3MzYsNS45MjU0OTcyMyBMMTAuMjQwNzM3Niw1LjkyNTQ5NzIzIEw5LjMzNjAxNjExLDEyLjc2MzU5ODEgQzkuMjM4MDc2MDMsMTMuNTQ3NjY2MSA4LjU0MDI1Mjk1LDE0LjEwMDM2OTggNy43ODEyMTczMiwxMy45ODQ2ODc2IEM3LjE2OTA5MTgxLDEzLjg5NDcxMjYgNi42OTE2MzM5MSwxMy4zODA1Njk3IDYuNjE2OTU0NiwxMi43NjM1OTgxIEw1LjcxMjIzMzEsNS45MjU0OTcyMyBMMy42NTQyNjcxNCw1LjkyNTQ5NzIzIEMzLjA2Nzg1MDksNS45MjU0OTcyMyAyLjc4NTA0ODkyLDUuMTkyODQzNTYgMy4xOTAyNzYsNC43Njg2NzU2NCBMNy41MzUxNDI4NiwwLjE5MjgwMzU5NyBDNy43OTIyMzU1OCwtMC4wNjQyNjc4NjU4IDguMjA5NzA1MTcsLTAuMDY0MjY3ODY1OCA4LjQ1MzMzMTEzLDAuMTkyODAzNTk3IEwxMi44MTI4ODksNC43Njg2NzU2NCBDMTMuMjE2ODkxOCw1LjE5Mjg0MzU2IDEyLjkyMzA3MTYsNS45MjU0OTcyMyAxMi4zNDc2NzM2LDUuOTI1NDk3MjMiIGlkPSJGaWxsLTEiIGZpbGw9IiM4NTVDRDYiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMiw4IEwxNiw4IiBpZD0iU3Ryb2tlLTYiIHN0cm9rZT0iIzU3NUU3NSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48L3BhdGg+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMCw4IEw0LDgiIGlkPSJTdHJva2UtMTAiIHN0cm9rZT0iIzU3NUU3NSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48L3BhdGg+CiAgICAgICAgICAgIDwvZz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPgo=",title:i.formatMessage(lp.backward),onClick:t.onSendBackward})):null,A(t.format)?l().createElement(dd(),{minWidth:Jd},l().createElement(wu,{className:np.row},l().createElement(Wc,{disabled:!md(),hideLabel:Kd(i.locale),imgSrc:rp,title:i.formatMessage(lp.front),onClick:t.onSendToFront}),l().createElement(Wc,{disabled:!gd(),hideLabel:Kd(i.locale),imgSrc:ip,title:i.formatMessage(lp.back),onClick:t.onSendToBack}))):null,A(t.format)?l().createElement(dd(),{maxWidth:Jd-1},l().createElement(wu,null,l().createElement(Rd,{className:np.modUnselect,enterExitTransitionDurationMs:20,popoverContent:l().createElement(wu,{className:np.modContextMenu,rtl:t.rtl},l().createElement($i,{className:h()(np.modMenuItem,sp({},np.modDisabled,!md())),disabled:!md(),onClick:t.onSendToFront},l().createElement("img",{className:np.menuItemIcon,draggable:!1,src:rp}),l().createElement("span",null,i.formatMessage(lp.front))),l().createElement($i,{className:h()(np.modMenuItem,sp({},np.modDisabled,!gd())),disabled:!gd(),onClick:t.onSendToBack},l().createElement("img",{className:np.menuItemIcon,draggable:!1,src:ip}),l().createElement("span",null,i.formatMessage(lp.back)))),tipSize:.01},i.formatMessage(lp.more)))):null)};cp.propTypes={canRedo:i().func.isRequired,canUndo:i().func.isRequired,format:i().oneOf(Object.keys(I)),name:i().string,onGroup:i().func.isRequired,onRedo:i().func.isRequired,onSendBackward:i().func.isRequired,onSendForward:i().func.isRequired,onSendToBack:i().func.isRequired,onSendToFront:i().func.isRequired,onUndo:i().func.isRequired,onUngroup:i().func.isRequired,onUpdateName:i().func.isRequired,rtl:i().bool.isRequired};var up=(0,c.connect)(function(t){return{format:t.scratchPaint.format,rtl:t.scratchPaint.layout.rtl,selectedItems:t.scratchPaint.selectedItems,undoState:t.scratchPaint.undo}})(cp),hp="scratch-paint/text-tool/CHANGE_TEXT_EDIT_TARGET",dp=function(t){return{type:hp,textEditTargetId:t||null}},pp="scratch-paint/layout/SET_LAYOUT",fp={rtl:!1},gp=["ltr","rtl"],mp=function(t){return{type:pp,layout:t}};function yp(t){return yp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yp(t)}function vp(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,bp(i.key),i)}}function bp(t){var e=function(t,e){if("object"!=yp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=yp(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==yp(e)?e:e+""}function Ip(t,e,n){return e=Mp(e),function(t,e){if(e&&("object"==yp(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ap()?Reflect.construct(e,n||[],Mp(t).constructor):e.apply(t,n))}function Ap(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ap=function(){return!!t})()}function Mp(t){return Mp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mp(t)}function wp(t,e){return wp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},wp(t,e)}var Cp=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=Ip(this,e,[t]),m()(n,["handleSendBackward","handleSendForward","handleSendToBack","handleSendToFront","handleSetSelectedItems","handleGroup","handleUngroup"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wp(t,e)}(e,t),function(t,e,n){return e&&vp(t.prototype,e),n&&vp(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"handleGroup",value:function(){U(this.props.clearSelectedItems,this.handleSetSelectedItems,this.props.onUpdateImage)}},{key:"handleUngroup",value:function(){Z(this.props.clearSelectedItems,this.handleSetSelectedItems,this.props.onUpdateImage)}},{key:"handleSendBackward",value:function(){!function(t){var e=It();if(0!==e.length&&e[0].previousSibling){var n,i=e[0].previousSibling,r=pd(e);try{for(r.s();!(n=r.n()).done;)n.value.insertBelow(i)}catch(t){r.e(t)}finally{r.f()}t()}}(this.props.onUpdateImage)}},{key:"handleSendForward",value:function(){!function(t){var e=It();if(0!==e.length&&e[e.length-1].nextSibling){for(var n=e[e.length-1].nextSibling,i=e.length-1;i>=0;i--)e[i].insertAbove(n);t()}}(this.props.onUpdateImage)}},{key:"handleSendToBack",value:function(){!function(t){for(var e=It(),n=e.length-1;n>=0;n--)e[n].sendToBack();t()}(this.props.onUpdateImage)}},{key:"handleSendToFront",value:function(){!function(t){var e,n=pd(It());try{for(n.s();!(e=n.n()).done;)e.value.bringToFront()}catch(t){n.e(t)}finally{n.f()}t()}(this.props.onUpdateImage)}},{key:"handleSetSelectedItems",value:function(){this.props.setSelectedItems(this.props.format)}},{key:"render",value:function(){return l().createElement(up,{canRedo:this.props.canRedo,canUndo:this.props.canUndo,name:this.props.name,onGroup:this.handleGroup,onRedo:this.props.onRedo,onSendBackward:this.handleSendBackward,onSendForward:this.handleSendForward,onSendToBack:this.handleSendToBack,onSendToFront:this.handleSendToFront,onUndo:this.props.onUndo,onUngroup:this.handleUngroup,onUpdateImage:this.props.onUpdateImage,onUpdateName:this.props.onUpdateName})}}])}(l().Component);Cp.propTypes={canRedo:i().func.isRequired,canUndo:i().func.isRequired,clearSelectedItems:i().func.isRequired,format:i().oneOf(Object.keys(I)),name:i().string,onRedo:i().func.isRequired,onUndo:i().func.isRequired,onUpdateImage:i().func.isRequired,onUpdateName:i().func.isRequired,setSelectedItems:i().func.isRequired};var Tp=(0,c.connect)(function(t){return{changeColorToEyeDropper:t.scratchPaint.color.eyeDropper.callback,format:t.scratchPaint.format,isEyeDropping:t.scratchPaint.color.eyeDropper.active,mode:t.scratchPaint.mode,pasteOffset:t.scratchPaint.clipboard.pasteOffset,previousTool:t.scratchPaint.color.eyeDropper.previousTool,selectedItems:t.scratchPaint.selectedItems,viewBounds:t.scratchPaint.viewBounds}},function(t){return{changeMode:function(e){t(Zi(e))},clearSelectedItems:function(){t(en())},handleSwitchToBitmap:function(){t(hn(I.BITMAP))},handleSwitchToVector:function(){t(hn(I.VECTOR))},removeTextEditTarget:function(){t(dp())},setLayout:function(e){t(mp(e))},setSelectedItems:function(e){t(tn(At(),M(e)))},onDeactivateEyeDropper:function(){t(no())}}})(Cp),xp=p(687),Sp=p.n(xp);function Dp(t){return Dp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dp(t)}function Np(){return Np=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Np.apply(null,arguments)}function _p(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ep(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ep(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Ep(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function jp(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,kp(i.key),i)}}function kp(t){var e=function(t,e){if("object"!=Dp(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Dp(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Dp(e)?e:e+""}function Op(t,e,n){return e=Lp(e),function(t,e){if(e&&("object"==Dp(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,zp()?Reflect.construct(e,n||[],Lp(t).constructor):e.apply(t,n))}function zp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(zp=function(){return!!t})()}function Lp(t){return Lp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Lp(t)}function Bp(t,e){return Bp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Bp(t,e)}var Pp=function(t){var n=function(n){function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=Op(this,i,[t]),m()(e,["handleCopy","handlePaste"]),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Bp(t,e)}(i,n),function(t,e,n){return e&&jp(t.prototype,e),n&&jp(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(i,[{key:"handleCopy",value:function(){var t=[];if(this.props.mode===E.RESHAPE){var n,i=_p(At());try{for(i.s();!(n=i.n()).done;){var r=n.value;r.parent&&r.parent instanceof e().CompoundPath?t.push(r.parent):t.push(r)}}catch(t){i.e(t)}finally{i.f()}}else t=It();if(0===t.length)if(M(this.props.format)){var o=Ht(!1);if(!o)return;t.push(o)}else t=dt();for(var s=[],a=0;a<t.length;a++){var l=t[a].exportJSON({asString:!1});s.push(l)}this.props.setClipboardItems(s)}},{key:"handlePaste",value:function(){if(bt(this.props.clearSelectedItems),0!==this.props.clipboardItems.length){for(var t=[],n=0;n<this.props.clipboardItems.length;n++){var i=e().Base.importJSON(this.props.clipboardItems[n]);i&&t.push(i)}if(t.length){if(M(this.props.format)&&!(1===t.length&&t[0]instanceof e().Raster)){var r=new(e().Group)(t);t=[r.rasterize()],r.remove()}for(var o=0,s=t;o<s.length;o++){var a=s[o],l=e().project.getActiveLayer().addChild(a);l.selected=!0,l.position.x+=10*this.props.pasteOffset,l.position.y+=10*this.props.pasteOffset}this.props.incrementPasteOffset(),this.props.setSelectedItems(this.props.format),this.props.onUpdateImage()}}}},{key:"render",value:function(){var e=Sp()(this.props,["clearSelectedItems","clipboardItems","format","incrementPasteOffset","mode","pasteOffset","setClipboardItems","setSelectedItems"]);return l().createElement(t,Np({onCopyToClipboard:this.handleCopy,onPasteFromClipboard:this.handlePaste},e))}}])}(l().Component);n.propTypes={clearSelectedItems:i().func.isRequired,clipboardItems:i().arrayOf(i().array),format:i().oneOf(Object.keys(I)),incrementPasteOffset:i().func.isRequired,mode:i().oneOf(Object.keys(E)),onUpdateImage:i().func.isRequired,pasteOffset:i().number,setClipboardItems:i().func.isRequired,setSelectedItems:i().func.isRequired};return(0,c.connect)(function(t){return{clipboardItems:t.scratchPaint.clipboard.items,format:t.scratchPaint.format,mode:t.scratchPaint.mode,pasteOffset:t.scratchPaint.clipboard.pasteOffset}},function(t){return{setClipboardItems:function(e){t({type:sn,clipboardItems:e})},incrementPasteOffset:function(){t({type:an})},clearSelectedItems:function(){t(en())},setSelectedItems:function(e){t(tn(At(),M(e)))}}})(n)},Rp="scratch-paint/brush-mode/CHANGE_BRUSH_SIZE",Up={brushSize:10},Gp="scratch-paint/brush-mode/CHANGE_BIT_BRUSH_SIZE",Yp="scratch-paint/eraser-mode/CHANGE_BIT_ERASER_SIZE",Zp="scratch-paint/fill-bitmap-shapes/SET_FILLED",Wp=function(t){return{type:Zp,filled:t}},Qp={SANS_SERIF:"Sans Serif",SERIF:"Serif",HANDWRITING:"Handwriting",MARKER:"Marker",CURLY:"Curly",PIXEL:"Pixel",CHINESE:'"Microsoft YaHei", "微软雅黑", STXihei, "华文细黑"',JAPANESE:'"ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka, "メイリオ", Meiryo, "MS Pゴシック", "MS PGothic"',KOREAN:"Malgun Gothic"},Hp=p(241),Fp=p.n(Hp),Vp={};Vp.styleTagTransform=En(),Vp.setAttributes=Sn(),Vp.insert=Tn().bind(null,"head"),Vp.domAPI=wn(),Vp.insertStyleElement=Nn();An()(Fp(),Vp);var qp=Fp()&&Fp().locals?Fp().locals:void 0,Jp=function(t){return l().createElement(Rd,{className:h()(qp.modUnselect,qp.fontDropdown),enterExitTransitionDurationMs:60,popoverContent:l().createElement(wu,{className:qp.modContextMenu},l().createElement($i,{className:h()(qp.modMenuItem),onClick:t.onChoose,onMouseOver:t.onHoverSansSerif},l().createElement("span",{className:qp.sansSerif},t.getFontName(Qp.SANS_SERIF))),l().createElement($i,{className:h()(qp.modMenuItem),onClick:t.onChoose,onMouseOver:t.onHoverSerif},l().createElement("span",{className:qp.serif},t.getFontName(Qp.SERIF))),l().createElement($i,{className:h()(qp.modMenuItem),onClick:t.onChoose,onMouseOver:t.onHoverHandwriting},l().createElement("span",{className:qp.handwriting},t.getFontName(Qp.HANDWRITING))),l().createElement($i,{className:h()(qp.modMenuItem),onClick:t.onChoose,onMouseOver:t.onHoverMarker},l().createElement("span",{className:qp.marker},t.getFontName(Qp.MARKER))),l().createElement($i,{className:h()(qp.modMenuItem),onClick:t.onChoose,onMouseOver:t.onHoverCurly},l().createElement("span",{className:qp.curly},t.getFontName(Qp.CURLY))),l().createElement($i,{className:h()(qp.modMenuItem),onClick:t.onChoose,onMouseOver:t.onHoverPixel},l().createElement("span",{className:qp.pixel},t.getFontName(Qp.PIXEL))),l().createElement($i,{className:h()(qp.modMenuItem),onClick:t.onChoose,onMouseOver:t.onHoverChinese},l().createElement("span",{className:qp.chinese},t.getFontName(Qp.CHINESE))),l().createElement($i,{className:h()(qp.modMenuItem),onClick:t.onChoose,onMouseOver:t.onHoverJapanese},l().createElement("span",{className:qp.japanese},t.getFontName(Qp.JAPANESE))),l().createElement($i,{className:h()(qp.modMenuItem),onClick:t.onChoose,onMouseOver:t.onHoverKorean},l().createElement("span",{className:qp.korean},t.getFontName(Qp.KOREAN)))),ref:t.componentRef,tipSize:.01,onOpen:t.onOpenDropdown,onOuterAction:t.onClickOutsideDropdown},l().createElement("span",{className:h()(t.getFontStyle(t.font),qp.displayedFontName)},t.getFontName(t.font)))};Jp.propTypes={componentRef:i().func.isRequired,font:i().string,getFontName:i().func.isRequired,getFontStyle:i().func.isRequired,onChoose:i().func.isRequired,onClickOutsideDropdown:i().func,onHoverChinese:i().func,onHoverCurly:i().func,onHoverHandwriting:i().func,onHoverJapanese:i().func,onHoverKorean:i().func,onHoverMarker:i().func,onHoverPixel:i().func,onHoverSansSerif:i().func,onHoverSerif:i().func,onOpenDropdown:i().func};var Xp=Jp,Kp="scratch-paint/fonts/CHANGE_FONT",$p=Qp.SANS_SERIF,tf=function(t){return{type:Kp,font:t}};function ef(t){return ef="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ef(t)}function nf(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return rf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function rf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function of(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,sf(i.key),i)}}function sf(t){var e=function(t,e){if("object"!=ef(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=ef(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ef(e)?e:e+""}function af(t,e,n){return e=cf(e),function(t,e){if(e&&("object"==ef(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,lf()?Reflect.construct(e,n||[],cf(t).constructor):e.apply(t,n))}function lf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(lf=function(){return!!t})()}function cf(t){return cf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},cf(t)}function uf(t,e){return uf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},uf(t,e)}var hf=function(t){function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e=af(this,n,[t]),m()(e,["getFontStyle","getFontName","handleChangeFontSerif","handleChangeFontSansSerif","handleChangeFontHandwriting","handleChangeFontMarker","handleChangeFontCurly","handleChangeFontPixel","handleChangeFontChinese","handleChangeFontJapanese","handleChangeFontKorean","handleOpenDropdown","handleClickOutsideDropdown","setDropdown","handleChoose"]),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&uf(t,e)}(n,t),function(t,e,n){return e&&of(t.prototype,e),n&&of(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"getFontStyle",value:function(t){switch(t){case Qp.SERIF:return qp.serif;case Qp.SANS_SERIF:return qp.sansSerif;case Qp.HANDWRITING:return qp.handwriting;case Qp.MARKER:return qp.marker;case Qp.CURLY:return qp.curly;case Qp.PIXEL:return qp.pixel;case Qp.CHINESE:return qp.chinese;case Qp.JAPANESE:return qp.japanese;case Qp.KOREAN:return qp.korean;default:return""}}},{key:"getFontName",value:function(t){switch(t){case Qp.CHINESE:return"中文";case Qp.KOREAN:return"한국어";case Qp.JAPANESE:return"日本語";default:return t}}},{key:"handleChangeFontSansSerif",value:function(){this.dropDown.isOpen()&&this.props.changeFont(Qp.SANS_SERIF)}},{key:"handleChangeFontSerif",value:function(){this.dropDown.isOpen()&&this.props.changeFont(Qp.SERIF)}},{key:"handleChangeFontHandwriting",value:function(){this.dropDown.isOpen()&&this.props.changeFont(Qp.HANDWRITING)}},{key:"handleChangeFontMarker",value:function(){this.dropDown.isOpen()&&this.props.changeFont(Qp.MARKER)}},{key:"handleChangeFontCurly",value:function(){this.dropDown.isOpen()&&this.props.changeFont(Qp.CURLY)}},{key:"handleChangeFontPixel",value:function(){this.dropDown.isOpen()&&this.props.changeFont(Qp.PIXEL)}},{key:"handleChangeFontChinese",value:function(){this.dropDown.isOpen()&&this.props.changeFont(Qp.CHINESE)}},{key:"handleChangeFontJapanese",value:function(){this.dropDown.isOpen()&&this.props.changeFont(Qp.JAPANESE)}},{key:"handleChangeFontKorean",value:function(){this.dropDown.isOpen()&&this.props.changeFont(Qp.KOREAN)}},{key:"handleChoose",value:function(){this.dropDown.isOpen()&&(this.dropDown.handleClosePopover(),this.props.onUpdateImage())}},{key:"handleOpenDropdown",value:function(){this.savedFont=this.props.font,this.savedSelection=At()}},{key:"handleClickOutsideDropdown",value:function(t){t.stopPropagation(),this.dropDown.handleClosePopover();var n,i=nf(this.savedSelection);try{for(i.s();!(n=i.n()).done;){var r=n.value;r instanceof e().PointText&&(r.font=this.savedFont)}}catch(t){i.e(t)}finally{i.f()}this.props.changeFont(this.savedFont),this.savedFont=null,this.savedSelection=null}},{key:"setDropdown",value:function(t){this.dropDown=t}},{key:"render",value:function(){return l().createElement(Xp,{componentRef:this.setDropdown,font:this.props.font,getFontName:this.getFontName,getFontStyle:this.getFontStyle,onChoose:this.handleChoose,onClickOutsideDropdown:this.handleClickOutsideDropdown,onHoverChinese:this.handleChangeFontChinese,onHoverCurly:this.handleChangeFontCurly,onHoverHandwriting:this.handleChangeFontHandwriting,onHoverJapanese:this.handleChangeFontJapanese,onHoverKorean:this.handleChangeFontKorean,onHoverMarker:this.handleChangeFontMarker,onHoverPixel:this.handleChangeFontPixel,onHoverSansSerif:this.handleChangeFontSansSerif,onHoverSerif:this.handleChangeFontSerif,onOpenDropdown:this.handleOpenDropdown})}}])}(l().Component);hf.propTypes={changeFont:i().func.isRequired,font:i().string,onUpdateImage:i().func.isRequired};var df=(0,c.connect)(function(t){return{font:t.scratchPaint.font}},function(t){return{changeFont:function(e){t(tf(e))}}})(hf);function pf(t){return pf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pf(t)}function ff(){return ff=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},ff.apply(null,arguments)}function gf(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,mf(i.key),i)}}function mf(t){var e=function(t,e){if("object"!=pf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=pf(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==pf(e)?e:e+""}function yf(t,e,n){return e=bf(e),function(t,e){if(e&&("object"==pf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,vf()?Reflect.construct(e,n||[],bf(t).constructor):e.apply(t,n))}function vf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(vf=function(){return!!t})()}function bf(t){return bf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bf(t)}function If(t,e){return If=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},If(t,e)}function Af(t){var e=function(e){function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e=yf(this,n,[t]),m()(e,["handleChange","handleKeyPress","handleFlush"]),e.state={value:null},e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&If(t,e)}(n,e),function(t,e,n){return e&&gf(t.prototype,e),n&&gf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"handleKeyPress",value:function(t){"Enter"===t.key&&(this.handleChange(t),t.target.blur())}},{key:"handleFlush",value:function(){this.setState({value:null})}},{key:"handleChange",value:function(t){var e=!("number"==typeof this.props.value)||!isNaN(t.target.value);if(null!==t.target.value&&e){var n=Number(t.target.value);void 0!==this.props.max&&n>Number(this.props.max)&&(n=this.props.max),void 0!==this.props.min&&n<Number(this.props.min)&&(n=this.props.min),this.props.onSubmit(n)}this.setState({value:t.target.value})}},{key:"render",value:function(){var e=null===this.state.value?this.props.value:this.state.value;return l().createElement(t,ff({},this.props,{value:e,onBlur:this.handleFlush,onChange:this.handleChange,onKeyPress:this.handleKeyPress}))}}])}(l().Component);return e.propTypes={max:i().oneOfType([i().number,i().string]),min:i().oneOfType([i().number,i().string]),onSubmit:i().func.isRequired,value:i().oneOfType([i().string,i().number])},e}var Mf=p(761),wf=p.n(Mf),Cf={};Cf.styleTagTransform=En(),Cf.setAttributes=Sn(),Cf.insert=Tn().bind(null,"head"),Cf.domAPI=wn(),Cf.insertStyleElement=Nn();An()(wf(),Cf);var Tf=wf()&&wf().locals?wf().locals:void 0,xf="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUwLjIgKDU1MDQ3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5kZWxldGU8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iZGVsZXRlIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iRGVsZXRlLUljb24iIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIuMDAwMDAwLCAxLjUwMDAwMCkiIGZpbGw9IiM4NTVDRDYiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0yLDMuMjUgTDE0LDMuMjUgQzE0LjQ0MzcxNjQsMy4yNSAxNC43OTA0MjkzLDMuNjMzMTEzNDMgMTQuNzQ2Mjc3OSw0LjA3NDYyNzc5IEwxMy42MzYzMjc1LDE1LjE3NDEzMTUgQzEzLjU0Njg2NzIsMTYuMDY4NzM0NyAxMi43OTQwNzc1LDE2Ljc1IDExLjg5NTAxMjQsMTYuNzUgTDQuMTA0OTg3NTYsMTYuNzUgQzMuMjA1OTIyNTMsMTYuNzUgMi40NTMxMzI3OSwxNi4wNjg3MzQ3IDIuMzYzNjcyNDgsMTUuMTc0MTMxNSBMMS4yNTM3MjIxMSw0LjA3NDYyNzc5IEMxLjIwOTU3MDY3LDMuNjMzMTEzNDMgMS41NTYyODM1NiwzLjI1IDIsMy4yNSBaIE04Ljc1LDEyIEw4Ljc1LDcgQzguNzUsNi41ODU3ODY0NCA4LjQxNDIxMzU2LDYuMjUgOCw2LjI1IEM3LjU4NTc4NjQ0LDYuMjUgNy4yNSw2LjU4NTc4NjQ0IDcuMjUsNyBMNy4yNSwxMiBDNy4yNSwxMi40MTQyMTM2IDcuNTg1Nzg2NDQsMTIuNzUgOCwxMi43NSBDOC40MTQyMTM1NiwxMi43NSA4Ljc1LDEyLjQxNDIxMzYgOC43NSwxMiBaIE0xMS4yNSwxMiBMMTEuMjUsNyBDMTEuMjUsNi41ODU3ODY0NCAxMC45MTQyMTM2LDYuMjUgMTAuNSw2LjI1IEMxMC4wODU3ODY0LDYuMjUgOS43NSw2LjU4NTc4NjQ0IDkuNzUsNyBMOS43NSwxMiBDOS43NSwxMi40MTQyMTM2IDEwLjA4NTc4NjQsMTIuNzUgMTAuNSwxMi43NSBDMTAuOTE0MjEzNiwxMi43NSAxMS4yNSwxMi40MTQyMTM2IDExLjI1LDEyIFogTTYuMjUsMTIgTDYuMjUsNyBDNi4yNSw2LjU4NTc4NjQ0IDUuOTE0MjEzNTYsNi4yNSA1LjUsNi4yNSBDNS4wODU3ODY0NCw2LjI1IDQuNzUsNi41ODU3ODY0NCA0Ljc1LDcgTDQuNzUsMTIgQzQuNzUsMTIuNDE0MjEzNiA1LjA4NTc4NjQ0LDEyLjc1IDUuNSwxMi43NSBDNS45MTQyMTM1NiwxMi43NSA2LjI1LDEyLjQxNDIxMzYgNi4yNSwxMiBaIE0xLjUsNCBMMTQuNSw0IEwxLjUsNCBaIE0xLjUsMyBMMTQuNSwzIEMxNS4wNTIyODQ3LDMgMTUuNSwzLjQ0NzcxNTI1IDE1LjUsNCBDMTUuNSw0LjU1MjI4NDc1IDE1LjA1MjI4NDcsNSAxNC41LDUgTDEuNSw1IEMwLjk0NzcxNTI1LDUgMC41LDQuNTUyMjg0NzUgMC41LDQgQzAuNSwzLjQ0NzcxNTI1IDAuOTQ3NzE1MjUsMyAxLjUsMyBaIE05LjI1LDMuMjUgTDkuMjUsMiBDOS4yNSwxLjg2MTkyODgxIDkuMTM4MDcxMTksMS43NSA5LDEuNzUgTDcsMS43NSBDNi44NjE5Mjg4MSwxLjc1IDYuNzUsMS44NjE5Mjg4MSA2Ljc1LDIgTDYuNzUsMy4yNSBMOS4yNSwzLjI1IFogTTcsMC4yNSBMOSwwLjI1IEM5Ljk2NjQ5ODMxLDAuMjUgMTAuNzUsMS4wMzM1MDE2OSAxMC43NSwyIEwxMC43NSw0Ljc1IEw1LjI1LDQuNzUgTDUuMjUsMiBDNS4yNSwxLjAzMzUwMTY5IDYuMDMzNTAxNjksMC4yNSA3LDAuMjUgWiIgaWQ9IkNvbWJpbmVkLVNoYXBlIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4K",Sf=Af(qd),Df=function(t){var e=(0,d.useIntl)(),n=(0,d.defineMessages)({brushSize:{id:"paint.modeTools.brushSize",defaultMessage:"Size"},eraserSize:{id:"paint.modeTools.eraserSize",defaultMessage:"Eraser size"},copy:{id:"paint.modeTools.copy",defaultMessage:"Copy"},paste:{id:"paint.modeTools.paste",defaultMessage:"Paste"},delete:{id:"paint.modeTools.delete",defaultMessage:"Delete"},curved:{id:"paint.modeTools.curved",defaultMessage:"Curved"},pointed:{id:"paint.modeTools.pointed",defaultMessage:"Pointed"},thickness:{id:"paint.modeTools.thickness",defaultMessage:"Thickness"},flipHorizontal:{id:"paint.modeTools.flipHorizontal",defaultMessage:"Flip Horizontal"},flipVertical:{id:"paint.modeTools.flipVertical",defaultMessage:"Flip Vertical"},filled:{id:"paint.modeTools.filled",defaultMessage:"Filled"},outlined:{id:"paint.modeTools.outlined",defaultMessage:"Outlined"}});switch(t.mode){case E.BRUSH:case E.BIT_BRUSH:case E.BIT_LINE:var i=A(t.format)?yl:t.mode===E.BIT_LINE?_r:cr,r=M(t.format)?t.bitBrushSize:t.brushValue,o=M(t.format)?t.onBitBrushSliderChange:t.onBrushSliderChange,s=t.mode===E.BIT_LINE?n.thickness:n.brushSize;return l().createElement("div",{className:h()(t.className,Tf.modeTools)},l().createElement("div",null,l().createElement("img",{alt:e.formatMessage(s),className:Tf.modeToolsIcon,draggable:!1,src:i})),l().createElement(Sf,{range:!0,small:!0,max:gh,min:"1",type:"number",value:r,onSubmit:o}));case E.BIT_ERASER:case E.ERASER:var a=A(t.format)?zl:Vs,c=M(t.format)?t.bitEraserSize:t.eraserValue,u=M(t.format)?t.onBitEraserSliderChange:t.onEraserSliderChange;return l().createElement("div",{className:h()(t.className,Tf.modeTools)},l().createElement("div",null,l().createElement("img",{alt:e.formatMessage(n.eraserSize),className:Tf.modeToolsIcon,draggable:!1,src:a})),l().createElement(Sf,{range:!0,small:!0,max:gh,min:"1",type:"number",value:c,onSubmit:u}));case E.RESHAPE:return l().createElement("div",{className:h()(t.className,Tf.modeTools)},l().createElement(wu,{className:h()(Tf.modDashedBorder,Tf.modLabeledIconHeight)},l().createElement(Wc,{disabled:!t.hasSelectedUncurvedPoints,hideLabel:Kd(e.locale),imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+Y3VydmVkLXBvaW50PC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9ImN1cnZlZC1wb2ludCI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0yLDE1IEMyLDEwLjU4MTg0NTIgNS41ODE1MTIxNCw3IDEwLjAwMDc0NCw3IEMxNC40MTg0ODc5LDcgMTgsMTAuNTgxODQ1MiAxOCwxNSIgaWQ9IlN0cm9rZS0zIiBzdHJva2U9IiM4NTVDRDYiIHN0cm9rZS13aWR0aD0iMC43NSIgZmlsbC1vcGFjaXR5PSIwLjI1IiBmaWxsPSIjODU1Q0Q2IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjwvcGF0aD4KICAgICAgICAgICAgPHBhdGggZD0iTTMsNyBMMTcsNyIgaWQ9IlN0cm9rZS03IiBzdHJva2U9IiM4NTVDRDYiIHN0cm9rZS13aWR0aD0iMC43NSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48L3BhdGg+CiAgICAgICAgICAgIDxjaXJjbGUgaWQ9Ik92YWwtNCIgZmlsbC1vcGFjaXR5PSIwLjI1IiBmaWxsPSIjODU1Q0Q2IiBjeD0iMTAiIGN5PSI3IiByPSIzIj48L2NpcmNsZT4KICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbC00IiBmaWxsPSIjODU1Q0Q2IiBjeD0iMTAiIGN5PSI3IiByPSIyIj48L2NpcmNsZT4KICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbC01IiBmaWxsPSIjODU1Q0Q2IiBjeD0iMyIgY3k9IjciIHI9IjEiPjwvY2lyY2xlPgogICAgICAgICAgICA8Y2lyY2xlIGlkPSJPdmFsLTUtQ29weSIgZmlsbD0iIzg1NUNENiIgY3g9IjE3IiBjeT0iNyIgcj0iMSI+PC9jaXJjbGU+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4K",title:e.formatMessage(n.curved),onClick:t.onCurvePoints}),l().createElement(Wc,{disabled:!t.hasSelectedUnpointedPoints,hideLabel:Kd(e.locale),imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+c3RyYWlnaHQtcG9pbnQ8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0ic3RyYWlnaHQtcG9pbnQiIGZpbGw9IiM4NTVDRDYiPgogICAgICAgICAgICA8cG9seWxpbmUgaWQ9IlBhdGgtMiIgc3Ryb2tlPSIjODU1Q0Q2IiBzdHJva2Utd2lkdGg9IjAuNzUiIGZpbGwtb3BhY2l0eT0iMC4yNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBwb2ludHM9IjIgMTUgMTAgNyAxOCAxNSI+PC9wb2x5bGluZT4KICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbC00IiBmaWxsLW9wYWNpdHk9IjAuMjUiIGN4PSIxMCIgY3k9IjciIHI9IjMiPjwvY2lyY2xlPgogICAgICAgICAgICA8Y2lyY2xlIGlkPSJPdmFsLTQiIGN4PSIxMCIgY3k9IjciIHI9IjIiPjwvY2lyY2xlPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==",title:e.formatMessage(n.pointed),onClick:t.onPointPoints})),l().createElement(wu,{className:h()(Tf.modLabeledIconHeight)},l().createElement(Wc,{hideLabel:Kd(e.locale),imgSrc:xf,title:e.formatMessage(n.delete),onClick:t.onDelete})));case E.BIT_SELECT:case E.SELECT:return l().createElement("div",{className:h()(t.className,Tf.modeTools)},l().createElement(wu,{className:h()(Tf.modDashedBorder,Tf.modLabeledIconHeight)},l().createElement(Wc,{hideLabel:Kd(e.locale),imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0OC4yICg0NzMyNykgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+Y29weSB2MjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJjb3B5LXYyIj4KICAgICAgICAgICAgPGcgaWQ9ImNvcHkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDMuMDAwMDAwLCAyLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHBvbHlsaW5lIGlkPSJQYXRoLTMiIHN0cm9rZS1vcGFjaXR5PSIwLjUiIHN0cm9rZT0iIzU3NUU3NSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2UtZGFzaGFycmF5PSIxLDIiIHBvaW50cz0iMC41MDMxNzM4MjggMyAwLjUwMzE3MzgyOCAxNS41IDEzIDE1LjUiPjwvcG9seWxpbmU+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMiwxLjAwNjg0NTQ3IEMyLDAuNDUwNzgwMDczIDIuNDUzMDM2MzEsMCAyLjk5NzAzMDE0LDAgTDEwLDAgTDEwLDIuMzQ5OTUzMTcgQzEwLDMuMjYxMjQ4ODcgMTAuNzMzNjYxNyw0IDExLjY1MDA0NjgsNCBMMTQsNCBMMTQsMTMuMDA0NjAyNCBDMTQsMTMuNTU0MzQ1MyAxMy41NDQyMzksMTQgMTIuOTk3NTI2NywxNCBMMy4wMDI0NzMyOSwxNCBDMi40NDg4MjI1OCwxNCAyLDEzLjU1MDA1MTIgMiwxMi45OTMxNTQ1IEwyLDEuMDA2ODQ1NDcgWiIgaWQ9IlJlY3RhbmdsZS00IiBmaWxsPSIjODU1Q0Q2Ij48L3BhdGg+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTEsMCBMMTQsMyBMMTEuOTk4OTU2NiwzIEMxMS40NDcyNDgxLDMgMTEsMi41NTczMzk2NyAxMSwyLjAwMTA0MzQ0IEwxMSwwIFoiIGlkPSJSZWN0YW5nbGUtNSIgZmlsbD0iIzg1NUNENiI+PC9wYXRoPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTkuODExNTk0Miw5LjE4ODQwNTggTDguNjg4NDA1OCw5LjE4ODQwNTggTDguNjg4NDA1OCwxMC4zMTE1OTQyIEM4LjY4ODQwNTgsMTAuNjg1OTkwMyA4LjM4NjQ3MzQzLDExIDgsMTEgQzcuNjEzNTI2NTcsMTEgNy4zMTE1OTQyLDEwLjY4NTk5MDMgNy4zMTE1OTQyLDEwLjMxMTU5NDIgTDcuMzExNTk0Miw5LjE4ODQwNTggTDYuMTg4NDA1OCw5LjE4ODQwNTggQzUuODE0MDA5NjYsOS4xODg0MDU4IDUuNSw4Ljg4NjQ3MzQzIDUuNSw4LjUgQzUuNSw4LjExMzUyNjU3IDUuODE0MDA5NjYsNy44MTE1OTQyIDYuMTg4NDA1OCw3LjgxMTU5NDIgTDcuMzExNTk0Miw3LjgxMTU5NDIgTDcuMzExNTk0Miw2LjY4ODQwNTggQzcuMzExNTk0Miw2LjMxMjgwMTkzIDcuNjEzNTI2NTcsNiA4LDYgQzguMzg2NDczNDMsNiA4LjY4ODQwNTgsNi4zMTI4MDE5MyA4LjY4ODQwNTgsNi42ODg0MDU4IEw4LjY4ODQwNTgsNy44MTE1OTQyIEw5LjgxMTU5NDIsNy44MTE1OTQyIEMxMC4xODU5OTAzLDcuODExNTk0MiAxMC41LDguMTEzNTI2NTcgMTAuNSw4LjUgQzEwLjUsOC44ODY0NzM0MyAxMC4xODU5OTAzLDkuMTg4NDA1OCA5LjgxMTU5NDIsOS4xODg0MDU4IFoiIGlkPSJGaWxsLTEiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLXdpZHRoPSIwLjI1IiBmaWxsPSIjRkZGRkZGIj48L3BhdGg+CiAgICAgICAgICAgIDwvZz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPgo=",title:e.formatMessage(n.copy),onClick:t.onCopyToClipboard}),l().createElement(Wc,{disabled:!(t.clipboardItems.length>0),hideLabel:Kd(e.locale),imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0OC4yICg0NzMyNykgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+cGFzdGUgdjI8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0icGFzdGUtdjIiPgogICAgICAgICAgICA8ZyBpZD0icGFzdGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDMuMDAwMDAwLCAyLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPHBvbHlsaW5lIGlkPSJQYXRoLTMiIHN0cm9rZS1vcGFjaXR5PSIwLjUiIHN0cm9rZT0iIzU3NUU3NSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2UtZGFzaGFycmF5PSIxLDIiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDYuNzQ4NDEzLCA2Ljc1MDAwMCkgc2NhbGUoMSwgLTEpIHRyYW5zbGF0ZSgtNi43NDg0MTMsIC02Ljc1MDAwMCkgIiBwb2ludHM9IjAuNSAwLjUgMC41IDEzIDEyLjk5NjgyNjIgMTMiPjwvcG9seWxpbmU+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMiwzLjAwNjg0NTQ3IEMyLDIuNDUwNzgwMDcgMi40NTMwMzYzMSwyIDIuOTk3MDMwMTQsMiBMMTAsMiBMMTAsNC4zNDk5NTMxNyBDMTAsNS4yNjEyNDg4NyAxMC43MzM2NjE3LDYgMTEuNjUwMDQ2OCw2IEwxNCw2IEwxNCwxNS4wMDQ2MDI0IEMxNCwxNS41NTQzNDUzIDEzLjU0NDIzOSwxNiAxMi45OTc1MjY3LDE2IEwzLjAwMjQ3MzI5LDE2IEMyLjQ0ODgyMjU4LDE2IDIsMTUuNTUwMDUxMiAyLDE0Ljk5MzE1NDUgTDIsMy4wMDY4NDU0NyBaIiBpZD0iUmVjdGFuZ2xlLTQiIGZpbGw9IiM4NTVDRDYiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMSwyIEwxNCw1IEwxMS45OTg5NTY2LDUgQzExLjQ0NzI0ODEsNSAxMSw0LjU1NzMzOTY3IDExLDQuMDAxMDQzNDQgTDExLDIgWiIgaWQ9IlJlY3RhbmdsZS01IiBmaWxsPSIjODU1Q0Q2Ij48L3BhdGg+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNOC4zNDc5MTgzMywxMi44NzcxODg1IEM4LjI2MTgwNjY4LDEyLjk2MzMwMDEgOC4xNDY5OTExMywxMy4wMDYzNTU5IDguMDMyMTc1NTksMTMuMDA2MzU1OSBDNy45MDMwMDgxLDEzLjAwNjM1NTkgNy43ODgxOTI1NiwxMi45NjMzMDAxIDcuNzAyMDgwOTEsMTIuODc3MTg4NSBMNS44NjUwMzIyMiwxMS4wNDAxMzk4IEM1LjczNTg2NDc0LDEwLjg5NjYyMDMgNS42OTI4MDg5MSwxMC43MTAwNDUxIDUuNzY0NTY4NjIsMTAuNTM3ODIxOCBDNS44MzYzMjgzNCwxMC4zNjU1OTg1IDUuOTk0MTk5NzEsMTAuMjY1MTM0OSA2LjE4MDc3NDk3LDEwLjI2NTEzNDkgTDYuOTI3MDc1OTksMTAuMjY1MTM0OSBMNy4yODU4NzQ1Niw3LjY2NzQzMzIxIEM3LjMxNDU3ODQ1LDcuNDY2NTA2MDEgNy40MTUwNDIwNSw3LjI3OTkzMDc1IDcuNTcyOTEzNDIsNy4xNjUxMTUyMSBDNy43MzA3ODQ3OSw3LjAzNTk0NzczIDcuOTQ2MDYzOTMsNi45Nzg1Mzk5NSA4LjEzMjYzOTE5LDcuMDA3MjQzODQgQzguNDc3MDg1ODIsNy4wNjMyMTY0MiA4Ljc0OTc3MjczLDcuMzM3MzM4NTIgOC43OTI4Mjg1Niw3LjY2NzQzMzIxIEw5LjE2NTk3OTA3LDEwLjI2NTEzNDkgTDkuODY5MjI0MjcsMTAuMjY1MTM0OSBDMTAuMDU1Nzk5NSwxMC4yNjUxMzQ5IDEwLjIxMzY3MDksMTAuMzc5OTUwNCAxMC4yODU0MzA2LDEwLjU1MjE3MzcgQzEwLjM1NzE5MDMsMTAuNzEwMDQ1MSAxMC4zMTQxMzQ1LDEwLjkxMDk3MjMgMTAuMTg0OTY3LDExLjA0MDEzOTggTDguMzQ3OTE4MzMsMTIuODc3MTg4NSBaIiBpZD0iRmlsbC0xIiBmaWxsPSIjRkZGRkZGIj48L3BhdGg+CiAgICAgICAgICAgIDwvZz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPgo=",title:e.formatMessage(n.paste),onClick:t.onPasteFromClipboard})),l().createElement(wu,{className:h()(Tf.modDashedBorder,Tf.modLabeledIconHeight)},l().createElement(Wc,{hideLabel:Kd(e.locale),imgSrc:xf,title:e.formatMessage(n.delete),onClick:t.onDelete})),l().createElement(wu,{className:h()(Tf.modLabeledIconHeight)},l().createElement(Wc,{hideLabel:"en"!==e.locale,imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+ZmxpcC1ob3Jpem9udGFsPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9ImZsaXAtaG9yaXpvbnRhbCI+CiAgICAgICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIuMDAwMDAwLCAzLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbCIgZmlsbD0iIzU3NUU3NSIgb3BhY2l0eT0iMC41IiBjeD0iOCIgY3k9IjAuNzUiIHI9IjEiPjwvY2lyY2xlPgogICAgICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbCIgZmlsbD0iIzU3NUU3NSIgb3BhY2l0eT0iMC41IiBjeD0iOCIgY3k9IjEzLjI1IiByPSIxIj48L2NpcmNsZT4KICAgICAgICAgICAgICAgIDxjaXJjbGUgaWQ9Ik92YWwtQ29weSIgZmlsbD0iIzU3NUU3NSIgb3BhY2l0eT0iMC41IiBjeD0iOCIgY3k9IjMuODc1IiByPSIxIj48L2NpcmNsZT4KICAgICAgICAgICAgICAgIDxjaXJjbGUgaWQ9Ik92YWwtQ29weS0yIiBmaWxsPSIjNTc1RTc1IiBvcGFjaXR5PSIwLjUiIGN4PSI4IiBjeT0iNyIgcj0iMSI+PC9jaXJjbGU+CiAgICAgICAgICAgICAgICA8Y2lyY2xlIGlkPSJPdmFsLUNvcHktMyIgZmlsbD0iIzU3NUU3NSIgb3BhY2l0eT0iMC41IiBjeD0iOCIgY3k9IjEwLjEyNSIgcj0iMSI+PC9jaXJjbGU+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTYsMy4wODQyNTQyMyBMMTYsMTAuOTE1NzQ1OCBDMTYsMTEuNDM0MjYyNiAxNS4yNTc0NDkxLDExLjY5NTY5OTYgMTQuODIzNTc5OCwxMS4zMjgyMzUzIEwxMC4yMDE5MjkzLDcuNDExMDM3MTEgQzkuOTMyNjkwMjUsNy4xODQ0NTgzNSA5LjkzMjY5MDI1LDYuODE0MDg5MjIgMTAuMjAxOTI5Myw2LjU4NzUxMDQ2IEwxNC44MjM1Nzk4LDIuNjcxNzY0NjkgQzE1LjI1NzQ0OTEsMi4zMDQzMDA0MiAxNiwyLjU2NTczNzQ1IDE2LDMuMDg0MjU0MjMiIGlkPSJGaWxsLTExIiBmaWxsPSIjODU1Q0Q2IiBvcGFjaXR5PSIwLjUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0wLDEwLjkxNTc0NTggTDAsMy4wODQyNTQyMyBDMCwyLjU2NTczNzQ1IDAuNzQyNTUwOTExLDIuMzA0MzAwNDIgMS4xNzQ3MDUyNSwyLjY3MTc2NDY5IEw1Ljc5ODA3MDc0LDYuNTg4OTYyODkgQzYuMDY3MzA5NzUsNi44MTU1NDE2NSA2LjA2NzMwOTc1LDcuMTg1OTEwNzggNS43OTgwNzA3NCw3LjQxMjQ4OTU0IEwxLjE3NDcwNTI1LDExLjMyODIzNTMgQzAuNzQyNTUwOTExLDExLjY5NTY5OTYgMCwxMS40MzQyNjI2IDAsMTAuOTE1NzQ1OCIgaWQ9IkZpbGwtMTQiIGZpbGw9IiM4NTVDRDYiPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==",title:e.formatMessage(n.flipHorizontal),onClick:t.onFlipHorizontal}),l().createElement(Wc,{hideLabel:"en"!==e.locale,imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+ZmxpcC12ZXJ0aWNhbDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJmbGlwLXZlcnRpY2FsIj4KICAgICAgICAgICAgPGcgaWQ9ImZsaXAtaG9yaXpvbnRhbCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuMDAwMDAwLCAxMC4wMDAwMDApIHJvdGF0ZSg5MC4wMDAwMDApIHRyYW5zbGF0ZSgtMTAuMDAwMDAwLCAtMTAuMDAwMDAwKSB0cmFuc2xhdGUoMi4wMDAwMDAsIDMuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICA8Y2lyY2xlIGlkPSJPdmFsIiBmaWxsPSIjNTc1RTc1IiBvcGFjaXR5PSIwLjUiIGN4PSI4IiBjeT0iMC43NSIgcj0iMSI+PC9jaXJjbGU+CiAgICAgICAgICAgICAgICA8Y2lyY2xlIGlkPSJPdmFsIiBmaWxsPSIjNTc1RTc1IiBvcGFjaXR5PSIwLjUiIGN4PSI4IiBjeT0iMTMuMjUiIHI9IjEiPjwvY2lyY2xlPgogICAgICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbC1Db3B5IiBmaWxsPSIjNTc1RTc1IiBvcGFjaXR5PSIwLjUiIGN4PSI4IiBjeT0iMy44NzUiIHI9IjEiPjwvY2lyY2xlPgogICAgICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbC1Db3B5LTIiIGZpbGw9IiM1NzVFNzUiIG9wYWNpdHk9IjAuNSIgY3g9IjgiIGN5PSI3IiByPSIxIj48L2NpcmNsZT4KICAgICAgICAgICAgICAgIDxjaXJjbGUgaWQ9Ik92YWwtQ29weS0zIiBmaWxsPSIjNTc1RTc1IiBvcGFjaXR5PSIwLjUiIGN4PSI4IiBjeT0iMTAuMTI1IiByPSIxIj48L2NpcmNsZT4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xNiwzLjA4NDI1NDIzIEwxNiwxMC45MTU3NDU4IEMxNiwxMS40MzQyNjI2IDE1LjI1NzQ0OTEsMTEuNjk1Njk5NiAxNC44MjM1Nzk4LDExLjMyODIzNTMgTDEwLjIwMTkyOTMsNy40MTEwMzcxMSBDOS45MzI2OTAyNSw3LjE4NDQ1ODM1IDkuOTMyNjkwMjUsNi44MTQwODkyMiAxMC4yMDE5MjkzLDYuNTg3NTEwNDYgTDE0LjgyMzU3OTgsMi42NzE3NjQ2OSBDMTUuMjU3NDQ5MSwyLjMwNDMwMDQyIDE2LDIuNTY1NzM3NDUgMTYsMy4wODQyNTQyMyIgaWQ9IkZpbGwtMTEiIGZpbGw9IiM4NTVDRDYiIG9wYWNpdHk9IjAuNSI+PC9wYXRoPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTAsMTAuOTE1NzQ1OCBMMCwzLjA4NDI1NDIzIEMwLDIuNTY1NzM3NDUgMC43NDI1NTA5MTEsMi4zMDQzMDA0MiAxLjE3NDcwNTI1LDIuNjcxNzY0NjkgTDUuNzk4MDcwNzQsNi41ODg5NjI4OSBDNi4wNjczMDk3NSw2LjgxNTU0MTY1IDYuMDY3MzA5NzUsNy4xODU5MTA3OCA1Ljc5ODA3MDc0LDcuNDEyNDg5NTQgTDEuMTc0NzA1MjUsMTEuMzI4MjM1MyBDMC43NDI1NTA5MTEsMTEuNjk1Njk5NiAwLDExLjQzNDI2MjYgMCwxMC45MTU3NDU4IiBpZD0iRmlsbC0xNCIgZmlsbD0iIzg1NUNENiI+PC9wYXRoPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4K",title:e.formatMessage(n.flipVertical),onClick:t.onFlipVertical})));case E.BIT_TEXT:case E.TEXT:return l().createElement("div",{className:h()(t.className,Tf.modeTools)},l().createElement(wu,null,l().createElement(df,{onUpdateImage:t.onUpdateImage})));case E.BIT_RECT:case E.BIT_OVAL:var p=t.mode===E.BIT_RECT?gs:Vo,f=t.mode===E.BIT_RECT?"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUwLjIgKDU1MDQ3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5yZWN0YW5nZS1vdXRsaW5lZDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJyZWN0YW5nZS1vdXRsaW5lZCIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEuMzMzMzMzMzMiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPHJlY3QgaWQ9InJlY3RhbmdsZS1pY29uIiBzdHJva2U9IiM1NzVFNzUiIHg9IjQuNSIgeT0iNC41IiB3aWR0aD0iMTEiIGhlaWdodD0iMTEiPjwvcmVjdD4KICAgIDwvZz4KPC9zdmc+":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUwLjIgKDU1MDQ3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5vdmFsLW91dGxpbmVkPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9Im92YWwtb3V0bGluZWQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJHcm91cCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNC4wMDAwMDAsIDQuMDAwMDAwKSIgZmlsbD0iIzU3NUU3NSI+CiAgICAgICAgICAgIDxwb2x5Z29uIGlkPSJGaWxsLTEiIHBvaW50cz0iMCA5LjMzMzMzMzMzIDEuMzMzMzMzMzMgOS4zMzMzMzMzMyAxLjMzMzMzMzMzIDIuNjY2NjY2NjcgMCAyLjY2NjY2NjY3Ij48L3BvbHlnb24+CiAgICAgICAgICAgIDxwb2x5Z29uIGlkPSJGaWxsLTIiIHBvaW50cz0iMS4zMzMzMzMzMyAyLjY2NjY2NjY3IDIuNjY2NjY2NjcgMi42NjY2NjY2NyAyLjY2NjY2NjY3IDEuMzMzMzMzMzMgMS4zMzMzMzMzMyAxLjMzMzMzMzMzIj48L3BvbHlnb24+CiAgICAgICAgICAgIDxwb2x5Z29uIGlkPSJGaWxsLTMiIHBvaW50cz0iMS4zMzMzMzMzMyAxMC42NjY2NjY3IDIuNjY2NjY2NjcgMTAuNjY2NjY2NyAyLjY2NjY2NjY3IDkuMzMzMzMzMzMgMS4zMzMzMzMzMyA5LjMzMzMzMzMzIj48L3BvbHlnb24+CiAgICAgICAgICAgIDxwb2x5Z29uIGlkPSJGaWxsLTQiIHBvaW50cz0iMi42NjY2NjY2NyAxLjMzMzMzMzMzIDkuMzMzMzMzMzMgMS4zMzMzMzMzMyA5LjMzMzMzMzMzIDAgMi42NjY2NjY2NyAwIj48L3BvbHlnb24+CiAgICAgICAgICAgIDxwb2x5Z29uIGlkPSJGaWxsLTUiIHBvaW50cz0iOS4zMzMzMzMzMyAyLjY2NjY2NjY3IDEwLjY2NjY2NjcgMi42NjY2NjY2NyAxMC42NjY2NjY3IDEuMzMzMzMzMzMgOS4zMzMzMzMzMyAxLjMzMzMzMzMzIj48L3BvbHlnb24+CiAgICAgICAgICAgIDxwb2x5Z29uIGlkPSJGaWxsLTYiIHBvaW50cz0iMTAuNjY2NjY2NyA5LjMzMzMzMzMzIDEyIDkuMzMzMzMzMzMgMTIgMi42NjY2NjY2NyAxMC42NjY2NjY3IDIuNjY2NjY2NjciPjwvcG9seWdvbj4KICAgICAgICAgICAgPHBvbHlnb24gaWQ9IkZpbGwtNyIgcG9pbnRzPSI5LjMzMzMzMzMzIDEwLjY2NjY2NjcgMTAuNjY2NjY2NyAxMC42NjY2NjY3IDEwLjY2NjY2NjcgOS4zMzMzMzMzMyA5LjMzMzMzMzMzIDkuMzMzMzMzMzMiPjwvcG9seWdvbj4KICAgICAgICAgICAgPHBvbHlnb24gaWQ9IkZpbGwtOCIgcG9pbnRzPSIyLjY2NjY2NjY3IDEyIDkuMzMzMzMzMzMgMTIgOS4zMzMzMzMzMyAxMC42NjY2NjY3IDIuNjY2NjY2NjcgMTAuNjY2NjY2NyI+PC9wb2x5Z29uPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+";return l().createElement("div",{className:h()(t.className,Tf.modeTools)},l().createElement(wu,null,l().createElement(Wc,{highlighted:t.fillBitmapShapes,imgSrc:p,title:e.formatMessage(n.filled),onClick:t.onFillShapes})),l().createElement(wu,null,l().createElement(Wc,{highlighted:!t.fillBitmapShapes,imgSrc:f,title:e.formatMessage(n.outlined),onClick:t.onOutlineShapes})),t.fillBitmapShapes?null:l().createElement(wu,null,l().createElement(Nu,{text:e.formatMessage(n.thickness)},l().createElement(Sf,{range:!0,small:!0,max:gh,min:"1",type:"number",value:t.bitBrushSize,onSubmit:t.onBitBrushSliderChange}))));default:return l().createElement("div",{className:h()(t.className,Tf.modeTools)})}};Df.propTypes={bitBrushSize:i().number,bitEraserSize:i().number,brushValue:i().number,className:i().string,clipboardItems:i().arrayOf(i().array),eraserValue:i().number,fillBitmapShapes:i().bool,format:i().oneOf(Object.keys(I)),hasSelectedUncurvedPoints:i().bool,hasSelectedUnpointedPoints:i().bool,mode:i().string.isRequired,onBitBrushSliderChange:i().func.isRequired,onBitEraserSliderChange:i().func.isRequired,onBrushSliderChange:i().func.isRequired,onCopyToClipboard:i().func.isRequired,onCurvePoints:i().func.isRequired,onDelete:i().func.isRequired,onEraserSliderChange:i().func,onFillShapes:i().func.isRequired,onFlipHorizontal:i().func.isRequired,onFlipVertical:i().func.isRequired,onOutlineShapes:i().func.isRequired,onPasteFromClipboard:i().func.isRequired,onPointPoints:i().func.isRequired,onUpdateImage:i().func.isRequired};var Nf=(0,c.connect)(function(t){return{mode:t.scratchPaint.mode,format:t.scratchPaint.format,fillBitmapShapes:t.scratchPaint.fillBitmapShapes,bitBrushSize:t.scratchPaint.bitBrushSize,bitEraserSize:t.scratchPaint.bitEraserSize,brushValue:t.scratchPaint.brushMode.brushSize,clipboardItems:t.scratchPaint.clipboard.items,eraserValue:t.scratchPaint.eraserMode.brushSize}},function(t){return{onBrushSliderChange:function(e){t(function(t){return{type:Rp,brushSize:t}}(e))},onBitBrushSliderChange:function(e){t({type:Gp,brushSize:e})},onBitEraserSliderChange:function(e){t(function(t){return{type:Yp,eraserSize:t}}(e))},onEraserSliderChange:function(e){t(Ol(e))},onFillShapes:function(){t(Wp(!0))},onOutlineShapes:function(){t(Wp(!1))}}})(Df);function _f(t){return _f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_f(t)}function Ef(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return jf(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jf(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function jf(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function kf(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Of(i.key),i)}}function Of(t){var e=function(t,e){if("object"!=_f(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=_f(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_f(e)?e:e+""}function zf(t,e,n){return e=Bf(e),function(t,e){if(e&&("object"==_f(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Lf()?Reflect.construct(e,n||[],Bf(t).constructor):e.apply(t,n))}function Lf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Lf=function(){return!!t})()}function Bf(t){return Bf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bf(t)}function Pf(t,e){return Pf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pf(t,e)}var Rf=function(t){function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e=zf(this,n,[t]),m()(e,["_getSelectedUncurvedPoints","_getSelectedUnpointedPoints","hasSelectedUncurvedPoints","hasSelectedUnpointedPoints","handleCurvePoints","handleFlipHorizontal","handleFlipVertical","handleDelete","handlePasteFromClipboard","handlePointPoints"]),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pf(t,e)}(n,t),function(t,e,n){return e&&kf(t.prototype,e),n&&kf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"_getSelectedUncurvedPoints",value:function(){var t,e=[],n=Ef(At());try{for(n.s();!(t=n.n()).done;){var i=t.value;if(i.segments){var r,o=Ef(i.segments);try{for(o.s();!(r=o.n()).done;){var s=r.value;if(s.selected){var a=s.getPrevious(),l=s.getNext();(!a||s.handleIn.length>0)&&(!l||s.handleOut.length>0)&&(!a||!l||s.handleOut.isColinear(s.handleIn))||e.push(s)}}}catch(t){o.e(t)}finally{o.f()}}}}catch(t){n.e(t)}finally{n.f()}return e}},{key:"_getSelectedUnpointedPoints",value:function(){var t,e=[],n=Ef(At());try{for(n.s();!(t=n.n()).done;){var i=t.value;if(i.segments){var r,o=Ef(i.segments);try{for(o.s();!(r=o.n()).done;){var s=r.value;s.selected&&(s.handleIn.length>0||s.handleOut.length>0)&&e.push(s)}}catch(t){o.e(t)}finally{o.f()}}}}catch(t){n.e(t)}finally{n.f()}return e}},{key:"hasSelectedUncurvedPoints",value:function(){return this._getSelectedUncurvedPoints().length>0}},{key:"hasSelectedUnpointedPoints",value:function(){return this._getSelectedUnpointedPoints().length>0}},{key:"handleCurvePoints",value:function(){var t,e,n=Ef(this._getSelectedUncurvedPoints());try{for(n.s();!(e=n.n()).done;){var i=e.value,r=i.getPrevious(),o=i.getNext(),s=0===i.handleIn.length&&0===i.handleOut.length;if(r||o){if(r&&o&&s)i.handleIn=r.point.subtract(o.point).normalize().multiply(r.getCurve().length*X);else if(r&&!o&&0===i.handleIn.length){var a=r.getCurve().getCurvatureAtTime(.5)<0?-1:1;i.handleIn=r.getCurve().getNormalAtTime(1).multiply(a).add(r.point.subtract(i.point).normalize()).normalize().multiply(r.getCurve().length*X)}else if(o&&!r&&0===i.handleOut.length){var l=i.getCurve().getCurvatureAtTime(.5)<0?-1:1;i.handleOut=i.getCurve().getNormalAtTime(0).multiply(l).add(o.point.subtract(i.point).normalize()).normalize().multiply(i.getCurve().length*X)}i.handleIn.length>0&&o?i.handleOut=i.handleIn.multiply(-1):i.handleOut.length>0&&r&&(i.handleIn=i.handleOut.multiply(-1)),t=!0}}}catch(t){n.e(t)}finally{n.f()}t&&(this.props.setSelectedItems(this.props.format),this.props.onUpdateImage())}},{key:"handlePointPoints",value:function(){var t,e,n=Ef(this._getSelectedUnpointedPoints());try{for(n.s();!(e=n.n()).done;){var i=e.value;0===i.handleIn.length&&0===i.handleOut.length||(i.handleIn=null,i.handleOut=null,t=!0)}}catch(t){n.e(t)}finally{n.f()}t&&(this.props.setSelectedItems(this.props.format),this.props.onUpdateImage())}},{key:"_handleFlip",value:function(t,n,i){0===i.length&&(i=dt());var r,o=Ef(i);try{for(o.s();!(r=o.n()).done;){var s=r.value;s.data.index=s.index}}catch(t){o.e(t)}finally{o.f()}var a=new(e().Group)(i);a.scale(t,n),nt(a);for(var l=0;l<i.length;l++)a.layer.insertChild(i[l].data.index,i[l]),i[l].data.index=null;a.remove(),this.props.onUpdateImage()}},{key:"handleFlipHorizontal",value:function(){var t=It();M(this.props.format)&&0===t.length?(Ee().canvas=$t(Ee().canvas),this.props.onUpdateImage()):this._handleFlip(-1,1,t)}},{key:"handleFlipVertical",value:function(){var t=It();M(this.props.format)&&0===t.length?(Ee().canvas=te(Ee().canvas),this.props.onUpdateImage()):this._handleFlip(1,-1,t)}},{key:"handlePasteFromClipboard",value:function(){this.props.onPasteFromClipboard()&&this.props.onUpdateImage()}},{key:"handleDelete",value:function(){this.props.selectedItems.length||(M(this.props.format)?se(this.props.clearSelectedItems):this.props.mode===E.RESHAPE?vt():yt()),Ct(this.props.mode,this.props.onUpdateImage)&&this.props.setSelectedItems(this.props.format)}},{key:"render",value:function(){return l().createElement(Nf,{hasSelectedUncurvedPoints:this.hasSelectedUncurvedPoints(),hasSelectedUnpointedPoints:this.hasSelectedUnpointedPoints(),onCopyToClipboard:this.props.onCopyToClipboard,onCurvePoints:this.handleCurvePoints,onDelete:this.handleDelete,onFlipHorizontal:this.handleFlipHorizontal,onFlipVertical:this.handleFlipVertical,onPasteFromClipboard:this.handlePasteFromClipboard,onPointPoints:this.handlePointPoints,onUpdateImage:this.props.onUpdateImage})}}])}(l().Component);Rf.propTypes={clearSelectedItems:i().func.isRequired,format:i().oneOf(Object.keys(I)),mode:i().oneOf(Object.keys(E)),onCopyToClipboard:i().func.isRequired,onPasteFromClipboard:i().func.isRequired,onUpdateImage:i().func.isRequired,selectedItems:i().arrayOf(i().instanceOf(e().Item)),setSelectedItems:i().func.isRequired};var Uf=Pp((0,c.connect)(function(t){return{format:t.scratchPaint.format,mode:t.scratchPaint.mode,selectedItems:t.scratchPaint.selectedItems}},function(t){return{clearSelectedItems:function(){t(en())},setSelectedItems:function(e){t(tn(At(),M(e)))}}})(Rf));function Gf(t){return Gf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gf(t)}function Yf(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Zf(i.key),i)}}function Zf(t){var e=function(t,e){if("object"!=Gf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Gf(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Gf(e)?e:e+""}function Wf(t,e,n){return e=Hf(e),function(t,e){if(e&&("object"==Gf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Qf()?Reflect.construct(e,n||[],Hf(t).constructor):e.apply(t,n))}function Qf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Qf=function(){return!!t})()}function Hf(t){return Hf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Hf(t)}function Ff(t,e){return Ff=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ff(t,e)}var Vf=function(t){function n(t,e,i,r){var o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(o=Wf(this,n)).setSelectedItems=t,o.clearSelectedItems=e,o.onUpdateImage=r,o.boundingBoxTool=new jo(E.OVAL,t,e,i,r);var s=new Po(E.OVAL,o.boundingBoxTool,r);return o.onMouseDown=o.handleMouseDown,o.onMouseDrag=o.handleMouseDrag,o.onMouseMove=o.handleMouseMove,o.onMouseUp=o.handleMouseUp,o.onKeyUp=s.onKeyUp,o.onKeyDown=s.onKeyDown,o.oval=null,o.colorState=null,o.isBoundingBoxMode=null,o.active=!1,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ff(t,e)}(n,t),function(t,e,n){return e&&Yf(t.prototype,e),n&&Yf(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"getHitOptions",value:function(){return{segments:!0,stroke:!0,curves:!0,fill:!0,guide:!1,match:function(t){return t.item.data&&(t.item.data.isScaleHandle||t.item.data.isRotHandle)||t.item.selected},tolerance:n.TOLERANCE/e().view.zoom}}},{key:"onSelectionChanged",value:function(t){this.boundingBoxTool.onSelectionChanged(t)}},{key:"setColorState",value:function(t){this.colorState=t}},{key:"handleMouseDown",value:function(t){t.event.button>0||(this.active=!0,this.boundingBoxTool.onMouseDown(t,!1,!1,!1,this.getHitOptions())?this.isBoundingBoxMode=!0:(this.isBoundingBoxMode=!1,bt(this.clearSelectedItems),this.oval=new(e().Shape.Ellipse)({point:t.downPoint,size:0}),Ui(this.oval,this.colorState)))}},{key:"handleMouseDrag",value:function(t){if(!(t.event.button>0)&&this.active)if(this.isBoundingBoxMode)this.boundingBoxTool.onMouseDrag(t);else{var n=new(e().Point)(t.downPoint.x,t.downPoint.y),i=new(e().Point)(t.point.x,t.point.y),r=rt(t.downPoint,t.point);t.modifiers.shift?this.oval.size=r.size.abs():this.oval.size=n.subtract(i),t.modifiers.alt?this.oval.position=n:t.modifiers.shift?this.oval.position=r.position:this.oval.position=n.subtract(this.oval.size.multiply(.5)),Ui(this.oval,this.colorState)}}},{key:"handleMouseMove",value:function(t){this.boundingBoxTool.onMouseMove(t,this.getHitOptions())}},{key:"handleMouseUp",value:function(t){if(!(t.event.button>0)&&this.active){if(this.isBoundingBoxMode)return this.boundingBoxTool.onMouseUp(t),void(this.isBoundingBoxMode=null);if(this.oval)if(Math.abs(this.oval.size.width*this.oval.size.height)<n.TOLERANCE/e().view.zoom)this.oval.remove(),this.oval=null;else{var i=this.oval.toPath(!0);this.oval.remove(),this.oval=null,i.selected=!0,this.setSelectedItems(),this.onUpdateImage()}this.active=!1}}},{key:"deactivateTool",value:function(){this.boundingBoxTool.deactivateTool()}}],[{key:"TOLERANCE",get:function(){return 2}}])}(e().Tool),qf=Vf,Jf=function(t){return l().createElement(ar,{imgDescriptor:lr.oval,imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+b3ZhbDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJvdmFsIiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlPSIjNTc1RTc1Ij4KICAgICAgICAgICAgPGNpcmNsZSBpZD0ib3ZhbC1pY29uIiBjeD0iMTAiIGN5PSIxMCIgcj0iNSI+PC9jaXJjbGU+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",isSelected:t.isSelected,onMouseDown:t.onMouseDown})};Jf.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var Xf=Jf;function Kf(t){return Kf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kf(t)}function $f(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,tg(i.key),i)}}function tg(t){var e=function(t,e){if("object"!=Kf(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Kf(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Kf(e)?e:e+""}function eg(t,e,n){return e=ig(e),function(t,e){if(e&&("object"==Kf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ng()?Reflect.construct(e,n||[],ig(t).constructor):e.apply(t,n))}function ng(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ng=function(){return!!t})()}function ig(t){return ig=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ig(t)}function rg(t,e){return rg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},rg(t,e)}var og=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=eg(this,e,[t]),m()(n,["activateTool","deactivateTool","validateColorState"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&rg(t,e)}(e,t),function(t,e,n){return e&&$f(t.prototype,e),n&&$f(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidMount",value:function(){this.props.isOvalModeActive&&this.activateTool(this.props)}},{key:"componentWillReceiveProps",value:function(t){this.tool&&t.colorState!==this.props.colorState&&this.tool.setColorState(t.colorState),this.tool&&t.selectedItems!==this.props.selectedItems&&this.tool.onSelectionChanged(t.selectedItems),t.isOvalModeActive&&!this.props.isOvalModeActive?this.activateTool():!t.isOvalModeActive&&this.props.isOvalModeActive&&this.deactivateTool()}},{key:"shouldComponentUpdate",value:function(t){return t.isOvalModeActive!==this.props.isOvalModeActive}},{key:"componentWillUnmount",value:function(){this.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){bt(this.props.clearSelectedItems),this.validateColorState(),this.tool=new qf(this.props.setSelectedItems,this.props.clearSelectedItems,this.props.setCursor,this.props.onUpdateImage),this.tool.setColorState(this.props.colorState),this.tool.activate()}},{key:"deactivateTool",value:function(){this.tool.deactivateTool(),this.tool.remove(),this.tool=null}},{key:"validateColorState",value:function(){var t=this.props.colorState.strokeWidth,e=this.props.colorState.fillColor.primary,n=this.props.colorState.fillColor.secondary,i=this.props.colorState.fillColor.gradientType,r=this.props.colorState.strokeColor.primary,o=this.props.colorState.strokeColor.secondary,s=this.props.colorState.strokeColor.gradientType;n===Di&&(this.props.clearFillGradient(),n=null,i=ci.SOLID),o===Di&&(this.props.clearStrokeGradient(),o=null,s=ci.SOLID);var a=e===Di||i===ci.SOLID&&null===e||i!==ci.SOLID&&null===e&&null===n,l=r===Di||null===t||0===t||s===ci.SOLID&&null===r||s!==ci.SOLID&&null===r&&null===o;a&&l?(this.props.onChangeFillColor(Ai),this.props.clearFillGradient(),this.props.onChangeStrokeColor(null),this.props.clearStrokeGradient()):a&&!l?(this.props.onChangeFillColor(null),this.props.clearFillGradient()):!a&&l&&(this.props.onChangeStrokeColor(null),this.props.clearStrokeGradient())}},{key:"render",value:function(){return l().createElement(Xf,{isSelected:this.props.isOvalModeActive,onMouseDown:this.props.handleMouseDown})}}])}(l().Component);og.propTypes={clearFillGradient:i().func.isRequired,clearStrokeGradient:i().func.isRequired,clearSelectedItems:i().func.isRequired,colorState:i().shape({fillColor:Xr,strokeColor:Xr,strokeWidth:i().number}).isRequired,handleMouseDown:i().func.isRequired,isOvalModeActive:i().bool.isRequired,onChangeFillColor:i().func.isRequired,onChangeStrokeColor:i().func.isRequired,onUpdateImage:i().func.isRequired,selectedItems:i().arrayOf(i().instanceOf(e().Item)),setCursor:i().func.isRequired,setSelectedItems:i().func.isRequired};var sg=(0,c.connect)(function(t){return{colorState:t.scratchPaint.color,isOvalModeActive:t.scratchPaint.mode===E.OVAL,selectedItems:t.scratchPaint.selectedItems}},function(t){return{clearSelectedItems:function(){t(en())},clearFillGradient:function(){t(Ti())},clearStrokeGradient:function(){t(Nh())},setCursor:function(e){t(oo(e))},setSelectedItems:function(){t(tn(At(),!1))},handleMouseDown:function(){t(Zi(E.OVAL))},onChangeFillColor:function(e){t(wi(e))},onChangeStrokeColor:function(e){t(xh(e))}}})(og);function ag(t){return ag="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ag(t)}function lg(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,cg(i.key),i)}}function cg(t){var e=function(t,e){if("object"!=ag(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=ag(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ag(e)?e:e+""}function ug(t,e,n){return e=dg(e),function(t,e){if(e&&("object"==ag(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,hg()?Reflect.construct(e,n||[],dg(t).constructor):e.apply(t,n))}function hg(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(hg=function(){return!!t})()}function dg(t){return dg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dg(t)}function pg(t,e){return pg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},pg(t,e)}var fg=function(t){function n(t,e,i,r){var o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(o=ug(this,n)).setSelectedItems=t,o.clearSelectedItems=e,o.onUpdateImage=r,o.boundingBoxTool=new jo(E.RECT,t,e,i,r);var s=new Po(E.RECT,o.boundingBoxTool,r);return o.onMouseDown=o.handleMouseDown,o.onMouseMove=o.handleMouseMove,o.onMouseDrag=o.handleMouseDrag,o.onMouseUp=o.handleMouseUp,o.onKeyUp=s.onKeyUp,o.onKeyDown=s.onKeyDown,o.rect=null,o.colorState=null,o.isBoundingBoxMode=null,o.active=!1,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&pg(t,e)}(n,t),function(t,e,n){return e&&lg(t.prototype,e),n&&lg(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"getHitOptions",value:function(){return{segments:!0,stroke:!0,curves:!0,fill:!0,guide:!1,match:function(t){return t.item.data&&(t.item.data.isScaleHandle||t.item.data.isRotHandle)||t.item.selected},tolerance:n.TOLERANCE/e().view.zoom}}},{key:"onSelectionChanged",value:function(t){this.boundingBoxTool.onSelectionChanged(t)}},{key:"setColorState",value:function(t){this.colorState=t}},{key:"handleMouseDown",value:function(t){t.event.button>0||(this.active=!0,this.boundingBoxTool.onMouseDown(t,!1,!1,!1,this.getHitOptions())?this.isBoundingBoxMode=!0:(this.isBoundingBoxMode=!1,bt(this.clearSelectedItems)))}},{key:"handleMouseDrag",value:function(t){if(!(t.event.button>0)&&this.active)if(this.isBoundingBoxMode)this.boundingBoxTool.onMouseDrag(t);else{this.rect&&this.rect.remove();var n=new(e().Rectangle)(t.downPoint,t.point),i=rt(t.downPoint,t.point);if(t.modifiers.shift&&(n.size=i.size.abs()),this.rect=new(e().Path.Rectangle)(n),t.modifiers.alt)this.rect.position=t.downPoint;else if(t.modifiers.shift)this.rect.position=i.position;else{var r=t.point.subtract(t.downPoint);this.rect.position=t.downPoint.add(r.multiply(.5))}Ui(this.rect,this.colorState)}}},{key:"handleMouseUp",value:function(t){if(!(t.event.button>0)&&this.active){if(this.isBoundingBoxMode)return this.boundingBoxTool.onMouseUp(t),void(this.isBoundingBoxMode=null);this.rect&&(this.rect.area<n.TOLERANCE/e().view.zoom?(this.rect.remove(),this.rect=null):(this.rect.selected=!0,this.setSelectedItems(),this.onUpdateImage(),this.rect=null)),this.active=!1}}},{key:"handleMouseMove",value:function(t){this.boundingBoxTool.onMouseMove(t,this.getHitOptions())}},{key:"deactivateTool",value:function(){this.boundingBoxTool.deactivateTool()}}],[{key:"TOLERANCE",get:function(){return 2}}])}(e().Tool),gg=fg,mg=function(t){return l().createElement(ar,{imgDescriptor:lr.rect,imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+cmVjdGFuZ2xlPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj4KICAgICAgICA8ZyBpZD0icmVjdGFuZ2xlIiBzdHJva2U9IiM1NzVFNzUiIHN0cm9rZS13aWR0aD0iMS41Ij4KICAgICAgICAgICAgPHJlY3QgaWQ9InJlY3RhbmdsZS1pY29uIiB4PSI1IiB5PSI1IiB3aWR0aD0iMTAiIGhlaWdodD0iMTAiPjwvcmVjdD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg==",isSelected:t.isSelected,onMouseDown:t.onMouseDown})};mg.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var yg=mg;function vg(t){return vg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vg(t)}function bg(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Ig(i.key),i)}}function Ig(t){var e=function(t,e){if("object"!=vg(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=vg(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vg(e)?e:e+""}function Ag(t,e,n){return e=wg(e),function(t,e){if(e&&("object"==vg(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Mg()?Reflect.construct(e,n||[],wg(t).constructor):e.apply(t,n))}function Mg(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Mg=function(){return!!t})()}function wg(t){return wg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wg(t)}function Cg(t,e){return Cg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cg(t,e)}var Tg=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=Ag(this,e,[t]),m()(n,["activateTool","deactivateTool","validateColorState"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cg(t,e)}(e,t),function(t,e,n){return e&&bg(t.prototype,e),n&&bg(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidMount",value:function(){this.props.isRectModeActive&&this.activateTool(this.props)}},{key:"componentWillReceiveProps",value:function(t){this.tool&&t.colorState!==this.props.colorState&&this.tool.setColorState(t.colorState),this.tool&&t.selectedItems!==this.props.selectedItems&&this.tool.onSelectionChanged(t.selectedItems),t.isRectModeActive&&!this.props.isRectModeActive?this.activateTool():!t.isRectModeActive&&this.props.isRectModeActive&&this.deactivateTool()}},{key:"shouldComponentUpdate",value:function(t){return t.isRectModeActive!==this.props.isRectModeActive}},{key:"componentWillUnmount",value:function(){this.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){bt(this.props.clearSelectedItems),this.validateColorState(),this.tool=new gg(this.props.setSelectedItems,this.props.clearSelectedItems,this.props.setCursor,this.props.onUpdateImage),this.tool.setColorState(this.props.colorState),this.tool.activate()}},{key:"validateColorState",value:function(){var t=this.props.colorState.strokeWidth,e=this.props.colorState.fillColor.primary,n=this.props.colorState.fillColor.secondary,i=this.props.colorState.fillColor.gradientType,r=this.props.colorState.strokeColor.primary,o=this.props.colorState.strokeColor.secondary,s=this.props.colorState.strokeColor.gradientType;n===Di&&(this.props.clearFillGradient(),n=null,i=ci.SOLID),o===Di&&(this.props.clearStrokeGradient(),o=null,s=ci.SOLID);var a=e===Di||i===ci.SOLID&&null===e||i!==ci.SOLID&&null===e&&null===n,l=r===Di||null===t||0===t||s===ci.SOLID&&null===r||s!==ci.SOLID&&null===r&&null===o;a&&l?(this.props.onChangeFillColor(Ai),this.props.clearFillGradient(),this.props.onChangeStrokeColor(null),this.props.clearStrokeGradient()):a&&!l?(this.props.onChangeFillColor(null),this.props.clearFillGradient()):!a&&l&&(this.props.onChangeStrokeColor(null),this.props.clearStrokeGradient())}},{key:"deactivateTool",value:function(){this.tool.deactivateTool(),this.tool.remove(),this.tool=null}},{key:"render",value:function(){return l().createElement(yg,{isSelected:this.props.isRectModeActive,onMouseDown:this.props.handleMouseDown})}}])}(l().Component);Tg.propTypes={clearFillGradient:i().func.isRequired,clearStrokeGradient:i().func.isRequired,clearSelectedItems:i().func.isRequired,colorState:i().shape({fillColor:Xr,strokeColor:Xr,strokeWidth:i().number}).isRequired,handleMouseDown:i().func.isRequired,isRectModeActive:i().bool.isRequired,onChangeFillColor:i().func.isRequired,onChangeStrokeColor:i().func.isRequired,onUpdateImage:i().func.isRequired,selectedItems:i().arrayOf(i().instanceOf(e().Item)),setCursor:i().func.isRequired,setSelectedItems:i().func.isRequired};var xg=(0,c.connect)(function(t){return{colorState:t.scratchPaint.color,isRectModeActive:t.scratchPaint.mode===E.RECT,selectedItems:t.scratchPaint.selectedItems}},function(t){return{clearSelectedItems:function(){t(en())},clearFillGradient:function(){t(Ti())},clearStrokeGradient:function(){t(Nh())},setSelectedItems:function(){t(tn(At(),!1))},setCursor:function(e){t(oo(e))},handleMouseDown:function(){t(Zi(E.RECT))},onChangeFillColor:function(e){t(wi(e))},onChangeStrokeColor:function(e){t(xh(e))}}})(Tg);function Sg(t){return Sg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sg(t)}function Dg(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ng(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ng(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Ng(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function _g(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Eg(i.key),i)}}function Eg(t){var e=function(t,e){if("object"!=Sg(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Sg(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Sg(e)?e:e+""}var jg=function(){return function(t,e,n){return e&&_g(t.prototype,e),n&&_g(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.deselectOnMouseUp=null,this.deleteOnMouseUp=null,this.invertDeselect=!1,this.selectedItems=null,this.setSelectedItems=e,this.clearSelectedItems=n,this.lastPoint=null,this.onUpdateImage=i},[{key:"onMouseDown",value:function(t){t.doubleClicked&&(this.deleteOnMouseUp=t.hitResult),t.hitResult.segment.selected?t.multiselect?this.deselectOnMouseUp=t.hitResult.segment:(this.deselectOnMouseUp=t.hitResult.segment,this.invertDeselect=!0,t.hitResult.segment.selected=!0):(t.multiselect||bt(this.clearSelectedItems),t.hitResult.segment.selected=!0),this.selectedItems=At()}},{key:"addPoint",value:function(t){var e=t.hitResult.item.divideAt(t.hitResult.location);e.hasHandles()||e.smooth(),t.hitResult.segment=e,t.multiselect||bt(this.clearSelectedItems),e.selected=!0}},{key:"removePoint",value:function(t){var e=t.segment.index;t.item.removeSegment(e);var n=t.item.segments[e-1],i=t.item.segments[e],r=n&&n.curve?n.curve.length:null;n&&n.handleOut&&(n.handleOut=i?n.handleOut.multiply(r*X/n.handleOut.length):null),i&&i.handleIn&&(i.handleIn=n?i.handleIn.multiply(r*X/i.handleIn.length):null)}},{key:"onMouseDrag",value:function(t){this.deselectOnMouseUp=null,this.invertDeselect=!1,this.deleteOnMouseUp=null;var e=t.point,n=we();e.x=Math.max(n.left,Math.min(e.x,n.right)),e.y=Math.max(n.top,Math.min(e.y,n.bottom)),this.lastPoint||(this.lastPoint=t.lastPoint);var i=e.subtract(t.downPoint),r=e.subtract(this.lastPoint);this.lastPoint=e;var o,s=Dg(Mt());try{for(s.s();!(o=s.n()).done;){var a=o.value;a.origPoint||(a.origPoint=a.point.clone()),t.modifiers.shift?a.point=a.origPoint.add(K(i,Math.PI/4)):a.point=a.point.add(r)}}catch(t){s.e(t)}finally{s.f()}}},{key:"onMouseUp",value:function(){this.lastPoint=null;var t,e=!1,n=Dg(Mt());try{for(n.s();!(t=n.n()).done;){var i=t.value;i.origPoint&&!i.equals(i.origPoint)&&(e=!0),i.origPoint=null}}catch(t){n.e(t)}finally{n.f()}this.deselectOnMouseUp&&(this.invertDeselect?(bt(this.clearSelectedItems),this.deselectOnMouseUp.selected=!0):this.deselectOnMouseUp.selected=!1,this.deselectOnMouseUp=null,this.invertDeselect=!1),this.deleteOnMouseUp&&this.removePoint(this.deleteOnMouseUp),this.selectedItems=null,this.setSelectedItems(),(e||this.deleteOnMouseUp)&&(this.deleteOnMouseUp=null,this.onUpdateImage())}}])}();function kg(t){return kg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kg(t)}function Og(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return zg(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zg(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function zg(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function Lg(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Bg(i.key),i)}}function Bg(t){var e=function(t,e){if("object"!=kg(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=kg(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==kg(e)?e:e+""}var Pg=function(){return function(t,e,n){return e&&Lg(t.prototype,e),n&&Lg(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.hitType=null,this.setSelectedItems=e,this.clearSelectedItems=n,this.onUpdateImage=i,this.selectedItems=[]},[{key:"onMouseDown",value:function(t){t.multiselect||bt(this.clearSelectedItems),t.hitResult.segment.handleIn.selected=!0,t.hitResult.segment.handleOut.selected=!0,this.hitType=t.hitResult.type}},{key:"onMouseDrag",value:function(t){this.selectedItems=At();var e,n=Og(this.selectedItems);try{for(n.s();!(e=n.n()).done;){var i,r=Og(e.value.segments);try{for(r.s();!(i=r.n()).done;){var o=i.value;o.origPoint||(o.origPoint=o.point.clone()),o.handleOut.selected&&"handle-out"===this.hitType?t.modifiers.option||!o.handleOut.isColinear(o.handleIn)?o.handleOut=o.handleOut.add(t.delta):(o.handleOut=o.handleOut.add(t.delta),o.handleIn=o.handleOut.multiply(-o.handleIn.length/o.handleOut.length)):o.handleIn.selected&&"handle-in"===this.hitType&&(t.modifiers.option||!o.handleOut.isColinear(o.handleIn)?o.handleIn=o.handleIn.add(t.delta):(o.handleIn=o.handleIn.add(t.delta),o.handleOut=o.handleIn.multiply(-o.handleOut.length/o.handleIn.length)))}}catch(t){r.e(t)}finally{r.f()}}}catch(t){n.e(t)}finally{n.f()}}},{key:"onMouseUp",value:function(){var t,e=!1,n=Og(this.selectedItems);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(!i.segments)return;var r,o=Og(i.segments);try{for(o.s();!(r=o.n()).done;){var s=r.value;s.origPoint&&!s.equals(s.origPoint)&&(e=!0),s.origPoint=null}}catch(t){o.e(t)}finally{o.f()}}}catch(t){n.e(t)}finally{n.f()}e&&(this.setSelectedItems(),this.onUpdateImage()),this.selectedItems=[]}}])}();function Rg(t){return Rg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rg(t)}function Ug(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Gg(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gg(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Gg(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function Yg(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Zg(i.key),i)}}function Zg(t){var e=function(t,e){if("object"!=Rg(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Rg(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Rg(e)?e:e+""}function Wg(t,e,n){return e=Hg(e),function(t,e){if(e&&("object"==Rg(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Qg()?Reflect.construct(e,n||[],Hg(t).constructor):e.apply(t,n))}function Qg(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Qg=function(){return!!t})()}function Hg(t){return Hg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Hg(t)}function Fg(t,e){return Fg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Fg(t,e)}var Vg=b()({FILL:null,POINT:null,HANDLE:null,SELECTION_BOX:null}),qg=function(t){function n(t,i,r,o,s,a){var l;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(l=Wg(this,n)).setHoveredItem=t,l.clearHoveredItem=i,l.onUpdateImage=s,l.prevHoveredItemId=null,l.lastEvent=null,l.active=!1,l.mode=Vg.SELECTION_BOX,l._modeMap={},l._modeMap[Vg.FILL]=new To(E.RESHAPE,r,o,s,a),l._modeMap[Vg.POINT]=new jg(r,o,s),l._modeMap[Vg.HANDLE]=new Pg(r,o,s),l._modeMap[Vg.SELECTION_BOX]=new ua(E.RESHAPE,r,o),l.onMouseDown=l.handleMouseDown,l.onMouseMove=l.handleMouseMove,l.onMouseDrag=l.handleMouseDrag,l.onMouseUp=l.handleMouseUp,l.onKeyUp=l.handleKeyUp,l.onKeyDown=l.handleKeyDown,e().settings.handleSize=2*n.HANDLE_RADIUS-2.5,l}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Fg(t,e)}(n,t),function(t,e,n){return e&&Yg(t.prototype,e),n&&Yg(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"getSelectedSegmentHitOptions",value:function(){return{segments:!0,tolerance:n.TOLERANCE/e().view.zoom,match:function(t){return"segment"===t.type&&((!t.item.data||!t.item.data.noHover)&&!!t.item.selected)}}}},{key:"getHandleHitOptions",value:function(){return{handles:!0,tolerance:n.TOLERANCE/e().view.zoom,match:function(t){return(!t.item.data||!t.item.data.noHover)&&(!(!t.segment||!t.segment.selected)&&!t.item.fullySelected)}}}},{key:"getSelectedStrokeHitOptions",value:function(){return{segments:!1,stroke:!1,curves:!0,handles:!1,fill:!1,guide:!1,tolerance:n.TOLERANCE/e().view.zoom,match:function(t){return"curve"===t.type&&(!!t.item.selected&&(!t.item.data||!t.item.data.noHover))}}}},{key:"getUnselectedAndFillHitOptions",value:function(){return{fill:!0,stroke:!0,curves:!0,tolerance:n.TOLERANCE/e().view.zoom,match:function(t){return!t.item.data||!t.item.data.noHover}}}},{key:"setPrevHoveredItemId",value:function(t){this.prevHoveredItemId=t}},{key:"getHitResult",value:function(t){var n,i=e().project.hitTestAll(t,this.getSelectedSegmentHitOptions());if(i.length||(i=e().project.hitTestAll(t,this.getHandleHitOptions())),i.length||(i=e().project.hitTestAll(t,this.getSelectedStrokeHitOptions())),i.length||(i=e().project.hitTestAll(t,this.getUnselectedAndFillHitOptions())),!i.length)return null;var r,o=Ug(i);try{for(o.s();!(r=o.n()).done;){var s=r.value;(!n||tt(n.item,s.item)<0)&&(n=s)}}catch(t){o.e(t)}finally{o.f()}return n}},{key:"handleMouseDown",value:function(t){if(!(t.event.button>0)){this.active=!0,this.clearHoveredItem();var e=!1;this.lastEvent&&(e=t.event.timeStamp-this.lastEvent.event.timeStamp<n.DOUBLE_CLICK_MILLIS),this.lastEvent=t;var i=this.getHitResult(t.point);if(i){var r={hitResult:i,clone:t.modifiers.alt,multiselect:t.modifiers.shift,doubleClicked:e,subselect:!0};!i.item.selected||"fill"===i.type||"stroke"===i.type||"segment"!==i.type&&e?(this.mode=Vg.FILL,this._modeMap[this.mode].onMouseDown(r)):"segment"===i.type?(this.mode=Vg.POINT,this._modeMap[this.mode].onMouseDown(r)):"curve"===i.type?(this.mode=Vg.POINT,this._modeMap[this.mode].addPoint(r),this.onUpdateImage(),this._modeMap[this.mode].onMouseDown(r)):"handle-in"===i.type||"handle-out"===i.type?(this.mode=Vg.HANDLE,this._modeMap[this.mode].onMouseDown(r)):(s.warn("Unhandled hit result type: ".concat(i.type)),this.mode=Vg.FILL,this._modeMap[this.mode].onMouseDown(r))}else this._modeMap[Vg.SELECTION_BOX].onMouseDown(t.modifiers.shift)}}},{key:"handleMouseMove",value:function(t){var e,n=this.getHitResult(t.point);if(n){var i=n.item;e=i.selected?null:O(i)?jt(i):Et(i)}(!e&&this.prevHoveredItemId||e&&!this.prevHoveredItemId||e&&this.prevHoveredItemId&&e.id!==this.prevHoveredItemId)&&this.setHoveredItem(e?e.id:null)}},{key:"handleMouseDrag",value:function(t){t.event.button>0||!this.active||this._modeMap[this.mode].onMouseDrag(t)}},{key:"handleMouseUp",value:function(t){t.event.button>0||!this.active||(this.mode===Vg.SELECTION_BOX?this._modeMap[this.mode].onMouseUpVector(t):this._modeMap[this.mode].onMouseUp(t),this.mode=Vg.SELECTION_BOX,this.active=!1)}},{key:"handleKeyDown",value:function(t){if(!(t.event.target instanceof HTMLInputElement)){var n,i=1/e().view.zoom,r=At();if(0!==r.length)if("up"===t.key?n=new(e().Point)(0,-i):"down"===t.key?n=new(e().Point)(0,i):"left"===t.key?n=new(e().Point)(-i,0):"right"===t.key&&(n=new(e().Point)(i,0)),n){var o=Mt();if(0===o.length){var s,a=Ug(r);try{for(a.s();!(s=a.n()).done;){s.value.translate(n)}}catch(t){a.e(t)}finally{a.f()}}else{var l,c=Ug(o);try{for(c.s();!(l=c.n()).done;){var u=l.value;u.point=u.point.add(n)}}catch(t){c.e(t)}finally{c.f()}}}}}},{key:"handleKeyUp",value:function(t){0!==At().length&&("up"!==t.key&&"down"!==t.key&&"left"!==t.key&&"right"!==t.key||this.onUpdateImage())}},{key:"deactivateTool",value:function(){e().settings.handleSize=0,this.clearHoveredItem(),this.setHoveredItem=null,this.clearHoveredItem=null,this.onUpdateImage=null,this.lastEvent=null}}],[{key:"TOLERANCE",get:function(){return n.HANDLE_RADIUS+n.HANDLE_PADDING}},{key:"HANDLE_PADDING",get:function(){return 1}},{key:"HANDLE_RADIUS",get:function(){return 5.25}},{key:"DOUBLE_CLICK_MILLIS",get:function(){return 250}}])}(e().Tool),Jg=function(t){return l().createElement(ar,{imgDescriptor:lr.reshape,imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+cmVzaGFwZTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJyZXNoYXBlIj4KICAgICAgICAgICAgPGcgaWQ9InJlc2hhcGUtaWNvbiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMy4wMDAwMDAsIDIuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNNi4zNzE4LDRlLTA1IEM2LjM3MTgsMS4yMDI5ODg0NiA2LjAzODQwNjM5LDIuMzI4MTEwMDEgNS40NTg5ODMwNiwzLjI4ODA0MDc2IEM1LjMxODc2MzYyLDMuNTIwMzQyMzUgNC4zMDA3OTgxMiwzLjE1MTA3MDM0IDMuODI4MTg2MDQsMy42MTg1OTEzMSBDMy4zNTU1NzM5NSw0LjA4NjExMjI4IDMuNDc4NzM3NTksNS4zNDUyOTE0NyAzLjI2MTgxODg0LDUuNDc0ODIxODEgQzIuMzA3NTkzMDQsNi4wNDQ2MjU4OSAxLjE5MTkxMjA1LDYuMzcyMDQgLTAuMDAwMiw2LjM3MjA0IiBpZD0iU3Ryb2tlLTEiIHN0cm9rZT0iIzU3NUU3NSIgc3Ryb2tlLXdpZHRoPSIwLjc1Ij48L3BhdGg+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNNCw2Ljk0OTk5MDk0IEMyLjg1ODg3OTg0LDYuNzE4MzU1NzggMiw1LjcwOTQ3ODk2IDIsNC41IEMyLDMuMTE5Mjg4MTMgMy4xMTkyODgxMywyIDQuNSwyIEM1Ljg4MDcxMTg3LDIgNywzLjExOTI4ODEzIDcsNC41IEM3LDQuNTY4NTQyMzMgNi45OTcyNDE2Miw0LjYzNjQ0MDQyIDYuOTkxODI5ODIsNC43MDM1ODkyOSBMNi42ODEzNzc0Nyw0LjQyMDE3MzI3IEM1LjY1NzkyNzcyLDMuNDg0OTMzMjUgNCw0LjIwNDg0MDkxIDQsNS41OTU5MzIgTDQsNi45NDk5OTA5NCBaIiBpZD0iQ29tYmluZWQtU2hhcGUiIGZpbGw9IiM1NzVFNzUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik00LDcuOTY0NTU1NTcgQzIuMzAzODUyOTMsNy43MjE5NDA3NCAxLDYuMjYzMjM1OTUgMSw0LjUgQzEsMi41NjcwMDMzOCAyLjU2NzAwMzM4LDEgNC41LDEgQzYuNDMyOTk2NjIsMSA4LDIuNTY3MDAzMzggOCw0LjUgQzgsNC44NDUwODM0NSA3Ljk1MDA1OTE0LDUuMTc4NTAyNiA3Ljg1NzAxMDY1LDUuNDkzNDI0MiBMNi42ODEzNzc0Nyw0LjQyMDE3MzI3IEM1LjY1NzkyNzcyLDMuNDg0OTMzMjUgNCw0LjIwNDg0MDkxIDQsNS41OTU5MzIgTDQsNy45NjQ1NTU1NyBaIiBpZD0iT3ZhbC0yIiBmaWxsLW9wYWNpdHk9IjAuMTUiIGZpbGw9IiM1NzVFNzUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik03Ljg3OTE1MzI5LDEzLjE2ODQ1MjIgTDguOTg0Njc0MTQsMTUuNjMxNjcwMyBDOS4yMDIzNTk1NCwxNi4xMTg2NTgxIDkuNzY5ODA5MTMsMTYuMzMzNzIzOCAxMC4yNTE2NTIxLDE2LjExMzcxNDEgQzEwLjczMzQ5NTEsMTUuODkyNDY4MyAxMC45NDYyODg3LDE1LjMxODk1OTggMTAuNzI4NjAzMiwxNC44MzMyMDggTDkuNjM1ODMxODMsMTIuMzk3MzQ2MSBMMTIuMzk3NDYyOCwxMi4zOTczNDYxIEMxMi45NDU1MTIsMTIuMzk3MzQ2MSAxMy4yMDc1MTgsMTEuNzMxMzgxOCAxMi44MDQ4OTQxLDExLjM2NDQ0NjIgTDYuMDA3MTYwNjUsNS4xNTg3MDY3NCBDNS42MjI1NjQ3LDQuODA3MjU4NjQgNSw1LjA3NzY5NDk4IDUsNS41OTU5MzIgTDUsMTQuODAyNjgwNyBDNSwxNS4zNTA3MDE1IDUuNjgxNDU1OTUsMTUuNjA4MDMzIDYuMDQ4MDIzOTcsMTUuMTk5NDAwMSBMNy44NzkxNTMyOSwxMy4xNjg0NTIyIFoiIGlkPSJzZWxlY3QtaWNvbiIgZmlsbD0iIzU3NUU3NSI+PC9wYXRoPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",isSelected:t.isSelected,onMouseDown:t.onMouseDown})};Jg.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var Xg=Jg;function Kg(t){return Kg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kg(t)}function $g(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,tm(i.key),i)}}function tm(t){var e=function(t,e){if("object"!=Kg(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Kg(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Kg(e)?e:e+""}function em(t,e,n){return e=im(e),function(t,e){if(e&&("object"==Kg(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,nm()?Reflect.construct(e,n||[],im(t).constructor):e.apply(t,n))}function nm(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(nm=function(){return!!t})()}function im(t){return im=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},im(t)}function rm(t,e){return rm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},rm(t,e)}var om=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=em(this,e,[t]),m()(n,["activateTool","deactivateTool"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&rm(t,e)}(e,t),function(t,e,n){return e&&$g(t.prototype,e),n&&$g(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidMount",value:function(){this.props.isReshapeModeActive&&this.activateTool(this.props)}},{key:"componentWillReceiveProps",value:function(t){this.tool&&t.hoveredItemId!==this.props.hoveredItemId&&this.tool.setPrevHoveredItemId(t.hoveredItemId),t.isReshapeModeActive&&!this.props.isReshapeModeActive?this.activateTool():!t.isReshapeModeActive&&this.props.isReshapeModeActive&&this.deactivateTool()}},{key:"shouldComponentUpdate",value:function(t){return t.isReshapeModeActive!==this.props.isReshapeModeActive}},{key:"componentWillUnmount",value:function(){this.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){this.tool=new qg(this.props.setHoveredItem,this.props.clearHoveredItem,this.props.setSelectedItems,this.props.clearSelectedItems,this.props.onUpdateImage,this.props.switchToTextTool),this.tool.setPrevHoveredItemId(this.props.hoveredItemId),this.tool.activate()}},{key:"deactivateTool",value:function(){this.tool.deactivateTool(),this.tool.remove(),this.tool=null,this.hitResult=null}},{key:"render",value:function(){return l().createElement(Xg,{isSelected:this.props.isReshapeModeActive,onMouseDown:this.props.handleMouseDown})}}])}(l().Component);om.propTypes={clearHoveredItem:i().func.isRequired,clearSelectedItems:i().func.isRequired,handleMouseDown:i().func.isRequired,hoveredItemId:i().number,isReshapeModeActive:i().bool.isRequired,onUpdateImage:i().func.isRequired,setHoveredItem:i().func.isRequired,setSelectedItems:i().func.isRequired,switchToTextTool:i().func.isRequired};var sm=(0,c.connect)(function(t){return{isReshapeModeActive:t.scratchPaint.mode===E.RESHAPE,hoveredItemId:t.scratchPaint.hoveredItemId}},function(t){return{setHoveredItem:function(e){t(rn(e))},clearHoveredItem:function(){t(on())},clearSelectedItems:function(){t(en())},setSelectedItems:function(){t(tn(At(),!1))},handleMouseDown:function(){t(Zi(E.RESHAPE))},switchToTextTool:function(){t(Zi(E.TEXT))}}})(om);function am(t){return am="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},am(t)}function lm(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,cm(i.key),i)}}function cm(t){var e=function(t,e){if("object"!=am(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=am(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==am(e)?e:e+""}function um(t,e,n){return e=dm(e),function(t,e){if(e&&("object"==am(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,hm()?Reflect.construct(e,n||[],dm(t).constructor):e.apply(t,n))}function hm(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(hm=function(){return!!t})()}function dm(t){return dm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dm(t)}function pm(t,e){return pm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},pm(t,e)}var fm=function(t){function n(t,e,i,r,o,s,a){var l;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(l=um(this,n)).setHoveredItem=t,l.clearHoveredItem=e,l.onUpdateImage=s,l.boundingBoxTool=new jo(E.SELECT,i,r,o,s,a);var c=new Po(E.SELECT,l.boundingBoxTool,s);return l.selectionBoxTool=new ua(E.SELECT,i,r),l.selectionBoxMode=!1,l.prevHoveredItemId=null,l.active=!1,l.onMouseDown=l.handleMouseDown,l.onMouseMove=l.handleMouseMove,l.onMouseDrag=l.handleMouseDrag,l.onMouseUp=l.handleMouseUp,l.onKeyUp=c.onKeyUp,l.onKeyDown=c.onKeyDown,function(){var t,e=st(At());try{for(e.s();!(t=e.n()).done;){var n=t.value;if(F(n)){var i=V(n);mt(i,!0,!0)}var r=k(n);n!==r&&mt(r,!0,!0)}}catch(t){e.e(t)}finally{e.f()}}(),i(),l.boundingBoxTool.setSelectionBounds(),l}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&pm(t,e)}(n,t),function(t,e,n){return e&&lm(t.prototype,e),n&&lm(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"setPrevHoveredItemId",value:function(t){this.prevHoveredItemId=t}},{key:"onSelectionChanged",value:function(t){this.boundingBoxTool.onSelectionChanged(t)}},{key:"getHitOptions",value:function(t){var i={segments:!0,stroke:!0,curves:!0,fill:!0,guide:!1,tolerance:n.TOLERANCE/e().view.zoom,match:function(t){return!t.item.data||!t.item.data.isHelperItem||(t.item.data.isScaleHandle||t.item.data.isRotHandle)}};return t&&(i.selected=!0),i}},{key:"handleMouseDown",value:function(t){if(!(t.event.button>0)){this.active=!0,this.clearHoveredItem();var e=!1;this.lastEvent&&(e=t.event.timeStamp-this.lastEvent.event.timeStamp<n.DOUBLE_CLICK_MILLIS),this.lastEvent=t,this.boundingBoxTool.onMouseDown(t,t.modifiers.alt,t.modifiers.shift,e,this.getHitOptions(!1))||(this.selectionBoxMode=!0,this.selectionBoxTool.onMouseDown(t.modifiers.shift))}}},{key:"handleMouseMove",value:function(t){var e=Qu(t,this.getHitOptions());(!e&&this.prevHoveredItemId||e&&!this.prevHoveredItemId||e&&this.prevHoveredItemId&&e.id!==this.prevHoveredItemId)&&this.setHoveredItem(e?e.id:null),this.selectionBoxMode||this.boundingBoxTool.onMouseMove(t,this.getHitOptions(!1))}},{key:"handleMouseDrag",value:function(t){t.event.button>0||!this.active||(this.selectionBoxMode?this.selectionBoxTool.onMouseDrag(t):this.boundingBoxTool.onMouseDrag(t))}},{key:"handleMouseUp",value:function(t){t.event.button>0||!this.active||(this.selectionBoxMode?this.selectionBoxTool.onMouseUpVector(t):this.boundingBoxTool.onMouseUp(t,this.getHitOptions(!1)),this.selectionBoxMode=!1,this.active=!1)}},{key:"deactivateTool",value:function(){this.clearHoveredItem(),this.boundingBoxTool.deactivateTool(),this.setHoveredItem=null,this.clearHoveredItem=null,this.onUpdateImage=null,this.boundingBoxTool=null,this.selectionBoxTool=null}}],[{key:"TOLERANCE",get:function(){return 2}},{key:"DOUBLE_CLICK_MILLIS",get:function(){return 250}}])}(e().Tool),gm=fm,mm=function(t){return l().createElement(ar,{imgDescriptor:lr.select,imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+c2VsZWN0PC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9InNlbGVjdCIgZmlsbD0iIzU3NUU3NSI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik05LjA4NDgwNzA5LDEyLjc1MTkxMzEgTDEwLjI2OTI5MzcsMTUuMzkxMDc1MyBDMTAuNTAyNTI4MSwxNS45MTI4NDggMTEuMTEwNTA5OCwxNi4xNDMyNzU1IDExLjYyNjc3MDEsMTUuOTA3NTUwOCBDMTIuMTQzMDMwNCwxNS42NzA1MDE4IDEyLjM3MTAyMzYsMTUuMDU2MDI4NCAxMi4xMzc3ODkyLDE0LjUzNTU4IEwxMC45NjY5NjI3LDExLjkyNTcyOCBMMTMuOTI1ODUzLDExLjkyNTcyOCBDMTQuNTEzMDQ4NiwxMS45MjU3MjggMTQuNzkzNzY5MywxMS4yMTIxOTQ4IDE0LjM2MjM4NjUsMTAuODE5MDQ5NSBMNy4wNzkxMDA3LDQuMTcwMDQyOTQgQzYuNjY3MDMzNiwzLjc5MzQ5MTQgNiw0LjA4MzI0NDYyIDYsNC42Mzg0OTg1NyBMNiwxNC41MDI4NzIyIEM2LDE1LjA5MDAzNzMgNi43MzAxMzEzOCwxNS4zNjU3NDk2IDcuMTIyODgyODIsMTQuOTI3OTI4NyBMOS4wODQ4MDcwOSwxMi43NTE5MTMxIFoiIGlkPSJzZWxlY3QtaWNvbiI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",isSelected:t.isSelected,onMouseDown:t.onMouseDown})};mm.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var ym=mm;function vm(t){return vm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vm(t)}function bm(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Im(i.key),i)}}function Im(t){var e=function(t,e){if("object"!=vm(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=vm(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vm(e)?e:e+""}function Am(t,e,n){return e=wm(e),function(t,e){if(e&&("object"==vm(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Mm()?Reflect.construct(e,n||[],wm(t).constructor):e.apply(t,n))}function Mm(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Mm=function(){return!!t})()}function wm(t){return wm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wm(t)}function Cm(t,e){return Cm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cm(t,e)}var Tm=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=Am(this,e,[t]),m()(n,["activateTool","deactivateTool"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cm(t,e)}(e,t),function(t,e,n){return e&&bm(t.prototype,e),n&&bm(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"componentDidMount",value:function(){this.props.isSelectModeActive&&this.activateTool(this.props)}},{key:"componentWillReceiveProps",value:function(t){this.tool&&t.hoveredItemId!==this.props.hoveredItemId&&this.tool.setPrevHoveredItemId(t.hoveredItemId),this.tool&&t.selectedItems!==this.props.selectedItems&&this.tool.onSelectionChanged(t.selectedItems),t.isSelectModeActive&&!this.props.isSelectModeActive?this.activateTool():!t.isSelectModeActive&&this.props.isSelectModeActive&&this.deactivateTool()}},{key:"shouldComponentUpdate",value:function(t){return t.isSelectModeActive!==this.props.isSelectModeActive}},{key:"componentWillUnmount",value:function(){this.tool&&this.deactivateTool()}},{key:"activateTool",value:function(){this.tool=new gm(this.props.setHoveredItem,this.props.clearHoveredItem,this.props.setSelectedItems,this.props.clearSelectedItems,this.props.setCursor,this.props.onUpdateImage,this.props.switchToTextTool),this.tool.activate()}},{key:"deactivateTool",value:function(){this.tool.deactivateTool(),this.tool.remove(),this.tool=null}},{key:"render",value:function(){return l().createElement(ym,{isSelected:this.props.isSelectModeActive,onMouseDown:this.props.handleMouseDown})}}])}(l().Component);Tm.propTypes={clearHoveredItem:i().func.isRequired,clearSelectedItems:i().func.isRequired,handleMouseDown:i().func.isRequired,hoveredItemId:i().number,isSelectModeActive:i().bool.isRequired,onUpdateImage:i().func.isRequired,selectedItems:i().arrayOf(i().instanceOf(e().Item)),setCursor:i().func.isRequired,setHoveredItem:i().func.isRequired,setSelectedItems:i().func.isRequired,switchToTextTool:i().func.isRequired};var xm=(0,c.connect)(function(t){return{isSelectModeActive:t.scratchPaint.mode===E.SELECT,hoveredItemId:t.scratchPaint.hoveredItemId,selectedItems:t.scratchPaint.selectedItems}},function(t){return{setHoveredItem:function(e){t(rn(e))},clearHoveredItem:function(){t(on())},clearSelectedItems:function(){t(en())},setSelectedItems:function(){t(tn(At(),!1))},setCursor:function(e){t(oo(e))},handleMouseDown:function(){t(Zi(E.SELECT))},switchToTextTool:function(){t(Zi(E.TEXT))}}})(Tm),Sm=Uu((0,d.defineMessages)({label:{id:"paint.paintEditor.stroke",defaultMessage:"Outline"}}).label,!0),Dm=(0,c.connect)(function(t){return{colorIndex:t.scratchPaint.fillMode.colorIndex,disabled:t.scratchPaint.mode===E.BRUSH||t.scratchPaint.mode===E.TEXT||t.scratchPaint.mode===E.FILL,color:t.scratchPaint.color.strokeColor.primary,color2:t.scratchPaint.color.strokeColor.secondary,fillBitmapShapes:t.scratchPaint.fillBitmapShapes,colorModalVisible:t.scratchPaint.modals.strokeColor,format:t.scratchPaint.format,gradientType:t.scratchPaint.color.strokeColor.gradientType,isEyeDropping:t.scratchPaint.color.eyeDropper.active,mode:t.scratchPaint.mode,shouldShowGradientTools:t.scratchPaint.mode in j,textEditTarget:t.scratchPaint.textEditTarget}},function(t){return{onChangeColorIndex:function(e){t(Xl(e))},onChangeColor:function(e,n){0===n?t(xh(e)):1===n&&t(Sh(e))},onChangeStrokeWidth:function(e){t(mh(e))},onOpenColor:function(){t(oc(ic))},onCloseColor:function(){t(sc(ic))},onChangeGradientType:function(e){t(Dh(e))},setSelectedItems:function(e){t(tn(At(),M(e)))}}})(Sm),Nm=Af(qd),_m=function(t){return l().createElement(wu,{disabled:t.disabled},l().createElement(Nm,{range:!0,small:!0,disabled:t.disabled,max:gh,min:"0",type:"number",value:t.strokeWidth?t.strokeWidth:0,onSubmit:t.onChangeStrokeWidth}))};_m.propTypes={disabled:i().bool.isRequired,onChangeStrokeWidth:i().func.isRequired,strokeWidth:i().number};var Em=_m;function jm(t){return jm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jm(t)}function km(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Om(i.key),i)}}function Om(t){var e=function(t,e){if("object"!=jm(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=jm(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==jm(e)?e:e+""}function zm(t,e,n){return e=Bm(e),function(t,e){if(e&&("object"==jm(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Lm()?Reflect.construct(e,n||[],Bm(t).constructor):e.apply(t,n))}function Lm(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Lm=function(){return!!t})()}function Bm(t){return Bm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Bm(t)}function Pm(t,e){return Pm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Pm(t,e)}var Rm=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=zm(this,e,[t]),m()(n,["handleChangeStrokeWidth"]),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pm(t,e)}(e,t),function(t,e,n){return e&&km(t.prototype,e),n&&km(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"handleChangeStrokeWidth",value:function(t){var e=zi(t,this.props.textEditTarget);if((!this.props.strokeWidth||0===this.props.strokeWidth)&&t>0){var n=Bi(At(),M(this.props.format));null===n.strokeColor&&(null===n.strokeColor2||n.strokeGradientType===ci.SOLID)?(e=Oi("#000",0,!0,!0,this.props.textEditTarget)||e,this.props.onChangeStrokeGradientType(ci.SOLID),this.props.onChangeStrokeColor("#000")):n.strokeColor!==Di&&(this.props.onChangeStrokeGradientType(n.strokeGradientType),this.props.onChangeStrokeColor(lc()(n.strokeColor).hex),this.props.onChangeStrokeColor2(lc()(n.strokeColor2).hex))}this.props.onChangeStrokeWidth(t),e&&this.props.onUpdateImage()}},{key:"render",value:function(){return l().createElement(Em,{disabled:this.props.disabled,strokeWidth:this.props.strokeWidth,onChangeStrokeWidth:this.handleChangeStrokeWidth})}}])}(l().Component);Rm.propTypes={disabled:i().bool.isRequired,format:i().oneOf(Object.keys(I)),onChangeStrokeColor:i().func.isRequired,onChangeStrokeColor2:i().func.isRequired,onChangeStrokeGradientType:i().func.isRequired,onChangeStrokeWidth:i().func.isRequired,onUpdateImage:i().func.isRequired,strokeWidth:i().number,textEditTarget:i().number};var Um=(0,c.connect)(function(t){return{disabled:t.scratchPaint.mode===E.BRUSH||t.scratchPaint.mode===E.TEXT||t.scratchPaint.mode===E.FILL,format:t.scratchPaint.format,strokeWidth:t.scratchPaint.color.strokeWidth,textEditTarget:t.scratchPaint.textEditTarget}},function(t){return{onChangeStrokeColor:function(e){t(xh(e))},onChangeStrokeColor2:function(e){t(Sh(e))},onChangeStrokeGradientType:function(e){t(Dh(e))},onChangeStrokeWidth:function(e){t(mh(e))}}})(Rm);function Gm(t){return Gm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gm(t)}function Ym(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Zm(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Zm(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Zm(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function Wm(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Qm(i.key),i)}}function Qm(t){var e=function(t,e){if("object"!=Gm(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Gm(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Gm(e)?e:e+""}function Hm(t,e,n){return e=Vm(e),function(t,e){if(e&&("object"==Gm(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Fm()?Reflect.construct(e,n||[],Vm(t).constructor):e.apply(t,n))}function Fm(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Fm=function(){return!!t})()}function Vm(t){return Vm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vm(t)}function qm(t,e){return qm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qm(t,e)}var Jm=function(t){function n(t,e,i,r,o,s,a,l){var c;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(c=Hm(this,n)).element=t,c.setSelectedItems=e,c.clearSelectedItems=i,c.onUpdateImage=o,c.setTextEditTarget=s,c.changeFont=a;var u=l?E.BIT_TEXT:E.TEXT;return c.boundingBoxTool=new jo(u,e,i,r,o),c.nudgeTool=new Po(u,c.boundingBoxTool,o),c.isBitmap=l,c.onMouseDown=c.handleMouseDown,c.onMouseDrag=c.handleMouseDrag,c.onMouseUp=c.handleMouseUp,c.onMouseMove=c.handleMouseMove,c.onKeyUp=c.handleKeyUp,c.onKeyDown=c.handleKeyDown,c.textBox=null,c.guide=null,c.colorState=null,c.mode=null,c.active=!1,c.lastTypeEvent=null,c.lastEvent=null,c}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&qm(t,e)}(n,t),function(t,e,n){return e&&Wm(t.prototype,e),n&&Wm(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"getBoundingBoxHitOptions",value:function(){return{segments:!0,stroke:!0,curves:!0,fill:!0,guide:!1,match:function(t){return t.item.data&&(t.item.data.isScaleHandle||t.item.data.isRotHandle)||t.item.selected},tolerance:n.TOLERANCE/e().view.zoom}}},{key:"getTextEditHitOptions",value:function(){return{class:e().PointText,segments:!0,stroke:!0,curves:!0,fill:!0,guide:!1,match:function(t){return t.item&&!(t.item.data&&t.item.data.isHelperItem)&&!t.item.selected},tolerance:n.TOLERANCE/e().view.zoom}}},{key:"onSelectionChanged",value:function(t){this.boundingBoxTool.onSelectionChanged(t),(!this.textBox||!this.textBox.parent)&&t&&1===t.length&&t[0]instanceof e().PointText&&(this.textBox=t[0],this.mode=n.SELECT_MODE)}},{key:"setFont",value:function(t){this.font=t,this.textBox&&(this.textBox.font=t);var n,i=Ym(At());try{for(i.s();!(n=i.n()).done;){var r=n.value;r instanceof e().PointText&&(r.font=t)}}catch(t){i.e(t)}finally{i.f()}this.element.style.fontFamily=t,this.setSelectedItems()}},{key:"onTextEditCancelled",value:function(){this.mode===n.TEXT_EDIT_MODE&&(this.endTextEdit(),this.beginSelect())}},{key:"onViewBoundsChanged",value:function(t){this.mode===n.TEXT_EDIT_MODE&&this.calculateMatrix(t)}},{key:"calculateMatrix",value:function(t){var n=this.textBox.matrix,i=new(e().Matrix),r=0;this.rtl&&this.element.parentElement&&(r=-this.element.parentElement.clientWidth),this.element.style.transformOrigin="".concat(-this.textBox.internalBounds.x,"px ").concat(-this.textBox.internalBounds.y,"px"),i.translate(r,this.textBox.internalBounds.y),i.append(t),i.append(n),this.element.style.transform="matrix(".concat(i.a,", ").concat(i.b,", ").concat(i.c,", ").concat(i.d,",\n ").concat(i.tx,", ").concat(i.ty,")")}},{key:"setColorState",value:function(t){this.colorState=t}},{key:"setRtl",value:function(t){this.rtl=t}},{key:"handleMouseMove",value:function(t){e().project.hitTestAll(t.point,this.getTextEditHitOptions()).length?document.body.style.cursor="text":document.body.style.cursor="auto",this.boundingBoxTool.onMouseMove(t,this.getBoundingBoxHitOptions())}},{key:"handleMouseDown",value:function(t){if(!(t.event.button>0)){this.active=!0;var i=this.lastEvent&&t.event.timeStamp-this.lastEvent.event.timeStamp<n.DOUBLE_CLICK_MILLIS;if(this.lastEvent=t,i&&this.mode===n.SELECT_MODE&&this.textBox.hitTest(t.point))return this.endSelect(),this.beginTextEdit(this.textBox),void this.element.select();if(!this.boundingBoxTool.onMouseDown(t,!1,!1,!1,this.getBoundingBoxHitOptions())){var r=this.mode;this.mode===n.SELECT_MODE?(this.endSelect(),this.isBitmap&&this.commitText()):this.mode===n.TEXT_EDIT_MODE&&this.endTextEdit();var o=e().project.hitTestAll(t.point,this.getTextEditHitOptions());o.length?this.beginTextEdit(o[0].item):r===n.TEXT_EDIT_MODE?this.beginSelect():(this.textBox=new(e().PointText)({point:t.point,content:"",font:this.font,fontSize:40,fillColor:this.colorState.fillColor.primary,leading:46.15}),this.beginTextEdit(this.textBox))}}}},{key:"handleMouseDrag",value:function(t){t.event.button>0||!this.active||this.mode!==n.SELECT_MODE||this.boundingBoxTool.onMouseDrag(t)}},{key:"handleMouseUp",value:function(t){if(!(t.event.button>0)&&this.active)return this.mode===n.SELECT_MODE?(this.boundingBoxTool.onMouseUp(t),void(this.isBoundingBoxMode=null)):void(this.active=!1)}},{key:"handleKeyUp",value:function(t){t.event.target instanceof HTMLInputElement||this.mode===n.SELECT_MODE&&this.nudgeTool.onKeyUp(t)}},{key:"handleKeyDown",value:function(t){t.event.target instanceof HTMLInputElement||(this.mode===n.TEXT_EDIT_MODE&&"escape"===t.key&&this.endTextEdit(),this.mode===n.SELECT_MODE&&this.nudgeTool.onKeyDown(t))}},{key:"handleTextInput",value:function(t){this.lastTypeEvent&&t.timeStamp-this.lastTypeEvent.timeStamp>n.TYPING_TIMEOUT_MILLIS&&(this.textBox.selected=!0,this.onUpdateImage(),this.textBox.selected=!1),this.lastTypeEvent=t,this.mode===n.TEXT_EDIT_MODE&&(this.textBox.content=this.element.value),this.resizeGuide()}},{key:"resizeGuide",value:function(){this.guide&&this.guide.remove(),this.guide=jt(this.textBox,n.TEXT_PADDING),this.guide.dashArray=[4,4],this.element.style.width="".concat(this.textBox.internalBounds.width+1,"px"),this.element.style.height="".concat(this.textBox.internalBounds.height,"px"),this.rtl&&(this.element.style.transformOrigin="".concat(-this.textBox.internalBounds.x,"px ").concat(-this.textBox.internalBounds.y,"px"))}},{key:"beginSelect",value:function(){this.textBox&&(this.mode=n.SELECT_MODE,this.textBox.selected=!0,this.setSelectedItems())}},{key:"endSelect",value:function(){bt(this.clearSelectedItems),this.mode=null}},{key:"beginTextEdit",value:function(t){this.textBox=t,this.mode=n.TEXT_EDIT_MODE,this.setTextEditTarget(this.textBox.id),this.font!==this.textBox.font&&this.changeFont(this.textBox.font),this.element.style.fontSize="".concat(this.textBox.fontSize,"px"),this.element.style.lineHeight=this.textBox.leading/this.textBox.fontSize,this.element.style.display="initial",this.element.value=t.content?t.content:"",this.calculateMatrix(e().view.matrix),this.rtl?this.textBox.justification="right":this.textBox.justification="left",this.element.focus({preventScroll:!0}),this.eventListener=this.handleTextInput.bind(this),this.element.addEventListener("input",this.eventListener),this.resizeGuide()}},{key:"endTextEdit",value:function(){this.mode===n.TEXT_EDIT_MODE&&(this.mode=null,this.textBox&&""===this.textBox.content.trim()&&(this.textBox.remove(),this.textBox=null),this.guide&&(this.guide.remove(),this.guide=null,this.setTextEditTarget()),this.element.style.display="none",this.eventListener&&(this.element.removeEventListener("input",this.eventListener),this.eventListener=null),this.textBox&&this.lastTypeEvent&&(this.textBox.selected=!0,this.onUpdateImage(),this.textBox.selected=!1,this.lastTypeEvent=null))}},{key:"commitText",value:function(){if(this.textBox&&this.textBox.parent){var t=this.textBox.rasterize(72,!1,this.textBox.drawnBounds);this.textBox.remove(),this.textBox=null,Ee().drawImage(t.canvas,new(e().Point)(Math.floor(t.bounds.x),Math.floor(t.bounds.y))),this.onUpdateImage()}}},{key:"deactivateTool",value:function(){this.textBox&&""===this.textBox.content.trim()&&(this.textBox.remove(),this.textBox=null),this.endTextEdit(),this.isBitmap&&this.commitText(),this.boundingBoxTool.deactivateTool()}}],[{key:"TOLERANCE",get:function(){return 2}},{key:"TEXT_EDIT_MODE",get:function(){return"TEXT_EDIT_MODE"}},{key:"SELECT_MODE",get:function(){return"SELECT_MODE"}},{key:"DOUBLE_CLICK_MILLIS",get:function(){return 250}},{key:"TYPING_TIMEOUT_MILLIS",get:function(){return 1e3}},{key:"TEXT_PADDING",get:function(){return 8}}])}(e().Tool),Xm=Jm,Km=function(t){return l().createElement(ar,{imgDescriptor:lr.text,imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0My4yICgzOTA2OSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+dGV4dDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJ0ZXh0IiBmaWxsPSIjNTc1RTc1Ij4KICAgICAgICAgICAgPHBhdGggZD0iTTE2LDQuMzUyOTQxMTggTDE2LDYuODUxNzY0NzEgQzE2LDcuMDQ5NDExNzYgMTUuODQ0NzA1OSw3LjIwNDcwNTg4IDE1LjY0NzA1ODgsNy4yMDQ3MDU4OCBMMTQuODk4ODIzNSw3LjIwNDcwNTg4IEMxNC43NTc2NDcxLDcuMjA0NzA1ODggMTQuNjE2NDcwNiw3LjEyIDE0LjU3NDExNzYsNi45OTI5NDExOCBMMTQuMjA3MDU4OCw2LjExNzY0NzA2IEwxMS4wNTg4MjM1LDYuMTE3NjQ3MDYgTDExLjA1ODgyMzUsMTQuMjkxNzY0NyBMMTEuOTIsMTQuNjE2NDcwNiBDMTIuMDYxMTc2NSwxNC42NzI5NDEyIDEyLjE2LDE0LjggMTIuMTYsMTQuOTU1Mjk0MSBMMTIuMTYsMTUuNjQ3MDU4OCBDMTIuMTYsMTUuODQ0NzA1OSAxMS45OTA1ODgyLDE2IDExLjgwNzA1ODgsMTYgTDguMjA3MDU4ODIsMTYgQzguMDIzNTI5NDEsMTYgNy44NTQxMTc2NSwxNS44NDQ3MDU5IDcuODU0MTE3NjUsMTUuNjQ3MDU4OCBMNy44NTQxMTc2NSwxNC45NTUyOTQxIEM3Ljg1NDExNzY1LDE0LjggNy45NTI5NDExOCwxNC42NzI5NDEyIDguMDgsMTQuNjE2NDcwNiBMOC45NDExNzY0NywxNC4yOTE3NjQ3IEw4Ljk0MTE3NjQ3LDYuMTE3NjQ3MDYgTDUuODA3MDU4ODIsNi4xMTc2NDcwNiBMNS40NCw2Ljk5Mjk0MTE4IEM1LjM4MzUyOTQxLDcuMTIgNS4yNTY0NzA1OSw3LjIwNDcwNTg4IDUuMTE1Mjk0MTIsNy4yMDQ3MDU4OCBMNC4zNTI5NDExOCw3LjIwNDcwNTg4IEM0LjE2OTQxMTc2LDcuMjA0NzA1ODggNCw3LjA0OTQxMTc2IDQsNi44NTE3NjQ3MSBMNCw0LjM1Mjk0MTE4IEM0LDQuMTU1Mjk0MTIgNC4xNjk0MTE3Niw0IDQuMzUyOTQxMTgsNCBMMTUuNjQ3MDU4OCw0IEMxNS44NDQ3MDU5LDQgMTYsNC4xNTUyOTQxMiAxNiw0LjM1Mjk0MTE4IiBpZD0idGV4dC1pY29uIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",isSelected:t.isSelected,onMouseDown:t.onMouseDown})};Km.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var $m=Km,ty=function(t){return l().createElement(ar,{imgDescriptor:lr.text,imgSrc:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDQ5LjMgKDUxMTY3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT50ZXh0PC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9InRleHQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwb2x5Z29uIGlkPSJQYWdlLTEiIGZpbGw9IiM1NzVFNzUiIHBvaW50cz0iNCA0IDQgOCA2IDggNiA2IDkgNiA5IDE0IDcgMTQgNyAxNiAxMyAxNiAxMyAxNCAxMSAxNCAxMSA2IDE0IDYgMTQgOCAxNiA4IDE2IDQiPjwvcG9seWdvbj4KICAgIDwvZz4KPC9zdmc+",isSelected:t.isSelected,onMouseDown:t.onMouseDown})};ty.propTypes={isSelected:i().bool.isRequired,onMouseDown:i().func.isRequired};var ey=ty;function ny(t){return ny="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ny(t)}function iy(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,ry(i.key),i)}}function ry(t){var e=function(t,e){if("object"!=ny(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=ny(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ny(e)?e:e+""}function oy(t,e,n){return e=ay(e),function(t,e){if(e&&("object"==ny(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,sy()?Reflect.construct(e,n||[],ay(t).constructor):e.apply(t,n))}function sy(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(sy=function(){return!!t})()}function ay(t){return ay=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ay(t)}function ly(t,e){return ly=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ly(t,e)}var cy=function(t){function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e=oy(this,n,[t]),m()(e,["activateTool","deactivateTool"]),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ly(t,e)}(n,t),function(t,e,n){return e&&iy(t.prototype,e),n&&iy(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"componentDidMount",value:function(){this.props.isTextModeActive&&this.activateTool(this.props)}},{key:"componentWillReceiveProps",value:function(t){this.tool&&(t.colorState!==this.props.colorState&&this.tool.setColorState(t.colorState),t.selectedItems!==this.props.selectedItems&&this.tool.onSelectionChanged(t.selectedItems),!t.textEditTarget&&this.props.textEditTarget&&this.tool.onTextEditCancelled(),t.viewBounds.equals(this.props.viewBounds)||this.tool.onViewBoundsChanged(t.viewBounds),t.font!==this.props.font&&this.tool.setFont(t.font),t.rtl!==this.props.rtl&&this.tool.setRtl(t.rtl)),t.isTextModeActive&&!this.props.isTextModeActive?this.activateTool(t):!t.isTextModeActive&&this.props.isTextModeActive&&this.deactivateTool()}},{key:"shouldComponentUpdate",value:function(t){return t.isTextModeActive!==this.props.isTextModeActive}},{key:"componentWillUnmount",value:function(){this.tool&&this.deactivateTool()}},{key:"activateTool",value:function(t){var n=At(),i=null;1===n.length&&n[0]instanceof e().PointText&&(i=n[0]),bt(this.props.clearSelectedItems),this.props.clearGradient();var r=t.colorState.strokeWidth,o=t.colorState.fillColor.primary,s=t.colorState.strokeColor.primary,a=o!==Di&&null!==o,l=!t.isBitmap&&(s!==Di&&null!==s&&null!==r&&0!==r);a||l?!a&&l?this.props.onChangeFillColor(null):a&&!l&&this.props.onChangeStrokeColor(null):(this.props.onChangeFillColor(Ai),this.props.onChangeStrokeColor(null)),(!t.font||Object.keys(Qp).map(function(t){return Qp[t]}).indexOf(t.font)<0)&&this.props.changeFont(Qp.SANS_SERIF),this.tool=new Xm(this.props.textArea,this.props.setSelectedItems,this.props.clearSelectedItems,this.props.setCursor,this.props.onUpdateImage,this.props.setTextEditTarget,this.props.changeFont,t.isBitmap),this.tool.setRtl(this.props.rtl),this.tool.setColorState(t.colorState),this.tool.setFont(t.font),this.tool.activate(),i&&(this.tool.beginTextEdit(i),this.props.textArea.select())}},{key:"deactivateTool",value:function(){this.tool.deactivateTool(),this.tool.remove(),this.tool=null}},{key:"render",value:function(){return this.props.isBitmap?l().createElement(ey,{isSelected:this.props.isTextModeActive,onMouseDown:this.props.handleChangeModeBitText}):l().createElement($m,{isSelected:this.props.isTextModeActive,onMouseDown:this.props.handleChangeModeText})}}])}(l().Component);cy.propTypes={changeFont:i().func.isRequired,clearGradient:i().func.isRequired,clearSelectedItems:i().func.isRequired,colorState:i().shape({fillColor:Xr,strokeColor:Xr,strokeWidth:i().number}).isRequired,font:i().string,handleChangeModeBitText:i().func.isRequired,handleChangeModeText:i().func.isRequired,isBitmap:i().bool,isTextModeActive:i().bool.isRequired,onChangeFillColor:i().func.isRequired,onChangeStrokeColor:i().func.isRequired,onUpdateImage:i().func.isRequired,rtl:i().bool,selectedItems:i().arrayOf(i().instanceOf(e().Item)),setCursor:i().func.isRequired,setSelectedItems:i().func.isRequired,setTextEditTarget:i().func.isRequired,textArea:i().instanceOf(Element),textEditTarget:i().number,viewBounds:i().instanceOf(e().Matrix).isRequired};var uy=(0,c.connect)(function(t,e){return{colorState:t.scratchPaint.color,font:t.scratchPaint.font,isTextModeActive:e.isBitmap?t.scratchPaint.mode===E.BIT_TEXT:t.scratchPaint.mode===E.TEXT,rtl:t.scratchPaint.layout.rtl,selectedItems:t.scratchPaint.selectedItems,textEditTarget:t.scratchPaint.textEditTarget,viewBounds:t.scratchPaint.viewBounds}},function(t,e){return{changeFont:function(e){t(tf(e))},clearSelectedItems:function(){t(en())},clearGradient:function(){t(Ti())},handleChangeModeBitText:function(){t(Zi(E.BIT_TEXT))},handleChangeModeText:function(){t(Zi(E.TEXT))},setCursor:function(e){t(oo(e))},setSelectedItems:function(){t(tn(At(),e.isBitmap))},setTextEditTarget:function(e){t(dp(e))},onChangeFillColor:function(e){t(wi(e))},onChangeStrokeColor:function(e){t(xh(e))}}})(cy),hy=p(31),dy=p.n(hy),py={};py.styleTagTransform=En(),py.setAttributes=Sn(),py.insert=Tn().bind(null,"head"),py.domAPI=wn(),py.insertStyleElement=Nn();An()(dy(),py);var fy=dy()&&dy().locals?dy().locals:void 0,gy="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMjBweCIgdmlld0JveD0iMCAwIDIwIDIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCA0Ny4xICg0NTQyMikgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+Yml0bWFwPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9ImJpdG1hcCIgZmlsbD0iI0ZGRkZGRiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik00LDMgTDE2LDMgTDE2LDQgTDQsNCBMNCwzIFogTTIsNSBMMyw1IEwzLDEzIEwyLDEzIEwyLDUgWiBNMTcsNSBMMTgsNSBMMTgsMTMgTDE3LDEzIEwxNyw1IFogTTIsMTMgTDE4LDEzIEwxOCwxNSBMMiwxNSBMMiwxMyBaIE00LDEyIEwxNiwxMiBMMTYsMTMgTDQsMTMgTDQsMTIgWiBNNSwxMSBMOCwxMSBMOCwxMiBMNSwxMiBMNSwxMSBaIE02LDEwIEw3LDEwIEw3LDExIEw2LDExIEw2LDEwIFogTTksMTEgTDE2LDExIEwxNiwxMiBMOSwxMiBMOSwxMSBaIE0xMCwxMCBMMTUsMTAgTDE1LDExIEwxMCwxMSBMMTAsMTAgWiBNMTEsOSBMMTQsOSBMMTQsMTAgTDExLDEwIEwxMSw5IFogTTEyLDggTDEzLDggTDEzLDkgTDEyLDkgTDEyLDggWiBNMTYsMTIgTDE3LDEyIEwxNywxMyBMMTYsMTMgTDE2LDEyIFogTTMsMTUgTDE3LDE1IEwxNywxNiBMMywxNiBMMywxNSBaIE0zLDQgTDQsNCBMNCw1IEwzLDUgTDMsNCBaIE0xNiw0IEwxNyw0IEwxNyw1IEwxNiw1IEwxNiw0IFogTTQsMTYgTDE2LDE2IEwxNiwxNyBMNCwxNyBMNCwxNiBaIiBpZD0iQ29tYmluZWQtU2hhcGUiPjwvcGF0aD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg==",my=(0,d.defineMessages)({bitmap:{id:"paint.paintEditor.bitmap",defaultMessage:"Convert to Bitmap"},vector:{id:"paint.paintEditor.vector",defaultMessage:"Convert to Vector"}}),yy=function(t){var n=(0,d.useIntl)();return l().createElement("div",{className:fy.editorContainer,dir:t.rtl?"rtl":"ltr"},null!==t.canvas?l().createElement("div",{className:fy.editorContainerTop},l().createElement("div",{className:fy.row},l().createElement(Tp,{canRedo:t.canRedo,canUndo:t.canUndo,name:t.name,onRedo:t.onRedo,onUndo:t.onUndo,onUpdateImage:t.onUpdateImage,onUpdateName:t.onUpdateName})),A(t.format)?l().createElement("div",{className:fy.row},l().createElement(wu,{className:h()(fy.row,fy.modDashedBorder,fy.modLabeledIconHeight)},l().createElement(Yu,{className:fy.modMarginAfter,onUpdateImage:t.onUpdateImage}),l().createElement(Dm,{onUpdateImage:t.onUpdateImage}),l().createElement(Um,{onUpdateImage:t.onUpdateImage})),l().createElement(wu,{className:fy.modModeTools},l().createElement(Uf,{onUpdateImage:t.onUpdateImage}))):M(t.format)?l().createElement("div",{className:fy.row},l().createElement(wu,{className:h()(fy.row,fy.modDashedBorder,fy.modLabeledIconHeight)},l().createElement(Yu,{className:fy.modMarginAfter,onUpdateImage:t.onUpdateImage})),l().createElement(wu,{className:fy.modModeTools},l().createElement(Uf,{onUpdateImage:t.onUpdateImage}))):null):null,l().createElement("div",{className:fy.topAlignRow},null!==t.canvas&&A(t.format)?l().createElement("div",{className:fy.modeSelector},l().createElement(xm,{onUpdateImage:t.onUpdateImage}),l().createElement(sm,{onUpdateImage:t.onUpdateImage}),l().createElement(El,{onUpdateImage:t.onUpdateImage}),l().createElement(ql,{onUpdateImage:t.onUpdateImage}),l().createElement(hh,{onUpdateImage:t.onUpdateImage}),l().createElement(uy,{textArea:t.textArea,onUpdateImage:t.onUpdateImage}),l().createElement(Uh,{onUpdateImage:t.onUpdateImage}),l().createElement(sg,{onUpdateImage:t.onUpdateImage}),l().createElement(xg,{onUpdateImage:t.onUpdateImage})):null,null!==t.canvas&&M(t.format)?l().createElement("div",{className:fy.modeSelector},l().createElement(Nr,{onUpdateImage:t.onUpdateImage}),l().createElement(Jr,{onUpdateImage:t.onUpdateImage}),l().createElement(os,{onUpdateImage:t.onUpdateImage}),l().createElement(xs,{onUpdateImage:t.onUpdateImage}),l().createElement(uy,{isBitmap:!0,textArea:t.textArea,onUpdateImage:t.onUpdateImage}),l().createElement(Fs,{onUpdateImage:t.onUpdateImage}),l().createElement(oa,{onUpdateImage:t.onUpdateImage}),l().createElement(Na,{onUpdateImage:t.onUpdateImage})):null,l().createElement("div",{className:fy.controlsContainer},l().createElement(li,{canvas:t.canvas,hideScrollbars:t.isEyeDropping,style:fy.canvasContainer},l().createElement(Hn,{canvasRef:t.setCanvas,image:t.image,imageFormat:t.imageFormat,imageId:t.imageId,rotationCenterX:t.rotationCenterX,rotationCenterY:t.rotationCenterY,zoomLevelId:t.zoomLevelId,onUpdateImage:t.onUpdateImage}),l().createElement("textarea",{className:fy.textArea,ref:t.setTextArea,spellCheck:!1}),t.isEyeDropping&&null!==t.colorInfo&&!t.colorInfo.hideLoupe?l().createElement(Ya,{className:fy.colorPickerWrapper},l().createElement(ud,{colorInfo:t.colorInfo,pixelRatio:e().project.view.pixelRatio})):null),l().createElement("div",{className:fy.canvasControls},A(t.format)?l().createElement($i,{className:fy.bitmapButton,onClick:t.onSwitchToBitmap},l().createElement("img",{className:fy.bitmapButtonIcon,draggable:!1,src:gy}),l().createElement("span",{className:fy.buttonText},n.formatMessage(my.bitmap))):M(t.format)?l().createElement($i,{className:fy.bitmapButton,onClick:t.onSwitchToVector},l().createElement("img",{className:fy.bitmapButtonIcon,draggable:!1,src:gy}),l().createElement("span",{className:fy.buttonText},n.formatMessage(my.vector))):null,l().createElement(wu,{className:fy.zoomControls},l().createElement(Va,null,l().createElement($i,{className:fy.buttonGroupButton,onClick:t.onZoomOut},l().createElement("img",{alt:"Zoom Out",className:fy.buttonGroupButtonIcon,draggable:!1,src:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB2aWV3Qm94PSI2IDYgMjQgMjQiPgo8ZGVmcz4KICAgIDxzdHlsZT4KICAgICAgICAuY2xzLTR7ZmlsbDpub25lO3N0cm9rZTojNTc1ZTc1O3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2Utd2lkdGg6MS41cHg7fQogICAgPC9zdHlsZT4KPC9kZWZzPgo8dGl0bGU+em9vbS1vdXQ8L3RpdGxlPgo8ZyBjbGFzcz0iY2xzLTMiPgogICAgPGNpcmNsZSBjbGFzcz0iY2xzLTQiIGN4PSIxOCIgY3k9IjE4IiByPSI3Ii8+CiAgICA8bGluZSBjbGFzcz0iY2xzLTQiIHgxPSIyMyIgeTE9IjIzIiB4Mj0iMjYiIHkyPSIyNiIvPgogICAgPGxpbmUgY2xhc3M9ImNscy00IiB4MT0iMTYiIHkxPSIxOCIgeDI9IjIwIiB5Mj0iMTgiLz4KPC9nPgo8L3N2Zz4K"})),l().createElement($i,{className:fy.buttonGroupButton,onClick:t.onZoomReset},l().createElement("img",{alt:"Zoom Reset",className:fy.buttonGroupButtonIcon,draggable:!1,src:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB2aWV3Qm94PSI2IDYgMjQgMjQiPgo8ZGVmcz4KICAgIDxzdHlsZT4KICAgICAgICAuY2xzLTR7ZmlsbDojNTc1ZTc1O30KICAgIDwvc3R5bGU+CjwvZGVmcz4KPHRpdGxlPnpvb20tcmVzZXQ8L3RpdGxlPgo8ZyBjbGFzcz0iY2xzLTMiPgogICAgPHJlY3QgY2xhc3M9ImNscy00IiB4PSIxMyIgeT0iMTQiIHdpZHRoPSIxMCIgaGVpZ2h0PSIyIiByeD0iMSIgcnk9IjEiLz4KICAgIDxyZWN0IGNsYXNzPSJjbHMtNCIgeD0iMTMiIHk9IjIwIiB3aWR0aD0iMTAiIGhlaWdodD0iMiIgcng9IjEiIHJ5PSIxIi8+CjwvZz4KPC9zdmc+Cg=="})),l().createElement($i,{className:fy.buttonGroupButton,onClick:t.onZoomIn},l().createElement("img",{alt:"Zoom In",className:fy.buttonGroupButtonIcon,draggable:!1,src:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB2aWV3Qm94PSI2IDYgMjQgMjQiPgo8ZGVmcz4KICAgIDxzdHlsZT4KICAgICAgICAuY2xzLTR7ZmlsbDpub25lO3N0cm9rZTojNTc1ZTc1O3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2Utd2lkdGg6MS41cHg7fQogICAgPC9zdHlsZT4KPC9kZWZzPgo8dGl0bGU+em9vbS1pbjwvdGl0bGU+CjxnIGNsYXNzPSJjbHMtMyI+CiAgICA8Y2lyY2xlIGNsYXNzPSJjbHMtNCIgY3g9IjE4IiBjeT0iMTgiIHI9IjciLz4KICAgIDxsaW5lIGNsYXNzPSJjbHMtNCIgeDE9IjIzIiB5MT0iMjMiIHgyPSIyNiIgeTI9IjI2Ii8+CiAgICA8bGluZSBjbGFzcz0iY2xzLTQiIHgxPSIxNiIgeTE9IjE4IiB4Mj0iMjAiIHkyPSIxOCIvPgogICAgPGxpbmUgY2xhc3M9ImNscy00IiB4MT0iMTgiIHkxPSIxNiIgeDI9IjE4IiB5Mj0iMjAiLz4KPC9nPgo8L3N2Zz4K"}))))))))};yy.propTypes={canRedo:i().func.isRequired,canUndo:i().func.isRequired,canvas:i().instanceOf(Element),colorInfo:ud.propTypes.colorInfo,format:i().oneOf(Object.keys(I)),image:i().oneOfType([i().string,i().instanceOf(HTMLImageElement)]),imageFormat:i().string,imageId:i().string,isEyeDropping:i().bool,name:i().string,onRedo:i().func.isRequired,onSwitchToBitmap:i().func.isRequired,onSwitchToVector:i().func.isRequired,onUndo:i().func.isRequired,onUpdateImage:i().func.isRequired,onUpdateName:i().func.isRequired,onZoomIn:i().func.isRequired,onZoomOut:i().func.isRequired,onZoomReset:i().func.isRequired,rotationCenterX:i().number,rotationCenterY:i().number,rtl:i().bool,setCanvas:i().func.isRequired,setTextArea:i().func.isRequired,textArea:i().instanceOf(Element),zoomLevelId:i().string};var vy=yy;function by(t){return by="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},by(t)}function Iy(){return Iy=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Iy.apply(null,arguments)}function Ay(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,My(i.key),i)}}function My(t){var e=function(t,e){if("object"!=by(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=by(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==by(e)?e:e+""}function wy(t,e,n){return e=Ty(e),function(t,e){if(e&&("object"==by(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Cy()?Reflect.construct(e,n||[],Ty(t).constructor):e.apply(t,n))}function Cy(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Cy=function(){return!!t})()}function Ty(t){return Ty=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ty(t)}function xy(t,e){return xy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},xy(t,e)}var Sy=function(t){var e=function(e){function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e=wy(this,n,[t]),m()(e,["handleKeyPress","changeToASelectMode","selectAll"]),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&xy(t,e)}(n,e),function(t,e,n){return e&&Ay(t.prototype,e),n&&Ay(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"handleKeyPress",value:function(t){if(!(t.target instanceof HTMLInputElement||this.props.textEditing))if("Escape"===t.key)t.preventDefault(),bt(this.props.clearSelectedItems);else if("Delete"===t.key||"Backspace"===t.key)t.preventDefault(),Ct(this.props.mode,this.props.onUpdateImage)&&this.props.setSelectedItems(this.props.format);else if(t.metaKey||t.ctrlKey)if(t.shiftKey&&"z"===t.key.toLowerCase())this.props.onRedo();else if("z"===t.key)this.props.onUndo();else if(t.shiftKey&&"g"===t.key.toLowerCase())Q()&&Z(en,tn,this.props.onUpdateImage),t.preventDefault();else if("g"===t.key)W()&&U(en,tn,this.props.onUpdateImage),t.preventDefault();else if("c"===t.key)this.props.onCopyToClipboard();else if("v"===t.key)this.changeToASelectMode(),this.props.onPasteFromClipboard();else if("x"===t.key){It().length>0&&(this.props.onCopyToClipboard(),Ct(this.props.mode,this.props.onUpdateImage)&&this.props.setSelectedItems(this.props.format)),t.preventDefault()}else"a"===t.key&&(this.changeToASelectMode(),t.preventDefault(),this.selectAll())}},{key:"changeToASelectMode",value:function(){M(this.props.format)?this.props.mode!==E.BIT_SELECT&&this.props.changeMode(E.BIT_SELECT):this.props.mode!==E.SELECT&&this.props.mode!==E.RESHAPE&&this.props.changeMode(E.SELECT)}},{key:"selectAll",value:function(){M(this.props.format)?(se(this.props.clearSelectedItems),this.props.setSelectedItems(this.props.format)):this.props.mode===E.RESHAPE?vt()&&this.props.setSelectedItems(this.props.format):yt()&&this.props.setSelectedItems(this.props.format)}},{key:"render",value:function(){var e=Sp()(this.props,["changeMode","clearSelectedItems","format","mode","onCopyToClipboard","onPasteFromClipboard","setSelectedItems","textEditing"]);return l().createElement(t,Iy({onKeyPress:this.handleKeyPress},e))}}])}(l().Component);e.propTypes={changeMode:i().func.isRequired,clearSelectedItems:i().func.isRequired,format:i().oneOf(Object.keys(I)),mode:i().oneOf(Object.keys(E)).isRequired,onCopyToClipboard:i().func.isRequired,onPasteFromClipboard:i().func.isRequired,onRedo:i().func.isRequired,onUndo:i().func.isRequired,onUpdateImage:i().func.isRequired,setSelectedItems:i().func.isRequired,textEditing:i().bool.isRequired};return Pp((0,c.connect)(function(t){return{mode:t.scratchPaint.mode,format:t.scratchPaint.format,textEditing:null!==t.scratchPaint.textEditTarget}},function(t){return{changeMode:function(e){t(Zi(e))},clearSelectedItems:function(){t(en())},setSelectedItems:function(e){t(tn(At(),M(e)))}}})(e))};function Dy(t){return Dy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dy(t)}var Ny=["hoveredItemId"];function _y(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Ey(i.key),i)}}function Ey(t){var e=function(t,e){if("object"!=Dy(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Dy(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Dy(e)?e:e+""}function jy(t,e,n){return e=Oy(e),function(t,e){if(e&&("object"==Dy(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ky()?Reflect.construct(e,n||[],Oy(t).constructor):e.apply(t,n))}function ky(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ky=function(){return!!t})()}function Oy(t){return Oy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oy(t)}function zy(t,e){return zy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zy(t,e)}var Ly=function(t){var n=function(n){function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=jy(this,i,[t]),m()(e,["removeItemById"]),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&zy(t,e)}(i,n),function(t,e,n){return e&&_y(t.prototype,e),n&&_y(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(i,[{key:"componentDidUpdate",value:function(t){(this.props.hoveredItemId&&this.props.hoveredItemId!==t.hoveredItemId||!this.props.hoveredItemId&&t.hoveredItemId)&&this.removeItemById(t.hoveredItemId)}},{key:"removeItemById",value:function(t){if(t){var n=e().project.getItem({match:function(e){return e.id===t}});n&&n.remove()}}},{key:"render",value:function(){var e=this.props,n=(e.hoveredItemId,function(t,e){if(null==t)return{};var n,i,r=function(t,e){if(null==t)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;n[i]=t[i]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)n=o[i],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}(e,Ny));return l().createElement(t,n)}}])}(l().Component);n.propTypes={hoveredItemId:i().number};return(0,c.connect)(function(t){return{hoveredItemId:t.scratchPaint.hoveredItemId}})(n)};function By(t){return By="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},By(t)}function Py(){return Py=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Py.apply(null,arguments)}function Ry(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Uy(i.key),i)}}function Uy(t){var e=function(t,e){if("object"!=By(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=By(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==By(e)?e:e+""}function Gy(t,e,n){return e=Zy(e),function(t,e){if(e&&("object"==By(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Yy()?Reflect.construct(e,n||[],Zy(t).constructor):e.apply(t,n))}function Yy(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Yy=function(){return!!t})()}function Zy(t){return Zy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zy(t)}function Wy(t,e){return Wy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wy(t,e)}var Qy=function(t){var e=function(e){function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e=Gy(this,n,[t]),m()(e,["handleUndo","handleRedo","handleSetSelectedItems","shouldShowUndo","shouldShowRedo"]),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Wy(t,e)}(n,e),function(t,e,n){return e&&Ry(t.prototype,e),n&&Ry(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"handleUndo",value:function(){!function(t,e,n,i){if(t.pointer>0){var r=t.stack[t.pointer-1];We(r,n,i,M(r.paintEditorFormat)),e(A(r.paintEditorFormat)?I.VECTOR_SKIP_CONVERT:M(r.paintEditorFormat)?I.BITMAP_SKIP_CONVERT:null)}}(this.props.undoState,this.props.onUndo,this.handleSetSelectedItems,this.props.onUpdateImage)}},{key:"handleRedo",value:function(){!function(t,e,n,i){if(t.pointer>=0&&t.pointer<t.stack.length-1){var r=t.stack[t.pointer+1];We(r,n,i,M(r.paintEditorFormat)),e(A(r.paintEditorFormat)?I.VECTOR_SKIP_CONVERT:M(r.paintEditorFormat)?I.BITMAP_SKIP_CONVERT:null)}}(this.props.undoState,this.props.onRedo,this.handleSetSelectedItems,this.props.onUpdateImage)}},{key:"handleSetSelectedItems",value:function(){this.props.setSelectedItems(this.props.format)}},{key:"shouldShowUndo",value:function(){return this.props.undoState.pointer>0}},{key:"shouldShowRedo",value:function(){return(t=this.props.undoState).pointer>-1&&t.pointer!==t.stack.length-1;var t}},{key:"render",value:function(){var e=Sp()(this.props,["format","onUndo","onRedo","setSelectedItems","undoState"]);return l().createElement(t,Py({shouldShowRedo:this.shouldShowRedo,shouldShowUndo:this.shouldShowUndo,onRedo:this.handleRedo,onUndo:this.handleUndo},e))}}])}(l().Component);e.propTypes={format:i().oneOf(Object.keys(I)),onRedo:i().func.isRequired,onUndo:i().func.isRequired,onUpdateImage:i().func.isRequired,setSelectedItems:i().func.isRequired,undoState:i().shape({stack:i().arrayOf(i().object).isRequired,pointer:i().number.isRequired})};return(0,c.connect)(function(t){return{format:t.scratchPaint.format,undoState:t.scratchPaint.undo}},function(t){return{setSelectedItems:function(e){t(tn(At(),M(e)))},onUndo:function(e){t(function(t){return{type:Qe,format:t}}(e))},onRedo:function(e){t(function(t){return{type:He,format:t}}(e))}}})(e)};function Hy(t){return Hy="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hy(t)}function Fy(){return Fy=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Fy.apply(null,arguments)}function Vy(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return qy(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qy(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function qy(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function Jy(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Xy(i.key),i)}}function Xy(t){var e=function(t,e){if("object"!=Hy(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=Hy(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Hy(e)?e:e+""}function Ky(t,e,n){return e=tv(e),function(t,e){if(e&&("object"==Hy(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,$y()?Reflect.construct(e,n||[],tv(t).constructor):e.apply(t,n))}function $y(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return($y=function(){return!!t})()}function tv(t){return tv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},tv(t)}function ev(t,e){return ev=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ev(t,e)}var nv=function(t){var n=function(n){function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),e=Ky(this,i,[t]),m()(e,["handleUpdateImage","handleUpdateBitmap","handleUpdateVector"]),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ev(t,e)}(i,n),function(t,e,n){return e&&Jy(t.prototype,e),n&&Jy(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(i,[{key:"handleUpdateImage",value:function(t,n){var i=n||(_[this.props.mode]?I.BITMAP:I.VECTOR);M(i)?this.handleUpdateBitmap(t):A(i)&&this.handleUpdateVector(t),me(),this.props.updateViewBounds(e().view.matrix)}},{key:"handleUpdateBitmap",value:function(t){if(Ee().loaded){var n=Ee().getSubRaster(Ee().bounds);n.remove();var i=At();if(1===i.length){var r=i[0];if(r instanceof e().Raster){if(!r.loaded||r.data&&r.data.expanded&&!r.data.expanded.loaded)return void s.warn("Bitmap layer should be loaded before calling updateImage.");ne(r,n)}else if(r instanceof e().Shape&&"rectangle"===r.type)oe(r,n);else if(r instanceof e().Shape&&"ellipse"===r.type)re(r,n);else if(r instanceof e().PointText){var o=r.drawnBounds,a=r.rasterize(72,!1,o);n.drawImage(a.canvas,new(e().Point)(Math.floor(o.x),Math.floor(o.y)))}}var l=Qt(n);0!==l.width&&0!==l.height||(l.width=l.height=1);var c=n.getImageData(l);this.props.onUpdateImage(!1,c,ce/2-l.x,ue/2-l.y),t||Ze(this.props.undoSnapshot,I.BITMAP)}else s.warn("Bitmap layer should be loaded before calling updateImage.")}},{key:"handleUpdateVector",value:function(t){var n;if(e().project.activeLayer.clipped){var i,r=Vy(e().project.activeLayer.children);try{for(r.s();!(i=r.n()).done;){var o=i.value;if(o.isClipMask()){n=o;break}}}catch(t){r.e(t)}finally{r.f()}e().project.activeLayer.clipped=!1,n.remove()}var s=Pe(!0);it(e().project.activeLayer,.5,new(e().Point));var a=e().project.activeLayer.drawnBounds,l=0===a.width?0:240-a.x,c=0===a.height?0:180-a.y;this.props.onUpdateImage(!0,e().project.exportSVG({asString:!0,bounds:"content",matrix:(new(e().Matrix)).translate(-a.x,-a.y)}),l,c),it(e().project.activeLayer,2,new(e().Point)),e().project.activeLayer.applyMatrix=!0,Re(s),n&&(e().project.activeLayer.addChild(n),n.clipMask=!0),t||Ze(this.props.undoSnapshot,I.VECTOR)}},{key:"render",value:function(){var e=Sp()(this.props,["format","onUpdateImage","undoSnapshot"]);return l().createElement(t,Fy({onUpdateImage:this.handleUpdateImage},e))}}])}(l().Component);n.propTypes={format:i().oneOf(Object.keys(I)),mode:i().oneOf(Object.keys(E)).isRequired,onUpdateImage:i().func.isRequired,undoSnapshot:i().func.isRequired,updateViewBounds:i().func.isRequired};return(0,c.connect)(function(t){return{format:t.scratchPaint.format,mode:t.scratchPaint.mode,undoState:t.scratchPaint.undo}},function(t){return{setSelectedItems:function(e){t(tn(At(),M(e)))},undoSnapshot:function(e){t(Je(e))},updateViewBounds:function(e){t(fn(e))}}})(n)};function iv(t){return iv="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},iv(t)}function rv(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,ov(i.key),i)}}function ov(t){var e=function(t,e){if("object"!=iv(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=iv(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==iv(e)?e:e+""}function sv(t,e,n){return e=lv(e),function(t,e){if(e&&("object"==iv(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,av()?Reflect.construct(e,n||[],lv(t).constructor):e.apply(t,n))}function av(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(av=function(){return!!t})()}function lv(t){return lv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lv(t)}function cv(t,e){return cv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cv(t,e)}var uv=function(t){function n(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e=sv(this,n,[t]),m()(e,["switchModeForFormat","onMouseDown","onMouseUp","setCanvas","setTextArea","startEyeDroppingLoop","stopEyeDroppingLoop","handleSetSelectedItems","handleZoomIn","handleZoomOut","handleZoomReset"]),e.state={canvas:null,colorInfo:null},e.props.setLayout(e.props.rtl?"rtl":"ltr"),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cv(t,e)}(n,t),function(t,e,n){return e&&rv(t.prototype,e),n&&rv(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(n,[{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.props.onKeyPress),document.addEventListener("mousedown",this.onMouseDown),document.addEventListener("touchstart",this.onMouseDown),document.addEventListener("mouseup",this.onMouseUp),document.addEventListener("touchend",this.onMouseUp)}},{key:"componentWillReceiveProps",value:function(t){!M(this.props.format)&&M(t.format)?this.switchModeForFormat(I.BITMAP):!A(this.props.format)&&A(t.format)&&this.switchModeForFormat(I.VECTOR),t.rtl!==this.props.rtl&&this.props.setLayout(t.rtl?"rtl":"ltr")}},{key:"componentDidUpdate",value:function(t){this.props.isEyeDropping&&!t.isEyeDropping?this.startEyeDroppingLoop():!this.props.isEyeDropping&&t.isEyeDropping?this.stopEyeDroppingLoop():this.props.isEyeDropping&&this.props.viewBounds!==t.viewBounds&&(this.props.previousTool&&this.props.previousTool.activate(),this.props.onDeactivateEyeDropper(),this.stopEyeDroppingLoop()),this.props.format===I.VECTOR&&M(t.format)?function(t,n){bt(t);var i,r=Bt(e().project.activeLayer.children);try{for(r.s();!(i=r.n()).done;){var o=i.value;!0===o.clipMask&&(o.size.height=fe.height,o.size.width=fe.width,o.setPosition(he))}}catch(t){r.e(t)}finally{r.f()}Ht(!0),_e(),n(!1,I.VECTOR)}(this.props.clearSelectedItems,this.props.onUpdateImage):A(t.format)&&this.props.format===I.BITMAP&&function(t,n,i){bt(t);var r=Pe(!0),o=e().project.activeLayer.drawnBounds,a=e().project.exportSVG({bounds:"content",matrix:(new(e().Matrix)).translate(-o.x,-o.y)});Re(r),a.setAttribute("shape-rendering","crispEdges");var l=(new XMLSerializer).serializeToString(a);i?l=i(l):s.error("Fonts may be converted to bitmap incorrectly if fontInlineFn prop is not set on PaintEditor.");var c=new Image;c.onload=function(){c.width&&c.height&&Ee().drawImage(c,new(e().Point)(Math.floor(o.topLeft.x),Math.floor(o.topLeft.y)));for(var t=e().project.activeLayer.children.length-1;t>=0;t--){var i=e().project.activeLayer.children[t];!1===i.clipMask?i.remove():(i.size.height=ue,i.size.width=ce,i.setPosition(he))}n(!1,I.BITMAP)},c.onerror=function(){var t=e().project.activeLayer.rasterize(72,!1);t.onLoad=function(){t.canvas.width&&t.canvas.height&&Ee().drawImage(t.canvas,t.bounds.topLeft),e().project.activeLayer.removeChildren(),n(!1,I.BITMAP)}},c.src="data:image/svg+xml;utf8,".concat(encodeURIComponent(l))}(this.props.clearSelectedItems,this.props.onUpdateImage,this.props.fontInlineFn)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.props.onKeyPress),this.stopEyeDroppingLoop(),document.removeEventListener("mousedown",this.onMouseDown),document.removeEventListener("touchstart",this.onMouseDown),document.removeEventListener("mouseup",this.onMouseUp),document.removeEventListener("touchend",this.onMouseUp)}},{key:"switchModeForFormat",value:function(t){if(!(A(t)&&this.props.mode in N||M(t)&&this.props.mode in _))if(A(t))switch(this.props.mode){case E.BIT_BRUSH:this.props.changeMode(E.BRUSH);break;case E.BIT_LINE:this.props.changeMode(E.LINE);break;case E.BIT_OVAL:this.props.changeMode(E.OVAL);break;case E.BIT_RECT:this.props.changeMode(E.RECT);break;case E.BIT_TEXT:this.props.changeMode(E.TEXT);break;case E.BIT_FILL:this.props.changeMode(E.FILL);break;case E.BIT_ERASER:this.props.changeMode(E.ERASER);break;case E.BIT_SELECT:this.props.changeMode(E.SELECT);break;default:s.error("Mode not handled: ".concat(this.props.mode)),this.props.changeMode(E.BRUSH)}else if(M(t))switch(this.props.mode){case E.BRUSH:this.props.changeMode(E.BIT_BRUSH);break;case E.LINE:this.props.changeMode(E.BIT_LINE);break;case E.OVAL:this.props.changeMode(E.BIT_OVAL);break;case E.RECT:this.props.changeMode(E.BIT_RECT);break;case E.TEXT:this.props.changeMode(E.BIT_TEXT);break;case E.FILL:this.props.changeMode(E.BIT_FILL);break;case E.ERASER:this.props.changeMode(E.BIT_ERASER);break;case E.RESHAPE:case E.SELECT:this.props.changeMode(E.BIT_SELECT);break;default:s.error("Mode not handled: ".concat(this.props.mode)),this.props.changeMode(E.BIT_BRUSH)}}},{key:"handleZoomIn",value:function(){var t=n.ZOOM_INCREMENT;e().view.zoom===de&&(t=.16699999999999998),Ie(t),this.props.updateViewBounds(e().view.matrix),this.handleSetSelectedItems()}},{key:"handleZoomOut",value:function(){Ie(-n.ZOOM_INCREMENT),this.props.updateViewBounds(e().view.matrix),this.handleSetSelectedItems()}},{key:"handleZoomReset",value:function(){Ae(),this.props.updateViewBounds(e().view.matrix),this.handleSetSelectedItems()}},{key:"handleSetSelectedItems",value:function(){this.props.setSelectedItems(this.props.format)}},{key:"setCanvas",value:function(t){this.setState({canvas:t}),this.canvas=t}},{key:"setTextArea",value:function(t){this.setState({textArea:t})}},{key:"onMouseDown",value:function(t){t.target===e().view.element&&document.activeElement instanceof HTMLInputElement&&document.activeElement.blur(),t.target!==e().view.element&&t.target!==this.state.textArea&&this.props.removeTextEditTarget()}},{key:"onMouseUp",value:function(){if(this.props.isEyeDropping){var t=this.eyeDropper.colorString,e=this.props.changeColorToEyeDropper;this.eyeDropper.remove(),this.eyeDropper.hideLoupe||e(t),this.props.previousTool&&this.props.previousTool.activate(),this.props.onDeactivateEyeDropper(),this.stopEyeDroppingLoop()}}},{key:"startEyeDroppingLoop",value:function(){var t=this;this.eyeDropper=new qh(this.canvas,e().project.view.bounds.width,e().project.view.bounds.height,e().project.view.pixelRatio,e().view.zoom,e().project.view.bounds.x,e().project.view.bounds.y,M(this.props.format)),this.eyeDropper.pickX=-1,this.eyeDropper.pickY=-1,this.eyeDropper.activate(),this.intervalId=setInterval(function(){var e=t.eyeDropper.getColorInfo(t.eyeDropper.pickX,t.eyeDropper.pickY,t.eyeDropper.hideLoupe);e&&(null!==t.state.colorInfo&&t.state.colorInfo.x===e.x&&t.state.colorInfo.y===e.y||t.setState({colorInfo:e}))},30)}},{key:"stopEyeDroppingLoop",value:function(){clearInterval(this.intervalId),this.setState({colorInfo:null})}},{key:"render",value:function(){return l().createElement(vy,{canRedo:this.props.shouldShowRedo,canUndo:this.props.shouldShowUndo,canvas:this.state.canvas,colorInfo:this.state.colorInfo,format:this.props.format,image:this.props.image,imageFormat:this.props.imageFormat,imageId:this.props.imageId,isEyeDropping:this.props.isEyeDropping,name:this.props.name,rotationCenterX:this.props.rotationCenterX,rotationCenterY:this.props.rotationCenterY,rtl:this.props.rtl,setCanvas:this.setCanvas,setTextArea:this.setTextArea,textArea:this.state.textArea,zoomLevelId:this.props.zoomLevelId,onRedo:this.props.onRedo,onSwitchToBitmap:this.props.handleSwitchToBitmap,onSwitchToVector:this.props.handleSwitchToVector,onUndo:this.props.onUndo,onUpdateImage:this.props.onUpdateImage,onUpdateName:this.props.onUpdateName,onZoomIn:this.handleZoomIn,onZoomOut:this.handleZoomOut,onZoomReset:this.handleZoomReset})}}],[{key:"ZOOM_INCREMENT",get:function(){return.5}}])}(l().Component);uv.propTypes={changeColorToEyeDropper:i().func,changeMode:i().func.isRequired,clearSelectedItems:i().func.isRequired,format:i().oneOf(Object.keys(I)),fontInlineFn:i().func,handleSwitchToBitmap:i().func.isRequired,handleSwitchToVector:i().func.isRequired,image:i().oneOfType([i().string,i().instanceOf(HTMLImageElement)]),imageFormat:i().string,imageId:i().string,isEyeDropping:i().bool,mode:i().oneOf(Object.keys(E)).isRequired,name:i().string,onDeactivateEyeDropper:i().func.isRequired,onKeyPress:i().func.isRequired,onRedo:i().func.isRequired,onUndo:i().func.isRequired,onUpdateImage:i().func.isRequired,onUpdateName:i().func.isRequired,previousTool:i().shape({activate:i().func.isRequired,remove:i().func.isRequired}),removeTextEditTarget:i().func.isRequired,rotationCenterX:i().number,rotationCenterY:i().number,rtl:i().bool,setLayout:i().func.isRequired,setSelectedItems:i().func.isRequired,shouldShowRedo:i().func.isRequired,shouldShowUndo:i().func.isRequired,updateViewBounds:i().func.isRequired,viewBounds:i().instanceOf(e().Matrix).isRequired,zoomLevelId:i().string};var hv=nv(Ly(Qy(Sy((0,c.connect)(function(t){return{changeColorToEyeDropper:t.scratchPaint.color.eyeDropper.callback,format:t.scratchPaint.format,isEyeDropping:t.scratchPaint.color.eyeDropper.active,mode:t.scratchPaint.mode,previousTool:t.scratchPaint.color.eyeDropper.previousTool,viewBounds:t.scratchPaint.viewBounds}},function(t){return{changeMode:function(e){t(Zi(e))},clearSelectedItems:function(){t(en())},handleSwitchToBitmap:function(){t(hn(I.BITMAP))},handleSwitchToVector:function(){t(hn(I.VECTOR))},removeTextEditTarget:function(){t(dp())},setLayout:function(e){t(mp(e))},setSelectedItems:function(e){t(tn(At(),M(e)))},onDeactivateEyeDropper:function(){t(no())},updateViewBounds:function(e){t(fn(e))}}})(uv))))),dv=p(0),pv=(0,dv.combineReducers)({eyeDropper:function(t,e){switch(void 0===t&&(t=eo),e.type){case $r:return Object.assign({},t,{active:!0,callback:e.callback,previousTool:e.previousMode});case to:return Object.assign({},t,{active:!1,callback:function(){},previousTool:null});default:return t}},fillColor:Mi,strokeColor:function(t,e){return e.type===fh&&0===Math.max(e.strokeWidth,0)?bh(bh({},t),{},{primary:null,secondary:null}):Th(t,e)},strokeWidth:function(t,e){switch(void 0===t&&(t=4),e.type){case fh:return isNaN(e.strokeWidth)?(s.warn("Invalid brush size: ".concat(e.strokeWidth)),t):Math.min(gh,Math.max(0,e.strokeWidth));case Xe:return e.selectedItems&&e.selectedItems.length?e.bitmapMode?t:Bi(e.selectedItems,e.bitmapMode).strokeWidth:t;default:return t}}}),fv=(0,dv.combineReducers)({gradientType:function(t,e){if(void 0===t&&(t=null),e.type===bi){if(e.gradientType in ci)return e.gradientType;s.warn("Gradient type does not exist: ".concat(e.gradientType))}return t},colorIndex:function(t,e){switch(void 0===t&&(t=0),e.type){case Jl:return 1!==e.index&&0!==e.index?(s.warn("Invalid color index: ".concat(e.index)),t):e.index;case bi:if(e.gradientType===ci.SOLID)return 0;default:return t}}}),gv=(0,dv.combineReducers)({mode:function(t,e){if(void 0===t&&(t=Yi),e.type===Gi){if(e.mode in E)return e.mode;s.warn("Mode does not exist: ".concat(e.mode))}return t},bitBrushSize:function(t,e){switch(void 0===t&&(t=10),e.type){case Gp:return isNaN(e.brushSize)?(s.warn("Invalid brush size: ".concat(e.brushSize)),t):Math.max(1,e.brushSize);case Xe:if(!e.selectedItems||!e.selectedItems.length)return t;if(!e.bitmapMode)return t;var n=Bi(e.selectedItems,e.bitmapMode);return n.thickness?n.thickness:t;default:return t}},bitEraserSize:function(t,e){return void 0===t&&(t=40),e.type===Yp?isNaN(e.eraserSize)?(s.warn("Invalid eraser size: ".concat(e.eraserSize)),t):Math.max(1,e.eraserSize):t},brushMode:function(t,e){return void 0===t&&(t=Up),e.type===Rp?isNaN(e.brushSize)?(s.warn("Invalid brush size: ".concat(e.brushSize)),t):{brushSize:Math.max(1,e.brushSize)}:t},color:pv,clipboard:function(t,e){switch(void 0===t&&(t=cn),e.type){case sn:return e.clipboardItems&&e.clipboardItems instanceof Array&&0!==e.clipboardItems.length?{items:e.clipboardItems,pasteOffset:1}:(s.warn("Invalid clipboard item format"),t);case an:return{items:t.items,pasteOffset:t.pasteOffset+1};case ln:return{items:t.items,pasteOffset:0};default:return t}},cursor:function(t,e){switch(void 0===t&&(t=ro),e.type){case io:return void 0===e.cursorString?(s.warn("Cursor should not be set to undefined. Use 'default'."),t):(Object.values(Kr).includes(e.cursorString)||s.warn("Cursor should be a valid cursor string. Got: ".concat(e.cursorString)),e.cursorString);case $r:return Kr.NONE;case to:return Kr.DEFAULT;default:return t}},eraserMode:function(t,e){return void 0===t&&(t=kl),e.type===jl?isNaN(e.brushSize)?(s.warn("Invalid brush size: ".concat(e.brushSize)),t):{brushSize:Math.max(1,e.brushSize)}:t},fillBitmapShapes:function(t,n){switch(void 0===t&&(t=true),n.type){case Zp:return n.filled;case Xe:return n.bitmapMode&&n.selectedItems&&n.selectedItems[0]instanceof e().Shape?0===n.selectedItems[0].strokeWidth:t;default:return t}},fillMode:fv,font:function(t,e){return void 0===t&&(t=$p),e.type===Kp&&e.font?e.font:t},format:function(t,e){switch(void 0===t&&(t=null),e.type){case Qe:case He:case un:if(!e.format)return t;if(e.format in I)return e.format;s.warn("Format does not exist: ".concat(e.format));default:return t}},hoveredItemId:function(t,e){return void 0===t&&(t=null),e.type===nn?void 0===e.hoveredItemId?(s.warn("Hovered item should not be set to undefined. Use null."),t):void 0===e.hoveredItemId||isNaN(e.hoveredItemId)?(s.warn("Hovered item should be an item ID number. Got: ".concat(e.hoveredItemId)),t):e.hoveredItemId:t},layout:function(t,e){return void 0===t&&(t=fp),e.type===pp?-1===gp.indexOf(e.layout)?(s.warn("Unrecognized layout provided: ".concat(e.layout)),t):{rtl:"rtl"===e.layout}:t},modals:function(t,e){switch(void 0===t&&(t=rc),e.type){case tc:return Object.assign({},rc,$l({},e.modal,!0));case ec:return Object.assign({},rc,$l({},e.modal,!1));default:return t}},selectedItems:function(t,e){switch(void 0===t&&(t=$e),e.type){case Ke:return t.length>0?t.slice(0):t;case Xe:return e.selectedItems&&e.selectedItems instanceof Array?e.selectedItems.length>1&&e.bitmapMode?(s.warn("Multiselect should not be possible in bitmap mode: ".concat(e.selectedItems)),t):0===e.selectedItems.length&&0===t.length?t:e.selectedItems:(s.warn("No selected items or wrong format provided: ".concat(e.selectedItems)),t);default:return t}},textEditTarget:function(t,e){return void 0===t&&(t=null),e.type===hp?void 0===e.textEditTargetId?(s.warn("Text edit target should not be set to undefined. Use null."),t):void 0===e.textEditTargetId||isNaN(e.textEditTargetId)?(s.warn("Text edit target should be an item ID number. Got: ".concat(e.textEditTargetId)),t):e.textEditTargetId:t},undo:function(t,e){switch(void 0===t&&(t=qe),e.type){case Qe:return t.pointer<=0?(s.warn("Can't undo, undo stack is empty"),t):{stack:t.stack,pointer:t.pointer-1};case He:return t.pointer<=-1||t.pointer===t.stack.length-1?(s.warn("Can't redo, redo stack is empty"),t):{stack:t.stack,pointer:t.pointer+1};case Fe:return e.snapshot?t.pointer>=99?{stack:t.stack.slice(t.pointer-100+2,t.pointer+1).concat(e.snapshot),pointer:99}:{stack:t.stack.slice(0,t.pointer+1).concat(e.snapshot),pointer:t.pointer+1}:(s.warn("Couldn't create undo snapshot, no data provided"),t);case Ve:return qe;default:return t}},viewBounds:function(t,n){return void 0===t&&(t=pn),n.type===dn?n.viewBounds instanceof e().Matrix?n.viewBounds:(s.warn("View bounds should be a paper.Matrix."),t):t},zoomLevels:function(t,e){switch(void 0===t&&(t=bn),e.type){case vn:return"currentZoomLevelId"===e.zoomLevelId?(s.warn("currentZoomLevelId is an invalid string for zoomLevel"),t):Object.assign({},t,{currentZoomLevelId:e.zoomLevelId});case yn:return Object.assign({},t,mn({},t.currentZoomLevelId,e.zoomLevel));default:return t}}})}(),f}()});
3
+ //# sourceMappingURL=scratch-paint.js.map