@aurigma/ui-framework
Version:
A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.
7 lines • 31.1 kB
JavaScript
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[20],{858:function(t,e){t.exports='<style>\n .text {\n padding-top: 12px;\n padding-bottom: 12px;\n @apply --au-body2-font;\n color: var(--au-widget--color, --theme-text-color-1);\n --au-hem: var(--au-widget--font-size);\n }\n\n .color-picker__label {\n display: flex;\n align-items: center;\n cursor: pointer;\n outline: none;\n }\n\n .color-picker__color {\n width: 64px;\n height: 32px;\n border: 1px solid #E0E0E0;\n border-radius: 2px;\n margin-right: 12px;\n }\n\n .color-picker__text {\n font-family: var(--au-font-family);\n font-style: normal;\n font-weight: normal;\n font-size: 14px;\n line-height: 18px;\n\n color: #333333;\n }\n\n color-palette {\n position: absolute;\n z-index: 1;\n outline: none;\n }\n</style>\n<div tabindex="1" id="label" class="color-picker__label" onclick="{{togglePicker}}">\n <div class="color-picker__color" style$="background-color:{{displayColor}}"></div>\n <div class="color-picker__text">{{text}}</div>\n</div>\n\x3c!-- <color-picker id="picker" hidden="{{hiddenColor}}" color="{{color}}" name="{{text}}"></color-picker> --\x3e\n<color-palette tabindex="1" id="palette" color="{{color}}" hidden="{{hiddenColor}}" defaultColor="{{color}}"\n colors="{{colors}}">\n</color-palette>\n'},859:function(t,e,o){var n,r,i;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},l(t)}
/*!
* iro.js v4.2.2
* 2016-2019 James Daniel
* Licensed under MPL 2.0
* github.com/jaames/iro.js
*/i=function(){"use strict";var t=function(){},e={},o=[],n=[];function r(e,r){var i,l,s,a,c=arguments,p=n;for(a=arguments.length;2<a--;)o.push(c[a]);for(r&&null!=r.children&&(o.length||o.push(r.children),delete r.children);o.length;)if((l=o.pop())&&void 0!==l.pop)for(a=l.length;a--;)o.push(l[a]);else"boolean"==typeof l&&(l=null),(s="function"!=typeof e)&&(null==l?l="":"number"==typeof l?l=String(l):"string"!=typeof l&&(s=!1)),s&&i?p[p.length-1]+=l:p===n?p=[l]:p.push(l),i=s;var h=new t;return h.nodeName=e,h.children=p,h.attributes=null==r?void 0:r,h.key=null==r?void 0:r.key,h}function i(t,e){for(var o in e)t[o]=e[o];return t}function s(t,e){null!=t&&("function"==typeof t?t(e):t.current=e)}var a="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout,c=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,p=[];function h(t){!t._dirty&&(t._dirty=!0)&&1==p.push(t)&&a(d)}function d(){for(var t;t=p.pop();)t._dirty&&N(t)}function u(t,e){return t.normalizedNodeName===e||t.nodeName.toLowerCase()===e.toLowerCase()}function f(t){var e=i({},t.attributes);e.children=t.children;var o=t.nodeName.defaultProps;if(void 0!==o)for(var n in o)void 0===e[n]&&(e[n]=o[n]);return e}function v(t){var e=t.parentNode;e&&e.removeChild(t)}function g(t,e,o,n,r){if("className"===e&&(e="class"),"key"===e);else if("ref"===e)s(o,null),s(n,t);else if("class"!==e||r)if("style"===e){if(n&&"string"!=typeof n&&"string"!=typeof o||(t.style.cssText=n||""),n&&"object"==l(n)){if("string"!=typeof o)for(var i in o)i in n||(t.style[i]="");for(var i in n)t.style[i]="number"==typeof n[i]&&!1===c.test(i)?n[i]+"px":n[i]}}else if("dangerouslySetInnerHTML"===e)n&&(t.innerHTML=n.__html||"");else if("o"==e[0]&&"n"==e[1]){var a=e!==(e=e.replace(/Capture$/,""));e=e.toLowerCase().substring(2),n?o||t.addEventListener(e,b,a):t.removeEventListener(e,b,a),(t._listeners||(t._listeners={}))[e]=n}else if("list"!==e&&"type"!==e&&!r&&e in t){try{t[e]=null==n?"":n}catch(t){}null!=n&&!1!==n||"spellcheck"==e||t.removeAttribute(e)}else{var p=r&&e!==(e=e.replace(/^xlink:?/,""));null==n||!1===n?p?t.removeAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase()):t.removeAttribute(e):"function"!=typeof n&&(p?t.setAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase(),n):t.setAttribute(e,n))}else t.className=n||""}function b(t){return this._listeners[t.type](t)}var y=[],_=0,m=!1,x=!1;function w(){for(var t;t=y.shift();)t.componentDidMount&&t.componentDidMount()}function k(t,e,o,n,r,i){_++||(m=null!=r&&void 0!==r.ownerSVGElement,x=null!=t&&!("__preactattr_"in t));var l=C(t,e,o,n,i);return r&&l.parentNode!==r&&r.appendChild(l),--_||(x=!1,i||w()),l}function C(t,e,o,n,r){var i=t,l=m;if(null!=e&&"boolean"!=typeof e||(e=""),"string"==typeof e||"number"==typeof e)return t&&void 0!==t.splitText&&t.parentNode&&(!t._component||r)?t.nodeValue!=e&&(t.nodeValue=e):(i=document.createTextNode(e),t&&(t.parentNode&&t.parentNode.replaceChild(i,t),O(t,!0))),i.__preactattr_=!0,i;var s,a,c=e.nodeName;if("function"==typeof c)return function(t,e,o,n){for(var r=t&&t._component,i=r,l=t,s=r&&t._componentConstructor===e.nodeName,a=s,c=f(e);r&&!a&&(r=r._parentComponent);)a=r.constructor===e.nodeName;return r&&a&&(!n||r._component)?(E(r,c,3,o,n),t=r.base):(i&&!s&&(H(i),t=l=null),r=P(e.nodeName,c,o),t&&!r.nextBase&&(r.nextBase=t,l=null),E(r,c,1,o,n),t=r.base,l&&t!==l&&(l._component=null,O(l,!1))),t}(t,e,o,n);if(m="svg"===c||"foreignObject"!==c&&m,c=String(c),(!t||!u(t,c))&&(s=c,(a=m?document.createElementNS("http://www.w3.org/2000/svg",s):document.createElement(s)).normalizedNodeName=s,i=a,t)){for(;t.firstChild;)i.appendChild(t.firstChild);t.parentNode&&t.parentNode.replaceChild(i,t),O(t,!0)}var p=i.firstChild,h=i.__preactattr_,d=e.children;if(null==h){h=i.__preactattr_={};for(var b=i.attributes,y=b.length;y--;)h[b[y].name]=b[y].value}return!x&&d&&1===d.length&&"string"==typeof d[0]&&null!=p&&void 0!==p.splitText&&null==p.nextSibling?p.nodeValue!=d[0]&&(p.nodeValue=d[0]):(d&&d.length||null!=p)&&function(t,e,o,n,r){var i,l,s,a,c,p,h,d,f=t.childNodes,g=[],b={},y=0,_=0,m=f.length,x=0,w=e?e.length:0;if(0!==m)for(var k=0;k<m;k++){var j=f[k],S=j.__preactattr_;null!=(P=w&&S?j._component?j._component.__key:S.key:null)?(y++,b[P]=j):(S||(void 0!==j.splitText?!r||j.nodeValue.trim():r))&&(g[x++]=j)}if(0!==w)for(k=0;k<w;k++){var P;if(c=null,null!=(P=(a=e[k]).key))y&&void 0!==b[P]&&(c=b[P],b[P]=void 0,y--);else if(_<x)for(i=_;i<x;i++)if(void 0!==g[i]&&(p=l=g[i],d=r,"string"==typeof(h=a)||"number"==typeof h?void 0!==p.splitText:"string"==typeof h.nodeName?!p._componentConstructor&&u(p,h.nodeName):d||p._componentConstructor===h.nodeName)){c=l,g[i]=void 0,i===x-1&&x--,i===_&&_++;break}c=C(c,a,o,n),s=f[k],c&&c!==t&&c!==s&&(null==s?t.appendChild(c):c===s.nextSibling?v(s):t.insertBefore(c,s))}if(y)for(var k in b)void 0!==b[k]&&O(b[k],!1);for(;_<=x;)void 0!==(c=g[x--])&&O(c,!1)}(i,d,o,n,x||null!=h.dangerouslySetInnerHTML),function(t,e,o){var n;for(n in o)e&&null!=e[n]||null==o[n]||g(t,n,o[n],o[n]=void 0,m);for(n in e)"children"===n||"innerHTML"===n||n in o&&e[n]===("value"===n||"checked"===n?t[n]:o[n])||g(t,n,o[n],o[n]=e[n],m)}(i,e.attributes,h),m=l,i}function O(t,e){var o=t._component;o?H(o):(null!=t.__preactattr_&&s(t.__preactattr_.ref,null),!1!==e&&null!=t.__preactattr_||v(t),j(t))}function j(t){for(t=t.lastChild;t;){var e=t.previousSibling;O(t,!0),t=e}}var S=[];function P(t,e,o){var n,r=S.length;for(t.prototype&&t.prototype.render?(n=new t(e,o),T.call(n,e,o)):((n=new T(e,o)).constructor=t,n.render=M);r--;)if(S[r].constructor===t)return n.nextBase=S[r].nextBase,S.splice(r,1),n;return n}function M(t,e,o){return this.constructor(t,o)}function E(t,o,n,r,i){t._disable||(t._disable=!0,t.__ref=o.ref,t.__key=o.key,delete o.ref,delete o.key,void 0===t.constructor.getDerivedStateFromProps&&(!t.base||i?t.componentWillMount&&t.componentWillMount():t.componentWillReceiveProps&&t.componentWillReceiveProps(o,r)),r&&r!==t.context&&(t.prevContext||(t.prevContext=t.context),t.context=r),t.prevProps||(t.prevProps=t.props),t.props=o,t._disable=!1,0!==n&&(1!==n&&!1===e.syncComponentUpdates&&t.base?h(t):N(t,1,i)),s(t.__ref,t))}function N(t,e,o,n){if(!t._disable){var r,l,s,a=t.props,c=t.state,p=t.context,h=t.prevProps||a,d=t.prevState||c,u=t.prevContext||p,v=t.base,g=t.nextBase,b=v||g,m=t._component,x=!1,C=u;if(t.constructor.getDerivedStateFromProps&&(c=i(i({},c),t.constructor.getDerivedStateFromProps(a,c)),t.state=c),v&&(t.props=h,t.state=d,t.context=u,2!==e&&t.shouldComponentUpdate&&!1===t.shouldComponentUpdate(a,c,p)?x=!0:t.componentWillUpdate&&t.componentWillUpdate(a,c,p),t.props=a,t.state=c,t.context=p),t.prevProps=t.prevState=t.prevContext=t.nextBase=null,t._dirty=!1,!x){r=t.render(a,c,p),t.getChildContext&&(p=i(i({},p),t.getChildContext())),v&&t.getSnapshotBeforeUpdate&&(C=t.getSnapshotBeforeUpdate(h,d));var j,S,M=r&&r.nodeName;if("function"==typeof M){var T=f(r);(l=m)&&l.constructor===M&&T.key==l.__key?E(l,T,1,p,!1):(j=l,t._component=l=P(M,T,p),l.nextBase=l.nextBase||g,l._parentComponent=t,E(l,T,0,p,!1),N(l,1,o,!0)),S=l.base}else s=b,(j=m)&&(s=t._component=null),(b||1===e)&&(s&&(s._component=null),S=k(s,r,p,o||!v,b&&b.parentNode,!0));if(b&&S!==b&&l!==m){var F=b.parentNode;F&&S!==F&&(F.replaceChild(S,b),j||(b._component=null,O(b,!1)))}if(j&&H(j),(t.base=S)&&!n){for(var R=t,A=t;A=A._parentComponent;)(R=A).base=S;S._component=R,S._componentConstructor=R.constructor}}for(!v||o?y.push(t):x||t.componentDidUpdate&&t.componentDidUpdate(h,d,C);t._renderCallbacks.length;)t._renderCallbacks.pop().call(t);_||n||w()}}function H(t){var e=t.base;t._disable=!0,t.componentWillUnmount&&t.componentWillUnmount(),t.base=null;var o=t._component;o?H(o):e&&(null!=e.__preactattr_&&s(e.__preactattr_.ref,null),v(t.nextBase=e),S.push(t),j(e)),s(t.__ref,null)}function T(t,e){this._dirty=!0,this.context=e,this.props=t,this.state=this.state||{},this._renderCallbacks=[]}function F(t,e,o,n){void 0===n&&(n={});for(var r=0;r<e.length;r++)t.addEventListener(e[r],o,n)}function R(t,e,o,n){void 0===n&&(n={});for(var r=0;r<e.length;r++)t.removeEventListener(e[r],o,n)}i(T.prototype,{setState:function(t,e){this.prevState||(this.prevState=this.state),this.state=i(i({},this.state),"function"==typeof t?t(this.state,this.props):t),e&&this._renderCallbacks.push(e),h(this)},forceUpdate:function(t){t&&this._renderCallbacks.push(t),N(this,2)},render:function(){}});var A="mousedown",D="mousemove",L="mouseup",I="touchstart",U="touchmove",W="touchend",B=function(t){function e(e){t.call(this,e),this.uid=(Math.random()+1).toString(36).substring(5)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.componentDidMount=function(){F(this.base,[A,I],this,{passive:!1})},e.prototype.componentWillUnmount=function(){R(this.base,[A,I],this)},e.prototype.handleEvent=function(t){t.preventDefault();var e=t.touches?t.changedTouches[0]:t,o=e.clientX,n=e.clientY,r=this.base.getBoundingClientRect();switch(t.type){case A:case I:F(document,[D,U,L,W],this,{passive:!1}),this.handleInput(o,n,r,"START");break;case D:case U:this.handleInput(o,n,r,"MOVE");break;case L:case W:this.handleInput(o,n,r,"END"),R(document,[D,U,L,W],this,{passive:!1})}},e}(T);function V(t){var e=window.navigator.userAgent,o=/^((?!chrome|android).)*safari/i.test(e),n=/iPhone|iPod|iPad/i.test(e),r=window.location;return o||n?r.protocol+"//"+r.host+r.pathname+r.search+t:t}function $(t,e,o,n,r){var i=r-n<=180?0:1;return n*=Math.PI/180,r*=Math.PI/180,"M "+(t+o*Math.cos(r))+" "+(e+o*Math.sin(r))+" A "+o+" "+o+" 0 "+i+" 0 "+(t+o*Math.cos(n))+" "+(e+o*Math.sin(n))}function z(t){var e=t.r,o=t.url;return r("svg",{class:"iro__handle",x:t.x,y:t.y,style:{overflow:"visible"}},o&&r("use",Object.assign({},{xlinkHref:V(o)},t.origin)),!o&&r("circle",{class:"iro__handle__inner",r:e,fill:"none","stroke-width":2,stroke:"#000"}),!o&&r("circle",{class:"iro__handle__outer",r:e-2,fill:"none","stroke-width":2,stroke:"#fff"}))}z.defaultProps={x:0,y:0,r:8,url:null,origin:{x:0,y:0}};var G=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.render=function(t){var e=t.width,o=t.borderWidth,n=t.handleRadius,i=t.color.hsv,l=e/2-o,s=(360-i.h)*(Math.PI/180),a=i.s/100*(l-t.padding-n-o),c=l+o,p=l+o;return r("svg",{class:"iro__wheel",width:e,height:e,style:{overflow:"visible",display:"block"}},r("defs",null,r("radialGradient",{id:this.uid},r("stop",{offset:"0%","stop-color":"#fff"}),r("stop",{offset:"100%","stop-color":"#fff","stop-opacity":"0"}))),r("g",{class:"iro__wheel__hue","stroke-width":l,fill:"none"},Array.apply(null,{length:360}).map((function(t,e){return r("path",{key:e,d:$(c,p,l/2,e,e+1.5),stroke:"hsl("+(360-e)+", 100%, 50%)"})}))),r("circle",{class:"iro__wheel__saturation",cx:c,cy:p,r:l,fill:"url("+V("#"+this.uid)+")"}),t.wheelLightness&&r("circle",{class:"iro__wheel__lightness",cx:c,cy:p,r:l,fill:"#000",opacity:1-i.v/100}),r("circle",{class:"iro__wheel__border",cx:c,cy:p,r:l,fill:"none",stroke:t.borderColor,"stroke-width":o}),r(z,{r:n,url:t.handleSvg,origin:t.handleOrigin,x:c+a*Math.cos(s),y:p+a*Math.sin(s)}))},e.prototype.handleInput=function(t,e,o,n){var r=o.left,i=o.top,l=this.props,s=l.width/2,a=s-l.padding-l.handleRadius-l.borderWidth;t=s-(t-r),e=s-(e-i);var c=Math.atan2(e,t),p=360-(Math.round(c*(180/Math.PI))+180),h=Math.min(Math.sqrt(t*t+e*e),a);l.onInput(n,{h:p,s:Math.round(100/a*h)})},e}(B);function q(t,e){var o=-1<t.indexOf("%"),n=parseFloat(t);return o?e/100*n:n}function J(t){return parseInt(t,16)}function X(t){return t.toString(16).padStart(2,"0")}var Y="(?:[-\\+]?\\d+%?)|(?:[-\\+]?\\d*\\.\\d+%?)",K="[\\s|\\(]+("+Y+")[,|\\s]+("+Y+")[,|\\s]+("+Y+")\\s*\\)?",Q="[\\s|\\(]+("+Y+")[,|\\s]+("+Y+")[,|\\s]+("+Y+")[,|\\s]+("+Y+")\\s*\\)?",Z=new RegExp("rgb"+K),tt=new RegExp("rgba"+Q),et=new RegExp("hsl"+K),ot=new RegExp("hsla"+Q),nt="^(?:#?|0x?)",rt="([0-9a-fA-F]{1})",it="([0-9a-fA-F]{2})",lt=new RegExp(""+nt+rt+rt+rt+"$"),st=new RegExp(""+nt+rt+rt+rt+rt+"$"),at=new RegExp(""+nt+it+it+it+"$"),ct=new RegExp(""+nt+it+it+it+it+"$"),pt=function(t){this._onChange=!1,this._value={h:0,s:0,v:0,a:1},t&&this.set(t)},ht={hsv:{configurable:!0},rgb:{configurable:!0},hsl:{configurable:!0},rgbString:{configurable:!0},hexString:{configurable:!0},hslString:{configurable:!0}};pt.prototype.set=function(t){var e="string"==typeof t,o="object"==l(t);if(e&&/^(?:#?|0x?)[0-9a-fA-F]{3,8}$/.test(t))this.hexString=t;else if(e&&/^rgba?/.test(t))this.rgbString=t;else if(e&&/^hsla?/.test(t))this.hslString=t;else if(o&&t instanceof pt)this.hsv=t.hsv;else if(o&&"r"in t&&"g"in t&&"b"in t)this.rgb=t;else if(o&&"h"in t&&"s"in t&&"v"in t)this.hsv=t;else{if(!(o&&"h"in t&&"s"in t&&"l"in t))throw new Error("invalid color value");this.hsl=t}},pt.prototype.setChannel=function(t,e,o){var n;this[t]=Object.assign({},this[t],((n={})[e]=o,n))},pt.prototype.clone=function(){return new pt(this)},pt.hsvToRgb=function(t){var e=t.h/60,o=t.s/100,n=t.v/100,r=Math.floor(e),i=e-r,l=n*(1-o),s=n*(1-i*o),a=n*(1-(1-i)*o),c=r%6;return{r:255*[n,s,l,l,a,n][c],g:255*[a,n,n,s,l,l][c],b:255*[l,l,a,n,n,s][c]}},pt.rgbToHsv=function(t){var e,o=t.r/255,n=t.g/255,r=t.b/255,i=Math.max(o,n,r),l=Math.min(o,n,r),s=i-l,a=i,c=0===i?0:s/i;switch(i){case l:e=0;break;case o:e=(n-r)/s+(n<r?6:0);break;case n:e=(r-o)/s+2;break;case r:e=(o-n)/s+4}return{h:60*e,s:100*c,v:100*a}},pt.hsvToHsl=function(t){var e=t.s/100,o=t.v/100,n=(2-e)*o,r=n<=1?n:2-n,i=r<1e-9?0:e*o/r;return{h:t.h,s:100*i,l:50*n}},pt.hslToHsv=function(t){var e=2*t.l,o=t.s*(e<=100?e:200-e)/100,n=e+o<1e-9?0:2*o/(e+o);return{h:t.h,s:100*n,v:(e+o)/2}},ht.hsv.get=function(){var t=this._value;return{h:t.h,s:t.s,v:t.v,a:t.a}},ht.hsv.set=function(t){if(this._onChange){var e=this._value;t=Object.assign({},e,t);var o={};for(var n in e)o[n]=t[n]!=e[n];this._value=t,(o.h||o.s||o.v||o.a)&&this._onChange(this,o)}else this._value=t},ht.rgb.get=function(){var t=pt.hsvToRgb(this._value),e=t.r,o=t.g,n=t.b;return{r:Math.round(e),g:Math.round(o),b:Math.round(n)}},ht.rgb.set=function(t){this.hsv=pt.rgbToHsv(t)},ht.hsl.get=function(){var t=pt.hsvToHsl(this._value),e=t.h,o=t.s,n=t.l;return{h:Math.round(e),s:Math.round(o),l:Math.round(n)}},ht.hsl.set=function(t){this.hsv=pt.hslToHsv(t)},ht.rgbString.get=function(){var t=this.rgb;return"rgb("+t.r+", "+t.g+", "+t.b+")"},ht.rgbString.set=function(t){var e,o,n,r,i=1;if((e=Z.exec(t))?(o=q(e[1],255),n=q(e[2],255),r=q(e[3],255)):(e=tt.exec(t))&&(o=q(e[1],255),n=q(e[2],255),r=q(e[3],255),i=q(e[4],1)),!e)throw new Error("invalid rgb string");this.rgb={r:o,g:n,b:r,a:i}},ht.hexString.get=function(){var t=this.rgb;return"#"+X(t.r)+X(t.g)+X(t.b)},ht.hexString.set=function(t){var e,o,n,r,i=255;if((e=lt.exec(t))?(o=17*J(e[1]),n=17*J(e[2]),r=17*J(e[3])):(e=st.exec(t))?(o=17*J(e[1]),n=17*J(e[2]),r=17*J(e[3]),i=17*J(e[4])):(e=at.exec(t))?(o=J(e[1]),n=J(e[2]),r=J(e[3])):(e=ct.exec(t))&&(o=J(e[1]),n=J(e[2]),r=J(e[3]),i=J(e[4])),!e)throw new Error("invalid hex string");this.rgb={r:o,g:n,b:r,a:i/255}},ht.hslString.get=function(){var t=this.hsl;return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},ht.hslString.set=function(t){var e,o,n,r,i=1;if((e=et.exec(t))?(o=q(e[1],360),n=q(e[2],100),r=q(e[3],100)):(e=ot.exec(t))&&(o=q(e[1],360),n=q(e[2],100),r=q(e[3],100),i=q(e[4],1)),!e)throw new Error("invalid hsl string");this.hsl={h:o,s:n,l:r,a:i}},Object.defineProperties(pt.prototype,ht);var dt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.renderGradient=function(t){var e=t.color.hsv,o=[];switch(t.sliderType){case"hue":o=[{offset:"0",color:"#f00"},{offset:"16.666",color:"#ff0"},{offset:"33.333",color:"#0f0"},{offset:"50",color:"#0ff"},{offset:"66.666",color:"#00f"},{offset:"83.333",color:"#f0f"},{offset:"100",color:"#f00"}];break;case"saturation":var n=pt.hsvToHsl({h:e.h,s:0,v:e.v}),i=pt.hsvToHsl({h:e.h,s:100,v:e.v});o=[{offset:"0",color:"hsl("+n.h+", "+n.s+"%, "+n.l+"%)"},{offset:"100",color:"hsl("+i.h+", "+i.s+"%, "+i.l+"%)"}];break;default:var l=pt.hsvToHsl({h:e.h,s:e.s,v:100});o=[{offset:"0",color:"#000"},{offset:"100",color:"hsl("+l.h+", "+l.s+"%, "+l.l+"%)"}]}return r("linearGradient",{id:this.uid},o.map((function(t){return r("stop",{offset:t.offset+"%","stop-color":t.color})})))},e.prototype.render=function(t){var e=t.width,o=t.sliderHeight,n=t.borderWidth,i=t.handleRadius;o=o||2*t.padding+2*i+2*n,this.width=e;var l,s=(this.height=o)/2,a=e-2*s,c=t.color.hsv;switch(t.sliderType){case"hue":l=c.h/=3.6;break;case"saturation":l=c.s;break;default:l=c.v}return r("svg",{class:"iro__slider",width:e,height:o,style:{marginTop:t.sliderMargin,overflow:"visible",display:"block"}},r("defs",null,this.renderGradient(t)),r("rect",{class:"iro__slider__value",rx:s,ry:s,x:n/2,y:n/2,width:e-n,height:o-n,"stroke-width":n,stroke:t.borderColor,fill:"url("+V("#"+this.uid)+")"}),r(z,{r:i,url:t.handleSvg,origin:t.handleOrigin,x:s+l/100*a,y:o/2}))},e.prototype.getValueFromPoint=function(t,e,o){var n=o.left,r=this.width-this.height;t-=n+this.height/2;var i=Math.max(Math.min(t,r),0);return Math.round(100/r*i)},e.prototype.handleInput=function(t,e,o,n){var r,i,l=this.getValueFromPoint(t,e,o);switch(this.props.sliderType){case"hue":i="h",l*=3.6;break;case"saturation":i="s";break;default:i="v"}this.props.onInput(n,((r={})[i]=l,r))},e}(B),ut=function(t){function e(e){t.call(this,e),this.emitHook("init:before"),this._events={},this._mounted=!1,this._colorChangeActive=!1,this.color=new pt,this.color._onChange=this.updateColor.bind(this),this.state=Object.assign({},e,{color:this.color}),this.color.set(e.color),this.emitHook("init:state"),e.layout?this.layout=e.layout:this.layout=[{component:G,options:{}},{component:dt,options:{}}],this.emitHook("init:after")}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.on=function(t,e){var o=this._events;this.emitHook("event:on",t,e),(o[t]||(o[t]=[])).push(e),"mount"===t&&this._mounted&&this.emit("mount",this),"color:change"===t&&this._mounted&&this.emit("color:change",this.color,{h:!1,s:!1,v:!1,a:!1})},e.prototype.off=function(t,e){var o=this._events[t];this.emitHook("event:off",t,e),o&&o.splice(o.indexOf(e),1)},e.prototype.emit=function(t){for(var e,o=[],n=arguments.length-1;0<n--;)o[n]=arguments[n+1];(e=this).emitHook.apply(e,[t].concat(o));for(var r=this._events[t]||[],i=0;i<r.length;i++)r[i].apply(null,o)},e.prototype.resize=function(t){this.setState({width:t})},e.prototype.reset=function(){this.color.set(this.props.color)},e.addHook=function(t,o){var n=e.pluginHooks;(n[t]||(n[t]=[])).push(o)},e.prototype.emitHook=function(t){for(var o=[],n=arguments.length-1;0<n--;)o[n]=arguments[n+1];for(var r=e.pluginHooks[t]||[],i=0;i<r.length;i++)r[i].apply(this,o)},e.prototype.onMount=function(t){this.el=t,this._mounted=!0,this.emit("mount",this),this.emit("color:change",this.color,{h:!1,s:!1,v:!1,a:!1})},e.prototype.updateColor=function(t,e){this.emitHook("color:beforeUpdate",t,e),this.setState({color:t}),this.emitHook("color:afterUpdate",t,e),this._colorChangeActive||(this._colorChangeActive=!0,this.emit("color:change",t,e),this._colorChangeActive=!1)},e.prototype.handleInput=function(t,e){"START"===t&&this.emit("input:start",this.color),"MOVE"===t&&this.emit("input:mode",this.color),this.color.hsv=e,"END"===t&&this.emit("input:end",this.color)},e.prototype.render=function(t,e){var o=this;return r("div",{class:"iro__colorPicker",style:{display:e.display,width:e.width}},this.layout.map((function(t){var n=t.component,i=t.options;return r(n,Object.assign({},e,i,{onInput:function(t,e){return o.handleInput(t,e)},parent:o}))})))},e}(T);ut.pluginHooks={},ut.defaultProps={width:300,height:300,handleRadius:8,handleSvg:null,handleOrigin:{x:0,y:0},color:"#fff",borderColor:"#fff",borderWidth:0,display:"block",wheelLightness:!0,sliderHeight:null,sliderMargin:12,padding:6,layout:null};var ft,vt,gt,bt,yt=((vt=function(t,e){var o,n=null,i=document.createElement("div");return k(void 0,r(ft,Object.assign({},{ref:function(t){return n=t}},e)),{},!1,i,!1),o=function(){var e=t instanceof Element?t:document.querySelector(t);e.appendChild(n.base),n.onMount(e)},"loading"!==document.readyState?o():F(document,["DOMContentLoaded"],o),n}).prototype=(ft=ut).prototype,Object.assign(vt,ft),vt.__component=ft,vt);return bt=[],(gt={Color:pt,ColorPicker:yt,ui:{h:r,Component:B,Handle:z,Slider:dt,Wheel:G},util:{resolveUrl:V,createArcPath:$,parseUnit:q,parseHexInt:J,intToHex:X},version:"4.2.2"}).use=function(t,e){void 0===e&&(e={}),-1<bt.indexOf(t)||(t(gt,e),bt.push(t))},gt.installedPlugins=bt,gt},"object"==l(e)&&void 0!==t?t.exports=i():void 0===(r="function"==typeof(n=i)?n.call(e,o,e,t):n)||(t.exports=r)},931:function(t,e,o){"use strict";o.r(e),o.d(e,"AuWidgetColorPicker",(function(){return f})),o.d(e,"widget",(function(){return f}));var n,r,i,l,s,a=o(0),c=o(858),p=o(160),h=o(2),d=o(47),u=o(859),f=(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hidden=!0,e.color="#ffffff",e}Object(a.d)(e,t),Object.defineProperty(e,"styles",{get:function(){return Object(d.b)(n||(n=Object(a.f)(["\n .hidden { \n display:none !important;\n }\n "],["\n .hidden { \n display:none !important;\n }\n "])))},enumerable:!1,configurable:!0}),e.prototype.render=function(){return Object(d.d)(r||(r=Object(a.f)(['\n <div class="','">\n <div id="color-picker-container"></div>\n </div>\n '],['\n <div class="','">\n <div id="color-picker-container"></div>\n </div>\n '])),this.hidden?"hidden":"")},e.prototype.updated=function(t){this.colorPicker.color.hex=t.color},e.prototype.firstUpdated=function(){var t=this;this.colorPicker=u.ColorPicker(this.shadowRoot.querySelector("#color-picker-container"),{width:200,color:"#f00"}),this.colorPicker.on("color:change",(function(e,o){t.color=e.hexString}))},Object(a.c)([Object(d.e)(),Object(a.g)("design:type",Boolean)],e.prototype,"hidden",void 0),Object(a.c)([Object(d.e)(),Object(a.g)("design:type",String)],e.prototype,"color",void 0),e=Object(a.c)([Object(d.c)("color-picker")],e)}(d.a),function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="World",e.hidden=!0,e.defaultColor="#ffffff",e.handleChange=function(t){e.color=t;var o=new CustomEvent("change-color",{detail:e.color});e.dispatchEvent(o)},e}Object(a.d)(e,t),Object.defineProperty(e,"styles",{get:function(){return Object(d.b)(i||(i=Object(a.f)(["\n .color-palette__div {\n padding: 20px;\n display: flex;\n flex-wrap: wrap;\n background: #FFFFFF;\n box-shadow: 0px 4px 24px rgba(0, 0, 0, 0.2);\n border-radius: 2px;\n }\n \n .color-palette--hidden { \n display: none;\n }\n \n .color-palette__label {\n margin-right: 12px;\n margin-bottom: 12px;\n position: relative;\n width:32px;\n height: 32px;\n }\n .color-palette__label input {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n width: 100%;\n height: 100%;\n }\n .color-palette__radio {\n padding: 2px;\n box-shadow: 0 0 0 1px #DCDEDF;\n width: 100%;\n height: 100%;\n border-radius: 2px;\n }\n input:checked ~ .color-palette__radio {\n padding: 2px;\n box-shadow: 0 0 0 2px var(--theme-primary-color);\n }\n .color-palette__color {\n width: 100%;\n height: 100%;\n }\n "],["\n .color-palette__div {\n padding: 20px;\n display: flex;\n flex-wrap: wrap;\n background: #FFFFFF;\n box-shadow: 0px 4px 24px rgba(0, 0, 0, 0.2);\n border-radius: 2px;\n }\n \n .color-palette--hidden { \n display: none;\n }\n \n .color-palette__label {\n margin-right: 12px;\n margin-bottom: 12px;\n position: relative;\n width:32px;\n height: 32px;\n }\n .color-palette__label input {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n width: 100%;\n height: 100%;\n }\n .color-palette__radio {\n padding: 2px;\n box-shadow: 0 0 0 1px #DCDEDF;\n width: 100%;\n height: 100%;\n border-radius: 2px;\n }\n input:checked ~ .color-palette__radio {\n padding: 2px;\n box-shadow: 0 0 0 2px var(--theme-primary-color);\n }\n .color-palette__color {\n width: 100%;\n height: 100%;\n }\n "])))},enumerable:!1,configurable:!0}),e.prototype.render=function(){var t=this;return Object(d.d)(s||(s=Object(a.f)(['\n <div class="color-palette__div color-palette--','">\n ',"\n </div>\n "],['\n <div class="color-palette__div color-palette--','">\n ',"\n </div>\n "])),this.hidden?"hidden":"",this.colors.map((function(e,o){return Object(d.d)(l||(l=Object(a.f)(['\n <label for="color" class="color-palette__label">\n <input type="radio" name="color" @change="','" />\n <div class="color-palette__radio">\n <div class="color-palette__color" style="background-color:',';"></div>\n </div>\n </label>'],['\n <label for="color" class="color-palette__label">\n <input type="radio" name="color" @change="','" />\n <div class="color-palette__radio">\n <div class="color-palette__color" style="background-color:',';"></div>\n </div>\n </label>'])),(function(){return t.handleChange(e)}),e.displayColor)})))},Object(a.c)([Object(d.e)(),Object(a.g)("design:type",String)],e.prototype,"name",void 0),Object(a.c)([Object(d.e)(),Object(a.g)("design:type",Boolean)],e.prototype,"hidden",void 0),Object(a.c)([Object(d.e)(),Object(a.g)("design:type",String)],e.prototype,"defaultColor",void 0),Object(a.c)([Object(d.e)(),Object(a.g)("design:type",Array)],e.prototype,"colors",void 0),Object(a.c)([Object(d.e)(),Object(a.g)("design:type",Object)],e.prototype,"color",void 0),e=Object(a.c)([Object(d.c)("color-palette")],e)}(d.a),function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.text="Primary color",e.hiddenColor=!0,e.displayColor="#ffffff",e._isRestoring=!1,e.colors=[],e}return Object(a.d)(e,t),e.prototype.colorChanged=function(){this._isRestoring||this.emitChange({value:this.color})},Object.defineProperty(e.prototype,"_",{get:function(){return this.color},enumerable:!1,configurable:!0}),e.prototype.clearSelection=function(){this.color=!1},e.prototype.connectedCallback=function(){t.prototype.connectedCallback.call(this),this.togglePicker=this.togglePicker.bind(this),this.initEvents()},e.prototype.updateParams=function(t){this.text=t.text,this.colors=t.colors;var e=this.colors.find((function(t){return t.preselected}));!e||this.defaultColor&&JSON.stringify(this.defaultColor.value)===JSON.stringify(e.value)||(this.defaultColor=e||this.colors[0],this.color=this.defaultColor),this.color&&(this.displayColor=this.color.displayColor)},e.prototype.exportWidgetData=function(t){return Object(a.b)(this,void 0,void 0,(function(){return Object(a.e)(this,(function(t){return[2,{color:this.color}]}))}))},e.prototype.restoreWidgetFromData=function(t,e){return Object(a.b)(this,void 0,void 0,(function(){return Object(a.e)(this,(function(e){return t&&t.color&&this.displayColor!==t.color.displayColor&&(this._isRestoring=!0,this.color=t.color,this.displayColor=this.color.displayColor),this._isRestoring=!1,[2]}))}))},e.prototype.initEvents=function(){var t=this;this.$.palette.addEventListener("change-color",(function(e){return t.changeColor(e)})),this.$.palette.addEventListener("blur",(function(e){return t.closePicker()})),this.addEventListener("blur",(function(e){return t.closePicker()}))},e.prototype.togglePicker=function(){this.hiddenColor=!this.hiddenColor},e.prototype.closePicker=function(){this.hiddenColor=!0},e.prototype.changeColor=function(t){this.color=t.detail,this.displayColor=this.color.displayColor},Object(a.c)([Object(h.c)(),Object(a.g)("design:type",Object)],e.prototype,"params",void 0),Object(a.c)([Object(h.c)(),Object(a.g)("design:type",String)],e.prototype,"text",void 0),Object(a.c)([Object(h.c)(),Object(a.g)("design:type",Object)],e.prototype,"color",void 0),Object(a.c)([Object(h.b)("color"),Object(a.g)("design:type",Function),Object(a.g)("design:paramtypes",[]),Object(a.g)("design:returntype",void 0)],e.prototype,"colorChanged",null),Object(a.c)([Object(h.c)(),Object(a.g)("design:type",Array)],e.prototype,"colors",void 0),Object(a.c)([Object(h.a)("au-widget-color-picker",c)],e)}(p.b))}}]);