diff --git a/docs/bundle.css b/docs/bundle.css index 8d2291414..442be6761 100644 --- a/docs/bundle.css +++ b/docs/bundle.css @@ -3159,9 +3159,26 @@ html, body { position: absolute; left: 0px; top: 0px; - right: 0px; - bottom: 0px; + width: 100%; + height: 100%; pointer-events: none; + overflow: visible; +} +.csseditor .guide-line-view line { + stroke-width: 1; +} +.csseditor .guide-line-view line.base-line { + stroke: #fc554f; +} +.csseditor .guide-line-view line.base-rect { + stroke: #435cb5; +} +.csseditor .guide-line-view text { + font-size: 11px; + fill: #fc554f; +} +.csseditor .guide-line-view text.text-center { + text-anchor: middle; } .csseditor .property { border-bottom: 1px solid black; @@ -12279,9 +12296,26 @@ html, body { position: absolute; left: 0px; top: 0px; - right: 0px; - bottom: 0px; + width: 100%; + height: 100%; pointer-events: none; + overflow: visible; +} +.csseditor[data-theme=light] .guide-line-view line { + stroke-width: 1; +} +.csseditor[data-theme=light] .guide-line-view line.base-line { + stroke: #fc554f; +} +.csseditor[data-theme=light] .guide-line-view line.base-rect { + stroke: #435cb5; +} +.csseditor[data-theme=light] .guide-line-view text { + font-size: 11px; + fill: #fc554f; +} +.csseditor[data-theme=light] .guide-line-view text.text-center { + text-anchor: middle; } .csseditor[data-theme=light] .property { border-bottom: 1px solid black; diff --git a/docs/bundle.css.gz b/docs/bundle.css.gz index 135c5b88e..4fcbd05f6 100644 Binary files a/docs/bundle.css.gz and b/docs/bundle.css.gz differ diff --git a/docs/main.js b/docs/main.js index 42460e7c1..6e65b1ec6 100644 --- a/docs/main.js +++ b/docs/main.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.EasylogicStudio=e():t.EasylogicStudio=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e,n){},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"debounce",function(){return k}),n.d(r,"throttle",function(){return O}),n.d(r,"keyEach",function(){return S}),n.d(r,"keyMap",function(){return j}),n.d(r,"keyMapJoin",function(){return P}),n.d(r,"get",function(){return _}),n.d(r,"defaultValue",function(){return T}),n.d(r,"isUndefined",function(){return E}),n.d(r,"isNotUndefined",function(){return C}),n.d(r,"isArray",function(){return $}),n.d(r,"isBoolean",function(){return R}),n.d(r,"isString",function(){return V}),n.d(r,"isNotString",function(){return A}),n.d(r,"isObject",function(){return D}),n.d(r,"isFunction",function(){return I}),n.d(r,"isNumber",function(){return M}),n.d(r,"clone",function(){return L}),n.d(r,"cleanObject",function(){return B}),n.d(r,"combineKeyArray",function(){return z}),n.d(r,"repeat",function(){return F}),n.d(r,"html",function(){return X}),n.d(r,"CSS_TO_STRING",function(){return Y}),n.d(r,"STRING_TO_CSS",function(){return N}),n.d(r,"OBJECT_TO_PROPERTY",function(){return K}),n.d(r,"OBJECT_TO_CLASS",function(){return W}),n.d(r,"TAG_TO_STRING",function(){return U}),n.d(r,"mapjoin",function(){return Z});var o={};n.r(o),n.d(o,"format",function(){return q}),n.d(o,"hex",function(){return J}),n.d(o,"rgb",function(){return Q}),n.d(o,"hsl",function(){return tt});var i={};n.r(i),n.d(i,"randomNumber",function(){return et}),n.d(i,"random",function(){return nt}),n.d(i,"randomRGBA",function(){return rt});var a={};n.r(a),n.d(a,"round",function(){return at}),n.d(a,"degreeToRadian",function(){return ct}),n.d(a,"div",function(){return ut}),n.d(a,"radianToDegree",function(){return st}),n.d(a,"getXInCircle",function(){return lt}),n.d(a,"getYInCircle",function(){return ft}),n.d(a,"getXYInCircle",function(){return pt}),n.d(a,"getDist",function(){return ht}),n.d(a,"calculateAngle",function(){return yt}),n.d(a,"calculateAngle360",function(){return dt}),n.d(a,"uuid",function(){return bt}),n.d(a,"uuidShort",function(){return gt}),n.d(a,"cubicBezier",function(){return wt}),n.d(a,"getGradientLine",function(){return kt}),n.d(a,"CCW",function(){return Ot}),n.d(a,"incircle",function(){return St}),n.d(a,"initPolygon",function(){return jt}),n.d(a,"Deluanay",function(){return xt}),n.d(a,"generate_sample_points",function(){return _t}),n.d(a,"getCenterInTriangle",function(){return Tt});var c={};n.r(c),n.d(c,"ReverseXyz",function(){return Et}),n.d(c,"ReverseRGB",function(){return Ct}),n.d(c,"XYZtoRGB",function(){return $t}),n.d(c,"LABtoXYZ",function(){return Rt}),n.d(c,"PivotXyz",function(){return Vt}),n.d(c,"XYZtoLAB",function(){return At}),n.d(c,"LABtoRGB",function(){return Dt});var u={};n.r(u),n.d(u,"RGBtoHSV",function(){return It}),n.d(u,"RGBtoCMYK",function(){return Mt}),n.d(u,"RGBtoHSL",function(){return Lt}),n.d(u,"c",function(){return Bt}),n.d(u,"gray",function(){return zt}),n.d(u,"RGBtoSimpleGray",function(){return Ft}),n.d(u,"RGBtoGray",function(){return Gt}),n.d(u,"brightness",function(){return Ht}),n.d(u,"RGBtoYCrCb",function(){return Xt}),n.d(u,"PivotRGB",function(){return Yt}),n.d(u,"RGBtoXYZ",function(){return Nt}),n.d(u,"RGBtoLAB",function(){return Kt});var s={};n.r(s),n.d(s,"CMYKtoRGB",function(){return Wt});var l={};n.r(l),n.d(l,"HSVtoRGB",function(){return Ut}),n.d(l,"HSVtoHSL",function(){return Zt});var f={};n.r(f),n.d(f,"HUEtoRGB",function(){return qt}),n.d(f,"HSLtoHSV",function(){return Jt}),n.d(f,"HSLtoRGB",function(){return Qt});var p={};n.r(p),n.d(p,"YCrCbtoRGB",function(){return te});var h={};n.r(h),n.d(h,"isColor",function(){return ce}),n.d(h,"matches",function(){return ue}),n.d(h,"convertMatches",function(){return se}),n.d(h,"convertMatchesArray",function(){return le}),n.d(h,"reverseMatches",function(){return fe}),n.d(h,"trim",function(){return he}),n.d(h,"parse",function(){return ye}),n.d(h,"parseGradient",function(){return de});var d={};n.r(d),n.d(d,"interpolateRGB",function(){return ve}),n.d(d,"interpolateRGBObject",function(){return be}),n.d(d,"scale",function(){return ge}),n.d(d,"blend",function(){return me}),n.d(d,"mix",function(){return we}),n.d(d,"contrast",function(){return ke}),n.d(d,"contrastColor",function(){return Oe}),n.d(d,"gradient",function(){return Se}),n.d(d,"scaleHSV",function(){return je}),n.d(d,"scaleH",function(){return Pe}),n.d(d,"scaleS",function(){return xe}),n.d(d,"scaleV",function(){return _e});var v={};n.r(v),n.d(v,"start",function(){return kl});n(0);function b(t){return function(t){if(Array.isArray(t))return t}(t)||m(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function g(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e2&&void 0!==arguments[2]?arguments[2]:"";return j(t,e).join(n)}function _(t,e,n){var r=T(t[e],e);return I(n)?n(r):r}function T(t,e){return void 0===t?e:t}function E(t){return null==t}function C(t){return!1===E(t)}function $(t){return Array.isArray(t)}function R(t){return"boolean"==typeof t}function V(t){return"string"==typeof t}function A(t){return!1===V(t)}function D(t){return"object"==w(t)&&!$(t)&&!M(t)&&!V(t)&&null!==t}function I(t){return"function"==typeof t}function M(t){return"number"==typeof t}function L(t){return JSON.parse(JSON.stringify(t))}function B(t){var e={};return Object.keys(t).filter(function(e){return!!t[e]}).forEach(function(n){e[n]=t[n]}),e}function z(t){return Object.keys(t).forEach(function(e){Array.isArray(t[e])&&(t[e]=t[e].join(", "))}),t}function F(t){return g(Array(t))}var G=/\<(\w*)([^\>]*)\/\>/gim,H={image:!0,input:!0,br:!0,path:!0},X=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r",">"))})};function Y(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=t;return Object.keys(n).filter(function(t){return n[t]}).map(function(t){return"".concat(t,": ").concat(n[t])}).join(";"+e)}function N(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e={};return""===(t+="")?e:(t.split(";").forEach(function(t){var n=b(t.split(":").map(function(t){return t.trim()})),r=n[0],o=n.slice(1);""!=r&&(e[r]=o.join(":"))}),e)}function K(t){return Object.keys(t).map(function(e){return"class"===e&&D(t[e])?"".concat(e,'="').concat(W(t[e]),'"'):R(t[e])?t[e]?e:"":"".concat(e,'="').concat(t[e],'"')}).join(" ")}function W(t){return Object.keys(t).filter(function(e){return t[e]}).map(function(t){return t}).join(" ")}function U(t){return t.replace(/\/g,">")}function Z(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return t.map(e).join(n)}function q(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rgba(0, 0, 0, 0)";return Array.isArray(t)&&(t={r:t[0],g:t[1],b:t[2],a:t[3]}),"hex"==e?J(t):"rgb"==e?Q(t,n):"hsl"==e?tt(t):t}function J(t){Array.isArray(t)&&(t={r:t[0],g:t[1],b:t[2],a:t[3]});var e=t.r.toString(16);t.r<16&&(e="0"+e);var n=t.g.toString(16);t.g<16&&(n="0"+n);var r=t.b.toString(16);return t.b<16&&(r="0"+r),"#".concat(e).concat(n).concat(r)}function Q(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"rgba(0, 0, 0, 0)";if($(t)&&(t={r:t[0],g:t[1],b:t[2],a:t[3]}),!E(t))return 1==t.a||E(t.a)?isNaN(t.r)?e:"rgb(".concat(t.r,",").concat(t.g,",").concat(t.b,")"):"rgba(".concat(t.r,",").concat(t.g,",").concat(t.b,",").concat(t.a,")")}function tt(t){return $(t)&&(t={r:t[0],g:t[1],b:t[2],a:t[3]}),1==t.a||E(t.a)?"hsl(".concat(t.h,",").concat(t.s,"%,").concat(t.l,"%)"):"hsla(".concat(t.h,",").concat(t.s,"%,").concat(t.l,"%,").concat(t.a,")")}function et(t,e){return Math.floor(Math.random()*(e-t+1))+t}function nt(){return Q({r:et(0,255),g:et(0,255),b:et(0,255)})}function rt(){return Q({r:et(0,255),g:et(0,255),b:et(0,255),a:et(0,1e3)/1e3})}var ot={create:function(t,e,n){return{x:t||0,y:e||0,z:n||0}},add:function(t,e){return{x:t.x+e.x,y:t.y+e.y,z:t.z+e.z}},sub:function(t,e){return{x:t.x-e.x,y:t.y-e.y,z:t.z-e.z}},mul:function(t,e){return{x:t.x*e.x,y:t.y*e.y,z:t.z*e.z}},div:function(t,e){return{x:t.x/e.x,y:t.y/e.y,z:t.z/e.z}},muls:function(t,e){return{x:t.x*e,y:t.y*e,z:t.z*e}},divs:function(t,e){return{x:t.x/e,y:t.y/e,z:t.z/e}},len:function(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z)},dot:function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},cross2d:function(t,e){return t.x*e.y-t.y*e.x},cross:function(t,e){return{x:t.y*e.z-t.z*e.y,y:t.z*e.x-t.x*e.z,z:t.x*e.y-t.y*e.x}},normalize:function(t){return ot.divs(t,ot.len(t))},ang:function(t,e){return Math.acos(ot.dot(t,e)/(ot.len(t)*ot.len(e)))},copy:function(t){return{x:t.x,y:t.y,z:t.z}},equal:function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z},rotate:function(t,e){var n=t.x,r=t.y,o=t.z,i=0!==e.x?e.x/2:0,a=0!==e.y?e.y/2:0,c=0!==e.z?e.z/2:0,u=Math.cos(i),s=Math.cos(a),l=Math.cos(c),f=Math.sin(i),p=Math.sin(a),h=Math.sin(c),y=u*s*l+-f*p*h,d=f*s*l- -u*p*h,v=u*p*l+f*s*-h,b=u*s*h- -f*p*l;return{x:n*(1-2*(v*v+b*b))+r*(2*(d*v-b*y))+o*(2*(d*b+v*y)),y:n*(2*(d*v+b*y))+r*(1-2*(d*d+b*b))+o*(2*(v*b-d*y)),z:n*(2*(d*b-v*y))+r*(2*(b*v+d*y))+o*(1-2*(d*d+v*v))}}},it={matrix2d:{multiply:function(t){return function(e,n){var r=+e[n],o=+e[n+1];return[t[0][0]*r+t[0][1]*o+t[0][2],t[1][0]*r+t[1][1]*o+t[1][2],1]}},translate:function(t,e){return this.multiply([[1,0,t],[0,1,e],[0,0,1]])},rotate:function(t){return this.multiply([[Math.cos(t),Math.sin(t),0][(Math.sin(t),Math.cos(t),0)],[0,0,1]])},scale:function(t,e){return this.multiply([[t,0,0],[0,e,0],[0,0,1]])},skewX:function(t){return this.multiply([[1,Math.tan(t),0],[0,1,0],[0,0,1]])},skewY:function(t){return this.multiply([[1,0,0],[Math.tan(t),1,0],[0,0,1]])},flip:function(){return this.multiply([[-1,0,0],[0,-1,0],[0,0,1]])},flipX:function(){return this.multiply([[-1,0,0],[0,1,0],[0,0,1]])},flipY:function(){return this.multiply([[1,0,0],[0,-1,0],[0,0,1]])}},Vect3:ot,addVector:function(t,e){return ot.add(t,e)},rotateVector:function(t,e){return ot.rotate(t,e)}};function at(t,e){return e=E(e)?1:e,Math.round(t*e)/e}function ct(t){return t*Math.PI/180}function ut(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 0===t?0:t/e}function st(t){var e=180*t/Math.PI;return e<0&&(e=360+e),e}function lt(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)+e*Math.cos(ct(t))}function ft(t,e){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)+e*Math.sin(ct(t))}function pt(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return{x:lt(t,e,n),y:ft(t,e,r)}}function ht(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return Math.sqrt(Math.pow(Math.abs(n-t),2)+Math.pow(Math.abs(r-e),2))}function yt(t,e){return st(Math.atan2(e,t))}function dt(t,e){return(st(Math.atan2(e,t))+180)%360}var vt=/[xy]/g;function bt(){var t=(new Date).getTime();return"xxx12-xx-34xx".replace(vt,function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?n:3&n|8).toString(16)})}function gt(){var t=(new Date).getTime();return"idxxxxxxx".replace(vt,function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?n:3&n|8).toString(16)})}var mt={B1:function(t){return t*t*t},B2:function(t){return 3*t*t*(1-t)},B3:function(t){return 3*t*(1-t)*(1-t)},B4:function(t){return(1-t)*(1-t)*(1-t)}};function wt(t,e,n,r){var o=e,i=r;return function(t){return 1-(o*mt.B2(t)+i*mt.B3(t)+mt.B4(t))}}function kt(t,e){var n=Math.abs(e.width*Math.sin(t))+Math.abs(e.height*Math.cos(t)),r={x:e.x+e.width/2,y:e.y+e.height/2},o=Math.sin(t-Math.PI/2)*n/2,i=Math.cos(t-Math.PI/2)*n/2;return{length:n,center:r,start:{x:r.x-i,y:r.y-o},end:{x:r.x+i,y:r.y+o}}}function Ot(t,e,n){return E(n)?ot.cross2d(t,e):ot.cross2d(ot.sub(e,t),ot.sub(n,t))}function St(t,e,n,r){var o=Ot(t,e,n),i=t.x-r.x,a=t.y-r.y,c=e.x-r.x,u=e.y-r.y,s=n.x-r.x,l=n.y-r.y,f=(i*i+a*a)*(c*l-s*u)+(c*c+u*u)*(s*a-i*l)+(s*s+l*l)*(i*u-c*a);return o>0?f>=0:f<=0}function jt(t,e,n){for(var r=ot.create(Math.min(e,n),Math.max(e,n)),o=-1,i=0,a=t.length;i-1?t.splice(o,1):t.push(r)}function Pt(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function xt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=t.length;t[e]=ot.create(-2e9,-2e9),t[e+1]=ot.create(2e9,-2e9),t[e+2]=ot.create(0,2e9);for(var n=[ot.create(e,e+1,e+2)],r=0;r=e||c.y>=e||c.z>=e)&&(Pt(n,r,n.length-1),n.pop(),r--)}return n.map(function(e){return{a:t[e.x],b:t[e.y],c:t[e.z]}})}function _t(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:50,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:100,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){return Math.random()},c=[],u=t+n,s=-r,l=e+r,f=-n;f.008856?Math.pow(t,3):(t-16/116)/7.787}function Ct(t){return t>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t}function $t(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.x,e=r.y,n=r.z}var o=t/100,i=e/100,a=n/100,c=3.2406*o+-1.5372*i+-.4986*a,u=-.9689*o+1.8758*i+.0415*a,s=.0557*o+-.204*i+1.057*a;return c=Ct(c),u=Ct(u),s=Ct(s),{r:at(255*c),g:at(255*u),b:at(255*s)}}function Rt(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.l,e=r.a,n=r.b}var o=(t+16)/116,i=e/500+o,a=o-n/200;return o=Et(o),{x:95.047*(i=Et(i)),y:100*o,z:108.883*(a=Et(a))}}function Vt(t){return t>.008856?Math.pow(t,1/3):(7.787*t+16)/116}function At(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.x,e=r.y,n=r.z}var o=t/95.047,i=e/100,a=n/108.883;return o=Vt(o),{l:116*(i=Vt(i))-16,a:500*(o-i),b:200*(i-(a=Vt(a)))}}function Dt(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.l,e=r.a,n=r.b}return $t(Rt(t,e,n))}function It(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.r,e=r.g,n=r.b}var o=t/255,i=e/255,a=n/255,c=Math.max(o,i,a),u=c-Math.min(o,i,a),s=0;0==u?s=0:c==o?s=(i-a)/u%6*60:c==i?s=60*((a-o)/u+2):c==a&&(s=60*((o-i)/u+4)),s<0&&(s=360+s);return{h:s,s:0==c?0:u/c,v:c}}function Mt(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.r,e=r.g,n=r.b}var o=t/255,i=e/255,a=n/255,c=1-Math.max(o,i,a);return{c:(1-o-c)/(1-c),m:(1-i-c)/(1-c),y:(1-a-c)/(1-c),k:c}}function Lt(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.r,e=r.g,n=r.b}t/=255,e/=255,n/=255;var o,i,a=Math.max(t,e,n),c=Math.min(t,e,n),u=(a+c)/2;if(a==c)o=i=0;else{var s=a-c;switch(i=u>.5?s/(2-a-c):s/(a+c),a){case t:o=(e-n)/s+(e90?0:255)}function zt(t){return{r:t,g:t,b:t}}function Ft(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.r,e=r.g,n=r.b}return zt(Math.ceil((t+e+n)/3))}function Gt(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.r,e=r.g,n=r.b}return zt(Xt(t,e,n).y)}function Ht(t,e,n){return Math.ceil(.2126*t+.7152*e+.0722*n)}function Xt(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.r,e=r.g,n=r.b}var o=Ht(t,e,n);return{y:o,cr:.713*(t-o),cb:.564*(n-o)}}function Yt(t){return 100*(t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)}function Nt(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.r,e=r.g,n=r.b}var o=t/255,i=e/255,a=n/255;return{x:.4124*(o=Yt(o))+.3576*(i=Yt(i))+.1805*(a=Yt(a)),y:.2126*o+.7152*i+.0722*a,z:.0193*o+.1192*i+.9505*a}}function Kt(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.r,e=r.g,n=r.b}return At(Nt(t,e,n))}function Wt(t,e,n,r){if(1==arguments.length){var o=arguments[0];t=o.c,e=o.m,n=o.y,r=o.k}return{r:255*(1-t)*(1-r),g:255*(1-e)*(1-r),b:255*(1-n)*(1-r)}}function Ut(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.h,e=r.s,n=r.v}var o=t,i=n;o>=360&&(o=0);var a=e*i,c=a*(1-Math.abs(o/60%2-1)),u=i-a,s=[];return 0<=o&&o<60?s=[a,c,0]:60<=o&&o<120?s=[c,a,0]:120<=o&&o<180?s=[0,a,c]:180<=o&&o<240?s=[0,c,a]:240<=o&&o<300?s=[c,0,a]:300<=o&&o<360&&(s=[a,0,c]),{r:at(255*(s[0]+u)),g:at(255*(s[1]+u)),b:at(255*(s[2]+u))}}function Zt(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.h,e=r.s,n=r.v}var o=Ut(t,e,n);return Lt(o.r,o.g,o.b)}function qt(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Jt(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.h,e=r.s,n=r.l}var o=Qt(t,e,n);return It(o.r,o.g,o.b)}function Qt(t,e,n){if(1==arguments.length){var r=arguments[0];t=r.h,e=r.s,n=r.l}var o,i,a;if(t/=360,n/=100,0==(e/=100))o=i=a=n;else{var c=n<.5?n*(1+e):n+e-n*e,u=2*n-c;o=qt(u,c,t+1/3),i=qt(u,c,t),a=qt(u,c,t-1/3)}return{r:at(255*o),g:at(255*i),b:at(255*a)}}function te(t,e,n,r){if(1==arguments.length){var o=arguments[0];t=o.y,e=o.cr,n=o.cb;r=(r=o.bit)||0}var i=t+1.402*(e-r),a=t-.344*(n-r)-.714*(e-r),c=t+1.772*(n-r);return{r:Math.ceil(i),g:Math.ceil(a),b:Math.ceil(c)}}var ee={aliceblue:"rgb(240, 248, 255)",antiquewhite:"rgb(250, 235, 215)",aqua:"rgb(0, 255, 255)",aquamarine:"rgb(127, 255, 212)",azure:"rgb(240, 255, 255)",beige:"rgb(245, 245, 220)",bisque:"rgb(255, 228, 196)",black:"rgb(0, 0, 0)",blanchedalmond:"rgb(255, 235, 205)",blue:"rgb(0, 0, 255)",blueviolet:"rgb(138, 43, 226)",brown:"rgb(165, 42, 42)",burlywood:"rgb(222, 184, 135)",cadetblue:"rgb(95, 158, 160)",chartreuse:"rgb(127, 255, 0)",chocolate:"rgb(210, 105, 30)",coral:"rgb(255, 127, 80)",cornflowerblue:"rgb(100, 149, 237)",cornsilk:"rgb(255, 248, 220)",crimson:"rgb(237, 20, 61)",cyan:"rgb(0, 255, 255)",darkblue:"rgb(0, 0, 139)",darkcyan:"rgb(0, 139, 139)",darkgoldenrod:"rgb(184, 134, 11)",darkgray:"rgb(169, 169, 169)",darkgrey:"rgb(169, 169, 169)",darkgreen:"rgb(0, 100, 0)",darkkhaki:"rgb(189, 183, 107)",darkmagenta:"rgb(139, 0, 139)",darkolivegreen:"rgb(85, 107, 47)",darkorange:"rgb(255, 140, 0)",darkorchid:"rgb(153, 50, 204)",darkred:"rgb(139, 0, 0)",darksalmon:"rgb(233, 150, 122)",darkseagreen:"rgb(143, 188, 143)",darkslateblue:"rgb(72, 61, 139)",darkslategray:"rgb(47, 79, 79)",darkslategrey:"rgb(47, 79, 79)",darkturquoise:"rgb(0, 206, 209)",darkviolet:"rgb(148, 0, 211)",deeppink:"rgb(255, 20, 147)",deepskyblue:"rgb(0, 191, 255)",dimgray:"rgb(105, 105, 105)",dimgrey:"rgb(105, 105, 105)",dodgerblue:"rgb(30, 144, 255)",firebrick:"rgb(178, 34, 34)",floralwhite:"rgb(255, 250, 240)",forestgreen:"rgb(34, 139, 34)",fuchsia:"rgb(255, 0, 255)",gainsboro:"rgb(220, 220, 220)",ghostwhite:"rgb(248, 248, 255)",gold:"rgb(255, 215, 0)",goldenrod:"rgb(218, 165, 32)",gray:"rgb(128, 128, 128)",grey:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",greenyellow:"rgb(173, 255, 47)",honeydew:"rgb(240, 255, 240)",hotpink:"rgb(255, 105, 180)",indianred:"rgb(205, 92, 92)",indigo:"rgb(75, 0, 130)",ivory:"rgb(255, 255, 240)",khaki:"rgb(240, 230, 140)",lavender:"rgb(230, 230, 250)",lavenderblush:"rgb(255, 240, 245)",lawngreen:"rgb(124, 252, 0)",lemonchiffon:"rgb(255, 250, 205)",lightblue:"rgb(173, 216, 230)",lightcoral:"rgb(240, 128, 128)",lightcyan:"rgb(224, 255, 255)",lightgoldenrodyellow:"rgb(250, 250, 210)",lightgreen:"rgb(144, 238, 144)",lightgray:"rgb(211, 211, 211)",lightgrey:"rgb(211, 211, 211)",lightpink:"rgb(255, 182, 193)",lightsalmon:"rgb(255, 160, 122)",lightseagreen:"rgb(32, 178, 170)",lightskyblue:"rgb(135, 206, 250)",lightslategray:"rgb(119, 136, 153)",lightslategrey:"rgb(119, 136, 153)",lightsteelblue:"rgb(176, 196, 222)",lightyellow:"rgb(255, 255, 224)",lime:"rgb(0, 255, 0)",limegreen:"rgb(50, 205, 50)",linen:"rgb(250, 240, 230)",magenta:"rgb(255, 0, 255)",maroon:"rgb(128, 0, 0)",mediumaquamarine:"rgb(102, 205, 170)",mediumblue:"rgb(0, 0, 205)",mediumorchid:"rgb(186, 85, 211)",mediumpurple:"rgb(147, 112, 219)",mediumseagreen:"rgb(60, 179, 113)",mediumslateblue:"rgb(123, 104, 238)",mediumspringgreen:"rgb(0, 250, 154)",mediumturquoise:"rgb(72, 209, 204)",mediumvioletred:"rgb(199, 21, 133)",midnightblue:"rgb(25, 25, 112)",mintcream:"rgb(245, 255, 250)",mistyrose:"rgb(255, 228, 225)",moccasin:"rgb(255, 228, 181)",navajowhite:"rgb(255, 222, 173)",navy:"rgb(0, 0, 128)",oldlace:"rgb(253, 245, 230)",olive:"rgb(128, 128, 0)",olivedrab:"rgb(107, 142, 35)",orange:"rgb(255, 165, 0)",orangered:"rgb(255, 69, 0)",orchid:"rgb(218, 112, 214)",palegoldenrod:"rgb(238, 232, 170)",palegreen:"rgb(152, 251, 152)",paleturquoise:"rgb(175, 238, 238)",palevioletred:"rgb(219, 112, 147)",papayawhip:"rgb(255, 239, 213)",peachpuff:"rgb(255, 218, 185)",peru:"rgb(205, 133, 63)",pink:"rgb(255, 192, 203)",plum:"rgb(221, 160, 221)",powderblue:"rgb(176, 224, 230)",purple:"rgb(128, 0, 128)",rebeccapurple:"rgb(102, 51, 153)",red:"rgb(255, 0, 0)",rosybrown:"rgb(188, 143, 143)",royalblue:"rgb(65, 105, 225)",saddlebrown:"rgb(139, 69, 19)",salmon:"rgb(250, 128, 114)",sandybrown:"rgb(244, 164, 96)",seagreen:"rgb(46, 139, 87)",seashell:"rgb(255, 245, 238)",sienna:"rgb(160, 82, 45)",silver:"rgb(192, 192, 192)",skyblue:"rgb(135, 206, 235)",slateblue:"rgb(106, 90, 205)",slategray:"rgb(112, 128, 144)",slategrey:"rgb(112, 128, 144)",snow:"rgb(255, 250, 250)",springgreen:"rgb(0, 255, 127)",steelblue:"rgb(70, 130, 180)",tan:"rgb(210, 180, 140)",teal:"rgb(0, 128, 128)",thistle:"rgb(216, 191, 216)",tomato:"rgb(255, 99, 71)",turquoise:"rgb(64, 224, 208)",violet:"rgb(238, 130, 238)",wheat:"rgb(245, 222, 179)",white:"rgb(255, 255, 255)",whitesmoke:"rgb(245, 245, 245)",yellow:"rgb(255, 255, 0)",yellowgreen:"rgb(154, 205, 50)",transparent:"rgba(0, 0, 0, 0)"};var ne={isColorName:function(t){return!!ee[t]},getColorByName:function(t){return ee[t]}};function re(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e-1||e[r].indexOf("rgb")>-1||e[r].indexOf("hsl")>-1)n.push({color:e[r]});else{var i=ne.getColorByName(e[r]);i&&n.push({color:e[r],nameColor:i})}var a={next:0};return n.forEach(function(e){var n=t.indexOf(e.color,a.next);e.startIndex=n,e.endIndex=n+e.color.length,a.next=e.endIndex}),n}function se(t){var e=ue(t);return e.forEach(function(e,n){t=t.replace(e.color,"@"+n)}),{str:t,matches:e}}function le(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",",n=se(t);return n.str.split(e).map(function(t,e){return t=he(t),n.matches[e]&&(t=t.replace("@"+e,n.matches[e].color)),t})}function fe(t,e){return e.forEach(function(e,n){t=t.replace("@"+n,e.color)}),t}var pe=/^\s+|\s+$/g;function he(t){return t.replace(pe,"")}function ye(t){if(V(t)){if(ne.isColorName(t)&&(t=ne.getColorByName(t)),t.indexOf("rgb(")>-1){for(var e=0,n=(r=t.replace("rgb(","").replace(")","").split(",")).length;e-1){for(e=0,n=(r=t.replace("rgba(","").replace(")","").split(",")).length;e-1){for(e=0,n=(r=t.replace("hsl(","").replace(")","").split(",")).length;e-1){for(e=0,n=(r=t.replace("hsla(","").replace(")","").split(",")).length;e>16,g:(65280&t)>>8,b:(255&t)>>0,a:1},Lt(i));if(0<=t&&t<=4294967295)return i=oe({},i={type:"hex",r:(4278190080&t)>>24,g:(16711680&t)>>16,b:(65280&t)>>8,a:(255&t)/255},Lt(i))}return t}function de(t){V(t)&&(t=le(t));var e=(t=t.map(function(t){if(V(t)){var e=se(t),n=he(e.str).split(" ");return n[1]?n[1].indexOf("%")>-1?n[1]=parseFloat(n[1].replace(/%/,""))/100:n[1]=parseFloat(n[1]):n[1]="*",n[0]=fe(n[0],e.matches),n}if(Array.isArray(t))return t[1]?V(t[1])&&(t[1].indexOf("%")>-1?t[1]=parseFloat(t[1].replace(/%/,""))/100:t[1]=+t[1]):t[1]="*",re(t)})).filter(function(t){return"*"===t[1]}).length;if(e>0){var n=(1-t.filter(function(t){return"*"!=t[1]&&1!=t[1]}).map(function(t){return t[1]}).reduce(function(t,e){return t+e},0))/e;t.forEach(function(e,r){"*"==e[1]&&r>0&&(t.length-1==r||(e[1]=n))})}return t}function ve(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"hex",o=be(t,e,n);return q(o,o.a<1?"rgb":r)}function be(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5;return{r:at(t.r+(e.r-t.r)*n),g:at(t.g+(e.g-t.g)*n),b:at(t.b+(e.b-t.b)*n),a:at(t.a+(e.a-t.a)*n,100)}}function ge(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;if(!t)return[];V(t)&&(t=le(t));for(var n=(t=t||[]).length,r=[],o=0;o2&&void 0!==arguments[2]?arguments[2]:.5,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"hex";return ve(ye(t),ye(e),n,r)}function we(t,e){return me(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5,arguments.length>3&&void 0!==arguments[3]?arguments[3]:"hex")}function ke(t){return t=ye(t),(Math.round(299*t.r)+Math.round(587*t.g)+Math.round(114*t.b))/1e3}function Oe(t){return ke(t)>=128?"black":"white"}function Se(t){for(var e=[],n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:10)-((t=de(t)).length-1),r=n,o=1,i=t.length;o1&&void 0!==arguments[1]?arguments[1]:"h",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:9,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"rgb",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:100,c=It(ye(t)),u=(i-o)*a/n,s=[],l=1;l<=n;l++)c[e]=Math.abs((a-u*l)/a),s.push(q(Ut(c),r));return s}function Pe(t){return je(t,"h",arguments.length>1&&void 0!==arguments[1]?arguments[1]:9,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rgb",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,arguments.length>4&&void 0!==arguments[4]?arguments[4]:360,1)}function xe(t){return je(t,"s",arguments.length>1&&void 0!==arguments[1]?arguments[1]:9,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rgb",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,100)}function _e(t){return je(t,"v",arguments.length>1&&void 0!==arguments[1]?arguments[1]:9,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rgb",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,100)}function Te(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}ge.parula=function(t){return ge(["#352a87","#0f5cdd","#00b5a6","#ffc337","#fdff00"],t)},ge.jet=function(t){return ge(["#00008f","#0020ff","#00ffff","#51ff77","#fdff00","#ff0000","#800000"],t)},ge.hsv=function(t){return ge(["#ff0000","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff","#ff0000"],t)},ge.hot=function(t){return ge(["#0b0000","#ff0000","#ffff00","#ffffff"],t)},ge.pink=function(t){return ge(["#1e0000","#bd7b7b","#e7e5b2","#ffffff"],t)},ge.bone=function(t){return ge(["#000000","#4a4a68","#a6c6c6","#ffffff"],t)},ge.copper=function(t){return ge(["#000000","#3d2618","#9d623e","#ffa167","#ffc77f"],t)};var Ee=function(t){for(var e=1;e=t){e=Ce[r-1],n=Ce[r];break}return e&&n?Ee.interpolateRGB(e,n,(t-e.start)/(n.start-e.start)):Ce[0].rgb}};function Re(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ve=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(Be(this,t),this.value=e,M(this.value)&&isNaN(this.value))throw new Error("NaN is not able to set");this.unit=n}var e,n,r;return e=t,n=[{key:Symbol.toPrimitive,value:function(t){return"number"==t?this.value:this.toString()}},{key:"toString",value:function(){switch(this.unit){case"string":case"number":return this.value+"";case"var":return"var(--".concat(this.value,")");case"calc":return"calc(".concat(this.value,")");default:return this.value+this.unit}}},{key:"isUnitType",value:function(t){return this.unit===t}},{key:"isCalc",value:function(){return this.isUnitType("calc")}},{key:"isFr",value:function(){return this.isUnitType("fr")}},{key:"isPercent",value:function(){return this.isUnitType("%")}},{key:"isPx",value:function(){return this.isUnitType("px")}},{key:"isEm",value:function(){return this.isUnitType("em")}},{key:"isDeg",value:function(){return this.isUnitType("deg")}},{key:"isRad",value:function(){return this.isUnitType("rad")}},{key:"isTurn",value:function(){return this.isUnitType("turn")}},{key:"isSecond",value:function(){return this.isUnitType("s")}},{key:"isMs",value:function(){return this.isUnitType("ms")}},{key:"isNumber",value:function(){return this.isUnitType("number")}},{key:"isString",value:function(){return this.isUnitType("")}},{key:"isVar",value:function(){return this.isUnitType("--")}},{key:"isNaN",value:function(t){function e(){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(){return M(this.value)&&isNaN(this.value)})},{key:"set",value:function(t){return this.value=t,this}},{key:"add",value:function(t){return this.value+=+t,this}},{key:"sub",value:function(t){return this.add(-1*t)}},{key:"mul",value:function(t){return this.value*=+t,this}},{key:"div",value:function(t){return this.value/=+t,this}},{key:"mod",value:function(t){return this.value%=+t,this}},{key:"clone",value:function(){return new t(this.value,this.unit)}},{key:"getUnitName",value:function(){return"%"===this.unit?"percent":this.unit}},{key:"toJSON",value:function(){return this.toString()}},{key:"rate",value:function(t){return t/this.value}},{key:"stringToPercent",value:function(){return C(ze[this.value])?t.percent(ze[this.value]):t.percent(0)}},{key:"stringToEm",value:function(t){return this.stringToPercent().toEm(t)}},{key:"stringToPx",value:function(t){return this.stringToPercent().toPx(t)}},{key:"toPercent",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16;return this.isPercent()?this.clone():this.isPx()?t.percent(100*this.value/e):this.isEm()?t.percent(this.value*n*100/e):this.isString()?this.stringToPercent(e):this.isDeg()?t.percent(this.value/360*100):void 0}},{key:"toEm",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16;return this.isPercent()?t.em(this.value/100*e/n):this.isPx()?t.em(this.value/n):this.isEm()?this.clone():this.isString()?this.stringToEm(e):void 0}},{key:"toPx",value:function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.isPercent()?t.px(this.value/100*e):this.isPx()?this.clone():this.isEm()?t.px(this.value/100*e/16):this.isString()?this.stringToPx(e):void 0}},{key:"toDeg",value:function(){return this.isDeg()?this.clone():this.isTurn()?t.deg(360*this.value):this.isRad()?t.deg(this.value*(180/Math.PI)):void 0}},{key:"toTurn",value:function(){return this.isTurn()?this.clone():this.isDeg()?t.turn(this.value/360):void 0}},{key:"toSecond",value:function(){return this.isSecond()?this:this.isMs()?t.second(this.value/1e3):void 0}},{key:"toMs",value:function(){return this.isSecond()?t.ms(1e3*this.value):this.isMs()?this:void 0}},{key:"to",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16;return"px"===t?this.toPx(e,n):"%"===t||"percent"===t?this.toPercent(e,n):"em"===t?this.toEm(e,n):"deg"===t?this.toDeg():"turn"===t?this.toTurn():void 0}},{key:"toUnit",value:function(e){return new t(this.value,e)}},{key:"calculate",value:function(t,e){var n=this[t];return n?n.call(this,e):this}},{key:"includes",value:function(){for(var t=arguments.length,e=new Array(t),n=0;ne[o].value&&(r=e[o]);return r}},{key:"max",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n-1)return new t(e.split("calc(")[1].split(")")[0],"calc");var n=e.replace(Ge,"$1 $2").split(" ").map(function(t){return t.trim()});return+n[0]==n[0]?new t(+n[0],n[1]):new t(n[0])}if(e instanceof t)return e;if(e.unit){if("%"==e.unit||"percent"==e.unit){var r=0;return C(e.percent)?r=e.percent:C(e.value)&&(r=e.value),t.percent(r)}if("px"==e.unit){r=0;return C(e.px)?r=e.px:C(e.value)&&(r=e.value),t.px(r)}if("em"==e.unit){r=0;return C(e.em)?r=e.em:C(e.value)&&(r=e.value),t.em(r)}if("deg"==e.unit){r=0;return C(e.deg)?r=e.deg:C(e.value)&&(r=e.value),t.deg(r)}if("turn"==e.unit){r=0;return C(e.deg)?r=e.turn:C(e.value)&&(r=e.value),t.turn(r)}if("s"==e.unit){r=0;return C(e.second)?r=e.second:C(e.value)&&(r=e.value),t.second(r)}if("ms"==e.unit){r=0;return C(e.ms)?r=e.ms:C(e.value)&&(r=e.value),t.ms(r)}if("number"==e.unit){r=0;return C(e.value)&&(r=e.value),t.number(r)}if("--"==e.unit){r=0;return C(e.value)&&(r=e.value),t.var(r)}if(""===e.unit||"string"===e.unit){r="";return C(e.str)?r=e.str:C(e.value)&&(r=e.value),t.string(r)}}return t.string(e)}}],n&&Le(e.prototype,n),r&&Le(e,r),t}();function Xe(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:"block";return this.css("display","none"!=t?t:"block")}},{key:"hide",value:function(){return this.css("display","none")}},{key:"isHide",value:function(){return"none"==this.css("display")}},{key:"toggle",value:function(t){var e=this.isHide();return 1==arguments.length?e&&t?this.show():this.hide():e?this.show():this.hide()}},{key:"scrollIntoView",value:function(){this.el.scrollIntoView()}},{key:"addScrollLeft",value:function(t){return this.el.scrollLeft+=t,this}},{key:"addScrollTop",value:function(t){return this.el.scrollTop+=t,this}},{key:"setScrollTop",value:function(t){return this.el.scrollTop=t,this}},{key:"setScrollLeft",value:function(t){return this.el.scrollLeft=t,this}},{key:"scrollTop",value:function(){return this.el===document.body?t.getScrollTop():this.el.scrollTop}},{key:"scrollLeft",value:function(){return this.el===document.body?t.getScrollLeft():this.el.scrollLeft}},{key:"scrollHeight",value:function(){return this.el.scrollHeight}},{key:"scrollWidth",value:function(){return this.el.scrollWidth}},{key:"on",value:function(t,e,n,r){return this.el.addEventListener(t,e,n,r),this}},{key:"off",value:function(t,e){return this.el.removeEventListener(t,e),this}},{key:"getElement",value:function(){return this.el}},{key:"createChild",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=t.create(e,n,r);return i.css(o),this.append(i),i}},{key:"firstChild",value:function(){return t.create(this.el.firstElementChild)}},{key:"children",value:function(){var e=this.el.firstElementChild;if(!e)return[];var n=[];do{n.push(t.create(e)),e=e.nextElementSibling}while(e);return n}},{key:"childLength",value:function(){return this.el.children.length}},{key:"replace",value:function(t){return this.el.parentNode&&this.el.parentNode.replaceChild(t.el||t,this.el),this}},{key:"replaceChild",value:function(t,e){return this.el.replaceChild(e.el||e,t.el||t),this}},{key:"checked",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return 0==arguments.length?!!this.el.checked:(this.el.checked=!!t,this)}},{key:"click",value:function(){return this.el.click(),this}},{key:"focus",value:function(){return this.el.focus(),this}},{key:"select",value:function(){return this.el.select(),this}},{key:"blur",value:function(){return this.el.blur(),this}},{key:"select",value:function(){return this.el.select(),this}},{key:"context",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"2d";return this._initContext||(this._initContext=this.el.getContext(t)),this._initContext}},{key:"resize",value:function(t){var e=t.width,n=t.height;this._initContext=null;var r=this.context(),o=window.devicePixelRatio||1;this.px("width",+e),this.px("height",+n),this.el.width=e*o,this.el.height=n*o,r.scale(o,o)}},{key:"toDataURL",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.el.toDataURL(t,e)}},{key:"clear",value:function(){this.context().clearRect(0,0,this.el.width,this.el.height)}},{key:"update",value:function(t){this.clear(),t.call(this,this)}},{key:"drawImage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.context(),o=window.devicePixelRatio||1;r.drawImage(t,e,n,t.width,t.height,0,0,this.el.width/o,this.el.height/o)}},{key:"drawOption",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.context();Object.assign(e,t)}},{key:"drawLine",value:function(t,e,n,r){var o=this.context();o.beginPath(),o.moveTo(t,e),o.lineTo(n,r),o.stroke(),o.closePath()}},{key:"drawPath",value:function(){var t=this.context();t.beginPath();for(var e=arguments.length,n=new Array(e),r=0;r1&&void 0!==arguments[1]?arguments[1]:Qe;return" ".concat(e," ").concat(t)},Ue=/^load (.*)/gi,Ze=/^bind (.*)/gi,qe=["click|dblclick","mouse(down|up|move|over|out|enter|leave)","pointer(start|move|end)","touch(start|move|end)","key(down|up|press)","drag|drop|drag(start|over|enter|leave|exit|end)","contextmenu","change|input|focus|blur|focus(in|out)","paste","resize|scroll|wheel|mousewheel|DOMMouseScroll","submit","animation(start|end|iteration)","transition(start|end|cancel|run)"].join("|"),Je=new RegExp("^(".concat(qe,")"),"ig"),Qe="|",tn={},en=function(){for(var t=arguments.length,e=new Array(t),n=0;n1&&void 0!==arguments[1]?arguments[1]:Qe;return We(t,e)}),Tn=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qe;return We("after(".concat(t,")"),e)},En=_n,Cn=_n,$n=(_n("ArrowUp"),_n("ArrowDown"),_n("ArrowLeft"),_n("ArrowRight"),_n("Enter"),_n("Space"),_n("isAltKey")),Rn=(_n("isShiftKey"),_n("isMetaKey"),_n("isCtrlKey")),Vn=(_n("self"),_n("fit"),_n("passive"),_n("vdom")),An=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return _n("debounce(".concat(t,")"))},Dn=(An(1e3),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return _n("throttle(".concat(t,")"))}),In=(_n("capture()"),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"move";return Tn("bodyMouseMove ".concat(t))}),Mn=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";return Tn("bodyMouseUp ".concat(t))},Ln=Tn("preventDefault"),Bn=Tn("stopPropagation"),zn=function(){return"load "+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"$el")},Fn=function(){return!0},Gn=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"$el",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"bind "+t+(e?Qe+function(t){if(""===t)return"";var e=bt();return tn[e]=t,e}(e):"")},Hn={addEvent:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t&&t.addEventListener(e,n,r)},removeEvent:function(t,e,n){t&&t.removeEventListener(e,n)},pos:function(t){return t.touches&&t.touches[0]?t.touches[0]:t},posXY:function(t){var e=this.pos(t);return{x:e.pageX,y:e.pageY}}};function Xn(t,e){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0];!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cachedCallback={},this.callbacks={},this.commandes=[]}var e,n,r;return e=t,(n=[{key:"getCallbacks",value:function(t){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t]}},{key:"setCallbacks",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.callbacks[t]=e}},{key:"on",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=r>0?k(e,r):e;this.getCallbacks(t).push({event:t,callback:o,context:n,originalCallback:e})}},{key:"off",value:function(t,e){1==arguments.length?this.setCallbacks(t):2==arguments.length&&this.setCallbacks(t,this.getCallbacks(t).filter(function(t){return t.originalCallback!==e}))}},{key:"offAll",value:function(t){var e=this;Object.keys(this.callbacks).forEach(function(n){e.setCallbacks(n,e.getCallbacks(n).filter(function(e){return e.context!==t}))})}},{key:"getCachedCallbacks",value:function(t){return this.getCallbacks(t)}},{key:"sendMessage",value:function(t,e,n,r,o,i){var a=this;setTimeout(function(){var c=a.getCachedCallbacks(e);c&&c.filter(function(e){return e.originalCallback.source!==t}).forEach(function(t){t.callback(n,r,o,i)})},0)}},{key:"triggerMessage",value:function(t,e,n,r,o,i){var a=this;setTimeout(function(){var c=a.getCachedCallbacks(e);c?c.filter(function(e){return e.originalCallback.source===t}).forEach(function(t){t.callback(n,r,o,i)}):console.warn(e," is not valid event")},0)}},{key:"emit",value:function(t,e,n,r,o){this.sendMessage(this.source,t,e,n,r,o)}},{key:"trigger",value:function(t,e,n,r,o){this.triggerMessage(this.source,t,e,n,r,o)}},{key:"execute",value:function(t,e,n,r,o){this.runCommand(this.source,t,e,n,r,o)}}])&&Xn(e.prototype,n),r&&Xn(e,r),t}();function Kn(){var t=Un(["",""]);return Kn=function(){return t},t}function Wn(){var t=Un(["\n ","\n "]);return Wn=function(){return t},t}function Un(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function Zn(t,e){for(var n=0;n-1||!!e.key&&n.codes.indexOf(e.key.toLowerCase())>-1);var o=!0;return n.checkMethodList.length&&(o=n.checkMethodList.every(function(n){var r=t[n];return I(r)&&r?r.call(t,e):!C(r)||!!r})),r&&o},lr=function(t,e){var n=t.filter(function(t){return t.indexOf("".concat(e,"("))>-1}),r=n.map(function(t){var n=er(t.split("".concat(e,"("))[1].split(")")[0].trim().split(" "),2);return{target:n[0],param:n[1]}});return[n,r]},fr={touchstart:!0,touchmove:!0,mousedown:!0,mouseup:!0,mousemove:!0,wheel:!0,mousewheel:!0},pr=function(t,e,n){e.callback=function(t,e,n){return e.delegate?cr(t,e,n):ar(t,e,n)}(t,e,n),t.addBinding(e);var r=!!e.captures.length;fr[e.eventName]&&(r={passive:!0,capture:r}),Hn.addEvent(e.dom,e.eventName,e.callback,r)},hr=function(t,e,n,r){var o=Jn(e),i=o[0],a=o[1],c=o.slice(2),u=function(t,e,n){var r=n,o=r.filter(function(e){return!!t[e]}),i=er(lr(r,"after"),2),a=i[0],c=i[1],u=er(lr(r,"before"),2),s=u[0],l=u[1],f=er(lr(r,"debounce"),2),p=f[0],h=f[1],y=er(lr(r,"throttle"),2),d=y[0],v=y[1],b=er(lr(r,"capture"),1)[0],g=[].concat(Qn(o),Qn(a),Qn(s),Qn(p),Qn(d),Qn(b));return{eventName:e,codes:r.filter(function(t){return-1===g.indexOf(t)}).map(function(t){return t.toLowerCase()}),captures:b,afterMethods:c,beforeMethods:l,debounceMethods:h,throttleMethods:v,checkMethodList:o}}(t,i,n);if(u.dom=function(t,e){var n;return(n=e?t.refs[e]||t[e]||window[e]:t.el||t.$el||t.$root)instanceof Ke?n.getElement():n}(t,a),u.delegate=c.join(" "),u.debounceMethods.length)r=k(r,+u.debounceMethods[0].target);else if(u.throttleMethods.length){r=O(r,+u.throttleMethods[0].target)}pr(t,u,r)},yr=function(t,e){var n=e.split(Qe).map(function(t){return t.trim()}),r=Jn(n.shift().split(" ")),o=r[0],i=r.slice(1),a=function(t){var e=[];return t.split(":").forEach(function(t){var n=t.split(":");e.push.apply(e,Qn(n))}),e}(o),c=t[e].bind(t);a.forEach(function(e){hr(t,[e].concat(Qn(i)),n,c)})},dr=(qn(Yn={constructor:!0,initState:!0,refresh:!0,updateData:!0},"constructor",!0),qn(Yn,"initializeProperty",!0),qn(Yn,"created",!0),qn(Yn,"getRealEventName",!0),qn(Yn,"initializeStoreEvent",!0),qn(Yn,"destoryStoreEvent",!0),qn(Yn,"destroy",!0),qn(Yn,"emit",!0),qn(Yn,"trigger",!0),qn(Yn,"on",!0),qn(Yn,"off",!0),qn(Yn,"setState",!0),qn(Yn,"_reload",!0),qn(Yn,"render",!0),qn(Yn,"initialize",!0),qn(Yn,"afterRender",!0),qn(Yn,"components",!0),qn(Yn,"getRef",!0),qn(Yn,"parseTemplate",!0),qn(Yn,"childrenIds",!0),qn(Yn,"exists",!0),qn(Yn,"parseProperty",!0),qn(Yn,"parseSourceName",!0),qn(Yn,"parseComponent",!0),qn(Yn,"clean",!0),qn(Yn,"refresh",!0),qn(Yn,"loadTemplate",!0),qn(Yn,"load",!0),qn(Yn,"bindData",!0),qn(Yn,"template",!0),qn(Yn,"templateClass",!0),qn(Yn,"eachChildren",!0),qn(Yn,"initializeEvent",!0),qn(Yn,"destroy",!0),qn(Yn,"destroyDomEvent",!0),qn(Yn,"initializeDomEvent",!0),qn(Yn,"collectProps",!0),qn(Yn,"filterProps",!0),qn(Yn,"self",!0),qn(Yn,"isAltKey",!0),qn(Yn,"isCtrlKey",!0),qn(Yn,"isShiftKey",!0),qn(Yn,"isMetaKey",!0),qn(Yn,"preventDefault",!0),qn(Yn,"stopPropagation",!0),qn(Yn,"bodyMouseMove",!0),qn(Yn,"bodyMouseUp",!0),qn(Yn,"getBindings",!0),qn(Yn,"addBinding",!0),qn(Yn,"initBindings",!0),qn(Yn,"removeEventAll",!0),qn(Yn,"removeEvent",!0),Yn),vr=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state={},this.prevState={},this.refs={},this.children={},this._bindings=[],this.id=bt(),this.initComponents()}var e,n,r;return e=t,(n=[{key:"initComponents",value:function(){var t=this;this.childComponents=this.components(),this.childComponentKeys=Object.keys(this.childComponents),this.childComponentSet=new Map,this.childComponentKeys.forEach(function(e){t.childComponentSet.set(e.toLowerCase(),e)}),this.childComponentKeysString=Qn(this.childComponentSet.keys()).join(",")}},{key:"initState",value:function(){return{}}},{key:"setState",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.prevState=this.state,this.state=Object.assign({},this.state,t),e&&this.load()}},{key:"_reload",value:function(t){this.props=t,this.setState(this.initState(),!1),this.refresh(!0)}},{key:"render",value:function(t){this.$el=this.parseTemplate(X(Wn(),this.template())),this.refs.$el=this.$el,t&&t.append(this.$el),this.load(),this.parseComponent(!1),this.afterRender()}},{key:"initialize",value:function(){this.state=this.initState()}},{key:"afterRender",value:function(){}},{key:"components",value:function(){return{}}},{key:"getRef",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n-1}},{key:"parseProperty",value:function(t){var e={},n=!0,r=!1,o=void 0;try{for(var i,a=t.el.attributes[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var c=i.value;e[c.nodeName]=c.nodeValue}}catch(t){r=!0,o=t}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return t.$$("property").forEach(function(t){var n=er(t.attrs("name","value","type"),3),r=n[0],o=n[1],i=n[2],a=o||t.text();"json"===i&&(a=JSON.parse(a)),e[r]=a}),e}},{key:"parseSourceName",value:function(t){return t.parent?[t.sourceName].concat(Qn(this.parseSourceName(t.parent))):[t.sourceName]}},{key:"parseComponent",value:function(){var t=this,e=this.$el,n=[];this.childComponentKeysString&&(n=e.$$(this.childComponentKeysString)),n.forEach(function(e){var n=e.el.tagName.toLowerCase(),r=t.childComponentSet.get(n),o=t.childComponents[r],i=t.parseProperty(e),a=e.attr("ref"),c=null;t.children[a]?(c=t.children[a])._reload(i):(c=new o(t,i),t.children[a||c.id]=c,c.render(),c.initializeEvent()),e.replace(c.$el)}),S(this.children,function(e,n){n&&n.clean()&&delete t.children[e]})}},{key:"clean",value:function(){if(this.$el&&!this.$el.hasParent())return S(this.children,function(t,e){e.clean()}),this.destroy(),this.$el=null,!0}},{key:"refresh",value:function(){this.load()}},{key:"loadTemplate",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n-1}).forEach(function(e){var r=Jn(e.split("load ")[1].split(Qe).map(function(t){return t.trim()})),o=r[0],i=r.slice(1),a=(i=i.map(function(t){return t.trim()})).indexOf(Vn.value)>-1;if(t.refs[o]){var c,u=(c=t[e]).call.apply(c,[t].concat(n));$(u)&&(u=u.join(""));var s=t.parseTemplate(X(Kn(),u),!0);a?t.refs[o].htmlDiff(s):t.refs[o].html(s),t.initializeDomEvent()}}),this.bindData(),this.parseComponent()}},{key:"bindData",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r-1}).forEach(function(e){var r,o=t[e],i=er(e.split(Qe),2),a=(e=i[0],i[1]),c=t.getRef(a),u=Fn;""!=c&&V(c)?(r=c,u=function(){return this.prevState[r]!=this.state[r]}):I(c)&&(u=c);var s=e.split("bind ")[1],l=t.refs[s],f=I(u)&&u.call(t);if(l&&f){var p=o.call.apply(o,[t].concat(n));if(!p)return;S(p,function(t,e){!function(t,e,n){if("cssText"===e)t.cssText(n);else{if("style"===e)return void(A(n)&&t.css(n));if("class"===e)return void($(n)?t.addClass.apply(t,Qn(n)):D(n)?S(n,function(e,n){return t.toggleClass(e,n)}):t.addClass(n))}E(n)?t.removeAttr(e):"TEXTAREA"===t.el.nodeName&&"value"===e?t.text(n):"text"===e||"textContent"===e?t.text(n):"innerHTML"===e||"html"===e?t.html(n):t.attr(e,n)}(l,t,e)})}})}},{key:"template",value:function(){var t=this.templateClass(),e=t?'class="'.concat(t,'"'):"";return"
")}},{key:"templateClass",value:function(){return null}},{key:"eachChildren",value:function(t){I(t)&&S(this.children,function(e,n){t(n)})}},{key:"initializeEvent",value:function(){this.initializeDomEvent()}},{key:"destroy",value:function(){this.eachChildren(function(t){t.destroy()}),this.destroyDomEvent()}},{key:"destroyDomEvent",value:function(){this.removeEventAll()}},{key:"initializeDomEvent",value:function(){var t=this;this.destroyDomEvent(),this._domEvents||(this._domEvents=this.filterProps(Je)),this._domEvents.forEach(function(e){return yr(t,e)})}},{key:"collectProps",value:function(){var t=this,e=this.__proto__,n=[];do{if(!1===e instanceof Object)break;var r=Object.getOwnPropertyNames(e).filter(function(e){return I(t[e])&&!dr[e]});n.push.apply(n,Qn(r)),e=e.__proto__}while(e);return n}},{key:"filterProps",value:function(t){return this.collectProps().filter(function(e){return e.match(t)})}},{key:"self",value:function(t){return t&&t.$delegateTarget&&t.$delegateTarget.is(t.target)}},{key:"isAltKey",value:function(t){return t.altKey}},{key:"isCtrlKey",value:function(t){return t.ctrlKey}},{key:"isShiftKey",value:function(t){return t.shiftKey}},{key:"isMetaKey",value:function(t){return t.metaKey||"Meta"==t.key||t.code.indexOf("Meta")>-1}},{key:"preventDefault",value:function(t){return t.preventDefault(),!0}},{key:"stopPropagation",value:function(t){return t.stopPropagation(),!0}},{key:"bodyMouseMove",value:function(t,e){this[e]&&this.emit("add/body/mousemove",this[e],this,t.xy)}},{key:"bodyMouseUp",value:function(t,e){this[e]&&this.emit("add/body/mouseup",this[e],this,t.xy)}},{key:"getBindings",value:function(){return this._bindings||this.initBindings(),this._bindings}},{key:"addBinding",value:function(t){this.getBindings().push(t)}},{key:"initBindings",value:function(){this._bindings=[]}},{key:"removeEventAll",value:function(){var t=this;this.getBindings().forEach(function(e){t.removeEvent(e)}),this.initBindings()}},{key:"removeEvent",value:function(t){var e=t.eventName,n=t.dom,r=t.callback;Hn.removeEvent(n,e,r)}}])&&Zn(e.prototype,n),r&&Zn(e,r),t}();function br(t){return(br="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})(t)}function gr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function mr(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=wr(this,Or(e).call(this,t))).initializeProperty(t,r),n.created(),n.initialize(),n.initializeStoreEvent(),n}var n,r,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}}),e&&Sr(t,e)}(e,vr),n=e,(r=[{key:"initializeProperty",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.opt=t||{},this.parent=this.opt,this.props=e,this.source=bt(),this.sourceName=this.constructor.name,t&&t.$store&&(this.$store=t.$store)}},{key:"created",value:function(){}},{key:"getRealEventName",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ME@",n=t.indexOf(e);return t.substr(n<0?0:n+e.length)}},{key:"initializeStoreEvent",value:function(){var t=this;this.storeEvents={},this.filterProps(jr).forEach(function(e){var n=t.getRealEventName(e,"ME@"),r=gr(lr(n.split("|"),"debounce"),2),o=r[0],i=r[1],a=0;o.length&&(a=+i[0].target||0),n.split("|").filter(function(t){return-1===o.indexOf(t)}).map(function(t){return t.trim()}).forEach(function(n){var r=t[e].bind(t);r.displayName=n,r.source=t.source,t.storeEvents[n]=r,t.$store.on(n,t.storeEvents[n],t,a)})})}},{key:"destoryStoreEvent",value:function(){this.$store.offAll(this),this.storeEvents={}}},{key:"destroy",value:function(){kr(Or(e.prototype),"destroy",this).call(this),this.destoryStoreEvent()}},{key:"emit",value:function(t,e,n,r,o){this.$store.source=this.source,this.$store.sourceContext=this,this.$store.emit(t,e,n,r,o)}},{key:"trigger",value:function(t,e,n,r,o){this.$store.source=this.source,this.$store.trigger(t,e,n,r,o)}},{key:"on",value:function(t,e){this.$store.on(t,e)}},{key:"off",value:function(t,e){this.$store.off(t,e)}}])&&mr(n.prototype,r),o&&mr(n,o),e}();function Tr(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ref=new Proxy(this,{get:function(t,e){var n=t[e];return I(n)?function(){for(var e=arguments.length,r=new Array(e),o=0;o0&&void 0!==arguments[0]?arguments[0]:"";return this.json.id+t}},{key:"recover",value:function(){}},{key:"setCache",value:function(){}},{key:"is",value:function(){if(!this.json)return!1;for(var t=arguments.length,e=new Array(t),n=0;n-1}},{key:"isNot",value:function(){return!1===this.is.apply(this,arguments)}},{key:"convert",value:function(t){var e=this;return t.layers.forEach(function(t){t.parent=e.ref}),t}},{key:"checkField",value:function(t,e){return!0}},{key:"toCloneObject",value:function(){return{itemType:this.json.itemType,elementType:this.json.elementType,type:this.json.type,visible:this.json.visible,lock:this.json.lock,selected:this.json.selected,layers:this.json.layers.map(function(t){return t.clone()})}}},{key:"clone",value:function(){var t=new(0,this.constructor)(this.toCloneObject());return t.parent=this.json.parent,t}},{key:"reset",value:function(e){e instanceof t&&(e=e.toJSON()),this.json=this.convert($r({},this.json,e))}},{key:"getDefaultObject",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return $r({id:gt(),visible:!0,lock:!1,selected:!1,layers:[]},t)}},{key:"add",value:function(t){return this.json.layers.push(t),t.parent=this.ref,t}},{key:"toggle",value:function(t,e){E(e)?this.json[t]=!this.json[t]:this.json[t]=!!e}},{key:"expectJSON",value:function(t){return"parent"!==t&&""!==this.json[t]}},{key:"toJSON",value:function(){var t=this,e=this.json,n={};return Object.keys(e).filter(function(e){return t.expectJSON(e)}).forEach(function(t){n[t]=e[t]}),n}},{key:"resize",value:function(){}},{key:"copy",value:function(){return this.json.parent.copyItem(this.ref)}},{key:"copyItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=t.clone();n.x.add(e),n.y.add(e);for(var r=this.json.layers,o=-1,i=0,a=r.length;i-1&&this.json.layers.splice(o+1,0,n),n}},{key:"remove",value:function(){this.json.parent.removeItem(this.ref)}},{key:"removeItem",value:function(t){for(var e=this.json.layers,n=-1,r=0,o=e.length;r-1&&this.json.layers.splice(n,1)}},{key:"getIndex",value:function(){for(var t=-1,e=0,n=this.json.parent.layers.length;e-1&&this.setOrder(t+1)}},{key:"orderPrev",value:function(){var t=this.getIndex();t>0&&this.setOrder(t-1)}},{key:"orderFirst",value:function(){this.setOrder(0)}},{key:"orderLast",value:function(){this.setOrder(this.json.parent.layers.length-1)}},{key:"searchById",value:function(t){if(this.id===t)return this.ref;for(var e=0,n=this.layers.length;e0&&void 0!==arguments[0]?arguments[0]:{})}},{key:"isAttribute",value:function(){return!0}},{key:"toCSS",value:function(){return{}}},{key:"toString",value:function(){return Y(this.toCSS())}}])&&Lr(n.prototype,r),o&&Lr(n,o),e}();function Hr(t){return(Hr="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})(t)}function Xr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Yr(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};return Zr(qr(e.prototype),"getDefaultObject",this).call(this,Nr({itemType:"transform",type:"",value:[]},t))}},{key:"toCloneObject",value:function(){return Nr({},Zr(qr(e.prototype),"toCloneObject",this).call(this),{value:JSON.parse(JSON.stringify(this.json.value))})}},{key:"toString",value:function(){return"".concat(this.json.type,"(").concat(this.json.value.join(", ")||"",")")}},{key:"convert",value:function(t){return(t=Zr(qr(e.prototype),"convert",this).call(this,t)).type.includes("matrix")||t.type.includes("scale")?t.value=t.value.map(function(t){return He.number(t)}):t.value=t.value.map(function(t){return He.parse(t)}),t}},{key:"hasNumberValue",value:function(){var t=this.json.type;return t.includes("matrix")||t.includes("scale")}}])&&Wr(n.prototype,r),o&&Wr(n,o),e}();function eo(t){return(eo="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})(t)}function no(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ro(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);ethis.screenX2.value)&&!(t.y.value>this.screenY2.value)))}},{key:"toBoundCSS",value:function(){var t=this.json,e=t.x;return{top:t.y,left:e,width:t.width,height:t.height,transform:t.transform,"transform-origin":t["transform-origin"]}}},{key:"move",value:function(t,e){return this.reset({x:t,y:e}),this}},{key:"moveX",value:function(t){return this.reset({x:t}),this}},{key:"moveY",value:function(t){return this.reset({y:t}),this}},{key:"resize",value:function(t,e){return t.value>=0&&e.value>=0&&this.reset({width:t,height:e}),this}},{key:"resizeWidth",value:function(t){return t.value>=0&&this.reset({width:t}),this}},{key:"resizeHeight",value:function(t){return t.value>=0&&this.reset({height:t}),this}},{key:"getTransform",value:function(t){var e=to.parseStyle(Ke.create(t).css("transform")),n=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];if(!e.length)return{rotate:{x:0,y:0,z:0},translate:{x:0,y:0,z:0}};var r,o,i=(n=e[0].value.map(function(t){return+t}))[0],a=(n[1],n[2]),c=(n[3],n[4]),u=n[5],s=(n[6],n[7],n[8]),l=n[9],f=n[10],p=(n[11],n[12]),h=n[13],y=n[14],d=(n[15],Math.asin(-s));return 0!==Math.cos(d)?(r=Math.atan2(l,f),o=Math.atan2(c,i)):(r=Math.atan2(a,u),o=0),{rotate:{x:r,y:d,z:o},translate:{x:p,y:h,z:y}}}},{key:"verties",value:function(t,e){for(var n=t.offsetRect(),r=n.height,o=n.width/2,i=r/2,a={a:{x:-o,y:-i,z:0},b:{x:o,y:-i,z:0},c:{x:o,y:i,z:0},d:{x:-o,y:i,z:0}},c=this.getTransform(t.el);t.el&&(c=this.getTransform(t.el),a.a=it.addVector(it.rotateVector(a.a,c.rotate),c.translate),a.b=it.addVector(it.rotateVector(a.b,c.rotate),c.translate),a.c=it.addVector(it.rotateVector(a.c,c.rotate),c.translate),a.d=it.addVector(it.rotateVector(a.d,c.rotate),c.translate),(t=t.parent()).el!==e););return a}},{key:"checkInAreaForLayers",value:function(t){var e=[];return this.layers.forEach(function(n){e.push.apply(e,ro(n.checkInAreaForLayers(t))),n.checkInArea(t)&&e.push(n)}),e}},{key:"isAbsolute",get:function(){return"absolute"===this.json.position}},{key:"isRelative",get:function(){return"relative"===this.json.position}},{key:"isChild",get:function(){if(this.json.parent&&(!1===this.json.parent.is("project")&&this.isAbsolute))return!0;return!1}},{key:"screenX",get:function(){return this.isChild?He.px(this.json.parent.screenX.value+this.json.x.value):this.json.x||He.px(0)}},{key:"screenY",get:function(){return this.isChild?He.px(this.json.parent.screenY.value+this.json.y.value):this.json.y||He.px(0)}},{key:"screenX2",get:function(){return He.px(this.screenX.value+this.json.width.value)}},{key:"screenY2",get:function(){return He.px(this.screenY.value+this.json.height.value)}},{key:"screenWidth",get:function(){return this.json.width}},{key:"screenHeight",get:function(){return this.json.height}},{key:"screenRect",get:function(){return{left:this.screenX,top:this.screenY,width:this.screenWidth,height:this.screenHeight}}},{key:"centerX",get:function(){var t=0;return 0!=this.json.width.value&&(t=Math.floor(this.json.width.value/2)),He.px(this.screenX.value+t)}},{key:"centerY",get:function(){var t=0;return 0!=this.json.height.value&&(t=Math.floor(this.json.height.value/2)),He.px(this.screenY.value+t)}},{key:"transformOrigin",get:function(){var t=no((this.json["transform-origin"]||"50% 50%").split(" ").map(function(t){return He.parse(t||"50%")}),2),e=t[0],n=t[1];return{left:e=e.toPx(this.screenWidth.value),top:n=n.toPx(this.screenHeight.value)}}},{key:"screenTransform",get:function(){return to.addTransform(this.json.parent.screenTransform,this.json.transform)}}])&&io(n.prototype,r),o&&io(n,o),e}();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})(t)}function po(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ho(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{})}}])&&ho(n.prototype,r),o&&ho(n,o),e}();function mo(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:1;return He.px(t).round(e)};var Oo=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.project=null,this.artboard=null,this.items=[],this.itemKeys={},this.colorsteps=[]}var e,n,r;return e=t,(n=[{key:"initialize",value:function(){this.colorsteps=[],this.items=[],this.itemKeys={}}},{key:"selectColorStep",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n0&&void 0!==arguments[0])||arguments[0];this.cachedItems=this.items.map(function(e){return t&&e.setCache(),e.clone()}),this.setAllRectCache()}},{key:"setAllRectCache",value:function(){var t=Number.MAX_SAFE_INTEGER,e=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER;this.cachedItems.forEach(function(o){t=Math.min(o.screenX.value,t),e=Math.min(o.screenY.value,e),n=Math.max(o.screenX2.value,n),r=Math.max(o.screenY2.value,r)}),t===Number.MAX_SAFE_INTEGER&&(t=0),e===Number.MAX_SAFE_INTEGER&&(e=0),n===Number.MIN_SAFE_INTEGER&&(n=0),r===Number.MIN_SAFE_INTEGER&&(r=0),this.allRect=new go({x:He.px(t),y:He.px(e),width:He.px(n-t),height:He.px(r-e)})}},{key:"each",value:function(t){var e=this;I(t)&&this.items.forEach(function(n,r){t(n,e.cachedItems[r])})}},{key:"reset",value:function(t){this.each(function(e){return e.reset(t)})}},{key:"resetCallback",value:function(t){this.each(function(e){return e.reset(t(e))})}},{key:"resize",value:function(){this.each(function(t){return t.resize()})}},{key:"remove",value:function(){this.each(function(t){return t.remove()}),this.empty()}},{key:"copy",value:function(){this.copyItems=this.items.map(function(t){return t})}},{key:"paste",value:function(){this.select.apply(this,wo(this.copyItems.map(function(t){return t.copy()}))),this.copy()}},{key:"move",value:function(t,e){this.each(function(n,r){n.move(ko(r.x.value+t),ko(r.y.value+e))})}},{key:"moveRight",value:function(t){this.each(function(e,n){e.resizeWidth(ko(n.width.value+t))})}},{key:"moveLeft",value:function(t){this.each(function(e,n){n.width.value-t>=0&&(e.moveX(ko(n.x.value+t)),e.resizeWidth(ko(n.width.value-t)))})}},{key:"moveBottom",value:function(t){this.each(function(e,n){e.resizeHeight(ko(n.height.value+t))})}},{key:"moveTop",value:function(t){this.each(function(e,n){n.height.value-t>=0&&(e.moveY(ko(n.y.value+t)),e.resizeHeight(ko(n.height.value-t)))})}},{key:"current",get:function(){return this.items[0]}},{key:"currentProject",get:function(){return this.project}},{key:"currentArtboard",get:function(){return this.artboard}},{key:"isEmpty",get:function(){return!this.length}},{key:"length",get:function(){return this.items.length}},{key:"isRelative",get:function(){return"relative"===(this.items[0]||{}).position}}])&&mo(e.prototype,n),r&&mo(e,r),t}();function So(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{},n=gt();return Ro(Vo(e.prototype),"getDefaultObject",this).call(this,To({itemType:"svgfilter",id:n,in:[],bound:{x:100,y:100,targetX:0,targetY:0},connected:[]},t))}},{key:"getInCount",value:function(){return 0}},{key:"setIn",value:function(t,e){this.json.in[t]={id:e.id,type:e.type}}},{key:"setConnected",value:function(t){0===this.json.connected.filter(function(e){return e.id===t.id}).length&&this.json.connected.push({id:t.id})}},{key:"convert",value:function(t){return V(t.in)&&(t.in=JSON.parse(t.in)),V(t.bound)&&(t.bound=JSON.parse(t.bound)),V(t.connected)&&(t.connected=JSON.parse(t.connected)),t}},{key:"toCloneObject",value:function(){return To({},Ro(Vo(e.prototype),"toCloneObject",this).call(this),{id:this.json.id,in:L(this.json.in),bound:L(this.json.bound),connected:L(this.json.connected)})}},{key:"getDefaultAttribute",value:function(){var t=this,e=[];return this.json.connected.length&&e.push('result="'.concat(this.json.id,'result"')),Object.keys(Io).filter(function(e){return!!t.json[e]}).forEach(function(n){e.push("".concat(n,'="').concat(t.json[n],'"'))}),e.join(" ")+" "+this.getSourceInAttribute()}},{key:"hasInIndex",value:function(){return!1}},{key:"getSourceInAttribute",value:function(t){var e=this;return(t||this.json.in).map(function(t,n){if(!t)return"";var r=0===n?"":n+1+"";return e.hasInIndex()||(r=""),Do.includes(t.type)?"in".concat(r,'="').concat(t.type,'"'):"in".concat(r,'="').concat(t.id,'result"')}).join(" ")}},{key:"toString",value:function(){var t=this.json,e=t.type,n=t.value;return"")}}])&&Co(n.prototype,r),o&&Co(n,o),e}();function Lo(t){return(Lo="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})(t)}function Bo(t,e){for(var n=0;n\n \n ')}}])&&Bo(n.prototype,r),o&&Bo(n,o),e}();function Yo(t){return(Yo="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})(t)}function No(t,e){for(var n=0;n\n ").concat(e.map(function(e){return"")}).join(""),"\n ")}}])&&No(n.prototype,r),o&&No(n,o),e}();function Jo(t){return(Jo="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})(t)}function Qo(t,e){for(var n=0;n")}},{key:"hasInIndex",value:function(){return!0}}])&&Qo(n.prototype,r),o&&Qo(n,o),e}();function ii(t){return(ii="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})(t)}function ai(t,e){for(var n=0;n")}}])&&ai(n.prototype,r),o&&ai(n,o),e}();function pi(t){return(pi="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})(t)}function hi(t,e){for(var n=0;n")}}])&&hi(n.prototype,r),o&&hi(n,o),e}();function mi(t){return(mi="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})(t)}function wi(t,e){for(var n=0;n")}},{key:"hasInIndex",value:function(){return!0}}])&&wi(n.prototype,r),o&&wi(n,o),e}();function xi(t){return(xi="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})(t)}function _i(t,e){for(var n=0;n")}}])&&_i(n.prototype,r),o&&_i(n,o),e}();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})(t)}function Ai(t,e){for(var n=0;n")}}])&&Ai(n.prototype,r),o&&Ai(n,o),e}();function zi(t){return(zi="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})(t)}function Fi(t,e){for(var n=0;n")}}])&&Fi(n.prototype,r),o&&Fi(n,o),e}();function Ki(t){return(Ki="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})(t)}function Wi(t,e){for(var n=0;n")}}])&&Wi(n.prototype,r),o&&Wi(n,o),e}();function ta(t){return(ta="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})(t)}function ea(t,e){return oa(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||ra()}function na(t){return oa(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||ra()}function ra(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function oa(t){if(Array.isArray(t))return t}function ia(t,e){for(var n=0;n\n ").concat(e&&""),"\n ").concat(n&&""),"\n ").concat(r&&""),"\n ").concat(o&&""),"\n ")}}])&&ia(n.prototype,r),o&&ia(n,o),e}();function fa(t){return(fa="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})(t)}function pa(t,e){for(var n=0;n")}}])&&pa(n.prototype,r),o&&pa(n,o),e}();function ga(t){return(ga="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})(t)}function ma(t,e){for(var n=0;n")}}])&&ma(n.prototype,r),o&&ma(n,o),e}();function Pa(t){return(Pa="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})(t)}function xa(t,e){for(var n=0;n")}}])&&xa(n.prototype,r),o&&xa(n,o),e}();function Ra(t){return(Ra="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})(t)}function Va(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Aa(t,e){for(var n=0;n\n ").concat(this.json.lightInfo,"\n ")}}])&&Aa(n.prototype,r),o&&Aa(n,o),e}();function za(t){return(za="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})(t)}function Fa(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ga(t,e){for(var n=0;n\n ").concat(this.json.lightInfo,"\n ")}},{key:"getSourceInAttribute",value:function(){return""}}])&&Ga(n.prototype,r),o&&Ga(n,o),e}();function Wa(t){return(Wa="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})(t)}function Ua(t,e){for(var n=0;n")}}])&&Ua(n.prototype,r),o&&Ua(n,o),e}();function ec(t){return oc(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||rc()}function nc(t,e){return oc(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||rc()}function rc(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function oc(t){if(Array.isArray(t))return t}function ic(t,e){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],r=nc(e.split("data:"),2),o=(r[0],ec(r[1].split(","))),i=o[0],a=o.slice(1),c=nc(i.split(";"),2),u=c[0],s=c[1];return a=a.join(","),{mimeType:u,local:n&&t.getLink(u,s,a)}}},{key:"getLink",value:function(t,e,n){if("base64"===e){for(var r=atob(n),o=r.length,i=new Uint8Array(o),a=0;a-1&&(n[e.local]=e.original)}),Object.keys(n).forEach(function(e){t.indexOf(e)>-1&&(t=t.replace(new RegExp(e,"g"),n[e]))}),t},gc=function(t){var e,n,r,o=JSON.stringify(t);return e=o,n=pl.projects,r={},n.forEach(function(t){t.images.forEach(function(t){e.indexOf(t.local)>-1&&(r[t.local]="#"+t.id)})}),Object.keys(r).forEach(function(t){e.indexOf(t)>-1&&(e=e.replace(new RegExp(t,"g"),r[t]))}),o=e},mc=function(t){var e=JSON.parse(t||"[]"),n={};return e.forEach(function(t){t.images.forEach(function(t){n["#".concat(t.id)]=t})}),Object.keys(n).map(function(t){var e=n[t],r=ac.parse(e.original,!0);e.local=r.local}),e.forEach(function(t){t.layers=function t(e,n){return $(e)?e=e.map(function(e){return t(e,n)}):D(e)?Object.keys(e).forEach(function(r){e[r]=t(e[r],n)}):V(e)&&Object.keys(n).forEach(function(t){var r=n[t];e.indexOf("#".concat(r.id))>-1&&(e=e.replace(new RegExp("#".concat(r.id),"g"),r.local))}),e}(t.layers,n)}),e};function wc(t){return(wc="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})(t)}function kc(t,e){for(var n=0;n")}},{key:"hasInIndex",value:function(){return!0}}])&&kc(n.prototype,r),o&&kc(n,o),e}();function _c(t){return(_c="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})(t)}function Tc(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ec(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return $c(Rc(e.prototype),"getDefaultObject",this).call(this,function(t){for(var e=1;e")}}])&&ju(n.prototype,r),o&&ju(n,o),e}();function Cu(t){return(Cu="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})(t)}function $u(t,e){for(var n=0;n")}}])&&$u(n.prototype,r),o&&$u(n,o),e}();function Mu(t){return(Mu="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})(t)}function Lu(t,e){for(var n=0;n")}}])&&Lu(n.prototype,r),o&&Lu(n,o),e}();function Xu(t){return(Xu="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})(t)}function Yu(t,e){for(var n=0;n")}}])&&Yu(n.prototype,r),o&&Yu(n,o),e}();function qu(t){return(qu="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})(t)}function Ju(t,e){for(var n=0;n")}}])&&Ju(n.prototype,r),o&&Ju(n,o),e}();function os(t){return(os="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})(t)}function is(t,e){for(var n=0;n")}}])&&is(n.prototype,r),o&&is(n,o),e}();function fs(t){return(fs="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})(t)}function ps(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hs(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return ds(vs(e.prototype),"getDefaultObject",this).call(this,function(t){for(var e=1;e")}}])&&hs(n.prototype,r),o&&hs(n,o),e}(),ws={Image:ls,Tile:rs,Saturate:Iu,HueRotate:Hu,LuminanceAlpha:Zu,DropShadow:Eu,SourceGraphic:Fc,SourceAlpha:Wc,BackgroundImage:eu,BackgroundAlpha:uu,FillPaint:du,StrokePaint:Ou,ComponentTransfer:la,DistantLight:ba,PointLight:ja,SpotLight:$a,DiffuseLighting:Ba,SpecularLighting:Ka,Blend:xc,Offset:tc,RotaMatrix:Xo,GaussianBlur:Ni,Flood:Qi,Merge:qo,Composite:oi,Morphology:fi,Turbulence:gi,DisplacementMap:Pi,ColorMatrix:Ri,ConvolveMatrix:Bi},ks={Image:ls.spec,Tile:rs.spec,DropShadow:Eu.spec,Saturate:Iu.spec,HueRotate:Hu.spec,LuminanceAlpha:Zu.spec,Offset:tc.spec,ComponentTransfer:la.spec,SpecularLighting:Ka.spec,SpotLight:$a.spec,PointLight:ja.spec,DistantLight:ba.spec,DiffuseLighting:Ba.spec,Blend:xc.spec,RotaMatrix:Xo.spec,Merge:qo.spec,GaussianBlur:Ni.spec,Flood:Qi.spec,Morphology:fi.spec,Composite:oi.spec,Turbulence:gi.spec,DisplacementMap:Pi.spec,ColorMatrix:Ri.spec,ConvolveMatrix:Bi.spec};function Os(t){return(Os="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})(t)}function Ss(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};return this.addProperty(js({checked:!0,value:He.px(0)},t))}},{key:"addProperty",value:function(t){this.json.properties.push(t)}},{key:"removeProperty",value:function(t){this.json.properties.splice(t,1)}},{key:"sortItem",value:function(t,e,n){t.splice.apply(t,[n+(e1&&void 0!==arguments[1]?arguments[1]:{};Object.assign(this.json.properties[+t],js({},e))}},{key:"updatePropertyByKey",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=-1,r=0,o=this.json.properties.length;re.offset.value?1:-1}),e.map(function(e){return 0===e.properties.length?"":t.toOffsetString(e)}).join("\n")}},{key:"toCSSText",value:function(){return this.json.offsets.map(function(t){return t}).sort(function(t,e){return t.offset.value>e.offset.value?1:-1}),"\n@keyframes ".concat(this.json.name," {\n\n ").concat(this.toOffsetText(),"\n\n}\n")}},{key:"createOffset",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.addOffset(new $s(Is({checked:!0},t)))}},{key:"addOffset",value:function(t){this.json.offsets.push(t)}},{key:"removeOffset",value:function(t){this.json.offsets.splice(t,1)}},{key:"sortItem",value:function(t,e,n){t.splice.apply(t,[n+(e1&&void 0!==arguments[1]?arguments[1]:{};this.json.offsets[+t].reset(e)}},{key:"toCSS",value:function(){return{}}},{key:"toString",value:function(){return this.toCSSText()}}])&&Ls(n.prototype,r),o&&Ls(n,o),e}();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})(t)}function Ys(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};return Zs(qs(e.prototype),"getDefaultObject",this).call(this,Ns({colors:[],gradients:[],svgfilters:[],svgimages:[],keyframes:[],images:[]},t))}},{key:"addKeyframe",value:function(t){return this.json.keyframes.push(t),t}},{key:"createKeyframe",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.addKeyframe(new Hs(Ns({checked:!0},t)))}},{key:"removeKeyframe",value:function(t){this.removePropertyList(this.json.keyframes,t)}},{key:"sortItem",value:function(t,e,n){t.splice.apply(t,[n+(e1&&void 0!==arguments[1]?arguments[1]:{};this.json.keyframes[+t].reset(e)}},{key:"toKeyframeString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.json.keyframes.map(function(e){return e.toString(t)}).join("\n\n")}},{key:"copyPropertyList",value:function(t,e){var n=Ns({},t[e]);t.splice(e,0,n)}},{key:"toSVGString",value:function(){return this.json.svgfilters.map(function(t){var e=t.filters.map(function(t){return ms.parse(t)});return"\n ").concat(e.join("\n"),"\n\n")}).join("\n\n")}},{key:"toCloneObject",value:function(){var t=this.json;return Ns({},Zs(qs(e.prototype),"toCloneObject",this).call(this),{colors:L(t.colors),gradients:L(t.gradients),svgfilters:L(t.svgfilters),svgimages:L(t.svgimages),images:L(t.images),keyframes:t.keyframes.map(function(t){return t.clone()})})}},{key:"removePropertyList",value:function(t,e){t.splice(e,1)}},{key:"removeColor",value:function(t){this.removePropertyList(this.json.colors,t)}},{key:"copyColor",value:function(t){this.copyPropertyList(this.json.colors,t)}},{key:"sortColor",value:function(t,e){this.sortItem(this.json.colors,t,e)}},{key:"setColorValue",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.json.colors[t]=Ns({},this.json.colors[t],e)}},{key:"getColor",value:function(t){return this.json.colors.filter(function(e){return e.name===t})[0]}},{key:"addColor",value:function(t){return this.json.colors.push(t),t}},{key:"createColor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.addColor(t)}},{key:"removeImage",value:function(t){this.removePropertyList(this.json.images,t)}},{key:"copyImage",value:function(t){this.copyPropertyList(this.json.images,t)}},{key:"sortImage",value:function(t,e){this.sortItem(this.json.images,t,e)}},{key:"setImageValue",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.json.images[t]=Ns({},this.json.images[t],e)}},{key:"addImage",value:function(t){return this.json.images.push(t),t}},{key:"createImage",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.addImage(t)}},{key:"removeGradient",value:function(t){this.removePropertyList(this.json.gradients,t)}},{key:"copyGradient",value:function(t){this.copyPropertyList(this.json.gradients,t)}},{key:"sortGradient",value:function(t,e){this.sortItem(this.json.gradients,t,e)}},{key:"setGradientValue",value:function(t,e){this.json.gradients[t]=Ns({},this.json.gradients[t],e)}},{key:"getGradient",value:function(t){return this.json.gradients.filter(function(e){return e.name===t})[0]}},{key:"addGradient",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.json.gradients.push(t),t}},{key:"createGradient",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.addGradient(t)}},{key:"getSVGFilterIndex",value:function(t){var e=this.json.svgfilters.map(function(t,e){return{id:t.id,index:e}}).filter(function(e){return e.id===t})[0];return e?e.index:-1}},{key:"removeSVGFilter",value:function(t){this.removePropertyList(this.json.svgfilters,t)}},{key:"copySVGFilter",value:function(t){this.copyPropertyList(this.json.svgfilters,t)}},{key:"sortSVGFilter",value:function(t,e){this.sortItem(this.json.svgfilters,t,e)}},{key:"setSVGFilterValue",value:function(t,e){this.json.svgfilters[t]=Ns({},this.json.svgfilters[t],e)}},{key:"addSVGFilter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.json.svgfilters.push(t),this.json.svgfilters.length-1}},{key:"createSVGFilter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.addSVGFilter(t)}},{key:"getSVGImageIndex",value:function(t){var e=this.json.svgimages.map(function(t,e){return{id:t.id,index:e}}).filter(function(e){return e.id===t})[0];return e?e.index:-1}},{key:"removeSVGImage",value:function(t){this.removePropertyList(this.json.svgimages,t)}},{key:"copySVGImage",value:function(t){this.copyPropertyList(this.json.svgimages,t)}},{key:"sortSVGImage",value:function(t,e){this.sortItem(this.json.svgimages,t,e)}},{key:"setSVGImageValue",value:function(t,e){this.json.svgimages[t]=Ns({},this.json.svgimages[t],e)}},{key:"addSVGImage",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.json.svgimages.push(t),this.json.svgimages.length-1}},{key:"createSVGImage",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.addSVGImage(t)}}])&&Ws(n.prototype,r),o&&Ws(n,o),e}();function tl(t){return(tl="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})(t)}function el(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};return al(cl(e.prototype),"getDefaultObject",this).call(this,el({itemType:"project",name:"new Project",description:"",rootVariable:""},t))}},{key:"toCloneObject",value:function(){var t=this.json,n=t.name,r=t.description,o=t.rootVariable;return el({},al(cl(e.prototype),"toCloneObject",this).call(this),{name:n,description:r,rootVariable:o})}},{key:"isAbsolute",get:function(){return!1}},{key:"artboards",get:function(){return this.json.layers||[]}},{key:"html",get:function(){return this.artboards.map(function(t){return t.html}).join("\n\n")}}])&&ol(n.prototype,r),o&&ol(n,o),e}();function ll(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:fl;this.mode=t}},{key:"isMode",value:function(t){return this.mode===t}},{key:"isAddMode",value:function(){return this.isMode("ADD")}},{key:"isSelectionMode",value:function(){return this.isMode(fl)}},{key:"changeAddType",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.changeMode("ADD"),this.addType=t}},{key:"changeTheme",value:function(t){t="light"===t?"light":"dark",this.theme=t,window.localStorage.setItem("easylogic.studio.theme",t)}},{key:"getFile",value:function(t){return this.images[t]||t}},{key:"setStore",value:function(t){this.$store=t}},{key:"send",value:function(){this.emit.apply(this,arguments)}},{key:"emit",value:function(){var t;this.$store&&(this.$store.source="EDITOR_ID",(t=this.$store).emit.apply(t,arguments))}},{key:"load",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.projects=t}},{key:"add",value:function(t){return this.projects.push(t),t}},{key:"remove",value:function(t){this.projects.splice(t,1)}},{key:"clear",value:function(){this.projects=[]}},{key:"get",value:function(t){return this.projects[t]}},{key:"zIndex",get:function(){return this.popupZIndex++}}])&&ll(e.prototype,n),r&&ll(e,r),t}());function hl(t){return(hl="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})(t)}function yl(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:[];this.$store=new Nn({modules:[].concat(yl(this.getModuleList()),yl(t))}),pl.setStore(this.$store),this.$container=Ke.create(this.getContainer()),this.$container.addClass(this.getClassName()),this.render(this.$container),this.initializeEvent(),this.initBodyMoves()}},{key:"initBodyMoves",value:function(){this.moves=new Set,this.ends=new Set,this.modifyBodyMoveSecond(10)}},{key:"modifyBodyMoveSecond",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;pl.config.set("body.move.ms",t),this.funcBodyMoves=k(this.loopBodyMoves.bind(this),pl.config.get("body.move.ms"))}},{key:"loopBodyMoves",value:function(){var t=pl.config.get("pos"),e=pl.config.get("lastPos")||wl;!(e.x===t.x&&e.y===t.y)&&this.moves.size&&(this.moves.forEach(function(e){var n=t.x-e.xy.x,r=t.y-e.xy.y;0==n&&0==r||e.func.call(e.context,n,r,"move")}),pl.config.set("lastPos",t)),requestAnimationFrame(this.funcBodyMoves)}},{key:"removeBodyMoves",value:function(){var t=pl.config.get("pos");this.ends.forEach(function(e){e.func.call(e.context,t.x-e.xy.x,t.y-e.xy.y,"end")}),this.moves.clear(),this.ends.clear()}},{key:Pr("add/body/mousemove"),value:function(t,e,n){this.moves.add({func:t,context:e,xy:n})}},{key:Pr("add/body/mouseup"),value:function(t,e,n){this.ends.add({func:t,context:e,xy:n})}},{key:"getModuleList",value:function(){return t.modules||[]}},{key:"getClassName",value:function(){return t.className||"csseditor"}},{key:"getContainer",value:function(){return t.container||document.body}},{key:"template",value:function(){return"
".concat(t.template,"
")}},{key:"components",value:function(){return t.components||{}}},{key:On("document"),value:function(t){var e=t.xy||ml;pl.config.set("bodyEvent",t),pl.config.set("pos",e),this.requestId||(this.requestId=requestAnimationFrame(this.funcBodyMoves))}},{key:Sn("document")+An(30),value:function(t){pl.config.set("bodyEvent",t),this.removeBodyMoves(),this.requestId=null}}])&&dl(r.prototype,o),i&&dl(r,i),n}())(t)},Ol={App:v,Color:Ee,HueColor:$e,ColorNames:ne};function Sl(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:[];this.state.currentColorSets.colors=t,this.$store.emit("changeCurrentColorSets")}},{key:"removeCurrentColor",value:function(t){this.state.currentColorSets.colors[t]&&(this.state.currentColorSets.colors.splice(t,1),this.$store.emit("changeCurrentColorSets"))}},{key:"removeCurrentColorToTheRight",value:function(t){this.state.currentColorSets.colors[t]&&(this.state.currentColorSets.colors.splice(t,Number.MAX_VALUE),this.$store.emit("changeCurrentColorSets"))}},{key:"clearPalette",value:function(){this.state.currentColorSets.colors&&(this.state.currentColorSets.colors=[],this.$store.emit("changeCurrentColorSets"))}},{key:"getUserList",value:function(){return Array.isArray(this.state.userList)&&this.state.userList.length?this.state.userList:this.state.colorSetsList}},{key:"getCurrentColors",value:function(){return this.getColors(this.state.currentColorSets)}},{key:"getColors",value:function(t){return t.scale?Ee.scale(t.scale,t.count):t.colors||[]}},{key:"getColorSetsList",value:function(){var t=this;return this.getUserList().map(function(e){return{name:e.name,edit:e.edit,colors:t.getColors(e)}})}},{key:"hsv",get:function(){return this.state.hsv}},{key:"rgb",get:function(){return this.state.rgb}},{key:"hsl",get:function(){return this.state.hsl}},{key:"hex",get:function(){return this.state.hex}},{key:"alpha",get:function(){return this.state.alpha}},{key:"format",get:function(){return this.state.format}}])&&Pl(e.prototype,n),r&&Pl(e,r),t}();function _l(t){return(_l="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})(t)}function Tl(t,e){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0];this.$body=null,this.$root=null,this.$store=new Nn,this.callbackChange=function(){t.callbackChangeValue()},this.colorpickerShowCallback=function(){},this.colorpickerHideCallback=function(){},this.$body=Ke.create(this.getContainer()),this.$root=Ke.create("div","codemirror-colorpicker"),"inline"==this.opt.position&&this.$body.append(this.$root),this.opt.type&&this.$root.addClass(this.opt.type),this.opt.hideInformation&&this.$root.addClass("hide-information"),this.opt.hideColorsets&&this.$root.addClass("hide-colorsets"),this.opt.width&&this.$root.css("width",this.opt.width),this.$arrow=Ke.create("div","arrow"),this.$root.append(this.$arrow),this.manager.setUserPalette(this.opt.colorSets),this.render(this.$root),this.initColorWithoutChangeEvent(this.opt.color),this.initializeEvent()}},{key:"initColorWithoutChangeEvent",value:function(t){this.manager.initColor(t),this.emit("initColor")}},{key:"show",value:function(t,e,n,r){this.colorpickerShowCallback=n,this.colorpickerHideCallback=r,this.$root.css(this.getInitalizePosition()).show(),this.definePosition(t),this.isColorPickerShow=!0,this.isShortCut=t.isShortCut||!1,this.outputFormat=t.outputFormat,this.hideDelay=+T(t.hideDelay,2e3),this.hideDelay>0&&this.setHideDelay(this.hideDelay),this.$root.appendTo(this.$body),this.initColorWithoutChangeEvent(e)}},{key:"initColor",value:function(t,e){this.manager.changeColor(t,e),this.emit("changeColor")}},{key:"changeColor",value:function(t,e){this.manager.changeColor(t,e)}},{key:"hide",value:function(){this.isColorPickerShow&&(this.$root.hide(),this.$root.remove(),this.isColorPickerShow=!1,this.callbackHideValue())}},{key:"setColorsInPalette",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.manager.setCurrentColorAll(t)}},{key:"setUserPalette",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.manager.setUserPalette(t)}},{key:"getOption",value:function(t){return this.opt[t]}},{key:"setOption",value:function(t,e){this.opt[t]=e}},{key:"getContainer",value:function(){return this.opt.container||document.body}},{key:"getColor",value:function(t){return this.manager.toColor(t)}},{key:"definePositionForArrow",value:function(t,e,n){}},{key:"definePosition",value:function(t){var e=this.$root.width(),n=this.$root.height(),r=t.left-this.$body.scrollLeft();e+r>window.innerWidth&&(r-=e+r-window.innerWidth),r<0&&(r=0);var o=t.top-this.$body.scrollTop();n+o>window.innerHeight&&(o-=n+o-window.innerHeight),o<0&&(o=0),this.$root.css({left:He.px(r),top:He.px(o)})}},{key:"getInitalizePosition",value:function(){return"inline"==this.opt.position?{position:"relative",left:"auto",top:"auto",display:"inline-block"}:{position:"absolute"==this.opt.position?"absolute":"fixed",left:He.px(-1e4),top:He.px(-1e4)}}},{key:"setHideDelay",value:function(t){var e=this;t=t||0;var n=this.hide.bind(this);this.$root.off("mouseenter"),this.$root.off("mouseleave"),this.$root.on("mouseenter",function(){clearTimeout(e.timerCloseColorPicker)}),this.$root.on("mouseleave",function(){clearTimeout(e.timerCloseColorPicker),e.timerCloseColorPicker=setTimeout(n,t)}),clearTimeout(this.timerCloseColorPicker)}},{key:"callbackChangeValue",value:function(t){t=t||this.getCurrentColor(),I(this.opt.onChange)&&this.opt.onChange.call(this,t),I(this.colorpickerShowCallback)&&this.colorpickerShowCallback(t)}},{key:"callbackHideValue",value:function(t){t=t||this.getCurrentColor(),I(this.opt.onHide)&&this.opt.onHide.call(this,t),I(this.colorpickerHideCallback)&&this.colorpickerHideCallback(t)}},{key:"getCurrentColor",value:function(){return this.manager.toColor(this.outputFormat)}},{key:"checkColorPickerClass",value:function(t){var e=Ke.create(t),n=e.closest("codemirror-colorview"),r=e.closest("codemirror-colorpicker"),o=e.closest("CodeMirror");t.nodeName;return!!(r||n||o)}},{key:"checkInHtml",value:function(t){return"HTML"==t.nodeName}},{key:"initializeStoreEvent",value:function(){Cl($l(e.prototype),"initializeStoreEvent",this).call(this),this.$store.on("changeColor",this.callbackChange,this),this.$store.on("changeFormat",this.callbackChange,this)}},{key:"destroy",value:function(){Cl($l(e.prototype),"destroy",this).call(this),this.$store.off("changeColor",this.callbackChange),this.$store.off("changeFormat",this.callbackChange),this.callbackChange=void 0,this.colorpickerShowCallback=void 0,this.colorpickerHideCallback=void 0}},{key:an("document"),value:function(t){this.checkInHtml(t.target)||0==this.checkColorPickerClass(t.target)&&this.hide()}},{key:"hsv",get:function(){return this.manager.hsv}},{key:"rgb",get:function(){return this.manager.rgb}},{key:"hsl",get:function(){return this.manager.hsl}},{key:"hex",get:function(){return this.manager.hex}},{key:"alpha",get:function(){return this.manager.alpha}},{key:"format",get:function(){return this.manager.format}}])&&Tl(n.prototype,r),o&&Tl(n,o),e}();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})(t)}function Dl(t,e){for(var n=0;nr?100:(t-n)/(r-n)*100}},{key:"getCalculatedDist",value:function(t){var e=t?this.getMousePosition(t):this.getCurrent(this.getDefaultValue()/this.state.maxValue);return this.getDist(e)}},{key:"getDefaultValue",value:function(){return 0}},{key:"setMousePosition",value:function(t){this.refs.$bar.css({left:He.px(t)})}},{key:"getMousePosition",value:function(t){return Hn.pos(t).pageX}},{key:"refresh",value:function(){this.setColorUI()}},{key:"setColorUI",value:function(t){(t=t||this.getDefaultValue())<=this.state.minValue?this.refs.$bar.addClass("first").removeClass("last"):t>=this.maxValue?this.refs.$bar.addClass("last").removeClass("first"):this.refs.$bar.removeClass("last").removeClass("first"),this.setMousePosition(this.getMaxDist()*((t||0)/this.state.maxValue))}}])&&Fl(n.prototype,r),o&&Fl(n,o),e}();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})(t)}function Kl(t,e){for(var n=0;n\n
\n
\n
\n \n '}},{key:Gn("$container"),value:function(){return{style:{"background-color":this.parent.manager.toString("rgb")}}}},{key:"getDefaultValue",value:function(){return this.parent.hsv.v}},{key:"refreshColorUI",value:function(t){var e=this.getCalculatedDist(t);this.setColorUI(e/100*this.state.maxValue),this.changeColor({type:"hsv",v:e/100*this.state.maxValue})}}])&&Kl(n.prototype,r),o&&Kl(n,o),e}();function Jl(t){return(Jl="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})(t)}function Ql(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tf(t,e){for(var n=0;n\n
\n
\n
\n
\n \n '}},{key:"refresh",value:function(){nf(rf(e.prototype),"refresh",this).call(this),this.setOpacityColorBar()}},{key:"setOpacityColorBar",value:function(){var t=function(t){for(var e=1;e\n \n
\n
\n \n '}},{key:"refresh",value:function(t){this.setColorUI(t)}},{key:"setColorUI",value:function(t){this.renderCanvas(),this.renderValue(),this.setHueColor(null,t)}},{key:"renderValue",value:function(){var t=1-this.parent.hsv.v;this.refs.$valuewheel.css("background-color","rgba(0, 0, 0, ".concat(t,")"))}},{key:"renderWheel",value:function(t,e){this.width&&!t&&(t=this.width),this.height&&!e&&(e=this.height);var n=Ke.create("canvas"),r=n.el.getContext("2d");n.el.width=t,n.el.height=e,n.px("width",t),n.px("height",e);for(var o=r.getImageData(0,0,t,e),i=o.data,a=Math.floor(t/2),c=Math.floor(e/2),u=t>e?c:a,s=a,l=c,f=0;f0&&(r.globalCompositeOperation="destination-out",r.fillStyle="black",r.beginPath(),r.arc(s,l,u-this.thinkness,0,2*Math.PI),r.closePath(),r.fill()),n}},{key:"renderCanvas",value:function(){if(!this.parent.createdWheelCanvas){var t=this.refs.$colorwheel,e=t.el.getContext("2d"),n=yf(t.size(),2),r=n[0],o=n[1];this.width&&!r&&(r=this.width),this.height&&!o&&(o=this.height),t.el.width=r,t.el.height=o,t.px("width",r),t.px("height",o);var i=this.renderWheel(r,o);e.drawImage(i.el,0,0),this.parent.createdWheelCanvas=!0}}},{key:"getDefaultValue",value:function(){return this.parent.hsv.h}},{key:"getDefaultSaturation",value:function(){return this.parent.hsv.s}},{key:"getCurrentXY",value:function(t,e,n,r,o){return t?t.xy:pt(e,n,r,o)}},{key:"getRectangle",value:function(){var t=this.$el.width(),e=this.$el.height(),n=this.refs.$colorwheel.width()/2,r=this.$el.offsetLeft(),o=r+t/2,i=this.$el.offsetTop();return{minX:r,minY:i,width:t,height:e,radius:n,centerX:o,centerY:i+e/2}}},{key:"setHueColor",value:function(t,e){var n=this.getRectangle(),r=n.minX,o=n.minY,i=n.radius,a=n.centerX,c=n.centerY,u=this.getCurrentXY(t,this.getDefaultValue(),this.getDefaultSaturation()*i,a,c),s=(y=u.x)-a,l=(d=u.y)-c,f=s*s+l*l,p=yt(s,l);if(f>i*i)var h=this.getCurrentXY(null,p,i,a,c),y=h.x,d=h.y;var v=Math.min(Math.sqrt(f)/i,1);this.refs.$drag_pointer.px("left",y-r),this.refs.$drag_pointer.px("top",d-o),e||this.changeColor({type:"hsv",h:p,s:v})}},{key:"changeColor",value:function(t){this.parent.manager.changeColor(t||{})}},{key:Pr("changeColor"),value:function(){this.refresh(!0)}},{key:Pr("initColor"),value:function(){this.refresh(!0)}},{key:Sn("document"),value:function(t){this.isDown=!1}},{key:On("document"),value:function(t){this.isDown&&this.setHueColor(t)}},{key:kn("$drag_pointer"),value:function(t){this.isDown=!0}},{key:kn(),value:function(t){this.isDown=!0,this.setHueColor(t)}}])&&df(n.prototype,r),o&&df(n,o),e}();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})(t)}function Of(t,e){for(var n=0;n\n
\n \n
\n
\n
\n \n
HEX
\n
\n
\n
\n
\n \n
R
\n
\n
\n \n
G
\n
\n
\n \n
B
\n
\n
\n \n
A
\n
\n
\n
\n
\n \n
H
\n
\n
\n \n
%
\n
S
\n
\n
\n \n
%
\n
L
\n
\n
\n \n
A
\n
\n
\n \n '}},{key:"setCurrentFormat",value:function(t){this.format=t,this.initFormat()}},{key:"initFormat",value:function(){var t=this,e=this.format||"hex";["hex","rgb","hsl"].filter(function(t){return t!==e}).forEach(function(e){t.$el.removeClass(e)}),this.$el.addClass(e)}},{key:"nextFormat",value:function(){var t=this.format||"hex",e="hex";"hex"==t?e="rgb":"rgb"==t?e="hsl":"hsl"==t&&(e=1==this.parent.alpha?"hex":"rgb"),this.format=e,this.initFormat(),this.parent.manager.changeFormat(this.format)}},{key:"goToFormat",value:function(t){this.format=t,"rgb"!==t&&"hsl"!==t||this.initFormat(),this.parent.manager.changeFormat(this.format)}},{key:"getFormat",value:function(){return this.format||"hex"}},{key:"changeRgbColor",value:function(){this.parent.changeColor({type:"rgb",r:this.refs.$rgb_r.int(),g:this.refs.$rgb_g.int(),b:this.refs.$rgb_b.int(),a:this.refs.$rgb_a.float()})}},{key:"changeHslColor",value:function(){this.parent.changeColor({type:"hsl",h:this.refs.$hsl_h.int(),s:this.refs.$hsl_s.int(),l:this.refs.$hsl_l.int(),a:this.refs.$hsl_a.float()})}},{key:Pr("changeColor","initColor"),value:function(){this.refresh()}},{key:yn("$rgb_r"),value:function(t){this.changeRgbColor()}},{key:yn("$rgb_g"),value:function(t){this.changeRgbColor()}},{key:yn("$rgb_b"),value:function(t){this.changeRgbColor()}},{key:yn("$rgb_a"),value:function(t){this.changeRgbColor()}},{key:yn("$hsl_h"),value:function(t){this.changeHslColor()}},{key:yn("$hsl_s"),value:function(t){this.changeHslColor()}},{key:yn("$hsl_l"),value:function(t){this.changeHslColor()}},{key:yn("$hsl_a"),value:function(t){this.changeHslColor()}},{key:un("$hexCode"),value:function(t){var e=this.refs.$hexCode.val();"#"!=e.charAt(0)||7!=e.length&&9!==e.length||this.parent.initColor(e)}},{key:rn("$formatChangeButton"),value:function(t){this.nextFormat()}},{key:rn("$el .information-item.hex .input-field .title"),value:function(t){this.goToFormat("hex")}},{key:rn("$el .information-item.rgb .input-field .title"),value:function(t){this.goToFormat("hsl")}},{key:rn("$el .information-item.hsl .input-field .title"),value:function(t){this.goToFormat("rgb")}},{key:"setRGBInput",value:function(){this.refs.$rgb_r.val(this.parent.rgb.r),this.refs.$rgb_g.val(this.parent.rgb.g),this.refs.$rgb_b.val(this.parent.rgb.b),this.refs.$rgb_a.val(this.parent.alpha)}},{key:"setHSLInput",value:function(){this.refs.$hsl_h.val(this.parent.hsl.h),this.refs.$hsl_s.val(this.parent.hsl.s),this.refs.$hsl_l.val(this.parent.hsl.l),this.refs.$hsl_a.val(this.parent.alpha)}},{key:"setHexInput",value:function(){this.refs.$hexCode.val(this.parent.manager.toString("hex"))}},{key:"refresh",value:function(){this.setCurrentFormat(this.parent.format),this.setRGBInput(),this.setHSLInput(),this.setHexInput()}}])&&Of(n.prototype,r),o&&Of(n,o),e}();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})(t)}function Tf(t,e){for(var n=0;n\n
\n
\n

Color Palettes

\n ×\n
\n
\n
\n '}},{key:Pr("changeCurrentColorSets"),value:function(){this.refresh()}},{key:Pr("toggleColorChooser"),value:function(){this.toggle()}},{key:zn("$colorsetsList"),value:function(){var t=this.parent.manager.getColorSetsList();return"\n
\n ".concat(t.map(function(t,e){return'\n
\n

').concat(t.name,'

\n
\n
\n ').concat(t.colors.filter(function(t,e){return e<5}).map(function(t){return'
\n
\n
')}).join(""),"\n
\n
\n
")}).join(""),"\n
\n ")}},{key:"show",value:function(){this.$el.addClass("open")}},{key:"hide",value:function(){this.$el.removeClass("open")}},{key:"toggle",value:function(){this.$el.toggleClass("open")}},{key:rn("$toggleButton"),value:function(t){this.toggle()}},{key:rn("$colorsetsList .colorsets-item"),value:function(t,e){if(e){var n=parseInt(e.attr("data-colorsets-index"));this.parent.manager.setCurrentColorSets(n),this.hide()}}},{key:"destroy",value:function(){Cf($f(e.prototype),"destroy",this).call(this),this.hide()}}])&&Tf(n.prototype,r),o&&Tf(n,o),e}();function Af(t){return(Af="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})(t)}function Df(t,e){for(var n=0;n\n \n
\n \n '}},{key:zn("$colorSetsColorList"),value:function(){var t=this.parent.manager.getCurrentColorSets(),e=this.parent.manager.getCurrentColors();return'
\n '.concat(e.map(function(t,e){return'
\n
\n
\n
')}).join("")," \n ").concat(t.edit?'
+
':""," \n
")}},{key:"addColor",value:function(t){this.parent.manager.addCurrentColor(t),this.refresh()}},{key:Pr("changeCurrentColorSets"),value:function(){this.refresh()}},{key:Pr("initColor"),value:function(){this.refresh()}},{key:rn("$colorSetsChooseButton"),value:function(t){this.emit("toggleColorChooser")}},{key:pn("$colorSetsColorList"),value:function(t){if(t.preventDefault(),this.parent.manager.getCurrentColorSets().edit){var e=Ke.create(t.target).closest("color-item");if(e){var n=parseInt(e.attr("data-index"));this.emit("showContextMenu",t,n)}else this.emit("showContextMenu",t)}}},{key:rn("$colorSetsColorList .add-color-item"),value:function(t){this.addColor(this.parent.getColor())}},{key:rn("$colorSetsColorList .color-item"),value:function(t,e){this.parent.initColor(e.attr("data-color"))}}])&&Df(n.prototype,r),o&&Df(n,o),e}();function zf(t){return(zf="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})(t)}function Ff(t,e){for(var n=0;n\n \n \n \n \n '}},{key:"show",value:function(t,e){var n=Hn.pos(t);this.$el.px("top",n.clientY-10),this.$el.px("left",n.clientX),this.$el.addClass("show"),this.selectedColorIndex=e,E(this.selectedColorIndex)?this.$el.addClass("small"):this.$el.removeClass("small")}},{key:"hide",value:function(){this.$el.removeClass("show")}},{key:"runCommand",value:function(t){switch(t){case"remove-color":this.parent.manager.removeCurrentColor(this.selectedColorIndex);break;case"remove-all-to-the-right":this.parent.manager.removeCurrentColorToTheRight(this.selectedColorIndex);break;case"clear-palette":this.parent.manager.clearPalette()}}},{key:Pr("showContextMenu"),value:function(t,e){this.show(t,e)}},{key:rn("$el .menu-item"),value:function(t,e){t.preventDefault(),this.runCommand(e.attr("data-type")),this.hide()}}])&&Ff(n.prototype,r),o&&Ff(n,o),e}();function Nf(t){return(Nf="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})(t)}function Kf(t,e){for(var n=0;n\n \n
\n \n \n
\n \n
\n \n \n \n \n \n '}},{key:"components",value:function(){return{Value:ql,Opacity:af,ColorView:pf,ColorWheel:wf,Information:xf,CurrentColorSets:Bf,ColorSetsChooser:Vf,ContextMenu:Yf}}}])&&Kf(n.prototype,r),o&&Kf(n,o),e}();function Jf(t){return(Jf="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})(t)}function Qf(t,e){for(var n=0;n\n
\n
\n
\n \n '}},{key:"getDefaultValue",value:function(){return this.parent.hsv.h}},{key:"refreshColorUI",value:function(t){var e=this.getCalculatedDist(t);this.setColorUI(e/100*this.state.maxValue),this.changeColor({h:e/100*this.state.maxValue,type:"hsv"})}}])&&Qf(n.prototype,r),o&&Qf(n,o),e}();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})(t)}function ip(t,e){for(var n=0;n\n
\n
\n
\n
\n
\n \n '}},{key:"setBackgroundColor",value:function(t){this.$el.css("background-color",t)}},{key:"refresh",value:function(){this.setColorUI()}},{key:"calculateSV",value:function(){var t=this.drag_pointer_pos||{x:0,y:0},e=this.$el.width(),n=this.$el.height(),r=t.x/e,o=(n-t.y)/n;this.parent.initColor({type:"hsv",s:r,v:o})}},{key:"setColorUI",value:function(){var t=this.$el.width()*this.parent.hsv.s,e=this.$el.height()*(1-this.parent.hsv.v);this.refs.$drag_pointer.px("left",t),this.refs.$drag_pointer.px("top",e),this.drag_pointer_pos={x:t,y:e},this.setBackgroundColor(this.parent.manager.getHueColor())}},{key:"setMainColor",value:function(t){var e=this.$el.offset(),n=this.$el.contentWidth(),r=this.$el.contentHeight(),o=Hn.pos(t).pageX-e.left,i=Hn.pos(t).pageY-e.top;o<0?o=0:o>n&&(o=n),i<0?i=0:i>r&&(i=r),this.refs.$drag_pointer.px("left",o),this.refs.$drag_pointer.px("top",i),this.drag_pointer_pos={x:o,y:i},this.calculateSV()}},{key:Pr("changeColor","initColor"),value:function(){this.refresh()}},{key:Sn("document"),value:function(t){this.isDown=!1}},{key:On("document"),value:function(t){this.isDown&&this.setMainColor(t)}},{key:kn(),value:function(t){this.isDown=!0,this.setMainColor(t)}},{key:Sn(),value:function(t){this.isDown=!1}}])&&ip(n.prototype,r),o&&ip(n,o),e}();function lp(t){return(lp="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})(t)}function fp(t,e){for(var n=0;n\n \n
\n \n \n
\n \n
\n \n \n \n \n \n '}},{key:"components",value:function(){return{Hue:rp,Opacity:af,ColorView:pf,Palette:sp,Information:xf,CurrentColorSets:Bf,ColorSetsChooser:Vf,ContextMenu:Yf}}}])&&fp(n.prototype,r),o&&fp(n,o),e}();function vp(t){return(vp="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})(t)}function bp(t,e){for(var n=0;n\n \n
\n \n \n
\n \n "}},{key:"components",value:function(){return{Hue:rp,Opacity:af,Palette:sp}}}])&&bp(n.prototype,r),o&&bp(n,o),e}();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})(t)}function Sp(t,e){for(var n=0;n=this.maxValue?this.refs.$bar.addClass("last").removeClass("first"):this.refs.$bar.removeClass("last").removeClass("first");var e=1-(t||0)/this.state.maxValue;this.setMousePosition(this.getMaxDist()*e)}}])&&Sp(n.prototype,r),o&&Sp(n,o),e}();function Tp(t){return(Tp="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})(t)}function Ep(t,e){for(var n=0;n\n
\n
\n
\n \n '}},{key:"getDefaultValue",value:function(){return this.parent.hsv.h}},{key:"refreshColorUI",value:function(t){var e=this.getCalculatedDist(t);this.setColorUI(e/100*this.maxValue),this.changeColor({h:e/100*this.maxValue,type:"hsv"})}}])&&Ep(n.prototype,r),o&&Ep(n,o),e}();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})(t)}function Ip(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Mp(t,e){for(var n=0;n\n
\n
\n
\n
\n \n '}},{key:"refresh",value:function(){Bp(zp(e.prototype),"refresh",this).call(this),this.setOpacityColorBar()}},{key:"setOpacityColorBar",value:function(){var t=function(t){for(var e=1;e\n
\n \n "}},{key:"components",value:function(){return{Hue:Ap,Opacity:Gp,Palette:sp}}}])&&Xp(n.prototype,r),o&&Xp(n,o),e}();function Up(t){return(Up="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})(t)}function Zp(t,e){for(var n=0;n\n \n
\n '}},{key:"setColorUI",value:function(t){this.renderCanvas(),this.setHueColor(null,t)}},{key:"getDefaultValue",value:function(){return this.parent.hsv.h}},{key:"setHueColor",value:function(t,e){var n=this.getRectangle(),r=n.minX,o=n.minY,i=n.radius,a=n.centerX,c=n.centerY,u=this.getCurrentXY(t,this.getDefaultValue(),i,a,c),s=yt((f=u.x)-a,(p=u.y)-c),l=this.getCurrentXY(null,s,i-this.half_thinkness,a,c),f=l.x,p=l.y;this.refs.$drag_pointer.px("left",f-r),this.refs.$drag_pointer.px("top",p-o),e||this.changeColor({type:"hsv",h:s})}}])&&Zp(n.prototype,r),o&&Zp(n,o),e}();function nh(t){return(nh="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})(t)}function rh(t,e){for(var n=0;n\n \n \n
\n \n \n
\n \n
\n \n \n \n \n \n '}},{key:"components",value:function(){return{Value:ql,Opacity:af,ColorView:pf,ColorRing:eh,Palette:sp,Information:xf,CurrentColorSets:Bf,ColorSetsChooser:Vf,ContextMenu:Yf}}}])&&rh(n.prototype,r),o&&rh(n,o),e}();function uh(t){return(uh="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})(t)}function sh(t,e){for(var n=0;n\n \n
\n \n \n
\n \n \n \n \n \n "}},{key:"components",value:function(){return{Hue:Ap,Opacity:Gp,Palette:sp,Information:xf,CurrentColorSets:Bf,ColorSetsChooser:Vf,ContextMenu:Yf}}}])&&sh(n.prototype,r),o&&sh(n,o),e}();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})(t)}function dh(t,e){for(var n=0;n\n
\n
\n
".concat(this.opt.tabTitle,' Color
\n
Swatch
\n
Color Set
\n
\n
\n
\n \n \n
\n \n \n
\n \n
\n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n ')}},{key:rn("$tabHeader .color-tab-item"),value:function(t,e){if(!e.hasClass("active")){var n;(n=this.refs.$tabHeader.$(".active"))&&n.removeClass("active"),e.addClass("active"),(n=this.refs.$tabBody.$(".active"))&&n.removeClass("active");var r=this.refs.$tabBody.$("[item-id='".concat(e.attr("item-id"),"']"));r&&r.addClass("active")}}},{key:"components",value:function(){return{Value:ql,Opacity:af,ColorView:pf,ColorRing:eh,Palette:sp,Information:xf,CurrentColorSets:Bf,ColorSetsChooser:Vf,ContextMenu:Yf}}}])&&dh(n.prototype,r),o&&dh(n,o),e}();function wh(t){return(wh="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})(t)}function kh(t,e){for(var n=0;n\n
\n
\n
".concat(this.opt.tabTitle,' Color
\n
Swatch
\n
Color Set
\n
\n
\n
\n \n
\n \n \n
\n \n
\n
\n \n \n
\n
\n \n
\n
\n\n
\n ')}},{key:rn("$tabHeader .color-tab-item"),value:function(t,e){if(!e.hasClass("active")){var n;(n=this.refs.$tabHeader.$(".active"))&&n.removeClass("active"),e.addClass("active"),(n=this.refs.$tabBody.$(".active"))&&n.removeClass("active");var r=this.refs.$tabBody.$("[item-id='".concat(e.attr("item-id"),"']"));r&&r.addClass("active")}}},{key:"components",value:function(){return{Hue:Ap,Opacity:Gp,Palette:sp,Information:xf,CurrentColorSets:Bf,ColorSetsChooser:Vf,ContextMenu:Yf}}}])&&kh(n.prototype,r),o&&kh(n,o),e}(),Rh={create:function(t){switch(t.type){case"macos":return new qf(t);case"xd":return new hh(t);case"xd-tab":return new $h(t);case"ring":return new ch(t);case"ring-tab":return new mh(t);case"mini":return new kp(t);case"mini-vertical":return new Wp(t);case"sketch":case"palette":default:return new dp(t)}},ColorPicker:dp,ChromeDevToolColorPicker:dp,MacOSColorPicker:qf,RingColorPicker:ch,MiniColorPicker:kp,MiniVerticalColorPicker:Wp,XDColorPicker:hh};function Vh(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:1;return He.px(t).round(e)},Nh=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,r;return e=t,(n=[{key:"makeGuideCache",value:function(){var t=this,e=pl.selection.currentArtboard;return this.cachedExtraItems=[],e&&(this.cachedExtraItems=e.allLayers.filter(function(t){return!pl.selection.check(t)}),this.rect=pl.selection.allRect?pl.selection.allRect.clone():null),this.cachedPosition={},pl.selection.items.map(function(e){t.cachedPosition[e.id]={x:t.setupX(e),y:t.setupY(e)}}),this.rect}},{key:"move",value:function(t,e,n){var r=pl.selection.allRect;this.pointerType=t,"move"===t?this.rect.move(Yh(r.x.value+e),Yh(r.y.value+n)):(Gh.isRight(t)?this.rect.resizeWidth(Yh(r.width.value+e)):Gh.isLeft(t)&&r.width.value-e>=0&&(this.rect.moveX(Yh(r.x.value+e)),this.rect.resizeWidth(Yh(r.width.value-e))),Gh.isBottom(t)?this.rect.resizeHeight(Yh(r.height.value+n)):Gh.isTop(t)&&r.height.value-n>=0&&(this.rect.moveY(Yh(r.y.value+n)),this.rect.resizeHeight(Yh(r.height.value-n))))}},{key:"recover",value:function(t){if(this.rect){var e=this.cachedPosition[t.id].x,n=e.xDistRate,r=e.x2DistRate,o=this.cachedPosition[t.id].y,i=o.yDistRate,a=o.y2DistRate,c=this.rect.screenX.value,u=this.rect.screenX2.value,s=this.rect.screenY.value,l=this.rect.screenY2.value,f=u-c,p=f*n,h=f*r,y=l-s,d=y*i,v=y*a;this.setX(t,c,u,p,h),this.setY(t,s,l,d,v)}}},{key:"setY",value:function(t,e,n,r,o){var i=Math.round(r),a=Math.round(o)-i;t.setScreenY(i+e),t.height.set(a)}},{key:"setX",value:function(t,e,n,r,o){var i=Math.round(r),a=Math.round(o)-i;t.setScreenX(i+e),t.width.set(a)}},{key:"setupX",value:function(t){var e=pl.selection.allRect,n=e.screenX.value,r=e.screenX2.value-n;return 0===r?{xDistRate:0,x2DistRate:1}:{xDistRate:(t.screenX.value-n)/r,x2DistRate:(t.screenX2.value-n)/r}}},{key:"setupY",value:function(t){var e=pl.selection.allRect,n=e.screenY.value,r=e.screenY2.value-n;return 0===r?{yDistRate:0,y2DistRate:1}:{yDistRate:(t.screenY.value-n)/r,y2DistRate:(t.screenY2.value-n)/r}}},{key:"compareX",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,r=[t.screenX.value,t.centerX.value,t.screenX2.value],o=[e.screenX.value,e.centerX.value,e.screenX2.value],i=[];if(r.forEach(function(r,a){o.forEach(function(o,c){Math.abs(r-o)<=n&&i.push({A:t,B:e,source:a,target:c,ax:r,bx:o})})}),i.length){var a=Gh.getXDirection(this.pointerType),c=i.filter(function(t){return t.source==a});return c.length?c:[i[0]]}return i}},{key:"compareY",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,r=[t.screenY.value,t.centerY.value,t.screenY2.value],o=[e.screenY.value,e.centerY.value,e.screenY2.value],i=[];if(r.forEach(function(r,a){o.forEach(function(o,c){Math.abs(r-o)<=n&&i.push({A:t,B:e,source:a,target:c,ay:r,by:o})})}),i.length){var a=Gh.getYDirection(this.pointerType),c=i.filter(function(t){return t.source==a});return c.length?c:[i[0]]}return i}},{key:"compare",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3;return{x:this.compareX(t,e,n),y:this.compareY(t,e,n)}}},{key:"getLayers",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,n=this.cachedExtraItems,r=[],o=[];return n.forEach(function(n){var i=t.compare(t.rect,n,e);r.push.apply(r,Hh(i.x)),o.push.apply(o,Hh(i.y))}),[r[0],o[0]].filter(function(t){return C(t)})}},{key:"calculate",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,n=this.getLayers(e);return Gh.isMove(this.pointerType)?n.forEach(function(e){return t.moveSnap(e)}):n.forEach(function(e){return t.sizeSnap(e)}),n}},{key:"sizeSnap",value:function(t){var e,n,r,o;if(C(t.ax))switch(t.source){case 2:e=this.rect.screenX.value,n=t.bx-e,this.rect.width.set(n);break;case 0:e=t.bx,n=this.rect.screenX2.value-e,this.rect.x.set(e),this.rect.width.set(n)}else switch(t.source){case 2:r=this.rect.screenY.value,o=t.by-r,this.rect.y.set(r),this.rect.height.set(o);break;case 0:r=t.by,o=this.rect.screenY2.value-r,this.rect.y.set(r),this.rect.height.set(o)}}},{key:"moveSnap",value:function(t){if(C(t.ax)){var e=Math.round(this.rect.width.value/2*t.source),n=t.bx-e;this.rect.x.set(n)}else if(C(t.ay)){var r=Math.round(this.rect.height.value/2*t.source),o=t.by-r;this.rect.y.set(o)}}},{key:"recoverAll",value:function(){var t=this;pl.selection.items.forEach(function(e){t.recover(e),e.recover()})}}])&&Xh(e.prototype,n),r&&Xh(e,r),t}();function Kh(t){return(Kh="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})(t)}function Wh(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n "}},{key:Gn("$pathMaker"),value:function(){var t=pl.selection.current;if(t&&t.is&&t.is("artboard"))return{style:{display:"none"}};if(1!==pl.selection.length)return{style:{display:"none"}};var e={translate:{x:0,y:0,z:0}},n=0,r=0;if(t){var o=Uh((t["transform-origin"]||"50% 50%").split(" ").map(function(t){return He.parse(t||"50%")}),2),i=o[0],a=o[1];i=i.toPx(t.screenWidth.value),a=a.toPx(t.screenHeight.value);n=(t.screenX.value+i.value)*pl.scale,r=(t.screenY.value+a.value)*pl.scale;var c=Uh(to.get(t.transform,"translate"),2),u=c[0],s=c[1];if(!u)u=Uh(to.get(t.transform,"translateX"),1)[0];if(!s)s=Uh(to.get(t.transform,"translateY"),1)[0];u=u||He.px(0),s=s||He.px(0),e.translate.x=n+u.value*pl.scale,e.translate.y=r+s.value*pl.scale}return{style:{display:"block"},innerHTML:'\n \n ')}}},{key:on("$rotate3d"),value:function(t){t.altKey?(pl.selection.each(function(t){t.reset({"transform-origin":""})}),this.bindData("$rotate3d"),this.bindData("$pathMaker")):t.shiftKey?(pl.selection.each(function(t){var e=to.join(to.parseStyle(t.transform).filter(function(t){switch(t.type){case"translate":case"translateX":case"translateY":case"translateZ":return!1}return!0}));t.reset({transform:e})}),this.bindData("$rotateZ"),this.bindData("$rotateArea"),this.bindData("$transformOrigin"),this.bindData("$pathMaker")):(pl.selection.each(function(t){var e=to.join(to.parseStyle(t.transform).filter(function(t){switch(t.type){case"rotate":case"rotate3d":case"rotateX":case"rotateY":case"rotateZ":return!1}return!0}));t.reset({transform:e})}),this.bindData("$rotateZ"),this.bindData("$rotateArea"),this.bindData("$transformOrigin"),this.bindData("$pathMaker")),this.emit("refreshSelectionStyleView")}},{key:rn('$selectionTool .selection-tool-item[data-position="path"]'),value:function(t){this.trigger("openPathEditor")}},{key:"toggleEditingPath",value:function(t){this.refs.$selectionTool.toggleClass("editing-path",t)}},{key:"toggleEditingPolygon",value:function(t){this.refs.$selectionTool.toggleClass("editing-polygon",t)}},{key:Pr("hideSelectionToolView"),value:function(){this.refs.$selectionTool.css({left:"-10000px",top:"-10000px"})}},{key:Pr("hideSubEditor"),value:function(t){this.toggleEditingPath(!1),this.toggleEditingPolygon(!1)}},{key:Pr("openPathEditor"),value:function(){var t=pl.selection.current;t&&t.is("svg-path","svg-textpath")?(this.toggleEditingPolygon(!1),this.toggleEditingPath(!0),this.emit("showPathEditor","modify",{changeEvent:"updatePathItem",current:t,d:t.d,box:t.is("svg-textpath")?"box":"canvas",screenX:t.screenX,screenY:t.screenY,screenWidth:t.screenWidth,screenHeight:t.screenHeight})):t.is("svg-polygon")&&this.trigger("openPolygonEditor")}},{key:Pr("openPolygonEditor"),value:function(){var t=pl.selection.current;t&&t.is("svg-polygon")&&(this.toggleEditingPath(!1),this.toggleEditingPolygon(!0),this.emit("showPolygonEditor","modify",{changeEvent:"updatePolygonItem",current:t,points:t.points,screenX:t.screenX,screenY:t.screenY,screenWidth:t.screenWidth,screenHeight:t.screenHeight}))}},{key:Pr("finishPathEdit"),value:function(){this.toggleEditingPath(!1)}},{key:Pr("finishPolygonEdit"),value:function(){this.toggleEditingPolygon(!1)}},{key:Pr("updatePathItem"),value:function(t){var e,n=pl.selection.current;n&&(n.updatePathItem&&(n.updatePathItem(t),(e=this.parent).selectCurrent.apply(e,Wh(pl.selection.items)),pl.selection.setRectCache(),this.emit("refreshSelectionStyleView")))}},{key:Pr("updatePolygonItem"),value:function(t){var e,n=pl.selection.current;n&&(n.is("svg-polygon")&&(n.updatePolygonItem(t),(e=this.parent).selectCurrent.apply(e,Wh(pl.selection.items)),pl.selection.setRectCache(),this.emit("refreshSelectionStyleView"),this.emit("refreshCanvasForPartial",n)))}},{key:"setCacheBaseTrasnform",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n")}).join("");t="
".concat(a,"
")}return{innerHTML:t}}},{key:"refreshPositionText",value:function(t,e,n,r){if(pl.selection.currentArtboard){var o=He.px(t.value-pl.selection.currentArtboard.x.value/pl.scale).round(1),i=He.px(e.value-pl.selection.currentArtboard.y.value/pl.scale).round(1),a=He.px(n.value/pl.scale).round(1),c=He.px(r.value/pl.scale).round(1),u="";switch(this.pointerType){case"move":u="X: ".concat(o,", Y: ").concat(i);break;case"to right":u="W: ".concat(a);break;case"to left":u="X: ".concat(o,", W: ").concat(a);break;case"to top":u="Y: ".concat(i,", H: ").concat(c);break;case"to bottom":u="H: ".concat(c);break;case"to top right":case"to top left":u="X: ".concat(o,", Y: ").concat(i,", W: ").concat(a,", H: ").concat(c);break;case"to bottom right":u="W: ".concat(a,", H: ").concat(c);break;case"to bottom left":u="X: ".concat(o,", Y: ").concat(i,", W: ").concat(a,", H: ").concat(c)}this.setPositionText(u)}}},{key:"setPositionText",value:function(t){this.$target&&(pl.selection.current&&pl.selection.current.is("artboard")&&(t=t.split(",").filter(function(t){return!t.includes("X:")&&!t.includes("Y:")}).join(",")),this.$target.attr("data-position-text",t))}},{key:"calculateWorldPositionForGuideLine",value:function(){var t=this;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map(function(e){var n,r,o,i,a=new go(t.calculateWorldPosition(e.A)),c=new go(t.calculateWorldPosition(e.B));return C(e.ax)&&(n=e.ax*pl.scale),C(e.bx)&&(r=e.bx*pl.scale),C(e.ay)&&(o=e.ay*pl.scale),C(e.by)&&(i=e.by*pl.scale),{A:a,B:c,ax:n,bx:r,ay:o,by:i}})}},{key:"calculateWorldPosition",value:function(t){var e=He.px(t.x||0),n=He.px(t.y||0);return{x:He.px(e.value*pl.scale),y:He.px(n.value*pl.scale),width:He.px(t.width.value*pl.scale),height:He.px(t.height.value*pl.scale),transform:t.transform}}},{key:Pr("refreshCanvas"),value:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];pl.selection.setRectCache(),this.initSelectionTool()}},{key:Pr("refreshSelectionStyleView"),value:function(){this.bindData("$rotate3d"),this.bindData("$rotateArea"),this.bindData("$transformOrigin"),this.bindData("$rotateZ"),this.bindData("$pathMaker")}}])&&Zh(n.prototype,r),o&&Zh(n,o),e}();function oy(t){return(oy="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})(t)}function iy(t,e){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0];return cy(uy(e.prototype),"getDefaultObject",this).call(this,{itemType:"display",type:"block",direction:"row",alignItems:"normal",alignCentent:"normal",flexWrap:"nowrap",justifyContent:"flex-start",gap:He.px(0),rowGap:He.percent(1),columnGap:He.percent(1),columns:[He.fr(1)],rows:[He.fr(1)],areas:[]})}},{key:"toCSS",value:function(){var t=this.json,e={display:t.type};return"flex"==e.display?("row"!=t.direction&&(e["flex-direction"]=t.direction),"normal"!=t.alignItems&&(e["align-items"]=t.alignItems),"normal"!=t.alignContent&&(e["align-content"]=t.alignContent),"nowrap"!=t.flexWrap&&(e["flex-wrap"]=t.flexWrap),"flex-start"!=t.justifyContent&&(e["justify-content"]=t.justifyContent)):"grid"==e.display&&(t.gap.value>0&&(e["grid-gap"]=t.gap),t.rowGap.value>0&&(e["grid-row-gap"]=t.rowGap),t.columnGap.value>0&&(e["grid-column-gap"]=t.columnGap),t.columns.length&&(e["grid-template-columns"]=t.columns.join(" ")),t.rows.length&&(e["grid-template-rows"]=t.rows.join(" ")),t.areas.length&&(e["grid-template-areas"]=t.areas.map(function(t){return'"'.concat(t.join(" "),'"')}).join(" ")),"normal"!=t.alignItems&&(e["align-items"]=t.alignItems),"normal"!=t.alignContent&&(e["align-content"]=t.alignContent),"flex-start"!=t.justifyContent&&(e["justify-content"]=t.justifyContent)),e}},{key:"isLayout",value:function(){return this.isGrid()||this.isFlex()}},{key:"isFlex",value:function(){return"flex"==this.json.type}},{key:"isGrid",value:function(){return"grid"==this.json.type}},{key:"isInline",value:function(){return"inline"==this.json.type}},{key:"isInlineBlock",value:function(){return"inline-block"==this.json.type}},{key:"isBlock",value:function(){return"block"==this.json.type}},{key:"changeColumn",value:function(t,e){var n=this.json.columns[t],r=this.json.columns[e];this.json.columns[e]=n,this.json.columns[t]=r}},{key:"removeColumn",value:function(t){this.json.columns.splice(t,1)}},{key:"updateColumn",value:function(t,e){this.json.columns[t]=e}},{key:"changeRow",value:function(t,e){var n=this.json.rows[t],r=this.json.rows[e];this.json.rows[e]=n,this.json.rows[t]=r}},{key:"removeRow",value:function(t){this.json.rows.splice(t,1)}},{key:"updateRow",value:function(t,e){this.json.rows[t]=e}}])&&iy(n.prototype,r),o&&iy(n,o),e}();function fy(t){return(fy="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})(t)}function py(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"";return"".concat(t).concat(this.json.selector," {\n ").concat(this.toPropertyString(),"\n}")}},{key:"toCSS",value:function(){return{}}},{key:"toString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.toCSSText(t)}}])&&My(n.prototype,r),o&&My(n,o),e}();function Hy(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"50% 50%",e="50% 50%",n="";if((t=t||"50%").includes("at")){var r=Ny(t.split("at").map(function(t){return t.trim()}),2);e=r[0],n=r[1]}else n=t.trim();var o=Ny(n.split(" "),2),i=o[0],a=o[1];E(a)&&(a=i),i=He.parse(i),a=He.parse(a);var c=Ny(e.split(" "),2),u=c[0],s=c[1];return E(s)&&(s=u),{radiusX:u=He.parse(u),radiusY:s=He.parse(s),x:i,y:a}}},{key:"parseStyleForInset",value:function(){var t=Ny((arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split("round"),2),e=t[0],n=t[1],r=Ny(Xy.parse(e),5),o=r[0],i=r[1],a=r[2],c=r[3],u=r[4];if(n)var s=Ny(Xy.parse(n),5),l=s[0],f=s[1],p=s[2],h=s[3],y=s[4];return{isAll:1===o,top:i,right:a,bottom:c,left:u,round:n,isAllRadius:1===l,topRadius:f,rightRadius:p,bottomRadius:h,leftRadius:y}}},{key:"parseStyleForPolygon",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(",").filter(function(t){return t.trim()}).map(function(t){var e=Ny(t.trim().split(" "),2),n=e[0],r=e[1];return{x:He.parse(n),y:He.parse(r)}})}}],(r=[{key:"getDefaultObject",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return qy(Jy(e.prototype),"getDefaultObject",this).call(this,Ky({itemType:"clip-path",type:"none",value:""},t))}},{key:"toCloneObject",value:function(){return Ky({},qy(Jy(e.prototype),"toCloneObject",this).call(this),{value:this.json.value})}},{key:"toString",value:function(){var t=this.json.type,e=this.json.value,n=this.json.box,r="";switch(t){case"circle":case"inset":case"ellipse":case"polygon":case"path":r="".concat(t,"(").concat(e,")");break;case"svg":r="url(#".concat(e,")");break;default:r="none"}return n?"".concat(n," ").concat(r):r}},{key:"toCSS",value:function(){return{"clip-path":this.toString()}}}])&&Uy(n.prototype,r),o&&Uy(n,o),e}();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})(t)}function rd(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function od(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};return sd(ld(e.prototype),"getDefaultObject",this).call(this,id({position:"absolute",x:He.px(0),y:He.px(0),right:"",bottom:"",width:He.px(300),height:He.px(300),rootVariable:"",variable:"",transform:"",filter:"","backdrop-filter":"","background-color":"","background-clip":"","background-image":"",border:"","border-radius":"","box-shadow":"","text-shadow":"","text-clip":"","clip-path":"",color:"black","font-size":He.px(13),"font-stretch":"","line-height":"","text-align":"","text-transform":"","text-decoration":"","letter-spacing":"","word-spacing":"","text-indent":"","perspective-origin":"","transform-origin":"","transform-style":"",perspective:"","mix-blend-mode":"",opacity:"",rotate:"","text-fill-color":"","text-stroke-color":"","text-stroke-width":"","offset-path":"","offset-distance":"",outline:{},animations:[],transitions:[],selectors:[],svg:[]},t))}},{key:"toCloneObject",value:function(){var t=this.json;return id({},sd(ld(e.prototype),"toCloneObject",this).call(this),{position:t.position,right:t.right+"",bottom:t.bottom+"",rootVariable:t.rootVariable,variable:t.variable,transform:t.transform,filter:t.filter,"backdrop-filter":t["backdrop-filter"],"background-color":t["background-color"],"background-image":t["background-image"],"text-clip":t["text-clip"],"border-radius":t["border-radius"],border:t.border,"box-shadow":t["box-shadow"],"text-shadow":t["text-shadow"],"clip-path":t["clip-path"],color:t.color,"font-size":t["font-size"]+"","font-stretch":t["font-stretch"]+"","line-height":t["line-height"]+"","text-align":t["text-align"]+"","text-transform":t["text-transform"]+"","text-decoration":t["text-decoration"]+"","letter-spacing":t["letter-spacing"]+"","word-spacing":t["word-spacing"]+"","text-indent":t["text-indent"]+"","perspective-origin":t["perspective-origin"],"transform-origin":t["transform-origin"],"transform-style":t["transform-style"],perspective:t.perspective+"","mix-blend-mode":t["mix-blend-mode"],opacity:t.opacity+"",rotate:t.rotate+"",outline:L(t.outline),animations:t.animations.map(function(t){return t.clone()}),transitions:t.transitions.map(function(t){return t.clone()}),selectors:t.selectors.map(function(t){return t.clone()}),svg:t.svg.map(function(t){return t.clone()})})}},{key:"convert",value:function(t){return t=sd(ld(e.prototype),"convert",this).call(this,t)}},{key:"addAnimation",value:function(t){return this.json.animations.push(t),t}},{key:"addTransition",value:function(t){return this.json.transitions.push(t),t}},{key:"addSelector",value:function(t){return this.json.selectors.push(t),t}},{key:"createAnimation",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.addAnimation(new Py(id({checked:!0},t)))}},{key:"createSelector",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.addSelector(new Gy(id({checked:!0},t)))}},{key:"createTransition",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.addTransition(new Vy(id({checked:!0},t)))}},{key:"removePropertyList",value:function(t,e){t.splice(e,1)}},{key:"removeAnimation",value:function(t){this.removePropertyList(this.json.animations,t)}},{key:"removeSelector",value:function(t){this.removePropertyList(this.json.selectors,t)}},{key:"removeTransition",value:function(t){this.removePropertyList(this.json.transitions,t)}},{key:"enableHasChildren",value:function(){return!0}},{key:"sortItem",value:function(t,e,n){t.splice.apply(t,[n+(e1&&void 0!==arguments[1]?arguments[1]:{};this.json.animations[+t].reset(e)}},{key:"updateTransition",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.json.transitions[+t].reset(e)}},{key:"updateSelector",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.json.selectors[+t].reset(e)}},{key:"setSize",value:function(t){this.reset(t)}},{key:"setBorder",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=this.json.border;if("all"===t)n?this.json.border={all:n}:["top","right","bottom","left"].forEach(function(t){delete e.json.border[t]});else{if(r.all&&E(n)){var o=id({},r.all);r.top=id({},o),r.bottom=id({},o),r.left=id({},o),r.right=id({},o)}r.all&&delete r.all,n&&(this.json.border[t]=n)}}},{key:"getBorder",value:function(t){return this.json.border[t]||{}}},{key:"setOutline",value:function(t){this.json.outline=id({},this.json.outline,t)}},{key:"setBorderRadius",value:function(t,e){this.json.borderRadius=e}},{key:"traverse",value:function(t,e,n){var r=this;t.isAttribute()||(n||!t.isLayoutItem()||t.isRootItem())&&(e.push(t),t.children.forEach(function(t){r.traverse(t,e)}))}},{key:"tree",value:function(t){var e=this,n=[];return this.children.forEach(function(r){e.traverse(r,n,t)}),n}},{key:"toPropertyCSS",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={};return t.forEach(function(t){S(t.toCSS(e),function(t,e){n[t]||(n[t]=[]),n[t].push(e)})}),z(n)}},{key:"toStringPropertyCSS",value:function(t){return N(this.json[t])}},{key:"toBackgroundImageCSS",value:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.toStringPropertyCSS("background-image")}},{key:"toBorderCSS",value:function(){return this.toStringPropertyCSS("border")}},{key:"toOutlineCSS",value:function(){var t=this.json.outline;return t?0===Object.keys(t).length?{}:{outline:"".concat(t.color," ").concat(t.style," ").concat(t.width)}:{}}},{key:"toKeyCSS",value:function(t){return this.json[t]?ad({},t,this.json[t]):{}}},{key:"toAnimationKeyframes",value:function(t){return[{selector:'[data-id="'.concat(this.json.id,'"]'),properties:t}]}},{key:"toAnimationCSS",value:function(){return this.toPropertyCSS(this.json.animations)}},{key:"toTransitionCSS",value:function(){return this.toPropertyCSS(this.json.transitions)}},{key:"toString",value:function(){return Y(this.toCSS())}},{key:"toExport",value:function(){return Y(this.toCSS(!0))}},{key:"toExportSVGCode",value:function(){return""}},{key:"toBoxModelCSS",value:function(){var t=this.json,e={};return t["margin-top"]&&(e["margin-top"]=t["margin-top"]),t["margin-bottom"]&&(e["margin-bottom"]=t["margin-bottom"]),t["margin-left"]&&(e["margin-left"]=t["margin-left"]),t["margin-right"]&&(e["margin-right"]=t["margin-right"]),t["padding-top"]&&(e["padding-top"]=t["padding-top"]),t["padding-bottom"]&&(e["padding-bottom"]=t["padding-bottom"]),t["padding-left"]&&(e["padding-left"]=t["padding-left"]),t["padding-right"]&&(e["padding-right"]=t["padding-right"]),e}},{key:"toKeyListCSS",value:function(){for(var t=this.json,e={},n=arguments.length,r=new Array(n),o=0;o0&&void 0!==arguments[0]&&arguments[0];var t={};return this.isAbsolute&&(this.json.x&&(t.left=this.json.x),this.json.y&&(t.top=this.json.y)),t.visibility=this.json.visible?"visible":"hidden",id({},t,this.toKeyListCSS("position","right","bottom","width","height","overflow","background-color","color","opacity","mix-blend-mode","transform-origin","transform","transform-style","perspective","perspective-origin","font-size","font-stretch","line-height","font-weight","font-family","font-style","text-align","text-transform","text-decoration","letter-spacing","word-spacing","text-indent","border-radius","filter","backdrop-filter","box-shadow","text-shadow","offset-path"))}},{key:"toDefaultSVGCSS",value:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return id({},{overflow:"visible"},this.toKeyListCSS("transform","font-size","font-stretch","line-height","font-weight","font-family","font-style","text-align","text-transform","text-decoration","letter-spacing","word-spacing","text-indent"))}},{key:"toVariableCSS",value:function(){var t={};return this.json.variable.split(";").filter(function(t){return t.trim()}).forEach(function(e){var n=rd(e.split(":"),2),r=n[0],o=n[1];t["--".concat(r)]=o}),t}},{key:"toRootVariableCSS",value:function(){var t={};return this.json.rootVariable.split(";").filter(function(t){return t.trim()}).forEach(function(e){var n=rd(e.split(":"),2),r=n[0],o=n[1];t["--".concat(r)]=o}),t}},{key:"toRootVariableString",value:function(){return Y(this.toRootVariableCSS())}},{key:"toWebkitCSS",value:function(){var t=this.toKeyListCSS("text-fill-color","text-stroke-color","text-stroke-width","background-clip"),e={};return S(t,function(t,n){e["-webkit-".concat(t)]=n}),e}},{key:"toTextClipCSS",value:function(){var t={};return"text"===this.json["text-clip"]&&(t["-webkit-background-clip"]="text",t["-webkit-text-fill-color"]="transparent",t.color="transparent"),t}},{key:"toClipPathCSS",value:function(){var t=this.json["clip-path"];switch(ed.parseStyle(t).type){case"path":case"svg":t="url(#".concat(this.clipPathId,")")}return{"clip-path":t}}},{key:"toCSS",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return id({},this.toVariableCSS(),this.toDefaultCSS(t),this.toClipPathCSS(),this.toWebkitCSS(),this.toTextClipCSS(),this.toBoxModelCSS(),this.toBorderCSS(),this.toOutlineCSS(),this.toBackgroundImageCSS(t),this.toAnimationCSS(),this.toTransitionCSS())}},{key:"toSVGCSS",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return id({},this.toVariableCSS(),this.toDefaultSVGCSS(t),this.toClipPathCSS(),this.toWebkitCSS(),this.toTextClipCSS(),this.toBoxModelCSS(),this.toBorderCSS(),this.toOutlineCSS(),this.toBackgroundImageCSS(t),this.toAnimationCSS(),this.toTransitionCSS())}},{key:"toEmbedCSS",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return id({},this.toVariableCSS(),this.toDefaultCSS(),this.toClipPathCSS(),this.toWebkitCSS(),this.toTextClipCSS(),this.toBoxModelCSS(),this.toBorderCSS(),this.toOutlineCSS(),this.toAnimationCSS(),this.toTransitionCSS(),this.toBackgroundImageCSS(t))}},{key:"toSelectorString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.json.selectors.map(function(e){return e.toString(t)}).join("\n\n")}},{key:"toNestedCSS",value:function(t){return[]}},{key:"toNestedBoundCSS",value:function(t){return[]}},{key:"generateEmbed",value:function(){return{css:this.toEmbedCSS(),selectorString:this.toSelectorString()}}},{key:"generateView",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"\n".concat(t," { /* ").concat(this.json.itemType," */\n ").concat(Y(this.toCSS(),"\n "),"; \n ").concat(e,"\n}\n").concat(this.toNestedCSS().map(function(e){return"".concat(t," ").concat(e.selector," { \n ").concat(e.cssText?e.cssText:Y(e.css||{},"\n\t\t"),"; \n }")}).join("\n"),"\n").concat(this.toSelectorString(t),"\n")}},{key:"generateViewBoundCSS",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"\n".concat(t," { /* ").concat(this.json.itemType," */\n ").concat(Y(this.toBoundCSS(),"\n"),"; \n}\n\n\n").concat(this.toNestedBoundCSS().map(function(e){return"".concat(t," ").concat(e.selector," { \n ").concat(e.cssText?e.cssText:Y(e.css||{},"\n\t\t"),"; \n }")}).join("\n"),"\n\n")}},{key:"generateSVG",value:function(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0]){var t=this.json.width.value,e=this.json.height.value;return'\n\n ').concat(this.rootSVG,"\n")}return this.svg}},{key:"toSVG",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.json,r=n.layers,o=n.width,i=n.height,a=n.elementType||"div",c=this.toCSS();return delete c.left,delete c.top,"absolute"===c.position&&delete c.position,'\n \n ').concat(this.toDefString,"\n \n
\n <').concat(a,' style="').concat(Y(c),'" >\n
\n
\n ").concat(r.map(function(t){return t.svg}).join("\n\t")," \n
\n ")}},{key:"toBound",value:function(){var t={x:this.json.x?this.json.x.clone():He.px(0),y:this.json.y?this.json.y.clone():He.px(0),width:this.json.width.clone(),height:this.json.height.clone()};return t.x2=He.px(t.x.value+t.width.value),t.y2=He.px(t.y.value+t.height.value),t}},{key:"updateFunction",value:function(t){if(!(arguments.length>1&&void 0!==arguments[1])||arguments[1]){var e=t.$('[data-id="'.concat(this.innerSVGId,'"]'));if(e){e.$("defs").html(this.toDefInnerString)}else{var n=Ke.createByHTML(this.toDefString);n&&t.prepend(n)}}}},{key:"html",get:function(){var t=this.json,e=t.elementType,n=t.id,r=t.name,o=t.layers,i=t.itemType,a=e||"div";return"<".concat(a,' class="').concat(W(ad({"element-item":!0},i,!0)),'" ').concat(K({"data-id":n,"data-title":r}),">\n ").concat(this.toDefString,"\n ").concat(o.map(function(t){return t.html}).join("\n\t"),"\n")}},{key:"svg",get:function(){var t=this.json,e=t.x,n=t.y;return e=e.value,n=n.value,this.toSVG(e,n)}},{key:"rootSVG",get:function(){return this.toSVG()}},{key:"toDefInnerString",get:function(){return"".concat(this.toClipPath)}},{key:"toClipPath",get:function(){var t=ed.parseStyle(this.json["clip-path"]),e=t.value;switch(t.type){case"path":return'');case"svg":return'').concat(e,"")}return""}},{key:"innerSVGId",get:function(){return this.json.id+"inner-svg"}},{key:"toDefString",get:function(){var t=this.toDefInnerString.trim();return t&&"\n \n \n ').concat(t,"\n \n \n ")}},{key:"clipPathId",get:function(){return this.json.id+"clip-path"}}])&&cd(n.prototype,r),o&&cd(n,o),e}();function hd(t){return(hd="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})(t)}function yd(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};return gd(md(e.prototype),"getDefaultObject",this).call(this,yd({itemType:"layer",name:"New Layer",tagName:"div"},t))}},{key:"getDefaultTitle",value:function(){return"Layer"}},{key:"toCloneObject",value:function(){return yd({},gd(md(e.prototype),"toCloneObject",this).call(this),{tagName:this.json.tagName})}},{key:"screenX",get:function(){return this.json.parent?He.px(this.json.parent.screenX.value+(this.json.x||zero).value):this.json.x||He.px(0)}},{key:"screenY",get:function(){return this.json.parent?He.px(this.json.parent.screenY.value+(this.json.y||zero).value):this.json.y||He.px(0)}}])&&vd(n.prototype,r),o&&vd(n,o),e}();function Od(t){return(Od="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})(t)}function Sd(t,e){for(var n=0;n"}},{key:"createBackgroundImage",value:function(t,e,n,r,o){return{"background-image":"linear-gradient(to right, ".concat(t,", ").concat(t,")"),"background-size":"".concat(r," ").concat(o),"background-position":"".concat(e," ").concat(n),"background-repeat":"no-repeat"}}},{key:"createGuideLine",value:function(t){var e=this,n=He.px(1),r=[];t.forEach(function(t){var o=t.B;if(C(t.ax)){r.push(e.createBackgroundImage("rgb(244, 140, 255)",He.px(t.bx),t.A.screenY,n,t.A.height)),o instanceof kd&&r.push(e.createBackgroundImage("rgb(244, 140, 255)",He.px(t.bx),o.screenY,n,o.height));var i=He.min(o.screenY,t.A.screenY),a=He.max(o.screenY2,t.A.screenY2);r.push(e.createBackgroundImage("rgb(180, 199, 254)",He.px(t.bx),i,n,He.px(a.value-i.value)))}else{r.push(e.createBackgroundImage("rgb(244, 140, 255)",t.A.screenX,He.px(t.by),t.A.width,n));var c=He.min(o.screenX,t.A.screenX),u=He.max(o.screenX2,t.A.screenX2);r.push(e.createBackgroundImage("rgb(180, 199, 254)",c,He.px(t.by),He.px(u.value-c.value),n))}});var o={};return r.forEach(function(t){S(t,function(t,e){o[t]||(o[t]=[]),o[t].push(e)})}),z(o)}},{key:"removeGuideLine",value:function(){this.$el.cssText("")}},{key:"setGuideLine",value:function(t){this.$el.cssText(Y(this.createGuideLine(t)))}},{key:Pr("removeGuideLine"),value:function(){this.removeGuideLine()}},{key:Pr("refreshGuideLine"),value:function(t){this.setGuideLine(t)}}])&&Sd(n.prototype,r),o&&Sd(n,o),e}();function Td(t){for(var e=1;e4&&void 0!==arguments[4]&&arguments[4];return this.segmentList.push(Td({},t,{cx:e.x,cy:e.y,selected:o,index:n,segment:r,isFirst:e.isFirst,isLast:e.isLast,isSecond:e.isSecond})),this}},{key:"addStartPoint",value:function(t,e){return this.segmentList.push(Td({},t,{cx:e.x,cy:e.y,start:!0})),this}},{key:"addCurvePoint",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return this.segmentList.push({curve:!0,cx:t.x,cy:t.y,index:e,selected:r,segment:n,isFirst:t.isFirst,isLast:t.isLast,isSecond:t.isSecond}),this}},{key:"addText",value:function(t,e){return this.segmentList.push({type:"text",cx:t.x,cy:t.y,text:e+""}),this}},{key:"toString",value:function(){return this.segmentList.sort(function(t,e){return t.line&&!e.line?-1:!t.line&&e.line?1:0}),this.segmentList.map(function(t){return t.angle?"\n '):t.line?'\n "):t.text?'\n ').concat(t.text,"\n "):t.curve?"\n '):t.start?"\n '):"\n ')}).join("")}}])&&Cd(e.prototype,n),r&&Cd(e,r),t}();function Rd(t,e){for(var n=0;n0;r--)if("M"===t[r].command){n=r;break}-1===n&&(n=0);var o=t[n];return o&&(o.index=n),o}},{key:"getPrevPoint",value:function(e,n){var r=n-1;if(r<0)return t.getLastPoint(e,n);var o=e[r];return o&&(o.index=r),o}},{key:"getNextPoint",value:function(e,n){var r=e[n],o=e[n+1];return o&&(o.index=n+1),r.connected&&(o=t.getFirstPoint(e,n)),o}}],(n=null)&&Rd(e.prototype,n),r&&Rd(e,r),t}();function Ad(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Dd(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1&&void 0!==arguments[1]?arguments[1]:0,r=+e[n],o=+e[n+1];return[t[0][0]*r+t[0][1]*o+t[0][2],t[1][0]*r+t[1][1]*o+t[1][2],1]}},translate:function(t,e){return this.multiply([[1,0,t],[0,1,e],[0,0,1]])},rotate:function(t){return this.multiply([[Math.cos(t),-Math.sin(t),0],[Math.sin(t),Math.cos(t),0],[0,0,1]])},rotateCenter:function(t,e,n){return this.multiply([[Math.cos(t),-Math.sin(t),-e*Math.cos(t)+n*Math.sin(t)+e],[Math.sin(t),Math.cos(t),-e*Math.sin(t)-n*Math.cos(t)+n],[0,0,1]])},scale:function(t,e){return this.multiply([[t,0,0],[0,e,0],[0,0,1]])},skewX:function(t){return this.multiply([[1,t,0],[0,1,0],[0,0,1]])},skewY:function(t){return this.multiply([[1,0,0],[t,1,0],[0,0,1]])},reflectionOrigin:function(){return this.multiply([[-1,0,0],[0,-1,0],[0,0,1]])},flipX:function(){return this.multiply([[1,0,0],[0,-1,0],[0,0,1]])},flipY:function(){return this.multiply([[-1,0,0],[0,1,0],[0,0,1]])}},zd=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.reset(e)}var e,n,r;return e=t,(n=[{key:"reset",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.segments=[],this.pathString=t,this.parse()}},{key:"resetSegments",value:function(t){this.segments=t||[],this.pathString=this.joinPath()}},{key:"trim",value:function(){return((arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").match(Ld)||[]).filter(function(t){return""!=t})}},{key:"parse",value:function(){var t=this,e=this.pathString.match(Md)||[];this.segments=e.map(function(e){var n=e[0];return{command:n,values:t.trim(e.replace(n,"")).map(function(t){return+t})}}),this.segments=this.segments.map(function(e,n){switch(e.command){case"c":case"m":case"l":case"q":case"s":case"t":case"v":case"h":for(var r=t.segments[n-1],o=r.values[r.values.length-2],i=r.values[r.values.length-1],a=0,c=e.values.length;a1&&void 0!==arguments[1]&&arguments[1],r=this.segments.map(function(n){return t.call(e,n)});if(n)return r;this.segments=r}},{key:"_loop",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.each(function(e){var n=e.values;switch(e.command){case"M":case"L":var r=t(n,0);e.values=[r[0],r[1]];break;case"V":r=t([+n[0],0]);e.values=[r[0]];break;case"H":r=t([0,+n[0]]);e.values=[r[1]];break;case"C":case"S":case"T":case"Q":for(var o=0,i=n.length;o1&&void 0!==arguments[1]?arguments[1]:[];return this.pathArray.push("".concat(t," ").concat(this.getPointString(e))),this}},{key:"M",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n0&&void 0!==arguments[0]?arguments[0]:"object";return'")}},{key:"d",get:function(){return this.pathArray.join(" ").trim()}}])&&Fd(e.prototype,n),r&&Fd(e,r),t}();function Hd(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);ee.dist?-1:1});var a=null;return i.length&&(r+=(a=i[0].point)[e]-n),{point:a,distanceValue:r}}function Zd(t,e,n,r){var o=[],i=Wd;return t.filter(function(t){return t}).forEach(function(t){i.filter(function(e){return t[e]}).forEach(function(i){var a=t[i],c=Math.abs(a[e]-n);c<=r&&o.push({dist:c,point:a})})}),o.sort(function(t,e){return t.dist>e.dist?1:-1}),o.length?o[0].point:null}function qd(t,e,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=[],i=0,a=t.length;i3&&void 0!==arguments[3]?arguments[3]:1,o=n.command,i=n.values;switch(o){case"Z":return"Z";default:var a=i.map(function(n){var o=n.x-t==0?0:(n.x-t)/r,i=n.y-e==0?0:(n.y-e)/r;return"".concat(o," ").concat(i)}).join(" ");return"".concat(o," ").concat(a)}}(e,n,t,r)}).join(" ")}}var Jd=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.pathEditor=e,this.pathStringManager=new Gd,this.guideLineManager=new Gd,this.segmentManager=new $d,this.initialize(),this.initializeSelect()}var e,n,r;return e=t,(n=[{key:"initialize",value:function(){this.splitLines=[],this.guideLineManager.reset(),this.segmentManager.reset(),this.pathStringManager.reset()}},{key:"initializeSelect",value:function(){this.selectedPointKeys={},this.selectedPointList=[]}},{key:"selectInBox",value:function(t){var e=[],n=["startPoint","endPoint","reversePoint"];this.state.points.forEach(function(r,o){n.forEach(function(n){var i=r[n];(function(t,e){return!(t.x2.valuee.x||t.y.value>e.y)})(t,i)&&e.push({x:i.x,y:i.y,key:n,index:o})})}),this.select.apply(this,e)}},{key:"select",value:function(){var t=this;this.selectedPointKeys={};for(var e=arguments.length,n=new Array(e),r=0;r1?r-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.transformRect,o=(r.x,r.y,r.width),i=r.height;switch(t){case"flipX":this.applyTransform(it.matrix2d.translate(-e,0),it.matrix2d.flipX());break;case"flipY":this.applyTransform(it.matrix2d.translate(0,-n),it.matrix2d.flipY());break;case"flip":this.applyTransform(it.matrix2d.translate(-e,-n),it.matrix2d.flip());break;case"to move":this.applyTransform(it.matrix2d.translate(e,n));break;case"to skewX":var a=(s=yt(c=o/2,u=i/2))-yt(c+e,u);this.applyTransform(it.matrix2d.skewX(ct(a)));break;case"to skewY":var c,u,s=yt(c=o/2,u=i/2),l=yt(c,u+n)-s;this.applyTransform(it.matrix2d.skewY(ct(l)));break;case"to bottom right":var f=ut(o+e,o),p=ut(i+n,i);this.applyTransform(it.matrix2d.scale(f,p));break;case"to right":f=ut(o+e,o);this.applyTransform(it.matrix2d.scale(f,1));break;case"to bottom":p=ut(i+n,i);this.applyTransform(it.matrix2d.scale(1,p));break;case"to top right":f=ut(o+e,o),p=ut(i-n,i);this.applyTransform(it.matrix2d.scale(f,p),it.matrix2d.translate(0,n));break;case"to top left":f=ut(o-e,o),p=ut(i-n,i);this.applyTransform(it.matrix2d.scale(f,p),it.matrix2d.translate(e,n));break;case"to left":f=ut(o-e,o);this.applyTransform(it.matrix2d.scale(f,1),it.matrix2d.translate(e,0));break;case"to top":p=ut(i-n,i);this.applyTransform(it.matrix2d.scale(1,p),it.matrix2d.translate(0,n));break;case"to bottom left":f=ut(o-e,o),p=ut(i+n,i);this.applyTransform(it.matrix2d.scale(f,p),it.matrix2d.translate(e,0))}}},{key:"initTransform",value:function(t){this.transformRect=L(t),this.transformPoints=this.clonePoints.map(function(t){return{startPoint:L(t.startPoint),endPoint:L(t.endPoint),reversePoint:L(t.reversePoint)}})}},{key:"setConnectedPoint",value:function(t,e){var n=this.state,r=n.dragXY.x+t,o=n.dragXY.y+e,i={x:r,y:o},a={x:r,y:o};n.dragPoints&&(n.reversePoint=Vd.getReversePoint(n.startPoint,i));var c={startPoint:n.startPoint,endPoint:i,curve:!!n.dragPoints,reversePoint:a,connected:!0,close:!0};n.points.push(c)}},{key:"setCachePoint",value:function(t,e){var n=this.state,r=n.points;if(this.snapPointList=[],n.selectedIndex=t,n.connectedPoint=Vd.getPrevPoint(r,t),n.connectedPoint&&!n.connectedPoint.connected&&(n.connectedPoint=null),n.segment=Vd.getIndexPoint(r,t),n.segment.connected&&(n.connectedPoint=Vd.getNextPoint(r,t)),Vd.isFirst(n.segment)){var o=Vd.getLastPoint(r,t);o.connected&&(n.connectedPoint=o)}n.segmentKey=e,n.isCurveSegment=n.segment.curve&&"startPoint"!=n.segmentKey,n.originalSegment=L(n.segment),n.connectedPoint&&(n.originalConnectedPoint=L(n.connectedPoint)),n.cachedPoints=[],r.filter(function(t){return t&&t!=n.segment}).forEach(function(t){n.cachedPoints.push(t.startPoint,t.reversePoint,t.endPoint)})}},{key:"moveSegment",value:function(t,e,n){var r=this.state,o=r.originalSegment[t],i=r.segment[t];o&&(i.x=o.x+e,i.y=o.y+n)}},{key:"calculateToCurve",value:function(t,e,n){var r=(e.startPoint.x+n.startPoint.x)/2,o=(e.startPoint.y+n.startPoint.y)/2,i=(e.startPoint.x-r)/2,a=(e.startPoint.y-o)/2;return t.endPoint={x:t.startPoint.x+i,y:t.startPoint.y+a},t.reversePoint={x:t.startPoint.x-i,y:t.startPoint.y-a},{dx:i,dy:a}}},{key:"convertToCurve",value:function(t){var e=this.state.points,n=e[t];if(n.curve)if(n.curve=!1,n.reversePoint=L(n.startPoint),n.endPoint=L(n.startPoint),"M"===n.command){var r=Vd.getPrevPoint(e,n.index);r.connected&&(r.curve=!1,r.reversePoint=L(r.startPoint),r.endPoint=L(r.startPoint))}else{if((o=Vd.getNextPoint(e,t))&&"M"===o.command)(a=o).curve=!1,a.reversePoint=L(a.startPoint),a.endPoint=L(a.startPoint)}else{n.curve=!0;var o,i=Vd.getPrevPoint(e,t);if((o=Vd.getNextPoint(e,t))&&o.indext&&"M"!==o.command)this.calculateToCurve(n,o,i);else if(!o&&i){var c=(n.startPoint.x-i.startPoint.x)/3,u=(n.startPoint.y-i.startPoint.y)/3;n.endPoint={x:n.startPoint.x+c,y:n.startPoint.y+u},n.reversePoint=Vd.getReversePoint(n.startPoint,n.endPoint)}else if(!i&&o){c=(n.startPoint.x-o.startPoint.x)/3,u=(n.startPoint.y-o.startPoint.y)/3;n.endPoint={x:n.startPoint.x+c,y:n.startPoint.y+u},n.reverse=Vd.getReversePoint(n.startPoint,n.endPoint)}}}},{key:"moveCurveSegment",value:function(t,e,n){var r=this.state;this.moveSegment(t,e,n);var o="endPoint"===t?"reversePoint":"endPoint";r.segment[o]=Vd.getReversePoint(r.segment.startPoint,r.segment[t])}},{key:"rotateSegmentTarget",value:function(t,e){var n=this.state;if(n.originalSegment&&n.segment){var r=n.originalSegment.startPoint,o=r.x,i=r.y,a=n.segment[t],c=a.x,u=a.y,s=n.originalSegment[e],l=s.x,f=s.y,p=pt(dt(c-o,u-i),ht(l,f,o,i),o,i),h=p.x,y=p.y;n.segment[e]={x:h,y:y}}}},{key:"rotateSegment",value:function(t){this.rotateSegmentTarget(t,"endPoint"===t?"reversePoint":"endPoint")}},{key:"calculateSnap",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=this.state,i=o.cachedPoints,a=o.originalSegment[t];if(!t)return{dx:e,dy:n,snapPointList:[]};var c=a.x+e,u=a.y+n,s=Ud(i,"x",c,e,r),l=s.point,f=(e=s.distanceValue,Ud(i,"y",u,n,r)),p=f.point,h=(n=f.distanceValue,{x:a.x+e,y:a.y+n}),y=[];return l&&y.push({startPoint:l,endPoint:h}),p&&y.push({startPoint:p,endPoint:h}),{dx:e,dy:n,snapPointList:y}}},{key:"copySegment",value:function(t,e){e.startPoint=L(t.startPoint),e.endPoint=L(t.endPoint),e.reversePoint=L(t.reversePoint)}},{key:"moveSelectedSegment",value:function(t,e){var n=this;this.selectedPointList.forEach(function(r){var o=n.state.points[r.index][r.key];o.x=r.x+t,o.y=r.y+e})}},{key:"move",value:function(t,e,n){var r=this.state,o=r.isCurveSegment,i=r.segmentKey,a=r.connectedPoint,c=this.calculateSnap(i,t,e,2),u=(t=c.dx,e=c.dy,c.snapPointList);if(this.snapPointList=u||[],this.selectedPointList.length>1)this.moveSelectedSegment(t,e);else if(o)if(n.shiftKey){this.moveSegment(i,t,e);var s="endPoint"===i?"reversePoint":"endPoint";r.segment[s]=Vd.getReversePoint(r.segment.startPoint,r.segment[i])}else n.altKey?this.moveSegment(i,t,e):(this.moveSegment(i,t,e),this.rotateSegment(i));else this.moveSegment("startPoint",t,e),this.moveSegment("endPoint",t,e),this.moveSegment("reversePoint",t,e);a&&this.copySegment(r.segment,r.connectedPoint)}},{key:"moveEnd",value:function(t,e){var n=this.state,r=n.points,o=n.dragXY.x+t,i=n.dragXY.y+e,a={x:o,y:i},c={x:o,y:i};n.dragPoints&&(c=Vd.getReversePoint(n.startPoint,a)),r.push({command:0===n.clickCount?"M":"",startPoint:n.startPoint,endPoint:a,curve:!!n.dragPoints,reversePoint:c}),n.startPoint=null,n.dragPoints=!1,n.moveXY=null}},{key:"setPoint",value:function(t){var e=t.first[0],n=t.second[t.second.length-1],r=this.clonePoints,o=Vd.getPoint(r,e),i=Vd.getPoint(r,n),a=[Nd({},o,{endPoint:t.first[1]}),{startPoint:t.first[3],reversePoint:t.first[2],curve:!0,endPoint:t.second[1]},Nd({},i,{reversePoint:t.second[2]})],c=Vd.getIndex(r,e);r.splice.apply(r,[c,2].concat(a)),this.state.points=r}},{key:"setPointQuard",value:function(t){var e=t.first[0],n=(t.second[t.second.length-1],this.clonePoints),r=Vd.getPoint(n,e),o=[Nd({},r,{endPoint:{x:r.startPoint.x+(r.endPoint.x-r.startPoint.x)/3,y:r.startPoint.y+(r.endPoint.y-r.startPoint.y)/3}}),{startPoint:t.first[2],reversePoint:t.first[1],curve:!0,endPoint:t.second[1]}],i=Vd.getIndex(n,e);n.splice.apply(n,[i,1].concat(o)),this.state.points=n}},{key:"setPointLine",value:function(t){var e=t.first[0],n=this.clonePoints,r=[{command:"L",startPoint:t.first[1],curve:!1,endPoint:t.first[1],reversePoint:t.first[1]}],o=Vd.getIndex(n,e);n.splice.apply(n,[o+1,0].concat(r)),this.state.points=n}},{key:"toPath",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return qd(this.clonePoints,t,e,n)}},{key:"changeScale",value:function(){this.pathEditor.scale}},{key:"makeSVGPath",value:function(){return this.initialize(),this.makePointGuide(this.clonePoints),this.makeMovePositionGuide(),this.toSVGString()}},{key:"makeTriangleDistancePointGuide",value:function(t,e){var n=Math.min(t.startPoint.x,e.startPoint.x),r=Math.max(t.startPoint.x,e.startPoint.x),o=Math.min(t.startPoint.y,e.startPoint.y),i=Math.max(t.startPoint.y,e.startPoint.y);if(t.startPoint.xe.startPoint.y?this.segmentManager.addDistanceLine({x:n,y:i},{x:r,y:i}).addDistanceLine({x:r,y:o},{x:r,y:i}):t.startPoint.x>e.startPoint.x&&t.startPoint.y>e.startPoint.y?this.segmentManager.addDistanceLine({x:n,y:o},{x:n,y:i}).addDistanceLine({x:n,y:i},{x:r,y:i}):t.startPoint.x>e.startPoint.x&&t.startPoint.y2&&void 0!==arguments[2]?arguments[2]:1,r=Zd(t,"x",e.x,n),o=Zd(t,"y",e.y,n),i=Nd({},e);r&&(i.x=r.x),o&&(i.y=o.y);var a=[];return r&&a.push({startPoint:r,endPoint:i}),o&&a.push({startPoint:o,endPoint:i}),{snapPointList:a,moveXY:i}}(e,r,2),u=c.snapPointList,s=c.moveXY;(a=i).push.apply(a,Hd(u)),t.moveXY=s,r=s,this.snapPointList=i;var l=e[e.length-1];if(o)if(l){if(l.curve){var f=Vd.getReversePoint(n,r);y=f.x,d=f.y;this.guideLineManager.M(l.startPoint).C(l.endPoint,{x:y,y:d},n),this.segmentManager.addGuideLine(l.startPoint,l.endPoint).addGuideLine(n,{x:y,y:d}).addGuideLine(n,r).addCurvePoint(l.endPoint).addCurvePoint({x:y,y:d}).addCurvePoint(r).addPoint(!1,n)}else if(!1===l.curve){var p=Vd.getReversePoint(n,r);y=p.x,d=p.y;this.guideLineManager.M(l.startPoint).Q({x:y,y:d},n),this.segmentManager.addGuideLine(r,{x:y,y:d}).addPoint(!1,n).addCurvePoint({x:y,y:d}).addCurvePoint(r)}}else{var h=Vd.getReversePoint(n,r),y=h.x,d=h.y;this.guideLineManager.M(r).L(n).L({x:y,y:d}),this.segmentManager.addCurvePoint(n).addCurvePoint(r).addCurvePoint({x:y,y:d})}else l&&(l.curve?(this.guideLineManager.M(l.startPoint).Q(l.endPoint,r),this.segmentManager.addGuideLine(l.endPoint,l.startPoint).addCurvePoint(l.endPoint)):l.close||(this.guideLineManager.M(l.startPoint).L(r),this.segmentManager.addPoint(!1,l.startPoint)))}}},{key:"makeSnapLines",value:function(){var t=[];if(this.snapPointList){var e=new Gd;t=this.snapPointList.map(function(t){return e.reset(),e.M(t.startPoint).L(t.endPoint).toString("snap-path")})}return t.join("")}},{key:"makeSelectedSVGZone",value:function(){var t=this.state,e=t.screenX,n=t.screenY,r=t.screenWidth,o=t.screenHeight,i=this.pathEditor.scale,a=e.value*i,c=n.value*i,u=r.value*i,s=o.value*i;return"")}},{key:"toSVGString",value:function(){return'\n \n '.concat(this.makeSelectedSVGZone(),"\n ").concat(this.guideLineManager.toString("guide"),"\n ").concat(this.pathStringManager.toString("object"),"\n ").concat(this.splitLines.join(""),"\n ").concat(this.makeSnapLines(),"\n ").concat(this.segmentManager.toString(),"\n \n ")}},{key:"state",get:function(){return this.pathEditor.state}},{key:"clonePoints",get:function(){return Hd(this.state.points)}}])&&Yd(e.prototype,n),r&&Yd(e,r),t}();function Qd(t){return(Qd="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})(t)}function tv(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};return pv(hv(e.prototype),"getDefaultObject",this).call(this,function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:[];if(!t.length)return"";var e=t.map(function(e,n){return e.prevColorStep=e.cut&&n>0?t[n-1]:null,e});return 1===e.length&&e.push(new cv({color:e[0].color||"transparent",percent:100})),e.map(function(t){return"".concat(t)}).join(",")}},{key:"random",value:function(){var t=Math.floor(1e3*Math.random())%360;return"linear-gradient(".concat(t,"deg, ").concat(Ee.random()," 0%, ").concat(Ee.random()," 100%)")}}],(r=[{key:"isGradient",value:function(){return!0}},{key:"toString",value:function(){return"none"}},{key:"getDefaultObject",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return kv(Ov(e.prototype),"getDefaultObject",this).call(this,bv({type:"gradient",colorsteps:[]},t))}},{key:"toCloneObject",value:function(){return bv({},kv(Ov(e.prototype),"toCloneObject",this).call(this),{colorsteps:this.json.colorsteps.map(function(t){return t.clone()})})}},{key:"convert",value:function(t){return t.colorsteps=t.colorsteps.map(function(t){return new cv(t)}),t}},{key:"calculateAngle",value:function(){var t=this.json.angle;return E(jv[t])?t:jv[t]||0}},{key:"addColorStep",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.json.colorsteps.push(t),e&&this.sortColorStep(),t}},{key:"insertColorStep",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"rgba(216,216,216,0)",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"rgba(216,216,216,1)",r=this.colorsteps;if(r.length){if(te.percent?1:t.percente.index?1:-1:void 0}),t.forEach(function(t,e){t.index=100*e})}},{key:"addColorStepList",value:function(){var t=this;(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(function(e){t.addColorStep(e,!1)}),this.sortColorStep()}},{key:"getColorStep",value:function(t){return this.json.colorsteps.filter(function(e){return e.id==t})[0]}},{key:"clear",value:function(){arguments.length?this.json.colorsteps.splice(+(arguments.length<=0?void 0:arguments[0]),1):this.json.colorsteps=[]}},{key:"removeColorStep",value:function(t){this.json.colorsteps=this.json.colorsteps.filter(function(e){return e.id!=t})}},{key:"getColorString",value:function(){var t=this.colorsteps;return e.toColorString(t)}},{key:"colorsteps",get:function(){return this.json.colorsteps}}])&&mv(n.prototype,r),o&&mv(n,o),e}();function xv(t){return(xv="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})(t)}function _v(t,e){for(var n=0;n\n ").concat(this.colorsteps.map(function(t){return'')}).join("\n"),"\n\n ")}},{key:"toFillValue",value:function(t){return"url(#".concat(t,")")}}])&&Mv(n.prototype,r),o&&Mv(n,o),e}();function Hv(t){return(Hv="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})(t)}function Xv(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Yv(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};return Zv(qv(e.prototype),"getDefaultObject",this).call(this,Nv({type:"radial-gradient",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%",fr:"0%",spreadMethod:"pad"},t))}},{key:"toCloneObject",value:function(){var t=this.json,n=t.cx,r=t.cy,o=t.r,i=t.fx,a=t.fy,c=t.fr,u=t.spreadMethod;return Nv({},Zv(qv(e.prototype),"toCloneObject",this).call(this),{cx:n,cy:r,r:o,fx:i,fy:a,fr:c,spreadMethod:u})}},{key:"toString",value:function(){if(0===this.colorsteps.length)return"";var t=this.getColorString(),e=this.json,n=[e.cx,e.cy,e.r,e.fx,e.fy,e.fr,e.spreadMethod].join(" ");return"".concat(this.json.type,"(").concat(n,", ").concat(t,")")}},{key:"toSVGString",value:function(t){var e=this.json,n=e.cx,r=e.cy,o=e.r,i=e.fx,a=e.fy,c=e.fr,u=e.spreadMethod;return"\n\n ").concat(this.colorsteps.map(function(t){return'')}).join("\n"),"\n\n")}},{key:"toFillValue",value:function(t){return"url(#".concat(t,")")}}])&&Wv(n.prototype,r),o&&Wv(n,o),e}();function tb(t){return(tb="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})(t)}function eb(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nb(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"transparent";return new e({colorsteps:[new cv({color:t,percent:0,index:0}),new cv({color:t,percent:100,index:0})]})}}],(r=[{key:"getDefaultObject",value:function(){return ob(ib(e.prototype),"getDefaultObject",this).call(this,{type:"static-gradient",static:!0,colorsteps:[new cv({color:"red",percent:0,index:0}),new cv({color:"red",percent:100,index:1})]})}},{key:"toCloneObject",value:function(){return function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};return yb(db(e.prototype),"getDefaultObject",this).call(this,lb({type:"url",url:"",datauri:"",patternUnits:"userSpaceOnUse",patternWidth:"100%",patternHeight:"100%",imageX:"0%",imageY:"0%",imageWidth:"100%",imageHeight:"100%"},t))}},{key:"toCloneObject",value:function(){return lb({},yb(db(e.prototype),"toCloneObject",this).call(this),{url:this.json.url,datauri:this.json.datauri,patternUnits:this.json.patternUnits,patternWidth:this.json.patternWidth,patternHeight:this.json.patternHeight,imageX:this.json.imageX,imageY:this.json.imageY,imageWidth:this.json.imageWidth,imageHeight:this.json.imageHeight})}},{key:"isUrl",value:function(){return!0}},{key:"toString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.json,n=e.patternUnits,r=e.patternWidth,o=e.patternHeight,i=e.imageX,a=e.imageY,c=e.imageWidth,u=e.imageHeight,s=e.url,l=[n,r,o,i,a,c,u].join(",").trim();return t?"url(".concat(pl.getFile(s),")"):"url(".concat(s,"#").concat(l,")")}},{key:"toSVGString",value:function(t){var e=this.json,n=e.patternUnits,r=e.patternWidth,o=e.patternHeight,i=e.imageX,a=e.imageY,c=e.imageWidth,u=e.imageHeight;return"\n \n \n \n ")}},{key:"toFillValue",value:function(t){return"url(#".concat(t,")")}}])&&pb(n.prototype,r),o&&pb(n,o),e}();function mb(t){return(mb="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})(t)}function wb(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};return Vb(Ab(e.prototype),"getDefaultObject",this).call(this,Eb({itemType:"svg",name:"New SVG",elementType:"svg",overflow:"visible",stroke:"black","stroke-width":1,svgfilter:"",fill:"transparent","fill-rule":"","fill-opacity":"","stroke-linecap":"","stroke-linejoin":"","stroke-dashoffset":"","stroke-dasharray":" ","text-anchor":"start","motion-based":!1},t))}},{key:"toCloneObject",value:function(){var t=this.json;return Eb({},Vb(Ab(e.prototype),"toCloneObject",this).call(this),{overflow:t.overflow,stroke:t.stroke,"stroke-width":t["stroke-width"],svgfilter:t.svgfilter,fill:t.fill,"fill-rule":t["fill-rule"],"fill-opacity":t["fill-opacity"],"stroke-linecap":t["stroke-linecap"],"stroke-linejoin":t["stroke-linejoin"],"stroke-dashoffset":t["stroke-dashoffset"],"stroke-dasharray":t["stroke-dasharray"],"text-anchor":t["text-anchor"],"motion-based":t["motion-based"]})}},{key:"toDefaultCSS",value:function(){return Eb({},Vb(Ab(e.prototype),"toDefaultCSS",this).call(this),this.toKeyListCSS("stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","fill-opacity","fill-rule","text-anchor"))}},{key:"toSVGAttribute",value:function(){return Eb({},this.toDefaultSVGCSS(),this.toKeyListCSS("stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","fill-opacity","fill-rule","text-anchor"))}},{key:"getDefaultTitle",value:function(){return"SVG"}},{key:"updateDefString",value:function(t){var e=t.$("defs");if(e)e.html(this.toDefInnerString);else{var n=this.toDefString.trim();t.prepend(Ke.createByHTML(n))}}},{key:"toExportSVGCode",value:function(){return"\n ".concat(this.toFillSVG,"\n ").concat(this.toStrokeSVG,"\n ")}},{key:"toDefInnerString",get:function(){return"\n ".concat(this.toFillSVG,"\n ").concat(this.toStrokeSVG,"\n ")}},{key:"toDefString",get:function(){var t=this.toDefInnerString.trim();return"\n \n ".concat(t,"\n \n ")}},{key:"fillId",get:function(){return this.getInnerId("fill")}},{key:"strokeId",get:function(){return this.getInnerId("stroke")}},{key:"toFillSVG",get:function(){return _b.parseImage(this.json.fill||"transparent").toSVGString(this.fillId)}},{key:"toStrokeSVG",get:function(){return _b.parseImage(this.json.stroke||"black").toSVGString(this.strokeId)}},{key:"toFillValue",get:function(){return _b.parseImage(this.json.fill||"transparent").toFillValue(this.fillId)}},{key:"toStrokeValue",get:function(){return _b.parseImage(this.json.stroke||"black").toFillValue(this.strokeId)}},{key:"toFilterValue",get:function(){return this.json.svgfilter?"url(#".concat(this.json.svgfilter,")"):""}}])&&$b(n.prototype,r),o&&$b(n,o),e}();function Mb(t){return(Mb="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})(t)}function Lb(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};return Gb(Hb(e.prototype),"getDefaultObject",this).call(this,Lb({itemType:"svg-path",name:"New Path",d:"",segments:[],totalLength:0},t))}},{key:"enableHasChildren",value:function(){return!1}},{key:"updatePathItem",value:function(t){this.json.d=t.d,this.json.totalLength=t.totalLength,this.json.path=new zd(t.d),t.segments&&this.json.path.resetSegment(t.segments),t.rect&&(this.json.width=He.px(t.rect.width),this.json.height=He.px(t.rect.height),this.setScreenX(He.px(t.rect.x)),this.setScreenY(He.px(t.rect.y)))}},{key:"setCache",value:function(){this.rect=this.clone(),this.cachePath=this.json.path.clone()}},{key:"recover",value:function(){var t=this.rect.width.value;0===t&&(t=1);var e=this.rect.height.value;0===e&&(e=1);var n=this.json.width.value/t,r=this.json.height.value/e;this.scale(n,r)}},{key:"scale",value:function(t,e){this.json.d=this.cachePath.clone().scaleTo(t,e),this.json.path.reset(this.json.d)}},{key:"convert",value:function(t){return(t=Gb(Hb(e.prototype),"convert",this).call(this,t)).d&&(t.path=new zd(t.d)),t}},{key:"toCloneObject",value:function(){var t=this.json;return Lb({},Gb(Hb(e.prototype),"toCloneObject",this).call(this),{totalLength:t.totalLength,d:t.d,segments:L(this.json.segments)})}},{key:"getDefaultTitle",value:function(){return"Path"}},{key:"toAnimationKeyframes",value:function(t){var e=t.filter(function(t){return yc(t.property)&&dc(t.property)}),n=t.filter(function(t){return vc(t.property)});return[{selector:'[data-id="'.concat(this.json.id,'"]'),properties:n},{selector:'[data-id="'.concat(this.json.id,'"] path'),properties:e}]}},{key:"updateFunction",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=t.$("path");n.attr("d",this.json.d),e&&(n.setAttr({filter:this.toFilterValue,fill:this.toFillValue,stroke:this.toStrokeValue}),this.updateDefString(t)),this.json.totalLength=n.totalLength}},{key:"toSVG",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return'\n \n ').concat(this.toDefString,"\n \n \n ")}},{key:"html",get:function(){var t=this.json.id,e={"motion-based":this.json["motion-based"]};return"\n \n ').concat(this.toDefString,"\n \n ")}},{key:"svg",get:function(){var t=this.json.x.value,e=this.json.y.value;return this.toSVG(t,e)}}])&&zb(n.prototype,r),o&&zb(n,o),e}();function Nb(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e8&&void 0!==arguments[8]?arguments[8]:1e3,s=Qb({x:t,y:e},{x:n,y:r},{x:o,y:i},{x:a,y:c}),l=0,f=s(0),p=0;p<=u;p++){var h=s(p/u);l+=ht(f.x,f.y,h.x,h.y),f=h}return l},rg=function(t,e,n,r,o,i){for(var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e3,c=tg({x:t,y:e},{x:n,y:r},{x:o,y:i}),u=0,s=c(0),l=0;l<=a;l++){var f=c(l/a);u+=ht(s.x,s.y,f.x,f.y),s=f}return u},og=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,n={minDist:1/0,minT:0};return function(r,o){for(var i=0;i<=e;i++)eg(n,t,i/e,r,o);var a=1/(2*e),c=n.minT;for(i=0;i2&&void 0!==arguments[2]?arguments[2]:100;return og(function(t,e){var n=[t,e];return function(t){return lg(n,t)}}(t,e),n)},ag=function(t){var e=Jb(t),n={x:e[0],y:e[1]},r={x:e[2],y:e[3]};return Qb({x:0,y:0},n,r,{x:1,y:1})},cg=function(t,e,n){return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n}},ug=function(t,e){var n=cg(t[0],t[1],e),r=cg(t[1],t[2],e),o=cg(t[2],t[3],e),i=cg(n,r,e),a=cg(r,o,e);return cg(i,a,e)},sg=function(t,e){var n=cg(t[0],t[1],e),r=cg(t[1],t[2],e);return cg(n,r,e)},lg=function(t,e){return cg(t[0],t[1],e)},fg=function(t,e){var n=cg(t[0],t[1],e);return{first:[t[0],n],second:[n,t[1]]}};function pg(t){return(pg="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})(t)}function hg(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yg(t,e,n){return(yg="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=wg(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function dg(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e4&&void 0!==arguments[4]?arguments[4]:100;return og(Qb(t,e,n,r),o)}.apply(void 0,dg(r).concat([200]))(n.x,n.y);this.changeMode("modify"),this.pathGenerator.setPoint(function(t,e){var n=cg(t[0],t[1],e),r=cg(t[1],t[2],e),o=cg(t[2],t[3],e),i=cg(n,r,e),a=cg(r,o,e),c=cg(i,a,e);return{first:[t[0],n,i,c],second:[c,a,o,t[3]]}}(r,o))}else if("Q"===e.segments[1].command){r=[jg(e.segments[0].values),jg(e.segments[1].values.slice(0,2)),jg(e.segments[1].values.slice(2,4))],o=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;return og(tg(t,e,n),r)}.apply(void 0,dg(r).concat([200]))(n.x,n.y);this.changeMode("modify"),this.pathGenerator.setPointQuard(function(t,e){var n=cg(t[0],t[1],e),r=cg(t[1],t[2],e),o=cg(n,r,e);return{first:[t[0],n,o],second:[o,r,t[2]]}}(r,o))}else if("L"===e.segments[1].command){r=[jg(e.segments[0].values),jg(e.segments[1].values.slice(0,2))],o=ig.apply(void 0,dg(r).concat([200]))(n.x,n.y);this.changeMode("modify"),this.pathGenerator.setPointLine(fg(r,o))}this.renderPath(),this.refreshPathLayer()}}]),e}(),_g=function(t){function e(){return vg(this,e),mg(this,wg(e).apply(this,arguments))}return kg(e,xg),gg(e,[{key:Pr("changePathTransform"),value:function(t){this.resetTransformZone();var e=this.state.transformZoneRect,n=e.width,r=e.height;switch(this.pathGenerator.initTransform(this.state.transformZoneRect),t){case"flipX":this.pathGenerator.transform("flipX",n,0);break;case"flipY":this.pathGenerator.transform("flipY",0,r);break;case"flip":this.pathGenerator.transform("flip",n,r)}this.renderPath(),this.refreshPathLayer()}},{key:kn("$tool .transform-tool-item")+In("moveTransformTool")+Mn("moveEndTransformTool"),value:function(t){this.transformMoveType=t.$delegateTarget.attr("data-position"),this.resetTransformZone(),this.pathGenerator.initTransform(this.state.transformZoneRect),this.startXY=t.xy}},{key:"moveTransformTool",value:function(t,e){this.pathGenerator.transform(this.transformMoveType,t,e),this.renderPath(),this.refreshPathLayer()}},{key:"moveEndTransformTool",value:function(t,e){}}]),e}(),Tg=function(t){function e(){return vg(this,e),mg(this,wg(e).apply(this,arguments))}return kg(e,_g),gg(e,[{key:"initialize",value:function(){yg(wg(e.prototype),"initialize",this).call(this),this.pathParser=new zd,this.pathGenerator=new Jd(this)}},{key:"initState",value:function(){return{changeEvent:"updatePathItem",isShow:!1,points:[],hasTransform:!1,mode:"draw",$target:null,clickCount:0,isSegment:!1,isFirstSegment:!1,screenX:He.px(0),screenY:He.px(0),screenWidth:He.px(0),screenHeight:He.px(0)}}},{key:"template",value:function(){return"\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
"}},{key:Gn("$tool"),value:function(){this.resetTransformZone();var t=this.state.transformZoneRect;return{"data-show":"transform"===this.state.mode,style:{left:He.px(t.x),top:He.px(t.y),width:He.px(t.width),height:He.px(t.height)}}}},{key:"renderTransformTool",value:function(){this.bindData("$tool")}},{key:"isShow",value:function(){return this.state.isShow}},{key:"initRect",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.state.rect&&!t||(this.state.rect=this.parent.refs.$body.rect())}},{key:un("document")+En("isShow")+Cn("Escape")+Cn("Enter")+Ln+Bn,value:function(){this.state.current?this.refreshPathLayer():this.addPathLayer(),this.trigger("hidePathEditor")}},{key:"makePathLayer",value:function(t){var e,n=this.pathGenerator.toPath(t.x,t.y,this.scale).d,r=pl.selection.currentArtboard;if(r){var o=t.x/this.scale,i=t.y/this.scale,a=t.width/this.scale,c=t.height/this.scale;(e=r.add(new Yb({width:He.px(a),height:He.px(c),d:n,totalLength:this.totalPathLength}))).setScreenX(o),e.setScreenY(i)}return e}},{key:"updatePathLayer",value:function(){var t=this.getPathRect(),e=t.x,n=t.y,r=this.state.current;if(r&&this.isBoxMode)e=r.screenX.value/this.scale,n=r.screenY.value/this.scale;var o=this.pathGenerator.toPath(e,n,this.scale).d,i=new zd(o);this.emit(this.state.changeEvent,{d:i.toString(),totalLength:this.totalPathLength,rect:{x:0===t.x?0:t.x/this.scale,y:0===t.y?0:t.y/this.scale,width:0===t.width?0:t.width/this.scale,height:0===t.height?0:t.height/this.scale}}),this.emit("refreshPathLayer")}},{key:"addPathLayer",value:function(){var t=this.getPathRect();if(this.changeMode("modify"),0!==t.width&&0!==t.height){var e=this.makePathLayer(t);e&&(pl.selection.select(e),this.emit("refreshAll"),this.emit("refreshSelection"))}}},{key:"changeMode",value:function(t,e){this.setState(function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:"draw",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"move"===t?(e.current=null,e.points=[]):e.current||(e.current=null),e.box=e.box||"canvas",this.changeMode(t,e),this.refresh(e),this.state.isShow=!0,this.$el.show(),this.$el.focus(),this.emit("showPathManager",{mode:this.state.mode})}},{key:Pr("hidePathEditor"),value:function(){this.pathParser.reset(""),this.setState(this.initState(),!1),this.refs.$view.empty(),this.$el.hide(),this.emit("finishPathEdit"),this.emit("hidePathManager")}},{key:Gn("$view"),value:function(){return{class:{draw:"draw"===this.state.mode,modify:"modify"===this.state.mode,transform:"transform"===this.state.mode,box:"box"===this.state.box,"has-transform":!!this.state.hasTransform,"segment-move":"segment-move"===this.state.mode},innerHTML:this.pathGenerator.makeSVGPath()}}},{key:"refreshPathLayer",value:function(){this.updatePathLayer()}},{key:Gn("$splitCircle"),value:function(){return{cx:this.state.splitXY.x,cy:this.state.splitXY.y}}},{key:"renderPath",value:function(){this.bindData("$view"),this.renderTransformTool()}},{key:"getPathRect",value:function(){this.initRect(!0);var t=this.refs.$view.$("path.object"),e={x:He.px(0),y:He.px(0),width:He.px(0),height:He.px(0)};return t&&((e=t.rect()).x-=this.state.rect.x,e.y-=this.state.rect.y),e}},{key:"resetTransformZone",value:function(){var t=this.getPathRect();this.state.transformZoneRect=t}},{key:On("$view"),value:function(t){(this.initRect(),this.isMode("draw")&&this.state.rect)?(this.state.moveXY={x:t.xy.x-this.state.rect.x,y:t.xy.y-this.state.rect.y},this.state.altKey=t.altKey,this.renderPath()):(Ke.create(t.target).hasClass("split-path")&&(this.state.splitXY={x:t.xy.x-this.state.rect.x,y:t.xy.y-this.state.rect.y},this.bindData("$splitCircle")),this.state.altKey=!1)}},{key:kn("$view :not(.split-path)")+In()+Mn(),value:function(t){this.initRect(),this.state.altKey=!1;var e=this.isMode("draw");this.state.dragXY={x:t.xy.x-this.state.rect.x,y:t.xy.y-this.state.rect.y},this.state.isOnCanvas=!1;var n=Ke.create(t.target);if(n.hasClass("svg-editor-canvas")&&!e?this.state.isOnCanvas=!0:(this.pathGenerator.reselect(),this.state.isSegment="true"===n.attr("data-segment"),this.state.isFirstSegment=this.state.isSegment&&"true"===n.attr("data-is-first")),e){if(this.state.isFirstSegment){var r=+n.attr("data-index");this.state.startPoint=this.state.points[r].startPoint}else this.state.startPoint=this.state.dragXY;this.state.dragPoints=!1,this.state.endPoint=null}else if(this.isOnCanvas)this.renderSelectBox(this.state.dragXY);else if(this.state.isSegment){this.changeMode("segment-move");var o=Sg(n.attrs("data-index","data-segment-point"),2),i=(r=o[0],o[1]);this.pathGenerator.setCachePoint(+r,i),this.pathGenerator.selectKeyIndex(i,r)}}},{key:"hideSelectBox",value:function(){this.refs.$segmentBox.css({left:He.px(-1e5)})}},{key:"renderSelectBox",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r={left:He.px(t.x+(e<0?e:0)),top:He.px(t.y+(n<0?n:0)),width:He.px(Math.abs(e)),height:He.px(Math.abs(n))};this.refs.$segmentBox.css(r)}},{key:"getSelectBox",value:function(){var t=Sg(this.refs.$segmentBox.styles("left","top","width","height").map(function(t){return He.parse(t)}),4),e={x:t[0],y:t[1],width:t[2],height:t[3]};return e.x2=He.px(e.x.value+e.width.value),e.y2=He.px(e.y.value+e.height.value),e}},{key:"move",value:function(t,e){if(this.state.isOnCanvas)this.renderSelectBox(this.state.dragXY,t,e);else if(this.isMode("segment-move")){var n=pl.config.get("bodyEvent");this.pathGenerator.move(t,e,n),this.renderPath(),this.updatePathLayer()}else if(this.isMode("draw")){n=pl.config.get("bodyEvent");this.state.dragPoints=!n.altKey}}},{key:"end",value:function(t,e){this.state.isOnCanvas?0===t&&0===e?(this.changeMode("modify"),this.trigger("hidePathEditor")):(this.changeMode("segment-move"),this.pathGenerator.selectInBox(this.getSelectBox()),this.renderPath(),this.hideSelectBox()):this.isMode("modify")||(this.isMode("segment-move")?(this.changeMode("modify"),this.renderPath()):this.isMode("draw")&&(this.state.isFirstSegment?(this.changeMode("modify"),this.pathGenerator.setConnectedPoint(t,e),this.renderPath(),this.state.current?this.refreshPathLayer():(this.addPathLayer(),this.trigger("hidePathEditor"))):(this.pathGenerator.moveEnd(t,e),this.state.clickCount++,this.renderPath())))}},{key:"scale",get:function(){return pl.scale}},{key:"totalPathLength",get:function(){if(!this.refs.$view)return 0;var t=this.refs.$view.$("path.object");return t?t.totalLength:0}},{key:"isBoxMode",get:function(){return"box"===this.state.box}}]),e}();function Eg(t){return(Eg="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})(t)}function Cg(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function $g(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"";return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Rg(this,Vg(e).call(this,t))}var n,r,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}}),e&&Ag(t,e)}(e,zd),n=e,(r=[{key:"reset",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.segments=[],this.points=t,this.parse()}},{key:"resetSegments",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.segments=t,this.points=this.joinPoints()}},{key:"parse",value:function(){var t=this.points;$(t)&&(t=t.join(" "));for(var e=t.trim().split(Dg).filter(function(t){return t}),n=[],r=0,o=e.length;r1&&void 0!==arguments[1]&&arguments[1],r=this.segments.map(function(n){return t.call(e,n)});if(n)return r;this.segments=r}},{key:"_loop",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.each(function(e){var n=Cg(t([e.x,e.y],0),2),r=n[0],o=n[1];return e.x=r,e.y=o,e},e)}},{key:"clone",value:function(){return new e(this.joinPoints())}},{key:"toString",value:function(){return this.joinPoints()}}])&&$g(n.prototype,r),o&&$g(n,o),e}();function Mg(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);ee.dist?-1:1});var i=null;return o.length&&(n+=(i=o[0].point)[t]-e),{point:i,distanceValue:n}}},{key:"calculateSnap",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=this.state.originalSegment,o=r.x+t,i=r.y+e,a=this.calculateSnapPoint("x",o,t,n),c=a.point,u=(t=a.distanceValue,this.calculateSnapPoint("y",i,e,n)),s=u.point,l=(e=u.distanceValue,{x:r.x+t,y:r.y+e}),f=[];return c&&f.push({startPoint:c,endPoint:l}),s&&f.push({startPoint:s,endPoint:l}),{dx:t,dy:e,snapPointList:f}}},{key:"calculatePointDist",value:function(t,e,n){var r=this.state,o=[];return r.segments.forEach(function(r){var i=Math.abs(r[t]-e);i<=n&&o.push({dist:i,point:r})}),o.sort(function(t,e){return t.dist>e.dist?1:-1}),o.length?o[0].point:null}},{key:"calculateMovePointSnap",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.calculatePointDist("x",t.x,e),r=this.calculatePointDist("y",t.y,e),o=function(t){for(var e=1;e2&&void 0!==arguments[2]?arguments[2]:1;return{points:this.cloneSegments.map(function(r){var o=(r.x-t)/n,i=(r.y-e)/n;return"".concat(o," ").concat(i)}).join(" ")}}},{key:"makeSVGPath",value:function(){return this.initialize(),this.makeMoveGuide(this.cloneSegments),this.makeMovePositionGuide(),this.toSVGString()}},{key:"makeMoveGuide",value:function(t){var e=this;this.points=[];t.length;t.forEach(function(n,r){var o=0===r;e.points.push(n),e.splitLines.push((new Gd).M(Vd.getPrevPoint(t,r)).L(n).toString("split-path")),e.segmentManager.addPoint({isFirst:o},n,r),e.segmentManager.addText(n,r+1)})}},{key:"makeMovePositionGuide",value:function(){var t=this.state,e=t.moveXY,n=t.snapPointList;if(e){var r;n=n||[];var o=this.calculateMovePointSnap(e,2),i=o.snapPointList,a=o.moveXY;(r=n).push.apply(r,Mg(i)),t.moveXY=a,this.snapPointList=n,this.points.push(t.moveXY),this.segmentManager.addStartPoint({},t.dragXY)}}},{key:"makeSnapLines",value:function(){var t=[];if(this.snapPointList){var e=new Gd;t=this.snapPointList.map(function(t){return e.reset(),e.M(t.startPoint).L(t.endPoint).toString("snap-path")})}return t.join("")}},{key:"makeSelectedSVGZone",value:function(){var t=this.state,e=t.screenX,n=t.screenY,r=t.screenWidth,o=t.screenHeight,i=this.polygonEditor.scale,a=e.value*i,c=n.value*i,u=r.value*i,s=o.value*i;return"")}},{key:"makeDeluanay",value:function(){return""}},{key:"toSVGString",value:function(){return'\n \n '.concat(this.makeSelectedSVGZone(),"\n ").concat(this.makeDeluanay(),"\n \n ').concat(this.makeSnapLines(),"\n ").concat(this.splitLines.join("")," \n ").concat(this.segmentManager.toString(),"\n \n ")}},{key:"state",get:function(){return this.polygonEditor.state}},{key:"cloneSegments",get:function(){return Mg(this.state.segments)}}])&&Bg(e.prototype,n),r&&Bg(e,r),t}();function Fg(t){return(Fg="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})(t)}function Gg(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};return Ng(Kg(e.prototype),"getDefaultObject",this).call(this,Gg({itemType:"svg-polygon",name:"New Polygon",points:"",totalLength:0},t))}},{key:"enableHasChildren",value:function(){return!1}},{key:"updatePolygonItem",value:function(t){this.json.points=t.points,this.json.totalLength=t.totalLength,this.json.polygon=new Ig(t.points),this.json.width=He.px(t.rect.width),this.json.height=He.px(t.rect.height),this.setScreenX(He.px(t.rect.x)),this.setScreenY(He.px(t.rect.y))}},{key:"setCache",value:function(){this.rect={width:this.json.width.clone(),height:this.json.height.clone()},this.cachePolygon=this.json.polygon.clone()}},{key:"recover",value:function(){var t=this.json.width.value/this.rect.width.value,e=this.json.height.value/this.rect.height.value;this.scale(t,e)}},{key:"scale",value:function(t,e){this.json.points=this.cachePolygon.clone().scaleTo(t,e),this.json.polygon.reset(this.json.points)}},{key:"convert",value:function(t){return(t=Ng(Kg(e.prototype),"convert",this).call(this,t)).points&&(t.polygon=new Ig(t.points)),t}},{key:"toCloneObject",value:function(){var t=this.json;return Gg({},Ng(Kg(e.prototype),"toCloneObject",this).call(this),{totalLength:t.totalLength,points:t.points})}},{key:"getDefaultTitle",value:function(){return"Polygon"}},{key:"updateFunction",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=t.$("polygon");n.attr("points",this.json.points),e&&(n.setAttr({filter:this.toFilterValue,fill:this.toFillValue,stroke:this.toStrokeValue}),this.updateDefString(t)),this.json.totalLength=n.totalLength}},{key:"toAnimationKeyframes",value:function(t){var e=t.filter(function(t){return hasSVGProperty(t.property)});return[{properties:t.filter(function(t){return hasCSSProperty(t.property)}),selector:'[data-id="'.concat(this.json.id,'"]')},{properties:e,selector:'[data-id="'.concat(this.json.id,'"] polygon')}]}},{key:"toSVG",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return'\n \n ').concat(this.toDefString,"\n \n \n ")}},{key:"d",get:function(){return this.json.polygon.toPathString()}},{key:"html",get:function(){var t=this.json,e=t.id,n=t.points;return"\n ').concat(this.toDefString,"\n \n ")}},{key:"svg",get:function(){var t=this.json.x.value,e=this.json.y.value;return this.toSVG(t,e)}}])&&Xg(n.prototype,r),o&&Xg(n,o),e}();function Zg(t){return(Zg="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})(t)}function qg(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Jg(t){for(var e=1;e"}},{key:"isStarMode",value:function(){return this.isMode("star")}},{key:"isShow",value:function(){return this.state.isShow}},{key:un()+Cn(1)+Cn(2)+En("isStarMode")+Ln+Bn,value:function(t){var e=1;"1"===t.key&&(e=-1),this.state.starCount+=e,this.refreshStar(),this.emit("changeStarManager",this.state.starCount,this.state.starInnerRadiusRate)}},{key:"refreshStar",value:function(){this.polygonGenerator.refreshStar(),this.bindData("$view"),this.updatePolygonLayer()}},{key:un()+Cn(3)+Cn(4)+En("isStarMode")+Ln+Bn,value:function(t){var e=.1;"3"===t.key&&(e=-.1),this.state.starInnerRadiusRate+=e,this.refreshStar(),this.emit("changeStarManager",this.state.starCount,this.state.starInnerRadiusRate)}},{key:un("document")+En("isShow")+Cn("Escape")+Cn("Enter")+Ln,value:function(t){this.state.current?this.refreshPolygonLayer():this.addPolygonLayer(),this.trigger("hidePolygonEditor")}},{key:"makePolygonLayer",value:function(t){var e,n=this.refs.$view.$("polygon.object").totalLength,r=this.polygonGenerator.toPolygon(t.x,t.y,this.scale).points,o=pl.selection.currentArtboard;if(o){var i=t.x/this.scale,a=t.y/this.scale,c=t.width/this.scale,u=t.height/this.scale;(e=o.add(new Ug({width:He.px(c),height:He.px(u),points:r,totalLength:n}))).setScreenX(i),e.setScreenY(a)}return e}},{key:"updatePolygonLayer",value:function(){var t=this.getViewRect(),e=this.refs.$view.$("polygon.object").totalLength,n=this.polygonGenerator.toPolygon(t.x*this.scale,t.y*this.scale,this.scale).points;this.emit("updatePolygonItem",{points:n,totalLength:e,rect:t}),this.emit("refreshPolygonLayer")}},{key:"addPolygonLayer",value:function(){this.changeMode("modify");var t=this.getViewRect(),e=this.makePolygonLayer(t);e&&(pl.selection.select(e),this.state.segments=[],this.polygonParser.reset(""),this.bindData("$view"),this.emit("refreshAll"),this.emit("refreshSelection"))}},{key:"changeMode",value:function(t,e){this.setState(Jg({mode:t,moveXY:null},e),!1)}},{key:"isMode",value:function(t){return this.state.mode===t}},{key:Pr("changeScale"),value:function(){this.refresh()}},{key:"refresh",value:function(t){t&&t.points?(this.polygonParser.reset(t.points),this.polygonParser.scale(this.scale,this.scale),this.polygonParser.translate(t.screenX.value*this.scale,t.screenY.value*this.scale),this.state.segments=this.polygonParser.convertGenerator()):this.state.segments=[],this.bindData("$view")}},{key:Pr("showPolygonEditor"),value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"draw",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"move"===t?e.current=null:e.current||(e.current=null);var n=Jg({},e,{points:e.points||""});this.changeMode(t,e),this.refresh(n),this.state.isShow=!0,this.$el.show(),this.$el.focus(),"star"===t?(this.emit("showStarManager",{changeEvent:"changeStarManager",count:this.state.starCount,radius:this.state.starInnerRadiusRate}),this.emit("hidePolygonManager")):(this.emit("showPolygonManager",{mode:this.state.mode}),this.emit("hideStarManager"))}},{key:Pr("changeStarManager"),value:function(t,e){this.state.starCount=t,this.state.starInnerRadiusRate=e,this.refreshStar()}},{key:Pr("hidePolygonEditor"),value:function(){this.polygonParser.reset(""),this.setState(this.initState(),!1),this.refs.$view.empty(),this.$el.hide(),this.emit("hideStarManager"),this.emit("hidePolygonManager"),this.emit("finishPolygonEdit")}},{key:Gn("$view"),value:function(){return{class:{draw:"draw"===this.state.mode,modify:"modify"===this.state.mode,"segment-move":"segment-move"===this.state.mode},innerHTML:this.polygonGenerator.makeSVGPath()}}},{key:"getXY",value:function(t){var e=qg(t,2);return{x:e[0],y:e[1]}}},{key:rn("$view .split-path"),value:function(t){var e=new zd(t.$delegateTarget.attr("d")),n={x:t.xy.x-this.state.rect.x,y:t.xy.y-this.state.rect.y},r=[this.getXY(e.segments[0].values),this.getXY(e.segments[1].values.slice(0,2))],o=ig.apply(void 0,r.concat([200]))(n.x,n.y);this.polygonGenerator.setPointLine(fg(r,o)),this.changeMode("modify"),this.bindData("$view"),this.refreshPolygonLayer()}},{key:"getViewRect",value:function(){var t=this.refs.$view.$("polygon.object").rect();return t.x-=this.state.rect.x,t.y-=this.state.rect.y,t}},{key:"refreshPolygonLayer",value:function(){this.updatePolygonLayer()}},{key:On("$view"),value:function(t){this.isMode("draw")&&this.state.rect&&(this.state.moveXY={x:t.xy.x-this.state.rect.x,y:t.xy.y-this.state.rect.y},this.state.altKey=t.altKey,this.bindData("$view"))}},{key:kn("$view :not(.split-path)")+In()+Mn(),value:function(t){if(this.state.rect=this.parent.refs.$body.rect(),this.state.altKey=!1,this.state.dragXY={x:t.xy.x-this.state.rect.x,y:t.xy.y-this.state.rect.y},this.$el.focus(),this.state.$target=Ke.create(t.target),this.state.isSegment="true"===this.state.$target.attr("data-segment"),this.state.$target.hasClass("svg-editor-canvas")&&!this.isMode("draw")&&!this.isMode("star"))return this.changeMode("modify"),this.trigger("hidePolygonEditor"),!1;if(this.state.isSegment){this.changeMode("segment-move");var e=+this.state.$target.attr("data-index");this.polygonGenerator.setCachePoint(e)}else this.isMode("star")?this.polygonGenerator.moveStart():this.isMode("draw")}},{key:"move",value:function(t,e){this.isMode("star")?(this.polygonGenerator.moveStar(t,e,pl.config.get("bodyEvent")),this.bindData("$view")):this.isMode("segment-move")?(this.polygonGenerator.move(t,e,pl.config.get("bodyEvent")),this.bindData("$view"),this.updatePolygonLayer()):this.isMode("draw")||this.isMode("move")}},{key:"end",value:function(t,e){if(this.state.$target.is(this.refs.$view)&&pl.config.get("bodyEvent").altKey)return this.trigger("hidePolygonEditor"),void this.changeMode("modify");this.isMode("segment-move")?this.changeMode("modify"):this.isMode("star")?(this.polygonGenerator.moveEndStar(t,e),this.bindData("$view")):this.isMode("draw")&&(this.polygonGenerator.moveEnd(t,e),this.bindData("$view"))}},{key:"scale",get:function(){return pl.scale}}])&&tm(n.prototype,r),o&&tm(n,o),e}();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})(t)}function cm(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function um(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e\n
\n
\n \n \n \n \n \n "}},{key:"getScrollXY",value:function(){return{width:this.refs.$body.scrollWidth(),height:this.refs.$body.scrollHeight(),left:this.refs.$body.scrollLeft(),top:this.refs.$body.scrollTop()}}},{key:Pr("after.change.mode"),value:function(){this.$el.attr("data-mode",pl.mode)}},{key:Pr("hideSubEditor"),value:function(t){this.children.$pathEditorView.$el.hide(),this.children.$polygonEditorView.$el.hide()}},{key:"getElement",value:function(t){return this.refs.$view.$('[data-id="'.concat(t,'"]'))}},{key:"checkEmptyElement",value:function(t){var e=Ke.create(t.target);return!!pl.isAddMode()||"selection"===this.state.mode&&(!1===e.hasClass("element-item")&&!1===e.hasClass("selection-tool-item")&&!1===e.hasClass("path-editor-view")&&!1===e.hasClass("polygon-editor-view")&&!1===e.hasClass("point")&&!1===e.hasClass("handle")&&!1===e.hasClass("perspective-handle")&&!1===e.hasClass("transform-tool-item")&&!1===e.hasClass("transform-tool")&&!1===e.isTag("svg")&&!1===e.isTag("path")&&!1===e.isTag("textPath")&&!1===e.isTag("polygon")&&"true"!==e.attr("data-segment"))}},{key:kn("$el")+En("checkEmptyElement")+In("movePointer")+Mn("moveEndPointer"),value:function(t){if(this.$target=Ke.create(t.target),this.dragXY={x:t.xy.x,y:t.xy.y},this.rect=this.refs.$body.rect(),this.canvasOffset=this.refs.$view.rect(),this.canvasPosition={x:this.canvasOffset.left-this.rect.x,y:this.canvasOffset.top-this.rect.y},this.dragXY.x-=this.rect.x,this.dragXY.y-=this.rect.y,pl.isSelectionMode()){var e={left:He.px(this.dragXY.x),top:He.px(this.dragXY.y),width:He.px(0),height:He.px(0)};this.refs.$dragAreaRect.css(e),pl.selection.empty(),this.cachedCurrentElement={},this.$el.$$(".selected").forEach(function(t){return t.removeClass("selected")}),this.emit("initSelectionTool")}}},{key:"movePointer",value:function(t,e){var n={left:He.px(this.dragXY.x+(t<0?t:0)),top:He.px(this.dragXY.y+(e<0?e:0)),width:He.px(Math.abs(t)),height:He.px(Math.abs(e))};if(this.refs.$dragAreaRect.css(n),pl.isSelectionMode()){var r,o=n.left,i=n.top,a=n.width,c=n.height,u={x:He.px(o.value-this.canvasPosition.x),y:He.px(i.value-this.canvasPosition.y),width:a,height:c};u.x2=He.px(u.x.value+u.width.value),u.y2=He.px(u.y.value+u.height.value);var s=pl.selection.currentArtboard;if(s){var l;Object.keys(u).forEach(function(t){u[t].div(pl.scale)});var f=s.checkInAreaForLayers(u);0===u.width.value&&0===u.height.value&&(f=[]),(l=pl.selection).select.apply(l,um(f)),this.selectCurrentForBackgroundView.apply(this,um(f))}(r=pl.selection).select.apply(r,um(f)),this.emit("refreshSelection")}}},{key:"moveEndPointer",value:function(t,e){var n=cm(this.refs.$dragAreaRect.styles("left","top","width","height").map(function(t){return He.parse(t)}),4),r=n[0],o=n[1],i=n[2],a=n[3],c={x:He.px(r.value-this.canvasPosition.x),y:He.px(o.value-this.canvasPosition.y),width:i,height:a};if(c.x2=He.px(c.x.value+c.width.value),c.y2=He.px(c.y.value+c.height.value),this.refs.$dragAreaRect.css({left:He.px(-1e4),top:He.px(0),width:He.px(0),height:He.px(0)}),pl.isSelectionMode()){var u,s=pl.selection.currentArtboard,l=[];if(s)Object.keys(c).forEach(function(t){c[t].div(pl.scale)}),l=s.checkInAreaForLayers(c),0===c.width.value&&0===c.height.value&&(l=[]),0===l.length&&s.checkInArea(c)&&(l=[s]),(u=pl.selection).select.apply(u,um(l)),this.selectCurrentForBackgroundView.apply(this,um(l)),l.length?this.emit("refreshSelection"):(pl.selection.select(),this.emit("emptySelection"));else pl.selection.select(),this.emit("emptySelection")}else{var f={x:He.px(c.x.value/pl.scale),y:He.px(c.y.value/pl.scale),width:He.px(c.width.value/pl.scale),height:He.px(c.height.value/pl.scale)};"image"===pl.addType?this.emit("addImage",f):this.emit("new.layer",pl.addType,f)}this.sendHelpMessage()}},{key:"sendHelpMessage",value:function(){1===pl.selection.length&&(pl.selection.current.is("svg-path","svg-polygon","svg-textpath")&&this.emit("addStatusBarMessage","Please click if you want to edit to path "))}},{key:un("$view .element-item.text"),value:function(t){var e=t.$delegateTarget.html(),n=t.$delegateTarget.text().trim(),r=t.$delegateTarget.attr("data-id"),o=[];pl.selection.items.filter(function(t){return t.id===r}).forEach(function(t){t.reset({content:e,text:n}),o.push({id:t.id,content:e,text:n})}),this.emit("refreshContent",o)}},{key:"checkEditMode",value:function(){return pl.isSelectionMode()}},{key:kn("$view .element-item")+En("checkEditMode")+In("calculateMovedElement")+Mn("calculateEndedElement"),value:function(t){if(this.startXY=t.xy,this.$element=t.$delegateTarget,this.$element.hasClass("text")&&this.$element.hasClass("selected"))return!1;if(this.$element.hasClass("selected"));else{var e=this.$element.attr("data-id");pl.selection.selectById(e)}pl.selection.isRelative||(this.selectCurrent.apply(this,um(pl.selection.items)),this.emit("refreshSelection"),pl.selection.setRectCache())}},{key:"calculateMovedElement",value:function(t,e){this.children.$selectionTool.refreshSelectionToolView(t,e,"move"),this.updateRealPosition()}},{key:"updateRealPosition",value:function(){var t=this;pl.selection.items.forEach(function(e){var n=e.toBound(),r=n.x,o=n.y,i=n.width,a=n.height,c=t.cachedCurrentElement[e.id];c&&c.cssText("left: ".concat(r,";top:").concat(o,";width:").concat(i,";height:").concat(a))}),this.emit("refreshRect")}},{key:"updateRealTransform",value:function(){var t=this;pl.selection.items.forEach(function(e){var n=e.transform,r=t.cachedCurrentElement[e.id];r&&r.css({transform:n})}),this.emit("refreshTransform")}},{key:"updateRealTransformWillChange",value:function(){var t=this;pl.selection.items.forEach(function(e){var n=t.cachedCurrentElement[e.id];n&&n.css("will-change","transform")})}},{key:Pr("removeRealPosition","removeRealTransform"),value:function(){var t=this;pl.selection.items.forEach(function(e){var n=t.cachedCurrentElement[e.id];n&&(n.cssText(""),e.is("svg-path")&&n.firstChild().cssText(""))})}},{key:Pr("refreshArtBoardName"),value:function(t,e){this.$el.$("[data-id='".concat(t,"']")).attr("data-title",e)}},{key:"calculateEndedElement",value:function(t,e){this.children.$selectionTool.refreshSelectionToolView(t,e,"move");var n=1===pl.selection.items.length?pl.selection.current:null;this.emit("refreshElement",n),this.emit("refreshSelection"),this.emit("removeGuideLine"),this.trigger("removeRealPosition")}},{key:Gn("$body"),value:function(){var t=He.px(1e4),e=He.px(1e4);return{"data-mode":pl.mode,style:{position:"relative",width:t,height:e}}}},{key:Gn("$view"),value:function(){return{style:{transform:"scale(".concat(pl.scale,")")},innerHTML:this.state.html}}},{key:Pr("addElement"),value:function(){var t=(pl.selection.currentArtboard||{html:""}).html;this.setState({html:t},!1),this.refs.$view.updateDiff(t),this.emit("refreshSelectionTool")}},{key:"selectCurrent",value:function(){var t=this;this.cachedCurrentElement={};var e=this.$el.$$(".selected");e&&e.forEach(function(t){return t.removeClass("selected")});for(var n=arguments.length,r=new Array(n),o=0;o1&&void 0!==arguments[1])||arguments[1];(t?[t]:pl.selection.items).forEach(function(t){e.updateElement(t,n)})}},{key:"updateElement",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t.updateFunction(this.getElement(t.id),e)}},{key:Pr("playTimeline"),value:function(){var t=this,e=pl.selection.currentArtboard;e&&e.getSelectedTimeline().animations.map(function(t){return e.searchById(t.id)}).forEach(function(e){t.updateElement(e)})}},{key:Pr("refreshCanvas"),value:function(t){t?this.updateElement(t):this.trigger("addElement")}},{key:Pr("refreshAllCanvas"),value:function(){var t=(pl.selection.currentArtboard||{html:""}).html;this.setState({html:t}),this.emit("refreshSelectionTool")}},{key:"refresh",value:function(){this.state.html!=this.prevState.html&&this.load()}}])&&sm(n.prototype,r),o&&sm(n,o),e}(),ym='';function dm(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var vm=function(t){for(var e=1;e',device_hub:'',control_point:'',flip_camera:'\n\n \n \n \n\n',flipY:'',flip:'',account_tree:'',format_shapes:'',merge:'',texture:'',settings_input_component:'',view_comfy:'',camera_roll:'',broken_image:'',shadow:'',opacity:'',looks:'',vintage:'',waves:'',blur_linear:'',blur:'',landscape:'',palette:'',diffuse:'',specular:'',photo:'',near_me:'',view_list:'',flash_on:'',doc:'',storage:'',archive:'',file_copy:'',gps_fixed:'',refresh:'',cat:'\n\n\n\n\n',shuffle:'',replay:'',speed:'',alternate_reverse:'',alternate:'',note:'',rect:'',circle:'',color_lens:'',cube:'',polygon:'',star:'',dahaze:'',brush:'',expand:'',list:'',grid:'',align_center:'',align_justify:'',align_left:'',align_right:'',color:'',size:'',edit:'',outline_image:'',ballot:'',shape:'',scatter:'',transform:'',gradient:'',close:'',build:'',code:'',autorenew:'',play:'',pause:'',skip_next:'',skip_prev:'',fast_forward:'',fast_rewind:'',filter:'',input:'',timer:'',title:'',paint:'',border_all:'',border_inner:ym,check:'',arrowRight:'',screen:'',repeat:'',remove2:'',setting:'',image:'\n',artboard:'',folder:'',publish:'',add_note:'',add:'',save:'\n',export:'',redo:'',undo:'',lock:'',lock_open:'',remove:'',copy:'\n',visible:'\n',add_box:'',add_circle:'',create_folder:'\n \n',chevron_right:'\n \n',chevron_left:''});function bm(t){return(bm="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})(t)}function gm(t,e){for(var n=0;n"}},{key:zn("$body"),value:function(){var t=this.state,e=t.min,n=t.max,r=t.step,o=t.label,i=t.type,a=t.removable,c=t.layout,u=+this.state.value.value.toString();isNaN(u)&&(u=0);var s=o?"has-label":"",l=a?"is-removable":"",f=c,p=(+u).toString();return"\n
\n ").concat(o?""):"","\n
\n
\n \n \n
\n
\n \n
\n ")}},{key:"getValue",value:function(){return this.state.value}},{key:"setValue",value:function(t){this.setState({value:He.parse(t)})}},{key:dn("$propertyNumber"),value:function(t){this.refs.$propertyNumber.addClass("focused")}},{key:bn("$propertyNumber"),value:function(t){this.refs.$propertyNumber.removeClass("focused")}},{key:rn("$remove"),value:function(t){this.updateData({value:""})}},{key:"updateData",value:function(t){this.setState(t,!1),this.parent.trigger(this.props.onchange,this.props.key,this.state.value,this.props.params)}},{key:yn("$propertyNumber"),value:function(t){var e=+this.getRef("$propertyNumber").value;this.getRef("$property").val(e),this.updateData({value:this.state.value.set(e)})}},{key:yn("$property"),value:function(t){var e=+this.getRef("$property").value;this.getRef("$propertyNumber").val(e),""===this.state.value&&(this.state.value=He.number(0)),this.updateData({value:this.state.value.set(e)})}}])&&gm(n.prototype,r),o&&gm(n,o),e}();function Sm(t){return(Sm="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})(t)}function jm(t,e){for(var n=0;n\n \n \n
\n \n
\n \n \n\n ')}},{key:Pr("changeScaleValue"),value:function(t){this.children.$scale.setValue(100*pl.scale),this.emit("update.scale",t)}},{key:Pr("changeRangeEditor"),value:function(t,e){this.trigger("changeScaleValue",e/100)}},{key:rn("$plus")+Ln+Bn,value:function(){this.trigger("changeScaleValue",1.1*pl.scale)}},{key:rn("$minus")+Ln+Bn,value:function(){this.trigger("changeScaleValue",.9*pl.scale)}}])&&jm(n.prototype,r),o&&jm(n,o),e}();function Em(t){return(Em="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})(t)}function Cm(t,e){for(var n=0;n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n
\n \n ')}},{key:Gn("$count"),value:function(){return{value:this.state.count}}},{key:Gn("$radius"),value:function(){return{value:this.state.radius}}},{key:"refresh",value:function(){this.load()}},{key:rn("$c [data-type]"),value:function(t){var e="plus"===t.$delegateTarget.attr("data-type")?1:-1;this.updateData({count:this.state.count+e}),this.refresh()}},{key:rn("$r [data-type]"),value:function(t){var e="plus"===t.$delegateTarget.attr("data-type")?.1:-.1;this.updateData({radius:this.state.radius+e}),this.refresh()}},{key:jn("$count"),value:function(){var t=+this.refs.$count.value;t<3&&(t=3),this.updateData({count:t}),this.refresh()}},{key:jn("$radius"),value:function(){var t=+this.refs.$radius.value;this.updateData({radius:t})}},{key:"updateData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setState(t,!1),this.emit(this.state.changeEvent,this.state.count,this.state.radius)}},{key:Pr("changeStarManager"),value:function(t,e){this.setState({count:t,radius:e},!1),this.refresh()}},{key:Pr("showStarManager"),value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.changeEvent=t.changeEvent||"changeStarManager",this.setState(t,!1),this.refresh(),this.$el.show()}},{key:Pr("hideStarManager"),value:function(){this.$el.hide()}},{key:Pr("hideSubEditor"),value:function(){this.trigger("hideStarManager")}}])&&Cm(n.prototype,r),o&&Cm(n,o),e}();function Dm(t){return(Dm="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})(t)}function Im(t,e){for(var n=0;n\n
\n \n \n \n
\n
\n
\n \n \n \n
\n \n ")}},{key:Gn("$mode"),value:function(){return{"data-selected-value":zm[this.state.mode]}}},{key:"refresh",value:function(){this.bindData("$mode")}},{key:rn("$flip button"),value:function(t){var e=t.$delegateTarget.attr("data-value");this.emit("changePathTransform",e)}},{key:rn("$mode button"),value:function(t){var e=t.$delegateTarget.attr("data-value");this.updateData({mode:e}),this.refresh()}},{key:"updateData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setState(t,!1),this.emit(this.state.changeEvent,this.state.mode)}},{key:Pr("changePathManager"),value:function(t){this.setState({mode:t})}},{key:Pr("showPathManager"),value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.changeEvent=t.changeEvent||"changePathManager",this.setState(t),this.$el.show(),this.emit("addStatusBarMessage",this.state.msg)}},{key:Pr("hidePathManager"),value:function(){this.$el.hide()}},{key:Pr("hideSubEditor"),value:function(){this.trigger("hidePathManager")}}])&&Im(n.prototype,r),o&&Im(n,o),e}();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})(t)}function Hm(t,e){for(var n=0;n\n
\n \n \n \n
\n \n "}},{key:rn('$el input[type="radio"]'),value:function(t){var e=t.$delegateTarget.value;this.updateData({mode:e})}},{key:"refresh",value:function(){var t=this.$el.$("[value=".concat(this.state.mode,"]"));t&&t.checked(!0)}},{key:"updateData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setState(t,!1),this.emit(this.state.changeEvent,this.state.mode)}},{key:Pr("changePolygonManager"),value:function(t){this.setState({mode:t},!1),this.refresh()}},{key:Pr("showPolygonManager"),value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.changeEvent=t.changeEvent||"changePolygonManager",this.setState(t,!1),this.refresh(),this.$el.show(),this.emit("addStatusBarMessage",this.state.msg)}},{key:Pr("hidePolygonManager"),value:function(){this.$el.hide()}},{key:Pr("hideSubEditor"),value:function(){this.trigger("hidePolygonManager")}}])&&Hm(n.prototype,r),o&&Hm(n,o),e}();function Wm(t){return(Wm="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})(t)}function Um(t,e){for(var n=0;n\n \n \n \n \n \n "}}])&&Um(n.prototype,r),o&&Um(n,o),e}();function tw(t){return(tw="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})(t)}function ew(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e\n
\n
\n \n
\n
\n \n \n \n "}},{key:Pr("toggle.fullscreen"),value:function(){this.$el.fullscreen()}},{key:un("$el")+Rn+Cn("c")+Ln,value:function(t){this.emit("copy")}},{key:un("$el")+Rn+Cn("v")+Ln,value:function(){this.emit("paste")}},{key:"isNumberKey",value:function(t){return+t.key+""===t.key}},{key:"isNotFormElement",value:function(t){var e=t.target.tagName.toLowerCase();return!1===["input"].includes(e)}},{key:un("$el")+En("isNumberKey")+En("isNotFormElement")+Ln+Bn,value:function(t){this.emit("keyup.canvas.view",t.key)}},{key:Pn("$lock")+$n+Ln+Dn(10),value:function(t){var e=t.deltaY<0?1.1:.9;this.emit("changeScaleValue",pl.scale*e)}},{key:"getScrollTop",value:function(){return this.refs.$lock?this.refs.$lock.scrollTop():0}},{key:"getScrollLeft",value:function(){return this.refs.$lock?this.refs.$lock.scrollLeft():0}},{key:"setScrollTop",value:function(t){this.refs.$lock.setScrollTop(t)}},{key:"addScrollTop",value:function(t){this.setScrollTop(this.getScrollTop()+t)}},{key:"setScrollLeft",value:function(t){this.refs.$lock.setScrollLeft(t)}},{key:"addScrollLeft",value:function(t){this.setScrollLeft(this.getScrollLeft()+t)}},{key:Pr("focusCanvasView"),value:function(){this.$el.focus()}},{key:un()+En("Backspace"),value:function(t){Ke.create(t.target).attr("contenteditable")||(pl.selection.remove(),this.emit("refreshAllSelectArtBoard"))}},{key:fn()+Ln,value:function(t){}},{key:ln()+Ln,value:function(t){var e=t.dataTransfer.getData("image/info");this.emit("drop.image.url",e)}},{key:Pr("refreshComputedStyle")+An(100),value:function(t){var e,n=(e=this.refs.$canvas).getComputedStyle.apply(e,ew(t));this.emit("refreshComputedStyleCode",n)}},{key:"scrollXY",get:function(){return{screenX:He.px(this.getScrollLeft()),screenY:He.px(this.getScrollTop())}}},{key:"screenSize",get:function(){return this.refs.$lock?this.refs.$lock.rect():{width:0,height:0}}}])&&nw(n.prototype,r),o&&nw(n,o),e}();function cw(t){return(cw="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})(t)}function uw(t,e){for(var n=0;n\n
').concat(this.getIconString(),'
\n
').concat(this.getTitle(),"
\n \n ")}},{key:"getClassName",value:function(){return""}},{key:"clickButton",value:function(t){}},{key:"getChecked",value:function(){return!1}},{key:"getTitle",value:function(){return""}},{key:"getIcon",value:function(){return""}},{key:"getIconString",value:function(){return""}},{key:"isHideTitle",value:function(){return!1}},{key:rn(),value:function(t){this.clickButton(t)}}])&&uw(n.prototype,r),o&&uw(n,o),e}();function hw(t){return(hw="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})(t)}function yw(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:"anipa"){case"anipa":return new kw(t).generateCode()}return""},Sw={makeProjectStyle:function(t){var e=t.toKeyframeString(),n=t.toRootVariableCSS();return"\n :root {\n ".concat(Y(n),"\n }\n /* keyframe */\n ").concat(e,"\n ")},makeStyle:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t.is("project"))return this.makeProjectStyle(t);var r=t.generateView("[data-id='".concat(t.id,"']"),n);return"\n ".concat(r,"\n ")+t.layers.map(function(t){return e.makeStyle(t)}).join("")},makeSvg:function(t){var e=t.toSVGString?t.toSVGString():"";return"\n ".concat(e?''.concat(e,""):"","\n ")},generate:function(){var t=pl.selection.currentProject,e=pl.selection.currentArtboard,n="\n".concat(this.makeStyle(t),"\n").concat(this.makeStyle(e,"\n left: 0px;\n top: 0px;\n")),r="\n".concat(e.html,"\n").concat(this.makeSvg(t),"\n "),o=Ow(e,"anipa");return{html:r=bc(r),css:n=bc(n),js:o=bc(o)}},generateSVG:function(t){return bc(t.generateSVG(!0))}};function jw(t){return(jw="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})(t)}function Pw(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xw(t,e){for(var n=0;n\n \n \n \n '}},{key:wn(),value:function(){var t=Sw.generate();return this.refs.$codepen.val(JSON.stringify(function(t){for(var e=1;e\n \n \n \n \n \n \n \n \n '}},{key:wn(),value:function(){this.refs.$title.val("sapa - editor.easylogic.studio"),this.refs.$description.val("https://editor.easylogic.studio");var t=Sw.generate(),e=["https://cdn.jsdelivr.net/npm/@easylogic/anipa@0.0.3/dist/main.js"].join(",");return this.refs.$html.val(t.html),this.refs.$css.val(t.css),this.refs.$resources.val(e),!1}}])&&Rw(n.prototype,r),o&&Rw(n,o),e}();function Mw(t){return(Mw="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})(t)}function Lw(t,e){for(var n=0;n1&&(pl.selection.each(function(t){t.setScreenX(pl.selection.allRect.x.value),t.width.set(pl.selection.allRect.width.value)}),pl.selection.setRectCache())}},{key:"sameHeight",value:function(){var t=pl.selection.items.length;1==t||t>1&&(pl.selection.each(function(t){t.setScreenY(pl.selection.allRect.y.value),t.height.set(pl.selection.allRect.height.value)}),pl.selection.setRectCache())}}],(n=null)&&Uw(e.prototype,n),r&&Uw(e,r),t}();function qw(t){return(qw="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})(t)}function Jw(t,e){for(var n=0;n\n
\n
\n \x3c!----\x3e\n \n \n \n \n \n \n \x3c!-- AddCylinder / --\x3e\n \x3c!-- AddSphere / --\x3e\n
\n \x3c!----\x3e\n \n \n \n \n \n \n \x3c!-- --\x3e\n
\n
\n\n \n "}},{key:Pr("noneSelectMenu"),value:function(){var t=this.refs.$items.$(".selected");t&&t.removeClass("selected")}},{key:rn("$items button"),value:function(t){t.$delegateTarget.onlyOneClass("selected")}}])&&JS(n.prototype,r),o&&JS(n,o),e}();function rj(t){return(rj="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})(t)}function oj(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ij(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"transparent";return new e({colorsteps:[new cv({color:t,percent:0,index:0}),new cv({color:t,percent:100,index:1})]})}}],(r=[{key:"getDefaultObject",value:function(){return cj(uj(e.prototype),"getDefaultObject",this).call(this,{type:"static-gradient",static:!0,colorsteps:[new cv({color:"red",percent:0,index:0}),new cv({color:"red",percent:100,index:0})]})}},{key:"toCloneObject",value:function(){return function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};return gj(mj(e.prototype),"getDefaultObject",this).call(this,pj({type:"url",url:"",datauri:""},t))}},{key:"toCloneObject",value:function(){return pj({},gj(mj(e.prototype),"toCloneObject",this).call(this),{url:this.json.url,datauri:this.json.datauri})}},{key:"isUrl",value:function(){return!0}},{key:"toString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.json;return"url(".concat(t?pl.getFile(e.url):e.url,")")}}],[{key:"parse",value:function(t){return new e({url:t.split("(")[1].split(")")[0]})}},{key:"isImageFile",value:function(t){return Oj.includes(t)}}]),e}();function jj(t){return(jj="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})(t)}function Pj(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e360?e%360:e,"deg")),"".concat(this.json.type,"(").concat(e,", ").concat(t,")")}}])&&Tj(n.prototype,r),o&&Tj(n,o),e}();function Ij(t){return(Ij="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})(t)}function Mj(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return Zj(qj(e.prototype),"getDefaultObject",this).call(this,Kj({type:"radial-gradient",radialType:"ellipse",radialPosition:[Fe.CENTER,Fe.CENTER]},t))}},{key:"toCloneObject",value:function(){return Kj({},Zj(qj(e.prototype),"toCloneObject",this).call(this),{radialType:this.json.radialType,radialPosition:L(this.json.radialPosition)})}},{key:"isRadial",value:function(){return!0}},{key:"toString",value:function(){if(0===this.colorsteps.length)return"";var t,e=this.getColorString(),n=this.json,r=n.radialType,o=n.radialPosition||["center","center"];return t=(o=tP[o]?o:o.join(" "))?"".concat(r," at ").concat(o):r,"".concat(n.type||"radial-gradient","(").concat(t,", ").concat(e,")")}}])&&Wj(n.prototype,r),o&&Wj(n,o),e}();function nP(t){return(nP="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})(t)}function rP(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return vP(bP(e.prototype),"getDefaultObject",this).call(this,hP({type:"conic-gradient",angle:0,radialPosition:[Fe.CENTER,Fe.CENTER]},t))}},{key:"toCloneObject",value:function(){return hP({},vP(bP(e.prototype),"toCloneObject",this).call(this),{angle:this.json.angle,radialPosition:L(this.json.radialPosition)})}},{key:"isConic",value:function(){return!0}},{key:"hasAngle",value:function(){return!0}},{key:"getColorString",value:function(){if(0===this.colorsteps.length)return"";var t=this.colorsteps;return t?(t.sort(function(t,e){return t.percent==e.percent?0:t.percent>e.percent?1:-1}),t.map(function(e,n){return e.prevColorStep=e.cut&&n>0?t[n-1]:null,e}).map(function(t){var e=Math.floor(3.6*t.percent),n="";if(t.cut&&t.prevColorStep){var r=Math.floor(3.6*t.prevColorStep.percent);n="".concat(r,"deg")}return"".concat(t.color," ").concat(n," ").concat(e,"deg")}).join(",")):""}},{key:"toString",value:function(){var t=this.getColorString(),e=[],n=this.json,r=n.angle,o=n.radialPosition||Fe.CENTER;o=wP[o]?o:o.join(" "),C(r)&&(r=+(kP[r]||r),e.push("from ".concat(r,"deg"))),o&&e.push("at ".concat(o));var i=e.length?e.join(" ")+",":"";return"".concat(n.type,"(").concat(i," ").concat(t,")")}}])&&yP(n.prototype,r),o&&yP(n,o),e}();function SP(t){return(SP="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})(t)}function jP(t,e){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],n={};return t.forEach(function(t){S(t.toCSS(e),function(t,e){n[t]||(n[t]=[]),n[t].push(e)})}),z(n)}},{key:"join",value:function(t){return Y(e.toPropertyCSS(t.map(function(t){return e.parse(t)})))}}],(r=[{key:"addImageResource",value:function(t){return this.clear("image-resource"),this.addItem("image-resource",t)}},{key:"addGradient",value:function(t){return this.addImageResource(t)}},{key:"setImageUrl",value:function(t){t.images&&t.images.length&&this.reset({type:"image",image:e.createImage(t.images[0])})}},{key:"setGradient",value:function(t){this.reset({type:t.type,image:e.createGradient(t,this.json.image)})}},{key:"getDefaultObject",value:function(){return IP(MP(e.prototype),"getDefaultObject",this).call(this,{itemType:"background-image",checked:!1,blendMode:"normal",size:"auto",repeat:"repeat",width:He.percent(100),height:He.percent(100),x:He.percent(0),y:He.percent(0),image:new lj})}},{key:"toCloneObject",value:function(){var t=this.json;return RP({},IP(MP(e.prototype),"toCloneObject",this).call(this),{checked:t.checked,blendMode:t.blendMode,size:t.size,repeat:t.repeat,width:t.width+"",height:t.height+"",x:t.x+"",y:t.y+"",image:t.image.clone()})}},{key:"convert",value:function(t){return t.x=He.parse(t.x),t.y=He.parse(t.y),t.width&&(t.width=He.parse(t.width)),t.height&&(t.height=He.parse(t.height)),V(t.image)&&(t.image=e.parseImage(t.image)),t}},{key:"checkField",value:function(t,n){return"repeat"===t?BP.includes(n):IP(MP(e.prototype),"checkField",this).call(this,t,n)}},{key:"toBackgroundImageCSS",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.json.image?{"background-image":this.json.image.toString(t)}:{}}},{key:"toBackgroundPositionCSS",value:function(){var t=this.json;return{"background-position":"".concat(t.x," ").concat(t.y)}}},{key:"toBackgroundSizeCSS",value:function(){var t=this.json,e="auto";return"contain"==t.size||"cover"==t.size?e=t.size:t.width.isPercent()&&t.width.isPercent()&&100==+t.width&&100==+t.height||(e="".concat(t.width," ").concat(t.height)),{"background-size":e}}},{key:"toBackgroundRepeatCSS",value:function(){return{"background-repeat":this.json.repeat}}},{key:"toBackgroundBlendCSS",value:function(){return{"background-blend-mode":this.json.blendMode}}},{key:"toCSS",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return RP({},this.toBackgroundImageCSS(t),this.toBackgroundPositionCSS(),this.toBackgroundSizeCSS(),this.toBackgroundRepeatCSS(),this.toBackgroundBlendCSS())}},{key:"toString",value:function(){return j(this.toCSS(),function(t,e){return"".concat(t,": ").concat(e)}).join(";")}},{key:"toBackgroundCSS",value:function(){var t=this.toCSS();return{background:"".concat(t["background-image"]," ")}}},{key:"image",get:function(){return this.json.image},set:function(t){this.json.image=t}}])&&AP(n.prototype,r),o&&AP(n,o),e}();function GP(t){return(GP="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})(t)}function HP(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};this.setState(t,!1),this.modifyValue(t)}},{key:"modifyValue",value:function(t){this.parent.trigger(this.props.onchange,this.props.key,t,this.state.index)}},{key:"setValue",value:function(t){this.setState(HP({},t))}},{key:Gn("$miniView"),value:function(){return{style:{"background-image":"linear-gradient(to top right, black, white)","background-repeat":this.state.repeat,"background-size":"7px 7px"}}}},{key:"template",value:function(){return"\n
\n
\n
\n
\n
\n
\n
\n ")}},{key:rn("$preview"),value:function(t){this.viewBackgroundPositionPopup()}},{key:"viewBackgroundPositionPopup",value:function(){this.emit("showBackgroundImagePositionPopup",{changeEvent:"changeBackgroundPositionPattern",data:this.state},{id:this.id})}},{key:Pr("changeBackgroundPositionPattern"),value:function(t,e){e.id===this.id&&this.updateData(HP({},t))}}])&&YP(n.prototype,r),o&&YP(n,o),e}();function ZP(t){return(ZP="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})(t)}function qP(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function JP(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.setState(t,!1),this.modifyValue(t)}},{key:"modifyValue",value:function(t){this.parent.trigger(this.props.onchange,this.props.key,t,this.state.index)}},{key:"setValue",value:function(t){this.setState(function(t){for(var e=1;e\n
\n
\n
\n
\n
\n \n ")}},{key:rn("$preview"),value:function(t){this.viewGradientPopup()}},{key:"viewGradientPopup",value:function(){this.emit("showGradientPickerPopup",{instance:this,changeEvent:"changeGradientSingle",gradient:this.state.image})}},{key:Pr("changeGradientSingle"),value:function(t,e){this.updateData({image:t}),this.refresh()}}])&&JP(n.prototype,r),o&&JP(n,o),e}();function rx(t){return(rx="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})(t)}function ox(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e\n
\n \n
\n \n
\n
\n
\n \n ")}},{key:"getColorStepList",value:function(t){switch(t.type){case"static-gradient":case"linear-gradient":case"repeating-linear-gradient":case"radial-gradient":case"repeating-radial-gradient":case"conic-gradient":case"repeating-conic-gradient":return this.getColorStepString(t.colorsteps)}return""}},{key:"getColorStepString",value:function(t){return t.map(function(t,e){return"\n
\n
\n
\n ")}).join("")}},{key:zn("$fillList"),value:function(){var t=this;return this.state.images.map(function(e,n){var r=e.image,o=lx[r.type],i=sx[r.type],a=e.selected?"selected":"";return e.selected&&(t.selectedIndex=n),"\n
\n \n \n
\n
\n
').concat(i,"
\n
\n ').concat(t.getColorStepList(r),"\n
\n
\n \n
\n
\n
\n
\n ")})}},{key:"modifyBackgroundImage",value:function(){var t=Y(FP.toPropertyCSS(this.state.images));this.parent.trigger(this.props.onchange,this.props.key,t)}},{key:Pr("add"),value:function(){this.state.images.push(new FP({image:new Dj({angle:90,colorsteps:[new cv({percent:0,color:"white",index:0}),new cv({percent:100,color:"black",index:1})]})})),this.refresh(),this.modifyBackgroundImage()}},{key:rn("$add"),value:function(){this.trigger("add")}},{key:sn("$fillList .fill-item"),value:function(t){this.startIndex=+t.$delegateTarget.attr("data-index")}},{key:fn("$fillList .fill-item")+Ln,value:function(t){}},{key:"sortItem",value:function(t,e,n){t.splice.apply(t,[n+(e1&&void 0!==arguments[1])||arguments[1]?this.refs["fillIndex".concat(t)].addClass("selected"):this.refs["fillIndex".concat(t)].removeClass("selected"),this.state.images.forEach(function(e,n){e.selected=n===t})}},{key:Pr("selectFillPopupTab"),value:function(t,e){var n=lx[t];this.refs["fillIndex".concat(this.selectedIndex)].attr("data-fill-type",n)}},{key:Pr("changePattern"),value:function(t,e,n){var r=+n;this.state.images[r].reset(e),this.modifyBackgroundImage(),this.refresh()}}])&&ix(n.prototype,r),o&&ix(n,o),e}();function px(t){return(px="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})(t)}function hx(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yx(t,e){for(var n=0;n\n
\n \n
\n ").concat(this.props.title?"":"Add","\n
\n
\n
\n \n ")}},{key:zn("$shadowList"),value:function(){var t=this.state.boxShadows.map(function(t,e){return'\n
\n
\n
\n
\n
\n
').concat(vm.check,'
\n
').concat(t.offsetX,'
\n
').concat(t.offsetY,'
\n
').concat(t.blurRadius,'
\n
').concat(t.spreadRadius,'
\n
\n \n
\n
\n ")});return t.length&&t.push('\n
\n
\n
Inset
\n\n
X
\n
Y
\n
Blur
\n
Spread
\n
\n
\n
\n '),t.join("")}},{key:Pr("refreshSelection"),value:function(){this.refresh()}},{key:"modifyBoxShadow",value:function(){var t=this.state.boxShadows.join(", ");this.parent.trigger(this.props.onchange,t)}},{key:Pr("add"),value:function(){this.state.boxShadows.push(new mx),this.refresh(),this.modifyBoxShadow()}},{key:rn("$add"),value:function(){this.trigger("add")}},{key:rn("$shadowList .remove"),value:function(t){var e=+t.$delegateTarget.attr("data-index");this.state.boxShadows.splice(e,1),this.refresh(),this.modifyBoxShadow(),this.emit("hideBoxShadowPropertyPopup")}},{key:rn("$shadowList .shadow-item.real > div:not(.tools)"),value:function(t){var e=+t.$delegateTarget.closest("shadow-item").attr("data-index"),n=this.state.boxShadows[e];this.viewShadowPopup(n,e)}},{key:"viewShadowPopup",value:function(t,e){this.selectedIndex=e,this.viewBoxShadowPropertyPopup(t)}},{key:"viewBoxShadowPropertyPopup",value:function(t){this.emit("showBoxShadowPropertyPopup",{changeEvent:"changeBoxShadowEditorPopup",color:t.color,inset:t.inset,offsetX:t.offsetX,offsetY:t.offsetY,blurRadius:t.blurRadius,spreadRadius:t.spreadRadius},{id:this.id})}},{key:Pr("changeBoxShadowEditorColor"),value:function(t){this.trigger("changeBoxShadowEditorPopup",{color:t})}},{key:Pr("changeBoxShadowEditorPopup"),value:function(t,e){if(e.id===this.id){var n=this.state.boxShadows[this.selectedIndex];n&&(n.reset(t),this.refresh(),this.modifyBoxShadow())}}}])&&kx(n.prototype,r),o&&kx(n,o),e}();function xx(t){return(xx="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})(t)}function _x(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Tx(t,e){for(var n=0;n\n ").concat(t?""):"","\n \n \n ")}},{key:"getValue",value:function(){return this.refs.$options.value}},{key:"setValue",value:function(t){this.state.value=t+"",this.refs.$options.val(this.state.value),this.refresh()}},{key:"refresh",value:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.load()}},{key:Gn("$options"),value:function(){return{"data-count":this.state.options.length.toString()}}},{key:zn("$options"),value:function(){var t=this;return this.state.options.map(function(e){var n=e;if((o=e).includes(":")){var r=_x(o.split(":"),2),o=r[0];n=r[1]}""===n?n=t.props["none-value"]?t.props["none-value"]:"":"-"===n&&(n="----------",o="");var i=o===t.state.value?"selected":"";return"")})}},{key:"setOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.setState({options:t.split(this.state.splitChar).map(function(t){return t.trim()})})}},{key:hn("$options"),value:function(){this.updateData({value:this.refs.$options.value})}},{key:"updateData",value:function(t){this.setState(t,!1),this.parent.trigger(this.props.onchange,this.props.key,this.state.value,this.props.params)}}])&&Tx(n.prototype,r),o&&Tx(n,o),e}();function Vx(t){return(Vx="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})(t)}function Ax(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Dx(t,e){for(var n=0;n"}},{key:"refresh",value:function(){this.load()}},{key:zn("$body"),value:function(){var t=this.state,e=t.min,n=t.max,r=t.step,o=t.label,i=t.calc,a=t.type,c=t.removable,u=t.layout,s=+this.state.value.value.toString();isNaN(s)&&(s=0);var l=u,f=(+s).toString();return"\n
\n ").concat(o?""):"","\n \n
\n \n
\n \n \n
\n
\n
\n
\n \n\n \n
\n
\n \n
\n ")}},{key:"getValue",value:function(){return this.state.value.clone()}},{key:"setValue",value:function(t){this.setState({value:He.parse(t)})}},{key:dn("$propertyNumber"),value:function(t){this.refs.$rangeArea.addClass("focused")}},{key:bn("$propertyNumber"),value:function(t){this.refs.$rangeArea.removeClass("focused")}},{key:rn("$toggleType"),value:function(t){var e="calc"===this.state.type?"range":"calc";r="";if("calc"===e){r=He.calc(this.refs.$calc.value);var n=r.unit;this.children.$varType.setValue(n)}else{var r=this.getRef("$propertyNumber").value,o=this.children.$unit.getValue();r=new He(r,o)}this.updateData({type:e,value:r}),this.refs.$range.attr("data-selected-type",e)}},{key:rn("$remove"),value:function(t){this.updateData({value:""})}},{key:yn("$calc"),value:function(){this.updateData({value:new He(this.refs.$calc.value,this.children.$varType.getValue())})}},{key:"updateData",value:function(t){this.setState(t,!1),this.parent.trigger(this.props.onchange,this.props.key,this.state.value,this.props.params)}},{key:"updateCalc",value:function(){this.refs.$calc.val(this.state.value)}},{key:"initValue",value:function(){""==this.state.value&&(this.state.value=new He(0,this.children.$unit.getValue()))}},{key:yn("$propertyNumber"),value:function(t){var e=+this.getRef("$propertyNumber").value;this.getRef("$property").val(e),this.initValue(),this.updateData({value:new He(e,this.children.$unit.getValue())}),this.updateCalc()}},{key:yn("$property"),value:function(t){var e=+this.getRef("$property").value;this.getRef("$propertyNumber").val(e),this.initValue(),this.updateData({value:new He(e,this.children.$unit.getValue())}),this.updateCalc()}},{key:Pr("changeUnit"),value:function(t,e){this.initValue(),this.updateData({value:this.state.value.toUnit(e)}),this.updateCalc()}},{key:Pr("changeVarType"),value:function(t,e){this.updateData({value:new He(this.refs.$calc.value,e)})}}])&&Dx(n.prototype,r),o&&Dx(n,o),e}();function zx(t,e){for(var n=0;n"}},{key:Pr("changeBorderRadius"),value:function(t,e){var n=this;"border-radius"===t&&Wx.forEach(function(t){n.children["$".concat(t)].setValue(e.clone())}),this.setBorderRadius()}},{key:zn("$body"),value:function(){var t=this,e=this.state.isAll?"all":"partitial",n=this.state["border-radius"];return'\n
\n
\n \n \n
\n
\n \n
\n
\n