@leankylin-sheet/react 1.2.17 → 1.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.min.js +1 -1
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -34721,7 +34721,7 @@
|
|
|
34721
34721
|
case"(":case")":out[out.length]={t:flen===1?"t":c,v:c};++i;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":o=c;while(i<fmt.length&&"0123456789".indexOf(fmt.charAt(++i))>-1)o+=fmt.charAt(i);out[out.length]={t:"D",v:o};break;case" ":out[out.length]={t:c,v:c};++i;break;case"$":out[out.length]={t:"t",v:"$"};++i;break;default:// if ("¤฿BsBr₵₡₫ƒFtRs.₭kr£₤Lm₥₦₱PQRSkRp৲৳R$S/.〒₮₩¥NT¥zł₴₪៛руб€$,$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
|
34722
34722
|
if("¤฿BsBr₵₡₫ƒFtRs.₭kr£₤Lm₥₦₱PQRSkRp৲৳R$S/.〒₮₩¥NT¥zł₴₪៛руб€$,$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP$¥LekdinAf$dhAflRial?£BirrKzMOPPGKRsGsB/R$ррlevkrKMzBsPNuFBuKPkrRD$NfkCFA?CVEGMDFrCDHTGNAfLFdjKGSFGGHSRielKCFknKshLSLL£LtRFRONArRfMWKRMMURsMROS/KMDLMTnRC$kr€GELCHFSLLSCRDbSZLSDGSOSSomFCFPTShT$VUVQUGXгрнsomWSTNT$FtDramRpZMWFCFA".indexOf(c)===-1)throw new Error("unrecognized character "+c+" in "+fmt);out[out.length]={t:"t",v:c};++i;break;}}/* Scan for date/time parts */var bt=0,ss0=0,ssm;for(i=out.length-1,lst="t";i>=0;--i){switch(out[i].t){case"h":case"H":out[i].t=hr;lst="h";if(bt<1)bt=1;break;case"s":if(ssm=out[i].v.match(/\.0+$/))ss0=Math.max(ss0,ssm[0].length-1);if(bt<3)bt=3;/* falls through */case"d":case"y":case"M":case"e":lst=out[i].t;break;case"m":if(lst==="s"){out[i].t="M";if(bt<2)bt=2;}break;case"X":/*if(out[i].v === "B2");*/break;case"Z":if(bt<1&&out[i].v.match(/[Hh]/))bt=1;if(bt<2&&out[i].v.match(/[Mm]/))bt=2;if(bt<3&&out[i].v.match(/[Ss]/))bt=3;}}/* time rounding depends on presence of minute / second / usec fields */switch(bt){case 0:break;case 1:if(dt.u>=0.5){dt.u=0;++dt.S;}if(dt.S>=60){dt.S=0;++dt.M;}if(dt.M>=60){dt.M=0;++dt.H;}break;case 2:if(dt.u>=0.5){dt.u=0;++dt.S;}if(dt.S>=60){dt.S=0;++dt.M;}break;}/* replace fields */var nstr="",jj;for(i=0;i<out.length;++i){switch(out[i].t){case"t":case"T":case" ":case"D":break;case"X":out[i].v="";out[i].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":out[i].v=write_date(out[i].t.charCodeAt(0),out[i].v,dt,ss0);out[i].t="t";break;case"n":case"?":jj=i+1;while(out[jj]!=null&&((c=out[jj].t)==="?"||c==="D"||(c===" "||c==="t")&&out[jj+1]!=null&&(out[jj+1].t==="?"||out[jj+1].t==="t"&&out[jj+1].v==="/")||out[i].t==="("&&(c===" "||c==="n"||c===")")||c==="t"&&(out[jj].v==="/"||out[jj].v===" "&&out[jj+1]!=null&&out[jj+1].t=="?"))){out[i].v+=out[jj].v;out[jj]={v:"",t:";"};++jj;}nstr+=out[i].v;i=jj-1;break;case"G":out[i].t="t";out[i].v=general_fmt(v,opts);break;}}var vv="",myv,ostr;if(nstr.length>0){if(nstr.charCodeAt(0)==40){/* '(' */myv=v<0&&nstr.charCodeAt(0)===45?-v:v;ostr=write_num("n",nstr,myv);}else {myv=v<0&&flen>1?-v:v;ostr=write_num("n",nstr,myv);if(myv<0&&out[0]&&out[0].t=="t"){ostr=ostr.substr(1);out[0].v="-"+out[0].v;}}jj=ostr.length-1;var decpt=out.length;for(i=0;i<out.length;++i)if(out[i]!=null&&out[i].t!="t"&&out[i].v.indexOf(".")>-1){decpt=i;break;}var lasti=out.length;if(decpt===out.length&&ostr.indexOf("E")===-1){for(i=out.length-1;i>=0;--i){if(out[i]==null||"n?".indexOf(out[i].t)===-1)continue;if(jj>=out[i].v.length-1){jj-=out[i].v.length;out[i].v=ostr.substr(jj+1,out[i].v.length);}else if(jj<0)out[i].v="";else {out[i].v=ostr.substr(0,jj+1);jj=-1;}out[i].t="t";lasti=i;}if(jj>=0&&lasti<out.length)out[lasti].v=ostr.substr(0,jj+1)+out[lasti].v;}else if(decpt!==out.length&&ostr.indexOf("E")===-1){jj=ostr.indexOf(".")-1;for(i=decpt;i>=0;--i){if(out[i]==null||"n?".indexOf(out[i].t)===-1)continue;j=out[i].v.indexOf(".")>-1&&i===decpt?out[i].v.indexOf(".")-1:out[i].v.length-1;vv=out[i].v.substr(j+1);for(;j>=0;--j){if(jj>=0&&(out[i].v.charAt(j)==="0"||out[i].v.charAt(j)==="#"))vv=ostr.charAt(jj--)+vv;}out[i].v=vv;out[i].t="t";lasti=i;}if(jj>=0&&lasti<out.length)out[lasti].v=ostr.substr(0,jj+1)+out[lasti].v;jj=ostr.indexOf(".")+1;for(i=decpt;i<out.length;++i){if(out[i]==null||"n?(".indexOf(out[i].t)===-1&&i!==decpt)continue;j=out[i].v.indexOf(".")>-1&&i===decpt?out[i].v.indexOf(".")+1:0;vv=out[i].v.substr(0,j);for(;j<out[i].v.length;++j){if(jj<ostr.length)vv+=ostr.charAt(jj++);}out[i].v=vv;out[i].t="t";lasti=i;}}}for(i=0;i<out.length;++i)if(out[i]!=null&&"n?".indexOf(out[i].t)>-1){myv=flen>1&&v<0&&i>0&&out[i-1].v==="-"?-v:v;out[i].v=write_num(out[i].t,out[i].v,myv);out[i].t="t";}var retval="";for(i=0;i!==out.length;++i)if(out[i]!=null)retval+=out[i].v;return retval;}SSF._eval=eval_fmt;var cfregex=/\[[=<>]/;var cfregex2=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function chkcond(v,rr){if(rr==null)return false;var thresh=parseFloat(rr[2]);switch(rr[1]){case"=":if(v==thresh)return true;break;case">":if(v>thresh)return true;break;case"<":if(v<thresh)return true;break;case"<>":if(v!=thresh)return true;break;case">=":if(v>=thresh)return true;break;case"<=":if(v<=thresh)return true;break;}return false;}function choose_fmt(f,v){var fmt=split_fmt(f);var l=fmt.length,lat=fmt[l-1].indexOf("@");if(l<4&&lat>-1)--l;if(fmt.length>4)throw new Error("cannot find right format for |"+fmt.join("|")+"|");// 这行代码弃用,有可能v会有"1"的情况出现,并且需要排查true,false,‘ ’这些值所以需要使用parseFloat(v).toString()去判断是不是Number类型
|
|
34723
34723
|
// if (typeof v !== "number")
|
|
34724
|
-
if(parseFloat(v).toString()=="NaN")return [4,fmt.length===4||lat>-1?fmt[fmt.length-1]:"@"];switch(fmt.length){case 1:fmt=lat>-1?["General","General","General",fmt[0]]:[fmt[0],fmt[0],fmt[0],"@"];break;case 2:fmt=lat>-1?[fmt[0],fmt[0],fmt[0],fmt[1]]:[fmt[0],fmt[1],fmt[0],"@"];break;case 3:fmt=lat>-1?[fmt[0],fmt[1],fmt[0],fmt[2]]:[fmt[0],fmt[1],fmt[2],"@"];break;}var ff=v>0?fmt[0]:v<0?fmt[1]:fmt[2];if(fmt[0].indexOf("[")===-1&&fmt[1].indexOf("[")===-1)return [l,ff];if(fmt[0].match(cfregex)!=null||fmt[1].match(cfregex)!=null){var m1=fmt[0].match(cfregex2);var m2=fmt[1].match(cfregex2);return chkcond(v,m1)?[l,fmt[0]]:chkcond(v,m2)?[l,fmt[1]]:[l,fmt[m1!=null&&m2!=null?2:1]];}return [l,ff];}function format(fmt,v,o){if(fmt==='leanky_n'){return numberThousands(v);}if(o==null)o={};var sfmt="";switch(_typeof$3(fmt)){case"string":if(fmt=="m/d/yy"&&o.dateNF)sfmt=o.dateNF;else sfmt=fmt;break;case"number":if(fmt==14&&o.dateNF)sfmt=o.dateNF;else sfmt=(o.table!=null?o.table:table_fmt)[fmt];if(sfmt==null)sfmt=o.table&&o.table[default_map[fmt]]||table_fmt[default_map[fmt]];if(sfmt==null)sfmt=default_str[fmt]||"General";break;}//new runze 增加万 亿 格式
|
|
34724
|
+
if(parseFloat(v).toString()=="NaN")return [4,fmt.length===4||lat>-1?fmt[fmt.length-1]:"@"];switch(fmt.length){case 1:fmt=lat>-1?["General","General","General",fmt[0]]:[fmt[0],fmt[0],fmt[0],"@"];break;case 2:fmt=lat>-1?[fmt[0],fmt[0],fmt[0],fmt[1]]:[fmt[0],fmt[1],fmt[0],"@"];break;case 3:fmt=lat>-1?[fmt[0],fmt[1],fmt[0],fmt[2]]:[fmt[0],fmt[1],fmt[2],"@"];break;}var ff=v>0?fmt[0]:v<0?fmt[1]:fmt[2];if(fmt[0].indexOf("[")===-1&&fmt[1].indexOf("[")===-1)return [l,ff];if(fmt[0].match(cfregex)!=null||fmt[1].match(cfregex)!=null){var m1=fmt[0].match(cfregex2);var m2=fmt[1].match(cfregex2);return chkcond(v,m1)?[l,fmt[0]]:chkcond(v,m2)?[l,fmt[1]]:[l,fmt[m1!=null&&m2!=null?2:1]];}return [l,ff];}function format(fmt,v,o){if(fmt===null||fmt===void 0?void 0:fmt.includes('leanky_n')){var precision=fmt.replace('leanky_n','');return numberThousands(v,',',precision);}if(o==null)o={};var sfmt="";switch(_typeof$3(fmt)){case"string":if(fmt=="m/d/yy"&&o.dateNF)sfmt=o.dateNF;else sfmt=fmt;break;case"number":if(fmt==14&&o.dateNF)sfmt=o.dateNF;else sfmt=(o.table!=null?o.table:table_fmt)[fmt];if(sfmt==null)sfmt=o.table&&o.table[default_map[fmt]]||table_fmt[default_map[fmt]];if(sfmt==null)sfmt=default_str[fmt]||"General";break;}//new runze 增加万 亿 格式
|
|
34725
34725
|
//注:"w":2万2500 "w0":2万2500 "w0.0":2万2500.2 "w0.00":2万2500.23......自定义精确度
|
|
34726
34726
|
var reg=/^(w|W)((0?)|(0\.0+))$/;if(!!sfmt.match(reg)){if(isNaN(v)){return v;}//var v =300101886.436;
|
|
34727
34727
|
var acc=sfmt.slice(1);//取得0/0.0/0.00
|
|
@@ -34737,7 +34737,7 @@
|
|
|
34737
34737
|
var afterYi=v.substring(v.indexOf("亿")+1);if(afterYi.substring(0,1)!=="."&&afterYi!=""){switch((parseInt(afterYi)+"").length){case 1:afterYi="000"+afterYi;break;case 2:afterYi="00"+afterYi;break;case 3:afterYi="0"+afterYi;break;}v=v.substring(0,v.indexOf("亿")+1)+afterYi;}}else if(v.indexOf("亿")==-1&&v.indexOf("万")!=-1){//3万0011
|
|
34738
34738
|
var afterWan=v.substring(v.indexOf("万")+1);if(afterWan.substring(0,1)!=="."&&afterWan!=""){switch((parseInt(afterWan)+"").length){case 1:afterWan="000"+afterWan;break;case 2:afterWan="00"+afterWan;break;case 3:afterWan="0"+afterWan;break;}v=v.substring(0,v.indexOf("万")+1)+afterWan;}}else if(v.indexOf("亿")!=-1&&v.indexOf("万")!=-1){//1亿0053万0611
|
|
34739
34739
|
var afterYi=v.substring(v.indexOf("亿")+1,v.indexOf("万")),afterWan=v.substring(v.indexOf("万")+1);switch((parseInt(afterYi)+"").length){case 1:afterYi="000"+afterYi;break;case 2:afterYi="00"+afterYi;break;case 3:afterYi="0"+afterYi;break;}v=v.substring(0,v.indexOf("亿")+1)+afterYi+v.substring(v.indexOf("万"));if(afterWan.substring(0,1)!=="."&&afterWan!=""){switch((parseInt(afterWan)+"").length){case 1:afterWan="000"+afterWan;break;case 2:afterWan="00"+afterWan;break;case 3:afterWan="0"+afterWan;break;}v=v.substring(0,v.indexOf("万")+1)+afterWan;}}}else {if(acc!=""){v=numeral(v).format(acc);//处理精确度
|
|
34740
|
-
}}if(isNegative){return "-"+v;}else {return v;}}if(isgeneral(sfmt,0))return general_fmt(v,o);if(v instanceof Date)v=datenum_local(v,o.date1904);var f=choose_fmt(sfmt,v);if(isgeneral(f[1]))return general_fmt(v,o);if(v===true)v="TRUE";else if(v===false)v="FALSE";else if(v===""||v==null)return "";return eval_fmt(f[1],v,o,f[0]);}function load_entry(fmt,idx){if(typeof idx!="number"){idx=+idx||-1;for(var i=0;i<0x0188;++i){if(table_fmt[i]==undefined){if(idx<0)idx=i;continue;}if(table_fmt[i]==fmt){idx=i;break;}}if(idx<0)idx=0x187;}table_fmt[idx]=fmt;return idx;}SSF.load=load_entry;SSF._table=table_fmt;SSF.get_table=function get_table(){return table_fmt;};SSF.load_table=function load_table(tbl){for(var i=0;i!=0x0188;++i)if(tbl[i]!==undefined)load_entry(tbl[i],i);};SSF.init_table=init_table;SSF.format=format;};make_ssf(SSF);var intThousands=function intThousands(number){var groupSeparator=arguments.length>1&&arguments[1]!==undefined?arguments[1]:',';return String(number).replace(/\B(?=(\d{3})+(?!\d))/g,groupSeparator);};var numberThousands=function numberThousands(number){var groupSeparator=arguments.length>1&&arguments[1]!==undefined?arguments[1]:',';if(number===0)return '0';if(!number)return number;if(String(number).includes('.')){var _String$split=String(number).split('.'),_String$split2=_slicedToArray$3(_String$split,2),init=_String$split2[0],decimal=_String$split2[1];return intThousands(init,groupSeparator)+'.'+decimal;}else {return intThousands(number,groupSeparator);}};var base1904=new Date(1900,2,1,0,0,0);function datenum_local(v,date1904){var epoch=Date.UTC(v.getFullYear(),v.getMonth(),v.getDate(),v.getHours(),v.getMinutes(),v.getSeconds());var dnthresh_utc=Date.UTC(1899,11,31,0,0,0);if(date1904)epoch-=1461*24*60*60*1000;else if(v>=base1904)epoch+=24*60*60*1000;return (epoch-dnthresh_utc)/(24*60*60*1000);}var good_pd_date=new Date("2017-02-19T19:06:09.000Z");if(Number.isNaN(good_pd_date.getFullYear()))good_pd_date=new Date("2/19/17");var good_pd=good_pd_date.getFullYear()===2017;function parseDate(str,fixdate){var d=new Date(str);if(good_pd){if(!lodash.isNil(fixdate)){if(fixdate>0)d.setTime(d.getTime()+d.getTimezoneOffset()*60*1000);else if(fixdate<0)d.setTime(d.getTime()-d.getTimezoneOffset()*60*1000);}return d;}if(str instanceof Date)return str;if(good_pd_date.getFullYear()===1917&&!Number.isNaN(d.getFullYear())){var s=d.getFullYear();if(str.indexOf("".concat(s))>-1)return d;d.setFullYear(d.getFullYear()+100);return d;}var n=str.match(/\d+/g)||["2017","2","19","0","0","0"];var out=new Date(+n[0],+n[1]-1,+n[2],+n[3]||0,+n[4]||0,+n[5]||0);if(str.indexOf("Z")>-1)out=new Date(out.getTime()-out.getTimezoneOffset()*60*1000);return out;}function genarate(value){var m=null;var ct={};var v=value;if(lodash.isNil(value)){return null;}if(/^-?[0-9]{1,}[,][0-9]{3}(.[0-9]{1,2})?$/.test(value)){value=value;m=value;v=Number(value.split(".")[0].replace(",",""));var fa="#,##0";if(value.split(".")[1]){fa="#,##0.";for(var i=0;i<value.split(".")[1].length;i+=1){fa+=0;}}ct={fa:fa,t:"n"};}else if(value.toString().substring(0,1)==="'"){m=value.toString().substring(1);ct={fa:"@",t:"s"};}else if(value.toString().toUpperCase()==="TRUE"){m="TRUE";ct={fa:"General",t:"b"};v=true;}else if(value.toString().toUpperCase()==="FALSE"){m="FALSE";ct={fa:"General",t:"b"};v=false;}else if(valueIsError(value.toString())){m=value.toString();ct={fa:"General",t:"e"};}else if(/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(value)){m=value.toString();ct={fa:"@",t:"s"};}else if(isRealNum(value)&&Math.abs(parseFloat(value))>0&&(Math.abs(parseFloat(value))>=1e11||Math.abs(parseFloat(value))<1e-9)){v=parseFloat(value);var str=v.toExponential();if(str.indexOf(".")>-1){var strlen=str.split(".")[1].split("e")[0].length;if(strlen>5){strlen=5;}ct={fa:"#0.".concat(new Array(strlen+1).join("0"),"E+00"),t:"n"};}else {ct={fa:"#0.E+00",t:"n"};}m=SSF.format(ct.fa,v);}else if(value.toString().indexOf("%")>-1){var index=value.toString().indexOf("%");var value2=value.toString().substring(0,index);var value3=value2.replace(/,/g,"");if(index===value.toString().length-1&&isRealNum(value3)){if(value2.indexOf(".")>-1){if(value2.indexOf(".")===value2.lastIndexOf(".")){var value4=value2.split(".")[0];var value5=value2.split(".")[1];var len=value5.length;if(len>9){len=9;}if(value4.indexOf(",")>-1){var isThousands=true;var ThousandsArr=value4.split(",");for(var _i=1;_i<ThousandsArr.length;_i+=1){if(ThousandsArr[_i].length<3){isThousands=false;break;}}if(isThousands){ct={fa:"#,##0.".concat(new Array(len+1).join("0"),"%"),t:"n"};v=numeral(value).value();m=SSF.format(ct.fa,v);}else {m=value.toString();ct={fa:"@",t:"s"};}}else {ct={fa:"0.".concat(new Array(len+1).join("0"),"%"),t:"n"};v=numeral(value).value();m=SSF.format(ct.fa,v);}}else {m=value.toString();ct={fa:"@",t:"s"};}}else if(value2.indexOf(",")>-1){var _isThousands=true;var _ThousandsArr=value2.split(",");for(var _i2=1;_i2<_ThousandsArr.length;_i2+=1){if(_ThousandsArr[_i2].length<3){_isThousands=false;break;}}if(_isThousands){ct={fa:"#,##0%",t:"n"};v=numeral(value).value();m=SSF.format(ct.fa,v);}else {m=value.toString();ct={fa:"@",t:"s"};}}else {ct={fa:"0%",t:"n"};v=numeral(value).value();m=SSF.format(ct.fa,v);}}else {m=value.toString();ct={fa:"@",t:"s"};}}else if(value.toString().indexOf(".")>-1){if(value.toString().indexOf(".")===value.toString().lastIndexOf(".")){var value1=value.toString().split(".")[0];var _value=value.toString().split(".")[1];var _len=_value.length;if(_len>9){_len=9;}if(value1.indexOf(",")>-1){var _isThousands2=true;var _ThousandsArr2=value1.split(",");for(var _i3=1;_i3<_ThousandsArr2.length;_i3+=1){if(!isRealNum(_ThousandsArr2[_i3])||_ThousandsArr2[_i3].length<3){_isThousands2=false;break;}}if(_isThousands2){ct={fa:"#,##0.".concat(new Array(_len+1).join("0")),t:"n"};v=numeral(value).value();m=SSF.format(ct.fa,v);}else {m=value.toString();ct={fa:"@",t:"s"};}}else {if(isRealNum(value1)&&isRealNum(_value)){ct={fa:"0.".concat(new Array(_len+1).join("0")),t:"n"};v=numeral(value).value();m=SSF.format(ct.fa,v);}else {m=value.toString();ct={fa:"@",t:"s"};}}}else {m=value.toString();ct={fa:"@",t:"s"};}}else if(isRealNum(value)){m=parseFloat(value).toString();ct={fa:"General",t:"n"};v=parseFloat(value);}else if(isdatetime(value)&&(value.toString().indexOf(".")>-1||value.toString().indexOf(":")>-1||value.toString().length<16)){v=datenum_local(parseDate(value.toString().replace(/-/g,"/")));if(v.toString().indexOf(".")>-1){if(value.toString().length>18){ct.fa="yyyy-MM-dd hh:mm:ss";}else if(value.toString().length>11){ct.fa="yyyy-MM-dd hh:mm";}else {ct.fa="yyyy-MM-dd";}}else {ct.fa="yyyy-MM-dd";}ct.t="d";m=SSF.format(ct.fa,v);}else {m=value;ct.fa="General";ct.t="g";}return [m,ct,v];}function update(fmt,v){return SSF.format(fmt,v);}function is_date(fmt,v){return SSF.is_date(fmt,v);}function fuzzynum(s){var v=Number(s);if(typeof s==="number"){return s;}if(!Number.isNaN(v))return v;var wt=1;var ss=s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g,function(){wt*=100;return "";});v=Number(ss);if(!Number.isNaN(v))return v/wt;ss=ss.replace(/[(](.*)[)]/,function($$,$1){wt=-wt;return $1;});v=Number(ss);if(!Number.isNaN(v))return v/wt;return v;}function valueShowEs(r,c,d){var value=getCellValue(r,c,d,"m");if(value==null){value=getCellValue(r,c,d,"v");}else {var _d$r,_d$r$c,_d$r$c$ct,_d$r2,_d$r2$c,_d$r2$c$ct;if(!Number.isNaN(fuzzynum(value))){if(lodash.isString(value)&&value.indexOf("%")>-1);else {value=getCellValue(r,c,d,"v");}}else if(((_d$r=d[r])===null||_d$r===void 0?void 0:(_d$r$c=_d$r[c])===null||_d$r$c===void 0?void 0:(_d$r$c$ct=_d$r$c.ct)===null||_d$r$c$ct===void 0?void 0:_d$r$c$ct.t)==="d");else if(((_d$r2=d[r])===null||_d$r2===void 0?void 0:(_d$r2$c=_d$r2[c])===null||_d$r2$c===void 0?void 0:(_d$r2$c$ct=_d$r2$c.ct)===null||_d$r2$c$ct===void 0?void 0:_d$r2$c$ct.t)==="b");else {value=getCellValue(r,c,d,"v");}}return value;}var colors=["#c1232b","#27727b","#fcce10","#e87c25","#b5c334","#fe8463","#9bca63","#fad860","#f3a43b","#60c0dd","#d7504b","#c6e579","#f4e001","#f0805a","#26c0c0","#c12e34","#e6b600","#0098d9","#2b821d","#005eaa","#339ca8","#cda819","#32a487","#3fb1e3","#6be6c1","#626c91","#a0a7e6","#c4ebad","#96dee8"];function mousePosition(x,y,ctx){var newX=x-ctx.rowHeaderWidth;var newY=y-ctx.toolbarHeight-ctx.calculatebarHeight-ctx.columnHeaderHeight;return [newX,newY];}function rowLocationByIndex(row_index,visibleRow){var row=0;var row_pre=0;row=visibleRow[row_index];if(row_index===0){row_pre=0;}else {row_pre=visibleRow[row_index-1];}return [row_pre,row,row_index];}function rowLocation(y,visibleRow){var row_index=lodash.sortedIndex(visibleRow,y);if(row_index>=visibleRow.length&&y>0){row_index=visibleRow.length-1;}else if(row_index===-1&&y<=0){row_index=0;}return rowLocationByIndex(row_index,visibleRow);}function colLocationByIndex(col_index,visibleCol){var col=0;var col_pre=0;col=visibleCol[col_index];if(col_index===0){col_pre=0;}else {col_pre=visibleCol[col_index-1];}return [col_pre,col,col_index];}function colLocation(x,visibleCol){var col_index=lodash.sortedIndex(visibleCol,x);if(col_index>=visibleCol.length&&x>0){col_index=visibleCol.length-1;}else if(col_index===-1&&x<=0){col_index=0;}return colLocationByIndex(col_index,visibleCol);}var functionHTMLIndex=0;var rangeIndexes=[];var operatorPriority={"^":0,"%":1,"*":1,"/":1,"+":2,"-":2};var operatorArr="==|!=|<>|<=|>=|=|+|-|>|<|/|*|%|&|^".split("|");var operatorjson={};for(var i=0;i<operatorArr.length;i+=1){operatorjson[operatorArr[i].toString()]=1;}var simpleSheetName$2="[A-Za-z0-9_\xC0-\u02AF]+";var quotedSheetName$2="'(?:(?!').|'')*'";var sheetNameRegexp$2="(".concat(simpleSheetName$2,"|").concat(quotedSheetName$2,")!");var rowColumnRegexp="[$]?[A-Za-z]+[$]?[0-9]+";var rowColumnWithSheetName="(?:".concat(sheetNameRegexp$2,")?(").concat(rowColumnRegexp,")");var LABEL_EXTRACT_REGEXP$1=new RegExp("^".concat(rowColumnWithSheetName,"(?:[:]").concat(rowColumnWithSheetName,")?$"));var FormulaCache=/*#__PURE__*/function(){function FormulaCache(){_classCallCheck$1(this,FormulaCache);this.parser=void 0;this.func_selectedrange=void 0;this.data_parm_index=void 0;this.cellTextToIndexList=void 0;this.rangechangeindex=void 0;this.selectingRangeIndex=void 0;this.rangeResizeObj=void 0;this.rangeResize=void 0;this.rangeResizeIndex=void 0;this.rangeResizexy=void 0;this.rangeResizeWinH=void 0;this.rangeResizeWinW=void 0;this.rangeResizeTo=void 0;this.rangeSetValueTo=void 0;this.rangeIndex=void 0;this.rangestart=void 0;this.rangetosheet=void 0;this.rangedrag_column_start=void 0;this.rangedrag_row_start=void 0;this.functionRangeIndex=void 0;this.functionlistMap=void 0;this.execFunctionExist=void 0;this.execFunctionGlobalData=void 0;var that=this;this.data_parm_index=0;this.selectingRangeIndex=-1;this.functionlistMap={};this.execFunctionGlobalData={};this.cellTextToIndexList={};this.parser=new Parser$1();this.parser.on("callCellValue",function(cellCoord,options,done){var _context$formulaCache,_flowdata$cellCoord$r;var context=that.parser.context;var id=cellCoord.sheetName==null?options.sheetId:getSheetIdByName(context,cellCoord.sheetName);if(id==null)throw Error(ERROR_REF);var flowdata=getFlowdata(context,id);var cell=(context===null||context===void 0?void 0:(_context$formulaCache=context.formulaCache.execFunctionGlobalData)===null||_context$formulaCache===void 0?void 0:_context$formulaCache["".concat(cellCoord.row.index,"_").concat(cellCoord.column.index,"_").concat(id)])||(flowdata===null||flowdata===void 0?void 0:(_flowdata$cellCoord$r=flowdata[cellCoord.row.index])===null||_flowdata$cellCoord$r===void 0?void 0:_flowdata$cellCoord$r[cellCoord.column.index]);var v=that.tryGetCellAsNumber(cell);done(v);});this.parser.on("callRangeValue",function(startCellCoord,endCellCoord,options,done){var context=that.parser.context;var id=startCellCoord.sheetName==null?options.sheetId:getSheetIdByName(context,startCellCoord.sheetName);if(id==null)throw Error(ERROR_REF);var flowdata=getFlowdata(context,id);var fragment=[];var startRow=startCellCoord.row.index;var endRow=endCellCoord.row.index;var startCol=startCellCoord.column.index;var endCol=endCellCoord.column.index;var emptyRow=startRow===-1||endRow===-1;var emptyCol=startCol===-1||endCol===-1;if(emptyRow){var _flowdata$length;startRow=0;endRow=(_flowdata$length=flowdata===null||flowdata===void 0?void 0:flowdata.length)!==null&&_flowdata$length!==void 0?_flowdata$length:0;}if(emptyCol){var _flowdata$0$length;startCol=0;endCol=(_flowdata$0$length=flowdata===null||flowdata===void 0?void 0:flowdata[0].length)!==null&&_flowdata$0$length!==void 0?_flowdata$0$length:0;}if(emptyRow&&emptyCol)throw Error(ERROR_REF);for(var row=startRow;row<=endRow;row+=1){var colFragment=[];for(var col=startCol;col<=endCol;col+=1){var _context$formulaCache2,_flowdata$row;var cell=(context===null||context===void 0?void 0:(_context$formulaCache2=context.formulaCache.execFunctionGlobalData)===null||_context$formulaCache2===void 0?void 0:_context$formulaCache2["".concat(row,"_").concat(col,"_").concat(id)])||(flowdata===null||flowdata===void 0?void 0:(_flowdata$row=flowdata[row])===null||_flowdata$row===void 0?void 0:_flowdata$row[col]);var v=that.tryGetCellAsNumber(cell);colFragment.push(v);}fragment.push(colFragment);}if(fragment){done(fragment);}});}return _createClass$1(FormulaCache,[{key:"tryGetCellAsNumber",value:function tryGetCellAsNumber(cell){var _cell$ct;if((cell===null||cell===void 0?void 0:(_cell$ct=cell.ct)===null||_cell$ct===void 0?void 0:_cell$ct.t)==="n"){var n=Number(cell===null||cell===void 0?void 0:cell.v);return Number.isNaN(n)?cell.v:n;}return cell===null||cell===void 0?void 0:cell.v;}}]);}();function parseElement(eleString){return new DOMParser().parseFromString(eleString,"text/html").body.childNodes[0];}function iscelldata(txt){var val=txt.split("!");var rangetxt;if(val.length>1){var _val=_slicedToArray$3(val,2);rangetxt=_val[1];}else {var _val2=_slicedToArray$3(val,1);rangetxt=_val2[0];}var reg_cell=/^(([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+))$/g;var reg_cellRange=/^(((([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+)))|((([a-zA-Z]+)|([$][a-zA-Z]+))))$/g;if(rangetxt.indexOf(":")===-1){var _row=parseInt(rangetxt.replace(/[^0-9]/g,""),10)-1;var _col=columnCharToIndex(rangetxt.replace(/[^A-Za-z]/g,""));if(!Number.isNaN(_row)&&!Number.isNaN(_col)&&rangetxt.toString().match(reg_cell)){return true;}if(!Number.isNaN(_row)){return false;}if(!Number.isNaN(_col)){return false;}return false;}reg_cellRange=/^(((([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+)))|((([a-zA-Z]+)|([$][a-zA-Z]+)))|((([0-9]+)|([$][0-9]+s))))$/g;var rangetxtArr=rangetxt.split(":");var row=[];var col=[];row[0]=parseInt(rangetxtArr[0].replace(/[^0-9]/g,""),10)-1;row[1]=parseInt(rangetxtArr[1].replace(/[^0-9]/g,""),10)-1;if(row[0]>row[1]){return false;}col[0]=columnCharToIndex(rangetxtArr[0].replace(/[^A-Za-z]/g,""));col[1]=columnCharToIndex(rangetxtArr[1].replace(/[^A-Za-z]/g,""));if(col[0]>col[1]){return false;}if(rangetxtArr[0].toString().match(reg_cellRange)&&rangetxtArr[1].toString().match(reg_cellRange)){return true;}return false;}function addToCellIndexList(ctx,txt,infoObj){if(lodash.isNil(txt)||txt.length===0||lodash.isNil(infoObj)){return;}if(lodash.isNil(ctx.formulaCache.cellTextToIndexList)){ctx.formulaCache.cellTextToIndexList={};}if(txt.indexOf("!")>-1){txt=txt.replace(/\\'/g,"'").replace(/''/g,"'");ctx.formulaCache.cellTextToIndexList[txt]=infoObj;}else {ctx.formulaCache.cellTextToIndexList["".concat(txt,"_").concat(infoObj.sheetId)]=infoObj;}}function getcellrange(ctx,txt,formulaId){if(lodash.isNil(txt)||txt.length===0){return null;}var flowdata=getFlowdata(ctx,formulaId);var sheettxt="";var rangetxt="";var sheetId=null;var sheetdata=null;var luckysheetfile=ctx.luckysheetfile;if(txt.indexOf("!")>-1){if(txt in ctx.formulaCache.cellTextToIndexList){return ctx.formulaCache.cellTextToIndexList[txt];}var matchRes=txt.match(LABEL_EXTRACT_REGEXP$1);if(matchRes==null){return null;}var _matchRes=_slicedToArray$3(matchRes,5),sheettxt1=_matchRes[1],starttxt1=_matchRes[2],sheettxt2=_matchRes[3],starttxt2=_matchRes[4];if(sheettxt2!=null&&sheettxt1!==sheettxt2){return null;}rangetxt=starttxt2?"".concat(starttxt1,":").concat(starttxt2):starttxt1;sheettxt=sheettxt1.replace(/^'|'$/g,"").replace(/\\'/g,"'").replace(/''/g,"'");lodash.forEach(luckysheetfile,function(f){if(sheettxt===f.name){sheetId=f.id;sheetdata=f.data;return false;}return true;});}else {var _i=formulaId;if(lodash.isNil(_i)){_i=ctx.currentSheetId;}if("".concat(txt,"_").concat(_i)in ctx.formulaCache.cellTextToIndexList){return ctx.formulaCache.cellTextToIndexList["".concat(txt,"_").concat(_i)];}var index=getSheetIndex(ctx,_i);if(lodash.isNil(index)){return null;}sheettxt=luckysheetfile[index].name;sheetId=luckysheetfile[index].id;sheetdata=flowdata;rangetxt=txt;}if(lodash.isNil(sheetdata)){return null;}if(rangetxt.indexOf(":")===-1){var _row2=parseInt(rangetxt.replace(/[^0-9]/g,""),10)-1;var _col2=columnCharToIndex(rangetxt.replace(/[^A-Za-z]/g,""));if(!Number.isNaN(_row2)&&!Number.isNaN(_col2)){var _item={row:[_row2,_row2],column:[_col2,_col2],sheetId:sheetId};addToCellIndexList(ctx,txt,_item);return _item;}return null;}var rangetxtArr=rangetxt.split(":");var row=[];var col=[];row[0]=parseInt(rangetxtArr[0].replace(/[^0-9]/g,""),10)-1;row[1]=parseInt(rangetxtArr[1].replace(/[^0-9]/g,""),10)-1;if(Number.isNaN(row[0])){row[0]=0;}if(Number.isNaN(row[1])){row[1]=sheetdata.length-1;}if(row[0]>row[1]){return null;}col[0]=columnCharToIndex(rangetxtArr[0].replace(/[^A-Za-z]/g,""));col[1]=columnCharToIndex(rangetxtArr[1].replace(/[^A-Za-z]/g,""));if(Number.isNaN(col[0])){col[0]=0;}if(Number.isNaN(col[1])){col[1]=sheetdata[0].length-1;}if(col[0]>col[1]){return null;}var item={row:row,column:col,sheetId:sheetId};addToCellIndexList(ctx,txt,item);return item;}function calPostfixExpression(cal){if(cal.length===0){return "";}var stack=[];for(var _i2=cal.length-1;_i2>=0;_i2-=1){var c=cal[_i2];if(c in operatorjson){var s2=stack.pop();var s1=stack.pop();var str="luckysheet_compareWith(".concat(s1,",'").concat(c,"', ").concat(s2,")");stack.push(str);}else {stack.push(c);}}if(stack.length>0){return stack[0];}return "";}function checkSpecialFunctionRange(ctx,function_str,r,c,id,dynamicArray_compute,cellRangeFunction){if(function_str.substring(0,30)==="luckysheet_getSpecialReference"||function_str.substring(0,20)==="luckysheet_function."){if(function_str.substring(0,20)==="luckysheet_function."){var funcName=function_str.split(".")[1];if(!lodash.isNil(funcName)){funcName=funcName.toUpperCase();if(funcName!=="INDIRECT"&&funcName!=="OFFSET"&&funcName!=="INDEX"){return;}}}try{ctx.calculateSheetId=id;var str=function_str.split(",")[function_str.split(",").length-1].split("'")[1].split("'")[0];var str_nb=lodash.trim(str);if(iscelldata(str_nb)){if(typeof cellRangeFunction==="function"){cellRangeFunction(str_nb);}}}catch(_unused){}}}function isFunctionRange(ctx,txt,r,c,id,dynamicArray_compute,cellRangeFunction){if(txt.substring(0,1)==="="){txt=txt.substring(1);}var funcstack=txt.split("");var i=0;var str="";var function_str="";var matchConfig={bracket:0,comma:0,squote:0,dquote:0,compare:0,braces:0};var cal1=[];var cal2=[];var bracket=[];while(i<funcstack.length){var s=funcstack[i];if(s==="("&&matchConfig.squote===0&&matchConfig.dquote===0&&matchConfig.braces===0){if(str.length>0&&bracket.length===0){str=str.toUpperCase();if(str.indexOf(":")>-1){var funcArray=str.split(":");function_str+="luckysheet_getSpecialReference(true,'".concat(lodash.trim(funcArray[0]).replace(/'/g,"\\'"),"', luckysheet_function.").concat(funcArray[1],".f(#lucky#");}else {function_str+="luckysheet_function.".concat(str,".f(");}bracket.push(1);str="";}else if(bracket.length===0){function_str+="(";bracket.push(0);str="";}else {bracket.push(0);str+=s;}}else if(s===")"&&matchConfig.squote===0&&matchConfig.dquote===0&&matchConfig.braces===0){bracket.pop();if(bracket.length===0){var functionS=isFunctionRange(ctx,str,r,c,id,dynamicArray_compute,cellRangeFunction);if(functionS.indexOf("#lucky#")>-1){functionS="".concat(functionS.replace(/#lucky#/g,""),")");}function_str+="".concat(functionS,")");str="";}else {str+=s;}}else if(s==="{"&&matchConfig.squote===0&&matchConfig.dquote===0){str+="{";matchConfig.braces+=1;}else if(s==="}"&&matchConfig.squote===0&&matchConfig.dquote===0){str+="}";matchConfig.braces-=1;}else if(s==='"'&&matchConfig.squote===0){if(matchConfig.dquote>0){if(i<funcstack.length-1&&funcstack[i+1]==='"'){i+=1;str+="\x7F";}else {matchConfig.dquote-=1;str+='"';}}else {matchConfig.dquote+=1;str+='"';}}else if(s==="'"&&matchConfig.dquote===0){str+="'";if(matchConfig.squote>0){if(i<funcstack.length-1&&funcstack[i+1]==="'"){i+=1;str+="'";}else {matchConfig.squote-=1;}}else {matchConfig.squote+=1;}}else if(s===","&&matchConfig.squote===0&&matchConfig.dquote===0&&matchConfig.braces===0){if(bracket.length<=1){var _functionS=isFunctionRange(ctx,str,r,c,id,dynamicArray_compute,cellRangeFunction);if(_functionS.indexOf("#lucky#")>-1){_functionS="".concat(_functionS.replace(/#lucky#/g,""),")");}function_str+="".concat(_functionS,",");str="";}else {str+=",";}}else if(s in operatorjson&&matchConfig.squote===0&&matchConfig.dquote===0&&matchConfig.braces===0){var s_next="";var op=operatorPriority;if(i+1<funcstack.length){s_next=funcstack[i+1];}if(s+s_next in operatorjson){if(bracket.length===0){if(lodash.trim(str).length>0){cal2.unshift(isFunctionRange(ctx,lodash.trim(str),r,c,id,dynamicArray_compute,cellRangeFunction));}else if(lodash.trim(function_str).length>0){cal2.unshift(lodash.trim(function_str));}if(cal1[0]in operatorjson){var stackCeilPri=op[cal1[0]];while(cal1.length>0&&!lodash.isNil(stackCeilPri)){cal2.unshift(cal1.shift());stackCeilPri=op[cal1[0]];}}cal1.unshift(s+s_next);function_str="";str="";}else {str+=s+s_next;}i+=1;}else {if(bracket.length===0){if(lodash.trim(str).length>0){cal2.unshift(isFunctionRange(ctx,lodash.trim(str),r,c,id,dynamicArray_compute,cellRangeFunction));}else if(lodash.trim(function_str).length>0){cal2.unshift(lodash.trim(function_str));}if(cal1[0]in operatorjson){var _stackCeilPri=op[cal1[0]];_stackCeilPri=lodash.isNil(_stackCeilPri)?1000:_stackCeilPri;var sPri=op[s];sPri=lodash.isNil(sPri)?1000:sPri;while(cal1.length>0&&sPri>=_stackCeilPri){cal2.unshift(cal1.shift());_stackCeilPri=op[cal1[0]];_stackCeilPri=lodash.isNil(_stackCeilPri)?1000:_stackCeilPri;}}cal1.unshift(s);function_str="";str="";}else {str+=s;}}}else {if(matchConfig.dquote===0&&matchConfig.squote===0){str+=lodash.trim(s);}else {str+=s;}}if(i===funcstack.length-1){var endstr="";var str_nb=lodash.trim(str).replace(/'/g,"\\'");if(iscelldata(str_nb)&&str_nb.substring(0,1)!==":"){endstr="luckysheet_getcelldata('".concat(str_nb,"')");}else if(str_nb.substring(0,1)===":"){str_nb=str_nb.substring(1);if(iscelldata(str_nb)){endstr="luckysheet_getSpecialReference(false,".concat(function_str,",'").concat(str_nb,"')");}}else {str=lodash.trim(str);var regx=/{.*?}/;if(regx.test(str)&&str.substring(0,1)!=='"'&&str.substring(str.length-1,1)!=='"'){var _regx$exec;var arraytxt=(_regx$exec=regx.exec(str))===null||_regx$exec===void 0?void 0:_regx$exec[0];var arraystart=str.search(regx);if(arraystart>0){endstr+=str.substring(0,arraystart);}endstr+="luckysheet_getarraydata('".concat(arraytxt,"')");if(arraystart+arraytxt.length<str.length){endstr+=str.substring(arraystart+arraytxt.length,str.length);}}else {endstr=str;}}if(endstr.length>0){cal2.unshift(endstr);}if(cal1.length>0){if(function_str.length>0){cal2.unshift(function_str);function_str="";}while(cal1.length>0){cal2.unshift(cal1.shift());}}if(cal2.length>0){function_str=calPostfixExpression(cal2);}else {function_str+=endstr;}}i+=1;}checkSpecialFunctionRange(ctx,function_str,r,c,id,dynamicArray_compute,cellRangeFunction);return function_str;}function getAllFunctionGroup(ctx){var luckysheetfile=ctx.luckysheetfile;var ret=[];for(var _i3=0;_i3<luckysheetfile.length;_i3+=1){var file=luckysheetfile[_i3];var calcChain=file.calcChain;var dynamicArray_compute=file.dynamicArray_compute;if(lodash.isNil(calcChain)){calcChain=[];}if(lodash.isNil(dynamicArray_compute)){dynamicArray_compute=[];}ret=ret.concat(calcChain);for(var j=0;j<dynamicArray_compute.length;j+=1){var d=dynamicArray_compute[0];ret.push({r:d.r,c:d.c,id:d.id});}}return ret;}function delFunctionGroup(ctx,r,c,id){if(lodash.isNil(id)){id=ctx.currentSheetId;}var file=ctx.luckysheetfile[getSheetIndex(ctx,id)];var calcChain=file.calcChain;if(!lodash.isNil(calcChain)){var modified=false;var calcChainClone=lodash.cloneDeep(calcChain);for(var _i4=0;_i4<calcChainClone.length;_i4+=1){var calc=calcChainClone[_i4];if(calc.r===r&&calc.c===c&&calc.id===id){calcChainClone.splice(_i4,1);modified=true;break;}}if(modified){file.calcChain=calcChainClone;}}var dynamicArray=file.dynamicArray;if(!lodash.isNil(dynamicArray)){var _modified=false;var dynamicArrayClone=lodash.cloneDeep(dynamicArray);for(var _i5=0;_i5<dynamicArrayClone.length;_i5+=1){var _calc=dynamicArrayClone[_i5];if(_calc.r===r&&_calc.c===c&&(lodash.isNil(_calc.id)||_calc.id===id)){dynamicArrayClone.splice(_i5,1);_modified=true;break;}}if(_modified){file.dynamicArray=dynamicArrayClone;}}}function checkBracketNum(fp){var bra_l=fp.match(/\(/g);var bra_r=fp.match(/\)/g);var bra_tl_txt=fp.match(/(['"])(?:(?!\1).)*?\1/g);var bra_tr_txt=fp.match(/(['"])(?:(?!\1).)*?\1/g);var bra_l_len=0;var bra_r_len=0;if(!lodash.isNil(bra_l)){bra_l_len+=bra_l.length;}if(!lodash.isNil(bra_r)){bra_r_len+=bra_r.length;}var bra_tl_len=0;var bra_tr_len=0;if(!lodash.isNil(bra_tl_txt)){for(var _i6=0;_i6<bra_tl_txt.length;_i6+=1){var bra_tl=bra_tl_txt[_i6].match(/\(/g);if(!lodash.isNil(bra_tl)){bra_tl_len+=bra_tl.length;}}}if(!lodash.isNil(bra_tr_txt)){for(var _i7=0;_i7<bra_tr_txt.length;_i7+=1){var bra_tr=bra_tr_txt[_i7].match(/\)/g);if(!lodash.isNil(bra_tr)){bra_tr_len+=bra_tr.length;}}}bra_l_len-=bra_tl_len;bra_r_len-=bra_tr_len;if(bra_l_len!==bra_r_len){return false;}return true;}function insertUpdateFunctionGroup(ctx,r,c,id){if(lodash.isNil(id)){id=ctx.currentSheetId;}var luckysheetfile=ctx.luckysheetfile;var idx=getSheetIndex(ctx,id);if(lodash.isNil(idx)){return;}var file=luckysheetfile[idx];var calcChain=file.calcChain;if(lodash.isNil(calcChain)){calcChain=[];}for(var _i8=0;_i8<calcChain.length;_i8+=1){var calc=calcChain[_i8];if(calc.r===r&&calc.c===c&&calc.id===id){return;}}var cc={r:r,c:c,id:id};calcChain.push(cc);file.calcChain=calcChain;ctx.luckysheetfile=luckysheetfile;}function execfunction(ctx,txt,r,c,id,isrefresh,notInsertFunc){if(txt.indexOf(error$2.r)>-1){return [false,error$2.r,txt];}if(!checkBracketNum(txt)){txt+=")";}if(lodash.isNil(id)){id=ctx.currentSheetId;}ctx.calculateSheetId=id;ctx.formulaCache.parser.context=ctx;var _ctx$formulaCache$par=ctx.formulaCache.parser.parse(txt.substring(1),{sheetId:id||ctx.currentSheetId}),result=_ctx$formulaCache$par.result,formulaError=_ctx$formulaCache$par.error;if(!lodash.isNil(r)&&!lodash.isNil(c)){if(isrefresh){execFunctionGroup(ctx,r,c,lodash.isNil(formulaError)?result:formulaError,id);}if(!notInsertFunc){insertUpdateFunctionGroup(ctx,r,c,id);}}return [true,lodash.isNil(formulaError)?result:formulaError,txt];}function insertUpdateDynamicArray(ctx,dynamicArrayItem){var r=dynamicArrayItem.r,c=dynamicArrayItem.c;var id=dynamicArrayItem.id;if(lodash.isNil(id)){id=ctx.currentSheetId;}var luckysheetfile=ctx.luckysheetfile;var idx=getSheetIndex(ctx,id);if(idx==null)return [];var file=luckysheetfile[idx];var dynamicArray=file.dynamicArray;if(lodash.isNil(dynamicArray)){dynamicArray=[];}for(var _i9=0;_i9<dynamicArray.length;_i9+=1){var calc=dynamicArray[_i9];if(calc.r===r&&calc.c===c&&calc.id===id){calc.data=dynamicArrayItem.data;calc.f=dynamicArrayItem.f;return dynamicArray;}}dynamicArray.push(dynamicArrayItem);return dynamicArray;}function groupValuesRefresh(ctx){var luckysheetfile=ctx.luckysheetfile;if(ctx.groupValuesRefreshData.length>0){for(var _i10=0;_i10<ctx.groupValuesRefreshData.length;_i10+=1){var item=ctx.groupValuesRefreshData[_i10];var idx=getSheetIndex(ctx,item.id);if(idx==null)continue;var file=luckysheetfile[idx];var data=file.data;if(lodash.isNil(data)){continue;}var updateValue={};if(!lodash.isNil(item.spe)){if(item.spe.type==="sparklines"){updateValue.spl=item.spe.data;}else if(item.spe.type==="dynamicArrayItem"){file.dynamicArray=insertUpdateDynamicArray(ctx,item.spe.data);}}updateValue.v=item.v;updateValue.f=item.f;setCellValue(ctx,item.r,item.c,data,updateValue);}ctx.groupValuesRefreshData=[];}}function execFunctionGroup(ctx,origin_r,origin_c,value,id,data){var isForce=arguments.length>6&&arguments[6]!==undefined?arguments[6]:false;if(lodash.isNil(data)){data=getFlowdata(ctx);}if(lodash.isNil(ctx.formulaCache.execFunctionGlobalData)){ctx.formulaCache.execFunctionGlobalData={};}if(lodash.isNil(id)){id=ctx.currentSheetId;}if(!lodash.isNil(value)){var cellCache=[[{v:undefined}]];setCellValue(ctx,0,0,cellCache,value);var _cellCache$=_slicedToArray$3(cellCache[0],1);ctx.formulaCache.execFunctionGlobalData["".concat(origin_r,"_").concat(origin_c,"_").concat(id)]=_cellCache$[0];}var calcChains=getAllFunctionGroup(ctx);var formulaObjects={};var sheets=ctx.luckysheetfile;var sheetData={};for(var _i11=0;_i11<sheets.length;_i11+=1){var sheet=sheets[_i11];sheetData[sheet.id]=sheet.data;}var updateValueOjects={};var updateValueArray=[];if(lodash.isNil(ctx.formulaCache.execFunctionExist)){var key="r".concat(origin_r,"c").concat(origin_c,"i").concat(id);updateValueOjects[key]=1;}else {for(var x=0;x<ctx.formulaCache.execFunctionExist.length;x+=1){var cell=ctx.formulaCache.execFunctionExist[x];var _key="r".concat(cell.r,"c").concat(cell.c,"i").concat(cell.i);updateValueOjects[_key]=1;}}var arrayMatchCache={};var arrayMatch=function arrayMatch(formulaArray,_formulaObjects,_updateValueOjects,func){for(var a=0;a<formulaArray.length;a+=1){var range=formulaArray[a];var cacheKey="r".concat(range.row[0]).concat(range.row[1],"c").concat(range.column[0]).concat(range.column[1],"id").concat(range.sheetId);if(cacheKey in arrayMatchCache){var amc=arrayMatchCache[cacheKey];amc.forEach(function(item){func(item.key,item.r,item.c,item.sheetId);});}else {var functionArr=[];for(var r=range.row[0];r<=range.row[1];r+=1){for(var c=range.column[0];c<=range.column[1];c+=1){var _key2="r".concat(r,"c").concat(c,"i").concat(range.sheetId);func(_key2,r,c,range.sheetId);if(_formulaObjects&&_key2 in _formulaObjects||_updateValueOjects&&_key2 in _updateValueOjects){functionArr.push({key:_key2,r:r,c:c,sheetId:range.sheetId});}}}if(_formulaObjects||_updateValueOjects){arrayMatchCache[cacheKey]=functionArr;}}}};var _loop=function _loop(){var formulaCell=calcChains[_i12];var key="r".concat(formulaCell.r,"c").concat(formulaCell.c,"i").concat(formulaCell.id);var calc_funcStr=getcellFormula(ctx,formulaCell.r,formulaCell.c,formulaCell.id);if(lodash.isNil(calc_funcStr)){return 1;// continue
|
|
34740
|
+
}}if(isNegative){return "-"+v;}else {return v;}}if(isgeneral(sfmt,0))return general_fmt(v,o);if(v instanceof Date)v=datenum_local(v,o.date1904);var f=choose_fmt(sfmt,v);if(isgeneral(f[1]))return general_fmt(v,o);if(v===true)v="TRUE";else if(v===false)v="FALSE";else if(v===""||v==null)return "";return eval_fmt(f[1],v,o,f[0]);}function load_entry(fmt,idx){if(typeof idx!="number"){idx=+idx||-1;for(var i=0;i<0x0188;++i){if(table_fmt[i]==undefined){if(idx<0)idx=i;continue;}if(table_fmt[i]==fmt){idx=i;break;}}if(idx<0)idx=0x187;}table_fmt[idx]=fmt;return idx;}SSF.load=load_entry;SSF._table=table_fmt;SSF.get_table=function get_table(){return table_fmt;};SSF.load_table=function load_table(tbl){for(var i=0;i!=0x0188;++i)if(tbl[i]!==undefined)load_entry(tbl[i],i);};SSF.init_table=init_table;SSF.format=format;};make_ssf(SSF);var intThousands=function intThousands(number){var groupSeparator=arguments.length>1&&arguments[1]!==undefined?arguments[1]:',';return String(number).replace(/\B(?=(\d{3})+(?!\d))/g,groupSeparator);};var numberThousands=function numberThousands(number){var groupSeparator=arguments.length>1&&arguments[1]!==undefined?arguments[1]:',';var precision=arguments.length>2?arguments[2]:undefined;if(number===0)return '0';if(!number)return number;var _number=!['',undefined].includes(precision)?formatNumber(number,precision):number;if(String(_number).includes('.')){var _String$split=String(_number).split('.'),_String$split2=_slicedToArray$3(_String$split,2),init=_String$split2[0],decimal=_String$split2[1];return intThousands(init,groupSeparator)+'.'+decimal;}else {return intThousands(_number,groupSeparator);}};function formatNumber(num,precision){return parseFloat(Number(num).toFixed(precision));}var base1904=new Date(1900,2,1,0,0,0);function datenum_local(v,date1904){var epoch=Date.UTC(v.getFullYear(),v.getMonth(),v.getDate(),v.getHours(),v.getMinutes(),v.getSeconds());var dnthresh_utc=Date.UTC(1899,11,31,0,0,0);if(date1904)epoch-=1461*24*60*60*1000;else if(v>=base1904)epoch+=24*60*60*1000;return (epoch-dnthresh_utc)/(24*60*60*1000);}var good_pd_date=new Date("2017-02-19T19:06:09.000Z");if(Number.isNaN(good_pd_date.getFullYear()))good_pd_date=new Date("2/19/17");var good_pd=good_pd_date.getFullYear()===2017;function parseDate(str,fixdate){var d=new Date(str);if(good_pd){if(!lodash.isNil(fixdate)){if(fixdate>0)d.setTime(d.getTime()+d.getTimezoneOffset()*60*1000);else if(fixdate<0)d.setTime(d.getTime()-d.getTimezoneOffset()*60*1000);}return d;}if(str instanceof Date)return str;if(good_pd_date.getFullYear()===1917&&!Number.isNaN(d.getFullYear())){var s=d.getFullYear();if(str.indexOf("".concat(s))>-1)return d;d.setFullYear(d.getFullYear()+100);return d;}var n=str.match(/\d+/g)||["2017","2","19","0","0","0"];var out=new Date(+n[0],+n[1]-1,+n[2],+n[3]||0,+n[4]||0,+n[5]||0);if(str.indexOf("Z")>-1)out=new Date(out.getTime()-out.getTimezoneOffset()*60*1000);return out;}function genarate(value){var m=null;var ct={};var v=value;if(lodash.isNil(value)){return null;}if(/^-?[0-9]{1,}[,][0-9]{3}(.[0-9]{1,2})?$/.test(value)){value=value;m=value;v=Number(value.split(".")[0].replace(",",""));var fa="#,##0";if(value.split(".")[1]){fa="#,##0.";for(var i=0;i<value.split(".")[1].length;i+=1){fa+=0;}}ct={fa:fa,t:"n"};}else if(value.toString().substring(0,1)==="'"){m=value.toString().substring(1);ct={fa:"@",t:"s"};}else if(value.toString().toUpperCase()==="TRUE"){m="TRUE";ct={fa:"General",t:"b"};v=true;}else if(value.toString().toUpperCase()==="FALSE"){m="FALSE";ct={fa:"General",t:"b"};v=false;}else if(valueIsError(value.toString())){m=value.toString();ct={fa:"General",t:"e"};}else if(/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(value)){m=value.toString();ct={fa:"@",t:"s"};}else if(isRealNum(value)&&Math.abs(parseFloat(value))>0&&(Math.abs(parseFloat(value))>=1e11||Math.abs(parseFloat(value))<1e-9)){v=parseFloat(value);var str=v.toExponential();if(str.indexOf(".")>-1){var strlen=str.split(".")[1].split("e")[0].length;if(strlen>5){strlen=5;}ct={fa:"#0.".concat(new Array(strlen+1).join("0"),"E+00"),t:"n"};}else {ct={fa:"#0.E+00",t:"n"};}m=SSF.format(ct.fa,v);}else if(value.toString().indexOf("%")>-1){var index=value.toString().indexOf("%");var value2=value.toString().substring(0,index);var value3=value2.replace(/,/g,"");if(index===value.toString().length-1&&isRealNum(value3)){if(value2.indexOf(".")>-1){if(value2.indexOf(".")===value2.lastIndexOf(".")){var value4=value2.split(".")[0];var value5=value2.split(".")[1];var len=value5.length;if(len>9){len=9;}if(value4.indexOf(",")>-1){var isThousands=true;var ThousandsArr=value4.split(",");for(var _i=1;_i<ThousandsArr.length;_i+=1){if(ThousandsArr[_i].length<3){isThousands=false;break;}}if(isThousands){ct={fa:"#,##0.".concat(new Array(len+1).join("0"),"%"),t:"n"};v=numeral(value).value();m=SSF.format(ct.fa,v);}else {m=value.toString();ct={fa:"@",t:"s"};}}else {ct={fa:"0.".concat(new Array(len+1).join("0"),"%"),t:"n"};v=numeral(value).value();m=SSF.format(ct.fa,v);}}else {m=value.toString();ct={fa:"@",t:"s"};}}else if(value2.indexOf(",")>-1){var _isThousands=true;var _ThousandsArr=value2.split(",");for(var _i2=1;_i2<_ThousandsArr.length;_i2+=1){if(_ThousandsArr[_i2].length<3){_isThousands=false;break;}}if(_isThousands){ct={fa:"#,##0%",t:"n"};v=numeral(value).value();m=SSF.format(ct.fa,v);}else {m=value.toString();ct={fa:"@",t:"s"};}}else {ct={fa:"0%",t:"n"};v=numeral(value).value();m=SSF.format(ct.fa,v);}}else {m=value.toString();ct={fa:"@",t:"s"};}}else if(value.toString().indexOf(".")>-1){if(value.toString().indexOf(".")===value.toString().lastIndexOf(".")){var value1=value.toString().split(".")[0];var _value=value.toString().split(".")[1];var _len=_value.length;if(_len>9){_len=9;}if(value1.indexOf(",")>-1){var _isThousands2=true;var _ThousandsArr2=value1.split(",");for(var _i3=1;_i3<_ThousandsArr2.length;_i3+=1){if(!isRealNum(_ThousandsArr2[_i3])||_ThousandsArr2[_i3].length<3){_isThousands2=false;break;}}if(_isThousands2){ct={fa:"#,##0.".concat(new Array(_len+1).join("0")),t:"n"};v=numeral(value).value();m=SSF.format(ct.fa,v);}else {m=value.toString();ct={fa:"@",t:"s"};}}else {if(isRealNum(value1)&&isRealNum(_value)){ct={fa:"0.".concat(new Array(_len+1).join("0")),t:"n"};v=numeral(value).value();m=SSF.format(ct.fa,v);}else {m=value.toString();ct={fa:"@",t:"s"};}}}else {m=value.toString();ct={fa:"@",t:"s"};}}else if(isRealNum(value)){m=parseFloat(value).toString();ct={fa:"General",t:"n"};v=parseFloat(value);}else if(isdatetime(value)&&(value.toString().indexOf(".")>-1||value.toString().indexOf(":")>-1||value.toString().length<16)){v=datenum_local(parseDate(value.toString().replace(/-/g,"/")));if(v.toString().indexOf(".")>-1){if(value.toString().length>18){ct.fa="yyyy-MM-dd hh:mm:ss";}else if(value.toString().length>11){ct.fa="yyyy-MM-dd hh:mm";}else {ct.fa="yyyy-MM-dd";}}else {ct.fa="yyyy-MM-dd";}ct.t="d";m=SSF.format(ct.fa,v);}else {m=value;ct.fa="General";ct.t="g";}return [m,ct,v];}function update(fmt,v){return SSF.format(fmt,v);}function is_date(fmt,v){return SSF.is_date(fmt,v);}function fuzzynum(s){var v=Number(s);if(typeof s==="number"){return s;}if(!Number.isNaN(v))return v;var wt=1;var ss=s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g,function(){wt*=100;return "";});v=Number(ss);if(!Number.isNaN(v))return v/wt;ss=ss.replace(/[(](.*)[)]/,function($$,$1){wt=-wt;return $1;});v=Number(ss);if(!Number.isNaN(v))return v/wt;return v;}function valueShowEs(r,c,d){var value=getCellValue(r,c,d,"m");if(value==null){value=getCellValue(r,c,d,"v");}else {var _d$r,_d$r$c,_d$r$c$ct,_d$r2,_d$r2$c,_d$r2$c$ct;if(!Number.isNaN(fuzzynum(value))){if(lodash.isString(value)&&value.indexOf("%")>-1);else {value=getCellValue(r,c,d,"v");}}else if(((_d$r=d[r])===null||_d$r===void 0?void 0:(_d$r$c=_d$r[c])===null||_d$r$c===void 0?void 0:(_d$r$c$ct=_d$r$c.ct)===null||_d$r$c$ct===void 0?void 0:_d$r$c$ct.t)==="d");else if(((_d$r2=d[r])===null||_d$r2===void 0?void 0:(_d$r2$c=_d$r2[c])===null||_d$r2$c===void 0?void 0:(_d$r2$c$ct=_d$r2$c.ct)===null||_d$r2$c$ct===void 0?void 0:_d$r2$c$ct.t)==="b");else {value=getCellValue(r,c,d,"v");}}return value;}var colors=["#c1232b","#27727b","#fcce10","#e87c25","#b5c334","#fe8463","#9bca63","#fad860","#f3a43b","#60c0dd","#d7504b","#c6e579","#f4e001","#f0805a","#26c0c0","#c12e34","#e6b600","#0098d9","#2b821d","#005eaa","#339ca8","#cda819","#32a487","#3fb1e3","#6be6c1","#626c91","#a0a7e6","#c4ebad","#96dee8"];function mousePosition(x,y,ctx){var newX=x-ctx.rowHeaderWidth;var newY=y-ctx.toolbarHeight-ctx.calculatebarHeight-ctx.columnHeaderHeight;return [newX,newY];}function rowLocationByIndex(row_index,visibleRow){var row=0;var row_pre=0;row=visibleRow[row_index];if(row_index===0){row_pre=0;}else {row_pre=visibleRow[row_index-1];}return [row_pre,row,row_index];}function rowLocation(y,visibleRow){var row_index=lodash.sortedIndex(visibleRow,y);if(row_index>=visibleRow.length&&y>0){row_index=visibleRow.length-1;}else if(row_index===-1&&y<=0){row_index=0;}return rowLocationByIndex(row_index,visibleRow);}function colLocationByIndex(col_index,visibleCol){var col=0;var col_pre=0;col=visibleCol[col_index];if(col_index===0){col_pre=0;}else {col_pre=visibleCol[col_index-1];}return [col_pre,col,col_index];}function colLocation(x,visibleCol){var col_index=lodash.sortedIndex(visibleCol,x);if(col_index>=visibleCol.length&&x>0){col_index=visibleCol.length-1;}else if(col_index===-1&&x<=0){col_index=0;}return colLocationByIndex(col_index,visibleCol);}var functionHTMLIndex=0;var rangeIndexes=[];var operatorPriority={"^":0,"%":1,"*":1,"/":1,"+":2,"-":2};var operatorArr="==|!=|<>|<=|>=|=|+|-|>|<|/|*|%|&|^".split("|");var operatorjson={};for(var i=0;i<operatorArr.length;i+=1){operatorjson[operatorArr[i].toString()]=1;}var simpleSheetName$2="[A-Za-z0-9_\xC0-\u02AF]+";var quotedSheetName$2="'(?:(?!').|'')*'";var sheetNameRegexp$2="(".concat(simpleSheetName$2,"|").concat(quotedSheetName$2,")!");var rowColumnRegexp="[$]?[A-Za-z]+[$]?[0-9]+";var rowColumnWithSheetName="(?:".concat(sheetNameRegexp$2,")?(").concat(rowColumnRegexp,")");var LABEL_EXTRACT_REGEXP$1=new RegExp("^".concat(rowColumnWithSheetName,"(?:[:]").concat(rowColumnWithSheetName,")?$"));var FormulaCache=/*#__PURE__*/function(){function FormulaCache(){_classCallCheck$1(this,FormulaCache);this.parser=void 0;this.func_selectedrange=void 0;this.data_parm_index=void 0;this.cellTextToIndexList=void 0;this.rangechangeindex=void 0;this.selectingRangeIndex=void 0;this.rangeResizeObj=void 0;this.rangeResize=void 0;this.rangeResizeIndex=void 0;this.rangeResizexy=void 0;this.rangeResizeWinH=void 0;this.rangeResizeWinW=void 0;this.rangeResizeTo=void 0;this.rangeSetValueTo=void 0;this.rangeIndex=void 0;this.rangestart=void 0;this.rangetosheet=void 0;this.rangedrag_column_start=void 0;this.rangedrag_row_start=void 0;this.functionRangeIndex=void 0;this.functionlistMap=void 0;this.execFunctionExist=void 0;this.execFunctionGlobalData=void 0;var that=this;this.data_parm_index=0;this.selectingRangeIndex=-1;this.functionlistMap={};this.execFunctionGlobalData={};this.cellTextToIndexList={};this.parser=new Parser$1();this.parser.on("callCellValue",function(cellCoord,options,done){var _context$formulaCache,_flowdata$cellCoord$r;var context=that.parser.context;var id=cellCoord.sheetName==null?options.sheetId:getSheetIdByName(context,cellCoord.sheetName);if(id==null)throw Error(ERROR_REF);var flowdata=getFlowdata(context,id);var cell=(context===null||context===void 0?void 0:(_context$formulaCache=context.formulaCache.execFunctionGlobalData)===null||_context$formulaCache===void 0?void 0:_context$formulaCache["".concat(cellCoord.row.index,"_").concat(cellCoord.column.index,"_").concat(id)])||(flowdata===null||flowdata===void 0?void 0:(_flowdata$cellCoord$r=flowdata[cellCoord.row.index])===null||_flowdata$cellCoord$r===void 0?void 0:_flowdata$cellCoord$r[cellCoord.column.index]);var v=that.tryGetCellAsNumber(cell);done(v);});this.parser.on("callRangeValue",function(startCellCoord,endCellCoord,options,done){var context=that.parser.context;var id=startCellCoord.sheetName==null?options.sheetId:getSheetIdByName(context,startCellCoord.sheetName);if(id==null)throw Error(ERROR_REF);var flowdata=getFlowdata(context,id);var fragment=[];var startRow=startCellCoord.row.index;var endRow=endCellCoord.row.index;var startCol=startCellCoord.column.index;var endCol=endCellCoord.column.index;var emptyRow=startRow===-1||endRow===-1;var emptyCol=startCol===-1||endCol===-1;if(emptyRow){var _flowdata$length;startRow=0;endRow=(_flowdata$length=flowdata===null||flowdata===void 0?void 0:flowdata.length)!==null&&_flowdata$length!==void 0?_flowdata$length:0;}if(emptyCol){var _flowdata$0$length;startCol=0;endCol=(_flowdata$0$length=flowdata===null||flowdata===void 0?void 0:flowdata[0].length)!==null&&_flowdata$0$length!==void 0?_flowdata$0$length:0;}if(emptyRow&&emptyCol)throw Error(ERROR_REF);for(var row=startRow;row<=endRow;row+=1){var colFragment=[];for(var col=startCol;col<=endCol;col+=1){var _context$formulaCache2,_flowdata$row;var cell=(context===null||context===void 0?void 0:(_context$formulaCache2=context.formulaCache.execFunctionGlobalData)===null||_context$formulaCache2===void 0?void 0:_context$formulaCache2["".concat(row,"_").concat(col,"_").concat(id)])||(flowdata===null||flowdata===void 0?void 0:(_flowdata$row=flowdata[row])===null||_flowdata$row===void 0?void 0:_flowdata$row[col]);var v=that.tryGetCellAsNumber(cell);colFragment.push(v);}fragment.push(colFragment);}if(fragment){done(fragment);}});}return _createClass$1(FormulaCache,[{key:"tryGetCellAsNumber",value:function tryGetCellAsNumber(cell){var _cell$ct;if((cell===null||cell===void 0?void 0:(_cell$ct=cell.ct)===null||_cell$ct===void 0?void 0:_cell$ct.t)==="n"){var n=Number(cell===null||cell===void 0?void 0:cell.v);return Number.isNaN(n)?cell.v:n;}return cell===null||cell===void 0?void 0:cell.v;}}]);}();function parseElement(eleString){return new DOMParser().parseFromString(eleString,"text/html").body.childNodes[0];}function iscelldata(txt){var val=txt.split("!");var rangetxt;if(val.length>1){var _val=_slicedToArray$3(val,2);rangetxt=_val[1];}else {var _val2=_slicedToArray$3(val,1);rangetxt=_val2[0];}var reg_cell=/^(([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+))$/g;var reg_cellRange=/^(((([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+)))|((([a-zA-Z]+)|([$][a-zA-Z]+))))$/g;if(rangetxt.indexOf(":")===-1){var _row=parseInt(rangetxt.replace(/[^0-9]/g,""),10)-1;var _col=columnCharToIndex(rangetxt.replace(/[^A-Za-z]/g,""));if(!Number.isNaN(_row)&&!Number.isNaN(_col)&&rangetxt.toString().match(reg_cell)){return true;}if(!Number.isNaN(_row)){return false;}if(!Number.isNaN(_col)){return false;}return false;}reg_cellRange=/^(((([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+)))|((([a-zA-Z]+)|([$][a-zA-Z]+)))|((([0-9]+)|([$][0-9]+s))))$/g;var rangetxtArr=rangetxt.split(":");var row=[];var col=[];row[0]=parseInt(rangetxtArr[0].replace(/[^0-9]/g,""),10)-1;row[1]=parseInt(rangetxtArr[1].replace(/[^0-9]/g,""),10)-1;if(row[0]>row[1]){return false;}col[0]=columnCharToIndex(rangetxtArr[0].replace(/[^A-Za-z]/g,""));col[1]=columnCharToIndex(rangetxtArr[1].replace(/[^A-Za-z]/g,""));if(col[0]>col[1]){return false;}if(rangetxtArr[0].toString().match(reg_cellRange)&&rangetxtArr[1].toString().match(reg_cellRange)){return true;}return false;}function addToCellIndexList(ctx,txt,infoObj){if(lodash.isNil(txt)||txt.length===0||lodash.isNil(infoObj)){return;}if(lodash.isNil(ctx.formulaCache.cellTextToIndexList)){ctx.formulaCache.cellTextToIndexList={};}if(txt.indexOf("!")>-1){txt=txt.replace(/\\'/g,"'").replace(/''/g,"'");ctx.formulaCache.cellTextToIndexList[txt]=infoObj;}else {ctx.formulaCache.cellTextToIndexList["".concat(txt,"_").concat(infoObj.sheetId)]=infoObj;}}function getcellrange(ctx,txt,formulaId){if(lodash.isNil(txt)||txt.length===0){return null;}var flowdata=getFlowdata(ctx,formulaId);var sheettxt="";var rangetxt="";var sheetId=null;var sheetdata=null;var luckysheetfile=ctx.luckysheetfile;if(txt.indexOf("!")>-1){if(txt in ctx.formulaCache.cellTextToIndexList){return ctx.formulaCache.cellTextToIndexList[txt];}var matchRes=txt.match(LABEL_EXTRACT_REGEXP$1);if(matchRes==null){return null;}var _matchRes=_slicedToArray$3(matchRes,5),sheettxt1=_matchRes[1],starttxt1=_matchRes[2],sheettxt2=_matchRes[3],starttxt2=_matchRes[4];if(sheettxt2!=null&&sheettxt1!==sheettxt2){return null;}rangetxt=starttxt2?"".concat(starttxt1,":").concat(starttxt2):starttxt1;sheettxt=sheettxt1.replace(/^'|'$/g,"").replace(/\\'/g,"'").replace(/''/g,"'");lodash.forEach(luckysheetfile,function(f){if(sheettxt===f.name){sheetId=f.id;sheetdata=f.data;return false;}return true;});}else {var _i=formulaId;if(lodash.isNil(_i)){_i=ctx.currentSheetId;}if("".concat(txt,"_").concat(_i)in ctx.formulaCache.cellTextToIndexList){return ctx.formulaCache.cellTextToIndexList["".concat(txt,"_").concat(_i)];}var index=getSheetIndex(ctx,_i);if(lodash.isNil(index)){return null;}sheettxt=luckysheetfile[index].name;sheetId=luckysheetfile[index].id;sheetdata=flowdata;rangetxt=txt;}if(lodash.isNil(sheetdata)){return null;}if(rangetxt.indexOf(":")===-1){var _row2=parseInt(rangetxt.replace(/[^0-9]/g,""),10)-1;var _col2=columnCharToIndex(rangetxt.replace(/[^A-Za-z]/g,""));if(!Number.isNaN(_row2)&&!Number.isNaN(_col2)){var _item={row:[_row2,_row2],column:[_col2,_col2],sheetId:sheetId};addToCellIndexList(ctx,txt,_item);return _item;}return null;}var rangetxtArr=rangetxt.split(":");var row=[];var col=[];row[0]=parseInt(rangetxtArr[0].replace(/[^0-9]/g,""),10)-1;row[1]=parseInt(rangetxtArr[1].replace(/[^0-9]/g,""),10)-1;if(Number.isNaN(row[0])){row[0]=0;}if(Number.isNaN(row[1])){row[1]=sheetdata.length-1;}if(row[0]>row[1]){return null;}col[0]=columnCharToIndex(rangetxtArr[0].replace(/[^A-Za-z]/g,""));col[1]=columnCharToIndex(rangetxtArr[1].replace(/[^A-Za-z]/g,""));if(Number.isNaN(col[0])){col[0]=0;}if(Number.isNaN(col[1])){col[1]=sheetdata[0].length-1;}if(col[0]>col[1]){return null;}var item={row:row,column:col,sheetId:sheetId};addToCellIndexList(ctx,txt,item);return item;}function calPostfixExpression(cal){if(cal.length===0){return "";}var stack=[];for(var _i2=cal.length-1;_i2>=0;_i2-=1){var c=cal[_i2];if(c in operatorjson){var s2=stack.pop();var s1=stack.pop();var str="luckysheet_compareWith(".concat(s1,",'").concat(c,"', ").concat(s2,")");stack.push(str);}else {stack.push(c);}}if(stack.length>0){return stack[0];}return "";}function checkSpecialFunctionRange(ctx,function_str,r,c,id,dynamicArray_compute,cellRangeFunction){if(function_str.substring(0,30)==="luckysheet_getSpecialReference"||function_str.substring(0,20)==="luckysheet_function."){if(function_str.substring(0,20)==="luckysheet_function."){var funcName=function_str.split(".")[1];if(!lodash.isNil(funcName)){funcName=funcName.toUpperCase();if(funcName!=="INDIRECT"&&funcName!=="OFFSET"&&funcName!=="INDEX"){return;}}}try{ctx.calculateSheetId=id;var str=function_str.split(",")[function_str.split(",").length-1].split("'")[1].split("'")[0];var str_nb=lodash.trim(str);if(iscelldata(str_nb)){if(typeof cellRangeFunction==="function"){cellRangeFunction(str_nb);}}}catch(_unused){}}}function isFunctionRange(ctx,txt,r,c,id,dynamicArray_compute,cellRangeFunction){if(txt.substring(0,1)==="="){txt=txt.substring(1);}var funcstack=txt.split("");var i=0;var str="";var function_str="";var matchConfig={bracket:0,comma:0,squote:0,dquote:0,compare:0,braces:0};var cal1=[];var cal2=[];var bracket=[];while(i<funcstack.length){var s=funcstack[i];if(s==="("&&matchConfig.squote===0&&matchConfig.dquote===0&&matchConfig.braces===0){if(str.length>0&&bracket.length===0){str=str.toUpperCase();if(str.indexOf(":")>-1){var funcArray=str.split(":");function_str+="luckysheet_getSpecialReference(true,'".concat(lodash.trim(funcArray[0]).replace(/'/g,"\\'"),"', luckysheet_function.").concat(funcArray[1],".f(#lucky#");}else {function_str+="luckysheet_function.".concat(str,".f(");}bracket.push(1);str="";}else if(bracket.length===0){function_str+="(";bracket.push(0);str="";}else {bracket.push(0);str+=s;}}else if(s===")"&&matchConfig.squote===0&&matchConfig.dquote===0&&matchConfig.braces===0){bracket.pop();if(bracket.length===0){var functionS=isFunctionRange(ctx,str,r,c,id,dynamicArray_compute,cellRangeFunction);if(functionS.indexOf("#lucky#")>-1){functionS="".concat(functionS.replace(/#lucky#/g,""),")");}function_str+="".concat(functionS,")");str="";}else {str+=s;}}else if(s==="{"&&matchConfig.squote===0&&matchConfig.dquote===0){str+="{";matchConfig.braces+=1;}else if(s==="}"&&matchConfig.squote===0&&matchConfig.dquote===0){str+="}";matchConfig.braces-=1;}else if(s==='"'&&matchConfig.squote===0){if(matchConfig.dquote>0){if(i<funcstack.length-1&&funcstack[i+1]==='"'){i+=1;str+="\x7F";}else {matchConfig.dquote-=1;str+='"';}}else {matchConfig.dquote+=1;str+='"';}}else if(s==="'"&&matchConfig.dquote===0){str+="'";if(matchConfig.squote>0){if(i<funcstack.length-1&&funcstack[i+1]==="'"){i+=1;str+="'";}else {matchConfig.squote-=1;}}else {matchConfig.squote+=1;}}else if(s===","&&matchConfig.squote===0&&matchConfig.dquote===0&&matchConfig.braces===0){if(bracket.length<=1){var _functionS=isFunctionRange(ctx,str,r,c,id,dynamicArray_compute,cellRangeFunction);if(_functionS.indexOf("#lucky#")>-1){_functionS="".concat(_functionS.replace(/#lucky#/g,""),")");}function_str+="".concat(_functionS,",");str="";}else {str+=",";}}else if(s in operatorjson&&matchConfig.squote===0&&matchConfig.dquote===0&&matchConfig.braces===0){var s_next="";var op=operatorPriority;if(i+1<funcstack.length){s_next=funcstack[i+1];}if(s+s_next in operatorjson){if(bracket.length===0){if(lodash.trim(str).length>0){cal2.unshift(isFunctionRange(ctx,lodash.trim(str),r,c,id,dynamicArray_compute,cellRangeFunction));}else if(lodash.trim(function_str).length>0){cal2.unshift(lodash.trim(function_str));}if(cal1[0]in operatorjson){var stackCeilPri=op[cal1[0]];while(cal1.length>0&&!lodash.isNil(stackCeilPri)){cal2.unshift(cal1.shift());stackCeilPri=op[cal1[0]];}}cal1.unshift(s+s_next);function_str="";str="";}else {str+=s+s_next;}i+=1;}else {if(bracket.length===0){if(lodash.trim(str).length>0){cal2.unshift(isFunctionRange(ctx,lodash.trim(str),r,c,id,dynamicArray_compute,cellRangeFunction));}else if(lodash.trim(function_str).length>0){cal2.unshift(lodash.trim(function_str));}if(cal1[0]in operatorjson){var _stackCeilPri=op[cal1[0]];_stackCeilPri=lodash.isNil(_stackCeilPri)?1000:_stackCeilPri;var sPri=op[s];sPri=lodash.isNil(sPri)?1000:sPri;while(cal1.length>0&&sPri>=_stackCeilPri){cal2.unshift(cal1.shift());_stackCeilPri=op[cal1[0]];_stackCeilPri=lodash.isNil(_stackCeilPri)?1000:_stackCeilPri;}}cal1.unshift(s);function_str="";str="";}else {str+=s;}}}else {if(matchConfig.dquote===0&&matchConfig.squote===0){str+=lodash.trim(s);}else {str+=s;}}if(i===funcstack.length-1){var endstr="";var str_nb=lodash.trim(str).replace(/'/g,"\\'");if(iscelldata(str_nb)&&str_nb.substring(0,1)!==":"){endstr="luckysheet_getcelldata('".concat(str_nb,"')");}else if(str_nb.substring(0,1)===":"){str_nb=str_nb.substring(1);if(iscelldata(str_nb)){endstr="luckysheet_getSpecialReference(false,".concat(function_str,",'").concat(str_nb,"')");}}else {str=lodash.trim(str);var regx=/{.*?}/;if(regx.test(str)&&str.substring(0,1)!=='"'&&str.substring(str.length-1,1)!=='"'){var _regx$exec;var arraytxt=(_regx$exec=regx.exec(str))===null||_regx$exec===void 0?void 0:_regx$exec[0];var arraystart=str.search(regx);if(arraystart>0){endstr+=str.substring(0,arraystart);}endstr+="luckysheet_getarraydata('".concat(arraytxt,"')");if(arraystart+arraytxt.length<str.length){endstr+=str.substring(arraystart+arraytxt.length,str.length);}}else {endstr=str;}}if(endstr.length>0){cal2.unshift(endstr);}if(cal1.length>0){if(function_str.length>0){cal2.unshift(function_str);function_str="";}while(cal1.length>0){cal2.unshift(cal1.shift());}}if(cal2.length>0){function_str=calPostfixExpression(cal2);}else {function_str+=endstr;}}i+=1;}checkSpecialFunctionRange(ctx,function_str,r,c,id,dynamicArray_compute,cellRangeFunction);return function_str;}function getAllFunctionGroup(ctx){var luckysheetfile=ctx.luckysheetfile;var ret=[];for(var _i3=0;_i3<luckysheetfile.length;_i3+=1){var file=luckysheetfile[_i3];var calcChain=file.calcChain;var dynamicArray_compute=file.dynamicArray_compute;if(lodash.isNil(calcChain)){calcChain=[];}if(lodash.isNil(dynamicArray_compute)){dynamicArray_compute=[];}ret=ret.concat(calcChain);for(var j=0;j<dynamicArray_compute.length;j+=1){var d=dynamicArray_compute[0];ret.push({r:d.r,c:d.c,id:d.id});}}return ret;}function delFunctionGroup(ctx,r,c,id){if(lodash.isNil(id)){id=ctx.currentSheetId;}var file=ctx.luckysheetfile[getSheetIndex(ctx,id)];var calcChain=file.calcChain;if(!lodash.isNil(calcChain)){var modified=false;var calcChainClone=lodash.cloneDeep(calcChain);for(var _i4=0;_i4<calcChainClone.length;_i4+=1){var calc=calcChainClone[_i4];if(calc.r===r&&calc.c===c&&calc.id===id){calcChainClone.splice(_i4,1);modified=true;break;}}if(modified){file.calcChain=calcChainClone;}}var dynamicArray=file.dynamicArray;if(!lodash.isNil(dynamicArray)){var _modified=false;var dynamicArrayClone=lodash.cloneDeep(dynamicArray);for(var _i5=0;_i5<dynamicArrayClone.length;_i5+=1){var _calc=dynamicArrayClone[_i5];if(_calc.r===r&&_calc.c===c&&(lodash.isNil(_calc.id)||_calc.id===id)){dynamicArrayClone.splice(_i5,1);_modified=true;break;}}if(_modified){file.dynamicArray=dynamicArrayClone;}}}function checkBracketNum(fp){var bra_l=fp.match(/\(/g);var bra_r=fp.match(/\)/g);var bra_tl_txt=fp.match(/(['"])(?:(?!\1).)*?\1/g);var bra_tr_txt=fp.match(/(['"])(?:(?!\1).)*?\1/g);var bra_l_len=0;var bra_r_len=0;if(!lodash.isNil(bra_l)){bra_l_len+=bra_l.length;}if(!lodash.isNil(bra_r)){bra_r_len+=bra_r.length;}var bra_tl_len=0;var bra_tr_len=0;if(!lodash.isNil(bra_tl_txt)){for(var _i6=0;_i6<bra_tl_txt.length;_i6+=1){var bra_tl=bra_tl_txt[_i6].match(/\(/g);if(!lodash.isNil(bra_tl)){bra_tl_len+=bra_tl.length;}}}if(!lodash.isNil(bra_tr_txt)){for(var _i7=0;_i7<bra_tr_txt.length;_i7+=1){var bra_tr=bra_tr_txt[_i7].match(/\)/g);if(!lodash.isNil(bra_tr)){bra_tr_len+=bra_tr.length;}}}bra_l_len-=bra_tl_len;bra_r_len-=bra_tr_len;if(bra_l_len!==bra_r_len){return false;}return true;}function insertUpdateFunctionGroup(ctx,r,c,id){if(lodash.isNil(id)){id=ctx.currentSheetId;}var luckysheetfile=ctx.luckysheetfile;var idx=getSheetIndex(ctx,id);if(lodash.isNil(idx)){return;}var file=luckysheetfile[idx];var calcChain=file.calcChain;if(lodash.isNil(calcChain)){calcChain=[];}for(var _i8=0;_i8<calcChain.length;_i8+=1){var calc=calcChain[_i8];if(calc.r===r&&calc.c===c&&calc.id===id){return;}}var cc={r:r,c:c,id:id};calcChain.push(cc);file.calcChain=calcChain;ctx.luckysheetfile=luckysheetfile;}function execfunction(ctx,txt,r,c,id,isrefresh,notInsertFunc){if(txt.indexOf(error$2.r)>-1){return [false,error$2.r,txt];}if(!checkBracketNum(txt)){txt+=")";}if(lodash.isNil(id)){id=ctx.currentSheetId;}ctx.calculateSheetId=id;ctx.formulaCache.parser.context=ctx;var _ctx$formulaCache$par=ctx.formulaCache.parser.parse(txt.substring(1),{sheetId:id||ctx.currentSheetId}),result=_ctx$formulaCache$par.result,formulaError=_ctx$formulaCache$par.error;if(!lodash.isNil(r)&&!lodash.isNil(c)){if(isrefresh){execFunctionGroup(ctx,r,c,lodash.isNil(formulaError)?result:formulaError,id);}if(!notInsertFunc){insertUpdateFunctionGroup(ctx,r,c,id);}}return [true,lodash.isNil(formulaError)?result:formulaError,txt];}function insertUpdateDynamicArray(ctx,dynamicArrayItem){var r=dynamicArrayItem.r,c=dynamicArrayItem.c;var id=dynamicArrayItem.id;if(lodash.isNil(id)){id=ctx.currentSheetId;}var luckysheetfile=ctx.luckysheetfile;var idx=getSheetIndex(ctx,id);if(idx==null)return [];var file=luckysheetfile[idx];var dynamicArray=file.dynamicArray;if(lodash.isNil(dynamicArray)){dynamicArray=[];}for(var _i9=0;_i9<dynamicArray.length;_i9+=1){var calc=dynamicArray[_i9];if(calc.r===r&&calc.c===c&&calc.id===id){calc.data=dynamicArrayItem.data;calc.f=dynamicArrayItem.f;return dynamicArray;}}dynamicArray.push(dynamicArrayItem);return dynamicArray;}function groupValuesRefresh(ctx){var luckysheetfile=ctx.luckysheetfile;if(ctx.groupValuesRefreshData.length>0){for(var _i10=0;_i10<ctx.groupValuesRefreshData.length;_i10+=1){var item=ctx.groupValuesRefreshData[_i10];var idx=getSheetIndex(ctx,item.id);if(idx==null)continue;var file=luckysheetfile[idx];var data=file.data;if(lodash.isNil(data)){continue;}var updateValue={};if(!lodash.isNil(item.spe)){if(item.spe.type==="sparklines"){updateValue.spl=item.spe.data;}else if(item.spe.type==="dynamicArrayItem"){file.dynamicArray=insertUpdateDynamicArray(ctx,item.spe.data);}}updateValue.v=item.v;updateValue.f=item.f;setCellValue(ctx,item.r,item.c,data,updateValue);}ctx.groupValuesRefreshData=[];}}function execFunctionGroup(ctx,origin_r,origin_c,value,id,data){var isForce=arguments.length>6&&arguments[6]!==undefined?arguments[6]:false;if(lodash.isNil(data)){data=getFlowdata(ctx);}if(lodash.isNil(ctx.formulaCache.execFunctionGlobalData)){ctx.formulaCache.execFunctionGlobalData={};}if(lodash.isNil(id)){id=ctx.currentSheetId;}if(!lodash.isNil(value)){var cellCache=[[{v:undefined}]];setCellValue(ctx,0,0,cellCache,value);var _cellCache$=_slicedToArray$3(cellCache[0],1);ctx.formulaCache.execFunctionGlobalData["".concat(origin_r,"_").concat(origin_c,"_").concat(id)]=_cellCache$[0];}var calcChains=getAllFunctionGroup(ctx);var formulaObjects={};var sheets=ctx.luckysheetfile;var sheetData={};for(var _i11=0;_i11<sheets.length;_i11+=1){var sheet=sheets[_i11];sheetData[sheet.id]=sheet.data;}var updateValueOjects={};var updateValueArray=[];if(lodash.isNil(ctx.formulaCache.execFunctionExist)){var key="r".concat(origin_r,"c").concat(origin_c,"i").concat(id);updateValueOjects[key]=1;}else {for(var x=0;x<ctx.formulaCache.execFunctionExist.length;x+=1){var cell=ctx.formulaCache.execFunctionExist[x];var _key="r".concat(cell.r,"c").concat(cell.c,"i").concat(cell.i);updateValueOjects[_key]=1;}}var arrayMatchCache={};var arrayMatch=function arrayMatch(formulaArray,_formulaObjects,_updateValueOjects,func){for(var a=0;a<formulaArray.length;a+=1){var range=formulaArray[a];var cacheKey="r".concat(range.row[0]).concat(range.row[1],"c").concat(range.column[0]).concat(range.column[1],"id").concat(range.sheetId);if(cacheKey in arrayMatchCache){var amc=arrayMatchCache[cacheKey];amc.forEach(function(item){func(item.key,item.r,item.c,item.sheetId);});}else {var functionArr=[];for(var r=range.row[0];r<=range.row[1];r+=1){for(var c=range.column[0];c<=range.column[1];c+=1){var _key2="r".concat(r,"c").concat(c,"i").concat(range.sheetId);func(_key2,r,c,range.sheetId);if(_formulaObjects&&_key2 in _formulaObjects||_updateValueOjects&&_key2 in _updateValueOjects){functionArr.push({key:_key2,r:r,c:c,sheetId:range.sheetId});}}}if(_formulaObjects||_updateValueOjects){arrayMatchCache[cacheKey]=functionArr;}}}};var _loop=function _loop(){var formulaCell=calcChains[_i12];var key="r".concat(formulaCell.r,"c").concat(formulaCell.c,"i").concat(formulaCell.id);var calc_funcStr=getcellFormula(ctx,formulaCell.r,formulaCell.c,formulaCell.id);if(lodash.isNil(calc_funcStr)){return 1;// continue
|
|
34741
34741
|
}var txt1=calc_funcStr.toUpperCase();var isOffsetFunc=txt1.indexOf("INDIRECT(")>-1||txt1.indexOf("OFFSET(")>-1||txt1.indexOf("INDEX(")>-1;var formulaArray=[];if(isOffsetFunc){isFunctionRange(ctx,calc_funcStr,null,null,formulaCell.id,null,function(str_nb){var range=getcellrange(ctx,lodash.trim(str_nb),formulaCell.id);if(!lodash.isNil(range)){formulaArray.push(range);}});}else if(!(calc_funcStr.substring(0,2)==='="'&&calc_funcStr.substring(calc_funcStr.length-1,1)==='"')){var point=0;var squote=-1;var dquote=-1;var formulaTextArray=[];var sq_end_array=[];var calc_funcStr_length=calc_funcStr.length;for(var j=0;j<calc_funcStr_length;j+=1){var char=calc_funcStr.charAt(j);if(char==="'"&&dquote===-1){if(squote===-1){if(point!==j){formulaTextArray.push.apply(formulaTextArray,_toConsumableArray$2(calc_funcStr.substring(point,j).split(/==|!=|<>|<=|>=|[,()=+-/*%&^><]/)));}squote=j;point=j;}else {if(j<calc_funcStr_length-1&&calc_funcStr.charAt(j+1)==="'"){j+=1;}else {point=j+1;formulaTextArray.push(calc_funcStr.substring(squote,point));sq_end_array.push(formulaTextArray.length-1);squote=-1;}}}if(char==='"'&&squote===-1){if(dquote===-1){if(point!==j){formulaTextArray.push.apply(formulaTextArray,_toConsumableArray$2(calc_funcStr.substring(point,j).split(/==|!=|<>|<=|>=|[,()=+-/*%&^><]/)));}dquote=j;point=j;}else {if(j<calc_funcStr_length-1&&calc_funcStr.charAt(j+1)==='"'){j+=1;}else {point=j+1;formulaTextArray.push(calc_funcStr.substring(dquote,point));dquote=-1;}}}}if(point!==calc_funcStr_length){formulaTextArray.push.apply(formulaTextArray,_toConsumableArray$2(calc_funcStr.substring(point,calc_funcStr_length).split(/==|!=|<>|<=|>=|[,()=+-/*%&^><]/)));}for(var _j=sq_end_array.length-1;_j>=0;_j-=1){if(sq_end_array[_j]!==formulaTextArray.length-1){formulaTextArray[sq_end_array[_j]]+=formulaTextArray[sq_end_array[_j]+1];formulaTextArray.splice(sq_end_array[_j]+1,1);}}for(var _j2=0;_j2<formulaTextArray.length;_j2+=1){var t=formulaTextArray[_j2];if(t.length<=1){continue;}if(t.substring(0,1)==='"'&&t.substring(t.length-1,1)==='"'||!iscelldata(t)){continue;}var range=getcellrange(ctx,lodash.trim(t),formulaCell.id);if(lodash.isNil(range)){continue;}formulaArray.push(range);}}var item={formulaArray:formulaArray,calc_funcStr:calc_funcStr,key:key,r:formulaCell.r,c:formulaCell.c,id:formulaCell.id,parents:{},chidren:{},color:"w"};formulaObjects[key]=item;};for(var _i12=0;_i12<calcChains.length;_i12+=1){if(_loop())continue;}Object.keys(formulaObjects).forEach(function(key){var formulaObject=formulaObjects[key];arrayMatch(formulaObject.formulaArray,formulaObjects,updateValueOjects,function(childKey){if(childKey in formulaObjects){var childFormulaObject=formulaObjects[childKey];formulaObject.chidren[childKey]=1;childFormulaObject.parents[key]=1;}if(!isForce&&childKey in updateValueOjects){updateValueArray.push(formulaObject);}});if(isForce){updateValueArray.push(formulaObject);}});var formulaRunList=[];var stack=updateValueArray;var existsFormulaRunList={};var _loop2=function _loop2(){var formulaObject=stack.pop();if(lodash.isNil(formulaObject)||formulaObject.key in existsFormulaRunList){return 0;// continue
|
|
34742
34742
|
}if(formulaObject.color==="b"){formulaRunList.push(formulaObject);existsFormulaRunList[formulaObject.key]=1;return 0;// continue
|
|
34743
34743
|
}var cacheStack=[];Object.keys(formulaObject.parents).forEach(function(parentKey){var parentFormulaObject=formulaObjects[parentKey];if(!lodash.isNil(parentFormulaObject)){cacheStack.push(parentFormulaObject);}});if(cacheStack.length===0){formulaRunList.push(formulaObject);existsFormulaRunList[formulaObject.key]=1;}else {formulaObject.color="b";stack.push(formulaObject);stack=stack.concat(cacheStack);}},_ret;while(stack.length>0){_ret=_loop2();if(_ret===0)continue;}formulaRunList.reverse();for(var _i13=0;_i13<formulaRunList.length;_i13+=1){var formulaCell=formulaRunList[_i13];if(formulaCell.level===Math.max){continue;}var calc_funcStr=formulaCell.calc_funcStr;var v=execfunction(ctx,calc_funcStr,formulaCell.r,formulaCell.c,formulaCell.id);ctx.groupValuesRefreshData.push({r:formulaCell.r,c:formulaCell.c,v:v[1],f:v[2],spe:v[3],id:formulaCell.id});ctx.formulaCache.execFunctionGlobalData["".concat(formulaCell.r,"_").concat(formulaCell.c,"_").concat(formulaCell.id)]={v:v[1],f:v[2]};}ctx.formulaCache.execFunctionExist=undefined;}function findrangeindex(ctx,v,vp){var re=/<span.*?>/g;var v_a=v.replace(re,"").split("</span>");var vp_a=vp.replace(re,"").split("</span>");v_a.pop();if(vp_a[vp_a.length-1]==="")vp_a.pop();var pfri=ctx.formulaCache.functionRangeIndex;if(pfri==null)return [];var vplen=vp_a.length;var vlen=v_a.length;if(vplen===vlen){var _i14=pfri[0];var p=vp_a[_i14];var n=v_a[_i14];if(lodash.isNil(p)){if(vp_a.length<=_i14){pfri=[vp_a.length-1,vp_a.length-1];}else if(v_a.length<=_i14){pfri=[v_a.length-1,v_a.length-1];}return pfri;}if(p.length===n.length){if(!lodash.isNil(vp_a[_i14+1])&&!lodash.isNil(v_a[_i14+1])&&vp_a[_i14+1].length<v_a[_i14+1].length){pfri[0]+=1;pfri[1]=1;}return pfri;}if(p.length>n.length){if(!lodash.isNil(p)&&!lodash.isNil(v_a[_i14+1])&&v_a[_i14+1].substring(0,1)==='"'&&(p.indexOf("{")>-1||p.indexOf("}")>-1)){pfri[0]+=1;pfri[1]=1;}return pfri;}if(p.length<n.length){if(pfri[1]>n.length){pfri[1]=n.length;}return pfri;}}else if(vplen>vlen){var _i15=pfri[0];var _p=vp_a[_i15];var _n=v_a[_i15];if(lodash.isNil(_n)){if(v_a[_i15-1].indexOf("{")>-1){pfri[0]-=1;var start=v_a[_i15-1].search("{");pfri[1]+=start;}else {pfri[0]=0;pfri[1]=0;}}else if(_p.length===_n.length){if(!lodash.isNil(v_a[_i15+1])&&(v_a[_i15+1].substring(0,1)==='"'||v_a[_i15+1].substring(0,1)==="{"||v_a[_i15+1].substring(0,1)==="}")){pfri[0]+=1;pfri[1]=1;}else if(!lodash.isNil(_p)&&_p.length>2&&_p.substring(0,1)==='"'&&_p.substring(_p.length-1,1)==='"');else if(!lodash.isNil(v_a[_i15])&&v_a[_i15]==='")'){pfri[1]=1;}else if(!lodash.isNil(v_a[_i15])&&v_a[_i15]==='"}'){pfri[1]=1;}else if(!lodash.isNil(v_a[_i15])&&v_a[_i15]==="{)"){pfri[1]=1;}else {pfri[1]=_n.length;}return pfri;}else if(_p.length>_n.length){if(!lodash.isNil(v_a[_i15+1])&&(v_a[_i15+1].substring(0,1)==='"'||v_a[_i15+1].substring(0,1)==="{"||v_a[_i15+1].substring(0,1)==="}")){pfri[0]+=1;pfri[1]=1;}return pfri;}else if(_p.length<_n.length){return pfri;}return pfri;}else if(vplen<vlen){var _i16=pfri[0];var _p2=vp_a[_i16];var _n2=v_a[_i16];if(lodash.isNil(_p2)){pfri[0]=v_a.length-1;if(!lodash.isNil(_n2)){pfri[1]=_n2.length;}else {pfri[1]=1;}}else if(_p2.length===_n2.length){if(vp_a[_i16+1]!=null&&(vp_a[_i16+1].substring(0,1)==='"'||vp_a[_i16+1].substring(0,1)==="{"||vp_a[_i16+1].substring(0,1)==="}")){pfri[1]=_n2.length;}else if(!lodash.isNil(v_a[_i16+1])&&v_a[_i16+1].substring(0,1)==='"'&&(v_a[_i16+1].substring(0,1)==="{"||v_a[_i16+1].substring(0,1)==="}")){pfri[0]+=1;pfri[1]=1;}else if(!lodash.isNil(_n2)&&_n2.substring(0,1)==='"'&&_n2.substring(_n2.length-1,1)==='"'&&_p2.substring(0,1)==='"'&&_p2.substring(_p2.length-1,1)===")"){pfri[1]=_n2.length;}else if(!lodash.isNil(_n2)&&_n2.substring(0,1)==="{"&&_n2.substring(_n2.length-1,1)==="}"&&_p2.substring(0,1)==="{"&&_p2.substring(_p2.length-1,1)===")"){pfri[1]=_n2.length;}else {pfri[0]=pfri[0]+vlen-vplen;if(v_a.length>vp_a.length){pfri[1]=v_a[_i16+1].length;}else {pfri[1]=1;}}return pfri;}else if(_p2.length>_n2.length){if(!lodash.isNil(_p2)&&_p2.substring(0,1)==='"'){pfri[1]=_n2.length;}else if(lodash.isNil(v_a[_i16+1])&&/{.*?}/.test(v_a[_i16+1])){pfri[0]+=1;pfri[1]=v_a[_i16+1].length;}else if(!lodash.isNil(_p2)&&v_a[_i16+1].substring(0,1)==='"'&&(_p2.indexOf("{")>-1||_p2.indexOf("}")>-1)){pfri[0]+=1;pfri[1]=1;}else if(!lodash.isNil(_p2)&&(_p2.indexOf("{")>-1||_p2.indexOf("}")>-1));else if(!lodash.isNil(_p2)&&!lodash.startsWith(_p2[0],"=")&&lodash.startsWith(_n2,"=")){return [vlen-1,v_a[vlen-1].length];}else {pfri[0]=pfri[0]+vlen-vplen-1;pfri[1]=v_a[(_i16||1)-1].length;}return pfri;}else if(_p2.length<_n2.length){return pfri;}return pfri;}return null;}function createFormulaRangeSelect(ctx,select){ctx.formulaRangeSelect=select;}function createRangeHightlight(ctx,inputInnerHtmlStr){var ignoreRangeIndex=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;var $span=parseElement("<div>".concat(inputInnerHtmlStr,"</div>"));var formulaRanges=[];$span.querySelectorAll("span.leankylin-formula-functionrange-cell").forEach(function(ele){var rangeIndex=parseInt(ele.getAttribute("rangeindex")||"0",10);if(rangeIndex===ignoreRangeIndex)return;var cellrange=getcellrange(ctx,ele.textContent||"");if(rangeIndex===ctx.formulaCache.selectingRangeIndex||cellrange==null)return;if(cellrange.sheetId===ctx.currentSheetId||cellrange.sheetId===-1&&ctx.formulaCache.rangetosheet===ctx.currentSheetId){var rect=seletedHighlistByindex(ctx,cellrange.row[0],cellrange.row[1],cellrange.column[0],cellrange.column[1]);if(rect){formulaRanges.push(_objectSpread2$1(_objectSpread2$1({rangeIndex:rangeIndex},rect),{},{backgroundColor:colors[rangeIndex]}));}}});ctx.formulaRangeHighlight=formulaRanges;}function setCaretPosition(ctx,textDom,children,pos){try{var el=textDom;var range=document.createRange();var sel=window.getSelection();range.setStart(el.childNodes[children],pos);range.collapse(true);sel===null||sel===void 0?void 0:sel.removeAllRanges();sel===null||sel===void 0?void 0:sel.addRange(range);el.focus();}catch(err){console.error(err);moveToEnd(ctx.formulaCache.rangeResizeTo[0]);}}function functionRange(ctx,obj,v,vp){if(window.getSelection){var currSelection=window.getSelection();if(!currSelection)return;var fri=findrangeindex(ctx,v,vp);if(lodash.isNil(fri)){currSelection.selectAllChildren(obj);currSelection.collapseToEnd();}else {setCaretPosition(ctx,obj.querySelectorAll("span")[fri[0]],0,fri[1]);}}else if(document.selection){ctx.formulaCache.functionRangeIndex.moveToElementText(obj);ctx.formulaCache.functionRangeIndex.collapse(false);ctx.formulaCache.functionRangeIndex.select();}}function searchFunction(ctx,searchtxt){var _locale=locale(ctx),functionlist=_locale.functionlist;var f=[];var s=[];var t=[];var result_i=0;for(var _i17=0;_i17<functionlist.length;_i17+=1){var item=functionlist[_i17];var n=item.n;if(n===searchtxt){f.unshift(item);result_i+=1;}else if(lodash.startsWith(n,searchtxt)){s.unshift(item);result_i+=1;}else if(n.indexOf(searchtxt)>-1){t.unshift(item);result_i+=1;}if(result_i>=10){break;}}var list=[].concat(f,s,t);if(list.length<=0){return;}ctx.functionCandidates=list;}function getrangeseleciton(){var _anchorNode$parentNod,_anchorNode$parentNod2,_anchorNode$parentEle,_anchorNode$parentEle2;var currSelection=window.getSelection();if(!currSelection)return null;var anchorNode=currSelection.anchorNode,anchorOffset=currSelection.anchorOffset;if(!anchorNode)return null;if(((_anchorNode$parentNod=anchorNode.parentNode)===null||_anchorNode$parentNod===void 0?void 0:(_anchorNode$parentNod2=_anchorNode$parentNod.nodeName)===null||_anchorNode$parentNod2===void 0?void 0:_anchorNode$parentNod2.toLowerCase())==="span"&&anchorOffset!==0){var txt=lodash.trim(anchorNode.textContent||"");if(txt.length===0&&anchorNode.parentNode.previousSibling){var ahr=anchorNode.parentNode.previousSibling;txt=lodash.trim(ahr.textContent||"");return ahr;}return anchorNode.parentNode;}var anchorElement=anchorNode;if(anchorElement.id==="luckysheet-rich-text-editor"||anchorElement.id==="luckysheet-functionbox-cell"){var _$last;var _txt=lodash.trim((_$last=lodash.last(anchorElement.querySelectorAll("span")))===null||_$last===void 0?void 0:_$last.innerText);if(_txt.length===0&&anchorElement.querySelectorAll("span").length>1){var _ahr=anchorElement.querySelectorAll("span");_txt=lodash.trim(_ahr[_ahr.length-2].innerText);return _ahr===null||_ahr===void 0?void 0:_ahr[0];}return lodash.last(anchorElement.querySelectorAll("span"));}if((anchorNode===null||anchorNode===void 0?void 0:(_anchorNode$parentEle=anchorNode.parentElement)===null||_anchorNode$parentEle===void 0?void 0:_anchorNode$parentEle.id)==="luckysheet-rich-text-editor"||(anchorNode===null||anchorNode===void 0?void 0:(_anchorNode$parentEle2=anchorNode.parentElement)===null||_anchorNode$parentEle2===void 0?void 0:_anchorNode$parentEle2.id)==="luckysheet-functionbox-cell"||anchorOffset===0){var newAnchorNode=anchorOffset===0?anchorNode===null||anchorNode===void 0?void 0:anchorNode.parentNode:anchorNode;if(newAnchorNode===null||newAnchorNode===void 0?void 0:newAnchorNode.previousSibling){return newAnchorNode===null||newAnchorNode===void 0?void 0:newAnchorNode.previousSibling;}}return null;}function helpFunctionExe($editer,currSelection,ctx){var _currSelection$parent;var _locale2=locale(ctx),functionlist=_locale2.functionlist;if(lodash.isEmpty(ctx.formulaCache.functionlistMap)){for(var _i18=0;_i18<functionlist.length;_i18+=1){ctx.formulaCache.functionlistMap[functionlist[_i18].n]=functionlist[_i18];}}if(!currSelection){return null;}var $prev=currSelection;var $span=$editer.querySelectorAll("span");var currentIndex=lodash.indexOf((_currSelection$parent=currSelection.parentNode)===null||_currSelection$parent===void 0?void 0:_currSelection$parent.childNodes,currSelection);var i=currentIndex;if($prev==null){return null;}var funcName=null;if($span[i].classList.contains("luckysheet-formula-text-func")){funcName=$span[i].textContent;}else {var $cur=null;var exceptIndex=[-1,-1];while(--i>0){$cur=$span[i];if($cur.classList.contains("luckysheet-formula-text-func")||lodash.trim($cur.textContent||"").toUpperCase()in ctx.formulaCache.functionlistMap){funcName=$cur.textContent;var endstate=true;for(var a=i;a<=currentIndex;a+=1){if(a>=exceptIndex[0]&&a<=exceptIndex[1]){continue;}$cur=$span[a];if($cur.classList.contains("luckysheet-formula-text-rpar")){exceptIndex=[i,a];funcName=null;endstate=false;break;}if($cur.classList.contains("luckysheet-formula-text-comma"));}if(endstate){break;}}}}return funcName;}function rangeHightlightselected(ctx,$editor){var currSelection=getrangeseleciton();if(!currSelection)return;var currText=lodash.trim(currSelection.textContent||"");if(currText===null||currText===void 0?void 0:currText.match(/^[a-zA-Z_]+$/)){searchFunction(ctx,currText.toUpperCase());ctx.functionHint=null;}else {var funcName=helpFunctionExe($editor,currSelection,ctx);ctx.functionHint=funcName===null||funcName===void 0?void 0:funcName.toUpperCase();ctx.functionCandidates=[];}}function functionHTML(txt){if(txt.substr(0,1)==="="){txt=txt.substr(1);}var funcstack=txt.split("");var i=0;var str="";var function_str="";var matchConfig={bracket:0,comma:0,squote:0,dquote:0,braces:0};while(i<funcstack.length){var s=funcstack[i];if(s==="("&&matchConfig.squote===0&&matchConfig.dquote===0&&matchConfig.braces===0){matchConfig.bracket+=1;if(str.length>0){function_str+="<span dir=\"auto\" class=\"luckysheet-formula-text-func\">".concat(str,"</span><span dir=\"auto\" class=\"luckysheet-formula-text-lpar\">(</span>");}else {function_str+='<span dir="auto" class="luckysheet-formula-text-lpar">(</span>';}str="";}else if(s===")"&&matchConfig.squote===0&&matchConfig.dquote===0&&matchConfig.braces===0){matchConfig.bracket-=1;function_str+="".concat(functionHTML(str),"<span dir=\"auto\" class=\"luckysheet-formula-text-rpar\">)</span>");str="";}else if(s==="{"&&matchConfig.squote===0&&matchConfig.dquote===0){str+="{";matchConfig.braces+=1;}else if(s==="}"&&matchConfig.squote===0&&matchConfig.dquote===0){str+="}";matchConfig.braces-=1;}else if(s==='"'&&matchConfig.squote===0){if(matchConfig.dquote>0){if(str.length>0){function_str+="".concat(str,"\"</span>");}else {function_str+='"</span>';}matchConfig.dquote-=1;str="";}else {matchConfig.dquote+=1;if(str.length>0){function_str+="".concat(functionHTML(str),"<span dir=\"auto\" class=\"luckysheet-formula-text-string\">\"");}else {function_str+='<span dir="auto" class="luckysheet-formula-text-string">"';}str="";}}else if(s==="'"&&matchConfig.dquote===0){str+="'";matchConfig.squote=matchConfig.squote===0?1:0;}else if(s===","&&matchConfig.squote===0&&matchConfig.dquote===0&&matchConfig.braces===0){function_str+="".concat(functionHTML(str),"<span dir=\"auto\" class=\"luckysheet-formula-text-comma\">,</span>");str="";}else if(s==="&"&&matchConfig.squote===0&&matchConfig.dquote===0&&matchConfig.braces===0){if(str.length>0){function_str+="".concat(functionHTML(str),"<span dir=\"auto\" class=\"luckysheet-formula-text-calc\">")+"&"+"</span>";str="";}else {function_str+='<span dir="auto" class="luckysheet-formula-text-calc">'+"&"+"</span>";}}else if(s in operatorjson&&matchConfig.squote===0&&matchConfig.dquote===0&&matchConfig.braces===0){var s_next="";if(i+1<funcstack.length){s_next=funcstack[i+1];}var p=i-1;var s_pre=null;if(p>=0){do{s_pre=funcstack[p];p-=1;}while(p>=0&&s_pre===" ");}if(s+s_next in operatorjson){if(str.length>0){function_str+="".concat(functionHTML(str),"<span dir=\"auto\" class=\"luckysheet-formula-text-calc\">").concat(s).concat(s_next,"</span>");str="";}else {function_str+="<span dir=\"auto\" class=\"luckysheet-formula-text-calc\">".concat(s).concat(s_next,"</span>");}i+=1;}else if(!/[^0-9]/.test(s_next)&&s==="-"&&(s_pre==="("||lodash.isNil(s_pre)||s_pre===","||s_pre===" "||s_pre in operatorjson)){str+=s;}else {if(str.length>0){function_str+="".concat(functionHTML(str),"<span dir=\"auto\" class=\"luckysheet-formula-text-calc\">").concat(s,"</span>");str="";}else {function_str+="<span dir=\"auto\" class=\"luckysheet-formula-text-calc\">".concat(s,"</span>");}}}else {str+=s;}if(i===funcstack.length-1){if(iscelldata(lodash.trim(str))){var rangeIndex=rangeIndexes.length>functionHTMLIndex?rangeIndexes[functionHTMLIndex]:functionHTMLIndex;function_str+="<span class=\"leankylin-formula-functionrange-cell\" rangeindex=\"".concat(rangeIndex,"\" dir=\"auto\" style=\"color:").concat(colors[rangeIndex],";\">").concat(str,"</span>");functionHTMLIndex+=1;}else if(matchConfig.dquote>0){function_str+="".concat(str,"</span>");}else if(str.indexOf("</span>")===-1&&str.length>0){var regx=/{.*?}/;if(regx.test(lodash.trim(str))){var arraytxt=regx.exec(str)[0];var arraystart=str.search(regx);var alltxt="";if(arraystart>0){alltxt+="<span dir=\"auto\" class=\"luckysheet-formula-text-color\">".concat(str.substr(0,arraystart),"</span>");}alltxt+="<span dir=\"auto\" style=\"color:#959a05\" class=\"luckysheet-formula-text-array\">".concat(arraytxt,"</span>");if(arraystart+arraytxt.length<str.length){alltxt+="<span dir=\"auto\" class=\"luckysheet-formula-text-color\">".concat(str.substr(arraystart+arraytxt.length,str.length),"</span>");}function_str+=alltxt;}else {function_str+="<span dir=\"auto\" class=\"luckysheet-formula-text-color\">".concat(str,"</span>");}}}i+=1;}return function_str;}function functionHTMLGenerate(txt){if(txt.length===0||txt.substring(0,1)!=="="){return txt;}functionHTMLIndex=0;return "<span dir=\"auto\" class=\"luckysheet-formula-text-color\">=</span>".concat(functionHTML(txt));}function getRangeIndexes($editor){var res=[];$editor.querySelectorAll("span.leankylin-formula-functionrange-cell").forEach(function(ele){var indexStr=ele.getAttribute("rangeindex");if(indexStr){var rangeIndex=parseInt(indexStr,10);res.push(rangeIndex);}});return res;}function handleFormulaInput(ctx,$copyTo,$editor,kcode,preText){var refreshRangeSelect=arguments.length>5&&arguments[5]!==undefined?arguments[5]:true;var value1;var value1txt=preText!==null&&preText!==void 0?preText:$editor.innerText;var value=$editor.innerText;value=escapeScriptTag(value);if(value.length>0&&value.substring(0,1)==="="&&(kcode!==229||value.length===1)){if(!refreshRangeSelect)rangeIndexes=getRangeIndexes($editor);value=functionHTMLGenerate(value);if(!refreshRangeSelect&&functionHTMLIndex<rangeIndexes.length)refreshRangeSelect=true;value1=functionHTMLGenerate(value1txt);rangeIndexes=[];if(window.getSelection){var _currSelection$anchor;var currSelection=window.getSelection();if(!currSelection)return;if(((_currSelection$anchor=currSelection.anchorNode)===null||_currSelection$anchor===void 0?void 0:_currSelection$anchor.nodeName.toLowerCase())==="div"){var _$editor$querySelecto;var editorlen=$editor.querySelectorAll("span").length;ctx.formulaCache.functionRangeIndex=[editorlen-1,(_$editor$querySelecto=$editor.querySelectorAll("span").item(editorlen-1).textContent)===null||_$editor$querySelecto===void 0?void 0:_$editor$querySelecto.length];}else {var _currSelection$anchor2,_currSelection$anchor3,_currSelection$anchor4,_currSelection$anchor5;ctx.formulaCache.functionRangeIndex=[lodash.indexOf((_currSelection$anchor2=currSelection.anchorNode)===null||_currSelection$anchor2===void 0?void 0:(_currSelection$anchor3=_currSelection$anchor2.parentNode)===null||_currSelection$anchor3===void 0?void 0:(_currSelection$anchor4=_currSelection$anchor3.parentNode)===null||_currSelection$anchor4===void 0?void 0:_currSelection$anchor4.childNodes,(_currSelection$anchor5=currSelection.anchorNode)===null||_currSelection$anchor5===void 0?void 0:_currSelection$anchor5.parentNode),currSelection.anchorOffset];}}else {var textRange=document.selection.createRange();ctx.formulaCache.functionRangeIndex=textRange;}$editor.innerHTML=value;if($copyTo)$copyTo.innerHTML=value;functionRange(ctx,$editor,value,value1);if(refreshRangeSelect){cancelFunctionrangeSelected(ctx);if(kcode!==46){createRangeHightlight(ctx,value);}ctx.formulaCache.rangestart=false;ctx.formulaCache.rangedrag_column_start=false;ctx.formulaCache.rangedrag_row_start=false;rangeHightlightselected(ctx,$editor);}}else if(lodash.startsWith(value1txt,"=")&&!lodash.startsWith(value,"=")){if($copyTo)$copyTo.innerHTML=value;$editor.innerHTML=escapeHTMLTag(value);}else if(!lodash.startsWith(value1txt,"=")){if(!$copyTo)return;if($copyTo.id==="luckysheet-rich-text-editor"){if(!lodash.startsWith($copyTo.innerHTML,"<span")){$copyTo.innerHTML=escapeHTMLTag(value);}}else {$copyTo.innerHTML=escapeHTMLTag(value);}}}function isfreezonFuc(txt){var row=txt.replace(/[^0-9]/g,"");var col=txt.replace(/[^A-Za-z]/g,"");var row$=txt.substr(txt.indexOf(row)-1,1);var col$=txt.substr(txt.indexOf(col)-1,1);var ret=[false,false];if(row$==="$"){ret[0]=true;}if(col$==="$"){ret[1]=true;}return ret;}function functionStrChange_range(txt,type,rc,orient,stindex,step){var val=txt.split("!");var rangetxt;var prefix="";if(val.length>1){var _val3=_slicedToArray$3(val,2);rangetxt=_val3[1];prefix="".concat(val[0],"!");}else {var _val4=_slicedToArray$3(val,1);rangetxt=_val4[0];}var r1;var r2;var c1;var c2;var $row0;var $row1;var $col0;var $col1;if(rangetxt.indexOf(":")===-1){r1=parseInt(rangetxt.replace(/[^0-9]/g,""),10)-1;r2=r1;c1=columnCharToIndex(rangetxt.replace(/[^A-Za-z]/g,""));c2=c1;var freezonFuc=isfreezonFuc(rangetxt);$row0=freezonFuc[0]?"$":"";$row1=$row0;$col0=freezonFuc[1]?"$":"";$col1=$col0;}else {rangetxt=rangetxt.split(":");r1=parseInt(rangetxt[0].replace(/[^0-9]/g,""),10)-1;r2=parseInt(rangetxt[1].replace(/[^0-9]/g,""),10)-1;if(r1>r2){return txt;}c1=columnCharToIndex(rangetxt[0].replace(/[^A-Za-z]/g,""));c2=columnCharToIndex(rangetxt[1].replace(/[^A-Za-z]/g,""));if(c1>c2){return txt;}var freezonFuc0=isfreezonFuc(rangetxt[0]);$row0=freezonFuc0[0]?"$":"";$col0=freezonFuc0[1]?"$":"";var freezonFuc1=isfreezonFuc(rangetxt[1]);$row1=freezonFuc1[0]?"$":"";$col1=freezonFuc1[1]?"$":"";}if(type==="del"){if(rc==="row"){if(r1>=stindex&&r2<=stindex+step-1){return error$2.r;}if(r1>stindex+step-1){r1-=step;}else if(r1>=stindex){r1=stindex;}if(r2>stindex+step-1){r2-=step;}else if(r2>=stindex){r2=stindex-1;}if(r1<0){r1=0;}if(r2<r1){r2=r1;}}else if(rc==="col"){if(c1>=stindex&&c2<=stindex+step-1){return error$2.r;}if(c1>stindex+step-1){c1-=step;}else if(c1>=stindex){c1=stindex;}if(c2>stindex+step-1){c2-=step;}else if(c2>=stindex){c2=stindex-1;}if(c1<0){c1=0;}if(c2<c1){c2=c1;}}if(r1===r2&&c1===c2){if(!Number.isNaN(r1)&&!Number.isNaN(c1)){return prefix+$col0+indexToColumnChar(c1)+$row0+(r1+1);}if(!Number.isNaN(r1)){return prefix+$row0+(r1+1);}if(!Number.isNaN(c1)){return prefix+$col0+indexToColumnChar(c1);}return txt;}if(Number.isNaN(c1)&&Number.isNaN(c2)){return "".concat(prefix+$row0+(r1+1),":").concat($row1).concat(r2+1);}if(Number.isNaN(r1)&&Number.isNaN(r2)){return "".concat(prefix+$col0+indexToColumnChar(c1),":").concat($col1).concat(indexToColumnChar(c2));}return "".concat(prefix+$col0+indexToColumnChar(c1)+$row0+(r1+1),":").concat($col1).concat(indexToColumnChar(c2)).concat($row1).concat(r2+1);}if(type==="add"){if(rc==="row"){if(orient==="lefttop"){if(r1>=stindex){r1+=step;}if(r2>=stindex){r2+=step;}}else if(orient==="rightbottom"){if(r1>stindex){r1+=step;}if(r2>stindex){r2+=step;}}}else if(rc==="col"){if(orient==="lefttop"){if(c1>=stindex){c1+=step;}if(c2>=stindex){c2+=step;}}else if(orient==="rightbottom"){if(c1>stindex){c1+=step;}if(c2>stindex){c2+=step;}}}if(r1===r2&&c1===c2){if(!Number.isNaN(r1)&&!Number.isNaN(c1)){return prefix+$col0+indexToColumnChar(c1)+$row0+(r1+1);}if(!Number.isNaN(r1)){return prefix+$row0+(r1+1);}if(!Number.isNaN(c1)){return prefix+$col0+indexToColumnChar(c1);}return txt;}if(Number.isNaN(c1)&&Number.isNaN(c2)){return "".concat(prefix+$row0+(r1+1),":").concat($row1).concat(r2+1);}if(Number.isNaN(r1)&&Number.isNaN(r2)){return "".concat(prefix+$col0+indexToColumnChar(c1),":").concat($col1).concat(indexToColumnChar(c2));}return "".concat(prefix+$col0+indexToColumnChar(c1)+$row0+(r1+1),":").concat($col1).concat(indexToColumnChar(c2)).concat($row1).concat(r2+1);}return "";}function israngeseleciton(ctx,istooltip){var _anchor,_anchor2,_anchor2$parentNode;if(istooltip==null){istooltip=false;}var currSelection=window.getSelection();if(currSelection==null)return false;var anchor=currSelection.anchorNode;if(!((_anchor=anchor)===null||_anchor===void 0?void 0:_anchor.textContent))return false;var anchorOffset=currSelection.anchorOffset;var anchorElement=anchor;var parentElement=anchor.parentNode;if(((_anchor2=anchor)===null||_anchor2===void 0?void 0:(_anchor2$parentNode=_anchor2.parentNode)===null||_anchor2$parentNode===void 0?void 0:_anchor2$parentNode.nodeName.toLowerCase())==="span"&&anchorOffset!==0){var txt=lodash.trim(anchor.textContent);var lasttxt="";if(txt.length===0&&anchor.parentNode.previousSibling){var ahr=anchor.parentNode.previousSibling;txt=lodash.trim(ahr.textContent||"");lasttxt=txt.substring(txt.length-1,1);ctx.formulaCache.rangeSetValueTo=anchor.parentNode;}else {lasttxt=txt.substring(anchorOffset-1,1);ctx.formulaCache.rangeSetValueTo=anchor.parentNode;}if(istooltip&&(lasttxt==="("||lasttxt===",")||!istooltip&&(lasttxt==="("||lasttxt===","||lasttxt==="="||lasttxt in operatorjson||lasttxt==="&")){return true;}}else if(anchorElement.id==="luckysheet-rich-text-editor"||anchorElement.id==="luckysheet-functionbox-cell"){var _$last2;var _txt2=lodash.trim((_$last2=lodash.last(anchorElement.querySelectorAll("span")))===null||_$last2===void 0?void 0:_$last2.innerText);ctx.formulaCache.rangeSetValueTo=lodash.last(anchorElement.querySelectorAll("span"));if(_txt2.length===0&&anchorElement.querySelectorAll("span").length>1){var _ahr2=anchorElement.querySelectorAll("span");_txt2=lodash.trim(_ahr2[_ahr2.length-2].innerText);_txt2=lodash.trim(_ahr2[_ahr2.length-2].innerText);ctx.formulaCache.rangeSetValueTo=_ahr2;}var _lasttxt=_txt2.substring(_txt2.length-1,1);if(istooltip&&(_lasttxt==="("||_lasttxt===",")||!istooltip&&(_lasttxt==="("||_lasttxt===","||_lasttxt==="="||_lasttxt in operatorjson||_lasttxt==="&")){return true;}}else if(parentElement.id==="luckysheet-rich-text-editor"||parentElement.id==="luckysheet-functionbox-cell"||anchorOffset===0){var _anchor$previousSibli;if(anchorOffset===0){anchor=anchor.parentNode;}if(!anchor)return false;if(((_anchor$previousSibli=anchor.previousSibling)===null||_anchor$previousSibli===void 0?void 0:_anchor$previousSibli.textContent)==null)return false;if(anchor.previousSibling){var _txt3=lodash.trim(anchor.previousSibling.textContent);var _lasttxt2=_txt3.substring(_txt3.length-1,1);ctx.formulaCache.rangeSetValueTo=anchor.previousSibling;if(istooltip&&(_lasttxt2==="("||_lasttxt2===",")||!istooltip&&(_lasttxt2==="("||_lasttxt2===","||_lasttxt2==="="||_lasttxt2 in operatorjson||_lasttxt2==="&")){return true;}}}return false;}function functionStrChange(txt,type,rc,orient,stindex,step){if(!txt){return "";}if(txt.substring(0,1)==="="){txt=txt.substring(1);}var funcstack=txt.split("");var i=0;var str="";var function_str="";var matchConfig={bracket:0,comma:0,squote:0,dquote:0};while(i<funcstack.length){var s=funcstack[i];if(s==="("&&matchConfig.dquote===0){matchConfig.bracket+=1;if(str.length>0){function_str+="".concat(str,"(");}else {function_str+="(";}str="";}else if(s===")"&&matchConfig.dquote===0){matchConfig.bracket-=1;function_str+="".concat(functionStrChange(str,type,rc,orient,stindex,step),")");str="";}else if(s==='"'&&matchConfig.squote===0){if(matchConfig.dquote>0){function_str+="".concat(str,"\"");matchConfig.dquote-=1;str="";}else {matchConfig.dquote+=1;str+='"';}}else if(s===","&&matchConfig.dquote===0){function_str+="".concat(functionStrChange(str,type,rc,orient,stindex,step),",");str="";}else if(s==="&"&&matchConfig.dquote===0){if(str.length>0){function_str+="".concat(functionStrChange(str,type,rc,orient,stindex,step),"&");str="";}else {function_str+="&";}}else if(s in operatorjson&&matchConfig.dquote===0){var s_next="";if(i+1<funcstack.length){s_next=funcstack[i+1];}var p=i-1;var s_pre=null;if(p>=0){do{s_pre=funcstack[p-=1];}while(p>=0&&s_pre===" ");}if(s+s_next in operatorjson){if(str.length>0){function_str+=functionStrChange(str,type,rc,orient,stindex,step)+s+s_next;str="";}else {function_str+=s+s_next;}i+=1;}else if(!/[^0-9]/.test(s_next)&&s==="-"&&(s_pre==="("||s_pre==null||s_pre===","||s_pre===" "||s_pre in operatorjson)){str+=s;}else {if(str.length>0){function_str+=functionStrChange(str,type,rc,orient,stindex,step)+s;str="";}else {function_str+=s;}}}else {str+=s;}if(i===funcstack.length-1){if(iscelldata(lodash.trim(str))){function_str+=functionStrChange_range(lodash.trim(str),type,rc,orient,stindex,step);}else {function_str+=lodash.trim(str);}}i+=1;}return function_str;}function rangeSetValue(ctx,cellInput,selected,fxInput){var _document$activeEleme;var $editor=cellInput;var $copyTo=fxInput;if(((_document$activeEleme=document.activeElement)===null||_document$activeEleme===void 0?void 0:_document$activeEleme.id)==="luckysheet-functionbox-cell"){$editor=fxInput;$copyTo=cellInput;}var range="";var rf=selected.row[0];var cf=selected.column[0];if(ctx.config.merge!=null&&"".concat(rf,"_").concat(cf)in ctx.config.merge){range=getRangetxt(ctx,ctx.currentSheetId,{column:[cf,cf],row:[rf,rf]},ctx.formulaCache.rangetosheet);}else {range=getRangetxt(ctx,ctx.currentSheetId,selected,ctx.formulaCache.rangetosheet);}if(!israngeseleciton(ctx)&&(ctx.formulaCache.rangestart||ctx.formulaCache.rangedrag_column_start||ctx.formulaCache.rangedrag_row_start)){var span=$editor.querySelector("span[rangeindex='".concat(ctx.formulaCache.rangechangeindex,"']"));if(span){span.innerHTML=range;setCaretPosition(ctx,span,0,range.length);}}else {var function_str="<span class=\"leankylin-formula-functionrange-cell\" rangeindex=\"".concat(functionHTMLIndex,"\" dir=\"auto\" style=\"color:").concat(colors[functionHTMLIndex],";\">").concat(range,"</span>");var newEle=parseElement(function_str);var refEle=ctx.formulaCache.rangeSetValueTo;if(refEle&&refEle.parentNode){refEle.parentNode.insertBefore(newEle,refEle.nextSibling);}else {$editor.appendChild(newEle);}ctx.formulaCache.rangechangeindex=functionHTMLIndex;var _span=$editor.querySelector("span[rangeindex='".concat(ctx.formulaCache.rangechangeindex,"']"));setCaretPosition(ctx,_span,0,range.length);functionHTMLIndex+=1;}if($copyTo)$copyTo.innerHTML=$editor.innerHTML;}function onFormulaRangeDragEnd(ctx){if(ctx.formulaCache.func_selectedrange){var _ctx$formulaCache$fun=ctx.formulaCache.func_selectedrange,left=_ctx$formulaCache$fun.left_move,top=_ctx$formulaCache$fun.top_move,width=_ctx$formulaCache$fun.width_move,height=_ctx$formulaCache$fun.height_move;if(left!=null&&top!=null&&width!=null&&height!=null&&(ctx.formulaCache.rangestart||ctx.formulaCache.rangedrag_column_start||ctx.formulaCache.rangedrag_row_start))ctx.formulaRangeSelect={rangeIndex:ctx.formulaCache.rangeIndex||0,left:left,top:top,width:width,height:height};}ctx.formulaCache.selectingRangeIndex=-1;}function setRangeSelect(container,left,top,height,width){var rangeElement=container.querySelector(".leankylin-formula-functionrange-select");if(rangeElement==null)return;rangeElement.style.left="".concat(left,"px");rangeElement.style.top="".concat(top,"px");rangeElement.style.height="".concat(height,"px");rangeElement.style.width="".concat(width,"px");}function rangeDrag(ctx,e,cellInput,scrollLeft,scrollTop,container,fxInput){var func_selectedrange=ctx.formulaCache.func_selectedrange;if(!func_selectedrange||func_selectedrange.left==null||func_selectedrange.height==null||func_selectedrange.top==null||func_selectedrange.width==null)return;var rect=container.getBoundingClientRect();var x=e.pageX-rect.left-ctx.rowHeaderWidth+scrollLeft;var y=e.pageY-rect.top-ctx.columnHeaderHeight+scrollTop;var _rowLocation=rowLocation(y,ctx.visibledatarow),_rowLocation2=_slicedToArray$3(_rowLocation,3),row_pre=_rowLocation2[0],row=_rowLocation2[1],row_index=_rowLocation2[2];var _colLocation=colLocation(x,ctx.visibledatacolumn),_colLocation2=_slicedToArray$3(_colLocation,3),col_pre=_colLocation2[0],col=_colLocation2[1],col_index=_colLocation2[2];var top=0;var height=0;var rowseleted=[];if(func_selectedrange.top>row_pre){top=row_pre;height=func_selectedrange.top+func_selectedrange.height-row_pre;rowseleted=[row_index,func_selectedrange.row[1]];}else if(func_selectedrange.top===row_pre){top=row_pre;height=func_selectedrange.top+func_selectedrange.height-row_pre;rowseleted=[row_index,func_selectedrange.row[0]];}else {top=func_selectedrange.top;height=row-func_selectedrange.top-1;rowseleted=[func_selectedrange.row[0],row_index];}var left=0;var width=0;var columnseleted=[];if(func_selectedrange.left>col_pre){left=col_pre;width=func_selectedrange.left+func_selectedrange.width-col_pre;columnseleted=[col_index,func_selectedrange.column[1]];}else if(func_selectedrange.left===col_pre){left=col_pre;width=func_selectedrange.left+func_selectedrange.width-col_pre;columnseleted=[col_index,func_selectedrange.column[0]];}else {left=func_selectedrange.left;width=col-func_selectedrange.left-1;columnseleted=[func_selectedrange.column[0],col_index];}var changeparam=mergeMoveMain(ctx,columnseleted,rowseleted,func_selectedrange,top,height,left,width);if(changeparam!=null){var _changeparam=_slicedToArray$3(changeparam,6);columnseleted=_changeparam[0];rowseleted=_changeparam[1];top=_changeparam[2];height=_changeparam[3];left=_changeparam[4];width=_changeparam[5];}func_selectedrange.row=rowseleted;func_selectedrange.column=columnseleted;func_selectedrange.left_move=left;func_selectedrange.width_move=width;func_selectedrange.top_move=top;func_selectedrange.height_move=height;rangeSetValue(ctx,cellInput,{row:rowseleted,column:columnseleted},fxInput);setRangeSelect(container,left,top,height,width);e.preventDefault();}function rangeDragColumn(ctx,e,cellInput,scrollLeft,scrollTop,container,fxInput){var func_selectedrange=ctx.formulaCache.func_selectedrange;if(!func_selectedrange||func_selectedrange.left==null||func_selectedrange.height==null||func_selectedrange.top==null||func_selectedrange.width==null)return;var mouse=mousePosition(e.pageX,e.pageY,ctx);var x=mouse[0]+scrollLeft;var visibledatarow=ctx.visibledatarow;var row_index=visibledatarow.length-1;var row=visibledatarow[row_index];var row_pre=0;var _colLocation3=colLocation(x,ctx.visibledatacolumn),_colLocation4=_slicedToArray$3(_colLocation3,3),col_pre=_colLocation4[0],col=_colLocation4[1],col_index=_colLocation4[2];var left=0;var width=0;var columnseleted=[];if(func_selectedrange.left>col_pre){left=col_pre;width=func_selectedrange.left+func_selectedrange.width-col_pre;columnseleted=[col_index,func_selectedrange.column[1]];}else if(func_selectedrange.left===col_pre){left=col_pre;width=func_selectedrange.left+func_selectedrange.width-col_pre;columnseleted=[col_index,func_selectedrange.column[0]];}else {left=func_selectedrange.left;width=col-func_selectedrange.left-1;columnseleted=[func_selectedrange.column[0],col_index];}var changeparam=mergeMoveMain(ctx,columnseleted,[0,row_index],func_selectedrange,row_pre,row-row_pre-1,left,width);if(changeparam!=null){var _changeparam2=_slicedToArray$3(changeparam,6);columnseleted=_changeparam2[0];left=_changeparam2[4];width=_changeparam2[5];}func_selectedrange.column=columnseleted;func_selectedrange.left_move=left;func_selectedrange.width_move=width;rangeSetValue(ctx,cellInput,{row:[null,null],column:columnseleted},fxInput);setRangeSelect(container,left,row_pre,row-row_pre-1,width);}function rangeDragRow(ctx,e,cellInput,scrollLeft,scrollTop,container,fxInput){var func_selectedrange=ctx.formulaCache.func_selectedrange;if(!func_selectedrange||func_selectedrange.left==null||func_selectedrange.height==null||func_selectedrange.top==null||func_selectedrange.width==null)return;var mouse=mousePosition(e.pageX,e.pageY,ctx);var y=mouse[1]+scrollTop;var _rowLocation3=rowLocation(y,ctx.visibledatarow),_rowLocation4=_slicedToArray$3(_rowLocation3,3),row_pre=_rowLocation4[0],row=_rowLocation4[1],row_index=_rowLocation4[2];var visibledatacolumn=ctx.visibledatacolumn;var col_index=visibledatacolumn.length-1;var col=visibledatacolumn[col_index];var col_pre=0;var top=0;var height=0;var rowseleted=[];if(func_selectedrange.top>row_pre){top=row_pre;height=func_selectedrange.top+func_selectedrange.height-row_pre;rowseleted=[row_index,func_selectedrange.row[1]];}else if(func_selectedrange.top===row_pre){top=row_pre;height=func_selectedrange.top+func_selectedrange.height-row_pre;rowseleted=[row_index,func_selectedrange.row[0]];}else {top=func_selectedrange.top;height=row-func_selectedrange.top-1;rowseleted=[func_selectedrange.row[0],row_index];}var changeparam=mergeMoveMain(ctx,[0,col_index],rowseleted,func_selectedrange,top,height,col_pre,col-col_pre-1);if(changeparam!=null){var _changeparam3=_slicedToArray$3(changeparam,4);rowseleted=_changeparam3[1];top=_changeparam3[2];height=_changeparam3[3];}func_selectedrange.row=rowseleted;func_selectedrange.top_move=top;func_selectedrange.height_move=height;rangeSetValue(ctx,cellInput,{row:rowseleted,column:[null,null]},fxInput);setRangeSelect(container,col_pre,top,height,col-col_pre-1);}function updateparam(orient,txt,step){var val=txt.split("!");var rangetxt;var prefix="";if(val.length>1){var _val5=_slicedToArray$3(val,2);rangetxt=_val5[1];prefix="".concat(val[0],"!");}else {var _val6=_slicedToArray$3(val,1);rangetxt=_val6[0];}if(rangetxt.indexOf(":")===-1){var _row3=parseInt(rangetxt.replace(/[^0-9]/g,""),10);var _col3=columnCharToIndex(rangetxt.replace(/[^A-Za-z]/g,""));var freezonFuc=isfreezonFuc(rangetxt);var $row=freezonFuc[0]?"$":"";var $col=freezonFuc[1]?"$":"";if(orient==="u"&&!freezonFuc[0]){_row3-=step;}else if(orient==="r"&&!freezonFuc[1]){_col3+=step;}else if(orient==="l"&&!freezonFuc[1]){_col3-=step;}else if(orient==="d"&&!freezonFuc[0]){_row3+=step;}if(!Number.isNaN(_row3)&&!Number.isNaN(_col3)){return prefix+$col+indexToColumnChar(_col3)+$row+_row3;}if(!Number.isNaN(_row3)){return prefix+$row+_row3;}if(!Number.isNaN(_col3)){return prefix+$col+indexToColumnChar(_col3);}return txt;}rangetxt=rangetxt.split(":");var row=[];var col=[];row[0]=parseInt(rangetxt[0].replace(/[^0-9]/g,""),10);row[1]=parseInt(rangetxt[1].replace(/[^0-9]/g,""),10);if(row[0]>row[1]){return txt;}col[0]=columnCharToIndex(rangetxt[0].replace(/[^A-Za-z]/g,""));col[1]=columnCharToIndex(rangetxt[1].replace(/[^A-Za-z]/g,""));if(col[0]>col[1]){return txt;}var freezonFuc0=isfreezonFuc(rangetxt[0]);var freezonFuc1=isfreezonFuc(rangetxt[1]);var $row0=freezonFuc0[0]?"$":"";var $col0=freezonFuc0[1]?"$":"";var $row1=freezonFuc1[0]?"$":"";var $col1=freezonFuc1[1]?"$":"";if(orient==="u"){if(!freezonFuc0[0]){row[0]-=step;}if(!freezonFuc1[0]){row[1]-=step;}}else if(orient==="r"){if(!freezonFuc0[1]){col[0]+=step;}if(!freezonFuc1[1]){col[1]+=step;}}else if(orient==="l"){if(!freezonFuc0[1]){col[0]-=step;}if(!freezonFuc1[1]){col[1]-=step;}}else if(orient==="d"){if(!freezonFuc0[0]){row[0]+=step;}if(!freezonFuc1[0]){row[1]+=step;}}if(row[0]<0||col[0]<0){return error$2.r;}if(Number.isNaN(col[0])&&Number.isNaN(col[1])){return "".concat(prefix+$row0+row[0],":").concat($row1).concat(row[1]);}if(Number.isNaN(row[0])&&Number.isNaN(row[1])){return "".concat(prefix+$col0+indexToColumnChar(col[0]),":").concat($col1).concat(indexToColumnChar(col[1]));}return "".concat(prefix+$col0+indexToColumnChar(col[0])+$row0+row[0],":").concat($col1).concat(indexToColumnChar(col[1])).concat($row1).concat(row[1]);}function downparam(txt,step){return updateparam("d",txt,step);}function upparam(txt,step){return updateparam("u",txt,step);}function leftparam(txt,step){return updateparam("l",txt,step);}function rightparam(txt,step){return updateparam("r",txt,step);}function functionCopy(ctx,txt,mode,step){if(mode==null){mode="down";}if(step==null){step=1;}if(txt.substring(0,1)==="="){txt=txt.substring(1);}var funcstack=txt.split("");var i=0;var str="";var function_str="";var matchConfig={bracket:0,comma:0,squote:0,dquote:0};while(i<funcstack.length){var s=funcstack[i];if(s==="("&&matchConfig.dquote===0){matchConfig.bracket+=1;if(str.length>0){function_str+="".concat(str,"(");}else {function_str+="(";}str="";}else if(s===")"&&matchConfig.dquote===0){matchConfig.bracket-=1;function_str+="".concat(functionCopy(ctx,str,mode,step),")");str="";}else if(s==='"'&&matchConfig.squote===0){if(matchConfig.dquote>0){function_str+="".concat(str,"\"");matchConfig.dquote-=1;str="";}else {matchConfig.dquote+=1;str+='"';}}else if(s===","&&matchConfig.dquote===0){function_str+="".concat(functionCopy(ctx,str,mode,step),",");str="";}else if(s==="&"&&matchConfig.dquote===0){if(str.length>0){function_str+="".concat(functionCopy(ctx,str,mode,step),"&");str="";}else {function_str+="&";}}else if(s in operatorjson&&matchConfig.dquote===0){var s_next="";if(i+1<funcstack.length){s_next=funcstack[i+1];}var p=i-1;var s_pre=null;if(p>=0){do{s_pre=funcstack[p];p-=1;}while(p>=0&&s_pre===" ");}if(s+s_next in operatorjson){if(str.length>0){function_str+=functionCopy(ctx,str,mode,step)+s+s_next;str="";}else {function_str+=s+s_next;}i+=1;}else if(!/[^0-9]/.test(s_next)&&s==="-"&&(s_pre==="("||s_pre==null||s_pre===","||s_pre===" "||s_pre in operatorjson)){str+=s;}else {if(str.length>0){function_str+=functionCopy(ctx,str,mode,step)+s;str="";}else {function_str+=s;}}}else {str+=s;}if(i===funcstack.length-1){if(iscelldata(lodash.trim(str))){if(mode==="down"){function_str+=downparam(lodash.trim(str),step);}else if(mode==="up"){function_str+=upparam(lodash.trim(str),step);}else if(mode==="left"){function_str+=leftparam(lodash.trim(str),step);}else if(mode==="right"){function_str+=rightparam(lodash.trim(str),step);}}else {function_str+=lodash.trim(str);}}i+=1;}return function_str;}function checkCellIsLocked(ctx,r,c,sheetId){var _data$r,_sheetFile$config;var sheetFile=getSheetByIndex(ctx,sheetId);if(lodash.isNil(sheetFile)){return false;}var data=sheetFile.data;var cell=data===null||data===void 0?void 0:(_data$r=data[r])===null||_data$r===void 0?void 0:_data$r[c];if(!lodash.isNil(cell===null||cell===void 0?void 0:cell.lo)){return !!(cell===null||cell===void 0?void 0:cell.lo);}var aut=(_sheetFile$config=sheetFile.config)===null||_sheetFile$config===void 0?void 0:_sheetFile$config.authority;var sheetInEditable=lodash.isNil(aut)||lodash.isNil(aut.sheet)||aut.sheet===0;return !sheetInEditable;}function checkProtectionSelectLockedOrUnLockedCells(ctx,r,c,sheetId){var _data$r2;var sheetFile=getSheetByIndex(ctx,sheetId);if(lodash.isNil(sheetFile)){return true;}if(lodash.isNil(sheetFile.config)||lodash.isNil(sheetFile.config.authority)){return true;}var aut=sheetFile.config.authority;if(lodash.isNil(aut)||lodash.isNil(aut.sheet)||aut.sheet===0){return true;}var data=sheetFile.data;var cell=data===null||data===void 0?void 0:(_data$r2=data[r])===null||_data$r2===void 0?void 0:_data$r2[c];if(cell&&cell.lo===0){if(aut.selectunLockedCells===1||lodash.isNil(aut.selectunLockedCells)){return true;}return false;}if(aut.selectLockedCells===1||lodash.isNil(aut.selectLockedCells)){return true;}return false;}function checkProtectionAllSelected(ctx,sheetId){var sheetFile=getSheetByIndex(ctx,sheetId);if(lodash.isNil(sheetFile)){return true;}if(lodash.isNil(sheetFile.config)||lodash.isNil(sheetFile.config.authority)){return true;}var aut=sheetFile.config.authority;if(lodash.isNil(aut)||lodash.isNil(aut.sheet)||aut.sheet===0){return true;}var selectunLockedCells=false;if(aut.selectunLockedCells===1||lodash.isNil(aut.selectunLockedCells)){selectunLockedCells=true;}var selectLockedCells=false;if(aut.selectLockedCells===1||lodash.isNil(aut.selectLockedCells)){selectLockedCells=true;}if(selectunLockedCells&&selectLockedCells){return true;}return false;}function checkProtectionFormatCells(ctx){var sheetFile=getSheetByIndex(ctx,ctx.currentSheetId);if(lodash.isNil(sheetFile)){return true;}if(lodash.isNil(sheetFile.config)||lodash.isNil(sheetFile.config.authority)){return true;}var aut=sheetFile.config.authority;if(lodash.isNil(aut)||lodash.isNil(aut.sheet)||aut.sheet===0){return true;}var ht="";if(!lodash.isNil(aut.hintText)&&aut.hintText.length>0){ht=aut.hintText;}else {ht=aut.defaultSheetHintText;}ctx.warnDialog=ht;return false;}function setConditionRules(ctx,protection,generalDialog,conditionformat,rules){var _ctx$luckysheet_selec,_ctx$luckysheetfile$i;if(!checkProtectionFormatCells(ctx)){return;}var conditionName=rules.rulesType;var conditionRange=[];var conditionValue=[];if(conditionName==="greaterThan"||conditionName==="lessThan"||conditionName==="equal"||conditionName==="textContains"){var v=rules.rulesValue;var rangeArr=getRangeByTxt(ctx,v);if(rangeArr.length>1){var r1=rangeArr[0].row[0];var r2=rangeArr[0].row[1];var c1=rangeArr[0].column[0];var c2=rangeArr[0].column[1];if(r1===r2&&c1===c2){var d=getFlowdata(ctx);if(!d)return;v=getCellValue(r1,c1,d);conditionRange.push({row:rangeArr[0].row,column:rangeArr[0].column});conditionValue.push(v);}else {ctx.warnDialog=conditionformat.onlySingleCell;}}else if(rangeArr.length===0){if(lodash.isNaN(v)||v===""){ctx.warnDialog=conditionformat.conditionValueCanOnly;return;}conditionValue.push(v);}}else if(conditionName==="between"){var v1=rules.betweenValue.value1;var v2=rules.betweenValue.value2;var rangeArr1=getRangeByTxt(ctx,v1);if(rangeArr1.length>1){ctx.warnDialog=conditionformat.onlySingleCell;return;}if(rangeArr1.length===1){var _r=rangeArr1[0].row[0];var _r2=rangeArr1[0].row[1];var _c=rangeArr1[0].column[0];var _c2=rangeArr1[0].column[1];if(_r===_r2&&_c===_c2){var _d=getFlowdata(ctx);if(!_d)return;v1=getCellValue(_r,_c,_d);conditionRange.push({row:rangeArr1[0].row,column:rangeArr1[0].column});conditionValue.push(v1);}else {ctx.warnDialog=conditionformat.onlySingleCell;return;}}else if(rangeArr1.length===0){if(lodash.isNaN(v1)||v1===""){ctx.warnDialog=conditionformat.conditionValueCanOnly;return;}conditionValue.push(v1);}var rangeArr2=getRangeByTxt(ctx,v2);if(rangeArr2.length>1){ctx.warnDialog=conditionformat.onlySingleCell;return;}if(rangeArr2.length===1){var _r3=rangeArr2[0].row[0];var _r4=rangeArr2[0].row[1];var _c3=rangeArr2[0].column[0];var _c4=rangeArr2[0].column[1];if(_r3===_r4&&_c3===_c4){var _d2=getFlowdata(ctx);if(!_d2)return;v2=getCellValue(_r3,_c3,_d2);conditionRange.push({row:rangeArr2[0].row,column:rangeArr2[0].column});}else {ctx.warnDialog=conditionformat.onlySingleCell;return;}}else if(rangeArr2.length===0){if(lodash.isNaN(v2)||v2===""){ctx.warnDialog=conditionformat.conditionValueCanOnly;}else {conditionValue.push(v2);}}}else if(conditionName==="occurrenceDate"){var _v=rules.dateValue;if(!_v){ctx.warnDialog=conditionformat.pleaseSelectADate;return;}conditionValue.push(_v);}else if(conditionName==="duplicateValue"){conditionValue.push(rules.repeatValue);}else if(conditionName==="top10"||conditionName==="top10_percent"||conditionName==="last10"||conditionName==="last10_percent"){var _v2=rules.projectValue;if(parseInt(_v2,10).toString()!==_v2||parseInt(_v2,10)<1||parseInt(_v2,10)>1000){ctx.warnDialog=conditionformat.pleaseEnterInteger;return;}conditionValue.push(_v2);}else {conditionValue.push(conditionName);}var textColor=null;if(rules.textColor.check){textColor=rules.textColor.color;}var cellColor=null;if(rules.cellColor.check){cellColor=rules.cellColor.color;}var rule={type:"default",cellrange:(_ctx$luckysheet_selec=ctx.luckysheet_select_save)!==null&&_ctx$luckysheet_selec!==void 0?_ctx$luckysheet_selec:[],format:{textColor:textColor,cellColor:cellColor},conditionName:conditionName,conditionRange:conditionRange,conditionValue:conditionValue};var index=getSheetIndex(ctx,ctx.currentSheetId);var ruleArr=(_ctx$luckysheetfile$i=ctx.luckysheetfile[index].luckysheet_conditionformat_save)!==null&&_ctx$luckysheetfile$i!==void 0?_ctx$luckysheetfile$i:[];ruleArr===null||ruleArr===void 0?void 0:ruleArr.push(rule);ctx.luckysheetfile[index].luckysheet_conditionformat_save=ruleArr;}function getColorGradation(color1,color2,value1,value2,value){var rgb1=color1.split(",");var r1=parseInt(rgb1[0].split("(")[1],10);var g1=parseInt(rgb1[1],10);var b1=parseInt(rgb1[2].split(")")[0],10);var rgb2=color2.split(",");var r2=parseInt(rgb2[0].split("(")[1],10);var g2=parseInt(rgb2[1],10);var b2=parseInt(rgb2[2].split(")")[0],10);var v12=value1-value2;var v10=value1-value;var r=Math.round(r1-(r1-r2)/v12*v10);var g=Math.round(g1-(g1-g2)/v12*v10);var b=Math.round(b1-(b1-b2)/v12*v10);return "rgb(".concat(r,", ").concat(g,", ").concat(b,")");}function compute$1(ctx,ruleArr,d){if(lodash.isNil(ruleArr)){ruleArr=[];}var computeMap={};if(ruleArr.length>0){var _loop=function _loop(){var _ruleArr$i=ruleArr[i],type=_ruleArr$i.type,cellrange=_ruleArr$i.cellrange,format=_ruleArr$i.format;if(type==="dataBar"){var max=null;var min=null;for(var s=0;s<cellrange.length;s+=1){for(var r=cellrange[s].row[0];r<=cellrange[s].row[1];r+=1){for(var c=cellrange[s].column[0];c<=cellrange[s].column[1];c+=1){if(lodash.isNil(d[r])||lodash.isNil(d[r][c])){continue;}var cell=d[r][c];if(!lodash.isNil(cell)&&!lodash.isNil(cell.ct)&&cell.ct.t==="n"&&lodash.isNil(cell.v)){if(lodash.isNil(max)||parseInt("".concat(cell.v),10)>max){max=parseInt("".concat(cell.v),10);}if(lodash.isNil(min)||parseInt("".concat(cell.v),10)<min){min=parseInt("".concat(cell.v),10);}}}}}if(!lodash.isNil(max)&&!lodash.isNil(min)){if(min<0){var plusLen=Math.round(max/(max-min)*10)/10;var minusLen=Math.round(Math.abs(min)/(max-min)*10)/10;for(var _s=0;_s<cellrange.length;_s+=1){for(var _r5=cellrange[_s].row[0];_r5<=cellrange[_s].row[1];_r5+=1){for(var _c5=cellrange[_s].column[0];_c5<=cellrange[_s].column[1];_c5+=1){if(lodash.isNil(d[_r5])||lodash.isNil(d[_r5][_c5])){continue;}var _cell=d[_r5][_c5];if(!lodash.isNil(_cell)&&!lodash.isNil(_cell.ct)&&_cell.ct.t==="n"&&!lodash.isNil(_cell.v)){if(parseInt("".concat(_cell.v),10)<0){var valueLen=Math.round(Math.abs(parseInt("".concat(_cell.v),10))/Math.abs(min)*100)/100;if("".concat(_r5,"_").concat(_c5)in computeMap){computeMap["".concat(_r5,"_").concat(_c5)].dataBar={valueType:"minus",minusLen:minusLen,valueLen:valueLen,format:format};}else {computeMap["".concat(_r5,"_").concat(_c5)]={dataBar:{valueType:"minus",minusLen:minusLen,valueLen:valueLen,format:format}};}}if(parseInt("".concat(_cell.v),10)>0){var _valueLen=Math.round(parseInt("".concat(_cell.v),10)/max*100)/100;if("".concat(_r5,"_").concat(_c5)in computeMap){computeMap["".concat(_r5,"_").concat(_c5)].dataBar={valueType:"plus",plusLen:plusLen,minusLen:minusLen,valueLen:_valueLen,format:format};}else {computeMap["".concat(_r5,"_").concat(_c5)]={dataBar:{valueType:"plus",plusLen:plusLen,minusLen:minusLen,valueLen:_valueLen,format:format}};}}}}}}}else {var _plusLen=1;for(var _s2=0;_s2<cellrange.length;_s2+=1){for(var _r6=cellrange[_s2].row[0];_r6<=cellrange[_s2].row[1];_r6+=1){for(var _c6=cellrange[_s2].column[0];_c6<=cellrange[_s2].column[1];_c6+=1){if(lodash.isNil(d[_r6])||lodash.isNil(d[_r6][_c6])){continue;}var _cell2=d[_r6][_c6];if(!lodash.isNil(_cell2)&&!lodash.isNil(_cell2.ct)&&_cell2.ct.t==="n"&&!lodash.isNil(_cell2.v)){var _valueLen2=void 0;if(max===0){_valueLen2=1;}else {_valueLen2=Math.round(parseInt("".concat(_cell2.v),10)/max*100)/100;}if("".concat(_r6,"_").concat(_c6)in computeMap){computeMap["".concat(_r6,"_").concat(_c6)].dataBar={valueType:"plus",plusLen:_plusLen,valueLen:_valueLen2,format:format};}else {computeMap["".concat(_r6,"_").concat(_c6)]={dataBar:{valueType:"plus",plusLen:_plusLen,valueLen:_valueLen2,format:format}};}}}}}}}}else if(type==="colorGradation"){var _max=null;var _min=null;var sum=0;var count=0;for(var _s3=0;_s3<cellrange.length;_s3+=1){for(var _r7=cellrange[_s3].row[0];_r7<=cellrange[_s3].row[1];_r7+=1){for(var _c7=cellrange[_s3].column[0];_c7<=cellrange[_s3].column[1];_c7+=1){if(lodash.isNil(d[_r7])||lodash.isNil(d[_r7][_c7])){continue;}var _cell3=d[_r7][_c7];if(!lodash.isNil(_cell3)&&!lodash.isNil(_cell3.ct)&&_cell3.ct.t==="n"&&!lodash.isNil(_cell3.v)){count+=1;sum+=parseInt("".concat(_cell3.v),10);if(lodash.isNil(_max)||parseInt("".concat(_cell3.v),10)>_max){_max=parseInt("".concat(_cell3.v),10);}if(lodash.isNil(_min)||parseInt("".concat(_cell3.v),10)<_min){_min=parseInt("".concat(_cell3.v),10);}}}}}if(!lodash.isNil(_max)&&!lodash.isNil(_min)){if(format.length===3){var avg=Math.floor(sum/count);for(var _s4=0;_s4<cellrange.length;_s4+=1){for(var _r8=cellrange[_s4].row[0];_r8<=cellrange[_s4].row[1];_r8+=1){for(var _c8=cellrange[_s4].column[0];_c8<=cellrange[_s4].column[1];_c8+=1){if(lodash.isNil(d[_r8])||lodash.isNil(d[_r8][_c8])){continue;}var _cell4=d[_r8][_c8];if(!lodash.isNil(_cell4)&&!lodash.isNil(_cell4.ct)&&_cell4.ct.t==="n"&&!lodash.isNil(_cell4.v)){if(parseInt("".concat(_cell4.v),10)===_min){if("".concat(_r8,"_").concat(_c8)in computeMap){computeMap["".concat(_r8,"_").concat(_c8)].cellColor=format.cellColor;}else {computeMap["".concat(_r8,"_").concat(_c8)]={cellColor:format.cellColor};}}else if(parseInt("".concat(_cell4.v),10)>_min&&parseInt("".concat(_cell4.v),10)<avg){if("".concat(_r8,"_").concat(_c8)in computeMap){computeMap["".concat(_r8,"_").concat(_c8)].cellColor=getColorGradation(format.cellColor,format.textColor,_min,avg,parseInt("".concat(_cell4.v),10));}else {computeMap["".concat(_r8,"_").concat(_c8)]={cellColor:getColorGradation(format[2],format[1],_min,avg,parseInt("".concat(_cell4.v),10))};}}else if(parseInt("".concat(_cell4.v),10)===avg){if("".concat(_r8,"_").concat(_c8)in computeMap){computeMap["".concat(_r8,"_").concat(_c8)].cellColor=format.cellColor;}else {computeMap["".concat(_r8,"_").concat(_c8)]={cellColor:format[1]};}}else if(parseInt("".concat(_cell4.v),10)>avg&&parseInt("".concat(_cell4.v),10)<_max){if("".concat(_r8,"_").concat(_c8)in computeMap){computeMap["".concat(_r8,"_").concat(_c8)].cellColor=getColorGradation(format[1],format[0],avg,_max,parseInt("".concat(_cell4.v),10));}else {computeMap["".concat(_r8,"_").concat(_c8)]={cellColor:getColorGradation(format[1],format[0],avg,_max,parseInt("".concat(_cell4.v),10))};}}else if(parseInt("".concat(_cell4.v),10)===_max){if("".concat(_r8,"_").concat(_c8)in computeMap){computeMap["".concat(_r8,"_").concat(_c8)].cellColor=format.cellColor;}else {computeMap["".concat(_r8,"_").concat(_c8)]={cellColor:format[0]};}}}}}}}else if(format.length===2){for(var _s5=0;_s5<cellrange.length;_s5+=1){for(var _r9=cellrange[_s5].row[0];_r9<=cellrange[_s5].row[1];_r9+=1){for(var _c9=cellrange[_s5].column[0];_c9<=cellrange[_s5].column[1];_c9+=1){if(lodash.isNil(d[_r9])||lodash.isNil(d[_r9][_c9])){continue;}var _cell5=d[_r9][_c9];if(!lodash.isNil(_cell5)&&!lodash.isNil(_cell5.ct)&&_cell5.ct.t==="n"&&!lodash.isNil(_cell5.v)){if(parseInt("".concat(_cell5.v),10)===_min){if("".concat(_r9,"_").concat(_c9)in computeMap){computeMap["".concat(_r9,"_").concat(_c9)].cellColor=format.cellColor;}else {computeMap["".concat(_r9,"_").concat(_c9)]={cellColor:format[1]};}}else if(parseInt("".concat(_cell5.v),10)>_min&&parseInt("".concat(_cell5.v),10)<_max){if("".concat(_r9,"_").concat(_c9)in computeMap){computeMap["".concat(_r9,"_").concat(_c9)].cellColor=getColorGradation(format[1],format[0],_min,_max,parseInt("".concat(_cell5.v),10));}else {computeMap["".concat(_r9,"_").concat(_c9)]={cellColor:getColorGradation(format[1],format[0],_min,_max,parseInt("".concat(_cell5.v),10))};}}else if(parseInt("".concat(_cell5.v),10)===_max){if("".concat(_r9,"_").concat(_c9)in computeMap){computeMap["".concat(_r9,"_").concat(_c9)].cellColor=format.textColor;}else {computeMap["".concat(_r9,"_").concat(_c9)]={cellColor:format[0]};}}}}}}}}}else if(type==="icons");else {var conditionName=ruleArr[i].conditionName;var conditionValue0=ruleArr[i].conditionValue[0];var conditionValue1=ruleArr[i].conditionValue[1];var textColor=format.textColor,cellColor=format.cellColor;for(var _s6=0;_s6<cellrange.length;_s6+=1){if(conditionName==="greaterThan"||conditionName==="lessThan"||conditionName==="equal"||conditionName==="textContains"){for(var _r10=cellrange[_s6].row[0];_r10<=cellrange[_s6].row[1];_r10+=1){for(var _c10=cellrange[_s6].column[0];_c10<=cellrange[_s6].column[1];_c10+=1){if(lodash.isNil(d[_r10])||lodash.isNil(d[_r10][_c10])){continue;}var _cell6=d[_r10][_c10];if(lodash.isNil(_cell6)||lodash.isNil(_cell6.v)||isRealNull(_cell6.v)){continue;}if(conditionName==="greaterThan"&&_cell6.v>conditionValue0){if("".concat(_r10,"_").concat(_c10)in computeMap){computeMap["".concat(_r10,"_").concat(_c10)].textColor=textColor;computeMap["".concat(_r10,"_").concat(_c10)].cellColor=cellColor;}else {computeMap["".concat(_r10,"_").concat(_c10)]={textColor:textColor,cellColor:cellColor};}}else if(conditionName==="lessThan"&&_cell6.v<conditionValue0){if("".concat(_r10,"_").concat(_c10)in computeMap){computeMap["".concat(_r10,"_").concat(_c10)].textColor=textColor;computeMap["".concat(_r10,"_").concat(_c10)].cellColor=cellColor;}else {computeMap["".concat(_r10,"_").concat(_c10)]={textColor:textColor,cellColor:cellColor};}}else if(conditionName==="equal"&&_cell6.v.toString()===conditionValue0){if("".concat(_r10,"_").concat(_c10)in computeMap){computeMap["".concat(_r10,"_").concat(_c10)].textColor=textColor;computeMap["".concat(_r10,"_").concat(_c10)].cellColor=cellColor;}else {computeMap["".concat(_r10,"_").concat(_c10)]={textColor:textColor,cellColor:cellColor};}}else if(conditionName==="textContains"&&_cell6.v.toString().indexOf(conditionValue0)!==-1){if("".concat(_r10,"_").concat(_c10)in computeMap){computeMap["".concat(_r10,"_").concat(_c10)].textColor=textColor;computeMap["".concat(_r10,"_").concat(_c10)].cellColor=cellColor;}else {computeMap["".concat(_r10,"_").concat(_c10)]={textColor:textColor,cellColor:cellColor};}}}}}else if(conditionName==="between"){var vBig=0;var vSmall=0;if(conditionValue0>conditionValue1){vBig=conditionValue0;vSmall=conditionValue1;}else {vBig=conditionValue1;vSmall=conditionValue0;}for(var _r11=cellrange[_s6].row[0];_r11<=cellrange[_s6].row[1];_r11+=1){for(var _c11=cellrange[_s6].column[0];_c11<=cellrange[_s6].column[1];_c11+=1){if(lodash.isNil(d[_r11])||lodash.isNil(d[_r11][_c11])){continue;}var _cell7=d[_r11][_c11];if(lodash.isNil(_cell7)||lodash.isNil(_cell7.v)||isRealNull(_cell7.v)){continue;}if(_cell7.v>=vSmall&&_cell7.v<=vBig){if("".concat(_r11,"_").concat(_c11)in computeMap){computeMap["".concat(_r11,"_").concat(_c11)].textColor=textColor;computeMap["".concat(_r11,"_").concat(_c11)].cellColor=cellColor;}else {computeMap["".concat(_r11,"_").concat(_c11)]={textColor:textColor,cellColor:cellColor};}}}}}else if(conditionName==="occurrenceDate"){var dBig=void 0;var dSmall=void 0;if(conditionValue0.toString().indexOf("-")===-1){dBig=genarate(conditionValue0)[2].toString();dSmall=genarate(conditionValue0)[2].toString();}else {var str=conditionValue0.toString().split("-");dBig=genarate(str[1].trim())[2].toString();dSmall=genarate(str[0].trim()[2].toString());}for(var _r12=cellrange[_s6].row[0];_r12<=cellrange[_s6].row[1];_r12+=1){for(var _c12=cellrange[_s6].column[0];_c12<=cellrange[_s6].column[1];_c12+=1){if(lodash.isNil(d[_r12])||lodash.isNil(d[_r12][_c12])){continue;}if(!lodash.isNil(d[_r12][_c12])&&!lodash.isNil(d[_r12][_c12].ct)&&d[_r12][_c12].ct.t==="d"){var cellVal=getCellValue(_r12,_c12,d);if(cellVal>=dSmall&&cellVal<=dBig){if("".concat(_r12,"_").concat(_c12)in computeMap){computeMap["".concat(_r12,"_").concat(_c12)].textColor=textColor;computeMap["".concat(_r12,"_").concat(_c12)].cellColor=cellColor;}else {computeMap["".concat(_r12,"_").concat(_c12)]={textColor:textColor,cellColor:cellColor};}}}}}}else if(conditionName==="duplicateValue"){var dmap={};for(var _r13=cellrange[_s6].row[0];_r13<=cellrange[_s6].row[1];_r13+=1){for(var _c13=cellrange[_s6].column[0];_c13<=cellrange[_s6].column[1];_c13+=1){var item=getCellValue(_r13,_c13,d);if(!(item in dmap)){dmap[item]=[];}dmap[item].push({r:_r13,c:_c13});}}if(conditionValue0==="0"){lodash.forEach(dmap,function(x){if(x.length>1){for(var j=0;j<x.length;j+=1){if("".concat(x[j].r,"_").concat(x[j].c)in computeMap){computeMap["".concat(x[j].r,"_").concat(x[j].c)].textColor=textColor;computeMap["".concat(x[j].r,"_").concat(x[j].c)].cellColor=cellColor;}else {computeMap["".concat(x[j].r,"_").concat(x[j].c)]={textColor:textColor,cellColor:cellColor};}}}});}else if(conditionValue0==="1"){lodash.forEach(dmap,function(x){if(x.length===1){if("".concat(x[0].r,"_").concat(x[0].c)in computeMap){computeMap["".concat(x[0].r,"_").concat(x[0].c)].textColor=textColor;computeMap["".concat(x[0].r,"_").concat(x[0].c)].cellColor=cellColor;}else {computeMap["".concat(x[0].r,"_").concat(x[0].c)]={textColor:textColor,cellColor:cellColor};}}});}}else if(conditionName==="top10"||conditionName==="top10_percent"||conditionName==="last10"||conditionName==="last10_percent"||conditionName==="aboveAverage"||conditionName==="belowAverage"){var dArr=[];for(var _r14=cellrange[_s6].row[0];_r14<=cellrange[_s6].row[1];_r14+=1){for(var _c14=cellrange[_s6].column[0];_c14<=cellrange[_s6].column[1];_c14+=1){if(lodash.isNil(d[_r14])||lodash.isNil(d[_r14][_c14])){continue;}if(!lodash.isNil(d[_r14][_c14])&&!lodash.isNil(d[_r14][_c14].ct)&&d[_r14][_c14].ct.t==="n"){dArr.push(getCellValue(_r14,_c14,d));}}}if(conditionName==="top10"||conditionName==="top10_percent"||conditionName==="last10"||conditionName==="last10_percent"){for(var j=0;j<dArr.length;j+=1){for(var k=0;k<dArr.length-1-j;k+=1){if(dArr[k]<dArr[k+1]){var temp=dArr[k];dArr[k]=dArr[k+1];dArr[k+1]=temp;}}}var cArr=void 0;if(conditionName==="top10"){cArr=dArr.slice(0,conditionValue0);}else if(conditionName==="top10_percent"){cArr=dArr.slice(0,Math.floor(conditionValue0*dArr.length/100));}else if(conditionName==="last10"){cArr=dArr.slice(dArr.length-conditionValue0,dArr.length);}else if(conditionName==="last10_percent"){cArr=dArr.slice(dArr.length-Math.floor(conditionValue0*dArr.length/100),dArr.length);}for(var _r15=cellrange[_s6].row[0];_r15<=cellrange[_s6].row[1];_r15+=1){for(var _c15=cellrange[_s6].column[0];_c15<=cellrange[_s6].column[1];_c15+=1){if(lodash.isNil(d[_r15])||lodash.isNil(d[_r15][_c15])){continue;}var _cellVal=getCellValue(_r15,_c15,d);if(!lodash.isNil(cArr)&&cArr.indexOf(_cellVal)!==-1){if("".concat(_r15,"_").concat(_c15)in computeMap){computeMap["".concat(_r15,"_").concat(_c15)].textColor=textColor;computeMap["".concat(_r15,"_").concat(_c15)].cellColor=cellColor;}else {computeMap["".concat(_r15,"_").concat(_c15)]={textColor:textColor,cellColor:cellColor};}}}}}else if(conditionName==="aboveAverage"||conditionName==="belowAverage"){var _sum=0;for(var _j=0;_j<dArr.length;_j+=1){_sum+=dArr[_j];}var averageNum=_sum/dArr.length;if(conditionName==="aboveAverage"){for(var _r16=cellrange[_s6].row[0];_r16<=cellrange[_s6].row[1];_r16+=1){for(var _c16=cellrange[_s6].column[0];_c16<=cellrange[_s6].column[1];_c16+=1){if(lodash.isNil(d[_r16])||lodash.isNil(d[_r16][_c16])){continue;}var _cellVal2=getCellValue(_r16,_c16,d);if(_cellVal2>averageNum){if("".concat(_r16,"_").concat(_c16)in computeMap){computeMap["".concat(_r16,"_").concat(_c16)].textColor=textColor;computeMap["".concat(_r16,"_").concat(_c16)].cellColor=cellColor;}else {computeMap["".concat(_r16,"_").concat(_c16)]={textColor:textColor,cellColor:cellColor};}}}}}else if(conditionName==="belowAverage"){for(var _r17=cellrange[_s6].row[0];_r17<=cellrange[_s6].row[1];_r17+=1){for(var _c17=cellrange[_s6].column[0];_c17<=cellrange[_s6].column[1];_c17+=1){if(lodash.isNil(d[_r17])||lodash.isNil(d[_r17][_c17])){continue;}var _cellVal3=getCellValue(_r17,_c17,d);if(_cellVal3<averageNum){if("".concat(_r17,"_").concat(_c17)in computeMap){computeMap["".concat(_r17,"_").concat(_c17)].textColor=textColor;computeMap["".concat(_r17,"_").concat(_c17)].cellColor=cellColor;}else {computeMap["".concat(_r17,"_").concat(_c17)]={textColor:textColor,cellColor:cellColor};}}}}}}}else if(conditionName==="formula"){var _str=cellrange[_s6].row[0];var edr=cellrange[_s6].row[1];var stc=cellrange[_s6].column[0];var edc=cellrange[_s6].column[1];var formulaTxt=conditionValue0;if(conditionValue0.toString().slice(0,1)!=="="){formulaTxt="=".concat(conditionValue0);}for(var _r18=_str;_r18<=edr;_r18+=1){for(var _c18=stc;_c18<=edc;_c18+=1){var func=formulaTxt;var offsetRow=_r18-_str;var offsetCol=_c18-stc;if(offsetRow>0){func="=".concat(functionCopy(ctx,func,"down",offsetRow));}if(offsetCol>0){func="=".concat(functionCopy(ctx,func,"right",offsetCol));}var funcV=execfunction(ctx,func,_r18,_c18);var v=funcV[1];if(typeof v!=="boolean"){v=!!Number(v);}if(!v){continue;}if("".concat(_r18,"_").concat(_c18)in computeMap){computeMap["".concat(_r18,"_").concat(_c18)].textColor=textColor;computeMap["".concat(_r18,"_").concat(_c18)].cellColor=cellColor;}else {computeMap["".concat(_r18,"_").concat(_c18)]={textColor:textColor,cellColor:cellColor};}}}}}}};for(var i=0;i<ruleArr.length;i+=1){_loop();}}return computeMap;}function getComputeMap(ctx){var index=getSheetIndex(ctx,ctx.currentSheetId);var ruleArr=ctx.luckysheetfile[index].luckysheet_conditionformat_save;var data=ctx.luckysheetfile[index].data;if(lodash.isNil(data))return null;var computeMap=compute$1(ctx,ruleArr,data);return computeMap;}function checkCF(r,c,computeMap){if(!lodash.isNil(computeMap)&&"".concat(r,"_").concat(c)in computeMap){return computeMap["".concat(r,"_").concat(c)];}return null;}function updateItem(ctx,type){if(!checkProtectionFormatCells(ctx)){return;}var index=getSheetIndex(ctx,ctx.currentSheetId);var ruleArr=[];if(type==="delSheet"){ruleArr=[];}else {var _ctx$luckysheet_selec2,_ctx$luckysheetfile$i2;var rule={type:type,cellrange:(_ctx$luckysheet_selec2=ctx.luckysheet_select_save)!==null&&_ctx$luckysheet_selec2!==void 0?_ctx$luckysheet_selec2:[],format:{textColor:ctx.conditionRules.textColor,cellColor:ctx.conditionRules.cellColor}};ruleArr=(_ctx$luckysheetfile$i2=ctx.luckysheetfile[index].luckysheet_conditionformat_save)!==null&&_ctx$luckysheetfile$i2!==void 0?_ctx$luckysheetfile$i2:[];ruleArr.push(rule);}ctx.luckysheetfile[index].luckysheet_conditionformat_save=ruleArr;}function CFSplitRange(range1,range2,range3,type){var range=[];var offset_r=range3.row[0]-range2.row[0];var offset_c=range3.column[0]-range2.column[0];var r1=range1.row[0];var r2=range1.row[1];var c1=range1.column[0];var c2=range1.column[1];if(r1>=range2.row[0]&&r2<=range2.row[1]&&c1>=range2.column[0]&&c2<=range2.column[1]){if(type==="allPart"){range=[{row:[r1+offset_r,r2+offset_r],column:[c1+offset_c,c2+offset_c]}];}else if(type==="restPart"){range=[];}else if(type==="operatePart"){range=[{row:[r1+offset_r,r2+offset_r],column:[c1+offset_c,c2+offset_c]}];}}else if(r1>=range2.row[0]&&r1<=range2.row[1]&&c1>=range2.column[0]&&c2<=range2.column[1]){if(type==="allPart"){range=[{row:[range2.row[1]+1,r2],column:[c1,c2]},{row:[r1+offset_r,range2.row[1]+offset_r],column:[c1+offset_c,c2+offset_c]}];}else if(type==="restPart"){range=[{row:[range2.row[1]+1,r2],column:[c1,c2]}];}else if(type==="operatePart"){range=[{row:[r1+offset_r,range2.row[1]+offset_r],column:[c1+offset_c,c2+offset_c]}];}}else if(r2>=range2.row[0]&&r2<=range2.row[1]&&c1>=range2.column[0]&&c2<=range2.column[1]){if(type==="allPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[0]+offset_r,r2+offset_r],column:[c1+offset_c,c2+offset_c]}];}else if(type==="restPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]}];}else if(type==="operatePart"){range=[{row:[range2.row[0]+offset_r,r2+offset_r],column:[c1+offset_c,c2+offset_c]}];}}else if(r1<range2.row[0]&&r2>range2.row[1]&&c1>=range2.column[0]&&c2<=range2.column[1]){if(type==="allPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[1]+1,r2],column:[c1,c2]},{row:[range2.row[0]+offset_r,range2.row[1]+offset_r],column:[c1+offset_c,c2+offset_c]}];}else if(type==="restPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[1]+1,r2],column:[c1,c2]}];}else if(type==="operatePart"){range=[{row:[range2.row[0]+offset_r,range2.row[1]+offset_r],column:[c1+offset_c,c2+offset_c]}];}}else if(c1>=range2.column[0]&&c1<=range2.column[1]&&r1>=range2.row[0]&&r2<=range2.row[1]){if(type==="allPart"){range=[{row:[r1,r2],column:[range2.column[1]+1,c2]},{row:[r1+offset_r,r2+offset_r],column:[c1+offset_c,range2.column[1]+offset_c]}];}else if(type==="restPart"){range=[{row:[r1,r2],column:[range2.column[1]+1,c2]}];}else if(type==="operatePart"){range=[{row:[r1+offset_r,r2+offset_r],column:[c1+offset_c,range2.column[1]+offset_c]}];}}else if(c2>=range2.column[0]&&c2<=range2.column[1]&&r1>=range2.row[0]&&r2<=range2.row[1]){if(type==="allPart"){range=[{row:[r1,r2],column:[c1,range2.column[0]-1]},{row:[r1+offset_r,r2+offset_r],column:[range2.column[0]+offset_c,c2+offset_c]}];}else if(type==="restPart"){range=[{row:[r1,r2],column:[c1,range2.column[0]-1]}];}else if(type==="operatePart"){range=[{row:[r1+offset_r,r2+offset_r],column:[range2.column[0]+offset_c,c2+offset_c]}];}}else if(c1<range2.column[0]&&c2>range2.column[1]&&r1>=range2.row[0]&&r2<=range2.row[1]){if(type==="allPart"){range=[{row:[r1,r2],column:[c1,range2.column[0]-1]},{row:[r1,r2],column:[range2.column[1]+1,c2]},{row:[r1+offset_r,r2+offset_r],column:[range2.column[0]+offset_c,range2.column[1]+offset_c]}];}else if(type==="restPart"){range=[{row:[r1,r2],column:[c1,range2.column[0]-1]},{row:[r1,r2],column:[range2.column[1]+1,c2]}];}else if(type==="operatePart"){range=[{row:[r1+offset_r,r2+offset_r],column:[range2.column[0]+offset_c,range2.column[1]+offset_c]}];}}else if(r1>=range2.row[0]&&r1<=range2.row[1]&&c1>=range2.column[0]&&c1<=range2.column[1]){if(type==="allPart"){range=[{row:[r1,range2.row[1]],column:[range2.column[1]+1,c2]},{row:[range2.row[1]+1,r2],column:[c1,c2]},{row:[r1+offset_r,range2.row[1]+offset_r],column:[c1+offset_c,range2.column[1]+offset_c]}];}else if(type==="restPart"){range=[{row:[r1,range2.row[1]],column:[range2.column[1]+1,c2]},{row:[range2.row[1]+1,r2],column:[c1,c2]}];}else if(type==="operatePart"){range=[{row:[r1+offset_r,range2.row[1]+offset_r],column:[c1+offset_c,range2.column[1]+offset_c]}];}}else if(r1>=range2.row[0]&&r1<=range2.row[1]&&c2>=range2.column[0]&&c2<=range2.column[1]){if(type==="allPart"){range=[{row:[r1,range2.row[1]],column:[c1,range2.column[0]-1]},{row:[range2.row[1]+1,r2],column:[c1,c2]},{row:[r1+offset_r,range2.row[1]+offset_r],column:[range2.column[0]+offset_c,c2+offset_c]}];}else if(type==="restPart"){range=[{row:[r1,range2.row[1]],column:[c1,range2.column[0]-1]},{row:[range2.row[1]+1,r2],column:[c1,c2]}];}else if(type==="operatePart"){range=[{row:[r1+offset_r,range2.row[1]+offset_r],column:[range2.column[0]+offset_c,c2+offset_c]}];}}else if(r2>=range2.row[0]&&r2<=range2.row[1]&&c1>=range2.column[0]&&c1<=range2.column[1]){if(type==="allPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[0],r2],column:[range2.column[1]+1,c2]},{row:[range2.row[0]+offset_r,r2+offset_r],column:[c1+offset_c,range2.column[1]+offset_c]}];}else if(type==="restPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[0],r2],column:[range2.column[1]+1,c2]}];}else if(type==="operatePart"){range=[{row:[range2.row[0]+offset_r,r2+offset_r],column:[c1+offset_c,range2.column[1]+offset_c]}];}}else if(r2>=range2.row[0]&&r2<=range2.row[1]&&c2>=range2.column[0]&&c2<=range2.column[1]){if(type==="allPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[0],r2],column:[c1,range2.column[0]-1]},{row:[range2.row[0]+offset_r,r2+offset_r],column:[range2.column[0]+offset_c,c2+offset_c]}];}else if(type==="restPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[0],r2],column:[c1,range2.column[0]-1]}];}else if(type==="operatePart"){range=[{row:[range2.row[0]+offset_r,r2+offset_r],column:[range2.column[0]+offset_c,c2+offset_c]}];}}else if(r1<range2.row[0]&&r2>range2.row[1]&&c1>=range2.column[0]&&c1<=range2.column[1]){if(type==="allPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[0],range2.row[1]],column:[range2.column[1]+1,c2]},{row:[range2.row[1]+1,r2],column:[c1,c2]},{row:[range2.row[0]+offset_r,range2.row[1]+offset_r],column:[c1+offset_c,range2.column[1]+offset_c]}];}else if(type==="restPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[0],range2.row[1]],column:[range2.column[1]+1,c2]},{row:[range2.row[1]+1,r2],column:[c1,c2]}];}else if(type==="operatePart"){range=[{row:[range2.row[0]+offset_r,range2.row[1]+offset_r],column:[c1+offset_c,range2.column[1]+offset_c]}];}}else if(r1<range2.row[0]&&r2>range2.row[1]&&c2>=range2.column[0]&&c2<=range2.column[1]){if(type==="allPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[0],range2.row[1]],column:[c1,range2.column[0]-1]},{row:[range2.row[1]+1,r2],column:[c1,c2]},{row:[range2.row[0]+offset_r,range2.row[1]+offset_r],column:[range2.column[0]+offset_c,c2+offset_c]}];}else if(type==="restPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[0],range2.row[1]],column:[c1,range2.column[0]-1]},{row:[range2.row[1]+1,r2],column:[c1,c2]}];}else if(type==="operatePart"){range=[{row:[range2.row[0]+offset_r,range2.row[1]+offset_r],column:[range2.column[0]+offset_c,c2+offset_c]}];}}else if(c1<range2.column[0]&&c2>range2.column[1]&&r1>=range2.row[0]&&r1<=range2.row[1]){if(type==="allPart"){range=[{row:[r1,range2.row[1]],column:[c1,range2.column[0]-1]},{row:[r1,range2.row[1]],column:[range2.column[1]+1,c2]},{row:[range2.row[1]+1,r2],column:[c1,c2]},{row:[r1+offset_r,range2.row[1]+offset_r],column:[range2.column[0]+offset_c,range2.column[1]+offset_c]}];}else if(type==="restPart"){range=[{row:[r1,range2.row[1]],column:[c1,range2.column[0]-1]},{row:[r1,range2.row[1]],column:[range2.column[1]+1,c2]},{row:[range2.row[1]+1,r2],column:[c1,c2]}];}else if(type==="operatePart"){range=[{row:[r1+offset_r,range2.row[1]+offset_r],column:[range2.column[0]+offset_c,range2.column[1]+offset_c]}];}}else if(c1<range2.column[0]&&c2>range2.column[1]&&r2>=range2.row[0]&&r2<=range2.row[1]){if(type==="allPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[0],r2],column:[c1,range2.column[0]-1]},{row:[range2.row[0],r2],column:[range2.column[1]+1,c2]},{row:[range2.row[0]+offset_r,r2+offset_r],column:[range2.column[0]+offset_c,range2.column[1]+offset_c]}];}else if(type==="restPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[0],r2],column:[c1,range2.column[0]-1]},{row:[range2.row[0],r2],column:[range2.column[1]+1,c2]}];}else if(type==="operatePart"){range=[{row:[range2.row[0]+offset_r,r2+offset_r],column:[range2.column[0]+offset_c,range2.column[1]+offset_c]}];}}else if(r1<range2.row[0]&&r2>range2.row[1]&&c1<range2.column[0]&&c2>range2.column[1]){if(type==="allPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[0],range2.row[1]],column:[c1,range2.column[0]-1]},{row:[range2.row[0],range2.row[1]],column:[range2.column[1]+1,c2]},{row:[range2.row[1]+1,r2],column:[c1,c2]},{row:[range2.row[0]+offset_r,range2.row[1]+offset_r],column:[range2.column[0]+offset_c,range2.column[1]+offset_c]}];}else if(type==="restPart"){range=[{row:[r1,range2.row[0]-1],column:[c1,c2]},{row:[range2.row[0],range2.row[1]],column:[c1,range2.column[0]-1]},{row:[range2.row[0],range2.row[1]],column:[range2.column[1]+1,c2]},{row:[range2.row[1]+1,r2],column:[c1,c2]}];}else if(type==="operatePart"){range=[{row:[range2.row[0]+offset_r,range2.row[1]+offset_r],column:[range2.column[0]+offset_c,range2.column[1]+offset_c]}];}}else {if(type==="allPart"){range=[{row:[r1,r2],column:[c1,c2]}];}else if(type==="restPart"){range=[{row:[r1,r2],column:[c1,c2]}];}else if(type==="operatePart"){range=[];}}return range;}function getDropdownList(ctx,txt){var list=[];if(iscelldata(txt)){var range=getcellrange(ctx,txt);var index=getSheetIndex(ctx,range.sheetId);var d=ctx.luckysheetfile[index].data;if(!d)return [];for(var r=range.row[0];r<=range.row[1];r+=1){for(var c=range.column[0];c<=range.column[1];c+=1){if(!d[r]){continue;}var cell=d[r][c];if(!cell||!cell.v){continue;}var v=cell.m||cell.v;if(!list.includes(v)){list.push(v);}}}}else {var arr=txt.split(",");for(var i=0;i<arr.length;i+=1){var _v=arr[i];if(_v.length===0){continue;}if(!list.includes(_v)){list.push(_v);}}}return list;}function validateIdCard(ctx,idCard){var regIdCard=/^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;if(regIdCard.test(idCard)){if(idCard.length===18){var idCardWi=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];var idCardY=[1,0,10,9,8,7,6,5,4,3,2];var idCardWiSum=0;for(var i=0;i<17;i+=1){idCardWiSum+=Number(idCard.substring(i,i+1))*idCardWi[i];}var idCardMod=idCardWiSum%11;var idCardLast=idCard.substring(17);if(idCardMod===2){if(idCardLast==="X"||idCardLast==="x"){return true;}return false;}if(idCardLast===idCardY[idCardMod].toString()){return true;}return false;}}else {return false;}return false;}function validateCellData(ctx,item,cellValue){var value1=item.value1,value2=item.value2;var type=item.type,type2=item.type2;if(type==="dropdown"){var list=getDropdownList(ctx,value1);if(type2&&cellValue){return cellValue.toString().split(",").every(function(i){return list.indexOf(i)!==-1;});}var result=false;for(var i=0;i<list.length;i+=1){if(list[i]===cellValue){result=true;break;}}return result;}if(type==="checkbox");else if(type==="number"||type==="number_integer"||type==="number_decimal"){if(!isRealNum(cellValue)){return false;}cellValue=Number(cellValue);if(type==="number_integer"&&cellValue%1!==0){return false;}if(type==="number_decimal"&&cellValue%1===0){return false;}value1=Number(value1);value2=Number(value2);if(type2==="between"&&(cellValue<value1||cellValue>value2)){return false;}if(type2==="notBetween"&&cellValue>=value1&&cellValue<=value2){return false;}if(type2==="equal"&&cellValue!==value1){return false;}if(type2==="notEqualTo"&&cellValue===value1){return false;}if(type2==="moreThanThe"&&cellValue<=value1){return false;}if(type2==="lessThan"&&cellValue>=value1){return false;}if(type2==="greaterOrEqualTo"&&cellValue<value1){return false;}if(type2==="lessThanOrEqualTo"&&cellValue>value1){return false;}}else if(type==="text_content"){cellValue=cellValue.toString();value1=value1.toString();if(type2==="include"&&cellValue.indexOf(value1)===-1){return false;}if(type2==="exclude"&&cellValue.indexOf(value1)>-1){return false;}if(type2==="equal"&&cellValue!==value1){return false;}}else if(type==="text_length"){cellValue=cellValue.toString().length;value1=Number(value1);value2=Number(value2);if(type2==="between"&&(cellValue<value1||cellValue>value2)){return false;}if(type2==="notBetween"&&cellValue>=value1&&cellValue<=value2){return false;}if(type2==="equal"&&cellValue!==value1){return false;}if(type2==="notEqualTo"&&cellValue===value1){return false;}if(type2==="moreThanThe"&&cellValue<=value1){return false;}if(type2==="lessThan"&&cellValue>=value1){return false;}if(type2==="greaterOrEqualTo"&&cellValue<value1){return false;}if(type2==="lessThanOrEqualTo"&&cellValue>value1){return false;}}else if(type==="date"){if(!isdatetime(cellValue)){return false;}if(type2==="between"&&(diff(cellValue,value1)<0||diff(cellValue,value2)>0)){return false;}if(type2==="notBetween"&&diff(cellValue,value1)>=0&&diff(cellValue,value2)<=0){return false;}if(type2==="equal"&&diff(cellValue,value1)!==0){return false;}if(type2==="notEqualTo"&&diff(cellValue,value1)===0){return false;}if(type2==="earlierThan"&&diff(cellValue,value1)>=0){return false;}if(type2==="noEarlierThan"&&diff(cellValue,value1)<0){return false;}if(type2==="laterThan"&&diff(cellValue,value1)<=0){return false;}if(type2==="noLaterThan"&&diff(cellValue,value1)>0){return false;}}else if(type==="validity"){if(type2==="identificationNumber"&&!validateIdCard(ctx,cellValue)){return false;}if(type2==="phoneNumber"&&!/^1[3456789]\d{9}$/.test(cellValue)){return false;}}return true;}function checkboxChange(ctx,r,c){var _ctx$luckysheetfile$i;var index=getSheetIndex(ctx,ctx.currentSheetId);var currentDataVerification=(_ctx$luckysheetfile$i=ctx.luckysheetfile[index].dataVerification)!==null&&_ctx$luckysheetfile$i!==void 0?_ctx$luckysheetfile$i:{};var item=currentDataVerification["".concat(r,"_").concat(c)];item.checked=!item.checked;var value=item.value2;if(item.checked){value=item.value1;}var d=getFlowdata(ctx);setCellValue(ctx,r,c,d,value);}function getFailureText(ctx,item){var failureText="";var lang=ctx.lang;var type=item.type,type2=item.type2,value1=item.value1,value2=item.value2;if(lang==="en"){var _ctx$dataVerification;var optionLabel_en=(_ctx$dataVerification=ctx.dataVerification)===null||_ctx$dataVerification===void 0?void 0:_ctx$dataVerification.optionLabel_en;if(type==="dropdown"){failureText+="what you selected is not an option in the drop-down list";}else if(type==="checkbox");else if(type==="number"||type==="number_integer"||type==="number_decimal"){failureText+="what you entered is not a ".concat(optionLabel_en[item.type]," ").concat(optionLabel_en[item.type2]," ").concat(item.value1);if(item.type2==="between"||item.type2==="notBetween"){failureText+=" and ".concat(item.value2);}}else if(type==="text_content"){failureText+="what you entered is not text that ".concat(optionLabel_en[item.type2]," ").concat(item.value1);}else if(type==="text_length"){failureText+="the text you entered is not length ".concat(optionLabel_en[item.type2]," ").concat(item.value1);if(item.type2==="between"||item.type2==="notBetween"){failureText+=" and ".concat(item.value2);}}else if(type==="date"){failureText+="the date you entered is not ".concat(optionLabel_en[item.type2]," ").concat(item.value1);if(type2==="between"||type2==="notBetween"){failureText+=" and ".concat(item.value2);}}else if(type==="validity"){failureText+="what you entered is not a correct ".concat(optionLabel_en[item.type2]);}}else if(lang==="zh"||lang==="zh-CN"){var _ctx$dataVerification2;var optionLabel_zh=(_ctx$dataVerification2=ctx.dataVerification)===null||_ctx$dataVerification2===void 0?void 0:_ctx$dataVerification2.optionLabel_zh;if(type==="dropdown"){failureText+="你选择的不是下拉列表中的选项";}else if(type==="checkbox");else if(type==="number"||type==="number_integer"||type==="number_decimal"){failureText+="\u4F60\u8F93\u5165\u7684\u4E0D\u662F".concat(optionLabel_zh[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){failureText+="\u548C".concat(value2,"\u4E4B\u95F4");}failureText+="\u7684".concat(optionLabel_zh[type]);}else if(type==="text_content"){failureText+="\u4F60\u8F93\u5165\u7684\u4E0D\u662F\u5185\u5BB9".concat(optionLabel_zh[type2]).concat(value1,"\u7684\u6587\u672C");}else if(type==="text_length"){failureText+="\u4F60\u8F93\u5165\u7684\u4E0D\u662F\u957F\u5EA6".concat(optionLabel_zh[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){failureText+="\u548C".concat(value2,"\u4E4B\u95F4");}failureText+="的文本";}else if(type==="date"){failureText+="\u4F60\u8F93\u5165\u7684\u4E0D\u662F".concat(optionLabel_zh[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){failureText+="\u548C".concat(value2,"\u4E4B\u95F4");}failureText+="的日期";}else if(type==="validity"){failureText+="\u4F60\u8F93\u5165\u7684\u4E0D\u662F\u4E00\u4E2A\u6B63\u786E\u7684".concat(optionLabel_zh[type2]);}}else if(lang==="zh-TW"){var _ctx$dataVerification3;var optionLabel_zh_tw=(_ctx$dataVerification3=ctx.dataVerification)===null||_ctx$dataVerification3===void 0?void 0:_ctx$dataVerification3.optionLabel_zh_tw;if(type==="dropdown"){failureText+="你選擇的不是下拉清單中的選項";}else if(type==="checkbox");else if(type==="number"||type==="number_integer"||type==="number_decimal"){failureText+="\u4F60\u8F38\u5165\u7684\u4E0D\u662F".concat(optionLabel_zh_tw[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){failureText+="\u548C".concat(value2,"\u4E4B\u9593");}failureText+="\u7684".concat(optionLabel_zh_tw[type]);}else if(type==="text_content"){failureText+="\u4F60\u8F38\u5165\u7684\u4E0D\u662F\u5167\u5BB9".concat(optionLabel_zh_tw[type2]).concat(value1,"\u7684\u6587\u672C");}else if(type==="text_length"){failureText+="\u4F60\u8F38\u5165\u7684\u4E0D\u662F\u9577\u5EA6".concat(optionLabel_zh_tw[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){failureText+="\u548C".concat(value2,"\u4E4B\u95F4");}failureText+="的文本";}else if(type==="date"){failureText+="\u4F60\u8F38\u5165\u7684\u4E0D\u662F".concat(optionLabel_zh_tw[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){failureText+="\u548C".concat(value2,"\u4E4B\u95F4");}failureText+="的日期";}else if(type==="validity"){failureText+="\u4F60\u8F38\u5165\u7684\u4E0D\u662F\u4E00\u500B\u6B63\u78BA\u7684".concat(optionLabel_zh_tw[type2]);}}else if(lang==="es"){var _ctx$dataVerification4;var optionLabel_es=(_ctx$dataVerification4=ctx.dataVerification)===null||_ctx$dataVerification4===void 0?void 0:_ctx$dataVerification4.optionLabel_es;if(type==="dropdown"){failureText+="No elegiste una opción en la lista desplegable";}else if(type==="checkbox");else if(type==="number"||type==="number_integer"||type==="number_decimal"){failureText+="Lo que introduciste no es".concat(optionLabel_es[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){failureText+="Y".concat(value2,"Entre");}failureText+="De".concat(optionLabel_es[type]);}else if(type==="text_content"){failureText+="Lo que introduciste no fue contenido".concat(optionLabel_es[type2]).concat(value1,"Texto");}else if(type==="text_length"){failureText+="No introduciste la longitud".concat(optionLabel_es[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){failureText+="Y".concat(value2,"Entre");}failureText+="Texto";}else if(type==="date"){failureText+="Lo que introduciste no es".concat(optionLabel_es[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){failureText+="Y".concat(value2,"Entre");}failureText+="Fecha";}else if(type==="validity"){failureText+="Lo que ingresas no es correcto".concat(optionLabel_es[type2]);}}return failureText;}function getHintText(ctx,item){var hintValue=item.hintValue||"";var type=item.type,type2=item.type2,value1=item.value1,value2=item.value2;var lang=ctx.lang;if(!hintValue){if(lang==="en"){var _ctx$dataVerification5;var optionLabel_en=(_ctx$dataVerification5=ctx.dataVerification)===null||_ctx$dataVerification5===void 0?void 0:_ctx$dataVerification5.optionLabel_en;if(type==="dropdown"){hintValue+="please select an option in the drop-down list";}else if(type==="checkbox");else if(type==="number"||type==="number_integer"||type==="number_decimal"){hintValue+="please enter a ".concat(optionLabel_en[type]," ").concat(optionLabel_en[type2]," ").concat(item.value1);if(type2==="between"||type2==="notBetween"){hintValue+=" and ".concat(value2);}}else if(type==="text_content"){hintValue+="please enter text ".concat(optionLabel_en[type2]," ").concat(value1);}else if(type==="date"){hintValue+="please enter a date ".concat(optionLabel_en[type2]," ").concat(value1);if(type2==="between"||type2==="notBetween"){hintValue+=" and ".concat(value2);}}else if(type==="validity"){hintValue+="please enter the correct ".concat(optionLabel_en[type2]);}}else if(lang==="zh"||lang==="zh-CN"){var _ctx$dataVerification6;var optionLabel_zh=(_ctx$dataVerification6=ctx.dataVerification)===null||_ctx$dataVerification6===void 0?void 0:_ctx$dataVerification6.optionLabel_zh;if(type==="dropdown"){hintValue+="请选择下拉列表中的选项";}else if(type==="checkbox");else if(type==="number"||type==="number_integer"||type==="number_decimal"){hintValue+="\u8BF7\u8F93\u5165".concat(optionLabel_zh[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){hintValue+="\u548C".concat(value2,"\u4E4B\u95F4");}hintValue+="\u7684".concat(optionLabel_zh[type]);}else if(type==="text_content"){hintValue+="\u8BF7\u8F93\u5165\u5185\u5BB9".concat(optionLabel_zh[type2]).concat(value1,"\u7684\u6587\u672C");}else if(type==="text_length"){hintValue+="\u8BF7\u8F93\u5165\u957F\u5EA6".concat(optionLabel_zh[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){hintValue+="\u548C".concat(value2,"\u4E4B\u95F4");}hintValue+="的文本";}else if(type==="date"){hintValue+="\u8BF7\u8F93\u5165".concat(optionLabel_zh[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){hintValue+="\u548C".concat(value2,"\u4E4B\u95F4");}hintValue+="的日期";}else if(type==="validity"){hintValue+="\u8BF7\u8F93\u5165\u6B63\u786E\u7684".concat(optionLabel_zh[type2]);}}else if(lang==="zh-TW"){var _ctx$dataVerification7;var optionLabel_zh_tw=(_ctx$dataVerification7=ctx.dataVerification)===null||_ctx$dataVerification7===void 0?void 0:_ctx$dataVerification7.optionLabel_zh_tw;if(type==="dropdown"){hintValue+="請選擇下拉清單中的選項";}else if(type==="checkbox");else if(type==="number"||type==="number_integer"||type==="number_decimal"){hintValue+="\u8ACB\u8F38\u5165".concat(optionLabel_zh_tw[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){hintValue+="\u548C".concat(value2,"\u4E4B\u9593");}hintValue+="\u7684".concat(optionLabel_zh_tw[type]);}else if(type==="text_content"){hintValue+="\u8ACB\u8F38\u5165\u5167\u5BB9".concat(optionLabel_zh_tw[type2]).concat(value1,"\u7684\u6587\u672C");}else if(type==="text_length"){hintValue+="\u8ACB\u8F38\u5165\u9577\u5EA6".concat(optionLabel_zh_tw[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){hintValue+="\u548C".concat(value2,"\u4E4B\u9593");}hintValue+="的文本";}else if(type==="date"){hintValue+="\u8ACB\u8F38\u5165".concat(optionLabel_zh_tw[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){hintValue+="\u548C".concat(value2,"\u4E4B\u9593");}hintValue+="的日期";}else if(type==="validity"){hintValue+="\u8ACB\u8F38\u5165\u6B63\u78BA\u7684".concat(optionLabel_zh_tw[type2]);}}else if(lang==="es"){var _ctx$dataVerification8;var optionLabel_es=(_ctx$dataVerification8=ctx.dataVerification)===null||_ctx$dataVerification8===void 0?void 0:_ctx$dataVerification8.optionLabel_es;if(type==="dropdown"){hintValue+="Por favor, elija una opción en la lista desplegable";}else if(type==="checkbox");else if(type==="number"||type==="number_integer"||type==="number_decimal"){hintValue+="Por favor, introduzca".concat(optionLabel_es[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){hintValue+="Y".concat(value2,"Entre");}hintValue+="De".concat(optionLabel_es[type]);}else if(type==="text_content"){hintValue+="Por favor, introduzca el contenido".concat(optionLabel_es[type2]).concat(value1,"Texto");}else if(type==="text_length"){hintValue+="Por favor, introduzca la longitud".concat(optionLabel_es[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){hintValue+="Y".concat(value2,"Entre");}hintValue+="Texto";}else if(type==="date"){hintValue+="Por favor, introduzca".concat(optionLabel_es[type2]).concat(value1);if(type2==="between"||type2==="notBetween"){hintValue+="Y".concat(value2,"Entre");}hintValue+="Fecha";}else if(type==="validity"){hintValue+="Por favor, introduzca lo correcto.".concat(optionLabel_es[type2]);}}}return hintValue;}function cellFocus(ctx,r,c,clickMode){var allowEdit=isAllowEdit(ctx);if(!allowEdit)return;var showHintBox=document.getElementById("luckysheet-dataVerification-showHintBox");var dropDownBtn=document.getElementById("luckysheet-dataVerification-dropdown-btn");ctx.dataVerificationDropDownList=false;if(!showHintBox||!dropDownBtn)return;showHintBox.style.display="none";dropDownBtn.style.display="none";var index=getSheetIndex(ctx,ctx.currentSheetId);var dataVerification=ctx.luckysheetfile[index].dataVerification;ctx.dataVerificationDropDownList=false;if(!dataVerification)return;var row=ctx.visibledatarow[r];var row_pre=r===0?0:ctx.visibledatarow[r-1];var col=ctx.visibledatacolumn[c];var col_pre=c===0?0:ctx.visibledatacolumn[c-1];var d=getFlowdata(ctx);if(!d)return;var margeSet=mergeBorder(ctx,d,r,c);if(margeSet){var _margeSet$row=_slicedToArray$3(margeSet.row,2);row_pre=_margeSet$row[0];row=_margeSet$row[1];var _margeSet$column=_slicedToArray$3(margeSet.column,2);col_pre=_margeSet$column[0];col=_margeSet$column[1];}var item=dataVerification["".concat(r,"_").concat(c)];if(!item)return;if(clickMode&&item.type==="checkbox"){checkboxChange(ctx,r,c);}if(item.type==="dropdown"){dropDownBtn.style.display="block";dropDownBtn.style.maxWidth="".concat(col-col_pre,"px");dropDownBtn.style.maxHeight="".concat(row-row_pre,"px");dropDownBtn.style.left="".concat(col-20,"px");dropDownBtn.style.top="".concat(row_pre+(row-row_pre-20)/2-2,"px");}if(item.hintShow){var hintText="";var lang=ctx.lang;if(lang==="en"){hintText='<span style="color:#f5a623;">Hint: </span>';}else if(lang==="zh"||lang==="zh-CN"){hintText='<span style="color:#f5a623;">提示:</span>';}else if(lang==="zh-TW"){hintText='<span style="color:#f5a623;">提示:</span>';}else if(lang==="es"){hintText='<span style="color:#f5a623;">Consejos:</span>';}hintText+=getHintText(ctx,item);showHintBox.innerHTML=hintText;showHintBox.style.display="block";showHintBox.style.left="".concat(col_pre,"px");showHintBox.style.top="".concat(row,"px");}var cellValue=getCellValue(r,c,d);if(isRealNull(cellValue)){return;}var validate=validateCellData(ctx,item,cellValue);if(!validate){var failureText="";var _lang=ctx.lang;if(_lang==="en"){failureText='<span style="color:#f72626;">Failure: </span>';}else if(_lang==="zh"||_lang==="zh-CN"){failureText='<span style="color:#f72626;">失效:</span>';}else if(_lang==="zh-TW"){failureText='<span style="color:#f72626;">失效:</span>';}else if(_lang==="es"){failureText='<span style="color:#f72626;">Caducidad: </span>';}failureText+=getFailureText(ctx,item);showHintBox.innerHTML=failureText;showHintBox.style.display="block";showHintBox.style.left="".concat(col_pre,"px");showHintBox.style.top="".concat(row,"px");}}function setDropcownValue(ctx,value,arr){if(!ctx.luckysheet_select_save)return;var d=getFlowdata(ctx);if(!d)return;var last=ctx.luckysheet_select_save[ctx.luckysheet_select_save.length-1];var rowIndex=last.row_focus;var colIndex=last.column_focus;if(rowIndex==null||colIndex==null)return;var index=getSheetIndex(ctx,ctx.currentSheetId);var item=ctx.luckysheetfile[index].dataVerification["".concat(rowIndex,"_").concat(colIndex)];if(item.type2==="true"){value=item.value1.split(",").filter(function(v){return arr.indexOf(v)>=0;}).join(",");}else {ctx.dataVerificationDropDownList=false;}setCellValue(ctx,rowIndex,colIndex,d,value);}function confirmMessage(ctx,generalDialog,dataVerification){var _ctx$dataVerification9,_ctx$dataVerification10;var range=getRangeByTxt(ctx,(_ctx$dataVerification9=ctx.dataVerification)===null||_ctx$dataVerification9===void 0?void 0:(_ctx$dataVerification10=_ctx$dataVerification9.dataRegulation)===null||_ctx$dataVerification10===void 0?void 0:_ctx$dataVerification10.rangeTxt);if(range.length===0){ctx.warnDialog=generalDialog.noSeletionError;return false;}var str=range[range.length-1].row[0];var edr=range[range.length-1].row[1];var stc=range[range.length-1].column[0];var edc=range[range.length-1].column[1];var d=getFlowdata(ctx);if(!d)return false;if(str<0){str=0;}if(edr>d.length-1){edr=d.length-1;}if(stc<0){stc=0;}if(edc>d[0].length-1){edc=d[0].length-1;}var regulation=ctx.dataVerification.dataRegulation;var verifacationT=regulation===null||regulation===void 0?void 0:regulation.type;var value1=regulation.value1,value2=regulation.value2,type2=regulation.type2;var v1=parseFloat(value1).toString()!=="NaN";var v2=parseFloat(value2).toString()!=="NaN";if(verifacationT==="dropdown"){if(!value1){ctx.warnDialog=dataVerification.tooltipInfo1;}}else if(verifacationT==="checkbox"){if(!value1||!value2){ctx.warnDialog=dataVerification.tooltipInfo2;}}else if(verifacationT==="number"||verifacationT==="number_integer"||verifacationT==="number_decimal"){if(!v1){ctx.warnDialog=dataVerification.tooltipInfo3;return false;}if(type2==="between"||type2==="notBetween"){if(!v2){ctx.warnDialog=dataVerification.tooltipInfo3;return false;}if(Number(value2)<Number(value1)){ctx.warnDialog=dataVerification.tooltipInfo4;return false;}}}else if(verifacationT==="text_content"){if(!value1){ctx.warnDialog=dataVerification.tooltipInfo5;return false;}}else if(verifacationT==="text_length"){if(!v1){ctx.warnDialog=dataVerification.tooltipInfo3;return false;}if(!Number.isInteger(Number(value1))||Number(value1)<0){ctx.warnDialog=dataVerification.textlengthInteger;return false;}if(type2==="between"||type2==="notBetween"){if(!v2){ctx.warnDialog=dataVerification.tooltipInfo3;return false;}if(!Number.isInteger(Number(value2))||Number(value2)<0){ctx.warnDialog=dataVerification.textlengthInteger;return false;}if(Number(value2)<Number(value1)){ctx.warnDialog=dataVerification.tooltipInfo4;return false;}}}else if(verifacationT==="date"){if(!isdatetime(value1)){ctx.warnDialog=dataVerification.tooltipInfo6;return false;}if(type2==="between"||type2==="notBetween"){if(!isdatetime(value2)){ctx.warnDialog=dataVerification.tooltipInfo6;return false;}if(diff(value1,value2)>0){ctx.warnDialog=dataVerification.tooltipInfo7;return false;}}}return true;}function normalizedCellAttr(cell,attr){var defaultFontSize=arguments.length>2&&arguments[2]!==undefined?arguments[2]:10;var tf={bl:1,it:1,ff:1,cl:1,un:1};var value=cell===null||cell===void 0?void 0:cell[attr];if(attr in tf||attr==="fs"&&isInlineStringCell(cell)){value||(value="0");}else if(["fc","bg","bc"].includes(attr)){var _value;if(["fc","bc"].includes(attr)){value||(value="#000000");}if(((_value=value)===null||_value===void 0?void 0:_value.indexOf("rgba"))>-1){value=rgbToHex(value);}}else if(attr.substring(0,2)==="bs"){value||(value="none");}else if(attr==="ht"||attr==="vt"){var defaultValue=attr==="ht"?"1":"0";value=!lodash.isNil(value)?value.toString():defaultValue;if(["0","1","2"].indexOf(value.toString())===-1){value=defaultValue;}}else if(attr==="fs"){value||(value=defaultFontSize.toString());}else if(attr==="tb"||attr==="tr"){value||(value="0");}return value;}function normalizedAttr(data,r,c,attr){if(!data||!data[r]){console.warn("cell (%d, %d) is null",r,c);return null;}var cell=data[r][c];if(!cell)return undefined;return normalizedCellAttr(cell,attr);}function getCellValue(r,c,data,attr){if(!attr){attr="v";}var d_value;if(!lodash.isNil(r)&&!lodash.isNil(c)){d_value=data[r][c];}else if(!lodash.isNil(r)){d_value=data[r];}else if(!lodash.isNil(c)){var newData=data[0].map(function(col,i){return data.map(function(row){return row[i];});});d_value=newData[c];}else {return data;}var retv=d_value;if(lodash.isPlainObject(d_value)){var d=d_value;retv=d[attr];if(attr==="f"&&!lodash.isNil(retv)){retv=functionHTMLGenerate(retv);}else if(attr==="f"){retv=d.v;}else if(d&&d.ct&&d.ct.t==="d"){retv=d.m;}}if(retv===undefined){retv=null;}return retv;}function setCellValue(ctx,r,c,d,v){var _cell$ct,_cell$ct2,_cell$ct3,_cell$ct4,_cell$ct5,_cell$ct6;if(lodash.isNil(d)){d=getFlowdata(ctx);}if(!d)return;var cell=d[r][c];var vupdate;if(lodash.isPlainObject(v)){if(lodash.isNil(cell)){cell=v;}else {if(!lodash.isNil(v.f)){cell.f=v.f;}else if("f"in cell){delete cell.f;}if(!lodash.isNil(v.ct)){cell.ct=v.ct;}}if(lodash.isPlainObject(v.v)){vupdate=v.v.v;}else {vupdate=v.v;}}else {vupdate=v;}if(isRealNull(vupdate)){if(lodash.isPlainObject(cell)){delete cell.m;delete cell.v;}else {cell=null;}d[r][c]=cell;return;}if(isRealNull(cell)||(lodash.isString(cell)||lodash.isNumber(cell))&&cell===v){cell={};}if(!cell)return;var vupdateStr=vupdate.toString();if(vupdateStr.substr(0,1)==="'"){cell.m=vupdateStr.substr(1);cell.ct={fa:"@",t:"s"};cell.v=vupdateStr.substr(1);cell.qp=1;}else if(cell.qp===1){cell.m=vupdateStr;cell.ct={fa:"@",t:"s"};cell.v=vupdateStr;}else if(vupdateStr.toUpperCase()==="TRUE"&&(lodash.isNil((_cell$ct=cell.ct)===null||_cell$ct===void 0?void 0:_cell$ct.fa)||((_cell$ct2=cell.ct)===null||_cell$ct2===void 0?void 0:_cell$ct2.fa)!=="@")){cell.m="TRUE";cell.ct={fa:"General",t:"b"};cell.v=true;}else if(vupdateStr.toUpperCase()==="FALSE"&&(lodash.isNil((_cell$ct3=cell.ct)===null||_cell$ct3===void 0?void 0:_cell$ct3.fa)||((_cell$ct4=cell.ct)===null||_cell$ct4===void 0?void 0:_cell$ct4.fa)!=="@")){cell.m="FALSE";cell.ct={fa:"General",t:"b"};cell.v=false;}else if(vupdateStr.substr(-1)==="%"&&isRealNum(vupdateStr.substring(0,vupdateStr.length-1))&&(lodash.isNil((_cell$ct5=cell.ct)===null||_cell$ct5===void 0?void 0:_cell$ct5.fa)||((_cell$ct6=cell.ct)===null||_cell$ct6===void 0?void 0:_cell$ct6.fa)!=="@")){cell.ct={fa:"0%",t:"n"};cell.v=vupdateStr.substring(0,vupdateStr.length-1)/100;cell.m=vupdate;}else if(valueIsError(vupdate)){cell.m=vupdateStr;if(!lodash.isNil(cell.ct)){cell.ct.t="e";}else {cell.ct={fa:"General",t:"e"};}cell.v=vupdate;}else {if(!lodash.isNil(cell.f)&&isRealNum(vupdate)&&!/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(vupdate)){cell.v=parseFloat(vupdate);if(lodash.isNil(cell.ct)){cell.ct={fa:"General",t:"n"};}if(cell.v===Infinity||cell.v===-Infinity){cell.m=cell.v.toString();}else {if(cell.v.toString().indexOf("e")>-1){var len;if(cell.v.toString().split(".").length===1){len=0;}else {len=cell.v.toString().split(".")[1].split("e")[0].length;}if(len>5){len=5;}cell.m=cell.v.toExponential(len).toString();}else {var v_p=Math.round(cell.v*1000000000)/1000000000;if(lodash.isNil(cell.ct)){var mask=genarate(v_p);if(mask!=null){cell.m=mask[0].toString();}}else {var _mask=update(cell.ct.fa,v_p);cell.m=_mask.toString();}}}}else if(!lodash.isNil(cell.ct)&&cell.ct.fa==="@"){cell.m=vupdateStr;cell.v=vupdate;}else if(cell.ct!=null&&cell.ct.t==="d"&&lodash.isString(vupdate)){var _mask2=genarate(vupdate);if(_mask2[1].t!=="d"||_mask2[1].fa===cell.ct.fa){var _mask3=_slicedToArray$3(_mask2,3);cell.m=_mask3[0];cell.ct=_mask3[1];cell.v=_mask3[2];}else {var _mask4=_slicedToArray$3(_mask2,3);cell.v=_mask4[2];cell.m=update(cell.ct.fa,cell.v);}}else if(!lodash.isNil(cell.ct)&&!lodash.isNil(cell.ct.fa)&&cell.ct.fa!=="General"){if(isRealNum(vupdate)){vupdate=parseFloat(vupdate);}var _mask5=update(cell.ct.fa,vupdate);if(_mask5===vupdate){_mask5=genarate(vupdate);cell.m=_mask5[0].toString();var _mask6=_mask5;var _mask7=_slicedToArray$3(_mask6,3);cell.ct=_mask7[1];cell.v=_mask7[2];}else {cell.m=_mask5.toString();cell.v=vupdate;}}else {if(isRealNum(vupdate)&&!/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(vupdate)){if(typeof vupdate==="string"){var flag=vupdate.split("").every(function(ele){return ele==="0"||ele===".";});if(flag){vupdate=parseFloat(vupdate);}}cell.v=vupdate;cell.ct={fa:"General",t:"n"};if(cell.v===Infinity||cell.v===-Infinity){cell.m=cell.v.toString();}else if(cell.v!=null){var _mask8=genarate(cell.v);if(_mask8){cell.m=_mask8[0].toString();}}}else {var _mask9=genarate(vupdate);if(_mask9){cell.m=_mask9[0].toString();var _mask10=_slicedToArray$3(_mask9,3);cell.ct=_mask10[1];cell.v=_mask10[2];}}}}d[r][c]=cell;}function getRealCellValue(r,c,data,attr){var value=getCellValue(r,c,data,"m");if(lodash.isNil(value)){value=getCellValue(r,c,data,attr);if(lodash.isNil(value)){var ct=getCellValue(r,c,data,"ct");if(isInlineStringCT(ct)){value=ct.s;}}}return value;}function mergeBorder(ctx,d,row_index,col_index){if(!d||!d[row_index]){console.warn("Merge info is null",row_index,col_index);return null;}var value=d[row_index][col_index];if(!value)return null;if(value===null||value===void 0?void 0:value.mc){var _d$row_index,_d$row_index2,_d$row_index2$col_ind,_d$row_index2$col_ind2,_d$row_index3,_d$row_index3$col_ind,_d$row_index3$col_ind2,_d$row_index4,_d$row_index4$col_ind;var margeMaindata=value.mc;if(!margeMaindata){console.warn("Merge info is null",row_index,col_index);return null;}col_index=margeMaindata.c;row_index=margeMaindata.r;if(lodash.isNil(d===null||d===void 0?void 0:(_d$row_index=d[row_index])===null||_d$row_index===void 0?void 0:_d$row_index[col_index])){console.warn("Main merge Cell info is null",row_index,col_index);return null;}var col_rs=(_d$row_index2=d[row_index])===null||_d$row_index2===void 0?void 0:(_d$row_index2$col_ind=_d$row_index2[col_index])===null||_d$row_index2$col_ind===void 0?void 0:(_d$row_index2$col_ind2=_d$row_index2$col_ind.mc)===null||_d$row_index2$col_ind2===void 0?void 0:_d$row_index2$col_ind2.cs;var row_rs=(_d$row_index3=d[row_index])===null||_d$row_index3===void 0?void 0:(_d$row_index3$col_ind=_d$row_index3[col_index])===null||_d$row_index3$col_ind===void 0?void 0:(_d$row_index3$col_ind2=_d$row_index3$col_ind.mc)===null||_d$row_index3$col_ind2===void 0?void 0:_d$row_index3$col_ind2.rs;var mergeMain=(_d$row_index4=d[row_index])===null||_d$row_index4===void 0?void 0:(_d$row_index4$col_ind=_d$row_index4[col_index])===null||_d$row_index4$col_ind===void 0?void 0:_d$row_index4$col_ind.mc;if(!mergeMain||lodash.isNil(mergeMain===null||mergeMain===void 0?void 0:mergeMain.rs)||lodash.isNil(mergeMain===null||mergeMain===void 0?void 0:mergeMain.cs)||lodash.isNil(col_rs)||lodash.isNil(row_rs)){console.warn("Main merge info is null",mergeMain);return null;}var start_r;var end_r;var row;var row_pre;for(var r=row_index;r<mergeMain.rs+row_index;r+=1){if(r===0){start_r=-1;}else {start_r=ctx.visibledatarow[r-1]-1;}end_r=ctx.visibledatarow[r];if(row_pre===undefined){row_pre=start_r;row=end_r;}else if(row!==undefined){row+=end_r-start_r-1;}}var start_c;var end_c;var col;var col_pre;for(var c=col_index;c<mergeMain.cs+col_index;c+=1){if(c===0){start_c=0;}else {start_c=ctx.visibledatacolumn[c-1];}end_c=ctx.visibledatacolumn[c];if(col_pre===undefined){col_pre=start_c;col=end_c;}else if(col!==undefined){col+=end_c-start_c;}}if(lodash.isNil(row_pre)||lodash.isNil(col_pre)||lodash.isNil(row)||lodash.isNil(col)){console.warn("Main merge info row_pre or col_pre or row or col is null",mergeMain);return null;}return {row:[row_pre,row,row_index,row_index+row_rs-1],column:[col_pre,col,col_index,col_index+col_rs-1]};}return null;}function mergeMove(ctx,mc,columnseleted,rowseleted,s,top,height,left,width){var row_st=mc.r;var row_ed=mc.r+mc.rs-1;var col_st=mc.c;var col_ed=mc.c+mc.cs-1;var ismatch=false;columnseleted[0]=Math.min(columnseleted[0],columnseleted[1]);rowseleted[0]=Math.min(rowseleted[0],rowseleted[1]);if(columnseleted[0]<=col_st&&columnseleted[1]>=col_ed&&rowseleted[0]<=row_st&&rowseleted[1]>=row_ed||!(columnseleted[1]<col_st||columnseleted[0]>col_ed)&&!(rowseleted[1]<row_st||rowseleted[0]>row_ed)){var flowdata=getFlowdata(ctx);if(!flowdata)return null;var margeset=mergeBorder(ctx,flowdata,mc.r,mc.c);if(margeset){var row=margeset.row[1];var row_pre=margeset.row[0];var col=margeset.column[1];var col_pre=margeset.column[0];if(!(columnseleted[1]<col_st||columnseleted[0]>col_ed)){if(rowseleted[0]<=row_ed&&rowseleted[0]>=row_st){height+=top-row_pre;top=row_pre;rowseleted[0]=row_st;}if(rowseleted[1]>=row_st&&rowseleted[1]<=row_ed){if(s.row_focus>=row_st&&s.row_focus<=row_ed){height=row-top;}else {height=row-top;}rowseleted[1]=row_ed;}}if(!(rowseleted[1]<row_st||rowseleted[0]>row_ed)){if(columnseleted[0]<=col_ed&&columnseleted[0]>=col_st){width+=left-col_pre;left=col_pre;columnseleted[0]=col_st;}if(columnseleted[1]>=col_st&&columnseleted[1]<=col_ed){if(s.column_focus>=col_st&&s.column_focus<=col_ed){width=col-left;}else {width=col-left;}columnseleted[1]=col_ed;}}ismatch=true;}}if(ismatch){return [columnseleted,rowseleted,top,height,left,width];}return null;}function mergeMoveMain(ctx,columnseleted,rowseleted,s,top,height,left,width){var mergesetting=ctx.config.merge;if(!mergesetting){return null;}var mcset=Object.keys(mergesetting);rowseleted[1]=Math.max(rowseleted[0],rowseleted[1]);columnseleted[1]=Math.max(columnseleted[0],columnseleted[1]);var offloop=true;var mergeMoveData={};while(offloop){offloop=false;for(var i=0;i<mcset.length;i+=1){var key=mcset[i];var mc=mergesetting[key];if(key in mergeMoveData){continue;}var changeparam=mergeMove(ctx,mc,columnseleted,rowseleted,s,top,height,left,width);if(changeparam!=null){mergeMoveData[key]=mc;var _changeparam=_slicedToArray$3(changeparam,6);columnseleted=_changeparam[0];rowseleted=_changeparam[1];top=_changeparam[2];height=_changeparam[3];left=_changeparam[4];width=_changeparam[5];offloop=true;}else {delete mergeMoveData[key];}}}return [columnseleted,rowseleted,top,height,left,width];}function cancelFunctionrangeSelected(ctx){if(ctx.formulaCache.selectingRangeIndex===-1){ctx.formulaRangeSelect=undefined;}}function cancelNormalSelected(ctx){cancelFunctionrangeSelected(ctx);ctx.luckysheetCellUpdate=[];ctx.formulaRangeHighlight=[];ctx.functionHint=null;ctx.formulaCache.rangestart=false;ctx.formulaCache.rangedrag_column_start=false;ctx.formulaCache.rangedrag_row_start=false;}function updateCell(ctx,r,c,$input,value,canvas){var _inputText,_curv,_ctx$hooks$beforeUpda,_ctx$hooks,_curv2;var inputText=$input===null||$input===void 0?void 0:$input.innerText;var inputHtml=$input===null||$input===void 0?void 0:$input.innerHTML;var flowdata=getFlowdata(ctx);if(!flowdata)return;var index=getSheetIndex(ctx,ctx.currentSheetId);var dataVerification=ctx.luckysheetfile[index].dataVerification;if(!lodash.isNil(dataVerification)){var dvItem=dataVerification["".concat(r,"_").concat(c)];if(!lodash.isNil(dvItem)&&dvItem.prohibitInput&&!validateCellData(ctx,dvItem,inputText)){var failureText=getFailureText(ctx,dvItem);cancelNormalSelected(ctx);ctx.warnDialog=failureText;return;}}var curv=flowdata[r][c];var oldValue=lodash.cloneDeep(curv);var isPrevInline=isInlineStringCell(curv);var isCurInline=((_inputText=inputText)===null||_inputText===void 0?void 0:_inputText.slice(0,1))!=="="&&(inputHtml===null||inputHtml===void 0?void 0:inputHtml.substring(0,5))==="<span";var isCopyVal=false;if(!isCurInline&&inputText&&inputText.length>0){var splitArr=inputText.replace(/\r\n/g,"_x000D_").replace(/ /g,"_x000D_").replace(/\r/g,"_x000D_").replace(/\n/g,"_x000D_").split("_x000D_");if(splitArr.length>1&&inputHtml!=="<br>"){isCopyVal=true;isCurInline=true;inputText=splitArr.join("\r\n");}}if(((_curv=curv)===null||_curv===void 0?void 0:_curv.ct)&&!value&&!isCurInline&&isPrevInline){delete curv.ct.s;curv.ct.t="g";curv.ct.fa="General";value="";}else if(isCurInline){if(!lodash.isPlainObject(curv)){curv={};}curv||(curv={});var fontSize=curv.fs||10;if(!curv.ct){curv.ct={};curv.ct.fa="General";}curv.ct.t="inlineStr";curv.ct.s=convertSpanToShareString($input.querySelectorAll("span"),curv);delete curv.fs;delete curv.f;delete curv.v;delete curv.m;curv.fs=fontSize;if(isCopyVal){curv.ct.s=[{v:inputText,fs:fontSize}];}}value=value||($input===null||$input===void 0?void 0:$input.innerText);if(((_ctx$hooks$beforeUpda=(_ctx$hooks=ctx.hooks).beforeUpdateCell)===null||_ctx$hooks$beforeUpda===void 0?void 0:_ctx$hooks$beforeUpda.call(_ctx$hooks,r,c,value))===false){cancelNormalSelected(ctx);return;}if(!isCurInline){if(isRealNull(value)&&!isPrevInline){if(!curv||isRealNull(curv.v)&&!curv.spl&&!curv.f){cancelNormalSelected(ctx);return;}}else if(curv&&curv.qp!==1){if(lodash.isPlainObject(curv)&&(value===curv.f||value===curv.v||value===curv.m)){cancelNormalSelected(ctx);return;}if(value===curv){cancelNormalSelected(ctx);return;}}if(lodash.isString(value)&&value.slice(0,1)==="="&&value.length>1);else if(lodash.isPlainObject(curv)&&curv&&curv.ct&&curv.ct.fa&&curv.ct.fa!=="@"&&!isRealNull(value)){delete curv.m;if(curv.f){delete curv.f;delete curv.spl;}}}var d=flowdata;var dynamicArrayItem=null;if(lodash.isPlainObject(curv)){if(!isCurInline){if(lodash.isString(value)&&value.slice(0,1)==="="&&value.length>1){var _d$r;var v=execfunction(ctx,value,r,c,undefined,true);curv=lodash.cloneDeep((d===null||d===void 0?void 0:(_d$r=d[r])===null||_d$r===void 0?void 0:_d$r[c])||{});var _v=_slicedToArray$3(v,3);curv.v=_v[1];curv.f=_v[2];if(v.length===4&&v[3].type==="sparklines"){delete curv.m;delete curv.v;var curCalv=v[3].data;if(lodash.isArray(curCalv)&&!lodash.isPlainObject(curCalv[0])){var _curCalv=_slicedToArray$3(curCalv,1);curv.v=_curCalv[0];}else {curv.spl=v[3].data;}}else if(v.length===4&&v[3].type==="dynamicArrayItem"){dynamicArrayItem=v[3].data;}}else if(lodash.isPlainObject(value)){var valueFunction=value.f;if(lodash.isString(valueFunction)&&valueFunction.slice(0,1)==="="&&valueFunction.length>1){var _d$r2;var _v2=execfunction(ctx,valueFunction,r,c,undefined,true);curv=lodash.cloneDeep((d===null||d===void 0?void 0:(_d$r2=d[r])===null||_d$r2===void 0?void 0:_d$r2[c])||{});var _v3=_slicedToArray$3(_v2,3);curv.v=_v3[1];curv.f=_v3[2];if(_v2.length===4&&_v2[3].type==="sparklines"){delete curv.m;delete curv.v;var _curCalv2=_v2[3].data;if(lodash.isArray(_curCalv2)&&!lodash.isPlainObject(_curCalv2[0])){var _curCalv3=_slicedToArray$3(_curCalv2,1);curv.v=_curCalv3[0];}else {curv.spl=_v2[3].data;}}else if(_v2.length===4&&_v2[3].type==="dynamicArrayItem"){dynamicArrayItem=_v2[3].data;}}else {Object.keys(value).forEach(function(attr){curv[attr]=value[attr];});}}else {var _d$r3;delFunctionGroup(ctx,r,c);execFunctionGroup(ctx,r,c,value);curv=lodash.cloneDeep((d===null||d===void 0?void 0:(_d$r3=d[r])===null||_d$r3===void 0?void 0:_d$r3[c])||{});curv.v=value;delete curv.f;delete curv.spl;if(curv.qp===1&&"".concat(value).substring(0,1)!=="'"){curv.qp=0;if(curv.ct){curv.ct.fa="General";curv.ct.t="n";}}}}value=curv;}else {if(lodash.isString(value)&&value.slice(0,1)==="="&&value.length>1){var _v4=execfunction(ctx,value,r,c,undefined,true);value={v:_v4[1],f:_v4[2]};if(_v4.length===4&&_v4[3].type==="sparklines"){var _curCalv4=_v4[3].data;if(lodash.isArray(_curCalv4)&&!lodash.isPlainObject(_curCalv4[0])){var _curCalv5=_slicedToArray$3(_curCalv4,1);value.v=_curCalv5[0];}else {value.spl=_v4[3].data;}}else if(_v4.length===4&&_v4[3].type==="dynamicArrayItem"){dynamicArrayItem=_v4[3].data;}}else if(lodash.isPlainObject(value)){var _valueFunction=value.f;if(lodash.isString(_valueFunction)&&_valueFunction.slice(0,1)==="="&&_valueFunction.length>1){var _v5=execfunction(ctx,_valueFunction,r,c,undefined,true);var _v6=_slicedToArray$3(_v5,3);value.v=_v6[1];value.f=_v6[2];if(_v5.length===4&&_v5[3].type==="sparklines"){var _curCalv6=_v5[3].data;if(lodash.isArray(_curCalv6)&&!lodash.isPlainObject(_curCalv6[0])){var _curCalv7=_slicedToArray$3(_curCalv6,1);value.v=_curCalv7[0];}else {value.spl=_v5[3].data;}}else if(_v5.length===4&&_v5[3].type==="dynamicArrayItem"){dynamicArrayItem=_v5[3].data;}}else {var _v7=curv;if(lodash.isNil(value.v)){value.v=_v7;}}}else {delFunctionGroup(ctx,r,c);execFunctionGroup(ctx,r,c,value);}}setCellValue(ctx,r,c,d,value);cancelNormalSelected(ctx);if(((_curv2=curv)===null||_curv2===void 0?void 0:_curv2.tb)==="2"&&curv.v||isInlineStringCell(d[r][c])){var _cfg$columnlen,_cfg$rowlen;var defaultrowlen=ctx.defaultrowlen;var cfg=ctx.luckysheetfile[getSheetIndex(ctx,ctx.currentSheetId)].config||{};if(!(((_cfg$columnlen=cfg.columnlen)===null||_cfg$columnlen===void 0?void 0:_cfg$columnlen[c])&&((_cfg$rowlen=cfg.rowlen)===null||_cfg$rowlen===void 0?void 0:_cfg$rowlen[r]))){var _cfg$columnlen2,_cfg$customHeight;var cellWidth=((_cfg$columnlen2=cfg.columnlen)===null||_cfg$columnlen2===void 0?void 0:_cfg$columnlen2[c])||ctx.defaultcollen;var textInfo=canvas?getCellTextInfo(d[r][c],canvas,ctx,{r:r,c:c,cellWidth:cellWidth}):null;var currentRowLen=defaultrowlen;if(textInfo){currentRowLen=textInfo.textHeightAll+2;}if(currentRowLen>defaultrowlen&&!((_cfg$customHeight=cfg.customHeight)===null||_cfg$customHeight===void 0?void 0:_cfg$customHeight[r])){if(lodash.isNil(cfg.rowlen))cfg.rowlen={};cfg.rowlen[r]=currentRowLen;}}}if(ctx.hooks.afterUpdateCell){var newValue=lodash.cloneDeep(flowdata[r][c]);var afterUpdateCell=ctx.hooks.afterUpdateCell;setTimeout(function(){afterUpdateCell===null||afterUpdateCell===void 0?void 0:afterUpdateCell(r,c,oldValue,newValue);});}ctx.formulaCache.execFunctionGlobalData=null;}function getOrigincell(ctx,r,c,i){var data=getFlowdata(ctx,i);if(lodash.isNil(r)||lodash.isNil(c)){return null;}if(!data||!data[r]||!data[r][c]){return null;}return data[r][c];}function getcellFormula(ctx,r,c,i,data){var cell;if(lodash.isNil(data)){cell=getOrigincell(ctx,r,c,i);}else {cell=data[r][c];}if(lodash.isNil(cell)){return null;}return cell.f;}function getRange(ctx){var rangeArr=lodash.cloneDeep(ctx.luckysheet_select_save);var result=[];if(!rangeArr)return result;for(var i=0;i<rangeArr.length;i+=1){var rangeItem=rangeArr[i];var temp={row:rangeItem.row,column:rangeItem.column};result.push(temp);}return result;}function getFlattenedRange(ctx,range){range=range||getRange(ctx);var result=[];range.forEach(function(ele){var rs=ele.row;var cs=ele.column;for(var r=rs[0];r<=rs[1];r+=1){for(var c=cs[0];c<=cs[1];c+=1){result.push({r:r,c:c});}}});return result;}function getRangetxt(ctx,sheetId,range,currentId){var sheettxt="";if(currentId==null){currentId=ctx.currentSheetId;}if(sheetId!==currentId){var index=getSheetIndex(ctx,sheetId);if(index==null)return "";sheettxt=ctx.luckysheetfile[index].name.replace(/'/g,"''");if(/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/.test(sheettxt)){sheettxt+="!";}else {sheettxt="'".concat(sheettxt,"'!");}}var row0=range.row[0];var row1=range.row[1];var column0=range.column[0];var column1=range.column[1];if(row0==null&&row1==null){return "".concat(sheettxt+indexToColumnChar(column0),":").concat(indexToColumnChar(column1));}if(column0==null&&column1==null){return "".concat(sheettxt+(row0+1),":").concat(row1+1);}if(column0===column1&&row0===row1){return sheettxt+indexToColumnChar(column0)+(row0+1);}return "".concat(sheettxt+indexToColumnChar(column0)+(row0+1),":").concat(indexToColumnChar(column1)).concat(row1+1);}function getRangeByTxt(ctx,txt){var range=[];if(txt.indexOf(",")!==-1){var arr=txt.split(",");for(var i=0;i<arr.length;i+=1){if(iscelldata(arr[i])){range.push(getcellrange(ctx,arr[i]));}else {range=[];break;}}}else {if(iscelldata(txt)){range.push(getcellrange(ctx,txt));}}return range;}function isAllSelectedCellsInStatus(ctx,attr,status){if(!lodash.isEmpty(ctx.luckysheetCellUpdate)){var _startContainer$paren2,_endContainer$parentE;var w=window.getSelection();if(!w)return false;var range=w.getRangeAt(0);if(range.collapsed===true){return false;}var endContainer=range.endContainer;var startContainer=range.startContainer;var cssField=lodash.camelCase(attrToCssName[attr]);if(startContainer===endContainer){var _startContainer$paren;return !lodash.isEmpty((_startContainer$paren=startContainer.parentElement)===null||_startContainer$paren===void 0?void 0:_startContainer$paren.style[cssField]);}if(((_startContainer$paren2=startContainer.parentElement)===null||_startContainer$paren2===void 0?void 0:_startContainer$paren2.tagName)==="SPAN"&&((_endContainer$parentE=endContainer.parentElement)===null||_endContainer$parentE===void 0?void 0:_endContainer$parentE.tagName)==="SPAN"){var _startSpan$parentNode;var startSpan=startContainer.parentNode;var endSpan=endContainer.parentNode;var allSpans=startSpan===null||startSpan===void 0?void 0:(_startSpan$parentNode=startSpan.parentNode)===null||_startSpan$parentNode===void 0?void 0:_startSpan$parentNode.querySelectorAll("span");if(allSpans){var startSpanIndex=lodash.indexOf(allSpans,startSpan);var endSpanIndex=lodash.indexOf(allSpans,endSpan);var rangeSpans=[];for(var i=startSpanIndex;i<=endSpanIndex;i+=1){rangeSpans.push(allSpans[i]);}return lodash.every(rangeSpans,function(s){return !lodash.isEmpty(s.style[cssField]);});}}}var cells=getFlattenedRange(ctx);var flowdata=getFlowdata(ctx);return cells.every(function(_ref){var _flowdata$r;var r=_ref.r,c=_ref.c;var cell=flowdata===null||flowdata===void 0?void 0:(_flowdata$r=flowdata[r])===null||_flowdata$r===void 0?void 0:_flowdata$r[c];if(lodash.isNil(cell)){return false;}return cell[attr]===status;});}function getFontStyleByCell(cell,checksAF,checksCF){var isCheck=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var style={};if(!cell){return style;}lodash.forEach(cell,function(v,key){var _checksAF$length;var value=cell[key];if(isCheck){value=normalizedCellAttr(cell,key);}var valueNum=Number(value);if(key==="bl"&&valueNum!==0){style.fontWeight="bold";}if(key==="it"&&valueNum!==0){style.fontStyle="italic";}if(key==="fs"&&valueNum!==10){style.fontSize="".concat(valueNum,"pt");}if(key==="fc"&&value!=="#000000"||((_checksAF$length=checksAF===null||checksAF===void 0?void 0:checksAF.length)!==null&&_checksAF$length!==void 0?_checksAF$length:0)>0||(checksCF===null||checksCF===void 0?void 0:checksCF.textColor)){var _checksAF$length2;if(checksCF===null||checksCF===void 0?void 0:checksCF.textColor){style.color=checksCF.textColor;}else if(((_checksAF$length2=checksAF===null||checksAF===void 0?void 0:checksAF.length)!==null&&_checksAF$length2!==void 0?_checksAF$length2:0)>0){var _checksAF=_slicedToArray$3(checksAF,1);style.color=_checksAF[0];}else {style.color=value;}}if(key==="cl"&&valueNum!==0){style.textDecoration="line-through";}if(key==="un"&&(valueNum===1||valueNum===3)){var _cell$_color,_cell$_fontSize;var color=(_cell$_color=cell._color)!==null&&_cell$_color!==void 0?_cell$_color:cell.fc;var fs=(_cell$_fontSize=cell._fontSize)!==null&&_cell$_fontSize!==void 0?_cell$_fontSize:cell.fs;style.borderBottom="".concat(Math.floor(fs/9),"px solid ").concat(color);}});return style;}function getStyleByCell(ctx,d,r,c){var style={};var checksAF=[];var cf_compute=getComputeMap(ctx);var checksCF=checkCF(r,c,cf_compute);var cell=d[r][c];if(!cell)return {};var isInline=isInlineStringCell(cell);if("bg"in cell){var value=normalizedCellAttr(cell,"bg");if(checksCF===null||checksCF===void 0?void 0:checksCF.cellColor){if(checksCF===null||checksCF===void 0?void 0:checksCF.cellColor){style.background="".concat(checksCF.cellColor);}else if(checksAF.length>1){style.background="".concat(checksAF[1]);}else {style.background="".concat(value);}}}if("ht"in cell){var _value2=normalizedCellAttr(cell,"ht");if(Number(_value2)===0){style.textAlign="center";}else if(Number(_value2)===2){style.textAlign="right";}}if("vt"in cell){var _value3=normalizedCellAttr(cell,"vt");if(Number(_value3)===0){style.alignItems="center";}else if(Number(_value3)===2){style.alignItems="flex-end";}}if(!isInline){style=lodash.assign(style,getFontStyleByCell(cell,checksAF,checksCF));}return style;}function getInlineStringHTML(r,c,data){var ct=getCellValue(r,c,data,"ct");if(isInlineStringCT(ct)){var strings=ct.s;var value="";for(var i=0;i<strings.length;i+=1){var strObj=strings[i];if(strObj.v){var style=getFontStyleByCell(strObj);var styleStr=lodash.map(style,function(v,key){return "".concat(lodash.kebabCase(key),":").concat(lodash.isNumber(v)?"".concat(v,"px"):v,";");}).join("");value+="<span class=\"luckysheet-input-span\" index='".concat(i,"' style='").concat(styleStr,"'>").concat(strObj.v,"</span>");}}return value;}return "";}function getdatabyselection(ctx,range,sheetId){if(range==null&&ctx.luckysheet_select_save){var _ctx$luckysheet_selec=_slicedToArray$3(ctx.luckysheet_select_save,1);range=_ctx$luckysheet_selec[0];}if(!range)return [];if(range.row==null||range.row.length===0){return [];}var d;var cfg;if(sheetId!=null&&sheetId!==ctx.currentSheetId){d=ctx.luckysheetfile[getSheetIndex(ctx,sheetId)].data;cfg=ctx.luckysheetfile[getSheetIndex(ctx,sheetId)].config;}else {d=getFlowdata(ctx);cfg=ctx.config;}var data=[];for(var r=range.row[0];r<=range.row[1];r+=1){var _d,_cfg;if(((_d=d)===null||_d===void 0?void 0:_d[r])==null){continue;}if(((_cfg=cfg)===null||_cfg===void 0?void 0:_cfg.rowhidden)!=null&&cfg.rowhidden[r]!=null){continue;}var row=[];for(var c=range.column[0];c<=range.column[1];c+=1){var _cfg2;if(((_cfg2=cfg)===null||_cfg2===void 0?void 0:_cfg2.colhidden)!=null&&cfg.colhidden[c]!=null){continue;}row.push(d[r][c]);}data.push(row);}return data;}function luckysheetUpdateCell(ctx,row_index,col_index){ctx.luckysheetCellUpdate=[row_index,col_index];}function getDataBySelectionNoCopy(ctx,range){if(!range||!range.row||range.row.length===0)return [];var data=[];var flowData=getFlowdata(ctx);if(!flowData)return [];for(var r=range.row[0];r<=range.row[1];r+=1){var row=[];if(ctx.config.rowhidden!=null&&ctx.config.rowhidden[r]!=null){continue;}for(var c=range.column[0];c<=range.column[1];c+=1){var value=null;if(ctx.config.colhidden!=null&&ctx.config.colhidden[c]!=null){continue;}if(flowData[r]!=null&&flowData[r][c]!=null){value=flowData[r][c];}row.push(value);}data.push(row);}return data;}var clipboard=/*#__PURE__*/function(){function clipboard(){_classCallCheck$1(this,clipboard);}return _createClass$1(clipboard,null,[{key:"writeHtml",value:function writeHtml(str){try{var ele=document.getElementById("leankylin-copy-content");if(!ele){var _document$querySelect;ele=document.createElement("div");ele.setAttribute("contentEditable","true");ele.id="leankylin-copy-content";ele.style.position="fixed";ele.style.height="0";ele.style.width="0";ele.style.left="-10000px";(_document$querySelect=document.querySelector(".leankylin-container"))===null||_document$querySelect===void 0?void 0:_document$querySelect.append(ele);}var previouslyFocusedElement=document.activeElement;ele.style.display="block";ele.innerHTML=str;ele.focus({preventScroll:true});document.execCommand("selectAll");document.execCommand("copy");setTimeout(function(){var _ele,_previouslyFocusedEle;(_ele=ele)===null||_ele===void 0?void 0:_ele.blur();previouslyFocusedElement===null||previouslyFocusedElement===void 0?void 0:(_previouslyFocusedEle=previouslyFocusedElement.focus)===null||_previouslyFocusedEle===void 0?void 0:_previouslyFocusedEle.call(previouslyFocusedElement);},10);}catch(e){console.error(e);}}}]);}();function scrollToHighlightCell(ctx,r,c){var scrollLeft=ctx.scrollLeft,scrollTop=ctx.scrollTop;var winH=ctx.cellmainHeight;var winW=ctx.cellmainWidth;var sheetIndex=getSheetIndex(ctx,ctx.currentSheetId);var sheet=sheetIndex==null?null:ctx.luckysheetfile[sheetIndex];if(!sheet)return;var frozen=sheet===null||sheet===void 0?void 0:sheet.frozen;if(r>=0){var _sheet$frozen,_sheet$frozen$range;var row_focus=(sheet===null||sheet===void 0?void 0:(_sheet$frozen=sheet.frozen)===null||_sheet$frozen===void 0?void 0:(_sheet$frozen$range=_sheet$frozen.range)===null||_sheet$frozen$range===void 0?void 0:_sheet$frozen$range.row_focus)||0;var freezeH=frozen&&r>row_focus?ctx.visibledatarow[row_focus]:0;var row=ctx.visibledatarow[r];var row_pre=r-1===-1?0:ctx.visibledatarow[r-1];if(row-scrollTop-winH+20>0){ctx.scrollTop=row-winH+20;}else if(row_pre-scrollTop-freezeH<0){var scrollAmount=Math.max(20,freezeH);ctx.scrollTop=row_pre-scrollAmount;}}if(c>=0){var _sheet$frozen2,_sheet$frozen2$range;var column_focus=(sheet===null||sheet===void 0?void 0:(_sheet$frozen2=sheet.frozen)===null||_sheet$frozen2===void 0?void 0:(_sheet$frozen2$range=_sheet$frozen2.range)===null||_sheet$frozen2$range===void 0?void 0:_sheet$frozen2$range.column_focus)||0;var freezeW=frozen&&c>column_focus?ctx.visibledatacolumn[column_focus]:0;var col=ctx.visibledatacolumn[c];var col_pre=c-1===-1?0:ctx.visibledatacolumn[c-1];if(col-scrollLeft-winW+20>0){ctx.scrollLeft=col-winW+20;}else if(col_pre-scrollLeft-freezeW<0){var _scrollAmount=Math.max(20,freezeW);ctx.scrollLeft=col_pre-_scrollAmount;}}}function seletedHighlistByindex(ctx,r1,r2,c1,c2){var row=ctx.visibledatarow[r2];var row_pre=r1-1===-1?0:ctx.visibledatarow[r1-1];var col=ctx.visibledatacolumn[c2];var col_pre=c1-1===-1?0:ctx.visibledatacolumn[c1-1];if(lodash.isNumber(row)&&lodash.isNumber(row_pre)&&lodash.isNumber(col)&&lodash.isNumber(col_pre)){return {left:col_pre,width:col-col_pre-1,top:row_pre,height:row-row_pre-1};}return null;}function normalizeSelection(ctx,selection){if(!selection)return selection;var flowdata=getFlowdata(ctx);if(!flowdata)return selection;for(var i=0;i<selection.length;i+=1){var r1=selection[i].row[0];var r2=selection[i].row[1];var c1=selection[i].column[0];var c2=selection[i].column[1];var rf=void 0;var cf=void 0;if(lodash.isNil(selection[i].row_focus)){rf=r1;}else {rf=selection[i].row_focus;}if(lodash.isNil(selection[i].column_focus)){cf=c1;}else {cf=selection[i].column_focus;}if(lodash.isNil(rf)||lodash.isNil(cf)){console.error("normalizeSelection: rf and cf is nil");return selection;}var row=ctx.visibledatarow[r2];var row_pre=r1-1===-1?0:ctx.visibledatarow[r1-1];var col=ctx.visibledatacolumn[c2];var col_pre=c1-1===-1?0:ctx.visibledatacolumn[c1-1];var row_f=ctx.visibledatarow[rf];var row_pre_f=rf-1===-1?0:ctx.visibledatarow[rf-1];var col_f=ctx.visibledatacolumn[cf];var col_pre_f=cf-1===-1?0:ctx.visibledatacolumn[cf-1];var margeset=mergeBorder(ctx,flowdata,rf,cf);if(margeset){var _margeset$row=_slicedToArray$3(margeset.row,2);row_pre_f=_margeset$row[0];row_f=_margeset$row[1];var _margeset$column=_slicedToArray$3(margeset.column,2);col_pre_f=_margeset$column[0];col_f=_margeset$column[1];}selection[i].row=[r1,r2];selection[i].column=[c1,c2];selection[i].row_focus=rf;selection[i].column_focus=cf;selection[i].left=col_pre_f;selection[i].width=col_f-col_pre_f<=0?0:col_f-col_pre_f-1;selection[i].top=row_pre_f;selection[i].height=row_f-row_pre_f<=0?0:row_f-row_pre_f-1;selection[i].left_move=col_pre;selection[i].width_move=col-col_pre<=0?0:col-col_pre-1;selection[i].top_move=row_pre;selection[i].height_move=row-row_pre<=0?0:row-row_pre-1;}return selection;}function selectTitlesMap(rangeMap,range1,range2){var map=rangeMap||{};for(var i=range1;i<=range2;i+=1){if(i in map){continue;}map[i]=0;}return map;}function selectTitlesRange(map){var mapArr=Object.keys(map).map(Number);mapArr.sort(function(a,b){return a-b;});var rangeArr;var item=[];if(mapArr.length>1){rangeArr=[];for(var j=1;j<mapArr.length;j+=1){if(mapArr[j]-mapArr[j-1]===1){item.push(mapArr[j-1]);if(j===mapArr.length-1){item.push(mapArr[j]);rangeArr.push(item);}}else {if(j===1){if(j===mapArr.length-1){item.push(mapArr[j-1]);rangeArr.push(item);rangeArr.push([mapArr[j]]);}else {rangeArr.push([mapArr[0]]);}}else if(j===mapArr.length-1){item.push(mapArr[j-1]);rangeArr.push(item);rangeArr.push([mapArr[j]]);}else {item.push(mapArr[j-1]);rangeArr.push(item);item=[];}}}}else {rangeArr=[];rangeArr.push([mapArr[0]]);}return rangeArr;}function pasteHandlerOfPaintModel(ctx,copyRange){var cfg=ctx.config;if(cfg.merge==null){cfg.merge={};}if(!copyRange)return;var copyHasMC=copyRange.HasMC;var copySheetIndex=copyRange.dataSheetId;var c_r1=copyRange.copyRange[0].row[0];var c_r2=copyRange.copyRange[0].row[1];var c_c1=copyRange.copyRange[0].column[0];var c_c2=copyRange.copyRange[0].column[1];var copyData=lodash.cloneDeep(getdatabyselection(ctx,{row:[c_r1,c_r2],column:[c_c1,c_c2]},copySheetIndex));if(!ctx.luckysheet_select_save)return;var last=ctx.luckysheet_select_save[ctx.luckysheet_select_save.length-1];var minh=last.row[0];var maxh=last.row[1];var minc=last.column[0];var maxc=last.column[1];var copyh=copyData.length;var copyc=copyData[0].length;if(minh===maxh&&minc===maxc){var has_PartMC=false;if(cfg.merge!=null){has_PartMC=hasPartMC(ctx,cfg,minh,minh+copyh-1,minc,minc+copyc-1);}if(has_PartMC){return;}maxh=minh+copyh-1;maxc=minc+copyc-1;}var timesH=Math.ceil((maxh-minh+1)/copyh);var timesC=Math.ceil((maxc-minc+1)/copyc);var flowdata=getFlowdata(ctx);if(flowdata==null)return;var cellMaxLength=flowdata[0].length;var rowMaxLength=flowdata.length;var borderInfoCompute=getBorderInfoCompute(ctx,copySheetIndex);var c_dataVerification=lodash.cloneDeep(ctx.luckysheetfile[getSheetIndex(ctx,copySheetIndex)].dataVerification)||{};var dataVerification=null;var mth=0;var mtc=0;var maxcellCahe=0;var maxrowCache=0;for(var th=1;th<=timesH;th+=1){for(var tc=1;tc<=timesC;tc+=1){mth=minh+(th-1)*copyh;mtc=minc+(tc-1)*copyc;maxrowCache=minh+th*copyh>rowMaxLength?rowMaxLength:minh+th*copyh;if(maxrowCache>maxh+1){maxrowCache=maxh+1;}maxcellCahe=minc+tc*copyc>cellMaxLength?cellMaxLength:minc+tc*copyc;if(maxcellCahe>maxc+1){maxcellCahe=maxc+1;}var offsetMC={};var _loop=function _loop(){if(h==null)return {v:void 0};if(flowdata[h]==null)return {v:void 0};var x=[];x=flowdata[h];var _loop2=function _loop2(c){if(borderInfoCompute["".concat(c_r1+h-mth,"_").concat(c_c1+c-mtc)]){var bd_obj={rangeType:"cell",value:{row_index:h,col_index:c,l:borderInfoCompute["".concat(c_r1+h-mth,"_").concat(c_c1+c-mtc)].l,r:borderInfoCompute["".concat(c_r1+h-mth,"_").concat(c_c1+c-mtc)].r,t:borderInfoCompute["".concat(c_r1+h-mth,"_").concat(c_c1+c-mtc)].t,b:borderInfoCompute["".concat(c_r1+h-mth,"_").concat(c_c1+c-mtc)].b}};if(cfg.borderInfo==null){cfg.borderInfo=[];}cfg.borderInfo.push(bd_obj);}else if(borderInfoCompute["".concat(h,"_").concat(c)]){var _bd_obj={rangeType:"cell",value:{row_index:h,col_index:c,l:null,r:null,t:null,b:null}};if(cfg.borderInfo==null){cfg.borderInfo=[];}cfg.borderInfo.push(_bd_obj);}if(c_dataVerification["".concat(c_r1+h-mth,"_").concat(c_c1+c-mtc)]){if(dataVerification==null){dataVerification=lodash.cloneDeep(ctx.luckysheetfile[getSheetIndex(ctx,ctx.currentSheetId)].dataVerification);}dataVerification["".concat(h,"_").concat(c)]=c_dataVerification["".concat(c_r1+h-mth,"_").concat(c_c1+c-mtc)];}if(lodash.isPlainObject(x[c])&&x[c].mc){if(x[c].mc.rs){delete cfg.merge["".concat(x[c].mc.r,"_").concat(x[c].mc.c)];}delete x[c].mc;}var value=null;if(copyData[h-mth]!=null&©Data[h-mth][c-mtc]!=null){value=copyData[h-mth][c-mtc];}if(lodash.isPlainObject(x[c])){if(x[c].ct&&x[c].ct.t==="inlineStr"&&value){delete value.ct;}else {var format=["bg","fc","ct","ht","vt","bl","it","cl","un","fs","ff","tb"];format.forEach(function(item){Reflect.deleteProperty(x[c],item);});}}else {x[c]={v:x[c]};}if(value!=null){delete value.v;delete value.m;delete value.f;delete value.spl;if(value.ct&&value.ct.t==="inlineStr"){delete value.ct;}x[c]=lodash.assign(x[c],lodash.cloneDeep(value));if(x[c].ct&&x[c].ct.t==="inlineStr"){x[c].ct.s.forEach(function(item){return lodash.assign(item,value);});}if(copyHasMC&&x[c].mc){if(x[c].mc.rs!=null){x[c].mc.r=h;if(x[c].mc.rs+h>=maxrowCache){x[c].mc.rs=maxrowCache-h;}x[c].mc.c=c;if(x[c].mc.cs+c>=maxcellCahe){x[c].mc.cs=maxcellCahe-c;}cfg.merge["".concat(x[c].mc.r,"_").concat(x[c].mc.c)]=x[c].mc;offsetMC["".concat(value.mc.r,"_").concat(value.mc.c)]=[x[c].mc.r,x[c].mc.c];}else {x[c]={mc:{r:offsetMC["".concat(value.mc.r,"_").concat(value.mc.c)][0],c:offsetMC["".concat(value.mc.r,"_").concat(value.mc.c)][1]}};}}if(x[c].v!=null){if(value.ct!=null&&value.ct.fa!=null){var mask=update(value.ct.fa,x[c].v);x[c].m=mask;}}}};for(var c=mtc;c<maxcellCahe;c+=1){_loop2(c);}flowdata[h]=x;},_ret;for(var h=mth;h<maxrowCache;h+=1){_ret=_loop();if(_ret)return _ret.v;}}}var currFile=ctx.luckysheetfile[getSheetIndex(ctx,ctx.currentSheetId)];currFile.config=cfg;currFile.dataVerification=dataVerification;var cdformat=null;var copyIndex=getSheetIndex(ctx,copySheetIndex);if(!copyIndex)return;var ruleArr=lodash.cloneDeep(ctx.luckysheetfile[copyIndex].luckysheet_conditionformat_save);if(!lodash.isNil(ruleArr)&&ruleArr.length>0){var currentIndex=getSheetIndex(ctx,ctx.currentSheetId);cdformat=lodash.cloneDeep(ctx.luckysheetfile[currentIndex].luckysheet_conditionformat_save);for(var i=0;i<ruleArr.length;i+=1){var cdformat_cellrange=ruleArr[i].cellrange;var emptyRange=[];for(var j=0;j<cdformat_cellrange.length;j+=1){var range=CFSplitRange(cdformat_cellrange[j],{row:[c_r1,c_r2],column:[c_c1,c_c2]},{row:[minh,maxh],column:[minc,maxc]},"operatePart");if(range.length>0){emptyRange=emptyRange.concat(range);}}if(emptyRange.length>0){ruleArr[i].cellrange=[{row:[minh,maxh],column:[minc,maxc]}];cdformat.push(ruleArr[i]);}}}}function selectionCopyShow(range,ctx){if(range==null){range=ctx.luckysheet_selection_range;}range=JSON.parse(JSON.stringify(range));}function rowHasMerged(ctx,r,c1,c2){var hasMerged=false;var flowData=getFlowdata(ctx);if(lodash.isNil(flowData)||lodash.isNil(flowData[r]))return false;for(var c=c1;c<=c2;c+=1){var cell=flowData[r][c];if(!lodash.isNil(cell)&&"mc"in cell){hasMerged=true;break;}}return hasMerged;}function colHasMerged(ctx,c,r1,r2){var hasMerged=false;var flowData=getFlowdata(ctx);if(lodash.isNil(flowData))return false;for(var r=r1;r<=r2;r+=1){var _flowData$r;var cell=(_flowData$r=flowData[r])===null||_flowData$r===void 0?void 0:_flowData$r[c];if(!lodash.isNil(ctx.config.merge)&&!lodash.isNil(cell)&&"mc"in cell&&!lodash.isNil(cell.mc)){hasMerged=true;break;}}return hasMerged;}function getRowMerge(ctx,rIndex,c1,c2){var flowData=getFlowdata(ctx);if(lodash.isNil(flowData))return [null,null];var r2=flowData.length-1;var str=null;if(rIndex>0){for(var r=rIndex;r>=0;r-=1){for(var c=c1;c<=c2;c+=1){var cell=flowData[r][c];if(!lodash.isNil(cell)&&!lodash.isNil(cell.mc)&&"mc"in cell&&!lodash.isNil(ctx.config.merge)){var mc=ctx.config.merge["".concat(cell.mc.r,"_").concat(cell.mc.c)];if(lodash.isNil(str)||mc.r<str){str=mc.r;}}}if(!lodash.isNil(str)&&rowHasMerged(ctx,str-1,c1,c2)&&str>0){r=str;}else {break;}}}else {str=0;}var end=null;if(rIndex<r2){for(var _r=rIndex;_r<=r2;_r+=1){for(var _c=c1;_c<=c2;_c+=1){var _cell=flowData[_r][_c];if(!lodash.isNil(_cell)&&!lodash.isNil(_cell.mc)&&"mc"in _cell&&!lodash.isNil(ctx.config.merge)){var _mc=ctx.config.merge["".concat(_cell.mc.r,"_").concat(_cell.mc.c)];if(lodash.isNil(end)||_mc.r+_mc.rs-1>end){end=_mc.r+_mc.rs-1;}}}if(!lodash.isNil(end)&&rowHasMerged(ctx,end+1,c1,c2)&&end<r2){_r=end;}else {break;}}}else {end=r2;}return [str,end];}function getColMerge(ctx,cIndex,r1,r2){var flowData=getFlowdata(ctx);if(lodash.isNil(flowData)){return [null,null];}var c2=flowData[0].length-1;var str=null;if(cIndex>0){for(var c=cIndex;c>=0;c-=1){for(var r=r1;r<=r2;r+=1){var cell=flowData[r][c];if(!lodash.isNil(ctx.config.merge)&&!lodash.isNil(cell)&&"mc"in cell&&!lodash.isNil(cell.mc)){var mc=ctx.config.merge["".concat(cell.mc.r,"_").concat(cell.mc.c)];if(lodash.isNil(str)||mc.c<str){str=mc.c;}}}if(!lodash.isNil(str)&&colHasMerged(ctx,str-1,r1,r2)&&str>0){c=str;}else {break;}}}else {str=0;}var end=null;if(cIndex<c2){for(var _c2=cIndex;_c2<=c2;_c2+=1){for(var _r2=r1;_r2<=r2;_r2+=1){var _cell2=flowData[_r2][_c2];if(!lodash.isNil(ctx.config.merge)&&!lodash.isNil(_cell2)&&"mc"in _cell2&&!lodash.isNil(_cell2.mc)){var _mc2=ctx.config.merge["".concat(_cell2.mc.r,"_").concat(_cell2.mc.c)];if(lodash.isNil(end)||_mc2.c+_mc2.cs-1>end){end=_mc2.c+_mc2.cs-1;}}}if(!lodash.isNil(end)&&colHasMerged(ctx,end+1,r1,r2)&&end<c2){_c2=end;}else {break;}}}else {end=c2;}return [str,end];}function moveHighlightCell(ctx,postion,index,type){var flowdata=getFlowdata(ctx);if(!flowdata)return;var datarowlen=flowdata.length;var datacolumnlen=flowdata[0].length;var row;var row_pre;var row_index;var row_index_ed;var col;var col_pre;var col_index;var col_index_ed;if(type==="rangeOfSelect"){var _ctx$luckysheet_selec;var last=(_ctx$luckysheet_selec=ctx.luckysheet_select_save)===null||_ctx$luckysheet_selec===void 0?void 0:_ctx$luckysheet_selec[ctx.luckysheet_select_save.length-1];if(!last){console.error("moveHighlightCell: no selection found");return;}var curR;if(lodash.isNil(last.row_focus)){var _last$row=_slicedToArray$3(last.row,1);curR=_last$row[0];}else {curR=last.row_focus;}var curC;if(lodash.isNil(last.column_focus)){var _last$column=_slicedToArray$3(last.column,1);curC=_last$column[0];}else {curC=last.column_focus;}var margeset=mergeBorder(ctx,flowdata,curR,curC);if(margeset){var str_r=margeset.row[2];var end_r=margeset.row[3];var str_c=margeset.column[2];var end_c=margeset.column[3];if(index>0){if(postion==="down"){curR=end_r;curC=str_c;}else if(postion==="right"){curR=str_r;curC=end_c;}}else {curR=str_r;curC=str_c;}}if(lodash.isNil(curR)||lodash.isNil(curC)){console.error("moveHighlightCell: curR or curC is nil");return;}var moveX=lodash.isNil(last.moveXY)?curR:last.moveXY.x;var moveY=lodash.isNil(last.moveXY)?curC:last.moveXY.y;if(postion==="down"){curR+=index;moveX=curR;}else if(postion==="right"){curC+=index;moveY=curC;}if(curR>=datarowlen){curR=datarowlen-1;moveX=curR;}if(curR<0){curR=0;moveX=curR;}if(curC>=datacolumnlen){curC=datacolumnlen-1;moveY=curC;}if(curC<0){curC=0;moveY=curC;}var margeset2=mergeBorder(ctx,flowdata,curR,curC);if(margeset2){var _margeset2$row=_slicedToArray$3(margeset2.row,4);row_pre=_margeset2$row[0];row=_margeset2$row[1];row_index=_margeset2$row[2];row_index_ed=_margeset2$row[3];var _margeset2$column=_slicedToArray$3(margeset2.column,4);col_pre=_margeset2$column[0];col=_margeset2$column[1];col_index=_margeset2$column[2];col_index_ed=_margeset2$column[3];}else {row=ctx.visibledatarow[moveX];row_pre=moveX-1===-1?0:ctx.visibledatarow[moveX-1];col=ctx.visibledatacolumn[moveY];col_pre=moveY-1===-1?0:ctx.visibledatacolumn[moveY-1];row_index=curR;row_index_ed=curR;col_index=curC;col_index_ed=curC;}if(lodash.isNil(row_index)||lodash.isNil(row_index_ed)||lodash.isNil(col_index)||lodash.isNil(col_index_ed)){console.error("moveHighlightCell: row_index or row_index_ed or col_index or col_index_ed is nil");return;}last.row=[row_index,row_index_ed];last.column=[col_index,col_index_ed];last.row_focus=row_index;last.column_focus=col_index;last.moveXY={x:moveX,y:moveY};normalizeSelection(ctx,ctx.luckysheet_select_save);scrollToHighlightCell(ctx,row_index,col_index);}else if(type==="rangeOfFormula"){var _last=ctx.formulaCache.func_selectedrange;if(!_last)return;var _curR;if(lodash.isNil(_last.row_focus)){var _last$row2=_slicedToArray$3(_last.row,1);_curR=_last$row2[0];}else {_curR=_last.row_focus;}var _curC;if(lodash.isNil(_last.column_focus)){var _last$column2=_slicedToArray$3(_last.column,1);_curC=_last$column2[0];}else {_curC=_last.column_focus;}var _margeset=mergeBorder(ctx,flowdata,_curR,_curC);if(_margeset){var _str_r=_margeset.row[2];var _end_r=_margeset.row[3];var _str_c=_margeset.column[2];var _end_c=_margeset.column[3];if(index>0){if(postion==="down"){_curR=_end_r;_curC=_str_c;}else if(postion==="right"){_curR=_str_r;_curC=_end_c;}}else {_curR=_str_r;_curC=_str_c;}}if(lodash.isNil(_curR)||lodash.isNil(_curC)){console.error("moveHighlightCell: curR or curC is nil");return;}var _moveX=lodash.isNil(_last.moveXY)?_curR:_last.moveXY.x;var _moveY=lodash.isNil(_last.moveXY)?_curC:_last.moveXY.y;if(postion==="down"){_curR+=index;_moveX=_curR;}else if(postion==="right"){_curC+=index;_moveY=_curC;}if(_curR>=datarowlen){_curR=datarowlen-1;_moveX=_curR;}if(_curR<0){_curR=0;_moveX=_curR;}if(_curC>=datacolumnlen){_curC=datacolumnlen-1;_moveY=_curC;}if(_curC<0){_curC=0;_moveY=_curC;}var _margeset2=mergeBorder(ctx,flowdata,_curR,_curC);if(_margeset2){var _margeset2$row2=_slicedToArray$3(_margeset2.row,4);row_pre=_margeset2$row2[0];row=_margeset2$row2[1];row_index=_margeset2$row2[2];row_index_ed=_margeset2$row2[3];var _margeset2$column2=_slicedToArray$3(_margeset2.column,4);col_pre=_margeset2$column2[0];col=_margeset2$column2[1];col_index=_margeset2$column2[2];col_index_ed=_margeset2$column2[3];}else {row=ctx.visibledatarow[_moveX];row_pre=_moveX-1===-1?0:ctx.visibledatarow[_moveX-1];row_index=_moveX;row_index_ed=_moveX;col=ctx.visibledatacolumn[_moveY];col_pre=_moveY-1===-1?0:ctx.visibledatacolumn[_moveY-1];col_index=_moveY;col_index_ed=_moveY;}if(lodash.isNil(col)||lodash.isNil(col_pre)||lodash.isNil(row)||lodash.isNil(row_pre)||lodash.isNil(row_index)||lodash.isNil(row_index_ed)||lodash.isNil(col_index)||lodash.isNil(col_index_ed)){console.error("moveHighlightCell: some values of func_selectedrange is nil");return;}ctx.formulaCache.func_selectedrange={left:col_pre,width:col-col_pre-1,top:row_pre,height:row-row_pre-1,left_move:col_pre,width_move:col-col_pre-1,top_move:row_pre,height_move:row-row_pre-1,row:[row_index,row_index_ed],column:[col_index,col_index_ed],row_focus:row_index,column_focus:col_index,moveXY:{x:_moveX,y:_moveY}};}}function moveHighlightRange(ctx,postion,index,type){var row;var row_pre;var col;var col_pre;var flowData=getFlowdata(ctx);if(lodash.isNil(flowData))return;if(lodash.isNil(ctx.luckysheet_select_save))return;if(type==="rangeOfSelect"){var last=ctx.luckysheet_select_save[ctx.luckysheet_select_save.length-1];var curR=last.row[0];var endR=last.row[1];var curC=last.column[0];var endC=last.column[1];var rf=last.row_focus;var cf=last.column_focus;if(lodash.isNil(rf)||lodash.isNil(cf))return;var datarowlen=flowData.length;var datacolumnlen=flowData[0].length;if(postion==="down"){if(rowHasMerged(ctx,rf,curC,endC)){var rfMerge=getRowMerge(ctx,rf,curC,endC);var rf_str=rfMerge[0];var rf_end=rfMerge[1];if(!lodash.isNil(rf_str)&&rf_str>curR&&rf_end===endR){if(index>0&&rowHasMerged(ctx,curR,curC,endC)){var v=getRowMerge(ctx,curR,curC,endC)[1];if(!lodash.isNil(v)){curR=v;}}curR+=index;}else if(!lodash.isNil(rf_end)&&rf_end<endR&&rf_str===curR){if(index<0&&rowHasMerged(ctx,endR,curC,endC)){var _v=getRowMerge(ctx,curR,curC,endC)[0];if(!lodash.isNil(_v)){endR=_v;}}endR+=index;}else {if(index>0){endR+=index;}else {curR+=index;}}}else {if(rf>curR&&rf===endR){if(index>0&&rowHasMerged(ctx,curR,curC,endC)){var _v2=getRowMerge(ctx,curR,curC,endC)[1];if(!lodash.isNil(_v2)){curR=_v2;}}curR+=index;}else if(rf<endR&&rf===curR){if(index<0&&rowHasMerged(ctx,endR,curC,endC)){var _v3=getRowMerge(ctx,endR,curC,endC)[0];if(!lodash.isNil(_v3)){endR=_v3;}}endR+=index;}else if(rf===curR&&rf===endR){if(index>0){endR+=index;}else {curR+=index;}}}if(endR>=datarowlen){endR=datarowlen-1;}if(endR<0){endR=0;}if(curR>=datarowlen){curR=datarowlen-1;}if(curR<0){curR=0;}}else {if(colHasMerged(ctx,cf,curR,endR)){var cfMerge=getColMerge(ctx,cf,curR,endR);var cf_str=cfMerge[0];var cf_end=cfMerge[1];if(!lodash.isNil(cf_str)&&cf_str>curC&&cf_end===endC){if(index>0&&colHasMerged(ctx,curC,curR,endR)){var _v4=getColMerge(ctx,curC,curR,endR)[1];if(!lodash.isNil(_v4)){curC=_v4;}curC+=index;}curC+=index;}else if(!lodash.isNil(cf_end)&&cf_end<endC&&cf_str===curC){if(index<0&&colHasMerged(ctx,endC,curR,endR)){var _v5=getColMerge(ctx,endC,curR,endR)[0];if(!lodash.isNil(_v5)){endC=_v5;}}endC+=index;}else {if(index>0){endC+=index;}else {curC+=index;}}}else {if(cf>curC&&cf===endC){if(index>0&&colHasMerged(ctx,curC,curR,endR)){var _v6=getColMerge(ctx,curC,curR,endR)[1];if(!lodash.isNil(_v6)){curC=_v6;}curC+=index;}curC+=index;}else if(cf<endC&&cf===curC){if(index<0&&colHasMerged(ctx,endC,curR,endR)){var _v7=getColMerge(ctx,endC,curR,endR)[0];if(!lodash.isNil(_v7)){endC=_v7;}}endC+=index;}else if(cf===curC&&cf===endC){if(index>0){endC+=index;}else {curC+=index;}}}if(endC>=datacolumnlen){endC=datacolumnlen-1;}if(endC<0){endC=0;}if(curC>=datacolumnlen){curC=datacolumnlen-1;}if(curC<0){curC=0;}}var rowseleted=[curR,endR];var columnseleted=[curC,endC];row=ctx.visibledatarow[endR];row_pre=curR-1===-1?0:ctx.visibledatarow[curR-1];col=ctx.visibledatacolumn[endC];col_pre=curC-1===-1?0:ctx.visibledatacolumn[curC-1];var changeparam=mergeMoveMain(ctx,columnseleted,rowseleted,last,row_pre,row-row_pre-1,col_pre,col-col_pre-1);if(!lodash.isNil(changeparam)){var _changeparam=_slicedToArray$3(changeparam,2);columnseleted=_changeparam[0];rowseleted=_changeparam[1];}last.row=rowseleted;last.column=columnseleted;normalizeSelection(ctx,ctx.luckysheet_select_save);if(postion==="down"){var rowToScroll=last.row_focus===last.row[0]?last.row[1]:last.row[0];scrollToHighlightCell(ctx,rowToScroll,-1);}else {var columnToScroll=last.column_focus===last.column[0]?last.column[1]:last.column[0];scrollToHighlightCell(ctx,-1,columnToScroll);}}else if(type==="rangeOfFormula"){var _last2=ctx.formulaCache.func_selectedrange;if(lodash.isNil(_last2))return;var _curR2=_last2.row[0];var _endR=_last2.row[1];var _curC2=_last2.column[0];var _endC=_last2.column[1];var _rf=_last2.row_focus;var _cf=_last2.column_focus;var _datarowlen=flowData.length;var _datacolumnlen=flowData[0].length;if(postion==="down"){if(!lodash.isNil(_rf)&&rowHasMerged(ctx,_rf,_curC2,_endC)){var _rfMerge=getRowMerge(ctx,_rf,_curC2,_endC);var _rf_str=_rfMerge[0];var _rf_end=_rfMerge[1];if(!lodash.isNil(_rf_str)&&_rf_str>_curR2&&_rf_end===_endR){if(index>0&&rowHasMerged(ctx,_curR2,_curC2,_endC)){var _v8=getRowMerge(ctx,_curR2,_curC2,_endC)[1];if(!lodash.isNil(_v8)){_curR2=_v8;}}_curR2+=index;}else if(!lodash.isNil(_rf_end)&&_rf_end<_endR&&_rf_str===_curR2){if(index<0&&rowHasMerged(ctx,_endR,_curC2,_endC)){var _v9=getRowMerge(ctx,_endR,_curC2,_endC)[0];if(!lodash.isNil(_v9)){_endR=_v9;}_endR+=index;}}else {if(index>0){_endR+=index;}else {_curR2+=index;}}}else {if(!lodash.isNil(_rf)&&_rf>_curR2&&_rf===_endR){if(index>0&&rowHasMerged(ctx,_curR2,_curC2,_endC)){var _v10=getRowMerge(ctx,_curR2,_curC2,_endC)[1];if(!lodash.isNil(_v10)){_curR2=_v10;}}_curR2+=index;}else if(!lodash.isNil(_rf)&&_rf<_endR&&_rf===_curR2){if(index<0&&rowHasMerged(ctx,_endR,_curC2,_endC)){var _v11=getRowMerge(ctx,_endR,_curC2,_endC)[0];if(!lodash.isNil(_v11)){_endR=_v11;}}_endR+=index;}else if(_rf===_curR2&&_rf===_endR){if(index>0){_endR+=index;}else {_curR2+=index;}}}if(_endR>=_datarowlen){_endR=_datarowlen-1;}if(_endR<0){_endR=0;}if(_curR2>=_datarowlen){_curR2=_datarowlen-1;}if(_curR2<0){_curR2=0;}}else {if(!lodash.isNil(_cf)&&colHasMerged(ctx,_cf,_curR2,_endR)){var _cfMerge=getColMerge(ctx,_cf,_curR2,_endR);var _cf_str=_cfMerge[0];var _cf_end=_cfMerge[1];if(!lodash.isNil(_cf_str)&&_cf_str>_curC2&&_cf_end===_endC){if(index>0&&colHasMerged(ctx,_curC2,_curR2,_endR)){var _v12=getColMerge(ctx,_curC2,_curR2,_endR)[1];if(!lodash.isNil(_v12)){_curC2=_v12;}}_curC2+=index;}else if(!lodash.isNil(_cf_end)&&_cf_end<_endC&&_cf_str===_curC2){if(index<0&&colHasMerged(ctx,_endC,_curR2,_endR)){var _v13=getColMerge(ctx,_endC,_curR2,_endR)[0];if(!lodash.isNil(_v13)){_endC=_v13;}}_endC+=index;}else {if(index>0){_endC+=index;}else {_curC2+=index;}}}else {if(!lodash.isNil(_cf)&&_cf>_curC2&&_cf===_endC){if(index>0&&colHasMerged(ctx,_curC2,_curR2,_endR)){var _v14=getColMerge(ctx,_curC2,_curR2,_endR)[1];if(!lodash.isNil(_v14)){_curC2=_v14;}}_curC2+=index;}else if(!lodash.isNil(_cf)&&_cf<_endC&&_cf===_curC2){if(index<0&&colHasMerged(ctx,_endC,_curR2,_endR)){var _v15=getColMerge(ctx,_endC,_curR2,_endR)[0];if(!lodash.isNil(_v15)){_endC=_v15;}}_endC+=index;}else if(_cf===_curC2&&_cf===_endC){if(index>0){_endC+=index;}else {_curC2+=index;}}}if(_endC>=_datacolumnlen){_endC=_datacolumnlen-1;}if(_endC<0){_endC=0;}if(_curC2>=_datacolumnlen){_curC2=_datacolumnlen-1;}if(_curC2<0){_curC2=0;}}var _rowseleted=[_curR2,_endR];var _columnseleted=[_curC2,_endC];row=ctx.visibledatarow[_endR];row_pre=_curR2-1===-1?0:ctx.visibledatarow[_curR2-1];col=ctx.visibledatacolumn[_endC];col_pre=_curC2-1===-1?0:ctx.visibledatacolumn[_curC2-1];var top=row_pre;var height=row-row_pre-1;var left=col_pre;var width=col-col_pre-1;var _changeparam2=mergeMoveMain(ctx,_columnseleted,_rowseleted,_last2,top,height,left,width);if(!lodash.isNil(_changeparam2)){var _changeparam3=_slicedToArray$3(_changeparam2,6);_columnseleted=_changeparam3[0];_rowseleted=_changeparam3[1];top=_changeparam3[2];height=_changeparam3[3];left=_changeparam3[4];width=_changeparam3[5];}ctx.formulaCache.func_selectedrange={left:left,width:width,top:top,height:height,left_move:left,width_move:width,top_move:top,height_move:height,row:_rowseleted,column:_columnseleted,row_focus:_rf,column_focus:_cf};}}function getHtmlBorderStyle(type,color){var style="";var borderType={"0":"none","1":"Thin","2":"Hair","3":"Dotted","4":"Dashed","5":"DashDot","6":"DashDotDot","7":"Double","8":"Medium","9":"MediumDashed","10":"MediumDashDot","11":"MediumDashDotDot","12":"SlantedDashDot","13":"Thick"};type=borderType[type.toString()];if(type.indexOf("Medium")>-1){style+="1pt ";}else if(type==="Thick"){style+="1.5pt ";}else {style+="0.5pt ";}if(type==="Hair"){style+="double ";}else if(type.indexOf("DashDotDot")>-1){style+="dotted ";}else if(type.indexOf("DashDot")>-1){style+="dashed ";}else if(type.indexOf("Dotted")>-1){style+="dotted ";}else if(type.indexOf("Dashed")>-1){style+="dashed ";}else {style+="solid ";}return "".concat(style+color,";");}function rangeValueToHtml(ctx,sheetId,ranges){var _sheet$config;var idx=getSheetIndex(ctx,sheetId);if(idx==null)return "";var sheet=ctx.luckysheetfile[idx];var rowIndexArr=[];var colIndexArr=[];for(var s=0;s<((_ranges$length=ranges===null||ranges===void 0?void 0:ranges.length)!==null&&_ranges$length!==void 0?_ranges$length:0);s+=1){var _ranges$length;var range=ranges[s];var r1=range.row[0];var r2=range.row[1];var c1=range.column[0];var c2=range.column[1];for(var copyR=r1;copyR<=r2;copyR+=1){if(!rowIndexArr.includes(copyR)){rowIndexArr.push(copyR);}for(var copyC=c1;copyC<=c2;copyC+=1){if(!colIndexArr.includes(copyC)){colIndexArr.push(copyC);}}}}var borderInfoCompute;if(((_sheet$config=sheet.config)===null||_sheet$config===void 0?void 0:_sheet$config.borderInfo)&&sheet.config.borderInfo.length>0){borderInfoCompute=getBorderInfoCompute(ctx,sheetId);}var cpdata="";var d=sheet.data;if(!d)return null;var colgroup="";for(var i=0;i<rowIndexArr.length;i+=1){var r=rowIndexArr[i];cpdata+="<tr>";var _loop3=function _loop3(){var _d$r;var c=colIndexArr[j];var column='<td ${span} style="${style}">';var cell=(_d$r=d[r])===null||_d$r===void 0?void 0:_d$r[c];if(cell!=null){var style="";var span="";if(r===rowIndexArr[0]){if(lodash.isNil(sheet.config)||lodash.isNil(sheet.config.columnlen)||lodash.isNil(sheet.config.columnlen[c.toString()])){colgroup+='<colgroup width="72px"></colgroup>';}else {colgroup+="<colgroup width=\"".concat(sheet.config.columnlen[c.toString()],"px\"></colgroup>");}}if(c===colIndexArr[0]){if(lodash.isNil(sheet.config)||lodash.isNil(sheet.config.rowlen)||lodash.isNil(sheet.config.rowlen[r.toString()])){style+="height:19px;";}else {style+="height:".concat(sheet.config.rowlen[r.toString()],"px;");}}var reg=/^(w|W)((0?)|(0\.0+))$/;var c_value;if(!lodash.isNil(cell.ct)&&!lodash.isNil(cell.ct.fa)&&cell.ct.fa.match(reg)){c_value=getCellValue(r,c,d);}else {c_value=getCellValue(r,c,d,"m");}var styleObj=getStyleByCell(ctx,d,r,c);style+=lodash.map(styleObj,function(v,key){return "".concat(lodash.kebabCase(key),":").concat(lodash.isNumber(v)?"".concat(v,"px"):v,";");}).join("");if(cell.mc){if("rs"in cell.mc){span="rowspan=\"".concat(cell.mc.rs,"\" colspan=\"").concat(cell.mc.cs,"\"");if(borderInfoCompute&&borderInfoCompute["".concat(r,"_").concat(c)]){var bl_obj={color:{},style:{}};var br_obj={color:{},style:{}};var bt_obj={color:{},style:{}};var bb_obj={color:{},style:{}};for(var bd_r=r;bd_r<r+cell.mc.rs;bd_r+=1){for(var bd_c=c;bd_c<c+cell.mc.cs;bd_c+=1){if(bd_r===r&&borderInfoCompute["".concat(bd_r,"_").concat(bd_c)]&&borderInfoCompute["".concat(bd_r,"_").concat(bd_c)].t){var linetype=borderInfoCompute["".concat(bd_r,"_").concat(bd_c)].t.style;var bcolor=borderInfoCompute["".concat(bd_r,"_").concat(bd_c)].t.color;if(lodash.isNil(bt_obj.style[linetype])){bt_obj.style[linetype]=1;}else {bt_obj.style[linetype]+=1;}if(lodash.isNil(bt_obj.color[bcolor])){bt_obj.color[bcolor]=1;}else {bt_obj.color[bcolor]+=1;}}if(bd_r===r+cell.mc.rs-1&&borderInfoCompute["".concat(bd_r,"_").concat(bd_c)]&&borderInfoCompute["".concat(bd_r,"_").concat(bd_c)].b){var _linetype=borderInfoCompute["".concat(bd_r,"_").concat(bd_c)].b.style;var _bcolor=borderInfoCompute["".concat(bd_r,"_").concat(bd_c)].b.color;if(lodash.isNil(bb_obj.style[_linetype])){bb_obj.style[_linetype]=1;}else {bb_obj.style[_linetype]+=1;}if(lodash.isNil(bb_obj.color[_bcolor])){bb_obj.color[_bcolor]=1;}else {bb_obj.color[_bcolor]+=1;}}if(bd_c===c&&borderInfoCompute["".concat(bd_r,"_").concat(bd_c)]&&borderInfoCompute["".concat(bd_r,"_").concat(bd_c)].l){var _linetype2=borderInfoCompute["".concat(r,"_").concat(c)].l.style;var _bcolor2=borderInfoCompute["".concat(bd_r,"_").concat(bd_c)].l.color;if(lodash.isNil(bl_obj.style[_linetype2])){bl_obj.style[_linetype2]=1;}else {bl_obj.style[_linetype2]+=1;}if(lodash.isNil(bl_obj.color[_bcolor2])){bl_obj.color[_bcolor2]=1;}else {bl_obj.color[_bcolor2]+=1;}}if(bd_c===c+cell.mc.cs-1&&borderInfoCompute["".concat(bd_r,"_").concat(bd_c)]&&borderInfoCompute["".concat(bd_r,"_").concat(bd_c)].r){var _linetype3=borderInfoCompute["".concat(bd_r,"_").concat(bd_c)].r.style;var _bcolor3=borderInfoCompute["".concat(bd_r,"_").concat(bd_c)].r.color;if(lodash.isNil(br_obj.style[_linetype3])){br_obj.style[_linetype3]=1;}else {br_obj.style[_linetype3]+=1;}if(lodash.isNil(br_obj.color[_bcolor3])){br_obj.color[_bcolor3]=1;}else {br_obj.color[_bcolor3]+=1;}}}}var rowlen=cell.mc.rs;var collen=cell.mc.cs;if(JSON.stringify(bl_obj).length>23){var bl_color=null;var bl_style=null;Object.keys(bl_obj.color).forEach(function(x){if(bl_obj.color[x]>=rowlen/2){bl_color=x;}});Object.keys(bl_obj.style).forEach(function(x){if(bl_obj.style[x]>=rowlen/2){bl_style=x;}});if(!lodash.isNil(bl_color)&&!lodash.isNil(bl_style)){style+="border-left:".concat(getHtmlBorderStyle(bl_style,bl_color));}}if(JSON.stringify(br_obj).length>23){var br_color=null;var br_style=null;Object.keys(br_obj.color).forEach(function(x){if(br_obj.color[x]>=rowlen/2){br_color=x;}});Object.keys(br_obj.style).forEach(function(x){if(br_obj.style[x]>=rowlen/2){br_style=x;}});if(!lodash.isNil(br_color)&&!lodash.isNil(br_style)){style+="border-right:".concat(getHtmlBorderStyle(br_style,br_color));}}if(JSON.stringify(bt_obj).length>23){var bt_color=null;var bt_style=null;Object.keys(bt_obj.color).forEach(function(x){if(bt_obj.color[x]>=collen/2){bt_color=x;}});Object.keys(bt_obj.style).forEach(function(x){if(bt_obj.style[x]>=collen/2){bt_style=x;}});if(!lodash.isNil(bt_color)&&!lodash.isNil(bt_style)){style+="border-top:".concat(getHtmlBorderStyle(bt_style,bt_color));}}if(JSON.stringify(bb_obj).length>23){var bb_color=null;var bb_style=null;Object.keys(bb_obj.color).forEach(function(x){if(bb_obj.color[x]>=collen/2){bb_color=x;}});Object.keys(bb_obj.style).forEach(function(x){if(bb_obj.style[x]>=collen/2){bb_style=x;}});if(!lodash.isNil(bb_color)&&!lodash.isNil(bb_style)){style+="border-bottom:".concat(getHtmlBorderStyle(bb_style,bb_color));}}}}else {return 1;// continue
|