jodit-pro
Version:
PRO Version of Jodit Editor
19 lines • 77.2 kB
JavaScript
/*!
* jodit-pro - PRO Version of Jodit Editor
* Author: Chupurnov Valerii <chupurnov@gmail.com>
* Version: v4.9.27
* Url: https://xdsoft.net/jodit/pro/
* License(s): SEE LICENSE IN LICENSE.md
*/
!function(t,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o();else if("function"==typeof define&&define.amd)define([],o);else{var i=o();for(var a in i)("object"==typeof exports?exports:t)[a]=i[a]}}(self,function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[946],{482:function(t,o,i){"use strict";i.r(o),i.d(o,{googleMaps:function(){return C}});var a=i(82749),r=i(31635);i(55029),i(99413);var s=i(17298),n=i(61818),l=i(67912),c=i(92931),p=i(65805),h=i(4774),u=i(82758),d=i(65478),g=i(21537),m=i(50911),f=i(62843),y=i(78584),v=i(92762),b=i(2692);window.JoditGoogleReadyHandler=l.GoogleReadyHandler;class C extends m.Plugin{className(){return"google-maps"}afterInit(t){t.registerCommand(s.COMMAND_OPEN_DIALOG,()=>{this.openMapEditor(null,{})})}beforeDestruct(t){}onOpenOnDblClick(t){if(t.dataset.googleMaps){let o;try{o=JSON.parse(this.j.ow.atob(t.dataset.googleMaps))}catch{}return this.openMapEditor(t,o),!1}}async openMapEditor(t,o){let i=this.j,a=this.getDialog(),r=this.j.o.googleMaps.saveStateInStorage?a.storage.get(s.STORAGE_KEY):void 0,{apiUrl:n}=this.jodit.o.googleMaps;(0,l.isApiAvailable)()||(0,g.appendScriptAsync)(this.jodit,n.replace(/\${([^}]+)}/g,(t,o)=>this.get(o)??""));let d={type:this.j.o.googleMaps.map.type,layer:this.j.o.googleMaps.map.layer,size:this.j.o.googleMaps.map.size,...r,...o},m=new h.UIMap(a,d,this.j.options);m.container.classList.add(a.getFullElName("map"));let y=new p.UIComboBox(i,{icon:"search",placeholder:"Search",clearButton:!0}).setMod("in-header",!0);y.container.classList.add(a.getFullElName("search")),this.j.async.promise(t=>{if((0,l.isApiAvailable)())return void t(0);let o=()=>{(0,l.isApiAvailable)()?t(0):this.j.async.setTimeout(o,100)};o(),(0,l.googleReady)(t)}).then(()=>{m.setStatus("ready"),y.setStatus("ready")}),this.j.e.on(y,"select",(t,o)=>{o?m.map.fitBounds(o):t&&(m.state.center=[t.lat(),t.lng()])}),r||("auto"===this.j.o.googleMaps.map.center?navigator.geolocation.getCurrentPosition(t=>{m.state.center=[t.coords.latitude,t.coords.longitude]},()=>{m.state.center=this.j.o.googleMaps.map.defaultCenter}):m.state.center=this.j.o.googleMaps.map.center),a.setSize(...i.o.googleMaps.dialog.size).setHeader([y," ",(0,f.Button)(i,"eye").onAction(()=>{let t=this.jodit.createInside.element("img");t.src=(0,c.staticUrl)(m),t.dataset.googleMaps=btoa(m.json());let o={value:t.outerHTML};this.onAfterGetValueFromEditor(o),i.execCommand("preview",null,o.value)})]).setContent((0,v.TabsWidget)(i,[{name:"Map",icon:"map",content:m},{name:"Settings",content:new h.UIMapsPropsForm(i,m.state)},{name:"Controls",icon:"menu",content:new h.UIMapsControlsForm(i,m.state)}])).setFooter([(0,f.Button)(i,"cancel","Cancel","default").onAction(()=>a.close()),(0,f.Button)(i,"ok",t?"Save":"Insert","primary").onAction(()=>{m.destruct(),y.destruct(),a.e.off("beforeClose",b),a.close(),this.insertMap(t,m)})]).open();let b=()=>{if(m.state.elements.length&&JSON.stringify(m.state.elements)!==JSON.stringify(d.elements)&&!u.IS_TEST&&!confirm(this.i18n("Are you sure?")))return!1;m.destruct(),y.destruct(),a.e.off("beforeClose",b)};a.e.on("beforeClose",b)}getDialog(){if(!this.dialog){let t=new y.Dialog({language:this.j.o.language});t.container.classList.add(this.getFullElName("")),this.dialog=t}return this.dialog}insertMap(t,o){let i=t??this.jodit.createInside.element("img");i.src=(0,c.staticUrl)(o),i.dataset.googleMaps=btoa(o.json()),t||this.jodit.s.insertImage(i)}onBeforeSetNativeEditorValue(t){t.value=t.value.replace(/<script[^>]+jodit-google-maps-init[^>]+>.*?<\/script>/gs,"")}onAfterGetValueFromEditor(t,o){this.j.o.googleMaps.useStaticImage||o===u.SOURCE_CONSUMER||(t.value=t.value.replace(/(<img[^>]+)(["']?)data-google-maps\2\s*=(["'])([^"']+)\3([^>]*>)/gs,(t,o,i,a,r,s)=>{let l={};try{l=JSON.parse(this.j.ow.atob(r))}catch{}return`${o} id="${l.uid}" ${i}data-google-maps${i}=${a}${r}${a}${s}${(0,n.generateJSScript)(this.j,l)}`}))}constructor(...t){super(...t),(0,a._)(this,"buttons",[{group:"media",name:"googleMaps"}]),(0,a._)(this,"dialog",null)}}(0,a._)(C,"requires",["license","color-picker"]),(0,r.__decorate)([(0,d.watch)("?:openOnDblClick")],C.prototype,"onOpenOnDblClick",null),(0,r.__decorate)([(0,d.watch)(":beforeSetNativeEditorValue")],C.prototype,"onBeforeSetNativeEditorValue",null),(0,r.__decorate)([(0,d.watch)(":afterGetValueFromEditor")],C.prototype,"onAfterGetValueFromEditor",null),b.JoditPro.plugins.add("google-maps",C)},1475:function(t,o,i){"use strict";i.d(o,{initOrUpdateElementFromState:function(){return p}});var a=i(53454),r=i(11079),s=i(72690),n=i(580),l=i(12153),c=i(67912);function p(t,o){let i,p=this.mapElements[o];if(p){if(p.state.type===t.type)return s.updateStateAndGme.call(this,t,o);p.gme.setMap(null)}switch(t.type){case"text":i=new google.maps.Marker({position:new google.maps.LatLng(t.coordinates[0],t.coordinates[1]),draggable:!0,title:t.text,map:this.map});break;case"marker":i=new google.maps.Marker({position:new google.maps.LatLng(t.coordinates[0],t.coordinates[1]),draggable:!0,label:t.showCaption?t.title:"",title:t.title,icon:t.icon?l.Icon.get(t.icon):void 0,map:this.map});break;case"polyline":case"polygon":{let o=(0,c.arrayToPath)(t.coordinates);i=new google.maps["polygon"===t.type?"Polygon":"Polyline"]({path:o,strokeColor:t.strokeColor,fillColor:t.fillColor,strokeWeight:t.strokeWeight,editable:!0,draggable:!0,map:this.map,fillOpacity:"polygon"===t.type?t.fillOpacity:1})}break;case"circle":i=new google.maps.Circle({center:new google.maps.LatLng(t.coordinates[0],t.coordinates[1]),radius:t.radius,strokeColor:t.strokeColor,fillColor:t.fillColor,strokeWeight:t.strokeWeight,editable:!0,draggable:!0,map:this.map,fillOpacity:t.fillOpacity??1})}let h={type:t.type,uid:(0,n.uniqueUid)(),state:t,gme:i};"dragend radius_changed center_changed".split(" ").forEach(t=>i.addListener(t,()=>a.onChangeGeometries.call(this,h,o))),("polygon"===h.type||"polyline"===h.type)&&"insert_at set_at remove_at".split(" ").forEach(t=>h.gme.getPath().addListener(t,()=>a.onChangeGeometries.call(this,h,o))),i.addListener("click",()=>r.openPropsDialog.call(this,h,o)),this.mapElements[o]=h}},4169:function(t,o,i){"use strict";i.d(o,{UIMap:function(){return v}});var a=i(82749),r=i(31635);i(55029);var s=i(22125),n=i(1475),l=i(81577),c=i(97357),p=i(13525),h=i(37133),u=i(580),d=i(38837),g=i(41180),m=i(67510),f=i(11676),y=i(17298);class v extends m.UIGroup{className(){return"UIMap"}json(){return JSON.stringify({...this.state,mode:"hand"})}async onReady(){await this.apiLoaded;let t=this.getElm("map-root");(0,d.assert)(null!=t,"map-root element does not exists"),this.map=new google.maps.Map(t,{center:{lat:this.state.center[0],lng:this.state.center[1]},zoom:this.state.zoom,mapTypeId:this.state.type}),this.map.addListener("zoom_changed",()=>{this.state.zoom=this.map.getZoom()??10}),this.map.addListener("center_changed",()=>{this.state.center=[this.map?.getCenter()?.lat()??55,this.map?.getCenter()?.lng()??34]}),this.map.addListener("maptypeid_changed",()=>{let t=this.map.getMapTypeId();t&&(this.state.type=t)}),this.initDrawManager(),this.onChangeElementsList(),this.onChangeSize(),this.onChangeControls(),this.onChangeLayer(),this.onChangeMapType(),this.onChangeMode(),this.mapInitialized=!0,this.j.async.requestIdleCallback(()=>{this.j.e.fire(this,"GoogleMapsIsReady")})}initDrawManager(){try{let t=new google.maps.drawing.DrawingManager;t.setMap(this.map),t.setOptions({drawingControl:!1,polygonOptions:{...this.options.googleMaps.map.defaultStates.polygon,clickable:!0,editable:!0},polylineOptions:{...this.options.googleMaps.map.defaultStates.polyline,clickable:!0,editable:!0},markerOptions:{...this.options.googleMaps.map.defaultStates.marker,clickable:!0},circleOptions:{...this.options.googleMaps.map.defaultStates.circle,clickable:!0,editable:!0}}),this.drawingManager=t,google.maps.event.addListener(t,"overlaycomplete",t=>{t.overlay&&(s.addNewInState.call(this,t.overlay),t.overlay.setMap(null))})}catch{}}changeCreateMode(t){this.state.mode=this.state.mode===t?"hand":t}onChangeMode(){this.j.buffer.set("createMode.gm",this.state.mode),this.drawingManager?.setDrawingMode("hand"===this.state.mode?null:this.state.mode),this.j.e.fire("updateToolbar")}onChangeElementsList(){let{state:{elements:t},mapElements:o}=this;t.length<o.length&&o.slice(t.length).forEach(t=>{t.gme.setMap(null)}),o.length=t.length,t.forEach((t,o)=>n.initOrUpdateElementFromState.call(this,t,o))}onChangeCenter(){let t=this.map.getCenter();(t?.lat()!==this.state.center[0]||t?.lng()!==this.state.center[1])&&this.map.setCenter({lat:this.state.center[0],lng:this.state.center[1]})}onChangeZoom(){this.map?.setZoom(this.state.zoom)}onChangeControls(){let t;for(t in this.state.controls)this.map?.set(t,this.state.controls[t])}onChangeBound(){this.options.googleMaps.saveStateInStorage&&this.j.storage.set(y.STORAGE_KEY,{center:this.state.center,size:this.state.size,zoom:this.state.zoom,type:this.state.type,layer:this.state.layer,controls:this.state.controls})}onChangeSize(){let t=this.getElm("map-size");(0,d.assert)(null!=t,"map-size element does not exists"),(0,g.css)(t,{width:this.state.size[0],height:this.state.size[1]})}onChangeMapType(){this.map.setMapTypeId(this.state.type)}onChangeLayer(){switch(this.layers.forEach(t=>t.setMap(null)),this.layers.length=0,this.state.layer){case"traffic":this.layers.push(new google.maps.TrafficLayer);break;case"transit":this.layers.push(new google.maps.TransitLayer);break;case"bicycling":this.layers.push(new google.maps.BicyclingLayer)}this.layers.forEach(t=>t.setMap(this.map))}render(){return`<div>
<div class='&__map-root'></div>
<div class='&__map-size'></div>
<div class='&__map-palette'></div>
</div>`}appendChildToContainer(){}constructor(t,o,i){super(t),(0,a._)(this,"options",void 0),(0,a._)(this,"drawingManager",void 0),(0,a._)(this,"toolbar",void 0),(0,a._)(this,"state",void 0),(0,a._)(this,"mapElements",void 0),(0,a._)(this,"apiLoaded",void 0),(0,a._)(this,"mapInitialized",void 0),(0,a._)(this,"map",void 0),(0,a._)(this,"layers",void 0),this.options=i,this.toolbar=new f.ToolbarCollection(this.jodit),this.state={uid:"jd"+(0,u.uniqueUid)()+new Date().toString().replace(/[^0-9]/g,""),layer:this.options.googleMaps.map.layer,center:this.options.googleMaps.map.defaultCenter,zoom:this.options.googleMaps.map.defaultZoom,size:this.options.googleMaps.map.size,type:this.options.googleMaps.map.type,controls:{zoomControl:!0,mapTypeControl:!0,scaleControl:!0,streetViewControl:!0,rotateControl:!0,fullscreenControl:!0},mode:"hand",elements:[]},this.mapElements=[],this.apiLoaded=null,this.mapInitialized=!1,this.layers=[],Object.assign(this.state,o),this.toolbar.build(["gm.hand","gm.marker","gm.polyline","gm.polygon","gm.circle"]);const r=this.getElm("map-palette");(0,d.assert)(null!=r,"palette element does not exists"),r.appendChild(this.toolbar.container)}}(0,r.__decorate)([(0,c.hook)("ready")],v.prototype,"onReady",null),(0,r.__decorate)([(0,h.watch)("?:changeCreateMode.gm")],v.prototype,"changeCreateMode",null),(0,r.__decorate)([(0,h.watch)("state.mode")],v.prototype,"onChangeMode",null),(0,r.__decorate)([(0,h.watch)("state.elements")],v.prototype,"onChangeElementsList",null),(0,r.__decorate)([(0,h.watch)("state.center"),(0,p.wait)(t=>t.mapInitialized),(0,l.debounce)()],v.prototype,"onChangeCenter",null),(0,r.__decorate)([(0,h.watch)("state.zoom"),(0,l.debounce)()],v.prototype,"onChangeZoom",null),(0,r.__decorate)([(0,h.watch)("state.controls")],v.prototype,"onChangeControls",null),(0,r.__decorate)([(0,h.watch)(["state.center","state.zoom","state.controls","state.size","state.type","state.layer"]),(0,p.wait)(t=>t.mapInitialized),(0,l.debounce)()],v.prototype,"onChangeBound",null),(0,r.__decorate)([(0,h.watch)("state.size"),(0,l.debounce)()],v.prototype,"onChangeSize",null),(0,r.__decorate)([(0,h.watch)("state.type")],v.prototype,"onChangeMapType",null),(0,r.__decorate)([(0,h.watch)("state.layer")],v.prototype,"onChangeLayer",null)},4774:function(t,o,i){"use strict";i.d(o,{UIMap:function(){return a.UIMap},UIMapsControlsForm:function(){return r.UIMapsControlsForm},UIMapsPropsForm:function(){return s.UIMapsPropsForm}}),i(90835);var a=i(4169),r=i(8073),s=i(83039);i(11093)},8073:function(t,o,i){"use strict";i.d(o,{UIMapsControlsForm:function(){return l}});var a=i(82749),r=i(31635),s=i(87325),n=i(67510);class l extends n.UIForm{className(){return"UIMapsControlsForm"}onChangeSize(t,o){this.state.controls={...this.state.controls,[t]:"true"===o}}constructor(t,o){super(t),(0,a._)(this,"state",void 0),this.state=o;const i={zoomControl:"Zoom control",mapTypeControl:"Map Type control",scaleControl:"Scale control",streetViewControl:"Street View control ",rotateControl:"Rotate control",fullscreenControl:"Fullscreen control"},r=Object.keys(i);this.append(r.map(o=>new n.UICheckbox(t,{label:i[o],name:o,checked:this.state.controls[o],switch:!0,type:"checkbox",onChange:this.onChangeSize.bind(this,o)})))}}l=(0,r.__decorate)([s.component],l)},11079:function(t,o,i){"use strict";i.d(o,{openPropsDialog:function(){return l}});var a=i(47660),r=i(72690),s=i(90835);function n(){let t=new google.maps.InfoWindow({content:"<div>test</div>"});return t.addListener("domready",()=>{this.setMod("info-opened",!0)}),t.addListener("closeclick",()=>{this.setMod("info-opened",!1)}),t}function l(t,o){let i;switch(this.state.mode="hand",t.type){case"polyline":i=new s.UIPolylineEditor(this.jodit,t.state,this.options);break;case"marker":i=new s.UIMarkerEditor(this.jodit,t.state,this.options);break;case"circle":case"polygon":i=new s.UIPolygonEditor(this.jodit,t.state,this.options)}if(!i)return;this.append(i),this.j.e.on(i,"bin",()=>{a.removeElement.call(this,t)}).on(i,"change",(i,a)=>{r.updateStateAndGme.call(this,{...t.state,[i]:a},o)});let l=n.call(this);if("polygon"===t.type||"polyline"===t.type){let o=t.gme.getPath().getAt(0);l.setPosition(o)}"circle"===t.type&&l.setPosition(t.gme.getCenter()),l.setContent(i.container),l.open(this.map,t.gme),l.addListener("closeclick",()=>{i&&(this.remove(i),i.destruct())})}},11093:function(t,o,i){"use strict";i.d(o,{UIWysiwyg:function(){return c}});var a=i(31635),r=i(87325),s=i(38837),n=i(48538),l=i(2692);class c extends n.UIElement{className(){return"UIWysiwyg"}render(){return`<div>
<div class='&__label'>~Info~</div>
<div class='&__editor'></div>
</div>`}constructor(t,o,i,a){super(t);const r=this.getElm("editor");(0,s.assert)(null!=r,"editor element does not exist");const n=l.JoditPro.make(r,{buttons:["bold","italic","image"],height:100,minHeight:100,allowResizeY:!1,allowResizeX:!1,disablePlugins:["mobile","backup","highlight-signature","tune-block","show-blocks"],toolbarButtonSize:"small",language:t.o.language,direction:t.o.direction,theme:t.o.theme,statusbar:!1,...o});n.value=i,n.e.on("change",()=>a(n.value))}}c=(0,a.__decorate)([r.component],c)},11696:function(t,o,i){"use strict";i.d(o,{UIPolygonEditor:function(){return c}});var a=i(31635),r=i(65478),s=i(62357),n=i(45128),l=i(69398);class c extends l.UIPolylineEditor{className(){return"UIPolygonEditor"}onReady(){this.append([new n.ColorInput(this.j,{label:"Fill color",value:this.state.fillColor??"#000",onChange:t=>this.j.e.fire(this,"change","fillColor",t)}).setMod("trigger",!1),new s.UIRange(this.j,{label:"Opacity",min:0,max:1,value:this.state.fillOpacity??1,onChange:t=>{this.j.e.fire(this,"change","fillOpacity",parseFloat(t)||0)}}).setMod("log",!1)],"form")}}(0,a.__decorate)([(0,r.hook)("ready")],c.prototype,"onReady",null),c=(0,a.__decorate)([r.component],c)},14002:function(t,o,i){"use strict";i.d(o,{UIBaseEditor:function(){return s}});var a=i(82749),r=i(67510);class s extends r.UIGroup{className(){return"UIBaseEditor"}render(){return`<div>
<div class='&__header'></div>
<div class='&__form'></div>
<div class='&__buttons'></div>
</div>`}onReady(){let t=(0,r.Button)(this.j,"bin").onAction(()=>this.j.e.fire(this,"bin"));this.append(t,"buttons")}constructor(t,o,i){super(t),(0,a._)(this,"state",void 0),(0,a._)(this,"options",void 0),this.state=o,this.options=i}}},17298:function(t,o,i){"use strict";i.d(o,{COMMAND_OPEN_DIALOG:function(){return r},STORAGE_KEY:function(){return a}});let a="googleMapsState",r="googleMapsDialog"},22125:function(t,o,i){"use strict";i.d(o,{addNewInState:function(){return r}});var a=i(67912);function r(t){switch(this.state.mode){case"polyline":case"polygon":{let{mode:o}=this.state;this.state.elements=[...this.state.elements,{type:o,coordinates:(0,a.pathToArray)(t.getPath()),...this.options.googleMaps.map.defaultStates[o]}];break}case"circle":this.state.elements=[...this.state.elements,{type:this.state.mode,coordinates:[t.getCenter()?.lat()??0,t.getCenter()?.lng()??0],radius:t.getRadius(),...this.options.googleMaps.map.defaultStates.circle}];break;case"marker":this.state.elements=[...this.state.elements,{type:this.state.mode,coordinates:[t.getPosition()?.lat()??0,t.getPosition()?.lng()??0],...this.options.googleMaps.map.defaultStates.marker}]}}},27622:function(t){t.exports='<svg width="72" height="86" viewBox="0 0 72 86" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M17.1832 79.1351L13.6833 45.0811L49.6832 58.4595L47.6832 5.35135" stroke="black" stroke-width="6"/> <circle cx="13" cy="44" r="6" fill="#C8C8C8"/> <circle cx="17" cy="77" r="6" fill="#C8C8C8"/> <circle cx="51" cy="59" r="6" fill="#C8C8C8"/> <circle cx="48" cy="6" r="6" fill="#C8C8C8"/> </svg>'},36576:function(t){t.exports='<svg viewBox="0 0 77 86" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M7 38.6056L33.1367 7.96263L69.5477 45.7058L36.2444 72.166L7 76.9673V38.6056Z" stroke="black" stroke-width="6"/> <circle cx="71" cy="45" r="6" fill="#C8C8C8"/> <circle cx="35" cy="73" r="6" fill="#C8C8C8"/> <circle cx="6" cy="79" r="6" fill="#C8C8C8"/> <circle cx="6" cy="39" r="6" fill="#C8C8C8"/> <circle cx="33" cy="6" r="6" fill="#C8C8C8"/> </svg>'},42370:function(t,o,i){"use strict";i.d(o,{UIMarkerEditor:function(){return l}});var a=i(31635),r=i(65478),s=i(14002),n=i(11093);class l extends s.UIBaseEditor{className(){return"UIMarkerEditor"}onReady(){super.onReady();let t=new n.UIWysiwyg(this.j,this.options.googleMaps.inlineEditorOptions,this.state.text??"",t=>this.j.e.fire(this,"change","text",t));this.append(t,"form")}}(0,a.__decorate)([(0,r.hook)("ready")],l.prototype,"onReady",null),l=(0,a.__decorate)([r.component],l)},45128:function(t,o,i){"use strict";i.d(o,{ColorInput:function(){return d}});var a=i(82749),r=i(31635),s=i(46146),n=i(82758),l=i(65478),c=i(21537),p=i(38837),h=i(67510),u=i(41409);class d extends h.UIInput{className(){return"ColorInput"}afterSetMode(t,o){"slim"===t&&o&&this.nativeInput.setAttribute("readonly","true")}onChangeSelfValue(){this.nativeInput.style.backgroundColor=this.value}onEscKeyDown(t){t.key===n.KEY_ESC&&this.popup?.close()}constructor(t,o){super(t,o),(0,a._)(this,"trigger",void 0),(0,a._)(this,"popup",void 0);const i=new h.Popup(t);this.popup=i,this.trigger=(0,h.Button)(this.j,"ok");const r=this.getElm("wrapper");(0,p.assert)(null!=r,"wrapper element does not exist"),r.appendChild(this.trigger.container),this.trigger.container.classList.add(this.getFullElName("trigger")),this.trigger.onAction(()=>{this.state.onChange?.(this.value),i.close()}),i.setMod("padding",!1).setMod("max-height",!1);const n=this.j.create.div(this.getFullElName("picker")),l=s.createPicker(n,{paletteEditable:!0,showAlpha:!0,palette:"PALETTE_MATERIAL_CHROME"}).on("change",(t,o)=>{this.isFocused||(this.value=s.parseColor(o||"","hex"))});this.j.e.on(this,"change",()=>{let t;t=this.value,s.parseColor(t,"hex")!==l.color&&(l.color=this.value)}),i.setContent(n),this.j.e.on(this.nativeInput,"click",()=>{i.parentElement=this,this.jodit instanceof u.Dialog&&i.setZIndex(this.jodit.getZIndex()+1),i.open(()=>(0,c.position)(this.container))}),this.onChangeValue(),this.onChangeSelfValue()}}(0,r.__decorate)([(0,l.watch)(":change")],d.prototype,"onChangeSelfValue",null),(0,r.__decorate)([(0,l.watch)("nativeInput:keydown")],d.prototype,"onEscKeyDown",null),d=(0,r.__decorate)([l.component],d)},46146:function(t){"u">typeof self&&self,t.exports=function(){var t=[function(t,o,i){"use strict";var a=i(3);function r(t){return!0===a(t)&&"[object Object]"===Object.prototype.toString.call(t)}t.exports=function(t){var o,i;return!1!==r(t)&&"function"==typeof(o=t.constructor)&&!1!==r(i=o.prototype)&&!1!==i.hasOwnProperty("isPrototypeOf")}},function(t,o,i){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.VERSION=o.PALETTE_MATERIAL_CHROME=o.PALETTE_MATERIAL_500=o.COLOR_NAMES=o.getLuminance=o.intToRgb=o.rgbToInt=o.rgbToHsv=o.rgbToHsl=o.hslToRgb=o.rgbToHex=o.parseColor=o.parseColorToHsla=o.parseColorToHsl=o.parseColorToRgba=o.parseColorToRgb=o.from=o.createPicker=void 0;var a=function(){function t(t,o){for(var i=0;i<o.length;i++){var a=o[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(o,i,a){return i&&t(o.prototype,i),a&&t(o,a),o}}(),r=function(t,o){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,o){var i=[],a=!0,r=!1,s=void 0;try{for(var n,l=t[Symbol.iterator]();!(a=(n=l.next()).done)&&(i.push(n.value),!o||i.length!==o);a=!0);}catch(t){r=!0,s=t}finally{try{!a&&l.return&&l.return()}finally{if(r)throw s}}return i}(t,o);throw TypeError("Invalid attempt to destructure non-iterable instance")},s=i(2),n=c(i(0)),l=c(i(4));function c(t){return t&&t.__esModule?t:{default:t}}function p(t,o){if(!(t instanceof o))throw TypeError("Cannot call a class as a function")}function h(t){if(Array.isArray(t)){for(var o=0,i=Array(t.length);o<t.length;o++)i[o]=t[o];return i}return Array.from(t)}var u="u">typeof window&&window.navigator.userAgent.indexOf("Edge")>-1,d="u">typeof window&&window.navigator.userAgent.indexOf("rv:")>-1,g={id:null,attachTo:"body",showHSL:!0,showRGB:!0,showHEX:!0,showAlpha:!1,color:"#ff0000",palette:null,paletteEditable:!1,useAlphaInPalette:"auto",slBarSize:[232,150],hueBarSize:[150,11],alphaBarSize:[150,11]},m="COLOR",f="RGBA_USER",y="HSLA_USER";function v(t,o,i){return t?t instanceof HTMLElement?t:t instanceof NodeList?t[0]:"string"==typeof t?document.querySelector(t):t.jquery?t.get(0):i?o:null:o}function b(t){var o=t.getContext("2d"),i=+t.width,a=+t.height,n=o.createLinearGradient(1,1,1,a-1);return n.addColorStop(0,"white"),n.addColorStop(1,"black"),{setHue:function(t){var r=o.createLinearGradient(1,0,i-1,0);r.addColorStop(0,"hsla("+t+", 100%, 50%, 0)"),r.addColorStop(1,"hsla("+t+", 100%, 50%, 1)"),o.fillStyle=n,o.fillRect(0,0,i,a),o.fillStyle=r,o.globalCompositeOperation="multiply",o.fillRect(0,0,i,a),o.globalCompositeOperation="source-over"},grabColor:function(t,i){return o.getImageData(t,i,1,1).data},findColor:function(t,o,n){var l=r((0,s.rgbToHsv)(t,o,n),3);return[l[1]*i,a-l[2]*a]}}}function C(t,o,i){return null===t?o:/^\s*$/.test(t)?i:!!/true|yes|1/i.test(t)||!/false|no|0/i.test(t)&&o}function k(t,o,i){if(null===t)return o;if(/^\s*$/.test(t))return i;var a=t.split(",").map(Number);return 2===a.length&&a[0]&&a[1]?a:o}var w=function(){function t(o,i){if(p(this,t),i?(o=v(o),this.options=Object.assign({},g,i)):o&&(0,n.default)(o)?(this.options=Object.assign({},g,o),o=v(this.options.attachTo)):(this.options=Object.assign({},g),o=v((0,s.nvl)(o,this.options.attachTo))),!o)throw Error("Container not found: "+this.options.attachTo);!function(t,o){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"acp-";if(o.hasAttribute(i+"show-hsl")&&(t.showHSL=C(o.getAttribute(i+"show-hsl"),g.showHSL,!0)),o.hasAttribute(i+"show-rgb")&&(t.showRGB=C(o.getAttribute(i+"show-rgb"),g.showRGB,!0)),o.hasAttribute(i+"show-hex")&&(t.showHEX=C(o.getAttribute(i+"show-hex"),g.showHEX,!0)),o.hasAttribute(i+"show-alpha")&&(t.showAlpha=C(o.getAttribute(i+"show-alpha"),g.showAlpha,!0)),o.hasAttribute(i+"palette-editable")&&(t.paletteEditable=C(o.getAttribute(i+"palette-editable"),g.paletteEditable,!0)),o.hasAttribute(i+"sl-bar-size")&&(t.slBarSize=k(o.getAttribute(i+"sl-bar-size"),g.slBarSize,[232,150])),o.hasAttribute(i+"hue-bar-size")&&(t.hueBarSize=k(o.getAttribute(i+"hue-bar-size"),g.hueBarSize,[150,11]),t.alphaBarSize=t.hueBarSize),o.hasAttribute(i+"palette")){var a=o.getAttribute(i+"palette");switch(a){case"PALETTE_MATERIAL_500":t.palette=s.PALETTE_MATERIAL_500;break;case"PALETTE_MATERIAL_CHROME":case"":t.palette=s.PALETTE_MATERIAL_CHROME;break;default:t.palette=a.split(/[;|]/)}}o.hasAttribute(i+"color")&&(t.color=o.getAttribute(i+"color"))}(this.options,o),this.H=0,this.S=0,this.L=0,this.R=0,this.G=0,this.B=0,this.A=1,this.palette={},this.element=document.createElement("div"),this.options.id&&(this.element.id=this.options.id),this.element.className="a-color-picker",this.element.innerHTML=l.default,o.appendChild(this.element);var a=this.element.querySelector(".a-color-picker-h");this.setupHueCanvas(a),this.hueBarHelper=b(a),this.huePointer=this.element.querySelector(".a-color-picker-h+.a-color-picker-dot");var r=this.element.querySelector(".a-color-picker-sl");this.setupSlCanvas(r),this.slBarHelper=b(r),this.slPointer=this.element.querySelector(".a-color-picker-sl+.a-color-picker-dot"),this.preview=this.element.querySelector(".a-color-picker-preview"),this.setupClipboard(this.preview.querySelector(".a-color-picker-clipbaord")),this.options.showHSL?(this.setupInput(this.inputH=this.element.querySelector(".a-color-picker-hsl>input[nameref=H]")),this.setupInput(this.inputS=this.element.querySelector(".a-color-picker-hsl>input[nameref=S]")),this.setupInput(this.inputL=this.element.querySelector(".a-color-picker-hsl>input[nameref=L]"))):this.element.querySelector(".a-color-picker-hsl").remove(),this.options.showRGB?(this.setupInput(this.inputR=this.element.querySelector(".a-color-picker-rgb>input[nameref=R]")),this.setupInput(this.inputG=this.element.querySelector(".a-color-picker-rgb>input[nameref=G]")),this.setupInput(this.inputB=this.element.querySelector(".a-color-picker-rgb>input[nameref=B]"))):this.element.querySelector(".a-color-picker-rgb").remove(),this.options.showHEX?this.setupInput(this.inputRGBHEX=this.element.querySelector("input[nameref=RGBHEX]")):this.element.querySelector(".a-color-picker-rgbhex").remove(),this.options.paletteEditable||this.options.palette&&this.options.palette.length>0?this.setPalette(this.paletteRow=this.element.querySelector(".a-color-picker-palette")):(this.paletteRow=this.element.querySelector(".a-color-picker-palette"),this.paletteRow.remove()),this.options.showAlpha?(this.setupAlphaCanvas(this.element.querySelector(".a-color-picker-a")),this.alphaPointer=this.element.querySelector(".a-color-picker-a+.a-color-picker-dot")):this.element.querySelector(".a-color-picker-alpha").remove(),this.element.style.width=this.options.slBarSize[0]+"px",this.onValueChanged(m,this.options.color)}return a(t,[{key:"setupHueCanvas",value:function(t){var o=this;t.width=this.options.hueBarSize[0],t.height=this.options.hueBarSize[1];for(var i=t.getContext("2d"),a=i.createLinearGradient(0,0,this.options.hueBarSize[0],0),r=0;r<=1;r+=1/360)a.addColorStop(r,"hsl("+360*r+", 100%, 50%)");i.fillStyle=a,i.fillRect(0,0,this.options.hueBarSize[0],this.options.hueBarSize[1]);var n=function(i){var a=(0,s.limit)(i.clientX-t.getBoundingClientRect().left,0,o.options.hueBarSize[0]),r=Math.round(360*a/o.options.hueBarSize[0]);o.huePointer.style.left=a-7+"px",o.onValueChanged("H",r)},l=function t(){document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",t)};t.addEventListener("mousedown",function(t){n(t),document.addEventListener("mousemove",n),document.addEventListener("mouseup",l)})}},{key:"setupSlCanvas",value:function(t){var o=this;t.width=this.options.slBarSize[0],t.height=this.options.slBarSize[1];var i=function(i){var a=(0,s.limit)(i.clientX-t.getBoundingClientRect().left,0,o.options.slBarSize[0]-1),r=(0,s.limit)(i.clientY-t.getBoundingClientRect().top,0,o.options.slBarSize[1]-1),n=o.slBarHelper.grabColor(a,r);o.slPointer.style.left=a-7+"px",o.slPointer.style.top=r-7+"px",o.onValueChanged("RGB",n)},a=function t(){document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",t)};t.addEventListener("mousedown",function(t){i(t),document.addEventListener("mousemove",i),document.addEventListener("mouseup",a)})}},{key:"setupAlphaCanvas",value:function(t){var o=this;t.width=this.options.alphaBarSize[0],t.height=this.options.alphaBarSize[1];var i=t.getContext("2d"),a=i.createLinearGradient(0,0,t.width-1,0);a.addColorStop(0,"hsla(0, 0%, 50%, 0)"),a.addColorStop(1,"hsla(0, 0%, 50%, 1)"),i.fillStyle=a,i.fillRect(0,0,this.options.alphaBarSize[0],this.options.alphaBarSize[1]);var r=function(i){var a=(0,s.limit)(i.clientX-t.getBoundingClientRect().left,0,o.options.alphaBarSize[0]),r=+(a/o.options.alphaBarSize[0]).toFixed(2);o.alphaPointer.style.left=a-7+"px",o.onValueChanged("ALPHA",r)},n=function t(){document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",t)};t.addEventListener("mousedown",function(t){r(t),document.addEventListener("mousemove",r),document.addEventListener("mouseup",n)})}},{key:"setupInput",value:function(t){var o=this,i=+t.min,a=+t.max,r=t.getAttribute("nameref");t.hasAttribute("select-on-focus")&&t.addEventListener("focus",function(){t.select()}),"text"===t.type?t.addEventListener("change",function(){o.onValueChanged(r,t.value)}):((u||d)&&t.addEventListener("keydown",function(n){"Up"===n.key?(t.value=(0,s.limit)(+t.value+1,i,a),o.onValueChanged(r,t.value),n.returnValue=!1):"Down"===n.key&&(t.value=(0,s.limit)(t.value-1,i,a),o.onValueChanged(r,t.value),n.returnValue=!1)}),t.addEventListener("change",function(){var n=+t.value;o.onValueChanged(r,(0,s.limit)(n,i,a))}))}},{key:"setupClipboard",value:function(t){var o=this;t.title="click to copy",t.addEventListener("click",function(){t.value=(0,s.parseColor)([o.R,o.G,o.B,o.A],"hexcss4"),t.select(),document.execCommand("copy")})}},{key:"setPalette",value:function(t){var o=this,i="auto"===this.options.useAlphaInPalette?this.options.showAlpha:this.options.useAlphaInPalette,a=null;switch(this.options.palette){case"PALETTE_MATERIAL_500":a=s.PALETTE_MATERIAL_500;break;case"PALETTE_MATERIAL_CHROME":a=s.PALETTE_MATERIAL_CHROME;break;default:a=(0,s.ensureArray)(this.options.palette)}if(this.options.paletteEditable||a.length>0){var r=function(i,a,r){var s=t.querySelector('.a-color-picker-palette-color[data-color="'+i+'"]')||document.createElement("div");s.className="a-color-picker-palette-color",s.style.backgroundColor=i,s.setAttribute("data-color",i),s.title=i,t.insertBefore(s,a),o.palette[i]=!0,r&&o.onPaletteColorAdd(i)},n=function(i,a){i?(t.removeChild(i),o.palette[i.getAttribute("data-color")]=!1,a&&o.onPaletteColorRemove(i.getAttribute("data-color"))):(t.querySelectorAll(".a-color-picker-palette-color[data-color]").forEach(function(o){t.removeChild(o)}),Object.keys(o.palette).forEach(function(t){o.palette[t]=!1}),a&&o.onPaletteColorRemove())};if(a.map(function(t){return(0,s.parseColor)(t,i?"rgbcss4":"hex")}).filter(function(t){return!!t}).forEach(function(t){return r(t)}),this.options.paletteEditable){var l=document.createElement("div");l.className="a-color-picker-palette-color a-color-picker-palette-add",l.innerHTML="+",t.appendChild(l),t.addEventListener("click",function(t){/a-color-picker-palette-add/.test(t.target.className)?t.shiftKey?n(null,!0):r(i?(0,s.parseColor)([o.R,o.G,o.B,o.A],"rgbcss4"):(0,s.rgbToHex)(o.R,o.G,o.B),t.target,!0):/a-color-picker-palette-color/.test(t.target.className)&&(t.shiftKey?n(t.target,!0):o.onValueChanged(m,t.target.getAttribute("data-color")))})}else t.addEventListener("click",function(t){/a-color-picker-palette-color/.test(t.target.className)&&o.onValueChanged(m,t.target.getAttribute("data-color"))})}else t.style.display="none"}},{key:"updatePalette",value:function(t){this.paletteRow.innerHTML="",this.palette={},this.paletteRow.parentElement||this.element.appendChild(this.paletteRow),this.options.palette=t,this.setPalette(this.paletteRow)}},{key:"onValueChanged",value:function(t,o){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{silent:!1};switch(t){case"H":this.H=o;var a=r((0,s.hslToRgb)(this.H,this.S,this.L),3);this.R=a[0],this.G=a[1],this.B=a[2],this.slBarHelper.setHue(o),this.updatePointerH(this.H),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"S":this.S=o;var n=r((0,s.hslToRgb)(this.H,this.S,this.L),3);this.R=n[0],this.G=n[1],this.B=n[2],this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"L":this.L=o;var l=r((0,s.hslToRgb)(this.H,this.S,this.L),3);this.R=l[0],this.G=l[1],this.B=l[2],this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"R":this.R=o;var c=r((0,s.rgbToHsl)(this.R,this.G,this.B),3);this.H=c[0],this.S=c[1],this.L=c[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"G":this.G=o;var p=r((0,s.rgbToHsl)(this.R,this.G,this.B),3);this.H=p[0],this.S=p[1],this.L=p[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"B":this.B=o;var h=r((0,s.rgbToHsl)(this.R,this.G,this.B),3);this.H=h[0],this.S=h[1],this.L=h[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"RGB":var u=r(o,3);this.R=u[0],this.G=u[1],this.B=u[2];var d=r((0,s.rgbToHsl)(this.R,this.G,this.B),3);this.H=d[0],this.S=d[1],this.L=d[2],this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case f:var g=r(o,4);this.R=g[0],this.G=g[1],this.B=g[2],this.A=g[3];var v=r((0,s.rgbToHsl)(this.R,this.G,this.B),3);this.H=v[0],this.S=v[1],this.L=v[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B),this.updatePointerA(this.A);break;case y:var b=r(o,4);this.H=b[0],this.S=b[1],this.L=b[2],this.A=b[3];var C=r((0,s.hslToRgb)(this.H,this.S,this.L),3);this.R=C[0],this.G=C[1],this.B=C[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B),this.updatePointerA(this.A);break;case"RGBHEX":var k=r((0,s.cssColorToRgb)(o)||[this.R,this.G,this.B],3);this.R=k[0],this.G=k[1],this.B=k[2];var w=r((0,s.rgbToHsl)(this.R,this.G,this.B),3);this.H=w[0],this.S=w[1],this.L=w[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B);break;case m:var E=r((0,s.parseColor)(o,"rgba")||[0,0,0,1],4);this.R=E[0],this.G=E[1],this.B=E[2],this.A=E[3];var A=r((0,s.rgbToHsl)(this.R,this.G,this.B),3);this.H=A[0],this.S=A[1],this.L=A[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B),this.updatePointerA(this.A);break;case"ALPHA":this.A=o}1===this.A?this.preview.style.backgroundColor="rgb("+this.R+","+this.G+","+this.B+")":this.preview.style.backgroundColor="rgba("+this.R+","+this.G+","+this.B+","+this.A+")",i&&i.silent||this.onchange&&this.onchange(this.preview.style.backgroundColor)}},{key:"onPaletteColorAdd",value:function(t){this.oncoloradd&&this.oncoloradd(t)}},{key:"onPaletteColorRemove",value:function(t){this.oncolorremove&&this.oncolorremove(t)}},{key:"updateInputHSL",value:function(t,o,i){this.options.showHSL&&(this.inputH.value=t,this.inputS.value=o,this.inputL.value=i)}},{key:"updateInputRGB",value:function(t,o,i){this.options.showRGB&&(this.inputR.value=t,this.inputG.value=o,this.inputB.value=i)}},{key:"updateInputRGBHEX",value:function(t,o,i){this.options.showHEX&&(this.inputRGBHEX.value=(0,s.rgbToHex)(t,o,i))}},{key:"updatePointerH",value:function(t){var o=this.options.hueBarSize[0]*t/360;this.huePointer.style.left=o-7+"px"}},{key:"updatePointerSL",value:function(t,o,i){var a=r((0,s.hslToRgb)(t,o,i),3),n=a[0],l=a[1],c=a[2],p=r(this.slBarHelper.findColor(n,l,c),2),h=p[0],u=p[1];h>=0&&(this.slPointer.style.left=h-7+"px",this.slPointer.style.top=u-7+"px")}},{key:"updatePointerA",value:function(t){if(this.options.showAlpha){var o=this.options.alphaBarSize[0]*t;this.alphaPointer.style.left=o-7+"px"}}}]),t}(),E=function(){function t(o){p(this,t),this.name=o,this.listeners=[]}return a(t,[{key:"on",value:function(t){t&&this.listeners.push(t)}},{key:"off",value:function(t){this.listeners=t?this.listeners.filter(function(o){return o!==t}):[]}},{key:"emit",value:function(t,o){for(var i=this.listeners.slice(0),a=0;a<i.length;a++)i[a].apply(o,t)}}]),t}();function A(t,o){var i=new w(t,o),a={change:new E("change"),coloradd:new E("coloradd"),colorremove:new E("colorremove")},n=!0,l={},c={get element(){return i.element},get rgb(){return[i.R,i.G,i.B]},set rgb(e){var p=r(e,3),h=p[0],u=p[1],d=p[2],g=[(0,s.limit)(h,0,255),(0,s.limit)(u,0,255),(0,s.limit)(d,0,255)];h=g[0],u=g[1],d=g[2],i.onValueChanged(f,[h,u,d,1])},get hsl(){return[i.H,i.S,i.L]},set hsl(e){var v=r(e,3),b=v[0],C=v[1],k=v[2],A=[(0,s.limit)(b,0,360),(0,s.limit)(C,0,100),(0,s.limit)(k,0,100)];b=A[0],C=A[1],k=A[2],i.onValueChanged(y,[b,C,k,1])},get rgbhex(){return this.all.hex},get rgba(){return[i.R,i.G,i.B,i.A]},set rgba(e){var x=r(e,4),S=x[0],F=x[1],B=x[2],L=x[3],R=[(0,s.limit)(S,0,255),(0,s.limit)(F,0,255),(0,s.limit)(B,0,255),(0,s.limit)(L,0,1)];S=R[0],F=R[1],B=R[2],L=R[3],i.onValueChanged(f,[S,F,B,L])},get hsla(){return[i.H,i.S,i.L,i.A]},set hsla(e){var H=r(e,4),I=H[0],M=H[1],_=H[2],T=H[3],P=[(0,s.limit)(I,0,360),(0,s.limit)(M,0,100),(0,s.limit)(_,0,100),(0,s.limit)(T,0,1)];I=P[0],M=P[1],_=P[2],T=P[3],i.onValueChanged(y,[I,M,_,T])},get color(){return this.all.toString()},set color(e){i.onValueChanged(m,e)},setColor:function(t){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i.onValueChanged(m,t,{silent:o})},get all(){if(n){var j=[i.R,i.G,i.B,i.A],G=i.A<1?"rgba("+i.R+","+i.G+","+i.B+","+i.A+")":s.rgbToHex.apply(void 0,j);(l=(0,s.parseColor)(j,l)).toString=function(){return G},n=!1}return Object.assign({},l)},get onchange(){return a.change&&a.change.listeners[0]},set onchange(e){this.off("change").on("change",e)},get oncoloradd(){return a.coloradd&&a.coloradd.listeners[0]},set oncoloradd(e){this.off("coloradd").on("coloradd",e)},get oncolorremove(){return a.colorremove&&a.colorremove.listeners[0]},set oncolorremove(e){this.off("colorremove").on("colorremove",e)},get palette(){return Object.keys(i.palette).filter(function(t){return i.palette[t]})},set palette(e){i.updatePalette(e)},show:function(){i.element.classList.remove("hidden")},hide:function(){i.element.classList.add("hidden")},toggle:function(){i.element.classList.toggle("hidden")},on:function(t,o){return t&&a[t]&&a[t].on(o),this},off:function(t,o){return t&&a[t]&&a[t].off(o),this},destroy:function(){a.change.off(),a.coloradd.off(),a.colorremove.off(),i.element.remove(),a=null,i=null}};return i.onchange=function(){for(var t=arguments.length,o=Array(t),i=0;i<t;i++)o[i]=arguments[i];n=!0,a.change.emit([c].concat(o),c)},i.oncoloradd=function(){for(var t=arguments.length,o=Array(t),i=0;i<t;i++)o[i]=arguments[i];a.coloradd.emit([c].concat(o),c)},i.oncolorremove=function(){for(var t=arguments.length,o=Array(t),i=0;i<t;i++)o[i]=arguments[i];a.colorremove.emit([c].concat(o),c)},i.element.ctrl=c,c}if("u">typeof window&&!document.querySelector('head>style[data-source="a-color-picker"]')){var x=i(5).toString(),S=document.createElement("style");S.setAttribute("type","text/css"),S.setAttribute("data-source","a-color-picker"),S.innerHTML=x,document.querySelector("head").appendChild(S)}o.createPicker=A,o.from=function(t,o){var i=(t?Array.isArray(t)?t:t instanceof HTMLElement?[t]:t instanceof NodeList?[].concat(h(t)):"string"==typeof t?[].concat(h(document.querySelectorAll(t))):t.jquery?t.get():[]:[]).map(function(t,i){var a=A(t,o);return a.index=i,a});return i.on=function(t,o){return i.forEach(function(i){return i.on(t,o)}),this},i.off=function(t){return i.forEach(function(o){return o.off(t)}),this},i},o.parseColorToRgb=s.parseColorToRgb,o.parseColorToRgba=s.parseColorToRgba,o.parseColorToHsl=s.parseColorToHsl,o.parseColorToHsla=s.parseColorToHsla,o.parseColor=s.parseColor,o.rgbToHex=s.rgbToHex,o.hslToRgb=s.hslToRgb,o.rgbToHsl=s.rgbToHsl,o.rgbToHsv=s.rgbToHsv,o.rgbToInt=s.rgbToInt,o.intToRgb=s.intToRgb,o.getLuminance=s.getLuminance,o.COLOR_NAMES=s.COLOR_NAMES,o.PALETTE_MATERIAL_500=s.PALETTE_MATERIAL_500,o.PALETTE_MATERIAL_CHROME=s.PALETTE_MATERIAL_CHROME,o.VERSION="1.2.1"},function(t,o,i){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.nvl=o.ensureArray=o.limit=o.getLuminance=o.parseColor=o.parseColorToHsla=o.parseColorToHsl=o.cssHslaToHsla=o.cssHslToHsl=o.parseColorToRgba=o.parseColorToRgb=o.cssRgbaToRgba=o.cssRgbToRgb=o.cssColorToRgba=o.cssColorToRgb=o.intToRgb=o.rgbToInt=o.rgbToHsv=o.rgbToHsl=o.hslToRgb=o.rgbToHex=o.PALETTE_MATERIAL_CHROME=o.PALETTE_MATERIAL_500=o.COLOR_NAMES=void 0;var a,r=function(t,o){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,o){var i=[],a=!0,r=!1,s=void 0;try{for(var n,l=t[Symbol.iterator]();!(a=(n=l.next()).done)&&(i.push(n.value),!o||i.length!==o);a=!0);}catch(t){r=!0,s=t}finally{try{!a&&l.return&&l.return()}finally{if(r)throw s}}return i}(t,o);throw TypeError("Invalid attempt to destructure non-iterable instance")},s=(a=i(0))&&a.__esModule?a:{default:a};function n(t){if(Array.isArray(t)){for(var o=0,i=Array(t.length);o<t.length;o++)i[o]=t[o];return i}return Array.from(t)}var l={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#00FFFF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blue:"#0000FF",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#FF00FF",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4","indianred ":"#CD5C5C","indigo ":"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#00FF00",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#FF0000",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFFFFF",whitesmoke:"#F5F5F5",yellow:"#FFFF00",yellowgreen:"#9ACD32"};function c(t,o,i){return isNaN(t*=1)||o>t?o:t>i?i:t}function p(t,o){return null==t?o:t}function h(t,o,i){var a=[c(t,0,255),c(o,0,255),c(i,0,255)];return"#"+("000000"+((t=a[0])<<16|(o=a[1])<<8|(i=a[2])).toString(16)).slice(-6)}function u(t,o,i){var a=void 0,r=void 0,s=void 0,n=[c(t,0,360)/360,c(o,0,100)/100,c(i,0,100)/100];if(t=n[0],i=n[2],0==(o=n[1]))a=r=s=i;else{var l=function(t,o,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(o-t)*i:i<.5?o:i<2/3?t+(o-t)*(2/3-i)*6:t},p=i<.5?i*(1+o):i+o-i*o,h=2*i-p;a=l(h,p,t+1/3),r=l(h,p,t),s=l(h,p,t-1/3)}return[255*a,255*r,255*s].map(Math.round)}function d(t,o,i){var a=[c(t,0,255)/255,c(o,0,255)/255,c(i,0,255)/255],r=Math.max(t=a[0],o=a[1],i=a[2]),s=Math.min(t,o,i),n=void 0,l=void 0,p=(r+s)/2;if(r==s)n=l=0;else{var h=r-s;switch(l=p>.5?h/(2-r-s):h/(r+s),r){case t:n=(o-i)/h+6*(o<i);break;case o:n=(i-t)/h+2;break;case i:n=(t-o)/h+4}n/=6}return[360*n,100*l,100*p].map(Math.round)}function g(t,o,i){return t<<16|o<<8|i}function m(t){if(t){var o=l[t.toString().toLowerCase()],i=r(/^\s*#?((([0-9A-F])([0-9A-F])([0-9A-F]))|(([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})))\s*$/i.exec(o||t)||[],10),a=i[3],s=i[4],n=i[5],c=i[7],p=i[8],h=i[9];if(void 0!==a)return[parseInt(a+a,16),parseInt(s+s,16),parseInt(n+n,16)];if(void 0!==c)return[parseInt(c,16),parseInt(p,16),parseInt(h,16)]}}function f(t){if(t){var o=l[t.toString().toLowerCase()],i=r(/^\s*#?((([0-9A-F])([0-9A-F])([0-9A-F])([0-9A-F])?)|(([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})?))\s*$/i.exec(o||t)||[],12),a=i[3],s=i[4],n=i[5],c=i[6],p=i[8],h=i[9],u=i[10],d=i[11];if(void 0!==a)return[parseInt(a+a,16),parseInt(s+s,16),parseInt(n+n,16),c?+(parseInt(c+c,16)/255).toFixed(2):1];if(void 0!==p)return[parseInt(p,16),parseInt(h,16),parseInt(u,16),d?+(parseInt(d,16)/255).toFixed(2):1]}}function y(t){if(t){var o=r(/^rgb\((\d+)[\s,](\d+)[\s,](\d+)\)/i.exec(t)||[],4),i=o[0],a=o[1],s=o[2],n=o[3];return i?[c(a,0,255),c(s,0,255),c(n,0,255)]:void 0}}function v(t){if(t){var o=r(/^rgba?\((\d+)\s*[\s,]\s*(\d+)\s*[\s,]\s*(\d+)(\s*[\s,]\s*(\d*(.\d+)?))?\)/i.exec(t)||[],6),i=o[0],a=o[1],s=o[2],n=o[3],l=o[5];return i?[c(a,0,255),c(s,0,255),c(n,0,255),c(p(l,1),0,1)]:void 0}}function b(t){if(Array.isArray(t))return[c(t[0],0,255),c(t[1],0,255),c(t[2],0,255),c(p(t[3],1),0,1)];var o=f(t)||v(t);return o&&3===o.length&&o.push(1),o}function C(t){if(t){var o=r(/^hsl\((\d+)[\s,](\d+)[\s,](\d+)\)/i.exec(t)||[],4),i=o[0],a=o[1],s=o[2],n=o[3];return i?[c(a,0,360),c(s,0,100),c(n,0,100)]:void 0}}function k(t){if(t){var o=r(/^hsla?\((\d+)\s*[\s,]\s*(\d+)\s*[\s,]\s*(\d+)(\s*[\s,]\s*(\d*(.\d+)?))?\)/i.exec(t)||[],6),i=o[0],a=o[1],s=o[2],n=o[3],l=o[5];return i?[c(a,0,255),c(s,0,255),c(n,0,255),c(p(l,1),0,1)]:void 0}}function w(t){if(Array.isArray(t))return[c(t[0],0,360),c(t[1],0,100),c(t[2],0,100),c(p(t[3],1),0,1)];var o=k(t);return o&&3===o.length&&o.push(1),o}function E(t,o){switch(o){case"rgb":default:return t.slice(0,3);case"rgbcss":return"rgb("+t[0]+", "+t[1]+", "+t[2]+")";case"rgbcss4":return"rgb("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")";case"rgba":return t;case"rgbacss":return"rgba("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")";case"hsl":return d.apply(void 0,n(t));case"hslcss":return"hsl("+(t=d.apply(void 0,n(t)))[0]+", "+t[1]+", "+t[2]+")";case"hslcss4":var i=d.apply(void 0,n(t));return"hsl("+i[0]+", "+i[1]+", "+i[2]+", "+t[3]+")";case"hsla":return[].concat(n(d.apply(void 0,n(t))),[t[3]]);case"hslacss":var a=d.apply(void 0,n(t));return"hsla("+a[0]+", "+a[1]+", "+a[2]+", "+t[3]+")";case"hex":return h.apply(void 0,n(t));case"hexcss4":return h.apply(void 0,n(t))+("00"+parseInt(255*t[3]).toString(16)).slice(-2);case"int":return g.apply(void 0,n(t))}}o.COLOR_NAMES=l,o.PALETTE_MATERIAL_500=["#F44336","#E91E63","#E91E63","#9C27B0","#9C27B0","#673AB7","#673AB7","#3F51B5","#3F51B5","#2196F3","#2196F3","#03A9F4","#03A9F4","#00BCD4","#00BCD4","#009688","#009688","#4CAF50","#4CAF50","#8BC34A","#8BC34A","#CDDC39","#CDDC39","#FFEB3B","#FFEB3B","#FFC107","#FFC107","#FF9800","#FF9800","#FF5722","#FF5722","#795548","#795548","#9E9E9E","#9E9E9E","#607D8B","#607D8B"],o.PALETTE_MATERIAL_CHROME=["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4caf50","#8bc34a","#cddc39","#ffeb3b","#ffc107","#ff9800","#ff5722","#795548","#9e9e9e","#607d8b"],o.rgbToHex=h,o.hslToRgb=u,o.rgbToHsl=d,o.rgbToHsv=function(t,o,i){var a=[c(t,0,255)/255,c(o,0,255)/255,c(i,0,255)/255],r,s=Math.max(t=a[0],o=a[1],i=a[2]),n=Math.min(t,o,i),l=void 0,p=s-n;if(r=0===s?0:p/s,s==n)