403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/landing/ui/field/color/dist/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/landing/ui/field/color/dist/color_field.bundle.min.js
this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};this.BX.Landing.UI=this.BX.Landing.UI||{};(function(e,t,s,i,a,r,n,o,l,c,h,u){"use strict";const g=/^rgba? ?\((\d{1,3})[, ]+(\d{1,3})[, ]+(\d{1,3})([, ]+([\d\.]{1,5}))?\)$/i;function d(e){return!!e.match(g)}const p=/^#([\da-f]{3}){1,2}$/i;function m(e){return!!e.trim().match(p)}const v=/^hsla?\((\d{1,3}), ?(\d{1,3})%, ?(\d{1,3})%(, ?([\d .]+))?\)/i;function f(e){return!!e.trim().match(v)}function b(e){if(e.length===4){const t=parseInt(`0x${e[1]}${e[1]}`,16);const s=parseInt(`0x${e[2]}${e[2]}`,16);const i=parseInt(`0x${e[3]}${e[3]}`,16);return{r:t,g:s,b:i}}if(e.length===7){const t=parseInt(`0x${e[1]}${e[2]}`,16);const s=parseInt(`0x${e[3]}${e[4]}`,16);const i=parseInt(`0x${e[5]}${e[6]}`,16);return{r:t,g:s,b:i}}return{r:255,g:255,b:255}}function y(e){const t=e.r/255;const s=e.g/255;const i=e.b/255;const a=Math.max(t,s,i);const r=Math.min(t,s,i);let n,o,l=(a+r)/2;if(a===r){n=o=0}else{const e=a-r;o=l>.5?e/(2-a-r):e/(a+r);switch(a){case t:n=(s-i)/e+(s<i?6:0);break;case s:n=(i-t)/e+2;break;case i:n=(t-s)/e+4;break}n*=.6}return{h:Math.round(n*100),s:Math.round(o*100),l:Math.round(l*100),a:"a"in e?e.a:1}}function C(e){const t=b(e.trim());return y(t)}function A(e){let t=e.r.toString(16);let s=e.g.toString(16);let i=e.b.toString(16);if(t.length===1){t="0"+t}if(s.length===1){s="0"+s}if(i.length===1){i="0"+i}return"#"+t+s+i}function L(e){const t=e.h;const s=e.s/100;const i=e.l/100;let a=(1-Math.abs(2*i-1))*s;let r=a*(1-Math.abs(t/60%2-1));let n=i-a/2;let o=0;let l=0;let c=0;if(0<=t&&t<60){o=a;l=r;c=0}else if(60<=t&&t<120){o=r;l=a;c=0}else if(120<=t&&t<180){o=0;l=a;c=r}else if(180<=t&&t<240){o=0;l=r;c=a}else if(240<=t&&t<300){o=r;l=0;c=a}else if(300<=t&&t<360){o=a;l=0;c=r}o=Math.round((o+n)*255);l=Math.round((l+n)*255);c=Math.round((c+n)*255);return{r:o,g:l,b:c}}function T(e){const t=L(e);return A(t)}function E(e){let t=e.trim().match(g);if(t.length>0){return y({r:u.Text.toNumber(t[1]),g:u.Text.toNumber(t[2]),b:u.Text.toNumber(t[3]),a:t[5]?u.Text.toNumber(t[5]):1})}}function V(e){let t=e.trim().match(v);if(t&&t.length>0){return{h:u.Text.toNumber(t[1]),s:u.Text.toNumber(t[2]),l:u.Text.toNumber(t[3]),a:t[5]?u.Text.toNumber(t[5]):1}}}const I=/^(var\()?((--[\w\d-]*?)(-opacity_([\d_]+)?)?)\)?$/i;function _(e){return!!e.trim().match(I)}function S(e){const t=e.trim().match(I);if(!!t){const e={full:t[2],name:t[3]};if(t[3]){const s="--primary-opacity-0_";const i="--primary-opacity-0";if(t[3].startsWith(i)&&!t[3].startsWith(s)){e.opacity=0}if(t[3].startsWith(s)){let i=t[3].substr(s.length);if(i.length===1&&i!==0){i=i/10}if(i.length===2){i=i/100}e.opacity=i}}if(t[5]){e.opacity=+parseFloat(t[5].replace("_",".")).toFixed(1)}return e}return null}const P={h:205,s:1,l:50,a:1};const N="cover";const w="scroll";const R=null;const O={url:null,size:N,attachment:w,overlay:R};class B{constructor(e){this.value=P;this.hex=null;this.cssVar=null;this.setValue(e)}getName(){if(this.hex){return this.getHex()+"_"+this.getOpacity()}const{h:e,s:t,l:s}=this.getHsl();return`${e}-${t}-${s}-${this.getOpacity()}`}setValue(e){if(u.Type.isObject(e)){if(e instanceof B){this.value=e.getHsla();this.cssVar=e.getCssVar();this.hex=e.getHexOriginal()}else{this.value={...this.value,...e}}}if(u.Type.isString(e)){if(f(e)){this.value=V(e)}else if(m(e)){this.value={...C(e),a:P.a};this.hex=e}else if(d(e)){this.value=E(e)}else if(_(e)){const t=S(e);const s="--primary";if(t!==null){this.cssVar=t.name;if("opacity"in t){this.cssVar=s;this.setValue(u.Dom.style(document.documentElement,this.cssVar));this.setOpacity(t.opacity)}else{this.setValue(u.Dom.style(document.documentElement,this.cssVar))}}}}this.value.h=Math.round(this.value.h);this.value.s=Math.round(this.value.s);this.value.l=Math.round(this.value.l);this.value.a=this.value.a.toFixed(2);const t=Math.round(this.value.a*100%5);if(t<3){this.value.a=(this.value.a*100-t)/100}else{this.value.a=(this.value.a*100-t+5)/100}return this}setOpacity(e){this.setValue({a:e});return this}lighten(e){this.value.l=Math.min(this.value.l+e,100);this.hex=null;return this}darken(e){this.value.l=Math.max(this.value.l-e,0);this.hex=null;return this}saturate(e){this.value.s=Math.min(this.value.s+e,100);this.hex=null;return this}desaturate(e){this.value.s=Math.max(this.value.s-e,0);this.hex=null;return this}adjustHue(e){this.value.h=(this.value.h+e)%360;return this}getHsl(){return{h:this.value.h,s:this.value.s,l:this.value.l}}getHsla(){const e=this.value.a||1;return{h:this.value.h,s:this.value.s,l:this.value.l,a:e}}getHex(){return this.hex||T(this.value)}getHexOriginal(){return this.hex}getOpacity(){var e;return(e=this.value.a)!=null?e:P.a}getCssVar(){return this.cssVar}getStyleString(){if(this.cssVar===null){if(this.hex&&this.getOpacity()===P.a){return this.hex}const{h:e,s:t,l:s,a:i}=this.value;return`hsla(${e}, ${t}%, ${s}%, ${i})`}else{let e=this.cssVar;if(this.value.a!==P.a){e=e+"-opacity-"+String(this.value.a).replace(".","_")}return`var(${e})`}}getStyleStringForOpacity(){const{h:e,s:t,l:s}=this.value;return`linear-gradient(to right, hsla(${e}, ${t}%, ${s}%, 0) 0%, hsla(${e}, ${t}%, ${s}%, 1) 100%)`}static compare(e,t){return e.getHsla().h===t.getHsla().h&&e.getHsla().s===t.getHsla().s&&e.getHsla().l===t.getHsla().l&&e.getHsla().a===t.getHsla().a&&e.cssVar===t.cssVar}static getMedian(e,t){return new B({h:(e.getHsla().h+t.getHsla().h)/2,s:(e.getHsla().s+t.getHsla().s)/2,l:(e.getHsla().l+t.getHsla().l)/2,a:(e.getHsla().a+t.getHsla().a)/2})}getContrast(){let e=60;let t=this.getHsl().h*Math.PI/180;e+=Math.sin(t)*10+5;let s=e-45*this.getHsl().l/100;return new B(this.value).setValue({l:(this.getHsl().l+s)%100})}getLighten(){let{h:e,s:t,l:s}=this.getHsl();if(t>0){t+=(s-50)/100*60;t=Math.min(100,Math.max(0,s))}s+=10+20*s/100;s=Math.min(100,s);return new B({h:e,s:t,l:s})}}let k=e=>e,D;class x extends n.EventEmitter{constructor(e){super();this.cache=new u.Cache.MemoryCache;this.property="color";this.options=e;this.pseudoClass=null;this.setEventNamespace("BX.Landing.UI.Field.Processor.BaseProcessor")}getProperty(){return u.Type.isArray(this.property)?this.property:[this.property]}getVariableName(){return u.Type.isArray(this.variableName)?this.variableName:[this.variableName]}isNullValue(e){return u.Type.isNull(e)}getNullValue(){return new B}getPseudoClass(){return this.pseudoClass}getLayout(){return this.cache.remember("layout",(()=>this.buildLayout()))}buildLayout(){return u.Tag.render(D||(D=k`<div>Base processor</div>`))}getClassName(){return[this.className]}getValue(){}getStyle(){if(u.Type.isNull(this.getValue())){return{[this.getVariableName()]:null}}return{[this.getVariableName()]:this.getValue().getStyleString()}}setProcessorValue(e){const t=this.getVariableName()[this.getVariableName().length-1];this.cache.delete("value");this.setValue(e[t])}setDefaultValue(e){if(!u.Type.isNull(e)){const t=this.getProperty()[this.getProperty().length-1];if(t in e){this.setValue(e[t]);this.cache.delete("value");this.unsetActive();return}}this.setValue(null);this.cache.set("value",null)}setValue(e){}onReset(){this.emit("onReset")}unsetActive(){}onChange(){this.cache.delete("value");this.emit("onChange")}defineActiveControl(e,t){}setActiveControl(e){}prepareProcessorValue(e,t,s){return e}}let F=e=>e,G;class M extends n.EventEmitter{constructor(e){super();this.cache=new u.Cache.MemoryCache}getLayout(){return this.cache.remember("layout",(()=>this.buildLayout()))}buildLayout(){return u.Tag.render(G||(G=F`
			<div class="landing-ui-field-base-control">
				Base control
			</div>
		`))}getValue(){return this.cache.remember("value",(()=>new B))}isNeedSetValue(e){return e!==this.getValue()}setValue(e){this.cache.set("value",e)}onChange(e){this.cache.delete("value");this.emit("onChange",{color:this.getValue()})}setActive(){u.Dom.addClass(this.getLayout(),M.ACTIVE_CLASS)}unsetActive(){u.Dom.removeClass(this.getLayout(),M.ACTIVE_CLASS)}isActive(){return u.Dom.hasClass(this.getLayout(),M.ACTIVE_CLASS)}}M.ACTIVE_CLASS="active";let U=e=>e,H,$,X,z,Y;class j extends M{constructor(){super();this.setEventNamespace("BX.Landing.UI.Field.Color.Hex");this.previewMode=false;this.onInput=u.Runtime.debounce(this.onInput.bind(this),300);this.onButtonClick=this.onButtonClick.bind(this)}setPreviewMode(e){this.previewMode=!!e}buildLayout(){if(!this.previewMode){u.Event.bind(this.getInput(),"input",this.onInput);u.Event.bind(this.getButton(),"click",this.onButtonClick)}this.adjustColors(j.DEFAULT_COLOR,j.DEFAULT_BG);return u.Tag.render(H||(H=U`
			<div class="landing-ui-field-color-hex">
				${0}
				${0}
			</div>
		`),this.getInput(),this.getButton())}getInput(){return this.cache.remember("input",(()=>this.previewMode?u.Tag.render($||($=U`<div class="landing-ui-field-color-hex-preview">${0}</div>`),j.DEFAULT_TEXT):u.Tag.render(X||(X=U`<input type="text" name="hexInput" value="${0}" class="landing-ui-field-color-hex-input">`),j.DEFAULT_TEXT)))}getButton(){return this.cache.remember("editButton",(()=>this.previewMode?u.Tag.render(z||(z=U`
					<svg class="landing-ui-field-color-hex-preview-btn" width="9" height="9" xmlns="http://www.w3.org/2000/svg">
						<path
							d="M7.108 0l1.588 1.604L2.486 7.8.896 6.194 7.108 0zM.006 8.49a.166.166 0 00.041.158.161.161 0 00.16.042l1.774-.478L.484 6.715.006 8.49z"
							fill="#525C69"
							fill-rule="evenodd"/>
					</svg>`)):u.Tag.render(Y||(Y=U`
					<svg class="landing-ui-field-color-hex-preview-btn" width="12" height="9" xmlns="http://www.w3.org/2000/svg">
						<path
							d="M4.27 8.551L.763 5.304 2.2 3.902l2.07 1.846L9.836.533l1.439 1.402z"
							fill="#525C69"
							fill-rule="evenodd"/>
					</svg>`))))}onInput(){let e=this.getInput().value.replace(/[^\da-f]/gi,"");e=e.substring(0,6);this.getInput().value="#"+e.toLowerCase();this.onChange()}onButtonClick(){this.onChange();this.emit("onButtonClick",{color:this.getValue()})}onChange(e){const t=this.getInput().value.length===7&&m(this.getInput().value)?new B(this.getInput().value):null;this.setValue(t);this.cache.delete("value");this.emit("onChange",{color:t})}adjustColors(e,t){u.Dom.style(this.getInput(),"background-color",t);u.Dom.style(this.getInput(),"color",e);u.Dom.style(this.getButton().querySelector("path"),"fill",e)}focus(){if(!this.previewMode){if(this.getValue()===null){this.getInput().value="#"}this.getInput().focus()}}unFocus(){if(!this.previewMode){this.getInput().blur()}}getValue(){return this.cache.remember("value",(()=>this.getInput().value===j.DEFAULT_TEXT?null:new B(this.getInput().value)))}setValue(e){if(this.isNeedSetValue(e)){super.setValue(e);if(e!==null){this.adjustColors(e.getContrast().getHex(),e.getHex());this.setActive()}else{this.adjustColors(j.DEFAULT_COLOR,j.DEFAULT_BG);this.unsetActive()}if(this.previewMode){this.getInput().innerText=e!==null?e.getHex():j.DEFAULT_TEXT}else if(h.PageObject.getRootWindow().document.activeElement!==this.getInput()){this.getInput().value=e!==null?e.getHex():j.DEFAULT_TEXT}}}setActive(){u.Dom.addClass(this.getInput(),j.ACTIVE_CLASS)}unsetActive(){u.Dom.removeClass(this.getInput(),j.ACTIVE_CLASS)}isActive(){return u.Dom.hasClass(this.getInput(),j.ACTIVE_CLASS)}}j.DEFAULT_TEXT="#HEX";j.DEFAULT_COLOR="#000000";j.DEFAULT_BG="#eeeeee";let W=e=>e,Z,q;class K extends M{static getDefaultSaturation(){const e=window.top.document.location.saturation;const t=new URL(window.top.document.location).searchParams.get("saturation");const s=e||t||K.DEFAULT_SATURATION;window.top.document.body.style.setProperty("--saturation",s+"%");return parseInt(s)}constructor(e){super();this.setEventNamespace("BX.Landing.UI.Field.Color.Spectrum");this.onPickerDragStart=this.onPickerDragStart.bind(this);this.onPickerDragMove=this.onPickerDragMove.bind(this);this.onPickerDragEnd=this.onPickerDragEnd.bind(this);this.onScroll=this.onScroll.bind(this);this.document=h.PageObject.getRootWindow().document;this.scrollContext=e.contentRoot;u.Event.bind(this.getLayout(),"mousedown",this.onPickerDragStart)}buildLayout(){return u.Tag.render(Z||(Z=W`
			<div class="landing-ui-field-color-spectrum">
				${0}
			</div>
		`),this.getPicker())}getPicker(){return this.cache.remember("picker",(()=>u.Tag.render(q||(q=W`<div class="landing-ui-field-color-spectrum-picker"></div>`))))}getPickerPos(){return{x:u.Text.toNumber(u.Dom.style(this.getPicker(),"left")),y:u.Text.toNumber(u.Dom.style(this.getPicker(),"top"))}}onPickerDragStart(e){if(e.ctrlKey||e.metaKey||e.button){return}u.Event.bind(this.scrollContext,"scroll",this.onScroll);u.Event.bind(this.document,"mousemove",this.onPickerDragMove);u.Event.bind(this.document,"mouseup",this.onPickerDragEnd);u.Dom.addClass(this.document.body,"landing-ui-field-color-draggable");this.onScroll();this.showPicker();this.onPickerDragMove(e)}onPickerDragMove(e){if(e.target===this.getPicker()){return}this.setPickerPos(e.pageX,e.pageY);this.onChange()}onPickerDragEnd(){u.Event.unbind(this.scrollContext,"scroll",this.onScroll);u.Event.unbind(this.document,"mousemove",this.onPickerDragMove);u.Event.unbind(this.document,"mouseup",this.onPickerDragEnd);u.Dom.removeClass(this.document.body,"landing-ui-field-color-draggable")}onScroll(){this.cache.delete("layoutSize")}getLayoutRect(){return this.cache.remember("layoutSize",(()=>{const e=this.getLayout().getBoundingClientRect();return{width:e.width,height:e.height,top:e.top,left:e.left}}))}setPickerPos(e,t){const{width:s,height:i,top:a,left:r}=this.getLayoutRect();let n=Math.min(Math.max(e-r,0),s);n=n>s/K.HUE_RANGE*K.HUE_RANGE_GRAY_THRESHOLD?s/K.HUE_RANGE*K.HUE_RANGE_GRAY_MIDDLE:n;u.Dom.style(this.getPicker(),{left:`${n}px`,top:`${Math.min(Math.max(t-a,0),i)}px`})}getValue(){return this.cache.remember("value",(()=>{if(u.Dom.hasClass(this.getPicker(),K.HIDE_CLASS)){return null}const e=this.getLayout().getBoundingClientRect().width;const t=this.getPickerPos().x/e*K.HUE_RANGE;const s=this.getLayout().getBoundingClientRect().height;const i=(1-this.getPickerPos().y/s)*100;if(isNaN(t)||isNaN(i)){return null}return new B({h:Math.min(t,K.HUE_RANGE_GRAY_THRESHOLD),s:t>=K.HUE_RANGE_GRAY_THRESHOLD?0:K.getDefaultSaturation(),l:i})}))}setValue(e){super.setValue(e);if(e!==null&&K.isSpectrumValue(e)){const{h:t,s:s,l:i}=e.getHsl();const a=s===0?K.HUE_RANGE_GRAY_MIDDLE/K.HUE_RANGE*100:t/K.HUE_RANGE*100;u.Dom.style(this.getPicker(),"left",`${a}%`);const r=100-i;u.Dom.style(this.getPicker(),"top",`${r}%`);this.showPicker()}else{this.hidePicker()}}hidePicker(){u.Dom.addClass(this.getPicker(),K.HIDE_CLASS)}showPicker(){u.Dom.removeClass(this.getPicker(),K.HIDE_CLASS)}isActive(){return this.getValue()!==null&&K.isSpectrumValue(this.getValue())}static isSpectrumValue(e){return e!==null&&(e.getHsl().s===K.getDefaultSaturation()||e.getHsl().s===0)}}K.DEFAULT_SATURATION=100;K.HUE_RANGE=375;K.HUE_RANGE_GRAY_THRESHOLD=360;K.HUE_RANGE_GRAY_MIDDLE=367;K.HIDE_CLASS="hidden";let J=e=>e,Q,ee;class te extends n.EventEmitter{constructor(){super();this.cache=new u.Cache.MemoryCache;this.setEventNamespace("BX.Landing.UI.Field.Color.Recent")}getLayout(){this.initItems();return this.getLayoutContainer()}getLayoutContainer(){return this.cache.remember("layout",(()=>u.Tag.render(Q||(Q=J`<div class="landing-ui-field-color-recent"></div>`))))}initItems(){if(te.itemsLoaded){this.buildItemsLayout()}else{l.Backend.getInstance().action("Utils::getUserOption",{name:te.USER_OPTION_NAME}).then((e=>{if(e&&u.Type.isString(e.items)){te.items=[];e.items.split(",").forEach((e=>{if(m(e)&&te.items.length<te.MAX_ITEMS){te.items.push(e)}}));te.itemsLoaded=true;this.buildItemsLayout()}}))}}buildItemsLayout(){u.Dom.clean(this.getLayoutContainer());te.items.forEach((e=>{if(m(e)){let t=u.Tag.render(ee||(ee=J`<div 
					class="landing-ui-field-color-recent-item" 
					style="background:${0}"
					data-value="${0}"
				></div>`),e,e);u.Event.bind(t,"click",(()=>this.onItemClick(event)));u.Dom.append(t,this.getLayoutContainer())}}));return this}onItemClick(e){this.emit("onChange",{hex:e.currentTarget.dataset.value})}addItem(e){if(m(e)){let t=te.items.indexOf(e);if(t!==-1){te.items.splice(t,1)}te.items.unshift(e);if(te.items.length>te.MAX_ITEMS){te.items.splice(te.MAX_ITEMS)}this.buildItemsLayout();this.saveItems()}return this}saveItems(){if(te.items.length>0){BX.userOptions.save("landing",te.USER_OPTION_NAME,"items",te.items)}return this}}te.USER_OPTION_NAME="color_field_recent_colors";te.MAX_ITEMS=6;te.items=[];te.itemsLoaded=false;let se=e=>e,ie,ae,re,ne;class oe extends M{constructor(e){super();this.setEventNamespace("BX.Landing.UI.Field.Color.Colorpicker");this.popupId="colorpicker_popup_"+u.Text.getRandom();this.popupTargetContainer=e.contentRoot;this.hexPreview=new j;this.hexPreview.setPreviewMode(true);u.Event.bind(this.hexPreview.getLayout(),"click",this.onPopupOpenClick.bind(this));this.hex=new j;this.hex.subscribe("onChange",this.onHexChange.bind(this));this.hex.subscribe("onButtonClick",this.onSelectClick.bind(this));this.spectrum=new K(e);this.spectrum.subscribe("onChange",this.onSpectrumChange.bind(this));this.recent=new te;this.recent.subscribe("onChange",this.onRecentChange.bind(this));u.Event.bind(this.getCancelButton(),"click",this.onCancelClick.bind(this));u.Event.bind(this.getSelectButton(),"click",this.onSelectClick.bind(this));this.previously=this.getValue()}onSelectClick(e){const t=e instanceof n.BaseEvent?e.getData().color:this.getValue();if(t!==null){this.recent.addItem(this.getValue().getHex())}this.getPopup().close()}buildLayout(){return u.Tag.render(ie||(ie=se`
			<div class="landing-ui-field-color-colorpicker">
				${0}
			</div>
		`),this.hexPreview.getLayout())}getPopupContent(){return u.Tag.render(ae||(ae=se`
			<div class="landing-ui-field-color-popup-container">
				<div class="landing-ui-field-color-popup-head">
					${0}
					${0}
				</div>
				${0}
				<div class="landing-ui-field-color-popup-footer">
					${0}
					${0}
				</div>
			</div>
		`),this.recent.getLayout(),this.hex.getLayout(),this.spectrum.getLayout(),this.getSelectButton(),this.getCancelButton())}getSelectButton(){return this.cache.remember("selectButton",(()=>u.Tag.render(re||(re=se`
				<button class="ui-btn ui-btn-xs ui-btn-primary">
					${0}
				</button>
			`),u.Loc.getMessage("LANDING_FIELD_COLOR-BUTTON_SELECT"))))}getCancelButton(){return this.cache.remember("cancelButton",(()=>u.Tag.render(ne||(ne=se`
				<button class="ui-btn ui-btn-xs ui-btn-light-border">
					${0}
				</button>
			`),u.Loc.getMessage("LANDING_FIELD_COLOR-BUTTON_CANCEL"))))}getHexPreviewObject(){return this.hexPreview}getPopup(){return this.cache.remember("popup",(()=>i.PopupManager.create({id:this.popupId,className:"landing-ui-field-color-spectrum-popup",autoHide:true,bindElement:this.hexPreview.getLayout(),bindOptions:{forceTop:true,forceLeft:true},padding:0,contentPadding:14,width:260,offsetTop:-37,offsetLeft:-180,content:this.getPopupContent(),closeByEsc:true,targetContainer:this.popupTargetContainer})))}getValue(){return this.cache.remember("value",(()=>this.spectrum.getValue()))}onHexChange(e){this.setValue(e.getData().color);this.onChange(e)}onSpectrumChange(e){this.hex.unFocus();this.setValue(e.getData().color);this.onChange(e)}onRecentChange(e){const t=new B(e.getData().hex);this.setValue(t);this.onChange(new n.BaseEvent({data:{color:t}}))}onCancelClick(){this.setValue(this.previously);this.getPopup().close();this.onChange(new n.BaseEvent({data:{color:this.getValue()}}))}onPopupOpenClick(){this.recent.buildItemsLayout();this.previously=this.getValue();this.getPopup().show();if(this.getPopup().isShown()){this.hex.focus()}}setValue(e){if(this.isNeedSetValue(e)){super.setValue(e);this.spectrum.setValue(e);this.hex.setValue(e);this.hexPreview.setValue(e)}this.setActivity(e)}setActivity(e){if(e!==null){if(this.spectrum.isActive()){this.hex.unsetActive()}else{this.hex.setActive()}this.hexPreview.setActive()}}unsetActive(){this.hex.unsetActive();this.hexPreview.unsetActive()}isActive(){return this.hex.isActive()||this.hexPreview.isActive()}}let le=e=>e,ce;class he extends n.EventEmitter{constructor(e={}){super();this.cache=new u.Cache.MemoryCache;this.setEventNamespace("BX.Landing.UI.Field.Color.Primary");u.Event.bind(this.getLayout(),"click",(()=>this.onClick()));if(e.content&&e.content==="var(--primary)"){this.setActive()}}getLayout(){return this.cache.remember("layout",(()=>u.Tag.render(ce||(ce=le`
				<div class="landing-ui-field-color-primary">
					<i class="landing-ui-field-color-primary-preview"></i>
					<span class="landing-ui-field-color-primary-text">
						${0}
					</span>
				</div>
			`),u.Loc.getMessage("LANDING_FIELD_COLOR-PRIMARY_TITLE"))))}getValue(){return this.cache.remember("value",(()=>new B(he.CSS_VAR)))}onClick(){this.setActive();this.emit("onChange",{color:this.getValue()})}setActive(){u.Dom.addClass(this.getLayout(),he.ACTIVE_CLASS)}unsetActive(){u.Dom.removeClass(this.getLayout(),he.ACTIVE_CLASS)}isActive(){return u.Dom.hasClass(this.getLayout(),he.ACTIVE_CLASS)}isPrimaryValue(e){return e!==null&&this.getValue().getCssVar()===e.getCssVar()}}he.ACTIVE_CLASS="active";he.CSS_VAR="--primary";function ue(e){return new RegExp(ge(e))}function ge(e){return e.source.replace(/(^\^)|(\$$)/g,"")}const de=/^(linear|radial)-gradient\(.*\)$/i;const pe=/^(linear|radial)-gradient\(.*?((\d)+deg).*?\)$/gi;const me=ge(p);const ve=new RegExp("((rgba|hsla)?\\([\\d% .,]+\\)|transparent|"+me+")+","ig");function fe(e){return!!e.trim().match(de)}class be{constructor(e){this.value={from:new B("#ffffff"),to:new B(he.CSS_VAR),angle:be.DEFAULT_ANGLE,type:be.DEFAULT_TYPE};this.setValue(e)}getName(){return this.value.from.getName()+"_"+this.value.to.getName()+"_"+this.getAngle()+"_"+this.getType()}setValue(e){if(u.Type.isObject(e)){if(e instanceof be){this.value.from=new B(e.getFrom());this.value.to=new B(e.getTo());this.value.angle=e.getAngle();this.value.type=e.getType()}else{if("from"in e){this.value.from=new B(e.from)}if("to"in e){this.value.to=new B(e.to)}if("angle"in e){this.value.angle=u.Text.toNumber(e.angle)}if("type"in e){this.value.type=e.type}}}else if(u.Type.isString(e)&&fe(e)){this.parseGradientString(e)}return this}setOpacity(e){this.value.from.setOpacity(e);this.value.to.setOpacity(e);return this}parseGradientString(e){const t=e.trim().match(de);if(!!t){this.setValue({type:t[1]})}const s=e.trim().match(pe);if(!!s){this.setValue({angle:s[2]})}const i=e.trim().match(ve);if(i&&i.length>0){this.setValue({from:new B(i[0])});this.setValue({to:new B(i[i.length-1])})}}getFrom(){return this.value.from}getTo(){return this.value.to}getAngle(){return this.value.angle}setAngle(e){if(u.Type.isNumber(e)){this.value.angle=Math.min(Math.max(e,0),360)}return this}getType(){return this.value.type}setType(e){if(e===be.TYPE_RADIAL||e===be.TYPE_LINEAR){this.value.type=e}return this}getOpacity(){var e;return(e=(this.value.from.getOpacity()+this.value.to.getOpacity())/2)!=null?e:P.a}getStyleString(){const e=this.value.angle;const t=this.value.type;const s=this.value.from.getStyleString();const i=this.value.to.getStyleString();return t==="linear"?`linear-gradient(${e}deg, ${s} 0%, ${i} 100%)`:`radial-gradient(circle farthest-side at 50% 50%, ${s} 0%, ${i} 100%)`}getStyleStringForOpacity(){return`radial-gradient(at top left, ${this.value.from.getHex()}, transparent)`+`, radial-gradient(at bottom left, ${this.value.to.getHex()}, transparent)`}static compare(e,t,s=true){const i=B.compare(e.getFrom(),t.getFrom())&&B.compare(e.getTo(),t.getTo())||B.compare(e.getTo(),t.getFrom())&&B.compare(e.getFrom(),t.getTo());const a=s?e.getAngle()===t.getAngle()&&e.getType()===t.getType():true;return i&&a}}be.TYPE_RADIAL="radial";be.TYPE_LINEAR="linear";be.DEFAULT_ANGLE=180;be.DEFAULT_TYPE="linear";const ye="color";const Ce="gradient";class Ae{static getDefaultPresets(){return Ae.cache.remember("default",(()=>{const e=[];Ae.defaultPresets.forEach((t=>{e.push({id:t.id,type:"color",items:t.items.map((e=>new B(C(e))))})}));return e}))}static getPrimaryColorPreset(){return this.cache.remember("primary",(()=>{const e={id:"defaultPrimary",items:[]};const t=new B(u.Dom.style(document.documentElement,"--primary").trim());e.items.push(new B(t));if(t.getHsl().s<=10){const s=t.getHsl().l>50?Math.ceil(t.getHsl().l/100*5):Math.floor(t.getHsl().l/100*5);const i=5-s;const a=t.getHsl().l/(s+1);const r=(100-t.getHsl().l)/(i+1);for(let i=1;i<=s;i++){e.items.push(new B(t).darken(a*i))}for(let s=1;s<=i;s++){e.items.push(new B(t).lighten(r*s))}const n=15;const o=15;const l=new B(Ae.BITRIX_COLOR);e.items[6]=new B(l);e.items[7]=new B(l.darken(n).saturate(o));e.items[8]=new B(l.darken(n).saturate(o));l.lighten(n*2).desaturate(o*2);e.items[9]=new B(l.lighten(n).desaturate(o));e.items[10]=new B(l.lighten(n).desaturate(o));l.darken(n*2).saturate(o*2);e.items[11]=new B(l).adjustHue(180)}else{const s=(90-t.getHsl().l)/3;const i=(t.getHsl().l-10)/3;const a=(90-t.getHsl().s)/3;const r=(t.getHsl().s-10)/3;e.items[1]=new B(t.darken(i).saturate(a));e.items[2]=new B(t.darken(i).saturate(a));e.items[3]=new B(t.darken(i).saturate(a));t.lighten(i*3).desaturate(a*3);e.items[4]=new B(t.desaturate(r).lighten(s));e.items[5]=new B(t.desaturate(r).lighten(s));e.items[11]=new B(t.desaturate(r).lighten(s));t.saturate(r*3).darken(s*3);e.items[7]=new B(t.adjustHue(40));e.items[8]=new B(t.adjustHue(-80));e.items[9]=new B(t.adjustHue(180));e.items[6]=new B(t.adjustHue(40));e.items[10]=new B(t.adjustHue(40))}return e}))}static getBlackAndWhitePreset(){return this.cache.remember("blackAndWhite",(()=>{const e={id:"blackAndWhite",items:[]};const t=new B("#ffffff");e.items.push(new B(t));e.items.push(new B(t.darken(14.28)));e.items.push(new B(t.darken(14.28)));e.items.push(new B(t.darken(14.28)));e.items.push(new B(t.darken(14.28)));e.items.push(new B(t.darken(14.28)));e.items.push(new B(t.darken(14.28)));e.items.push(new B(t.darken(14.32)));return e}))}static getGradientByColorOptions(e){const t=[];const s=[[1,2],[1,4],[5,12],[1,8],[8,9],[1,9],[10,7],[7,11]];s.forEach((s=>{t.push(new be({from:new B(e.items[s[0]-1]),to:new B(e.items[s[1]-1]),angle:be.DEFAULT_ANGLE,type:be.DEFAULT_TYPE}))}));return{type:Ce,items:t}}}Ae.BITRIX_COLOR="#2fc6f6";Ae.cache=new u.Cache.MemoryCache;Ae.defaultPresets=[{id:"agency",items:["#ff6366","#40191a","#803233","#bf4b4d","#e65a5c","#ffc1c2","#363643","#57dca3","#ee76ba","#ffa864","#eaeaec","#fadbdc"]},{id:"accounting",items:["#a5c33c","#384215","#6f8228","#8fa834","#b0cf40","#dae6ae","#4c4c4c","#5d84e6","#cd506b","#fe6466","#dfdfdf","#e9f0cf"]},{id:"app",items:["#4fd2c2","#1f524c","#379187","#46b8aa","#54dece","#c8f1ec","#6639b6","#e81c62","#9a69ca","#6279d8","#ffc337","#e9faf8"]},{id:"architecture",items:["#c94645","#4a1919","#8a2f2f","#b03c3c","#d64949","#eec3c3","#363643","#446d90","#a13773","#c98145","#eaeaec","#f9e8e7"]},{id:"business",items:["#3949a0","#232c61","#313e87","#3e4fad","#556ced","#d8d7dc","#14122c","#1d1937","#a03949","#2f295a","#c87014","#f4f4f5"]},{id:"charity",items:["#f5f219","#f58419","#f5cc19","#a8e32a","#f9f76a","#fcfbb6","#000000","#262e37","#74797f","#e569b1","#edeef0","#fefedf"]},{id:"construction",items:["#f7b70b","#382a02","#785905","#b88907","#dea509","#fdf1d1","#111111","#a3a3a3","#f7410b","#f70b4b","#d6dde9","#fef9ea"]},{id:"consulting",items:["#21a79b","#38afa5","#14665f","#1c8c83","#30f2e2","#a9ddd9","#ec4672","#58d400","#f0ac00","#2d6faf","#2da721","#e6f5f4"]},{id:"corporate",items:["#6ab8ee","#31556e","#4e86ad","#5fa3d4","#70c1fa","#d2e9f8","#36e2c0","#ffaa3c","#ee6a76","#ffa468","#5feb99","#ebf4fb"]},{id:"courses",items:["#6bda95","#2c593d","#4b9969","#5ebf83","#70e69d","#c2f0d3","#31556e","#ff947d","#738ed3","#f791ab","#ffb67d","#e2f8eb"]},{id:"event",items:["#f73859","#380d14","#781c2b","#b82a42","#de334f","#fdbbc6","#151726","#ffb553","#30d59b","#b265e0","#edeef0","#ffeaed"]},{id:"gym",items:["#6b7de0","#2f3661","#4d5aa1","#5f6fc7","#7284ed","#e4e8fa","#333333","#ffd367","#a37fe8","#e06b7d","#6dc1e0","#f4f6fd"]},{id:"lawyer",items:["#e74c3c","#69231b","#a8382c","#cf4536","#f55240","#f9d0cb","#4e4353","#5a505e","#e7863c","#38a27f","#e2e1e3","#fdeeec"]},{id:"photography",items:["#f7a700","#382600","#785200","#b87d00","#de9800","#fde8ba","#333333","#0b5aa0","#e93d18","#06c4ed","#3672a8","#fff6e3"]},{id:"restaurant",items:["#e6125d","#660829","#a60d43","#cc1052","#f21361","#facfde","#0eb88e","#00946f","#e04292","#9b12e6","#bfde00","#fef2f6"]},{id:"shipping",items:["#ff0000","#400000","#800000","#bf0000","#e60000","#ffb4b4","#333333","#ff822a","#d63986","#00ac6b","#ffb800","#fff3f3"]},{id:"spa",items:["#9dba04","#313b01","#667a02","#86a103","#a6c704","#e4ecb9","#ba7c04","#cf54bb","#049dba","#1d7094","#eead2f","#f2f6dd"]},{id:"travel",items:["#ee4136","#6e1f19","#ad3128","#d43c31","#fa4639","#fef1f0","#31353e","#3e434d","#ee8036","#428abc","#eaebec","#c3c4c7"]},{id:"wedding",items:["#d65779","#572431","#963e55","#bd4d6b","#e35d81","#f7dfe5","#af58a7","#6bc34b","#ec8c60","#50a098","#57b9d6","#fdf4f6"]}];let Le=e=>e,Te,Ee;class Ve extends n.EventEmitter{constructor(e){super();this.cache=new u.Cache.MemoryCache;this.setEventNamespace("BX.Landing.UI.Field.Color.Preset");this.id=e.id;this.type=e.type||ye;this.items=e.items;this.activeItem=null}getId(){return this.id}getGradientPreset(){const e=this.type===Ce?{type:Ce,items:this.items}:Ae.getGradientByColorOptions({items:this.items});return new Ve(e)}getLayout(){return this.cache.remember("layout",(()=>u.Tag.render(Te||(Te=Le`
				<div class="landing-ui-field-color-preset">
					${0}
				</div>
			`),this.items.map((e=>this.getItemLayout(e.getName()))))))}getItemLayout(e){return this.cache.remember(e,(()=>{const t=this.getItemByName(e);const s=u.Type.isString(t)?t:t.getStyleString();const i=u.Tag.render(Ee||(Ee=Le`
				<div
					class="landing-ui-field-color-preset-item"
					style="background: ${0}"
					data-name="${0}"
				></div>
			`),s,e);u.Event.bind(i,"click",this.onItemClick.bind(this));return i}))}getItemByName(e){return this.items.find((t=>e===t.getName()))||null}isPresetValue(e){if(e===null){return false}return this.items.some((t=>{if(t instanceof B&&e instanceof B){return B.compare(t,new B(e).setOpacity(1))}else if(t instanceof be&&e instanceof be){return be.compare(t,e,false)}return false}))}onItemClick(e){this.setActiveItem(e.currentTarget.dataset.name);let t=null;if(this.activeItem!==null){t=this.activeItem instanceof be?new be(this.activeItem):new B(this.activeItem)}this.emit("onChange",{color:t})}setActiveItem(e){this.activeItem=this.getItemByName(e);this.items.forEach((t=>{const s=t.getName();if(e===s){u.Dom.addClass(this.getItemLayout(s),Ve.ACTIVE_CLASS)}else{u.Dom.removeClass(this.getItemLayout(s),Ve.ACTIVE_CLASS)}}))}setActiveValue(e){if(e!==null){if(e instanceof be){this.setActiveItem(new be(e).setAngle(be.DEFAULT_ANGLE).setType(be.DEFAULT_TYPE).getName())}else{this.setActiveItem(new B(e).setOpacity(1).getName())}}}unsetActive(){this.items.forEach((e=>{u.Dom.removeClass(this.getItemLayout(e.getName()),Ve.ACTIVE_CLASS)}))}isActive(){return this.items.some((e=>u.Dom.hasClass(this.getItemLayout(e.getName()),Ve.ACTIVE_CLASS)))}}Ve.ACTIVE_CLASS="active";let Ie=e=>e,_e,Se,Pe,Ne,we;class Re extends n.EventEmitter{constructor(e){super();this.presets={};this.activeId=null;this.cache=new u.Cache.MemoryCache;this.setEventNamespace("BX.Landing.UI.Field.Color.PresetCollection");this.popupId="presets-popup_"+u.Text.getRandom();this.popupTargetContainer=e.contentRoot;this.onPresetClick=this.onPresetClick.bind(this);u.Event.bind(this.getOpenButton(),"click",(()=>{this.getPopup().toggle()}));this.onPresetChangeGlobal=this.onPresetChangeGlobal.bind(this);n.EventEmitter.subscribe("BX.Landing.UI.Field.Color.PresetCollection:onChange",this.onPresetChangeGlobal)}addDefaultPresets(){this.addPreset(Ae.getPrimaryColorPreset());Ae.getDefaultPresets().map((e=>{this.addPreset(e)}))}addPreset(e){this.cache.delete("popupLayout");if(!Object.keys(this.presets).length||!(e.id in this.presets)){this.presets[e.id]=e}}getGlobalActiveId(){return Re.globalActiveId}getActiveId(){return this.getGlobalActiveId()||this.getDefaultPreset().getId()}getActivePreset(){return this.getPresetById(this.getActiveId())}getDefaultPreset(){return Object.keys(this.presets).length?this.getPresetById(Object.keys(this.presets)[0]):null}getPresetById(e){if(e in this.presets){return this.cache.remember(e,(()=>new Ve(this.presets[e])))}else{return null}}getPresetByItemValue(e){if(e===null){return null}for(let t in this.presets){const s=this.getPresetById(t);if(s&&e instanceof B){if(s.isPresetValue(e)){return s}}else if(s&&e instanceof be){if(s.getGradientPreset().isPresetValue(e)){return s}}}return null}getLayout(){return this.cache.remember("value",(()=>u.Tag.render(_e||(_e=Ie`
				<div class="landing-ui-field-color-presets">
					<div class="landing-ui-field-color-presets-left">
						<span class="landing-ui-field-color-presets-title">
							${0}
						</span>
					</div>
					<div class="landing-ui-field-color-presets-right">${0}</div>
				</div>
			`),u.Loc.getMessage("LANDING_FIELD_COLOR-PRESETS_TITLE"),this.getOpenButton())))}getOpenButton(){return this.cache.remember("openButton",(()=>u.Tag.render(Se||(Se=Ie`<span class="landing-ui-field-color-presets-open">
				${0}
			</span>`),u.Loc.getMessage("LANDING_FIELD_COLOR-PRESETS_MORE"))))}getTitleContainer(){return this.cache.remember("titleContainer",(()=>this.getLayout().querySelector(".landing-ui-field-color-presets-left")))}getPopup(){return this.cache.remember("popup",(()=>i.PopupManager.create({id:this.popupId,className:"presets-popup",autoHide:true,bindElement:this.getOpenButton(),bindOptions:{forceTop:true,forceLeft:true},width:280,offsetLeft:-200,content:this.getPopupLayout(),closeByEsc:true,targetContainer:this.popupTargetContainer})))}getPopupLayout(){return this.cache.remember("popupLayout",(()=>{const e=u.Tag.render(Pe||(Pe=Ie`<div class="landing-ui-field-color-presets-popup">
				<div class="landing-ui-field-color-presets-popup-title">
					${0}
				</div>
				<div class="landing-ui-field-color-presets-popup-inner"></div>
			</div>`),u.Loc.getMessage("LANDING_FIELD_COLOR-PRESETS_MORE_COLORS"));const t=e.querySelector(".landing-ui-field-color-presets-popup-inner");for(const e in this.presets){const s=this.getPresetLayout(e);if(e===this.getActiveId()){u.Dom.addClass(s,Re.ACTIVE_CLASS);this.activeId=e}u.Event.bind(s,"click",this.onPresetClick);u.Dom.append(s,t)}return e}))}getPresetLayout(e){return this.cache.remember(e+"layout",(()=>u.Tag.render(Ne||(Ne=Ie`
				<div class="landing-ui-field-color-presets-preset" data-id="${0}">
					${0}
				</div>
			`),e,this.presets[e].items.map((e=>u.Tag.render(we||(we=Ie`<div
								class="landing-ui-field-color-presets-preset-item"
								style="background: ${0}"
							></div>`),u.Type.isString(e)?e:e.getStyleString()))))))}onPresetClick(e){this.getPopup().close();this.setActiveItem(e.currentTarget.dataset.id);this.emit("onChange",{presetId:this.getActiveId()})}onPresetChangeGlobal(e){if(e.getData().presetId!==this.activeId){this.setActiveItem(e.getData().presetId);this.emit("onChange",e)}}setActiveItem(e){if(e!==null&&e!==this.activeId){Re.globalActiveId=e;this.activeId=e;for(const t in this.presets){u.Dom.removeClass(this.getPresetLayout(t),Re.ACTIVE_CLASS);if(t===e){u.Dom.addClass(this.getPresetLayout(t),Re.ACTIVE_CLASS)}}}}unsetActive(){for(const e in this.presets){u.Dom.removeClass(this.getPresetLayout(e),Re.ACTIVE_CLASS)}}}Re.globalActiveId=null;Re.ACTIVE_CLASS="active";let Oe=e=>e,Be;class ke extends n.EventEmitter{constructor(e){super();this.options=e;this.cache=new u.Cache.MemoryCache;this.setEventNamespace("BX.Landing.UI.Field.Color.Reset");u.Event.bind(this.getLayout(),"click",(()=>this.onClick()));const t=BX.UI.Hint.createInstance({popupParameters:{targetContainer:e.contentRoot,padding:0}});t.init(this.getLayout())}getLayout(){if(this.options&&!this.options.styleNode){return null}return this.cache.remember("layout",(()=>u.Tag.render(Be||(Be=Oe`
				<div class="landing-ui-field-color-reset-container">
					<div class="landing-ui-field-color-reset"
						data-hint="${0}"
						data-hint-no-icon
					>
					</div>
				</div>
			`),u.Loc.getMessage("LANDING_FIELD_COLOR-RESET_HINT_2"))))}onClick(){this.emit("onReset")}}let De=e=>e,xe,Fe;class Ge extends M{constructor(e){super();this.options=e;this.setEventNamespace("BX.Landing.UI.Field.Color.ColorSet");this.reset=new ke(e);this.reset.subscribe("onReset",(()=>{this.emit("onReset")}));this.blackAndWhitePreset=new Ve(Ae.getBlackAndWhitePreset());this.blackAndWhitePreset.subscribe("onChange",(e=>{this.preset.unsetActive();this.onPresetItemChange(e)}));this.colorpicker=new oe(e);this.colorpicker.subscribe("onChange",(e=>{this.preset.unsetActive();this.blackAndWhitePreset.unsetActive();const t=e.getData().color;if(this.preset.isPresetValue(t)){this.preset.setActiveValue(t);this.colorpicker.unsetActive()}else if(this.blackAndWhitePreset.isPresetValue(t)){this.blackAndWhitePreset.setActiveValue(t);this.colorpicker.unsetActive()}this.onChange(e)}));this.presets=new Re(e);this.presets.subscribe("onChange",(e=>{this.setPreset(this.presets.getPresetById(e.getData().presetId))}));this.presets.addDefaultPresets();const t=this.presets.getActivePreset();if(t){this.setPreset(t)}}buildLayout(){u.Dom.append(this.reset.getLayout(),this.presets.getTitleContainer());return u.Tag.render(xe||(xe=De`
			<div class="landing-ui-field-color-colorset">
				<div class="landing-ui-field-color-colorset-top">
					${0}
				</div>
				${0}
				<div class="landing-ui-field-color-colorset-bottom">
					${0}
					${0}
				</div>
			</div>
		`),this.presets.getLayout(),this.getPresetContainer(),this.blackAndWhitePreset.getLayout(),this.colorpicker.getLayout())}getTitleLayout(){return this.cache.remember("titleLayout",(()=>this.getLayout().querySelector(".landing-ui-field-color-colorset-title")))}getPresetContainer(){return this.cache.remember("presetContainer",(()=>u.Tag.render(Fe||(Fe=De`<div class="landing-ui-field-color-colorset-preset-container"></div>`))))}setPreset(e){this.preset=e;this.preset.unsetActive();if(this.getValue()!==null&&this.preset.isPresetValue(this.getValue())){this.unsetActive();this.preset.setActiveValue(this.getValue())}else{this.unsetActive();this.colorpicker.setValue(this.getValue())}if(this.getValue()===null&&this.options.content){this.setColorFromContent()}this.preset.subscribe("onChange",(e=>{this.blackAndWhitePreset.unsetActive();this.onPresetItemChange(e)}));u.Dom.clean(this.getPresetContainer());u.Dom.append(e.getLayout(),this.getPresetContainer());this.emit("onPresetChange",{preset:e})}getPreset(){return this.preset}getPresetsCollection(){return this.presets}onPresetItemChange(e){this.colorpicker.setValue(e.getData().color);this.colorpicker.unsetActive();this.onChange(e)}onChange(e){this.cache.set("value",e.getData().color);this.emit("onChange",e)}getValue(){return this.cache.remember("value",(()=>this.colorpicker.getValue()))}setValue(e){if(this.isNeedSetValue(e)){super.setValue(e);this.colorpicker.setValue(e);const t=this.presets.getGlobalActiveId()?this.presets.getPresetById(this.presets.getGlobalActiveId()):this.presets.getPresetByItemValue(e);if(t!==null){this.setPreset(t);this.presets.setActiveItem(t.getId())}if(e!==null&&this.blackAndWhitePreset.isPresetValue(e)){this.unsetActive();this.blackAndWhitePreset.setActiveValue(e)}}}unsetActive(){this.preset.unsetActive();this.blackAndWhitePreset.unsetActive();this.colorpicker.unsetActive()}isActive(){return this.preset.isActive()||this.blackAndWhitePreset.isActive()||this.colorpicker.isActive()}setColorFromContent(){const e=this.options.content;let t="";if(e.startsWith("#")){t=C(e)}if(e.startsWith("hsl")){t=V(e)}if(u.Type.isObject(t)){const e=new B({h:t.h,s:t.s,l:t.l,a:t.a});this.unsetActive();this.colorpicker.setValue(e)}}}let Me=e=>e,Ue,He,$e;class Xe extends M{constructor(e){super();this.setEventNamespace("BX.Landing.UI.Field.Color.Opacity");this.defaultOpacity=u.Type.isObject(e)&&Reflect.has(e,"defaultOpacity")?e.defaultOpacity:Xe.DEFAULT_OPACITY;this.document=h.PageObject.getRootWindow().document;this.onPickerDragStart=this.onPickerDragStart.bind(this);this.onPickerDragMove=this.onPickerDragMove.bind(this);this.onPickerDragEnd=this.onPickerDragEnd.bind(this);this.layout=this.getLayout();this.pickerControl=this.layout.querySelector(".landing-ui-field-color-opacity");this.rangeControl=this.layout.querySelector(".landing-ui-field-color-opacity-range-output");this.arrowsUp=this.rangeControl.querySelector(".landing-ui-field-color-opacity-range-output-arrows-up");this.arrowsDown=this.rangeControl.querySelector(".landing-ui-field-color-opacity-range-output-arrows-down");this.rangeInput=this.rangeControl.querySelector(".landing-ui-field-color-opacity-range-output-input");u.Event.bind(this.arrowsUp,"click",this.onArrowClick.bind(this,"up"));u.Event.bind(this.arrowsDown,"click",this.onArrowClick.bind(this,"down"));u.Event.bind(this.pickerControl,"mousedown",this.onPickerDragStart)}buildLayout(){const e=this.defaultOpacity*100;const t=u.Tag.render(Ue||(Ue=Me`
			<div class="landing-ui-field-color-opacity-container">
				<div class="landing-ui-field-color-opacity">
					${0}
					${0}
				</div>
				<div class="landing-ui-field-color-opacity-range-output">
					<div 
						class="landing-ui-field-color-opacity-range-output-input"
						title="${0}">
						${0}
					</div>
					<div class="landing-ui-field-color-opacity-range-output-arrows">
						<div class="landing-ui-field-color-opacity-range-output-arrows-up"></div>
						<div class="landing-ui-field-color-opacity-range-output-arrows-down"></div>
					</div>
				</div>
			</div>
		`),this.getPicker(),this.getColorLayout(),e,e);this.setPickerPosByOpacity(this.defaultOpacity);return t}onPickerDragStart(e){if(e.ctrlKey||e.metaKey||e.button){return}u.Event.bind(this.document,"mousemove",this.onPickerDragMove);u.Event.bind(this.document,"mouseup",this.onPickerDragEnd);u.Dom.addClass(this.document.body,"landing-ui-field-color-draggable");this.onPickerDragMove(e)}onPickerDragMove(e){if(e.target===this.getPicker()){return}this.setPickerPos(e.pageX);this.onChange();this.onRangeControlChange()}onPickerDragEnd(){u.Event.unbind(this.document,"mousemove",this.onPickerDragMove);u.Event.unbind(this.document,"mouseup",this.onPickerDragEnd);u.Dom.removeClass(this.document.body,"landing-ui-field-color-draggable")}setPickerPos(e){const t=Math.max(Math.min(e-this.getLayoutRect().left,this.getLayoutRect().width),0);u.Dom.style(this.getPicker(),{left:`${t}px`})}setPickerPosByOpacity(e){e=Math.min(1,Math.max(0,e));u.Dom.style(this.getPicker(),{left:`${e*100}%`})}getLayoutRect(){return this.cache.remember("layoutSize",(()=>{const e=this.pickerControl.getBoundingClientRect();return{width:e.width,left:e.left}}))}getColorLayout(){return this.cache.remember("colorLayout",(()=>u.Tag.render(He||(He=Me`
				<div class="landing-ui-field-color-opacity-color"></div>
			`))))}getPicker(){return this.cache.remember("picker",(()=>u.Tag.render($e||($e=Me`
				<div class="landing-ui-field-color-opacity-picker">
					<div class="landing-ui-field-color-opacity-picker-item">
						<div class="landing-ui-field-color-opacity-picker-item-circle"></div>
					</div>
				</div>`))))}getDefaultValue(){return this.cache.remember("default",(()=>new B(Xe.DEFAULT_COLOR).setOpacity(this.defaultOpacity)))}getValue(){return this.cache.remember("value",(()=>{const e=u.Text.toNumber(u.Dom.style(this.getPicker(),"left"));const t=u.Text.toNumber(this.pickerControl.getBoundingClientRect().width);return this.getDefaultValue().setOpacity(e/t)}))}setValue(e){const t=!u.Type.isNull(e)?e:this.getDefaultValue();super.setValue(t);if(!u.Type.isNull(e)){u.Dom.style(this.getColorLayout(),{background:t.getStyleStringForOpacity()});this.setPickerPosByOpacity(t.getOpacity());this.onRangeControlChange()}else{u.Dom.style(this.getColorLayout(),{background:"none"})}}onRangeControlChange(){const e=parseInt(this.getValue().getOpacity()*100);this.rangeInput.title=e;this.rangeInput.innerHTML=e}onArrowClick(e){let t;const s=this.getValue().getOpacity();const i=parseInt(s*100);if(e==="up"){if(i<100){t=(i+5)/100}else{t=i/100}}if(e==="down"){if(i>0){t=(i-5)/100}else{t=i/100}}this.rangeInput.title=parseInt(t*100);this.rangeInput.innerHTML=parseInt(t*100);const a=this.pickerControl.getBoundingClientRect().width;const r=a-a*(1-t);u.Dom.style(this.getPicker(),{left:`${r}px`});this.onChange()}}Xe.DEFAULT_COLOR="#cccccc";Xe.DEFAULT_OPACITY=1;let ze=e=>e,Ye,je,We,Ze,qe,Ke;class Je extends n.EventEmitter{constructor(){super();this.setEventNamespace("BX.Landing.UI.Field.Color.Tabs");this.tabs=[];this.cache=new u.Cache.MemoryCache;this.multiple=true;this.isBig=false;this.onToggle=this.onToggle.bind(this)}setMultiple(e){this.multiple=e;return this}setBig(e){this.isBig=e;this.multiple=false;return this}appendTab(e,t,s){const i=new Qe({id:e,title:t,items:u.Type.isArray(s)?s:[s]});this.tabs.push(i);this.bindEvents(i);this.cache.delete("layout");return this}prependTab(e,t,s){const i=new Qe({id:e,title:t,items:u.Type.isArray(s)||[s]});this.tabs.unshift(i);this.bindEvents(i);this.cache.delete("layout");return this}bindEvents(e){e.subscribe("onToggle",this.onToggle);e.subscribe("onShow",this.onToggle);e.subscribe("onHide",this.onToggle)}onToggle(e){this.emit("onToggle",e)}showTab(e){if(!this.multiple){this.tabs.forEach((e=>{e.hide()}))}const t=this.getTabById(e);if(t){t.show()}return this}getTabById(e){return this.tabs.find((t=>t.id===e))}getLayout(){return this.cache.remember("layout",(()=>{const e=this.isBig?" landing-ui-field-color-tabs--big":"";const t=u.Tag.render(Ye||(Ye=ze`<div class="landing-ui-field-color-tabs${0}"></div>`),e);if(this.isBig){const e=u.Tag.render(je||(je=ze`
					<div class="landing-ui-field-color-tabs-head landing-ui-field-color-tabs-head--big"></div>
				`));const s=u.Tag.render(We||(We=ze`
					<div class="landing-ui-field-color-tabs-content landing-ui-field-color-tabs-content--big"></div>
				`));this.tabs.forEach((t=>{u.Dom.append(t.getTitle(),e);u.Dom.append(t.getLayout(),s)}));u.Dom.append(e,t);u.Dom.append(s,t)}else{this.tabs.forEach((e=>{const s=u.Tag.render(Ze||(Ze=ze`<div class="landing-ui-field-color-tabs-tab">
						${0}${0}
					</div>`),e.getTitle(),e.getLayout());u.Dom.append(s,t)}))}this.tabs.forEach((e=>{u.Event.bind(e.getTitle(),"click",(()=>{if(!this.multiple){this.tabs.forEach((e=>{e.hide()}))}e.toggle()}))}));return t}))}}class Qe extends n.EventEmitter{constructor(e){super();this.id=e.id;this.title=e.title;this.items=e.items;this.cache=new u.Cache.MemoryCache}getId(){return this.id}getTitle(){return this.cache.remember("title",(()=>u.Tag.render(qe||(qe=ze`
				<span class="landing-ui-field-color-tabs-tab-toggler">
					<span class="landing-ui-field-color-tabs-tab-toggler-icon"></span>
					<span class="landing-ui-field-color-tabs-tab-toggler-name">${0}</span>
				</span>
			`),this.title)))}getLayout(){return this.cache.remember("layout",(()=>u.Tag.render(Ke||(Ke=ze`
				<div class="landing-ui-field-color-tabs-tab-content">
					${0}
				</div>
			`),this.items.map((e=>e.getLayout())))))}toggle(){u.Dom.toggleClass(this.getLayout(),Qe.SHOW_CLASS);u.Dom.toggleClass(this.getTitle(),Qe.SHOW_CLASS);this.emit("onToggle",{tab:this.title});return this}show(){u.Dom.addClass(this.getLayout(),Qe.SHOW_CLASS);u.Dom.addClass(this.getTitle(),Qe.SHOW_CLASS);this.emit("onShow",{tab:this.title});return this}hide(){u.Dom.removeClass(this.getLayout(),Qe.SHOW_CLASS);u.Dom.removeClass(this.getTitle(),Qe.SHOW_CLASS);this.emit("onHide",{tab:this.title});return this}}Qe.SHOW_CLASS="show";let et=e=>e,tt;class st extends n.EventEmitter{constructor(e){super();this.options=e;this.cache=new u.Cache.MemoryCache;this.setEventNamespace("BX.Landing.UI.Field.Color.Zeroing");u.Event.bind(this.getLayout(),"click",(()=>this.onClick()))}getLayout(){let e="LANDING_FIELD_COLOR-ZEROING_TITLE_2";if(this.options){if(!this.options.styleNode){return null}if(this.options.textCode){e=this.options.textCode}}return this.cache.remember("layout",(()=>u.Tag.render(tt||(tt=et`<div class="landing-ui-field-color-zeroing">
				<div class="landing-ui-field-color-zeroing-preview">
					<div class="landing-ui-field-color-zeroing-state"></div>
				</div>
				<span class="landing-ui-field-color-primary-text">
					${0}
				</span>
			</div>`),u.Loc.getMessage(e))))}onClick(){this.emit("onChange",{color:null})}setActive(){u.Dom.addClass(this.getLayout(),st.ACTIVE_CLASS)}unsetActive(){u.Dom.removeClass(this.getLayout(),st.ACTIVE_CLASS)}isActive(){return u.Dom.hasClass(this.getLayout(),st.ACTIVE_CLASS)}}st.ACTIVE_CLASS="active";let it=e=>e,at;class rt extends x{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.Color");this.property="color";this.variableName="--color";this.className="g-color";this.colorSet=new Ge(e);this.colorSet.subscribe("onChange",this.onColorSetChange.bind(this));this.colorSet.subscribe("onReset",this.onReset.bind(this));this.opacity=new Xe;this.opacity.subscribe("onChange",this.onOpacityChange.bind(this));const t={styleNode:e.styleNode};this.zeroing=new st(t);this.zeroing.subscribe("onChange",this.onZeroingChange.bind(this));this.primary=new he(e);this.primary.subscribe("onChange",this.onPrimaryChange.bind(this));this.tabs=(new Je).appendTab("Opacity",u.Loc.getMessage("LANDING_FIELD_COLOR-TAB_OPACITY"),this.opacity)}isNullValue(e){return e===null||e==="none"||e==="rgba(0, 0, 0, 0)"}getNullValue(){return new B("rgba(0, 0, 0, 0)")}buildLayout(){return u.Tag.render(at||(at=it`
			<div class="landing-ui-field-color-color">
				${0}
				${0}
				${0}
				${0}
			</div>
		`),this.colorSet.getLayout(),this.primary.getLayout(),this.zeroing.getLayout(),this.tabs.getLayout())}onColorSetChange(e){this.primary.unsetActive();this.zeroing.unsetActive();const t=e.getData().color;if(t!==null){t.setOpacity(this.opacity.getValue().getOpacity())}this.opacity.setValue(t);this.onChange()}onOpacityChange(){this.onChange()}onPrimaryChange(e){this.colorSet.setValue(e.getData().color);this.onColorSetChange(e);this.colorSet.unsetActive();this.zeroing.unsetActive();this.primary.setActive()}onZeroingChange(e){this.colorSet.unsetActive();this.primary.unsetActive();this.zeroing.setActive();this.setValue(e.getData().color);this.onChange(e)}unsetActive(){this.colorSet.unsetActive();this.primary.unsetActive()}setValue(e){const t=e!==null?new B(e):null;this.colorSet.setValue(t);this.opacity.setValue(t);if(this.primary.isPrimaryValue(t)){this.primary.setActive();this.colorSet.unsetActive()}if(e!==null&&t.getOpacity()<1){this.tabs.showTab("Opacity")}}getValue(){return this.cache.remember("value",(()=>{const e=this.primary.isActive()?this.primary.getValue():this.colorSet.getValue();return e===null?null:e.setOpacity(this.opacity.getValue().getOpacity())}))}setDefaultValue(e){this.zeroing.setActive();if(!u.Type.isNull(e)){this.colorSet.colorpicker.hex.setActive()}super.setDefaultValue(e)}onReset(){this.zeroing.unsetActive();super.onReset()}setActiveControl(e){if(e==="primary"){this.primary.setActive()}if(e==="hex"){this.colorSet.colorpicker.hexPreview.setActive()}}defineActiveControl(e,t){if(!u.Type.isUndefined(t)){let s;let i;const a=t.getNode();if(a.length>0){e.forEach((e=>{if(u.Dom.hasClass(a[0],e.value)){s=e.value}}));if(s){const e=/g-[a-z]+-[a-z0-9-]+/i;const t=s.match(e);if(t){const e=/primary/i;const t=s.match(e);this.zeroing.unsetActive();if(t){i="primary"}else{i="hex"}}}if(i){this.setActiveControl(i)}}}}}rt.PRIMARY_VAR="var(--primary)";class nt extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.ColorHover");this.property="color";this.variableName="--color-hover";this.className="g-color--hover";this.pseudoClass=":hover"}}let ot=e=>e,lt,ct,ht,ut,gt,dt,pt;class mt extends M{constructor(e){super();this.ROTATE_STEP=45;this.setEventNamespace("BX.Landing.UI.Field.Color.Gradient");this.popupId="gradient_popup_"+u.Text.getRandom();this.popupTargetContainer=e.contentRoot;this.colorpickerFrom=new oe(e);this.colorpickerFrom.subscribe("onChange",(e=>{this.onColorChange(e.getData().color,null)}));this.colorpickerTo=new oe(e);this.colorpickerTo.subscribe("onChange",(e=>{this.onColorChange(null,e.getData().color)}));u.Event.bind(this.getPopupButton(),"click",this.onPopupOpen.bind(this));u.Event.bind(this.getRotateButton(),"click",this.onRotate.bind(this));u.Event.bind(this.getSwitchTypeButton(),"click",this.onSwitchType.bind(this));u.Event.bind(this.getSwapButton(),"click",this.onSwap.bind(this));this.preset=null}onColorChange(e,t){if(e===null&&t===null){return}const s=this.getValue()||new be;const i=e||s.getFrom()||(new be).getFrom();const a=t||s.getTo()||(new be).getTo();s.setValue({from:i,to:a});this.setValue(s);this.preset.unsetActive();this.onChange()}onPopupOpen(){this.getPopup().toggle()}onRotate(e){if(!mt.isButtonEnable(e.target)){return}const t=this.getValue();if(t!==null){t.setValue({angle:(t.getAngle()+this.ROTATE_STEP)%360});this.setValue(t);this.onChange()}this.getPopup().close()}onSwitchType(e){if(!mt.isButtonEnable(e.target)){return}const t=this.getValue();if(t!==null){if(t.getType()===be.TYPE_LINEAR){t.setValue({type:be.TYPE_RADIAL});mt.disableButton(this.getRotateButton())}else{t.setValue({type:be.TYPE_LINEAR});mt.enableButton(this.getRotateButton())}this.setValue(t);this.onChange()}this.getPopup().close()}onSwap(e){if(!mt.isButtonEnable(e.target)){return}const t=this.getValue();if(t!==null){t.setValue({to:t.getFrom(),from:t.getTo()});this.setValue(t);this.onChange()}this.getPopup().close()}static disableButton(e){u.Dom.addClass(e,mt.DISABLE_CLASS)}static enableButton(e){u.Dom.removeClass(e,mt.DISABLE_CLASS)}static isButtonEnable(e){return!u.Dom.hasClass(e,mt.DISABLE_CLASS)}correctColorpickerColors(){const e=this.getValue();if(e!==null){const t=e.getAngle();const s=this.colorpickerFrom.getHexPreviewObject();const i=this.colorpickerTo.getHexPreviewObject();const a=e.getFrom();const r=e.getTo();if(e.getType()===be.TYPE_LINEAR){if(t===270||t===90){const e=B.getMedian(a,r).getContrast().getHex();s.adjustColors(e,"transparent");i.adjustColors(e,"transparent")}else if(t>=135&&t<=225){s.adjustColors(a.getContrast().getHex(),"transparent");i.adjustColors(r.getContrast().getHex(),"transparent")}else{s.adjustColors(r.getContrast().getHex(),"transparent");i.adjustColors(a.getContrast().getHex(),"transparent")}}else if(e.getType()===be.TYPE_RADIAL){s.adjustColors(r.getContrast().getHex(),"transparent");i.adjustColors(r.getContrast().getHex(),"transparent")}}}getPopup(){return this.cache.remember("popup",(()=>i.PopupManager.create({id:this.popupId,className:"landing-ui-field-color-gradient-preset-popup",autoHide:true,bindElement:this.getPopupButton(),bindOptions:{forceTop:true,forceLeft:true},offsetLeft:15,angle:{offset:-5},padding:0,contentPadding:7,content:this.getPopupContent(),closeByEsc:true,targetContainer:this.popupTargetContainer})))}getPopupContent(){return this.cache.remember("popupContainer",(()=>u.Tag.render(lt||(lt=ot`
				<div class="landing-ui-field-color-gradient-preset-popup-container">
					${0}
					${0}
				</div>
			`),this.getRotateButton(),this.getSwapButton())))}buildLayout(){if(this.preset){u.Dom.clean(this.getPresetContainer());u.Dom.append(this.preset.getLayout(),this.getPresetContainer())}return u.Tag.render(ct||(ct=ot`
			<div class="landing-ui-field-color-gradient">
				${0}
				<div class="landing-ui-field-color-gradient-container">
					<div class="landing-ui-field-color-gradient-from">${0}</div>
					${0}
					<div class="landing-ui-field-color-gradient-to">${0}</div>
				</div>
				<div class="landing-ui-field-color-gradient-switch-type-container">
					${0}
				</div>
			</div>
		`),this.getPresetContainer(),this.colorpickerFrom.getLayout(),this.getPopupButton(),this.colorpickerTo.getLayout(),this.getSwitchTypeButton())}getContainerLayout(){return this.getLayout().querySelector(".landing-ui-field-color-gradient-container")}getPresetContainer(){return this.cache.remember("presetContainer",(()=>u.Tag.render(ht||(ht=ot`<div class="landing-ui-field-color-gradient-preset-container"></div>`))))}getPopupButton(){return this.cache.remember("popupButton",(()=>u.Tag.render(ut||(ut=ot`<span class="landing-ui-field-color-gradient-open-popup"></span>`))))}getSwitchTypeButton(){return this.cache.remember("switchTypeButton",(()=>u.Tag.render(gt||(gt=ot`
				<span
					class="landing-ui-field-color-gradient-switch-type"
					title="${0}"
				></span>`),u.Loc.getMessage("LANDING_FIELD_COLOR-GRADIENT_SWITCH_TYPE"))))}getRotateButton(){return this.cache.remember("rotateButton",(()=>u.Tag.render(dt||(dt=ot`
				<span
					class="landing-ui-field-color-gradient-rotate"
					title="${0}"
				></span>`),u.Loc.getMessage("LANDING_FIELD_COLOR-GRADIENT_ROTATE"))))}getSwapButton(){return this.cache.remember("swapButton",(()=>u.Tag.render(pt||(pt=ot`
				<span
					class="landing-ui-field-color-gradient-swap"
					title="${0}"
				></span>`),u.Loc.getMessage("LANDING_FIELD_COLOR-GRADIENT_SWAP"))))}setPreset(e){this.preset=e;this.preset.unsetActive();this.preset.subscribe("onChange",(e=>{this.setValue(e.getData().color);this.unsetColorpickerActive();this.onChange(e)}));u.Dom.clean(this.getPresetContainer());u.Dom.append(e.getLayout(),this.getPresetContainer())}getPreset(){return this.preset}getValue(){return this.cache.remember("value",(()=>{if(this.colorpickerFrom.getValue()===null||this.colorpickerTo.getValue()===null){return null}let e=this.getRotateButton().dataset.rotate;e=e?u.Text.toNumber(e):0;const t=this.getSwitchTypeButton().dataset.type||be.TYPE_LINEAR;return new be({from:this.colorpickerFrom.getValue(),to:this.colorpickerTo.getValue(),angle:e,type:t})}))}setValue(e){super.setValue(e);if(e===null){this.colorpickerFrom.setValue(null);this.colorpickerTo.setValue(null);this.unsetActive();u.Dom.style(this.getContainerLayout(),"background",(new be).getStyleString());mt.disableButton(this.getRotateButton());mt.disableButton(this.getSwitchTypeButton());mt.disableButton(this.getSwapButton())}else{this.colorpickerFrom.setValue(e.getFrom());this.colorpickerTo.setValue(e.getTo());this.correctColorpickerColors();this.getRotateButton().dataset.rotate=e.getAngle();this.getSwitchTypeButton().dataset.type=e.getType();u.Dom.style(this.getRotateButton(),"transform",`rotate(${e.getAngle()}deg)`);u.Dom.style(this.getContainerLayout(),"background",this.getValue().getStyleString());mt.enableButton(this.getSwitchTypeButton());mt.enableButton(this.getSwapButton());if(e.getType()===be.TYPE_RADIAL){mt.disableButton(this.getRotateButton());this.getSwitchTypeButton().innerText=u.Loc.getMessage("LANDING_FIELD_COLOR-GRADIENT_DO_LINEAR")}else{mt.enableButton(this.getRotateButton());this.getSwitchTypeButton().innerText=u.Loc.getMessage("LANDING_FIELD_COLOR-GRADIENT_DO_RADIAL")}this.setActive()}}onChange(e){this.cache.delete("value");this.emit("onChange",{gradient:this.getValue()})}setActive(){const e=this.getValue();if(this.preset.isPresetValue(e)){this.preset.setActiveValue(e);this.unsetColorpickerActive()}else{this.preset.unsetActive();this.setColorpickerActive()}}unsetActive(){this.preset.unsetActive();this.unsetColorpickerActive()}setColorpickerActive(){u.Dom.addClass(this.getContainerLayout(),mt.ACTIVE_CLASS)}unsetColorpickerActive(){this.colorpickerFrom.unsetActive();this.colorpickerTo.unsetActive();u.Dom.removeClass(this.getContainerLayout(),mt.ACTIVE_CLASS)}}mt.DISABLE_CLASS="disable";class vt extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.BgColor");this.property=["background-image","background-color"];this.variableName="--bg";this.className="g-bg";this.activeControl=null;this.gradient=new mt(e);this.gradient.subscribe("onChange",this.onGradientChange.bind(this));this.tabs.prependTab("Gradient",u.Loc.getMessage("LANDING_FIELD_COLOR-TAB_GRADIENT"),this.gradient);this.setGradientPreset(this.colorSet.getPreset());this.colorSet.subscribe("onPresetChange",(e=>{this.setGradientPreset(e.getData().preset)}));this.tabs.subscribe("onToggle",this.onTabsToggle.bind(this))}setGradientPreset(e){const t=e.getGradientPreset();this.gradient.setPreset(t);t.subscribe("onChange",(()=>{this.activeControl=this.gradient;this.onChange()}));const s=this.getValue();if(s!==null&&s instanceof be){if(this.gradient.getPreset().isPresetValue(s)){this.colorSet.getPreset().unsetActive();this.gradient.getPreset().setActiveValue(s);this.gradient.unsetColorpickerActive()}}}onColorSetChange(e){this.activeControl=this.colorSet;this.gradient.unsetActive();super.onColorSetChange(e)}onGradientChange(e){this.activeControl=this.gradient;this.colorSet.unsetActive();const t=e.getData().gradient;if(t!==null){this.opacity.setValue(t.setOpacity(this.opacity.getValue().getOpacity()))}this.onChange()}onOverlayOpacityChange(){this.onChange()}onTabsToggle(){this.gradient.getPopup().close()}unsetActive(){this.colorSet.unsetActive();this.gradient.unsetActive();this.primary.unsetActive()}setValue(e){this.colorSet.setValue(null);this.gradient.setValue(null);this.unsetActive();this.activeControl=null;if(u.Type.isNil(e));else if(d(e)||m(e)||f(e)||_(e)){super.setValue(e);this.activeControl=this.colorSet}else if(fe(e)){this.activeControl=this.gradient;const t=new be(e);this.gradient.setValue(t);this.opacity.setValue(t);const s=this.colorSet.getPresetsCollection();const i=s.getGlobalActiveId()?s.getPresetById(s.getGlobalActiveId()):s.getPresetByItemValue(t);if(i!==null&&i!==this.colorSet.getPreset()){this.colorSet.setPreset(i);this.setGradientPreset(i)}this.tabs.showTab("Gradient");if(t.getOpacity()<1){this.tabs.showTab("Opacity")}}}getValue(){return this.cache.remember("value",(()=>{if(this.activeControl===null){return null}else if(this.activeControl===this.gradient){const e=this.gradient.getValue();return e===null?e:e.setOpacity(this.opacity.getValue().getOpacity())}else{return super.getValue()}}))}}const ft=/url\(['"]?([^ '"]*)['"]?\)([\w \/]*)/i;function bt(e){if(!!e.trim().match(ft)){return true}return!!e.trim().match(yt())}function yt(){const e=ge(ft);const t=ge(de);return new RegExp(`^${t},${e}`)}class Ct{constructor(e){this.value=O;this.setValue(e)}getName(){return`\n\t\t\t${this.value.url.replace(/[^\w\d]/g,"")}_${this.value.size}_${this.value.attachment}\n\t\t`}setValue(e){if(u.Type.isObject(e)){if(e instanceof Ct){this.value.url=e.getUrl();this.value.url2x=e.getUrl2x();this.value.fileId=e.getFileId();this.value.fileId2x=e.getFileId2x();this.value.size=e.getSize();this.value.attachment=e.getAttachment()}else{this.value={...this.value,...e}}}if(u.Type.isString(e)&&bt(e)){this.parseBgString(e)}return this}parseBgString(e){const t=O;const s=e.trim().match(ue(ft));if(!!s){t.url=s[1];t.size=s[2].indexOf("auto")===-1?N:"auto";t.attachment=s[2].indexOf("fixed")===-1?w:"fixed"}const i=e.trim().match(ue(ve));if(!!e.trim().match(ue(de))&&!!i){t.overlay=new B(i[0])}this.setValue(t)}setOpacity(e){return this}setUrl(e){this.setValue({url:e});return this}setUrl2x(e){this.setValue({url2x:e});return this}setFileId(e){this.setValue({fileId:e});return this}setFileId2x(e){this.setValue({fileId2x:e});return this}setSize(e){this.setValue({size:e});return this}setAttachment(e){this.setValue({attachment:e});return this}setOverlay(e){this.setValue({overlay:e});return this}getUrl(){return this.value.url}getUrl2x(){return this.value.url2x}getFileId(){return this.value.fileId}getFileId2x(){return this.value.fileId2x}getSize(){return this.value.size}getAttachment(e=false){return e?this.value.attachment==="fixed":this.value.attachment}getOverlay(){return this.value.overlay}getOpacity(){return 1}getStyleString(){let e="";if(this.value.overlay!==null){e=`linear-gradient(${this.value.overlay.getStyleString()},${this.value.overlay.getStyleString()})`}const{url:t,url2x:s,size:i,attachment:a}=this.value;const r=`center / ${i} ${a}`;if(t!==null){e=e.length?e+",":"";if(s!==null){e+=`-webkit-image-set(url('${t}') 1x, url('${s}') 2x) ${r},`;e+=`image-set(url('${t}') 1x, url('${s}') 2x) ${r},`}e+=`url('${t}') ${r}`}return e}getStyleStringForOpacity(){return""}static getSizeItemsForButtons(){return[{name:u.Loc.getMessage("LANDING_FIELD_COLOR-BG_COVER"),value:"cover"},{name:u.Loc.getMessage("LANDING_FIELD_COLOR-BG_MOSAIC"),value:"auto"}]}static getAttachmentValueByBool(e){return e?"fixed":"scroll"}}let At=e=>e,Lt;class Tt extends M{constructor(e){super();this.setEventNamespace("BX.Landing.UI.Field.Color.Image");this.options=e;this.imgField=new o.Image({id:"landing_ui_color_image_"+u.Text.getRandom().toLowerCase(),className:"landing-ui-field-color-image-image",contextType:o.Image.CONTEXT_TYPE_STYLE,compactMode:true,disableLink:true,disableAltField:true,allowClear:true,isAiImageAvailable:c.Env.getInstance().getOptions()["ai_image_available"],isAiImageActive:c.Env.getInstance().getOptions()["ai_image_active"],aiUnactiveInfoCode:c.Env.getInstance().getOptions()["ai_unactive_info_code"],dimensions:{width:1920},uploadParams:{action:"Block::uploadFile",block:this.options.block.id},contentRoot:this.options.contentRoot});this.imgField.subscribe("change",this.onImageChange.bind(this));this.sizeField=new BX.Landing.UI.Field.Dropdown({id:"landing_ui_color_image_size_"+u.Text.getRandom().toLowerCase(),title:u.Loc.getMessage("LANDING_FIELD_COLOR-BG_SIZE_TITLE"),className:"landing-ui-field-color-image-size",items:Ct.getSizeItemsForButtons(),onChange:this.onSizeChange.bind(this),contentRoot:this.options.contentRoot});this.attachmentField=new BX.Landing.UI.Field.Checkbox({id:"landing_ui_color_image_attach_"+u.Text.getRandom().toLowerCase(),className:"landing-ui-field-color-image-attachment",multiple:false,compact:true,items:[{name:u.Loc.getMessage("LANDING_FIELD_COLOR-BG_FIXED"),value:"fixed"}],onChange:this.onAttachmentChange.bind(this),value:[this.getAttachmentValue()]})}buildLayout(){return u.Tag.render(Lt||(Lt=At`
			<div class="landing-ui-field-color-image">
				${0}
				${0}
				${0}
			</div>
		`),this.imgField.getLayout(),this.sizeField.getLayout(),this.attachmentField.getLayout())}onImageChange(e){const t=this.getValue()||new Ct;if(e.getData().value.src){t.setUrl(e.getData().value.src);t.setFileId(e.getData().value.id);if(e.getData().value.src2x){t.setUrl2x(e.getData().value.src2x);t.setFileId2x(e.getData().value.id2x)}}else{t.setUrl(null);t.setFileId(null);t.setUrl2x(null);t.setFileId2x(null)}this.setValue(t);this.onChange();this.saveNode(t)}saveNode(e){const t=this.options.styleNode;const s=this.options.block;let i;if(t.selector===s.selector||t.selector===s.makeAbsoluteSelector(s.selector)){i="#wrapper"}else if(!t.isSelectGroup()){i=BX.Landing.Utils.join(t.selector.split("@")[0],"@",t.getElementIndex(t.getNode()[0]))}else{i=t.selector.split("@")[0]}const a={[i]:{}};a[i].id=e.getFileId()||-1;a[i].id2x=e.getFileId2x()||-1;l.Backend.getInstance().action("Landing\\Block::updateNodes",{lid:this.options.block.lid,block:this.options.block.id,data:a})}onSizeChange(e){if(u.Type.isString(e)){const t=this.getValue()||new Ct;t.setSize(e);this.setValue(t);this.onChange()}}onAttachmentChange(e){if(e instanceof n.BaseEvent){const e=this.getValue()||new Ct;e.setAttachment(Ct.getAttachmentValueByBool(this.attachmentField.getValue()));this.setValue(e);this.onChange()}}onChange(e){this.cache.delete("value");this.emit("onChange",{data:{image:this.getValue()}})}getValue(){return this.cache.remember("value",(()=>{const e=this.imgField.getValue();const t=e.src;if(t===null){return null}else{const s=new Ct({url:t,fileId:e.id});if(e.src2x){s.setUrl2x(e.src2x);s.setFileId2x(e.fileId2x)}const i=this.sizeField.getValue();if(i!==null){s.setSize(i)}s.setAttachment(Ct.getAttachmentValueByBool(this.attachmentField.getValue()));return s}}))}setValue(e){if(this.isNeedSetValue(e)){super.setValue(e);if(e===null){this.imgField.setValue({src:""},true)}else{if(e.getUrl()!==null){this.setActive()}const t={type:"image",src:e.getUrl(),id:e.getFileId()};if(e.getUrl2x()){t.src2x=e.getUrl2x();t.id2x=e.getFileId2x()}this.imgField.setValue(t,true);this.sizeField.setValue(this.getSizeValue(),true);this.attachmentField.setValue([this.getAttachmentValue()])}}}setActive(){u.Dom.addClass(this.imgField.getLayout(),Tt.ACTIVE_CLASS)}unsetActive(){u.Dom.removeClass(this.imgField.getLayout(),Tt.ACTIVE_CLASS)}getAttachmentValue(){if(this.options&&this.options.block&&this.options.block.content&&u.Dom.hasClass(this.options.block.content,"g-bg-image")){const e=window.getComputedStyle(this.options.block.content);const t=e.getPropertyValue("background-attachment");return t.includes("fixed")?"fixed":"scroll"}return"scroll"}getSizeValue(){if(this.options&&this.options.block&&this.options.block.content&&u.Dom.hasClass(this.options.block.content,"g-bg-image")){const e=window.getComputedStyle(this.options.block.content);const t=e.getPropertyValue("background-size");return t.includes("cover")?"cover":"auto"}return"cover"}}function Et(e){const t=/\d{1,3}(\.\d+)?/g;const s=e.match(t);const i=s[0]?s[0]:null;const a=s[1]?s[1]:null;const r=s[2]?s[2]:null;if(i===null||a===null||r===null){return null}return Vt(i,a,r)}function Vt(e,t,s){return"rgb("+e+","+t+","+s+")"}let It=e=>e,_t;class St extends vt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.Bg");this.styleNode=e.styleNode;this.parentVariableName=this.variableName;this.variableName=[this.parentVariableName,St.BG_URL_VAR,St.BG_URL_2X_VAR,St.BG_OVERLAY_VAR,St.BG_SIZE_VAR,St.BG_ATTACHMENT_VAR,St.BG_IMAGE];this.parentClassName=this.className;this.className="g-bg-image";this.image=new Tt(e);this.image.subscribe("onChange",this.onImageChange.bind(this));this.overlay=new Ge(e);this.overlay.subscribe("onChange",this.onOverlayColorChange.bind(this));this.overlayOpacity=new Xe({defaultOpacity:.5});this.overlayOpacity.subscribe("onChange",this.onOverlayOpacityChange.bind(this));this.overlayPrimary=new he;this.overlayPrimary.subscribe("onChange",this.onOverlayPrimaryChange.bind(this));const t={textCode:"LANDING_FIELD_COLOR_OVERLAY_ZEROING_TITLE_2",styleNode:e.styleNode};this.overlayZeroing=new st(t);this.overlayZeroing.subscribe("onChange",this.overlayZeroingChange.bind(this));this.imageTabs=(new Je).appendTab("Overlay",u.Loc.getMessage("LANDING_FIELD_COLOR-BG_OVERLAY"),[this.overlay,this.overlayPrimary,this.overlayZeroing,this.overlayOpacity]);this.bigTabs=(new Je).setBig(true).appendTab("Color",u.Loc.getMessage("LANDING_FIELD_COLOR-BG_COLOR"),[this.colorSet,this.primary,this.zeroing,this.tabs]).appendTab("Image",u.Loc.getMessage("LANDING_FIELD_COLOR-BG_IMAGE"),[this.image,this.imageTabs])}buildLayout(){return u.Tag.render(_t||(_t=It`
			<div class="landing-ui-field-color-color">
				${0}
			</div>
		`),this.bigTabs.getLayout())}onColorSetChange(e){this.image.unsetActive();this.overlay.unsetActive();super.onColorSetChange(e)}onGradientChange(e){this.image.unsetActive();this.overlay.unsetActive();super.onGradientChange(e)}onImageChange(){this.unsetActive();this.activeControl=this.image;this.image.setActive();this.modifyStyleNode(this.styleNode)}onOverlayChange(e){const t=e.getData().color;if(t!==null){t.setOpacity(this.overlayOpacity.getValue().getOpacity())}this.overlayOpacity.setValue(t);const s=this.image.getValue();if(s!==null){this.image.setValue(s.setOverlay(t));this.activeControl=this.image;this.image.setActive();this.colorSet.unsetActive();this.gradient.unsetActive()}this.modifyStyleNode(this.styleNode)}onOverlayOpacityChange(){this.modifyStyleNode(this.styleNode)}onOverlayColorChange(e){this.overlayPrimary.unsetActive();this.overlayZeroing.unsetActive();this.onOverlayChange(e)}onOverlayPrimaryChange(e){this.overlay.unsetActive();this.overlayZeroing.unsetActive();this.onOverlayChange(e)}overlayZeroingChange(e){this.overlay.unsetActive();this.overlayPrimary.unsetActive();this.overlayZeroing.setActive();this.onOverlayChange(e)}unsetActive(){super.unsetActive();this.image.unsetActive()}setProcessorValue(e){this.cache.delete("value");this.setValue(e)}setValue(e){this.image.setValue(null);this.bigTabs.showTab("Color");if(u.Type.isNull(e)){super.setValue(e)}else if(u.Type.isString(e)){super.setValue(e)}else if(this.parentVariableName in e&&u.Type.isString(e[this.parentVariableName])){super.setValue(e[this.parentVariableName])}else if(u.Type.isObject(e)){const t=new Ct;if(St.BG_URL_VAR in e){t.setUrl(e[St.BG_URL_VAR].replace(/url\(["']/i,"").replace(/['"]\)/i,""))}if(St.BG_URL_2X_VAR in e){t.setUrl2x(e[St.BG_URL_2X_VAR].replace(/url\(["']/i,"").replace(/['"]\)/i,""))}if(St.BG_SIZE_VAR in e){t.setSize(e[St.BG_SIZE_VAR])}if(St.BG_ATTACHMENT_VAR in e){t.setAttachment(e[St.BG_ATTACHMENT_VAR])}if(St.BG_OVERLAY_VAR in e){t.setOverlay(new B(e[St.BG_OVERLAY_VAR]))}this.image.setValue(t);this.bigTabs.showTab("Image");this.activeControl=this.image;this.imageTabs.showTab("Overlay");if(St.BG_OVERLAY_VAR in e){const t=new B(e[St.BG_OVERLAY_VAR]);this.overlay.setValue(t);this.overlayOpacity.setValue(t);if(e[St.BG_OVERLAY_VAR].startsWith("var(--primary")||e["isPrimaryBasedColor"]===true){this.overlayPrimary.setActive();this.overlay.unsetActive()}}else{this.overlayZeroing.setActive()}}}getValue(){return this.cache.remember("value",(()=>{if(this.activeControl===this.image){const e=this.image.getValue();let t;let s=false;if(this.overlay.isActive()){t=this.overlay.getValue();s=true}if(this.overlayPrimary.isActive()){t=this.overlayPrimary.getValue();s=true}if(this.overlayZeroing.isActive()){t=null}if(e!==null&&t!==null&&s){t.setOpacity(this.overlayOpacity.getValue().getOpacity());e.setOverlay(t)}return e}else{return super.getValue()}}))}getClassName(){const e=this.getValue();if(e===null||e instanceof B||e instanceof be){return[this.parentClassName]}return[this.className]}getStyle(){if(this.getValue()===null){return{[this.parentVariableName]:null,[St.BG_URL_VAR]:null,[St.BG_URL_2X_VAR]:null,[St.BG_OVERLAY_VAR]:null,[St.BG_SIZE_VAR]:null,[St.BG_ATTACHMENT_VAR]:null}}const e=this.getValue();let t=null;let s=null;let i=null;let a=null;let r=null;let n=null;const o="";if(e instanceof B||e instanceof be){t=e.getStyleString()}else{s=e.getUrl()?`url('${e.getUrl()}')`:"";i=e.getUrl2x()?`url('${e.getUrl2x()}')`:"";a=e.getOverlay()?e.getOverlay().getStyleString():"rgba(0, 0, 0, 0)";r=e.getSize();n=e.getAttachment()}return{[this.parentVariableName]:t,[St.BG_URL_VAR]:s,[St.BG_URL_2X_VAR]:i?i:s,[St.BG_OVERLAY_VAR]:a,[St.BG_SIZE_VAR]:r,[St.BG_ATTACHMENT_VAR]:n,[St.BG_IMAGE]:o}}modifyStyleNode(e){u.Dom.style(e.getNode()[0],St.BG_IMAGE,"");this.onChange()}prepareProcessorValue(e,t){if(t&&t.hasOwnProperty(St.BG_IMAGE)){const s=/url\(/i;const i=t[St.BG_IMAGE].match(s);if(i!==null){e[St.BG_IMAGE]="";e[St.BG_SIZE_VAR]=N;e[St.BG_ATTACHMENT_VAR]=w;const s=/image-set\(url\(/i;const i=t[St.BG_IMAGE].match(s);if(i!==null){const s=/["'](https?:\/)?\/[\S]*["']/gi;const i=t[St.BG_IMAGE].match(s);if(i){const t=/["']/g;e[St.BG_URL_VAR]=i[0].replaceAll(t,"");if(i.length===2){e[St.BG_URL_2X_VAR]=i[1].replaceAll(t,"")}else{e[St.BG_URL_2X_VAR]=i[0].replaceAll(t,"")}}}else{e[St.BG_URL_VAR]=t[St.BG_IMAGE];e[St.BG_URL_2X_VAR]=t[St.BG_IMAGE]}const a=getComputedStyle(this.styleNode.getNode()[0],":after");if(!e[St.BG_OVERLAY_VAR]){e[St.BG_OVERLAY_VAR]=a.backgroundColor}const r=Et(a.backgroundColor);const n=Et(a.getPropertyValue("--primary-opacity-0"));if(r!==null&&n!==null&&r===n){e["isPrimaryBasedColor"]=true}}}return e}}St.BG_URL_VAR="--bg-url";St.BG_URL_2X_VAR="--bg-url-2x";St.BG_OVERLAY_VAR="--bg-overlay";St.BG_SIZE_VAR="--bg-size";St.BG_ATTACHMENT_VAR="--bg-attachment";St.BG_IMAGE="background-image";class Pt extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.BorderColor");this.property="border-color";this.variableName="--border-color";this.className="g-border-color"}}class Nt extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.BorderColorHover");this.property="border-color";this.variableName="--border-color--hover";this.className="g-border-color--hover";this.pseudoClass=":hover"}}class wt extends vt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.BgColorHover");this.property=["background-image","background-color"];this.variableName="--bg-hover";this.className="g-bg--hover";this.pseudoClass=":hover"}}class Rt extends vt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.BgColorAfter");this.property=["background-image","background-color"];this.variableName="--bg--after";this.className="g-bg--after";this.pseudoClass=":after";const t=this.getValue()||new B;this.opacity.setValue(t.setOpacity(.5));this.tabs.showTab("Opacity")}}class Ot extends vt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.BgColorBefore");this.property=["background-image","background-color"];this.variableName="--bg--before";this.className="g-bg--before";this.pseudoClass=":before";const t=this.getValue()||new B;this.opacity.setValue(t.setOpacity(.5));this.tabs.showTab("Opacity")}}class Bt extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.NavbarColor");this.property="color";this.variableName="--navbar-color";this.className="u-navbar-color"}}class kt extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.NavbarColorHover");this.property="color";this.variableName="--navbar-color--hover";this.className="u-navbar-color--hover";this.pseudoClass=":hover"}}class Dt extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.NavbarColorFixMoment");this.property="color";this.variableName="--navbar-color--fix-moment";this.className="u-navbar-color--fix-moment"}}class xt extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.NavbarColorFixMomentHover");this.property="color";this.variableName="--navbar-color--fix-moment--hover";this.className="u-navbar-color--fix-moment--hover";this.pseudoClass=":hover"}}class Ft extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.NavbarBgColor");this.property="background-color";this.variableName="--navbar-bg-color";this.className="u-navbar-bg"}}class Gt extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.NavbarBgColorHover");this.property="background-color";this.variableName="--navbar-bg-color--hover";this.className="u-navbar-bg--hover";this.pseudoClass=":hover"}}class Mt extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.BorderColorTop");this.property="border-top-color";this.variableName="--border-color-top";this.className="g-border-color-top"}}class Ut extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.FillColor");this.property="fill";this.pseudoClass=":before";this.variableName="--fill-first";this.className="g-fill-first"}}class Ht extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.FillColorSecond");this.property="fill";this.pseudoClass=":after";this.variableName="--fill-second";this.className="g-fill-second"}}class $t extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.ButtonColor");this.property="background-color";this.variableName=[$t.COLOR_CONTRAST_VAR,$t.COLOR_HOVER_VAR,$t.COLOR_LIGHT_VAR,$t.COLOR_VAR];this.className="g-button-color"}getStyle(){if(this.getValue()===null){return{[$t.COLOR_CONTRAST_VAR]:null,[$t.COLOR_HOVER_VAR]:null,[$t.COLOR_LIGHT_VAR]:null,[$t.COLOR_VAR]:null}}const e=this.getValue();const t=e.getContrast().lighten(10);const s=new B(e).lighten(10);const i=e.getLighten();return{[$t.COLOR_CONTRAST_VAR]:t.getStyleString(),[$t.COLOR_HOVER_VAR]:s.getStyleString(),[$t.COLOR_LIGHT_VAR]:i.getStyleString(),[$t.COLOR_VAR]:e.getStyleString()}}}$t.COLOR_CONTRAST_VAR="--button-color-contrast";$t.COLOR_HOVER_VAR="--button-color-hover";$t.COLOR_LIGHT_VAR="--button-color-light";$t.COLOR_VAR="--button-color";class Xt extends rt{constructor(e){super(e);this.setEventNamespace("BX.Landing.UI.Field.Processor.NavbarCollapseBgColor");this.property="background-color";this.variableName="--navbar-collapse-bg-color";this.className="u-navbar-collapse-bg"}}class zt extends t.BaseField{constructor(e){super(e);this.items="items"in e&&e.items?e.items:[];this.postfix=typeof e.postfix==="string"?e.postfix:"";this.frame=typeof e.frame==="object"?e.frame:null;const t={block:e.block,styleNode:e.styleNode,selector:e.selector,contentRoot:this.contentRoot,content:e.content};this.changeHandler=typeof e.onChange==="function"?e.onChange:()=>{};this.valueChangeHandler=typeof e.onValueChange==="function"?e.onValueChange:()=>{};this.resetHandler=typeof e.onReset==="function"?e.onReset:function(){};switch(e.subtype){case"color":this.processor=new rt(t);break;case"color-hover":this.processor=new nt(t);break;case"bg":this.processor=new St(t);break;case"bg-color":this.processor=new vt(t);break;case"bg-color-hover":this.processor=new wt(t);break;case"bg-color-after":this.processor=new Rt(t);break;case"bg-color-before":this.processor=new Ot(t);break;case"border-color":this.processor=new Pt(t);break;case"border-color-hover":this.processor=new Nt(t);break;case"border-color-top":this.processor=new Mt(t);break;case"navbar-color":this.processor=new Bt(t);break;case"navbar-color-hover":this.processor=new kt(t);break;case"navbar-color-fix-moment":this.processor=new Dt(t);break;case"navbar-color-fix-moment-hover":this.processor=new xt(t);break;case"navbar-bg-color":this.processor=new Ft(t);break;case"navbar-bg-color-hover":this.processor=new Gt(t);break;case"navbar-collapse-bg-color":this.processor=new Xt(t);break;case"fill-color":this.processor=new Ut(t);break;case"fill-color-second":this.processor=new Ht(t);break;case"button-color":this.processor=new $t(t);break;default:break}this.property=this.processor.getProperty()[this.processor.getProperty().length-1];this.processor.getClassName().forEach((e=>this.items.push({name:e,value:e})));u.Dom.remove(this.input);this.layout.classList.add("landing-ui-field-color");u.Dom.append(this.processor.getLayout(),this.layout);this.processor.subscribe("onChange",this.onChange.bind(this));this.processor.subscribe("onReset",this.onReset.bind(this))}getInlineProperties(){return this.processor.getVariableName()}prepareInlineProperties(e){e.push("background-image");return e}getComputedProperties(){return this.processor.getProperty()}getPseudoElement(){return this.processor.getPseudoClass()}onChange(){this.changeHandler({className:this.processor.getClassName(),style:this.processor.getStyle()},this.items,this.postfix,this.property);const e=this.getValue();let t="";if(e instanceof B){t=e.getStyleString()}else if(e instanceof Ct){t=e.getUrl()}else if(e instanceof be){t=e.getStyleString()}this.valueChangeHandler(new s.TextField({selector:this.selector,attribute:this.attribute,content:t,textOnly:true}));this.emit("onChange")}onReset(){this.resetHandler(this.items,this.postfix,this.property)}getValue(){return this.processor.getValue()||this.processor.getNullValue()}setValue(e){let t=null;this.prepareInlineProperties(this.getInlineProperties()).forEach((s=>{if(s in e&&!this.processor.isNullValue(e[s])){if(!u.Type.isObject(t)){t={}}t[s]=e[s]}}));let s=null;this.getComputedProperties().forEach((t=>{if(t in e&&!this.processor.isNullValue(e[t])){if(!u.Type.isObject(s)){s={}}s[t]=e[t]}}));t=this.processor.prepareProcessorValue(t,s);if(t!==null){this.processor.setProcessorValue(t)}else{this.processor.setDefaultValue(s);this.processor.defineActiveControl(this.items,this.data.styleNode)}}onFrameLoad(){const e=this.data.styleNode.getValue(true);this.setValue(e.style)}}e.ColorField=zt})(this.BX.Landing.UI.Field=this.BX.Landing.UI.Field||{},BX.Landing.UI.Field,BX.Landing.UI.Field,BX.Main,BX,BX,BX.Event,BX.Landing.UI.Field,BX.Landing,BX.Landing,BX.Landing,BX);
//# sourceMappingURL=color_field.bundle.map.js

Youez - 2016 - github.com/yon3zu
LinuXploit