export class CSSShadowModel{constructor(isBoxShadow){this._isBoxShadow=isBoxShadow;this._inset=false;this._offsetX=InlineEditor.CSSLength.zero();this._offsetY=InlineEditor.CSSLength.zero();this._blurRadius=InlineEditor.CSSLength.zero();this._spreadRadius=InlineEditor.CSSLength.zero();this._color=(Common.Color.parse('black'));this._format=[_Part.OffsetX,_Part.OffsetY];} static parseTextShadow(text){return CSSShadowModel._parseShadow(text,false);} static parseBoxShadow(text){return CSSShadowModel._parseShadow(text,true);} static _parseShadow(text,isBoxShadow){const shadowTexts=[];const splits=TextUtils.TextUtils.splitStringByRegexes(text,[Common.Color.Regex,/,/g]);let currentIndex=0;for(let i=0;i0?shadow._format[shadow._format.length-1]:'';if(previousPart===_Part.OffsetX){shadow._offsetY=length;shadow._format.push(_Part.OffsetY);}else if(previousPart===_Part.OffsetY){shadow._blurRadius=length;shadow._format.push(_Part.BlurRadius);}else if(previousPart===_Part.BlurRadius){shadow._spreadRadius=length;shadow._format.push(_Part.SpreadRadius);}else{shadow._offsetX=length;shadow._format.push(_Part.OffsetX);}}}} if(invalidCount(shadow,_Part.OffsetX,1,1)||invalidCount(shadow,_Part.OffsetY,1,1)||invalidCount(shadow,_Part.Color,0,1)||invalidCount(shadow,_Part.BlurRadius,0,1)||invalidCount(shadow,_Part.Inset,0,isBoxShadow?1:0)||invalidCount(shadow,_Part.SpreadRadius,0,isBoxShadow?1:0)){return[];} shadows.push(shadow);} return shadows;function invalidCount(shadow,part,min,max){let count=0;for(let i=0;imax;}} setInset(inset){this._inset=inset;if(this._format.indexOf(_Part.Inset)===-1){this._format.unshift(_Part.Inset);}} setOffsetX(offsetX){this._offsetX=offsetX;} setOffsetY(offsetY){this._offsetY=offsetY;} setBlurRadius(blurRadius){this._blurRadius=blurRadius;if(this._format.indexOf(_Part.BlurRadius)===-1){const yIndex=this._format.indexOf(_Part.OffsetY);this._format.splice(yIndex+1,0,_Part.BlurRadius);}} setSpreadRadius(spreadRadius){this._spreadRadius=spreadRadius;if(this._format.indexOf(_Part.SpreadRadius)===-1){this.setBlurRadius(this._blurRadius);const blurIndex=this._format.indexOf(_Part.BlurRadius);this._format.splice(blurIndex+1,0,_Part.SpreadRadius);}} setColor(color){this._color=color;if(this._format.indexOf(_Part.Color)===-1){this._format.push(_Part.Color);}} isBoxShadow(){return this._isBoxShadow;} inset(){return this._inset;} offsetX(){return this._offsetX;} offsetY(){return this._offsetY;} blurRadius(){return this._blurRadius;} spreadRadius(){return this._spreadRadius;} color(){return this._color;} asCSSText(){const parts=[];for(let i=0;i2&&match[2]){return new InlineEditor.CSSLength(parseFloat(match[1]),match[2]);} return InlineEditor.CSSLength.zero();} static zero(){return new InlineEditor.CSSLength(0,'');} asCSSText(){return this.amount+this.unit;}} CSSLength.Regex=(function(){const number='([+-]?(?:[0-9]*[.])?[0-9]+(?:[eE][+-]?[0-9]+)?)';const unit='(ch|cm|em|ex|in|mm|pc|pt|px|rem|vh|vmax|vmin|vw)';const zero='[+-]?(?:0*[.])?0+(?:[eE][+-]?[0-9]+)?';return new RegExp(number+unit+'|'+zero,'gi');})();self.InlineEditor=self.InlineEditor||{};InlineEditor=InlineEditor||{};InlineEditor.CSSShadowModel=CSSShadowModel;InlineEditor.CSSShadowModel._Part=_Part;InlineEditor.CSSLength=CSSLength;