@univerjs/preset-sheets-conditional-formatting 0.17.0 → 0.18.0
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/lib/index.css +1 -1
- package/lib/umd/index.js +129 -7
- package/lib/umd/locales/ca-ES.js +1 -2
- package/lib/umd/locales/en-US.js +1 -2
- package/lib/umd/locales/es-ES.js +1 -2
- package/lib/umd/locales/fa-IR.js +1 -2
- package/lib/umd/locales/fr-FR.js +1 -2
- package/lib/umd/locales/ja-JP.js +1 -2
- package/lib/umd/locales/ko-KR.js +1 -2
- package/lib/umd/locales/ru-RU.js +1 -2
- package/lib/umd/locales/sk-SK.js +1 -2
- package/lib/umd/locales/vi-VN.js +1 -2
- package/lib/umd/locales/zh-CN.js +1 -2
- package/lib/umd/locales/zh-TW.js +1 -2
- package/package.json +5 -5
package/lib/umd/index.js
CHANGED
|
@@ -1,16 +1,138 @@
|
|
|
1
1
|
// @univerjs/sheets-conditional-formatting/index
|
|
2
|
-
(function(f,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("rxjs"),require("@univerjs/engine-formula"),require("rxjs/operators"),require("@univerjs/engine-render")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","rxjs","@univerjs/engine-formula","rxjs/operators","@univerjs/engine-render"],d):(f=typeof globalThis<"u"?globalThis:f||self,d(f.UniverSheetsConditionalFormatting={},f.UniverCore,f.UniverSheets,f.rxjs,f.UniverEngineFormula,f.rxjs.operators,f.UniverEngineRender))})(this,(function(f,d,F,J,E,i2,Z){"use strict";var A0=Object.defineProperty;var y0=(f,d,F)=>d in f?A0(f,d,{enumerable:!0,configurable:!0,writable:!0,value:F}):f[d]=F;var w=(f,d,F)=>y0(f,typeof d!="symbol"?d+"":d,F);const c2="SHEET_CONDITIONAL_FORMATTING_PLUGIN";var T=(s=>(s.beginsWith="beginsWith",s.endsWith="endsWith",s.containsText="containsText",s.notContainsText="notContainsText",s.equal="equal",s.notEqual="notEqual",s.containsBlanks="containsBlanks",s.notContainsBlanks="notContainsBlanks",s.containsErrors="containsErrors",s.notContainsErrors="notContainsErrors",s))(T||{}),B=(s=>(s.today="today",s.yesterday="yesterday",s.tomorrow="tomorrow",s.last7Days="last7Days",s.thisMonth="thisMonth",s.lastMonth="lastMonth",s.nextMonth="nextMonth",s.thisWeek="thisWeek",s.lastWeek="lastWeek",s.nextWeek="nextWeek",s))(B||{}),p=(s=>(s.greaterThan="greaterThan",s.greaterThanOrEqual="greaterThanOrEqual",s.lessThan="lessThan",s.lessThanOrEqual="lessThanOrEqual",s.notBetween="notBetween",s.between="between",s.equal="equal",s.notEqual="notEqual",s))(p||{}),S=(s=>(s.highlightCell="highlightCell",s.dataBar="dataBar",s.colorScale="colorScale",s.iconSet="iconSet",s))(S||{}),y=(s=>(s.uniqueValues="uniqueValues",s.duplicateValues="duplicateValues",s.rank="rank",s.text="text",s.timePeriod="timePeriod",s.number="number",s.average="average",s.formula="formula",s))(y||{}),x=(s=>(s.num="num",s.min="min",s.max="max",s.percent="percent",s.percentile="percentile",s.formula="formula",s))(x||{});const Y2="#fff",K2="#000000",X2=()=>({cfId:void 0,ranges:[],stopIfTrue:!1,rule:{type:"highlightCell",subType:"text",operator:"containsText"}}),J2=(s,r)=>{switch(s){case"text":{if(["beginsWith","containsText","endsWith","equal","notContainsText","notEqual"].includes(r))return"";break}case"number":return["between","notBetween"].includes(r)?[10,100]:10}return""},z2=(s,r)=>{switch(s){case"formula":return"=";case"max":case"min":return"";case"percent":case"percentile":case"num":return r!==void 0?r:10}return""},O=(s,r,n)=>{if(!r)return null;const e=r.findIndex(t=>n(t)===s.id);if(e<0)return null;switch(s.type){case"after":return e+1;case"before":return e-1;case"self":return e}},w2=(s,r,n,e)=>{if(!n)return null;const t=O(s,n,e);let i=O(r,n,e);if(t===null||i===null||t===i)return;const a=n.splice(t,1)[0];switch(t<i&&(i=O(r,n,e)),r.type){case"before":{n.splice(i+1,0,a);break}case"self":case"after":{n.splice(i,0,a);break}}},d2=(s,r,n,e)=>{if(s.type==="after"&&["after","before"].includes(r.type))return[s,r];const t={...s},i={...r};if(t.type!=="after"){const a=O(t,n,e);if(a===null)return null;if(a-1<0){const o=n[a+1];if(o)t.id=e(o),t.type="before";else return null}else{const o=e(n[a-1]);t.id=o,t.type="after"}}if(!["after","before"].includes(i.type)){const a=O(i,n,e);if(a===null)return null;if(a===0)i.type="before";else if(a-1>=0){const o=e(n[a-1]);i.id=o,i.type="after"}else if(a+1<=n.length-1){const o=e(n[a+1]);i.id=o,i.type="before"}else return null}return t.id===i.id&&t.type===i.type?null:[t,i]},E2=(s,r)=>{if(["after","before"].includes(r.type)){if(s.type==="after")return[r,s];if(s.type==="before")return[r,{...s,type:"self"}]}return null},Q2=(s,r)=>s.id===r.id&&s.type===r.type,p2=()=>`${d.generateRandomId(8)}`;class I{constructor(){w(this,"_model",new Map);w(this,"_ruleChange$",new J.Subject);w(this,"$ruleChange",this._ruleChange$.asObservable())}_ensureList(r,n){let e=this.getSubunitRules(r,n);if(!e){e=[];let t=this._model.get(r);t||(t=new Map,this._model.set(r,t)),t.set(n,e)}return e}getRule(r,n,e){const t=this.getSubunitRules(r,n);return t?t.find(i=>i.cfId===e):null}getUnitRules(r){return this._model.get(r)||null}getSubunitRules(r,n){var t;return((t=this._model.get(r))==null?void 0:t.get(n))||null}getAll(){return this._model}deleteRule(r,n,e){const t=this.getSubunitRules(r,n);if(t){const i=t.findIndex(o=>o.cfId===e),a=t[i];a&&(t.splice(i,1),this._ruleChange$.next({rule:a,subUnitId:n,unitId:r,type:"delete"}))}}setRule(r,n,e,t){const a=this._ensureList(r,n).find(o=>o.cfId===t);if(a){const o=d.Tools.deepClone(a);Object.assign(a,e),this._ruleChange$.next({rule:a,subUnitId:n,unitId:r,type:"set",oldRule:o})}}addRule(r,n,e){const t=this._ensureList(r,n);t.find(a=>a.cfId===e.cfId)||t.unshift(e),this._ruleChange$.next({rule:e,subUnitId:n,unitId:r,type:"add"})}moveRulePriority(r,n,e,t){const i=this._ensureList(r,n),a=O(e,i,l=>l.cfId),o=O(t,i,l=>l.cfId);if(o===null||a===null||o===a)return;const h=i[a];h&&(w2(e,t,i,l=>l.cfId),this._ruleChange$.next({rule:h,subUnitId:n,unitId:r,type:"sort"}))}createCfId(r,n){return p2()}deleteUnitId(r){this._model.delete(r)}}const G={type:d.CommandType.MUTATION,id:"sheet.mutation.move-conditional-rule",handler(s,r){if(!r)return!1;const{unitId:n,subUnitId:e,start:t,end:i}=r;return s.get(I).moveRulePriority(n,e,t,i),!0}},A2=s=>{const{unitId:r,subUnitId:n}=s,e=E2(s.start,s.end);if(!e)return[];const[t,i]=e;return[{id:G.id,params:{unitId:r,subUnitId:n,start:t,end:i}}]},z=(s,r)=>{const n=s.get(I),{unitId:e,subUnitId:t,cfId:i}=r,a=[...n.getSubunitRules(e,t)||[]],o=a.findIndex(l=>l.cfId===i),h=a[o-1];if(o>-1){const l=a[o],c=[{id:H.id,params:{unitId:e,subUnitId:t,rule:d.Tools.deepClone(l)}}];if(a.splice(o,1),o!==0){const u=a[0];if(u){const g=d2({id:u.cfId,type:"before"},{id:h.cfId,type:"after"},a,A=>A.cfId);if(!g)return c;const[C,D]=g,v={unitId:e,subUnitId:t,start:C,end:D};c.push({id:G.id,params:v})}}return c}return[]},j={type:d.CommandType.MUTATION,id:"sheet.mutation.delete-conditional-rule",handler(s,r){if(!r)return!1;const{unitId:n,subUnitId:e,cfId:t}=r;return s.get(I).deleteRule(n,e,t),!0}},h2=(s,r)=>({id:j.id,params:{unitId:r.unitId,subUnitId:r.subUnitId,cfId:r.rule.cfId}}),H={type:d.CommandType.MUTATION,id:"sheet.mutation.add-conditional-rule",handler(s,r){if(!r)return!1;const{unitId:n,subUnitId:e,rule:t}=r;return s.get(I).addRule(n,e,t),!0}},y2={type:d.CommandType.COMMAND,id:"sheet.command.add-conditional-rule",handler(s,r){if(!r)return!1;const{rule:n}=r,e=s.get(d.IUndoRedoService),t=s.get(d.ICommandService),i=s.get(I),a=s.get(d.IUniverInstanceService),o=F.getSheetCommandTarget(a,r);if(!o)return!1;const{unitId:h,subUnitId:l}=o,c=i.createCfId(h,l),u={unitId:h,subUnitId:l,rule:{...n,cfId:n.cfId||c}},g=h2(s,u),C=t.syncExecuteCommand(H.id,u);return C&&e.pushUndoRedo({unitID:h,redoMutations:[{id:H.id,params:u}],undoMutations:[g]}),C}},Y={type:d.CommandType.MUTATION,id:"sheet.mutation.set-conditional-rule",handler(s,r){if(!r)return!1;const{unitId:n,subUnitId:e,rule:t}=r,i=r.cfId||r.rule.cfId;return s.get(I).setRule(n,e,t,i),!0}},g2=(s,r)=>{const n=s.get(I),{unitId:e,subUnitId:t}=r,i=r.cfId||r.rule.cfId,a=n.getRule(e,t,i);return a?[{id:Y.id,params:{unitId:e,subUnitId:t,cfId:i,rule:d.Tools.deepClone(a)}}]:[]},_2={type:d.CommandType.COMMAND,id:"sheet.command.clear-range-conditional-rule",handler(s,r){var v;if(!r)return!1;const n=s.get(I),e=s.get(d.IUniverInstanceService),t=s.get(d.ICommandService),i=s.get(d.IUndoRedoService),a=s.get(F.SheetsSelectionsService),o=F.getSheetCommandTarget(e,r);if(!o)return!1;const{unitId:h,subUnitId:l}=o,c=((v=a.getCurrentSelections())==null?void 0:v.map(A=>A.range))||[],u=n.getSubunitRules(h,l);if(!(u!=null&&u.length)||!c.length)return!1;const g=[],C=[];u.forEach(A=>{const _=new d.ObjectMatrix;A.ranges.forEach(M=>{d.Range.foreach(M,(L,k)=>{_.setValue(L,k,1)})}),c.forEach(M=>{d.Range.foreach(M,(L,k)=>{_.realDeleteValue(L,k)})});const b=F.findAllRectangle(F.createTopMatrixFromMatrix(_));if(b.length){const M={...A,ranges:b},L={unitId:h,subUnitId:l,rule:M},k=g2(s,L);g.push({id:Y.id,params:L}),C.push(...k)}else{const M={unitId:h,subUnitId:l,cfId:A.cfId},L=z(s,M);g.push({id:j.id,params:M}),C.push(...L)}});const D=d.sequenceExecute(g,t).result;return D&&i.pushUndoRedo({unitID:h,redoMutations:g,undoMutations:C}),D}},M2={type:d.CommandType.COMMAND,id:"sheet.command.clear-worksheet-conditional-rule",handler(s,r){const n=s.get(I),e=s.get(d.IUniverInstanceService),t=s.get(d.ICommandService),i=s.get(d.IUndoRedoService),a=F.getSheetCommandTarget(e,r);if(!a)return!1;const{unitId:o,subUnitId:h}=a,l=n.getSubunitRules(o,h);if(!(l!=null&&l.length))return!1;const c=l.map(D=>({cfId:D.cfId,unitId:o,subUnitId:h})),u=c.map(D=>({id:j.id,params:D})),g=c.map(D=>z(s,D)[0]),C=d.sequenceExecute(u,t).result;return C&&i.pushUndoRedo({unitID:o,redoMutations:u,undoMutations:g}),C}},R2={type:d.CommandType.COMMAND,id:"sheet.command.delete-conditional-rule",handler(s,r){if(!r)return!1;const n=s.get(d.IUndoRedoService),e=s.get(d.ICommandService),t=s.get(d.IUniverInstanceService),i=F.getSheetCommandTarget(t,r);if(!i)return!1;const{unitId:a,subUnitId:o}=i,h={unitId:a,subUnitId:o,cfId:r.cfId},l=z(s,h),c=e.syncExecuteCommand(j.id,h);return c&&n.pushUndoRedo({unitID:a,undoMutations:l,redoMutations:[{id:j.id,params:h}]}),c}},S2={type:d.CommandType.COMMAND,id:"sheet.command.move-conditional-rule",handler(s,r){if(!r)return!1;const n=s.get(d.IUndoRedoService),e=s.get(d.ICommandService),t=s.get(d.IUniverInstanceService),i=s.get(I),a=F.getSheetCommandTarget(t,r);if(!a)return!1;const{unitId:o,subUnitId:h}=a,l=d2(r.start,r.end,i.getSubunitRules(o,h)||[],v=>v.cfId);if(!l)return!1;const[c,u]=l,g={unitId:o,subUnitId:h,start:c,end:u},C=A2(g),D=e.syncExecuteCommand(G.id,g);return D&&n.pushUndoRedo({unitID:o,redoMutations:[{id:G.id,params:g}],undoMutations:C}),D}},I2={type:d.CommandType.COMMAND,id:"sheet.command.set-conditional-rule",handler(s,r){if(!r)return!1;const n=s.get(d.IUndoRedoService),e=s.get(d.ICommandService),t=s.get(d.IUniverInstanceService),i=F.getSheetCommandTarget(t,r);if(!i)return!1;const{unitId:a,subUnitId:o}=i,h={unitId:a,subUnitId:o,rule:r.rule,cfId:r.cfId},l=g2(s,h),c=e.syncExecuteCommand(Y.id,h);return c&&n.pushUndoRedo({unitID:a,undoMutations:l,redoMutations:[{id:Y.id,params:h}]}),c}};var e0=Object.getOwnPropertyDescriptor,t0=(s,r,n,e)=>{for(var t=e>1?void 0:e?e0(r,n):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(t=a(t)||t);return t},x2=(s,r)=>(n,e)=>r(n,e,s);f.ConditionalFormattingFormulaService=class extends d.Disposable{constructor(n,e){super();w(this,"_formulaMap",new Map);w(this,"_result$",new J.Subject);w(this,"result$",this._result$.asObservable());this._registerOtherFormulaService=n,this._conditionalFormattingRuleModel=e,this._initFormulaResultChange(),this._initRuleChange()}_initRuleChange(){const n=e=>{switch(e.type){case S.colorScale:return e.config.some(t=>t.value.type===x.formula);case S.dataBar:return[e.config.max,e.config.min].some(t=>t.type===x.formula);case S.iconSet:return e.config.some(t=>t.value.type===x.formula)}};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(e=>{const{unitId:t,subUnitId:i,rule:a,oldRule:o}=e;e.type==="delete"&&this._removeFormulaByCfId(t,i,a.cfId),e.type==="set"&&(n(a.rule)||o&&n(o.rule))&&this._removeFormulaByCfId(t,i,a.cfId),e.type==="add"&&this._registerRuleFormulas(t,i,a)}))}_registerRuleFormulas(n,e,t){switch(t.rule.type){case S.highlightCell:{if(t.rule.subType===y.formula){const i=t.rule.value;i&&this.registerFormulaWithRange(n,e,t.cfId,i,t.ranges)}break}}}_initFormulaResultChange(){this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe(n=>{for(const e in n)for(const t in n[e]){const i=n[e][t];for(const a of i){const o=this._ensureSubunitFormulaMap(e,t).getValue(a.formulaId,["formulaId"]);if(!o)continue;const l=this._getAllFormulaResultByCfId(e,t,o.cfId).every(c=>{const u=this._registerOtherFormulaService.getFormulaValueSync(e,t,c.formulaId);return(u==null?void 0:u.status)===E.FormulaResultStatus.SUCCESS});this._result$.next({...o,isAllFinished:l})}}}))}_ensureSubunitFormulaMap(n,e){let t=this._formulaMap.get(n);t||(t=new Map,this._formulaMap.set(n,t));let i=t.get(e);return i||(i=new d.RefAlias([],["formulaId","id"]),t.set(e,i)),i}getSubUnitFormulaMap(n,e){var t;return(t=this._formulaMap.get(n))==null?void 0:t.get(e)}registerFormulaWithRange(n,e,t,i,a=[{startRow:0,endRow:0,startColumn:0,endColumn:0}]){const o=this._ensureSubunitFormulaMap(n,e),h=this.createCFormulaId(t,i);if(o.getValue(h,["id"]))return;const l=this._registerOtherFormulaService.registerFormulaWithRange(n,e,i,a,void 0,E.OtherFormulaBizType.CONDITIONAL_FORMATTING,t);o.addValue({formulaText:i,unitId:n,subUnitId:e,cfId:t,id:h,formulaId:l})}_removeFormulaByCfId(n,e,t){const a=this.deleteCache(n,e,t).map(o=>o.formulaId);this._registerOtherFormulaService.deleteFormula(n,e,a)}getFormulaResultWithCoords(n,e,t,i,a=0,o=0){var u;const h=this.getSubUnitFormulaMap(n,e);if(!h)return{status:E.FormulaResultStatus.NOT_REGISTER};const l=h.getValue(this.createCFormulaId(t,i),["id"]);if(!l)return{status:E.FormulaResultStatus.NOT_REGISTER};const c=this._registerOtherFormulaService.getFormulaValueSync(n,e,l.formulaId);if(!c)return{status:E.FormulaResultStatus.NOT_REGISTER};if(c.status===E.FormulaResultStatus.SUCCESS&&c.result){const g=(u=c.result[a])==null?void 0:u[o];return{result:this._getCellValue(g),status:E.FormulaResultStatus.SUCCESS}}return{status:c.status}}getFormulaMatrix(n,e,t,i){const a=this.getSubUnitFormulaMap(n,e);if(!a)return{status:E.FormulaResultStatus.NOT_REGISTER};const o=a.getValue(this.createCFormulaId(t,i),["id"]);if(!o)return{status:E.FormulaResultStatus.NOT_REGISTER};const h=this._registerOtherFormulaService.getFormulaValueSync(n,e,o.formulaId);if(!h)return{status:E.FormulaResultStatus.NOT_REGISTER};if(h.status===E.FormulaResultStatus.SUCCESS&&h.result){const l=new d.ObjectMatrix;return new d.ObjectMatrix(h.result).forValue((u,g,C)=>{l.setValue(u,g,this._getCellValue(C))}),{result:l,status:E.FormulaResultStatus.SUCCESS}}return{status:h.status}}_getCellValue(n){if(!n||!n[0]||!n[0][0])return!1;const e=n[0][0];return(e==null?void 0:e.t)===d.CellValueType.BOOLEAN?e.v===d.BooleanNumber.TRUE||e.v===!0:e==null?void 0:e.v}deleteCache(n,e,t,i){const a=this.getSubUnitFormulaMap(n,e);if(!a)return[];if(i){const o=this.createCFormulaId(t,i);return a.deleteValue(o,["id"]),[]}else{const o=a.getValues().filter(h=>h.cfId===t);return o.forEach(h=>{a.deleteValue(h.formulaId,["formulaId"])}),o}}_getAllFormulaResultByCfId(n,e,t){const i=this.getSubUnitFormulaMap(n,e);return i?i.getValues().filter(o=>o.cfId===t):[]}createCFormulaId(n,e){return`${n}_${e}`}},f.ConditionalFormattingFormulaService=t0([x2(0,d.Inject(E.RegisterOtherFormulaService)),x2(1,d.Inject(I))],f.ConditionalFormattingFormulaService);var U=(s=>(s.preComputingStart="preComputingStart",s.preComputing="preComputing",s.preComputingEnd="preComputingEnd",s.preComputingError="preComputingError",s))(U||{});class s2{constructor(r){w(this,"_cache");w(this,"_preComputingStatus$",new J.BehaviorSubject("preComputingStart"));w(this,"preComputingStatus$",this._preComputingStatus$.asObservable().pipe(i2.distinctUntilChanged()));w(this,"_preComputingCache");w(this,"_rule");this._context=r,this._cache=new d.LRUMap(r.limit),this._rule=r.rule,this._preComputingCache=null,this._initClearCacheListener()}setCacheLength(r){this._cache.limit=r}clearCache(){this._cache.clear()}resetPreComputingCache(){this._preComputingStatus$.next("preComputingStart"),this._preComputingCache=null}updateRule(r){this._rule=r,this.resetPreComputingCache()}getCell(r,n){const e=this._createKey(r,n);if(this._preComputingStatus$.getValue()==="preComputing")return this._cache.get(e);let t=this.getPreComputingResult(r,n);if(t===null&&(this._preComputingStatus$.next("preComputingStart"),this.preComputing(r,n,this._getContext()),t=this.getPreComputingResult(r,n),t===null))return this._cache.get(e);if(this._preComputingStatus$.next("preComputingEnd"),this._cache.has(e))return this._cache.get(e);const i=this.getCellResult(r,n,t,this._getContext());return i!==null&&this._setCache(r,n,i),i}setPreComputingCache(r){this._preComputingCache=r}getPreComputingResult(r,n){return this._preComputingCache}_createKey(r,n){return`${r}_${n}`}_setCache(r,n,e){const t=this._createKey(r,n);this._cache.set(t,e)}_getContext(){return{...this._context,rule:this._rule}}_initClearCacheListener(){this.preComputingStatus$.subscribe(r=>{r==="preComputingEnd"&&this.clearCache()})}}class n0 extends s2{preComputing(r,n,e){const t=e.rule,i=e.worksheet,a=new d.ObjectMatrix;!t.rule.config.every(c=>c.value.type===x.num)&&t2(t.ranges,i.getMaxRows()-1,i.getMaxColumns()-1).forEach(u=>{d.Range.foreach(u,(g,C)=>{const D=e.getCellValue(g,C),v=D&&D.v;if(!R(v)&&(D==null?void 0:D.t)===d.CellValueType.NUMBER){const A=Number(v);!Number.isNaN(A)&&a.setValue(g,C,A)}})});const h=[...t.rule.config].sort((c,u)=>c.index-u.index).map(c=>({value:e2(c.value,a,{...e,cfId:t.cfId}),color:new d.ColorKit(c.color)}));if(!h.some(c=>Z.isObject(c.value)?c.value.status!==E.FormulaResultStatus.SUCCESS:!1)){const c=h.map(u=>u.color).reduce((u,g,C)=>(u.result.push({color:g,value:u.sortValue[C]}),u),{result:[],sortValue:h.map(u=>u.value.result).sort((u,g)=>u-g)}).result;this.setPreComputingCache(c),this._preComputingStatus$.next(U.preComputingEnd);return}this._preComputingStatus$.next(U.preComputing)}getCellResult(r,n,e,t){if(!e)return null;const i=t.getCellValue(r,n);if(i.t===d.CellValueType.NUMBER){const a=Number(i.v);if(!Number.isNaN(a))return N2(e,a)}}}const b2="sheet-conditional-rule-data-bar",C2="#ffbe38",f2="#abd91a",L2="#000",i0=34,s0=s=>{const{startRow:r,endRow:n,startColumn:e,endColumn:t}=s;return`${r}-${n}-${e}-${t}`};class T2 extends Z.SheetExtension{constructor(){super(...arguments);w(this,"_paddingRightAndLeft",2);w(this,"_paddingTopAndBottom",2);w(this,"uKey",b2);w(this,"Z_INDEX",i0);w(this,"_radius",1)}draw(n,e,t,i){const{worksheet:a}=t;if(!a)return!1;const o=new Set;n.save(),d.Range.foreach(t.rowColumnSegment,(h,l)=>{if(!a.getRowVisible(h)||!a.getColVisible(l))return;const c=t.getCellWithCoordByIndex(h,l,!1),{isMerged:u,isMergedMainCell:g,mergeInfo:C}=c;let D=a.getCell(h,l);if(u&&(D=a.getCell(C.startRow,C.startColumn)),!(D!=null&&D.dataBar)||!this.isRenderDiffRangesByCell(C,i))return;if(u||g){const V=s0(C);if(o.has(V))return;o.add(V)}const{color:v,value:A,startPoint:_,isGradient:b}=D.dataBar,{startX:M,endX:L,startY:k,endY:v2}=u||g?C:c,u2=L-M,F2=v2+Z.FIX_ONE_PIXEL_BLUR_OFFSET-k,$=u2-this._paddingRightAndLeft*2,H2=F2-this._paddingTopAndBottom*2;if(A>0){const V=Math.max($*(1-_/100)*A/100,1),P=M+this._paddingRightAndLeft+_/100*$,W=k+this._paddingTopAndBottom;if(b){const q=n.createLinearGradient(P,W,P+V,W);q.addColorStop(0,v),q.addColorStop(1,"rgb(255 255 255)"),n.fillStyle=q,n.strokeStyle=v,n.lineWidth=1}else n.fillStyle=v;this._drawRectWithRoundedCorner(n,P,W,V,H2,!1,!0,!0,!1),b&&n.stroke()}else{const V=Math.max($*_/100*Math.abs(A)/100,1),P=M+this._paddingRightAndLeft+_/100*$-V,W=k+this._paddingTopAndBottom;if(b){const q=n.createLinearGradient(P,W,P+V,W);q.addColorStop(0,"rgb(255 255 255)"),q.addColorStop(1,v),n.fillStyle=q,n.strokeStyle=v,n.lineWidth=1}else n.fillStyle=v;this._drawRectWithRoundedCorner(n,P,W,V,H2,!0,!1,!1,!0),b&&n.stroke()}}),n.restore()}_drawRectWithRoundedCorner(n,e,t,i,a,o,h,l,c){const u=this._radius;!a||!i||(n.beginPath(),n.moveTo(e+u,t),n.lineTo(e+i-u,t),h?n.arcTo(e+i,t,e+i,t+u,u):n.lineTo(e+i,t),n.lineTo(e+i,t+a-u),l?n.arcTo(e+i,t+a,e+i-u,t+a,u):n.lineTo(e+i,t+a),n.lineTo(e+u,t+a),c?n.arcTo(e,t+a,e,t+a-u,u):n.lineTo(e,t+a),n.lineTo(e,t+u),o?n.arcTo(e,t,e+u,t,u):n.lineTo(e,t),n.closePath(),n.fill())}}Z.SpreadsheetExtensionRegistry.add(T2);const r2=s=>Math.max(Math.min(100,s),0),r0=(s,r,n)=>{const e=n(s,r);if(e&&e.t===d.CellValueType.NUMBER){const t=Number(e.v);return Number.isNaN(t)?null:t}return null};class a0 extends s2{preComputing(r,n,e){const t=e.rule,i=t.rule,a=e.worksheet,o=new d.ObjectMatrix;![t.rule.config.max,t.rule.config.min].every(C=>C.type===x.num)&&t2(t.ranges,a.getMaxRows()-1,a.getMaxColumns()-1).forEach(D=>{d.Range.foreach(D,(v,A)=>{const _=e.getCellValue(v,A),b=_&&_.v;if(!R(b)&&(_==null?void 0:_.t)===d.CellValueType.NUMBER){const M=Number(b);!Number.isNaN(M)&&o.setValue(v,A,M)}})});const l=e2(i.config.min,o,{...e,cfId:t.cfId}),c=e2(i.config.max,o,{...e,cfId:t.cfId});let u=0,g=0;if(l.status===E.FormulaResultStatus.SUCCESS){const C=Number(l.result);u=Number.isNaN(C)?0:C}else{this._preComputingStatus$.next(U.preComputing);return}if(c.status===E.FormulaResultStatus.SUCCESS){const C=Number(c.result),D=Number.isNaN(C)?0:C;g=Math.max(D,u),u=Math.min(D,u);let v=50;if(u<0&&g<=0)v=100;else if(u<0&&g>0){const A=Math.abs(g)+Math.abs(u);v=Math.abs(u)/A*100}else u>=0&&g>0&&(v=0);this.setPreComputingCache({min:u,max:g,startPoint:v}),this._preComputingStatus$.next(U.preComputingEnd);return}this._preComputingStatus$.next(U.preComputing)}getCellResult(r,n,e,t){const{min:i,max:a,startPoint:o}=e,l=t.rule.rule,c=l.isShowValue,u=l.config.isGradient,g=r0(r,n,t.getCellValue);if(!(g===null||g<i||i===a||a<i)){if(g===0)return{color:L2,startPoint:o,value:0,isGradient:u,isShowValue:c};if(i<0&&a<=0){const C=a-i,D=r2((a-g)/C*100);return D===0?void 0:{color:l.config.nativeColor||f2,startPoint:o,value:-D,isGradient:u,isShowValue:c}}else if(i<0&&a>0)if(g>0){const C=r2(Math.min(g/a,1)*100);return C===0?void 0:{color:l.config.positiveColor||C2,startPoint:o,value:C,isGradient:u,isShowValue:c}}else{const C=r2(Math.min(Math.abs(g)/Math.abs(i),1)*100);return C===0?void 0:{color:l.config.nativeColor||f2,startPoint:o,value:-C,isGradient:u,isShowValue:c}}else if(i>=0&&a>0){const C=a-i,D=0,v=r2((1-(a-g)/C)*100);return v===0?void 0:{color:l.config.positiveColor||C2,startPoint:D,value:v,isGradient:u,isShowValue:c}}}}}class l0 extends s2{preComputing(r,n,e){const t=e.rule.rule,i=t2(e.rule.ranges,e.worksheet.getMaxRows()-1,e.worksheet.getMaxColumns()-1),o=(()=>{switch(t.subType){case y.average:{let h=0,l=0;return i.forEach(c=>{d.Range.foreach(c,(u,g)=>{const C=e.getCellValue(u,g),D=N(C);C&&C.t===d.CellValueType.NUMBER&&!R(D)&&(h+=Number(D)||0,l++)})}),{value:h/l,type:t.subType}}case y.uniqueValues:case y.duplicateValues:{const h=new Map;return i.forEach(l=>{d.Range.foreach(l,(c,u)=>{const g=e.getCellValue(c,u),C=N(g);if(!R(C)){const D=h.get(C);D?h.set(C,D+1):h.set(C,1)}})}),{value:h,type:t.subType}}case y.rank:{let h=[];i.forEach(u=>{d.Range.foreach(u,(g,C)=>{const D=e.getCellValue(g,C),v=N(D);D&&D.t===d.CellValueType.NUMBER&&!R(v)&&h.push(Number(v)||0)})}),h.sort((u,g)=>g-u);const l=e.rule.rule;if(l.isPercent){l.isBottom&&(h=h.toReversed());const u=d.Tools.clamp(l.value,0,100)/100,g=Math.floor(u*h.length),C=d.Tools.clamp(g-1,0,h.length-1);return{value:h[C],type:t.subType}}const c=Math.floor(d.Tools.clamp(l.isBottom?l.value-1:l.value,0,h.length));return l.isBottom?{value:h[h.length-c-1],type:t.subType}:{value:h[Math.max(c-1,0)],type:t.subType}}case y.formula:{const h=t,l=e.accessor.get(f.ConditionalFormattingFormulaService);l.registerFormulaWithRange(e.unitId,e.subUnitId,e.rule.cfId,h.value,e.rule.ranges);const c=l.getFormulaMatrix(e.unitId,e.subUnitId,e.rule.cfId,h.value);return c&&c.status===E.FormulaResultStatus.SUCCESS?(this._preComputingStatus$.next(U.preComputingEnd),{value:c.result,type:t.subType}):(this._preComputingStatus$.next(U.preComputing),null)}case y.timePeriod:switch(t.operator){case B.last7Days:return{value:{start:d.dayjs().subtract(7,"day").valueOf(),end:d.dayjs().valueOf()},type:t.subType};case B.lastMonth:return{value:{start:d.dayjs().startOf("month").subtract(1,"month").valueOf(),end:d.dayjs().endOf("month").subtract(1,"month").valueOf()},type:t.subType};case B.lastWeek:return{value:{start:d.dayjs().startOf("week").subtract(1,"week").valueOf(),end:d.dayjs().endOf("week").subtract(1,"week").valueOf()},type:t.subType};case B.nextMonth:return{value:{start:d.dayjs().startOf("month").add(1,"month").valueOf(),end:d.dayjs().endOf("month").add(1,"month").valueOf()},type:t.subType};case B.nextWeek:return{value:{start:d.dayjs().startOf("week").add(1,"week").valueOf(),end:d.dayjs().endOf("week").add(1,"week").valueOf()},type:t.subType};case B.thisMonth:return{value:{start:d.dayjs().startOf("month").valueOf(),end:d.dayjs().endOf("month").valueOf()},type:t.subType};case B.thisWeek:return{value:{start:d.dayjs().startOf("week").valueOf(),end:d.dayjs().endOf("week").valueOf()},type:t.subType};case B.today:return{value:{start:d.dayjs().startOf("day").valueOf(),end:d.dayjs().endOf("day").valueOf()},type:t.subType};case B.tomorrow:return{value:{start:d.dayjs().startOf("day").add(1,"day").valueOf(),end:d.dayjs().endOf("day").add(1,"day").valueOf()},type:t.subType};case B.yesterday:return{value:{start:d.dayjs().startOf("day").subtract(1,"day").valueOf(),end:d.dayjs().endOf("day").subtract(1,"day").valueOf()},type:t.subType}}}})();this.setPreComputingCache(o)}getCellResult(r,n,e,t){const i=t.getCellValue(r,n),a=t.rule.rule;return(()=>{switch(a.subType){case y.number:{const l=i&&Number(i.v),c=(i==null?void 0:i.t)===d.CellValueType.NUMBER,u=a;return c?R(l)||Number.isNaN(l)?void 0:K({operator:u.operator,value:u.value||0},l||0):!![p.notEqual,p.notBetween].includes(u.operator)}case y.text:{const l=a,c=N(i),u=R(c)?"":String(c),g=l.value||"";switch(l.operator){case T.beginsWith:return u.startsWith(g);case T.containsBlanks:return/^\s*$/.test(u);case T.notContainsBlanks:return!/^\s*$/.test(u);case T.containsErrors:return E.ERROR_TYPE_SET.has(u);case T.notContainsErrors:return!E.ERROR_TYPE_SET.has(u);case T.containsText:return u.indexOf(g)>-1;case T.notContainsText:return u.indexOf(g)===-1;case T.endsWith:return u.endsWith(g);case T.equal:return u===g;case T.notEqual:return u!==g;default:return!1}}case y.timePeriod:{const l=N(i);if(R(l)||Number.isNaN(Number(l))||(i==null?void 0:i.t)!==d.CellValueType.NUMBER||!e)return;const c=k2(Number(l)),{start:u,end:g}=e.value;return c>=u&&c<=g}case y.average:{const l=i&&i.v,c=Number(l),u=(i==null?void 0:i.t)===d.CellValueType.NUMBER,g=a;if(!u)return p.notEqual===g.operator;if(R(l)||Number.isNaN(c)||!e)return!1;const C=e.value;switch(g.operator){case p.greaterThan:return c>C;case p.greaterThanOrEqual:return c>=C;case p.lessThan:return c<C;case p.lessThanOrEqual:return c<=C;case p.equal:return Q(c,C);case p.notEqual:return!Q(c,C);default:return!1}}case y.rank:{const l=N(i),c=Number(l);if(R(l)||Number.isNaN(c)||(i==null?void 0:i.t)!==d.CellValueType.NUMBER||!e)return!1;const u=e.value;return a.isBottom?c<=u:c>=u}case y.uniqueValues:{const l=N(i);return R(l)||!e?!1:e.value.get(l)===1}case y.duplicateValues:{const l=N(i);if(R(l)||!e)return!1;const c=e.value.get(l);return c&&c!==1}case y.formula:{const l=e==null?void 0:e.value;if(l){const c=t.rule.ranges[0],u=r-c.startRow,g=n-c.startColumn;return l.getValue(u,g)===!0}return!1}}})()?a.style:{}}}const o0=(s,r,n)=>{const e=n(s,r);if(e&&e.t===d.CellValueType.NUMBER){const t=Number(e.v);return Number.isNaN(t)?null:t}return null};class u0 extends s2{preComputing(r,n,e){const t=e.rule.rule,i=e.worksheet,a=new d.ObjectMatrix;!t.config.every(c=>c.value.type===x.num)&&t2(e.rule.ranges,i.getMaxRows()-1,i.getMaxColumns()-1).forEach(u=>{d.Range.foreach(u,(g,C)=>{const D=e.getCellValue(g,C),v=D&&D.v;if(!R(v)&&(D==null?void 0:D.t)===d.CellValueType.NUMBER){const A=Number(v);!Number.isNaN(A)&&a.setValue(g,C,A)}})});const h=t.config.map(c=>e2(c.value,a,{...e,cfId:e.rule.cfId}));if(!h.some(c=>c.status!==E.FormulaResultStatus.SUCCESS)){const c=h.map((u,g)=>({operator:t.config[g].operator,value:Number(u.result)||0})).reduce((u,g,C,D)=>{const v=t.config[C];if(!C||C===D.length-1)u.push({...g,iconId:v.iconId,iconType:v.iconType});else{const A=D[C-1];K(A,g.value)||u.push({...g,iconId:v.iconId,iconType:v.iconType})}return u},[]);this.setPreComputingCache(c),this._preComputingStatus$.next(U.preComputingEnd);return}this._preComputingStatus$.next(U.preComputing)}getCellResult(r,n,e,t){if(!e)return null;const i=o0(r,n,t.getCellValue);if(i===null)return;const a=t.rule.rule,o=a.isShowValue===void 0?!0:!!a.isShowValue;for(let h=0;h<e.length;h++){const l=e[h],c={...l},u={...l},{iconId:g,iconType:C}=l;if(h===0){if(K(l,i))return{iconId:g,iconType:C,isShowValue:o}}else{if(h===e.length-1)return{iconId:g,iconType:C,isShowValue:o};{const D=e[h-1];if(u.operator=U2(D.operator),u.value=D.value,K(c,i)&&K(u,i))return{iconId:g,iconType:C,isShowValue:o}}}}}}var c0=Object.getOwnPropertyDescriptor,d0=(s,r,n,e)=>{for(var t=e>1?void 0:e?c0(r,n):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(t=a(t)||t);return t},a2=(s,r)=>(n,e)=>r(n,e,s);const l2=1e3*3*3;f.ConditionalFormattingViewModel=class extends d.Disposable{constructor(n,e,t,i){super();w(this,"_calculateUnitManagers",new Map);w(this,"_rTreeManager",new d.RTree);w(this,"_cellCache",new d.LRUMap(l2));w(this,"_markDirty$",new J.Subject);w(this,"markDirty$",this._markDirty$.asObservable());w(this,"_markRuleDirtyAtOnce",(n,e,t,i=!0)=>{if(this._cellCache.clear(),i){const o=this._ensureCalculateUnitManager(n,e).get(t);o&&o.resetPreComputingCache()}this._markDirty$.next({unitId:n,subUnitId:e,cfId:t})});w(this,"markRuleDirty",(()=>{const n=new J.Subject;return this.disposeWithMe(n.pipe(i2.bufferTime(100),i2.filter(e=>!!e.length),i2.map(e=>{const t=new Set,i=[];return e.forEach(a=>{const o=`${a.unitId}_${a.subUnitId}_${a.cfId}`;if(t.has(o)){if(a.isNeedResetPreComputingCache){const h=i.find(l=>l.cfId===a.cfId);h.isNeedResetPreComputingCache=!0}return}t.add(o),i.push({...a})}),i})).subscribe(e=>{e.forEach(t=>{this._markRuleDirtyAtOnce(t.unitId,t.subUnitId,t.cfId,t.isNeedResetPreComputingCache)})})),(e,t,i,a=!0)=>{n.next({unitId:e,subUnitId:t,cfId:i,isNeedResetPreComputingCache:a})}})());this._injector=n,this._conditionalFormattingRuleModel=e,this._conditionalFormattingFormulaService=t,this._univerInstanceService=i,this._initRuleListener(),this._handleCustomFormulasSeparately(),this._initCFFormulaListener()}_initCFFormulaListener(){this.disposeWithMe(this._conditionalFormattingFormulaService.result$.subscribe(({unitId:n,subUnitId:e,cfId:t,isAllFinished:i})=>{i&&this._markRuleDirtyAtOnce(n,e,t,i)}))}getCellCfs(n,e,t,i){const a=this._createCacheKey(n,e,t,i);if(this._cellCache.has(a))return this._cellCache.get(a);const o=this._getCellCfs(n,e,t,i);return o.length&&this._cellCache.set(a,o),o}_getCellCfs(n,e,t,i){var u;const a=(u=this._conditionalFormattingRuleModel.getSubunitRules(n,e))!=null?u:[],o=this._ensureCalculateUnitManager(n,e),h=this._rTreeManager.bulkSearch([{unitId:n,sheetId:e,range:{startColumn:i,endColumn:i,startRow:t,endRow:t}}]),l=a.filter(g=>h.has(g.cfId));return l.length?l.map(g=>{const C=o.get(g.cfId);return C?{cfId:g.cfId,result:C.getCell(t,i)}:null}).filter(g=>!!g).map((g,C)=>({...g,priority:C})):[]}dispose(){this.clearCache(),super.dispose()}clearCache(){this._calculateUnitManagers.clear(),this._cellCache.clear(),this._rTreeManager.clear()}_handleCustomFormulasSeparately(){this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(n=>{if(n.type==="set"){const{unitId:e,subUnitId:t}=n,i=n.oldRule;i.rule.type===S.highlightCell&&i.rule.subType===y.formula&&this._conditionalFormattingFormulaService.deleteCache(e,t,i.cfId)}}))}_initRuleListener(){this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(n=>{const{unitId:e,subUnitId:t,rule:i}=n,{cfId:a,ranges:o}=i,h=this._ensureCalculateUnitManager(e,t);switch(this.markRuleDirty(e,t,a),n.type){case"add":{this._rTreeManager.bulkInsert(o.map(c=>({unitId:e,sheetId:t,id:a,range:c})));const l=this._createRuleCalculateUnitInstance(e,t,i);if(!l)return;h.set(i.cfId,l);break}case"delete":{this._rTreeManager.bulkRemove(o.map(l=>({unitId:e,sheetId:t,id:a,range:l}))),h.delete(i.cfId);break}case"set":{const l=n.oldRule;if(this._rTreeManager.bulkRemove(l.ranges.map(c=>({unitId:e,sheetId:t,id:l.cfId,range:c}))),this._rTreeManager.bulkInsert(o.map(c=>({unitId:e,sheetId:t,id:a,range:c}))),l.rule.type!==i.rule.type){const c=this._createRuleCalculateUnitInstance(e,t,i);if(!c)return;h.delete(l.cfId),h.set(i.cfId,c)}else{const c=h.get(l.cfId);if(!c)return;c.updateRule(i)}}}}))}_ensureCalculateUnitManager(n,e){let t=this._calculateUnitManagers.get(n);t||(t=new Map,this._calculateUnitManagers.set(n,t));let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_createRuleCalculateUnitInstance(n,e,t){const i=this._univerInstanceService.getUnit(n),a=i==null?void 0:i.getSheetBySheetId(e);if(!i||!a)return;const o={workbook:i,worksheet:a,unitId:n,subUnitId:e,accessor:this._injector,rule:t,limit:l2,getCellValue:(h,l)=>a.getCellRaw(h,l)||{}};switch(t.rule.type){case S.colorScale:return new n0(o);case S.dataBar:return new a0(o);case S.highlightCell:return new l0(o);case S.iconSet:return new u0(o)}}_createCacheKey(n,e,t,i){return`${n}_${e}_${t}_${i}`}setCacheLength(n=l2){this._cellCache.limit!==n&&(this._cellCache.limit=n,this._calculateUnitManagers.forEach(e=>{e.forEach(t=>{t.forEach(i=>{i.setCacheLength(n)})})}))}},f.ConditionalFormattingViewModel=d0([a2(0,d.Inject(d.Injector)),a2(1,d.Inject(I)),a2(2,d.Inject(f.ConditionalFormattingFormulaService)),a2(3,d.IUniverInstanceService)],f.ConditionalFormattingViewModel);function Q(s,r){return Math.abs(s-r)<Number.EPSILON}const R=s=>s==null||typeof s=="string"&&s.trim()==="",N=s=>{var e,t;if(!s)return null;if(s.t===d.CellValueType.BOOLEAN)return s.v===d.BooleanNumber.TRUE?E.BooleanValue.TRUE:E.BooleanValue.FALSE;const r=s.v,n=(t=(e=s.p)==null?void 0:e.body)==null?void 0:t.dataStream.replace(/\r\n$/,"");return R(r)?R(n)?null:n:r},D2=86400;function B2(s,r=!0){if(r&&s>=0){if(s===0)return[1900,1,0];if(s===60)return[1900,2,29];if(s<60)return[1900,s<32?1:2,(s-1)%31+1]}let n=s+68569+2415019;const e=Math.floor(4*n/146097);n=n-Math.floor((146097*e+3)/4);const t=Math.floor(4e3*(n+1)/1461001);n=n-Math.floor(1461*t/4)+31;const i=Math.floor(80*n/2447),a=n-Math.floor(2447*i/80);n=Math.floor(i/11);const o=i+2-12*n;return[100*(e-49)+t+n|0,o|0,a|0]}const k2=s=>{let r=s|0;const n=D2*(s-r);let e=Math.floor(n);n-e>.9999&&(e+=1,e===D2&&(e=0,r+=1));const t=e<0?D2+e:e,[i,a,o]=B2(s,!0),h=Math.floor(t/60/60)%60,l=Math.floor(t/60)%60,c=Math.floor(t)%60;return d.dayjs(`${i}/${a}/${o} ${h}:${l}:${c}`).valueOf()},e2=(s,r,n)=>{switch(s.type){case x.max:{let e=0;return r.forValue((t,i,a)=>{a>e&&(e=a)}),{status:E.FormulaResultStatus.SUCCESS,result:e}}case x.min:{let e;return r.forValue((t,i,a)=>{e===void 0&&(e=a),a<e&&(e=a)}),{status:E.FormulaResultStatus.SUCCESS,result:e}}case x.percent:{let e,t;r.forValue((o,h,l)=>{(e===void 0||t===void 0)&&(e=l,t=l),l>e&&(e=l),l<t&&(t=l)});const i=(e||0)-(t||0),a=Math.max(Math.min(Number(s.value)||0,100),0);return{status:E.FormulaResultStatus.SUCCESS,result:i*(a/100)+(t||0)}}case x.percentile:{const e=r.toNativeArray().sort((l,c)=>l-c),t=Math.max(Math.min(Number(s.value)||0,100),0),i=(e.length-1)*t/100,a=Math.floor(i),o=i-a,h=e[a]+(e[Math.min(a+1,e.length-1)]-e[a])*o;return{status:E.FormulaResultStatus.SUCCESS,result:h}}case x.formula:{const{accessor:e,unitId:t,subUnitId:i,cfId:a}=n,o=String(s.value),h=e.get(f.ConditionalFormattingFormulaService);return h.registerFormulaWithRange(t,i,a,o),h.getFormulaResultWithCoords(t,i,a,o)}case x.num:default:{const e=Number(s.value);return{status:E.FormulaResultStatus.SUCCESS,result:Number.isNaN(e)?0:e}}}},h0=(s,r,n,e)=>{const{accessor:t}=e,i=t.get(f.ConditionalFormattingViewModel),a=new d.ObjectMatrix;return n.ranges.forEach(o=>{d.Range.foreach(o,(h,l)=>{const c=i.getCellCfs(s,r,h,l);if(c){const u=c.find(g=>g.cfId===n.cfId);u!=null&&u.result&&a.setValue(h,l,u.result)}})}),a},K=(s,r)=>{switch(s.operator){case p.between:{if(typeof s.value!="object"||!s.value.length)return;const n=Math.min(...s.value),e=Math.max(...s.value);return r>=n&&r<=e}case p.notBetween:{if(typeof s.value!="object"||!s.value.length)return;const n=Math.min(...s.value),e=Math.max(...s.value);return!(r>=n&&r<=e)}case p.equal:{const n=s.value||0;return Q(n,r)}case p.notEqual:{const n=s.value||0;return!Q(n,r)}case p.greaterThan:{const n=s.value||0;return r>n}case p.greaterThanOrEqual:{const n=s.value||0;return r>=n}case p.lessThan:{const n=s.value||0;return r<n}case p.lessThanOrEqual:{const n=s.value||0;return r<=n}default:return!1}},U2=s=>{switch(s){case p.greaterThan:return p.lessThanOrEqual;case p.greaterThanOrEqual:return p.lessThan;case p.lessThan:return p.greaterThanOrEqual;case p.lessThanOrEqual:return p.greaterThan}return s},N2=(s,r)=>{const n=i=>i.a!==void 0?i:{...i,a:1},e=s.findIndex(i=>i.value>=r),t=e-1;if(e===0)return s[0].color.toRgbString();if(t>=0){const i=s[t],a=s[e];if(i.color.isValid&&a.color.isValid){const o=n(i.color.toRgb()),h=n(a.color.toRgb()),l=a.value-i.value,c=(r-i.value)/l,u=["r","g","b","a"].reduce((C,D)=>{const v=o[D];return C[D]=(h[D]-v)*c+v,C},{});return new d.ColorKit(u).toRgbString()}}else return s[s.length-1].color.toRgbString()},t2=(s,r,n)=>s.map(e=>{if(e.startColumn>n||e.startRow>r)return null;const t={...e};return t.endRow=Math.min(t.endRow,r),t.endColumn=Math.min(t.endColumn,n),t}).filter(e=>!!e);function g0(s){let r=0;return new d.ObjectMatrix(s).forValue((n,e,t)=>{r=Math.max(Number.isNaN(r)?0:r,Number(t))}),r}const m={feedback:{mistake:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%227.03704%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.87359%206.87332C6.6146%207.13231%206.6146%207.55221%206.87359%207.8112L9.062%209.99961L6.87356%2012.188C6.61457%2012.447%206.61457%2012.8669%206.87356%2013.1259C7.13255%2013.3849%207.55245%2013.3849%207.81144%2013.1259L9.99987%2010.9375L12.1882%2013.1258C12.4472%2013.3848%2012.8671%2013.3848%2013.1261%2013.1258C13.3851%2012.8669%2013.3851%2012.447%2013.1261%2012.188L10.9378%209.99961L13.1261%207.81127C13.3851%207.55228%2013.3851%207.13238%2013.1261%206.87339C12.8671%206.61441%2012.4472%206.61441%2012.1882%206.87339L9.99987%209.06173L7.81147%206.87332C7.55248%206.61433%207.13257%206.61433%206.87359%206.87332Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A",warn:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%227.03704%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Cpath%20d%3D%22M9.16817%206.67735C9.16646%206.61745%209.1656%206.5875%209.16653%206.56236C9.18103%206.16817%209.49136%205.84883%209.88497%205.82306C9.91008%205.82141%209.94004%205.82141%209.99996%205.82141V5.82141C10.0599%205.82141%2010.0899%205.82141%2010.115%205.82306C10.5086%205.84883%2010.8189%206.16817%2010.8334%206.56236C10.8343%206.5875%2010.8335%206.61745%2010.8318%206.67735L10.7043%2011.131C10.6934%2011.5121%2010.3812%2011.8154%209.99995%2011.8154V11.8154C9.61866%2011.8154%209.30655%2011.5121%209.29564%2011.131L9.16817%206.67735Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3Crect%20x%3D%229.31488%22%20y%3D%2212.8086%22%20width%3D%221.37006%22%20height%3D%221.37006%22%20rx%3D%220.685032%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A",correct:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M17.037%2010C17.037%2013.8865%2013.8864%2017.0371%209.99999%2017.0371C6.11354%2017.0371%202.96295%2013.8865%202.96295%2010C2.96295%206.1136%206.11354%202.96301%209.99999%202.96301C13.8864%202.96301%2017.037%206.1136%2017.037%2010Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3Cpath%20d%3D%22M13.9239%207.17477C13.6638%206.91472%2013.2422%206.91472%2012.9821%207.17477L8.74433%2011.4126L7.01786%209.6861C6.75781%209.42606%206.33619%209.42606%206.07614%209.6861C5.81609%209.94615%205.81609%2010.3678%206.07614%2010.6278L8.27349%2012.8252C8.53354%2013.0852%208.95516%2013.0852%209.21521%2012.8252L9.2195%2012.8209L13.9239%208.1165C14.1839%207.85645%2014.1839%207.43482%2013.9239%207.17477Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A"},star:{starEmpty:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.8451%207.0699%2012.2165%207.33978%2012.6421%207.36863L16.2362%207.61233C16.5693%207.63492%2016.7048%208.05202%2016.4486%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.215%2011.2859%2013.319%2011.6996L14.1979%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6418%2015.5971L10.5908%2013.6817C10.2296%2013.4549%209.77045%2013.4549%209.40924%2013.6817L6.35828%2015.5971C6.07553%2015.7746%205.72072%2015.5168%205.80217%2015.1931L6.68105%2011.6996C6.7851%2011.2859%206.64322%2010.8493%206.31592%2010.5758L3.55145%208.26607C3.29525%208.05202%203.43078%207.63492%203.76386%207.61233L7.358%207.36863C7.78352%207.33978%208.15498%207.0699%208.31391%206.67412L9.65633%203.3312C9.78074%203.0214%2010.2193%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23fff%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A",starIncomplete:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.845%207.0699%2012.2165%207.33978%2012.642%207.36863L16.2361%207.61233C16.5692%207.63492%2016.7047%208.05202%2016.4485%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.2149%2011.2859%2013.3189%2011.6996L14.1978%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6417%2015.5971L10.5908%2013.6817C10.2295%2013.4549%209.77039%2013.4549%209.40918%2013.6817L6.35822%2015.5971C6.07547%2015.7746%205.72066%2015.5168%205.80211%2015.1931L6.68098%2011.6996C6.78504%2011.2859%206.64316%2010.8493%206.31586%2010.5758L3.55139%208.26607C3.29519%208.05202%203.43072%207.63492%203.7638%207.61233L7.35793%207.36863C7.78346%207.33978%208.15491%207.0699%208.31385%206.67412L9.65627%203.3312C9.78068%203.0214%2010.2192%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23fff%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cmask%20id%3D%22mask1_613_177%22%20style%3D%22mask-type%3Aalpha%22%20maskUnits%3D%22userSpaceOnUse%22%20x%3D%220%22%20y%3D%220%22%20width%3D%2210%22%20height%3D%2220%22%3E%0A%3Crect%20width%3D%2210%22%20height%3D%2220%22%20fill%3D%22%23C4C4C4%22%2F%3E%0A%3C%2Fmask%3E%0A%3Cg%20mask%3D%22url(%23mask1_613_177)%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.845%207.0699%2012.2165%207.33978%2012.642%207.36863L16.2361%207.61233C16.5692%207.63492%2016.7047%208.05202%2016.4485%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.2149%2011.2859%2013.3189%2011.6996L14.1978%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6417%2015.5971L10.5908%2013.6817C10.2295%2013.4549%209.77039%2013.4549%209.40918%2013.6817L6.35822%2015.5971C6.07547%2015.7746%205.72066%2015.5168%205.80211%2015.1931L6.68098%2011.6996C6.78504%2011.2859%206.64316%2010.8493%206.31586%2010.5758L3.55139%208.26607C3.29519%208.05202%203.43072%207.63492%203.7638%207.61233L7.35793%207.36863C7.78346%207.33978%208.15491%207.0699%208.31385%206.67412L9.65627%203.3312C9.78068%203.0214%2010.2192%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A",starFull:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.8451%207.0699%2012.2165%207.33978%2012.6421%207.36863L16.2362%207.61233C16.5693%207.63492%2016.7048%208.05202%2016.4486%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.215%2011.2859%2013.319%2011.6996L14.1979%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6418%2015.5971L10.5908%2013.6817C10.2296%2013.4549%209.77045%2013.4549%209.40924%2013.6817L6.35828%2015.5971C6.07553%2015.7746%205.72072%2015.5168%205.80217%2015.1931L6.68105%2011.6996C6.7851%2011.2859%206.64322%2010.8493%206.31592%2010.5758L3.55145%208.26607C3.29525%208.05202%203.43078%207.63492%203.76386%207.61233L7.358%207.36863C7.78352%207.33978%208.15498%207.0699%208.31391%206.67412L9.65633%203.3312C9.78074%203.0214%2010.2193%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A"},progress:{progress0:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A",progress25:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M16.2963%209.99991C16.2963%209.17307%2016.1335%208.35432%2015.8171%207.59042C15.5006%206.82652%2015.0369%206.13242%2014.4522%205.54776C13.8675%204.96309%2013.1734%204.49931%2012.4095%204.18289C11.6456%203.86647%2010.8269%203.70361%2010%203.70361L10%209.99991H16.2963Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A",progress50:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M10%2016.2962C11.6699%2016.2962%2013.2714%2015.6328%2014.4522%2014.4521C15.633%2013.2713%2016.2963%2011.6698%2016.2963%209.99991C16.2963%208.33003%2015.633%206.72854%2014.4522%205.54776C13.2714%204.36697%2011.6699%203.70361%2010%203.70361L10%209.99991L10%2016.2962Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A",progress75:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M3.70374%209.99991C3.70374%2011.2452%204.07301%2012.4625%204.76485%2013.4979C5.4567%2014.5334%206.44005%2015.3404%207.59054%2015.8169C8.74104%2016.2935%2010.007%2016.4182%2011.2284%2016.1752C12.4497%2015.9323%2013.5716%2015.3326%2014.4522%2014.4521C15.3327%2013.5715%2015.9324%2012.4496%2016.1753%2011.2283C16.4183%2010.0069%2016.2936%208.74092%2015.8171%207.59042C15.3405%206.43992%2014.5335%205.45658%2013.4981%204.76473C12.4626%204.07288%2011.2453%203.70361%2010%203.70361L10%209.99991L3.70374%209.99991Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A",progress100:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99991%22%20r%3D%226.2963%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A"},signal:{signal0:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A",signal25:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A",signal50:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A",signal75:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A",signal100:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93933%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70447%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A"},feeling:{guffaw:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M16.887%2010C16.887%2013.8037%2013.8036%2016.8871%209.99999%2016.8871C6.19638%2016.8871%203.11295%2013.8037%203.11295%2010C3.11295%206.19644%206.19638%203.11301%209.99999%203.11301C13.8036%203.11301%2016.887%206.19644%2016.887%2010Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M12.5355%2013.5821C13.0482%2013.1841%2013.3951%2012.6107%2013.5405%2012.0327C13.5934%2011.8226%2013.5051%2011.6349%2013.3518%2011.5331C13.2036%2011.4346%2013.0031%2011.4203%2012.8265%2011.5131C11.0615%2012.4407%208.94609%2012.4427%207.1828%2011.513C7.00629%2011.4199%206.80602%2011.4343%206.65798%2011.5329C6.50518%2011.6346%206.41701%2011.8217%206.46844%2012.0312C6.61029%2012.609%206.95079%2013.1833%207.46449%2013.5821C8.14361%2014.1093%209.05608%2014.3999%2010%2014.3999C10.9439%2014.3999%2011.8564%2014.1093%2012.5355%2013.5821Z%22%20fill%3D%22white%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.4%22%2F%3E%0A%3C%2Fsvg%3E%0A",smile:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2011.8518C7.03705%2011.8518%207.77779%2013.7037%2010%2013.7037C12.2222%2013.7037%2012.963%2011.8518%2012.963%2011.8518%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",noninductive:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.9259%22%20width%3D%221.48148%22%20height%3D%221.11111%22%20rx%3D%220.555556%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.9259%22%20width%3D%221.48148%22%20height%3D%221.11111%22%20rx%3D%220.555556%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2012.5927C7.03705%2012.5927%208.14816%2012.5927%2010.3704%2012.5927C12.5926%2012.5927%2012.963%2012.5927%2012.963%2012.5927%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",dissatisfied:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2013.7037C7.03705%2013.7037%207.77779%2011.8519%2010%2011.8519C12.2222%2011.8519%2012.963%2013.7037%2012.963%2013.7037%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A",impatient:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.47573%2011.731C6.96306%2012.129%206.61613%2012.7024%206.47071%2013.2804C6.41784%2013.4905%206.50617%2013.6782%206.65942%2013.78C6.80761%2013.8785%207.00813%2013.8928%207.18477%2013.8C8.9498%2012.8724%2011.0652%2012.8704%2012.8285%2013.8002C13.005%2013.8932%2013.2052%2013.8788%2013.3533%2013.7802C13.5061%2013.6785%2013.5942%2013.4914%2013.5428%2013.2819C13.401%2012.7041%2013.0605%2012.1298%2012.5468%2011.731C11.8676%2011.2038%2010.9552%2010.9132%2010.0112%2010.9132C9.06732%2010.9132%208.15485%2011.2038%207.47573%2011.731Z%22%20fill%3D%22white%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.4%22%2F%3E%0A%3C%2Fsvg%3E%0A"},arrow:JSON.parse('{"down-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M8.90467%203.99244C8.84611%204.1338%208.84611%204.31301%208.84611%204.67143V13.716L5.92068%2010.7906C5.66724%2010.5371%205.54052%2010.4104%205.39916%2010.3519C5.21067%2010.2738%204.9989%2010.2738%204.81041%2010.3519C4.66905%2010.4104%204.54233%2010.5371%204.28889%2010.7906C4.03545%2011.044%203.90873%2011.1707%203.85018%2011.3121C3.77211%2011.5006%203.77211%2011.7124%203.85018%2011.9008C3.90873%2012.0422%204.03545%2012.1689%204.28889%2012.4224L9.03476%2017.1682C9.07839%2017.2127%209.12737%2017.2617%209.18231%2017.3166L9.18239%2017.3167L9.18241%2017.3167C9.40545%2017.5398%209.53035%2017.6647%209.65346%2017.7313C9.67085%2017.7408%209.6882%2017.7492%209.70577%2017.7564C9.89425%2017.8345%2010.106%2017.8345%2010.2945%2017.7564C10.4359%2017.6979%2010.5626%2017.5712%2010.816%2017.3177C10.8986%2017.2352%2010.9677%2017.1661%2011.0253%2017.1056L15.7095%2012.4214L15.7095%2012.4213C15.963%2012.1679%2016.0897%2012.0412%2016.1482%2011.8998C16.2263%2011.7114%2016.2263%2011.4996%2016.1482%2011.3111C16.0897%2011.1697%2015.963%2011.043%2015.7095%2010.7896C15.4561%2010.5361%2015.3294%2010.4094%2015.188%2010.3509C14.9995%2010.2728%2014.7878%2010.2728%2014.5993%2010.3509C14.4579%2010.4094%2014.3312%2010.5361%2014.0778%2010.7896L14.0777%2010.7896L11.1538%2013.7135V4.67142C11.1538%204.31301%2011.1538%204.1338%2011.0953%203.99244C11.0172%203.80395%2010.8674%203.6542%2010.6789%203.57613C10.5376%203.51758%2010.3584%203.51758%209.99996%203.51758C9.64154%203.51758%209.46233%203.51758%209.32097%203.57613C9.13249%203.6542%208.98274%203.80395%208.90467%203.99244Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A","right-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.32508%2011.7609C3.46644%2011.8194%203.64565%2011.8194%204.00407%2011.8194H13.049L10.1235%2014.745C9.87002%2014.9984%209.7433%2015.1251%209.68475%2015.2665C9.60668%2015.455%209.60668%2015.6668%209.68475%2015.8552C9.7433%2015.9966%209.87002%2016.1233%2010.1235%2016.3768C10.3769%2016.6302%2010.5036%2016.7569%2010.645%2016.8155C10.8335%2016.8935%2011.0452%2016.8935%2011.2337%2016.8155C11.3751%2016.7569%2011.5018%2016.6302%2011.7552%2016.3768L16.5105%2011.6215C16.5524%2011.5803%2016.5983%2011.5344%2016.6493%2011.4834L16.6495%2011.4831C16.8561%2011.2765%2016.9785%2011.1542%2017.0484%2011.0394C17.0648%2011.0128%2017.0782%2010.9866%2017.0893%2010.9599C17.1674%2010.7714%2017.1674%2010.5596%2017.0893%2010.3711C17.0308%2010.2298%2016.904%2010.1031%2016.6506%209.84962C16.5685%209.76752%2016.4997%209.69872%2016.4394%209.64123L11.7542%204.95601C11.5007%204.70257%2011.374%204.57585%2011.2327%204.5173C11.0442%204.43923%2010.8324%204.43923%2010.6439%204.5173C10.5026%204.57585%2010.3758%204.70257%2010.1224%204.95601L10.1224%204.95601C9.86895%205.20945%209.74223%205.33617%209.68368%205.47753C9.60561%205.66601%209.60561%205.87779%209.68368%206.06627C9.74223%206.20764%209.86895%206.33436%2010.1224%206.5878L13.0463%209.51175H4.00407C3.64565%209.51175%203.46644%209.51175%203.32508%209.5703C3.1366%209.64837%202.98685%209.79812%202.90877%209.98661C2.85022%2010.128%202.85022%2010.3072%202.85022%2010.6656C2.85022%2011.024%202.85022%2011.2032%202.90877%2011.3446C2.98685%2011.5331%203.1366%2011.6828%203.32508%2011.7609Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","up-green":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M11.0936%2017.3406C11.1522%2017.1992%2011.1522%2017.02%2011.1522%2016.6616V7.61701L14.0776%2010.5424C14.3311%2010.7959%2014.4578%2010.9226%2014.5991%2010.9811C14.7876%2011.0592%2014.9994%2011.0592%2015.1879%2010.9811C15.3292%2010.9226%2015.456%2010.7959%2015.7094%2010.5424C15.9628%2010.289%2016.0896%2010.1623%2016.1481%2010.0209C16.2262%209.83243%2016.2262%209.62066%2016.1481%209.43217C16.0896%209.29081%2015.9628%209.16409%2015.7094%208.91065L10.9645%204.16576C10.9207%204.12105%2010.8714%204.07178%2010.8161%204.01648L10.8159%204.0163C10.5916%203.792%2010.4666%203.66696%2010.3428%203.60058C10.3261%203.59154%2010.3094%203.58358%2010.2925%203.57658C10.104%203.49851%209.89226%203.49851%209.70378%203.57658C9.56242%203.63514%209.4357%203.76186%209.18226%204.0153C9.09955%204.09801%209.03034%204.16722%208.97258%204.22785L4.28878%208.91166C4.03534%209.1651%203.90862%209.29182%203.85006%209.43318C3.77199%209.62166%203.77199%209.83344%203.85006%2010.0219C3.90862%2010.1633%204.03534%2010.29%204.28878%2010.5434C4.54221%2010.7969%204.66893%2010.9236%204.8103%2010.9822C4.99878%2011.0602%205.21056%2011.0602%205.39904%2010.9822C5.5404%2010.9236%205.66712%2010.7969%205.92056%2010.5434L5.92056%2010.5434L8.84449%207.61951V16.6616C8.84449%2017.02%208.84449%2017.1992%208.90305%2017.3406C8.98112%2017.5291%209.13087%2017.6788%209.31935%2017.7569C9.46072%2017.8154%209.63992%2017.8154%209.99834%2017.8154C10.3568%2017.8154%2010.536%2017.8154%2010.6773%2017.7569C10.8658%2017.6788%2011.0156%2017.5291%2011.0936%2017.3406Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A","rightAndDown-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.5062%206.72126C4.56476%206.86262%204.69148%206.98934%204.94492%207.24278L11.3404%2013.6382L7.20313%2013.6382C6.84471%2013.6382%206.66551%2013.6382%206.52414%2013.6968C6.33566%2013.7749%206.18591%2013.9246%206.10784%2014.1131C6.04928%2014.2545%206.04928%2014.4337%206.04928%2014.7921C6.04928%2015.1505%206.04928%2015.3297%206.10784%2015.4711C6.18591%2015.6596%206.33566%2015.8093%206.52414%2015.8874C6.66551%2015.9459%206.84471%2015.9459%207.20313%2015.9459L13.9194%2015.9459C13.9805%2015.9465%2014.0484%2015.9465%2014.1243%2015.9465H14.1243C14.4353%2015.9465%2014.6114%2015.9465%2014.7449%2015.9082C14.7659%2015.9023%2014.7859%2015.8954%2014.8052%2015.8874C14.9937%2015.8093%2015.1434%2015.6596%2015.2215%2015.4711C15.2801%2015.3297%2015.2801%2015.1505%2015.2801%2014.7921C15.2801%2014.6767%2015.2801%2014.5799%2015.2781%2014.497L15.2781%207.86957C15.2781%207.51115%2015.2781%207.33194%2015.2195%207.19058C15.1415%207.0021%2014.9917%206.85235%2014.8032%206.77428C14.6619%206.71572%2014.4827%206.71572%2014.1243%206.71572C13.7658%206.71572%2013.5866%206.71572%2013.4453%206.77428C13.2568%206.85235%2013.107%207.0021%2013.029%207.19058C12.9704%207.33194%2012.9704%207.51115%2012.9704%207.86957L12.9704%2012.0047L6.5767%205.61099C6.32326%205.35755%206.19654%205.23083%206.05518%205.17228C5.8667%205.09421%205.65492%205.09421%205.46644%205.17228C5.32508%205.23083%205.19836%205.35755%204.94492%205.61099C4.69148%205.86443%204.56476%205.99115%204.5062%206.13251C4.42813%206.32099%204.42813%206.53277%204.5062%206.72126Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","rightAndUp-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.05431%2016.1597C6.19567%2016.1012%206.32239%2015.9745%206.57583%2015.721L12.9712%209.32568L12.9712%2013.4626C12.9712%2013.821%2012.9712%2014.0002%2013.0297%2014.1416C13.1078%2014.3301%2013.2576%2014.4798%2013.446%2014.5579C13.5874%2014.6164%2013.7666%2014.6164%2014.125%2014.6164C14.4834%2014.6164%2014.6626%2014.6164%2014.804%2014.5579C14.9925%2014.4798%2015.1422%2014.3301%2015.2203%2014.1416C15.2789%2014.0002%2015.2789%2013.821%2015.2789%2013.4626L15.2789%206.75233C15.2795%206.68972%2015.2795%206.62004%2015.2795%206.54182L15.2795%206.54157C15.2795%206.22585%2015.2795%206.04918%2015.2395%205.91495C15.2339%205.89605%2015.2276%205.878%2015.2203%205.86053C15.1422%205.67204%2014.9925%205.52229%2014.804%205.44422C14.6626%205.38567%2014.4834%205.38567%2014.125%205.38567L14.125%205.38567C14.0075%205.38567%2013.9093%205.38567%2013.8254%205.38773L7.20256%205.38773C6.84414%205.38773%206.66493%205.38773%206.52357%205.44628C6.33509%205.52436%206.18534%205.6741%206.10727%205.86259C6.04871%206.00395%206.04871%206.18315%206.04871%206.54156V6.54157L6.04871%206.54159C6.04871%206.9%206.04871%207.0792%206.10727%207.22056C6.18534%207.40905%206.33509%207.55879%206.52357%207.63687C6.66493%207.69542%206.84414%207.69542%207.20256%207.69542H11.3379L4.94405%2014.0892C4.69061%2014.3427%204.56389%2014.4694%204.50533%2014.6108C4.42726%2014.7992%204.42726%2015.011%204.50533%2015.1995C4.56389%2015.3409%204.69061%2015.4676%204.94405%2015.721C5.19749%2015.9745%205.32421%2016.1012%205.46557%2016.1597C5.65405%2016.2378%205.86583%2016.2378%206.05431%2016.1597Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","down-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M8.90467%203.99244C8.84611%204.1338%208.84611%204.31301%208.84611%204.67143V13.716L5.92068%2010.7906C5.66724%2010.5371%205.54052%2010.4104%205.39916%2010.3519C5.21067%2010.2738%204.9989%2010.2738%204.81041%2010.3519C4.66905%2010.4104%204.54233%2010.5371%204.28889%2010.7906C4.03545%2011.044%203.90873%2011.1707%203.85018%2011.3121C3.77211%2011.5006%203.77211%2011.7124%203.85018%2011.9008C3.90873%2012.0422%204.03545%2012.1689%204.28889%2012.4224L9.03476%2017.1682C9.07839%2017.2127%209.12737%2017.2617%209.18231%2017.3166L9.18239%2017.3167L9.18241%2017.3167C9.40545%2017.5398%209.53035%2017.6647%209.65346%2017.7313C9.67085%2017.7408%209.6882%2017.7492%209.70577%2017.7564C9.89425%2017.8345%2010.106%2017.8345%2010.2945%2017.7564C10.4359%2017.6979%2010.5626%2017.5712%2010.816%2017.3177C10.8986%2017.2352%2010.9677%2017.1661%2011.0253%2017.1056L15.7095%2012.4214L15.7095%2012.4213C15.963%2012.1679%2016.0897%2012.0412%2016.1482%2011.8998C16.2263%2011.7114%2016.2263%2011.4996%2016.1482%2011.3111C16.0897%2011.1697%2015.963%2011.043%2015.7095%2010.7896C15.4561%2010.5361%2015.3294%2010.4094%2015.188%2010.3509C14.9995%2010.2728%2014.7878%2010.2728%2014.5993%2010.3509C14.4579%2010.4094%2014.3312%2010.5361%2014.0778%2010.7896L14.0777%2010.7896L11.1538%2013.7135V4.67142C11.1538%204.31301%2011.1538%204.1338%2011.0953%203.99244C11.0172%203.80395%2010.8674%203.6542%2010.6789%203.57613C10.5376%203.51758%2010.3584%203.51758%209.99996%203.51758C9.64154%203.51758%209.46233%203.51758%209.32097%203.57613C9.13249%203.6542%208.98274%203.80395%208.90467%203.99244Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","right-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.32508%2011.7609C3.46644%2011.8194%203.64565%2011.8194%204.00407%2011.8194H13.049L10.1235%2014.745C9.87002%2014.9984%209.7433%2015.1251%209.68475%2015.2665C9.60668%2015.455%209.60668%2015.6668%209.68475%2015.8552C9.7433%2015.9966%209.87002%2016.1233%2010.1235%2016.3768C10.3769%2016.6302%2010.5036%2016.7569%2010.645%2016.8155C10.8335%2016.8935%2011.0452%2016.8935%2011.2337%2016.8155C11.3751%2016.7569%2011.5018%2016.6302%2011.7552%2016.3768L16.5105%2011.6215C16.5524%2011.5803%2016.5983%2011.5344%2016.6493%2011.4834L16.6495%2011.4831C16.8561%2011.2765%2016.9785%2011.1542%2017.0484%2011.0394C17.0648%2011.0128%2017.0782%2010.9866%2017.0893%2010.9599C17.1674%2010.7714%2017.1674%2010.5596%2017.0893%2010.3711C17.0308%2010.2298%2016.904%2010.1031%2016.6506%209.84962C16.5685%209.76752%2016.4997%209.69872%2016.4394%209.64123L11.7542%204.95601C11.5007%204.70257%2011.374%204.57585%2011.2327%204.5173C11.0442%204.43923%2010.8324%204.43923%2010.6439%204.5173C10.5026%204.57585%2010.3758%204.70257%2010.1224%204.95601L10.1224%204.95601C9.86895%205.20945%209.74223%205.33617%209.68368%205.47753C9.60561%205.66601%209.60561%205.87779%209.68368%206.06627C9.74223%206.20764%209.86895%206.33436%2010.1224%206.5878L13.0463%209.51175H4.00407C3.64565%209.51175%203.46644%209.51175%203.32508%209.5703C3.1366%209.64837%202.98685%209.79812%202.90877%209.98661C2.85022%2010.128%202.85022%2010.3072%202.85022%2010.6656C2.85022%2011.024%202.85022%2011.2032%202.90877%2011.3446C2.98685%2011.5331%203.1366%2011.6828%203.32508%2011.7609Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","up-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M11.0936%2017.3406C11.1522%2017.1992%2011.1522%2017.02%2011.1522%2016.6616V7.61701L14.0776%2010.5424C14.3311%2010.7959%2014.4578%2010.9226%2014.5991%2010.9811C14.7876%2011.0592%2014.9994%2011.0592%2015.1879%2010.9811C15.3292%2010.9226%2015.456%2010.7959%2015.7094%2010.5424C15.9628%2010.289%2016.0896%2010.1623%2016.1481%2010.0209C16.2262%209.83243%2016.2262%209.62066%2016.1481%209.43217C16.0896%209.29081%2015.9628%209.16409%2015.7094%208.91065L10.9645%204.16576C10.9207%204.12105%2010.8714%204.07178%2010.8161%204.01648L10.8159%204.0163C10.5916%203.792%2010.4666%203.66696%2010.3428%203.60058C10.3261%203.59154%2010.3094%203.58358%2010.2925%203.57658C10.104%203.49851%209.89226%203.49851%209.70378%203.57658C9.56242%203.63514%209.4357%203.76186%209.18226%204.0153C9.09955%204.09801%209.03034%204.16722%208.97258%204.22785L4.28878%208.91166C4.03534%209.1651%203.90862%209.29182%203.85006%209.43318C3.77199%209.62166%203.77199%209.83344%203.85006%2010.0219C3.90862%2010.1633%204.03534%2010.29%204.28878%2010.5434C4.54221%2010.7969%204.66893%2010.9236%204.8103%2010.9822C4.99878%2011.0602%205.21056%2011.0602%205.39904%2010.9822C5.5404%2010.9236%205.66712%2010.7969%205.92056%2010.5434L5.92056%2010.5434L8.84449%207.61951V16.6616C8.84449%2017.02%208.84449%2017.1992%208.90305%2017.3406C8.98112%2017.5291%209.13087%2017.6788%209.31935%2017.7569C9.46072%2017.8154%209.63992%2017.8154%209.99834%2017.8154C10.3568%2017.8154%2010.536%2017.8154%2010.6773%2017.7569C10.8658%2017.6788%2011.0156%2017.5291%2011.0936%2017.3406Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","rightAndDown-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.5062%206.72126C4.56476%206.86262%204.69148%206.98934%204.94492%207.24278L11.3404%2013.6382L7.20313%2013.6382C6.84471%2013.6382%206.66551%2013.6382%206.52414%2013.6968C6.33566%2013.7749%206.18591%2013.9246%206.10784%2014.1131C6.04928%2014.2545%206.04928%2014.4337%206.04928%2014.7921C6.04928%2015.1505%206.04928%2015.3297%206.10784%2015.4711C6.18591%2015.6596%206.33566%2015.8093%206.52414%2015.8874C6.66551%2015.9459%206.84471%2015.9459%207.20313%2015.9459L13.9194%2015.9459C13.9805%2015.9465%2014.0484%2015.9465%2014.1243%2015.9465H14.1243C14.4353%2015.9465%2014.6114%2015.9465%2014.7449%2015.9082C14.7659%2015.9023%2014.7859%2015.8954%2014.8052%2015.8874C14.9937%2015.8093%2015.1434%2015.6596%2015.2215%2015.4711C15.2801%2015.3297%2015.2801%2015.1505%2015.2801%2014.7921C15.2801%2014.6767%2015.2801%2014.5799%2015.2781%2014.497L15.2781%207.86957C15.2781%207.51115%2015.2781%207.33194%2015.2195%207.19058C15.1415%207.0021%2014.9917%206.85235%2014.8032%206.77428C14.6619%206.71572%2014.4827%206.71572%2014.1243%206.71572C13.7658%206.71572%2013.5866%206.71572%2013.4453%206.77428C13.2568%206.85235%2013.107%207.0021%2013.029%207.19058C12.9704%207.33194%2012.9704%207.51115%2012.9704%207.86957L12.9704%2012.0047L6.5767%205.61099C6.32326%205.35755%206.19654%205.23083%206.05518%205.17228C5.8667%205.09421%205.65492%205.09421%205.46644%205.17228C5.32508%205.23083%205.19836%205.35755%204.94492%205.61099C4.69148%205.86443%204.56476%205.99115%204.5062%206.13251C4.42813%206.32099%204.42813%206.53277%204.5062%206.72126Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","rightAndUp-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.05431%2016.1597C6.19567%2016.1012%206.32239%2015.9745%206.57583%2015.721L12.9712%209.32568L12.9712%2013.4626C12.9712%2013.821%2012.9712%2014.0002%2013.0297%2014.1416C13.1078%2014.3301%2013.2576%2014.4798%2013.446%2014.5579C13.5874%2014.6164%2013.7666%2014.6164%2014.125%2014.6164C14.4834%2014.6164%2014.6626%2014.6164%2014.804%2014.5579C14.9925%2014.4798%2015.1422%2014.3301%2015.2203%2014.1416C15.2789%2014.0002%2015.2789%2013.821%2015.2789%2013.4626L15.2789%206.75233C15.2795%206.68972%2015.2795%206.62004%2015.2795%206.54182L15.2795%206.54157C15.2795%206.22585%2015.2795%206.04918%2015.2395%205.91495C15.2339%205.89605%2015.2276%205.878%2015.2203%205.86053C15.1422%205.67204%2014.9925%205.52229%2014.804%205.44422C14.6626%205.38567%2014.4834%205.38567%2014.125%205.38567L14.125%205.38567C14.0075%205.38567%2013.9093%205.38567%2013.8254%205.38773L7.20256%205.38773C6.84414%205.38773%206.66493%205.38773%206.52357%205.44628C6.33509%205.52436%206.18534%205.6741%206.10727%205.86259C6.04871%206.00395%206.04871%206.18315%206.04871%206.54156V6.54157L6.04871%206.54159C6.04871%206.9%206.04871%207.0792%206.10727%207.22056C6.18534%207.40905%206.33509%207.55879%206.52357%207.63687C6.66493%207.69542%206.84414%207.69542%207.20256%207.69542H11.3379L4.94405%2014.0892C4.69061%2014.3427%204.56389%2014.4694%204.50533%2014.6108C4.42726%2014.7992%204.42726%2015.011%204.50533%2015.1995C4.56389%2015.3409%204.69061%2015.4676%204.94405%2015.721C5.19749%2015.9745%205.32421%2016.1012%205.46557%2016.1597C5.65405%2016.2378%205.86583%2016.2378%206.05431%2016.1597Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A"}'),shape:{cross:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223.70374%22%20y%3D%228.14795%22%20width%3D%2212.5926%22%20height%3D%223.7037%22%20rx%3D%220.740741%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",up:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M9.44533%205.81157C9.74012%205.47858%2010.2598%205.47858%2010.5546%205.81157L16.2868%2012.2867C16.71%2012.7647%2016.3706%2013.5184%2015.7322%2013.5184H4.26776C3.62933%2013.5184%203.28995%2012.7647%203.71313%2012.2867L9.44533%205.81157Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A",down:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.5547%2014.1884C10.2599%2014.5214%209.74019%2014.5214%209.4454%2014.1884L3.71321%207.71335C3.29002%207.23532%203.6294%206.48161%204.26784%206.48161L15.7322%206.48161C16.3707%206.48161%2016.7101%207.23532%2016.2869%207.71335L10.5547%2014.1884Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A","rhomboid-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M2.1415%2011.1984C1.8412%2010.9074%201.8412%2010.4256%202.1415%2010.1346L9.48467%203.01785C9.77196%202.73942%2010.2284%202.73942%2010.5157%203.01786L17.8586%2010.1346C18.1589%2010.4256%2018.1589%2010.9074%2017.8586%2011.1984L10.5157%2018.3151C10.2284%2018.5936%209.77196%2018.5936%209.48467%2018.3152L2.1415%2011.1984Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-greed":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-pink":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23FB9D9D%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-gray":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A","roundness-black":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22black%22%2F%3E%0A%3C%2Fsvg%3E%0A","triangle-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20clip-path%3D%22url(%23clip0_613_237)%22%3E%0A%3Cpath%20d%3D%22M9.32308%204.41301C9.58368%203.82623%2010.4164%203.82623%2010.677%204.413L15.9526%2016.2917C16.1701%2016.7815%2015.8115%2017.3331%2015.2756%2017.3331H4.72454C4.18858%2017.3331%203.83002%2016.7815%204.04756%2016.2917L9.32308%204.41301Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fg%3E%0A%3Cdefs%3E%0A%3CclipPath%20id%3D%22clip0_613_237%22%3E%0A%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%20transform%3D%22translate(0%200.666504)%22%2F%3E%0A%3C%2FclipPath%3E%0A%3C%2Fdefs%3E%0A%3C%2Fsvg%3E%0A","indicate-greed":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A","indicate-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","indicate-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A"},feedback2:{mistake2:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.12194%206.33702C4.1805%206.47839%204.30722%206.6051%204.56066%206.85854L8.36822%2010.6661L4.56062%2014.4737C4.30718%2014.7272%204.18046%2014.8539%204.12191%2014.9952C4.04384%2015.1837%204.04384%2015.3955%204.12191%2015.584C4.18046%2015.7253%204.30718%2015.8521%204.56062%2016.1055C4.81406%2016.3589%204.94078%2016.4857%205.08214%2016.5442C5.27062%2016.6223%205.4824%2016.6223%205.67089%2016.5442C5.81225%2016.4857%205.93897%2016.3589%206.19241%2016.1055L10%2012.2979L13.8074%2016.1053C14.0609%2016.3588%2014.1876%2016.4855%2014.329%2016.544C14.5174%2016.6221%2014.7292%2016.6221%2014.9177%2016.544C15.0591%2016.4855%2015.1858%2016.3588%2015.4392%2016.1053L15.4392%2016.1053C15.6927%2015.8519%2015.8194%2015.7252%2015.8779%2015.5838C15.956%2015.3953%2015.956%2015.1835%2015.8779%2014.9951C15.8194%2014.8537%2015.6927%2014.727%2015.4392%2014.4735L15.4392%2014.4735L11.6318%2010.6661L15.4392%206.85872C15.6926%206.60528%2015.8193%206.47856%2015.8779%206.3372C15.956%206.14871%2015.956%205.93694%2015.8779%205.74845C15.8193%205.60709%2015.6926%205.48037%2015.4392%205.22693C15.1857%204.97349%2015.059%204.84677%2014.9177%204.78822C14.7292%204.71015%2014.5174%204.71015%2014.3289%204.78822C14.1876%204.84677%2014.0608%204.97349%2013.8074%205.22693L10%209.03433L6.19244%205.22676C5.939%204.97332%205.81228%204.8466%205.67092%204.78805C5.48244%204.70997%205.27066%204.70997%205.08218%204.78805C4.94082%204.8466%204.8141%204.97332%204.56066%205.22676L4.56066%205.22676C4.30722%205.4802%204.1805%205.60692%204.12194%205.74828C4.04387%205.93676%204.04387%206.14854%204.12194%206.33702Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A",warn2:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M8.49778%205.00963C8.48513%204.56774%208.47881%204.3468%208.56086%204.17746C8.63301%204.02856%208.75124%203.90689%208.89802%203.83052C9.06494%203.74365%209.28597%203.74365%209.72805%203.74365H10.272C10.714%203.74365%2010.9351%203.74365%2011.102%203.83052C11.2488%203.9069%2011.367%204.02856%2011.4392%204.17746C11.5212%204.3468%2011.5149%204.56775%2011.5022%205.00964L11.2644%2013.3173C11.2524%2013.737%2011.2464%2013.9468%2011.1609%2014.1065C11.0857%2014.2471%2010.9687%2014.3609%2010.826%2014.432C10.6639%2014.5129%2010.454%2014.5129%2010.0342%2014.5129H9.96582C9.54601%2014.5129%209.33611%2014.5129%209.17397%2014.432C9.0313%2014.3609%208.91426%2014.2471%208.83904%2014.1065C8.75357%2013.9468%208.74756%2013.737%208.73555%2013.3173L8.49778%205.00963Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Crect%20x%3D%228.76917%22%20y%3D%2215.2817%22%20width%3D%222.46154%22%20height%3D%222.46154%22%20rx%3D%220.769231%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A",correct2:"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20clip-path%3D%22url(%23clip0_613_248)%22%3E%0A%3Cpath%20d%3D%22M15.689%205.69723C15.5476%205.75578%2015.4209%205.8825%2015.1675%206.13594L7.82436%2013.4791L4.83279%2010.4875C4.57935%2010.2341%204.45263%2010.1073%204.31127%2010.0488C4.12278%209.97071%203.91101%209.97071%203.72252%2010.0488C3.58116%2010.1073%203.45444%2010.2341%203.201%2010.4875C2.94756%2010.7409%202.82084%2010.8676%202.76229%2011.009C2.68422%2011.1975%202.68422%2011.4093%202.76229%2011.5978C2.82084%2011.7391%202.94756%2011.8658%203.201%2012.1193L7.0085%2015.9268C7.26194%2016.1802%207.38866%2016.3069%207.53002%2016.3655C7.7185%2016.4436%207.93028%2016.4436%208.11876%2016.3655C8.26013%2016.3069%208.38685%2016.1802%208.64028%2015.9268C8.66387%2015.9032%208.68636%2015.8807%208.7078%2015.8592L16.7993%207.76772C17.0527%207.51428%2017.1794%207.38756%2017.238%207.2462C17.3161%207.05772%2017.3161%206.84594%2017.238%206.65746C17.1794%206.5161%2017.0527%206.38938%2016.7993%206.13594C16.5458%205.8825%2016.4191%205.75578%2016.2777%205.69723C16.0893%205.61915%2015.8775%205.61915%2015.689%205.69723Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fg%3E%0A%3Cdefs%3E%0A%3CclipPath%20id%3D%22clip0_613_248%22%3E%0A%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%20transform%3D%22translate(0%200.666504)%22%2F%3E%0A%3C%2FclipPath%3E%0A%3C%2Fdefs%3E%0A%3C%2Fsvg%3E%0A"},flag:{"flag-green":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A","flag-gold":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A","flag-red":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A"},cell:{"cell-0":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A","cell-25":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A","cell-50":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A","cell-75":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A","cell-100":"data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A"}},V2=[{title:"sheet.cf.iconSet.direction",group:[{name:"3Arrows",list:[m.arrow["up-green"],m.arrow["right-gold"],m.arrow["down-red"]]},{name:"3ArrowsGray",list:[m.arrow["up-gray"],m.arrow["right-gray"],m.arrow["down-gray"]]},{name:"4Arrows",list:[m.arrow["up-green"],m.arrow["rightAndUp-gold"],m.arrow["rightAndDown-gold"],m.arrow["down-red"]]},{name:"4ArrowsGray",list:[m.arrow["up-gray"],m.arrow["rightAndUp-gray"],m.arrow["rightAndDown-gray"],m.arrow["down-gray"]]},{name:"5Arrows",list:[m.arrow["up-green"],m.arrow["rightAndUp-gold"],m.arrow["right-gold"],m.arrow["rightAndDown-gold"],m.arrow["down-red"]]},{name:"5ArrowsGray",list:[m.arrow["up-gray"],m.arrow["rightAndUp-gray"],m.arrow["right-gray"],m.arrow["rightAndDown-gray"],m.arrow["down-gray"]]},{name:"3Triangles",list:[m.shape.up,m.shape.cross,m.shape.down]}]},{title:"sheet.cf.iconSet.shape",group:[{name:"3TrafficLights1",list:[m.shape["roundness-greed"],m.shape["roundness-gold"],m.shape["roundness-red"]]},{name:"3Signs",list:[m.shape["roundness-greed"],m.shape["triangle-gold"],m.shape["rhomboid-red"]]},{name:"3TrafficLights2",list:[m.shape["indicate-greed"],m.shape["indicate-gold"],m.shape["indicate-red"]]},{name:"4RedToBlack",list:[m.shape["roundness-red"],m.shape["roundness-pink"],m.shape["roundness-gray"],m.shape["roundness-black"]]},{name:"4TrafficLights",list:[m.shape["roundness-greed"],m.shape["roundness-gold"],m.shape["roundness-red"],m.shape["roundness-black"]]}]},{title:"sheet.cf.iconSet.mark",group:[{name:"3Symbols",list:[m.feedback.correct,m.feedback.warn,m.feedback.mistake]},{name:"3Symbols2",list:[m.feedback2.correct2,m.feedback2.warn2,m.feedback2.mistake2]},{name:"3Flags",list:[m.flag["flag-green"],m.flag["flag-gold"],m.flag["flag-red"]]}]},{title:"sheet.cf.iconSet.rank",group:[{name:"4Rating",list:[m.signal.signal25,m.signal.signal50,m.signal.signal75,m.signal.signal100]},{name:"5Rating",list:[m.signal.signal0,m.signal.signal25,m.signal.signal50,m.signal.signal75,m.signal.signal100]},{name:"5Quarters",list:[m.progress.progress100,m.progress.progress75,m.progress.progress50,m.progress.progress25,m.progress.progress0]},{name:"_5Felling",list:[m.feeling.guffaw,m.feeling.smile,m.feeling.noninductive,m.feeling.dissatisfied,m.feeling.impatient]},{name:"5Boxes",list:[m.cell["cell-100"],m.cell["cell-75"],m.cell["cell-50"],m.cell["cell-25"],m.cell["cell-0"]]},{name:"3Stars",list:[m.star.starFull,m.star.starIncomplete,m.star.starEmpty]}]}],n2=V2.reduce((s,r)=>{const{group:n}=r;for(const e of n)s[e.name]=e.list;return s},{});for(const s in n2){const r=n2[s];Object.freeze(r)}const O2="EMPTY_ICON_TYPE",j2={name:"@univerjs/sheets-conditional-formatting",version:"0.17.0"},C0="ssheets-conditional-formatting.config",$2={};var f0=Object.getOwnPropertyDescriptor,D0=(s,r,n,e)=>{for(var t=e>1?void 0:e?f0(r,n):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(t=a(t)||t);return t},X=(s,r)=>(n,e)=>r(n,e,s);f.ConditionalFormattingService=class extends d.Disposable{constructor(r,n,e,t,i,a){super(),this._conditionalFormattingRuleModel=r,this._injector=n,this._univerInstanceService=e,this._resourceManagerService=t,this._sheetInterceptorService=i,this._commandService=a,this._initCellChange(),this._initSnapshot(),this._initSheetChange()}get _conditionalFormattingViewModelV2(){return this._injector.get(f.ConditionalFormattingViewModel)}composeStyle(r,n,e,t){const i=this._conditionalFormattingViewModelV2.getCellCfs(r,n,e,t);if(i&&(i!=null&&i.length)){const a=i.map(l=>this._conditionalFormattingRuleModel.getRule(r,n,l.cfId)).filter(l=>!!l).reverse(),o=a.findIndex(l=>l==null?void 0:l.stopIfTrue);return o>-1&&a.splice(o+1),a.reduce((l,c)=>{var C;const u=c.rule.type,g=i.find(D=>D.cfId===c.cfId);if(u===S.highlightCell)g.result&&d.merge(l,{style:g.result});else if(u===S.colorScale){const D=g==null?void 0:g.result;D&&typeof D=="string"&&(l.style={...(C=l.style)!=null?C:{},bg:{rgb:D}})}else if(u===S.dataBar){const D=g==null?void 0:g.result;D&&(l.dataBar=D,l.isShowValue=D.isShowValue)}else if(u===S.iconSet){const D=g==null?void 0:g.result;D&&(l.iconSet=D,l.isShowValue=D.isShowValue)}return l},{})}return null}_initSnapshot(){const r=e=>{const t=this._conditionalFormattingRuleModel.getUnitRules(e),i={};return t?(t.forEach((a,o)=>{i[o]=a}),JSON.stringify(i)):""},n=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:c2,businesses:[d.UniverInstanceType.UNIVER_SHEET],toJson:e=>r(e),parseJson:e=>n(e),onUnLoad:e=>{this._conditionalFormattingRuleModel.deleteUnitId(e),!d.isInternalEditorID(e)&&this._conditionalFormattingViewModelV2.clearCache()},onLoad:(e,t)=>{Object.keys(t).forEach(i=>{[...t[i]].reverse().forEach(o=>{this._conditionalFormattingRuleModel.addRule(e,i,o)})})}}))}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:r=>{if(r.id===F.RemoveSheetCommand.id){const n=r.params,e=F.getSheetCommandTarget(this._univerInstanceService,n);if(!e)return{redos:[],undos:[]};const{unitId:t,subUnitId:i}=e,a=this._conditionalFormattingRuleModel.getSubunitRules(t,i);if(!a)return{redos:[],undos:[]};const o=[],h=[];return a.forEach(l=>{const c={unitId:t,subUnitId:i,cfId:l.cfId};o.push({id:j.id,params:c}),h.push(...z(this._injector,c))}),{redos:o,undos:h}}else if(r.id===F.CopySheetCommand.id){const n=r.params,e=F.getSheetCommandTarget(this._univerInstanceService,n);if(!e)return{redos:[],undos:[]};const{unitId:t,subUnitId:i}=e,{targetSubUnitId:a}=n,o=this._conditionalFormattingRuleModel.getSubunitRules(t,i);if(!o)return{redos:[],undos:[]};const h=[],l=[];return o.forEach(c=>{const u={unitId:t,subUnitId:a,rule:{...c,cfId:this._conditionalFormattingRuleModel.createCfId(t,a)}};h.push({id:H.id,params:u}),l.push(h2(this._injector,u))}),{redos:h,undos:l}}return{redos:[],undos:[]}}}))}_initCellChange(){this.disposeWithMe(this._commandService.onCommandExecuted(r=>{const n=(e,t,i)=>{const a=new Set;return i.forEach(([o,h])=>{const l=this._conditionalFormattingViewModelV2.getCellCfs(e,t,o,h);l==null||l.forEach(c=>a.add(c.cfId))}),[...a].map(o=>this._conditionalFormattingRuleModel.getRule(e,t,o)).filter(o=>!!o)};switch(r.id){case F.SetRangeValuesMutation.id:{const e=r.params,{subUnitId:t,unitId:i,cellValue:a}=e,o=[];new d.ObjectMatrix(a).forValue((l,c,u)=>{u&&Object.keys(u).some(C=>["p","v"].includes(C))&&o.push([l,c])}),n(i,t,o).forEach(l=>{this._conditionalFormattingViewModelV2.markRuleDirty(i,t,l.cfId)});break}case F.InsertColMutation.id:case F.RemoveColMutation.id:{const e=r.params,t=F.getSheetCommandTarget(this._univerInstanceService,e);if(!t)return;const{worksheet:i,unitId:a,subUnitId:o}=t,{range:h}=e,l={...h,endColumn:i.getColumnCount()-1},c=this._conditionalFormattingRuleModel.getSubunitRules(a,o);c&&c.filter(g=>g.ranges.some(C=>d.Rectangle.intersects(C,l))).forEach(g=>{this._conditionalFormattingViewModelV2.markRuleDirty(a,o,g.cfId)});break}case F.RemoveRowMutation.id:case F.InsertRowMutation.id:{const e=r.params,t=F.getSheetCommandTarget(this._univerInstanceService,e);if(!t)return;const{worksheet:i,unitId:a,subUnitId:o}=t,{range:h}=e,l={...h,endRow:i.getRowCount()-1},c=this._conditionalFormattingRuleModel.getSubunitRules(a,o);c&&c.filter(g=>g.ranges.some(C=>d.Rectangle.intersects(C,l))).forEach(g=>{this._conditionalFormattingViewModelV2.markRuleDirty(a,o,g.cfId)});break}case F.MoveRowsMutation.id:{const e=r.params,t=F.getSheetCommandTarget(this._univerInstanceService,e);if(!t)return;const{worksheet:i,unitId:a,subUnitId:o}=t,{sourceRange:h,targetRange:l}=e,c={startRow:Math.min(h.startRow,l.startRow),endRow:i.getRowCount()-1,startColumn:0,endColumn:i.getColumnCount()-1},u=this._conditionalFormattingRuleModel.getSubunitRules(a,o);u&&u.filter(C=>C.ranges.some(D=>d.Rectangle.intersects(D,c))).forEach(C=>{this._conditionalFormattingViewModelV2.markRuleDirty(a,o,C.cfId)});break}case F.MoveColsMutation.id:{const e=r.params,t=F.getSheetCommandTarget(this._univerInstanceService,e);if(!t)return;const{worksheet:i,unitId:a,subUnitId:o}=t,{sourceRange:h,targetRange:l}=e,c={startRow:0,endRow:i.getRowCount()-1,startColumn:Math.min(h.startColumn,l.startColumn),endColumn:i.getColumnCount()-1},u=this._conditionalFormattingRuleModel.getSubunitRules(a,o);u&&u.filter(C=>C.ranges.some(D=>d.Rectangle.intersects(D,c))).forEach(C=>{this._conditionalFormattingViewModelV2.markRuleDirty(a,o,C.cfId)});break}case F.MoveRangeMutation.id:{const{unitId:e,to:t,from:i}=r.params,a=o=>{const h=[];new d.ObjectMatrix(o.value).forValue((c,u)=>{h.push([c,u])}),n(e,o.subUnitId,h).forEach(c=>{this._conditionalFormattingViewModelV2.markRuleDirty(e,o.subUnitId,c.cfId)})};a(t),a(i);break}case F.ReorderRangeMutation.id:{const{range:e,unitId:t,subUnitId:i}=r.params,a=this._conditionalFormattingRuleModel.getSubunitRules(t,i);a&&a.filter(h=>h.ranges.some(l=>d.Rectangle.intersects(l,e))).forEach(h=>{this._conditionalFormattingViewModelV2.markRuleDirty(t,i,h.cfId)});break}}}))}},f.ConditionalFormattingService=D0([X(0,d.Inject(I)),X(1,d.Inject(d.Injector)),X(2,d.Inject(d.IUniverInstanceService)),X(3,d.Inject(d.IResourceManagerService)),X(4,d.Inject(F.SheetInterceptorService)),X(5,d.Inject(d.ICommandService))],f.ConditionalFormattingService);var m0=Object.defineProperty,v0=Object.getOwnPropertyDescriptor,F0=(s,r,n)=>r in s?m0(s,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[r]=n,w0=(s,r,n,e)=>{for(var t=e>1?void 0:e?v0(r,n):r,i=s.length-1,a;i>=0;i--)(a=s[i])&&(t=a(t)||t);return t},m2=(s,r)=>(n,e)=>r(n,e,s),o2=(s,r,n)=>F0(s,typeof r!="symbol"?r+"":r,n);f.UniverSheetsConditionalFormattingPlugin=class extends d.Plugin{constructor(r=$2,n,e,t){super(),this._config=r,this._injector=n,this._commandService=e,this._configService=t;const{...i}=d.merge({},$2,this._config);this._configService.setConfig(C0,i),[[f.ConditionalFormattingService],[f.ConditionalFormattingFormulaService],[I],[f.ConditionalFormattingViewModel]].forEach(a=>{this._injector.add(a)}),[y2,_2,M2,R2,S2,I2,H,j,Y,G].forEach(a=>{this._commandService.registerCommand(a)})}onStarting(){this._injector.get(f.ConditionalFormattingService),d.touchDependencies(this._injector,[[f.ConditionalFormattingService],[f.ConditionalFormattingViewModel]])}},o2(f.UniverSheetsConditionalFormattingPlugin,"pluginName",c2),o2(f.UniverSheetsConditionalFormattingPlugin,"packageName",j2.name),o2(f.UniverSheetsConditionalFormattingPlugin,"version",j2.version),o2(f.UniverSheetsConditionalFormattingPlugin,"type",d.UniverInstanceType.UNIVER_SHEET),f.UniverSheetsConditionalFormattingPlugin=w0([d.DependentOn(E.UniverFormulaEnginePlugin),m2(1,d.Inject(d.Injector)),m2(2,d.Inject(d.ICommandService)),m2(3,d.IConfigService)],f.UniverSheetsConditionalFormattingPlugin);const P2="sheet-conditional-rule-icon",E0=35,W2=15,q2=2,p0=s=>{const{startRow:r,endRow:n,startColumn:e,endColumn:t}=s;return`${r}-${n}-${e}-${t}`};class Z2 extends Z.SheetExtension{constructor(){super();w(this,"_paddingRightAndLeft",q2);w(this,"_width",W2);w(this,"_imageMap",new Map);w(this,"uKey",P2);w(this,"Z_INDEX",E0);w(this,"_radius",1);this._init()}draw(n,e,t,i){const{worksheet:a}=t;if(!a)return!1;const o=new Set;n.save(),d.Range.foreach(t.rowColumnSegment,(h,l)=>{if(!a.getRowVisible(h)||!a.getColVisible(l))return;const c=t.getCellWithCoordByIndex(h,l,!1),{isMerged:u,isMergedMainCell:g,mergeInfo:C}=c;let D=a.getCell(h,l);if(u&&(D=a.getCell(C.startRow,C.startColumn)),!(D!=null&&D.iconSet))return;const{iconType:v,iconId:A}=D.iconSet;if(v===O2)return;const _=this._imageMap.get(this._createKey(v,A));if(!_||!this.isRenderDiffRangesByCell(C,i))return;if(u||g){const $=p0(C);if(o.has($))return;o.add($)}const{startX:b,endX:M,startY:L,endY:k}=u||g?C:c,v2=M-b,u2=k-L;if(this._width>u2||this._width>v2+this._paddingRightAndLeft*2)return;const F2=(u2-this._width)/2+L;n.drawImage(_,b+this._paddingRightAndLeft,F2,this._width,this._width)}),n.restore()}_init(){for(const n in n2)n2[n].forEach((t,i)=>{const a=this._createKey(n,String(i)),o=new Image;o.onload=()=>{this._imageMap.set(a,o)},o.src=t})}_createKey(n,e){return`${n}_${e}`}}Z.SpreadsheetExtensionRegistry.add(Z2);function G2(s){if(typeof s!="object"||s===null)return s;const r={};for(const n in s)if(s.hasOwnProperty(n)){const e=G2(s[n]);e!==void 0&&(r[n]=e)}return r}Object.defineProperty(f,"isRangesEqual",{enumerable:!0,get:()=>d.isRangesEqual}),f.AddCfCommand=y2,f.AddConditionalRuleMutation=H,f.AddConditionalRuleMutationUndoFactory=h2,f.CFNumberOperator=p,f.CFRuleType=S,f.CFSubRuleType=y,f.CFTextOperator=T,f.CFTimePeriodOperator=B,f.CFValueType=x,f.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH=l2,f.ClearRangeCfCommand=_2,f.ClearWorksheetCfCommand=M2,f.ConditionalFormattingIcon=Z2,f.ConditionalFormattingRuleModel=I,f.DEFAULT_BG_COLOR=Y2,f.DEFAULT_FONT_COLOR=K2,f.DEFAULT_PADDING=q2,f.DEFAULT_WIDTH=W2,f.DataBar=T2,f.DeleteCfCommand=R2,f.DeleteConditionalRuleMutation=j,f.DeleteConditionalRuleMutationUndoFactory=z,f.EMPTY_ICON_TYPE=O2,f.IconUKey=P2,f.MoveCfCommand=S2,f.MoveConditionalRuleMutation=G,f.MoveConditionalRuleMutationUndoFactory=A2,f.SHEET_CONDITIONAL_FORMATTING_PLUGIN=c2,f.SetCfCommand=I2,f.SetConditionalRuleMutation=Y,f.anchorUndoFactory=E2,f.compareWithNumber=K,f.createCfId=p2,f.createDefaultRule=X2,f.createDefaultValue=J2,f.createDefaultValueByValueType=z2,f.dataBarUKey=b2,f.defaultDataBarNativeColor=f2,f.defaultDataBarPositiveColor=C2,f.defaultPlaceholderColor=L2,f.filterRange=t2,f.findIndexByAnchor=O,f.getCacheStyleMatrix=h0,f.getCellValue=N,f.getColorScaleFromValue=N2,f.getMaxInFormulaResult=g0,f.getOppositeOperator=U2,f.getValueByType=e2,f.iconGroup=V2,f.iconMap=n2,f.isAnchorEqual=Q2,f.isFloatsEqual=Q,f.isNullable=R,f.moveByAnchor=w2,f.removeUndefinedAttr=G2,f.serialTimeToTimestamp=k2,f.setConditionalRuleMutationUndoFactory=g2,f.toYMD_1900=B2,f.transformSupportSymmetryAnchor=d2,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})}));
|
|
3
|
-
|
|
2
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/sheets`),require(`rxjs`),require(`@univerjs/engine-formula`),require(`rxjs/operators`),require(`@univerjs/engine-render`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets`,`rxjs`,`@univerjs/engine-formula`,`rxjs/operators`,`@univerjs/engine-render`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsConditionalFormatting={},e.UniverCore,e.UniverSheets,e.rxjs,e.UniverEngineFormula,e.rxjs.operators,e.UniverEngineRender))})(this,function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let s=`SHEET_CONDITIONAL_FORMATTING_PLUGIN`,c=function(e){return e.beginsWith=`beginsWith`,e.endsWith=`endsWith`,e.containsText=`containsText`,e.notContainsText=`notContainsText`,e.equal=`equal`,e.notEqual=`notEqual`,e.containsBlanks=`containsBlanks`,e.notContainsBlanks=`notContainsBlanks`,e.containsErrors=`containsErrors`,e.notContainsErrors=`notContainsErrors`,e}({}),l=function(e){return e.today=`today`,e.yesterday=`yesterday`,e.tomorrow=`tomorrow`,e.last7Days=`last7Days`,e.thisMonth=`thisMonth`,e.lastMonth=`lastMonth`,e.nextMonth=`nextMonth`,e.thisWeek=`thisWeek`,e.lastWeek=`lastWeek`,e.nextWeek=`nextWeek`,e}({}),u=function(e){return e.greaterThan=`greaterThan`,e.greaterThanOrEqual=`greaterThanOrEqual`,e.lessThan=`lessThan`,e.lessThanOrEqual=`lessThanOrEqual`,e.notBetween=`notBetween`,e.between=`between`,e.equal=`equal`,e.notEqual=`notEqual`,e}({}),d=function(e){return e.highlightCell=`highlightCell`,e.dataBar=`dataBar`,e.colorScale=`colorScale`,e.iconSet=`iconSet`,e}({}),f=function(e){return e.uniqueValues=`uniqueValues`,e.duplicateValues=`duplicateValues`,e.rank=`rank`,e.text=`text`,e.timePeriod=`timePeriod`,e.number=`number`,e.average=`average`,e.formula=`formula`,e}({}),p=function(e){return e.num=`num`,e.min=`min`,e.max=`max`,e.percent=`percent`,e.percentile=`percentile`,e.formula=`formula`,e}({}),m=()=>({cfId:void 0,ranges:[],stopIfTrue:!1,rule:{type:d.highlightCell,subType:f.text,operator:c.containsText}}),h=(e,t)=>{switch(e){case f.text:if([c.beginsWith,c.containsText,c.endsWith,c.equal,c.notContainsText,c.notEqual].includes(t))return``;break;case f.number:return[u.between,u.notBetween].includes(t)?[10,100]:10}return``},g=(e,t)=>{switch(e){case p.formula:return`=`;case p.max:case p.min:return``;case p.percent:case p.percentile:case p.num:return t===void 0?10:t}return``},_=(e,t,n)=>{if(!t)return null;let r=t.findIndex(t=>n(t)===e.id);if(r<0)return null;switch(e.type){case`after`:return r+1;case`before`:return r-1;case`self`:return r}},v=(e,t,n,r)=>{if(!n)return null;let i=_(e,n,r),a=_(t,n,r);if(i===null||a===null||i===a)return;let o=n.splice(i,1)[0];switch(i<a&&(a=_(t,n,r)),t.type){case`before`:n.splice(a+1,0,o);break;case`self`:case`after`:n.splice(a,0,o);break}},y=(e,t,n,r)=>{if(e.type===`after`&&[`after`,`before`].includes(t.type))return[e,t];let i={...e},a={...t};if(i.type!==`after`){let e=_(i,n,r);if(e===null)return null;if(e-1<0){let t=n[e+1];if(t)i.id=r(t),i.type=`before`;else return null}else i.id=r(n[e-1]),i.type=`after`}if(![`after`,`before`].includes(a.type)){let e=_(a,n,r);if(e===null)return null;if(e===0)a.type=`before`;else if(e-1>=0)a.id=r(n[e-1]),a.type=`after`;else if(e+1<=n.length-1)a.id=r(n[e+1]),a.type=`before`;else return null}return i.id===a.id&&i.type===a.type?null:[i,a]},b=(e,t)=>{if([`after`,`before`].includes(t.type)){if(e.type===`after`)return[t,e];if(e.type===`before`)return[t,{...e,type:`self`}]}return null},x=(e,t)=>e.id===t.id&&e.type===t.type,S=()=>`${(0,t.generateRandomId)(8)}`;function C(e){"@babel/helpers - typeof";return C=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},C(e)}function w(e,t){if(C(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(C(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ee(e){var t=w(e,`string`);return C(t)==`symbol`?t:t+``}function T(e,t,n){return(t=ee(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E=class{constructor(){T(this,`_model`,new Map),T(this,`_ruleChange$`,new r.Subject),T(this,`$ruleChange`,this._ruleChange$.asObservable())}_ensureList(e,t){let n=this.getSubunitRules(e,t);if(!n){n=[];let r=this._model.get(e);r||(r=new Map,this._model.set(e,r)),r.set(t,n)}return n}getRule(e,t,n){let r=this.getSubunitRules(e,t);return r?r.find(e=>e.cfId===n):null}getUnitRules(e){return this._model.get(e)||null}getSubunitRules(e,t){var n;return((n=this._model.get(e))==null?void 0:n.get(t))||null}getAll(){return this._model}deleteRule(e,t,n){let r=this.getSubunitRules(e,t);if(r){let i=r.findIndex(e=>e.cfId===n),a=r[i];a&&(r.splice(i,1),this._ruleChange$.next({rule:a,subUnitId:t,unitId:e,type:`delete`}))}}setRule(e,n,r,i){let a=this._ensureList(e,n).find(e=>e.cfId===i);if(a){let i=t.Tools.deepClone(a);Object.assign(a,r),this._ruleChange$.next({rule:a,subUnitId:n,unitId:e,type:`set`,oldRule:i})}}addRule(e,t,n){let r=this._ensureList(e,t);r.find(e=>e.cfId===n.cfId)||r.unshift(n),this._ruleChange$.next({rule:n,subUnitId:t,unitId:e,type:`add`})}moveRulePriority(e,t,n,r){let i=this._ensureList(e,t),a=_(n,i,e=>e.cfId),o=_(r,i,e=>e.cfId);if(o===null||a===null||o===a)return;let s=i[a];s&&(v(n,r,i,e=>e.cfId),this._ruleChange$.next({rule:s,subUnitId:t,unitId:e,type:`sort`}))}createCfId(e,t){return S()}deleteUnitId(e){this._model.delete(e)}};let D={type:t.CommandType.MUTATION,id:`sheet.mutation.move-conditional-rule`,handler(e,t){if(!t)return!1;let{unitId:n,subUnitId:r,start:i,end:a}=t;return e.get(E).moveRulePriority(n,r,i,a),!0}},te=e=>{let{unitId:t,subUnitId:n}=e,r=b(e.start,e.end);if(!r)return[];let[i,a]=r;return[{id:D.id,params:{unitId:t,subUnitId:n,start:i,end:a}}]},O=(e,n)=>{let r=e.get(E),{unitId:i,subUnitId:a,cfId:o}=n,s=[...r.getSubunitRules(i,a)||[]],c=s.findIndex(e=>e.cfId===o),l=s[c-1];if(c>-1){let e=s[c],n=[{id:j.id,params:{unitId:i,subUnitId:a,rule:t.Tools.deepClone(e)}}];if(s.splice(c,1),c!==0){let e=s[0];if(e){let t=y({id:e.cfId,type:`before`},{id:l.cfId,type:`after`},s,e=>e.cfId);if(!t)return n;let[r,o]=t,c={unitId:i,subUnitId:a,start:r,end:o};n.push({id:D.id,params:c})}}return n}return[]},k={type:t.CommandType.MUTATION,id:`sheet.mutation.delete-conditional-rule`,handler(e,t){if(!t)return!1;let{unitId:n,subUnitId:r,cfId:i}=t;return e.get(E).deleteRule(n,r,i),!0}},A=(e,t)=>({id:k.id,params:{unitId:t.unitId,subUnitId:t.subUnitId,cfId:t.rule.cfId}}),j={type:t.CommandType.MUTATION,id:`sheet.mutation.add-conditional-rule`,handler(e,t){if(!t)return!1;let{unitId:n,subUnitId:r,rule:i}=t;return e.get(E).addRule(n,r,i),!0}},ne={type:t.CommandType.COMMAND,id:`sheet.command.add-conditional-rule`,handler(e,r){if(!r)return!1;let{rule:i}=r,a=e.get(t.IUndoRedoService),o=e.get(t.ICommandService),s=e.get(E),c=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService),r);if(!c)return!1;let{unitId:l,subUnitId:u}=c,d=s.createCfId(l,u),f={unitId:l,subUnitId:u,rule:{...i,cfId:i.cfId||d}},p=A(e,f),m=o.syncExecuteCommand(j.id,f);return m&&a.pushUndoRedo({unitID:l,redoMutations:[{id:j.id,params:f}],undoMutations:[p]}),m}},M={type:t.CommandType.MUTATION,id:`sheet.mutation.set-conditional-rule`,handler(e,t){if(!t)return!1;let{unitId:n,subUnitId:r,rule:i}=t,a=t.cfId||t.rule.cfId;return e.get(E).setRule(n,r,i,a),!0}},N=(e,n)=>{let r=e.get(E),{unitId:i,subUnitId:a}=n,o=n.cfId||n.rule.cfId,s=r.getRule(i,a,o);return s?[{id:M.id,params:{unitId:i,subUnitId:a,cfId:o,rule:t.Tools.deepClone(s)}}]:[]},re={type:t.CommandType.COMMAND,id:`sheet.command.clear-range-conditional-rule`,handler(e,r){var i;if(!r)return!1;let a=e.get(E),o=e.get(t.IUniverInstanceService),s=e.get(t.ICommandService),c=e.get(t.IUndoRedoService),l=e.get(n.SheetsSelectionsService),u=(0,n.getSheetCommandTarget)(o,r);if(!u)return!1;let{unitId:d,subUnitId:f}=u,p=((i=l.getCurrentSelections())==null?void 0:i.map(e=>e.range))||[],m=a.getSubunitRules(d,f);if(!(m!=null&&m.length)||!p.length)return!1;let h=[],g=[];m.forEach(r=>{let i=new t.ObjectMatrix;r.ranges.forEach(e=>{t.Range.foreach(e,(e,t)=>{i.setValue(e,t,1)})}),p.forEach(e=>{t.Range.foreach(e,(e,t)=>{i.realDeleteValue(e,t)})});let a=(0,n.findAllRectangle)((0,n.createTopMatrixFromMatrix)(i));if(a.length){let t={unitId:d,subUnitId:f,rule:{...r,ranges:a}},n=N(e,t);h.push({id:M.id,params:t}),g.push(...n)}else{let t={unitId:d,subUnitId:f,cfId:r.cfId},n=O(e,t);h.push({id:k.id,params:t}),g.push(...n)}});let _=(0,t.sequenceExecute)(h,s).result;return _&&c.pushUndoRedo({unitID:d,redoMutations:h,undoMutations:g}),_}},ie={type:t.CommandType.COMMAND,id:`sheet.command.clear-worksheet-conditional-rule`,handler(e,r){let i=e.get(E),a=e.get(t.IUniverInstanceService),o=e.get(t.ICommandService),s=e.get(t.IUndoRedoService),c=(0,n.getSheetCommandTarget)(a,r);if(!c)return!1;let{unitId:l,subUnitId:u}=c,d=i.getSubunitRules(l,u);if(!(d!=null&&d.length))return!1;let f=d.map(e=>({cfId:e.cfId,unitId:l,subUnitId:u})),p=f.map(e=>({id:k.id,params:e})),m=f.map(t=>O(e,t)[0]),h=(0,t.sequenceExecute)(p,o).result;return h&&s.pushUndoRedo({unitID:l,redoMutations:p,undoMutations:m}),h}},ae={type:t.CommandType.COMMAND,id:`sheet.command.delete-conditional-rule`,handler(e,r){if(!r)return!1;let i=e.get(t.IUndoRedoService),a=e.get(t.ICommandService),o=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService),r);if(!o)return!1;let{unitId:s,subUnitId:c}=o,l={unitId:s,subUnitId:c,cfId:r.cfId},u=O(e,l),d=a.syncExecuteCommand(k.id,l);return d&&i.pushUndoRedo({unitID:s,undoMutations:u,redoMutations:[{id:k.id,params:l}]}),d}},oe={type:t.CommandType.COMMAND,id:`sheet.command.move-conditional-rule`,handler(e,r){if(!r)return!1;let i=e.get(t.IUndoRedoService),a=e.get(t.ICommandService),o=e.get(t.IUniverInstanceService),s=e.get(E),c=(0,n.getSheetCommandTarget)(o,r);if(!c)return!1;let{unitId:l,subUnitId:u}=c,d=y(r.start,r.end,s.getSubunitRules(l,u)||[],e=>e.cfId);if(!d)return!1;let[f,p]=d,m={unitId:l,subUnitId:u,start:f,end:p},h=te(m),g=a.syncExecuteCommand(D.id,m);return g&&i.pushUndoRedo({unitID:l,redoMutations:[{id:D.id,params:m}],undoMutations:h}),g}},se={type:t.CommandType.COMMAND,id:`sheet.command.set-conditional-rule`,handler(e,r){if(!r)return!1;let i=e.get(t.IUndoRedoService),a=e.get(t.ICommandService),o=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService),r);if(!o)return!1;let{unitId:s,subUnitId:c}=o,l={unitId:s,subUnitId:c,rule:r.rule,cfId:r.cfId},u=N(e,l),d=a.syncExecuteCommand(M.id,l);return d&&i.pushUndoRedo({unitID:s,undoMutations:u,redoMutations:[{id:M.id,params:l}]}),d}};function P(e,t){return function(n,r){t(n,r,e)}}function F(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let I=class extends t.Disposable{constructor(e,t){super(),this._registerOtherFormulaService=e,this._conditionalFormattingRuleModel=t,T(this,`_formulaMap`,new Map),T(this,`_result$`,new r.Subject),T(this,`result$`,this._result$.asObservable()),this._initFormulaResultChange(),this._initRuleChange()}_initRuleChange(){let e=e=>{switch(e.type){case d.colorScale:return e.config.some(e=>e.value.type===p.formula);case d.dataBar:return[e.config.max,e.config.min].some(e=>e.type===p.formula);case d.iconSet:return e.config.some(e=>e.value.type===p.formula)}};this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(t=>{let{unitId:n,subUnitId:r,rule:i,oldRule:a}=t;t.type===`delete`&&this._removeFormulaByCfId(n,r,i.cfId),t.type===`set`&&(e(i.rule)||a&&e(a.rule))&&this._removeFormulaByCfId(n,r,i.cfId),t.type===`add`&&this._registerRuleFormulas(n,r,i)}))}_registerRuleFormulas(e,t,n){switch(n.rule.type){case d.highlightCell:if(n.rule.subType===f.formula){let r=n.rule.value;r&&this.registerFormulaWithRange(e,t,n.cfId,r,n.ranges)}break}}_initFormulaResultChange(){this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe(e=>{for(let t in e)for(let n in e[t]){let r=e[t][n];for(let e of r){let r=this._ensureSubunitFormulaMap(t,n).getValue(e.formulaId,[`formulaId`]);if(!r)continue;let a=this._getAllFormulaResultByCfId(t,n,r.cfId).every(e=>{let r=this._registerOtherFormulaService.getFormulaValueSync(t,n,e.formulaId);return(r==null?void 0:r.status)===i.FormulaResultStatus.SUCCESS});this._result$.next({...r,isAllFinished:a})}}}))}_ensureSubunitFormulaMap(e,n){let r=this._formulaMap.get(e);r||(r=new Map,this._formulaMap.set(e,r));let i=r.get(n);return i||(i=new t.RefAlias([],[`formulaId`,`id`]),r.set(n,i)),i}getSubUnitFormulaMap(e,t){var n;return(n=this._formulaMap.get(e))==null?void 0:n.get(t)}registerFormulaWithRange(e,t,n,r,a=[{startRow:0,endRow:0,startColumn:0,endColumn:0}]){let o=this._ensureSubunitFormulaMap(e,t),s=this.createCFormulaId(n,r);if(o.getValue(s,[`id`]))return;let c=this._registerOtherFormulaService.registerFormulaWithRange(e,t,r,a,void 0,i.OtherFormulaBizType.CONDITIONAL_FORMATTING,n);o.addValue({formulaText:r,unitId:e,subUnitId:t,cfId:n,id:s,formulaId:c})}_removeFormulaByCfId(e,t,n){let r=this.deleteCache(e,t,n).map(e=>e.formulaId);this._registerOtherFormulaService.deleteFormula(e,t,r)}getFormulaResultWithCoords(e,t,n,r,a=0,o=0){let s=this.getSubUnitFormulaMap(e,t);if(!s)return{status:i.FormulaResultStatus.NOT_REGISTER};let c=s.getValue(this.createCFormulaId(n,r),[`id`]);if(!c)return{status:i.FormulaResultStatus.NOT_REGISTER};let l=this._registerOtherFormulaService.getFormulaValueSync(e,t,c.formulaId);if(!l)return{status:i.FormulaResultStatus.NOT_REGISTER};if(l.status===i.FormulaResultStatus.SUCCESS&&l.result){var u;let e=(u=l.result[a])==null?void 0:u[o];return{result:this._getCellValue(e),status:i.FormulaResultStatus.SUCCESS}}return{status:l.status}}getFormulaMatrix(e,n,r,a){let o=this.getSubUnitFormulaMap(e,n);if(!o)return{status:i.FormulaResultStatus.NOT_REGISTER};let s=o.getValue(this.createCFormulaId(r,a),[`id`]);if(!s)return{status:i.FormulaResultStatus.NOT_REGISTER};let c=this._registerOtherFormulaService.getFormulaValueSync(e,n,s.formulaId);if(!c)return{status:i.FormulaResultStatus.NOT_REGISTER};if(c.status===i.FormulaResultStatus.SUCCESS&&c.result){let e=new t.ObjectMatrix;return new t.ObjectMatrix(c.result).forValue((t,n,r)=>{e.setValue(t,n,this._getCellValue(r))}),{result:e,status:i.FormulaResultStatus.SUCCESS}}return{status:c.status}}_getCellValue(e){if(!e||!e[0]||!e[0][0])return!1;let n=e[0][0];return(n==null?void 0:n.t)===t.CellValueType.BOOLEAN?n.v===t.BooleanNumber.TRUE||n.v===!0:n==null?void 0:n.v}deleteCache(e,t,n,r){let i=this.getSubUnitFormulaMap(e,t);if(!i)return[];if(r){let e=this.createCFormulaId(n,r);return i.deleteValue(e,[`id`]),[]}else{let e=i.getValues().filter(e=>e.cfId===n);return e.forEach(e=>{i.deleteValue(e.formulaId,[`formulaId`])}),e}}_getAllFormulaResultByCfId(e,t,n){let r=this.getSubUnitFormulaMap(e,t);return r?r.getValues().filter(e=>e.cfId===n):[]}createCFormulaId(e,t){return`${e}_${t}`}};I=F([P(0,(0,t.Inject)(i.RegisterOtherFormulaService)),P(1,(0,t.Inject)(E))],I);let L=function(e){return e.preComputingStart=`preComputingStart`,e.preComputing=`preComputing`,e.preComputingEnd=`preComputingEnd`,e.preComputingError=`preComputingError`,e}({});var R=class{constructor(e){this._context=e,T(this,`_cache`,void 0),T(this,`_preComputingStatus$`,new r.BehaviorSubject(L.preComputingStart)),T(this,`preComputingStatus$`,this._preComputingStatus$.asObservable().pipe((0,a.distinctUntilChanged)())),T(this,`_preComputingCache`,void 0),T(this,`_rule`,void 0),this._cache=new t.LRUMap(e.limit),this._rule=e.rule,this._preComputingCache=null,this._initClearCacheListener()}setCacheLength(e){this._cache.limit=e}clearCache(){this._cache.clear()}resetPreComputingCache(){this._preComputingStatus$.next(L.preComputingStart),this._preComputingCache=null}updateRule(e){this._rule=e,this.resetPreComputingCache()}getCell(e,t){let n=this._createKey(e,t);if(this._preComputingStatus$.getValue()===L.preComputing)return this._cache.get(n);let r=this.getPreComputingResult(e,t);if(r===null&&(this._preComputingStatus$.next(L.preComputingStart),this.preComputing(e,t,this._getContext()),r=this.getPreComputingResult(e,t),r===null)||(this._preComputingStatus$.next(L.preComputingEnd),this._cache.has(n)))return this._cache.get(n);let i=this.getCellResult(e,t,r,this._getContext());return i!==null&&this._setCache(e,t,i),i}setPreComputingCache(e){this._preComputingCache=e}getPreComputingResult(e,t){return this._preComputingCache}_createKey(e,t){return`${e}_${t}`}_setCache(e,t,n){let r=this._createKey(e,t);this._cache.set(r,n)}_getContext(){return{...this._context,rule:this._rule}}_initClearCacheListener(){this.preComputingStatus$.subscribe(e=>{e===L.preComputingEnd&&this.clearCache()})}},ce=class extends R{preComputing(e,n,r){let a=r.rule,s=r.worksheet,c=new t.ObjectMatrix;a.rule.config.every(e=>e.value.type===p.num)||Y(a.ranges,s.getMaxRows()-1,s.getMaxColumns()-1).forEach(e=>{t.Range.foreach(e,(e,n)=>{let i=r.getCellValue(e,n),a=i&&i.v;if(!U(a)&&(i==null?void 0:i.t)===t.CellValueType.NUMBER){let t=Number(a);!Number.isNaN(t)&&c.setValue(e,n,t)}})});let l=[...a.rule.config].sort((e,t)=>e.index-t.index).map(e=>({value:K(e.value,c,{...r,cfId:a.cfId}),color:new t.ColorKit(e.color)}));if(!l.some(e=>(0,o.isObject)(e.value)?e.value.status!==i.FormulaResultStatus.SUCCESS:!1)){let e=l.map(e=>e.color).reduce((e,t,n)=>(e.result.push({color:t,value:e.sortValue[n]}),e),{result:[],sortValue:l.map(e=>e.value.result).sort((e,t)=>e-t)}).result;this.setPreComputingCache(e),this._preComputingStatus$.next(L.preComputingEnd);return}this._preComputingStatus$.next(L.preComputing)}getCellResult(e,n,r,i){if(!r)return null;let a=i.getCellValue(e,n);if(a.t===t.CellValueType.NUMBER){let e=Number(a.v);if(!Number.isNaN(e))return J(r,e)}}};let le=`sheet-conditional-rule-data-bar`,ue=`#000`,de=e=>{let{startRow:t,endRow:n,startColumn:r,endColumn:i}=e;return`${t}-${n}-${r}-${i}`};var fe=class extends o.SheetExtension{constructor(...e){super(...e),T(this,`_paddingRightAndLeft`,2),T(this,`_paddingTopAndBottom`,2),T(this,`uKey`,le),T(this,`Z_INDEX`,34),T(this,`_radius`,1)}draw(e,n,r,i){let{worksheet:a}=r;if(!a)return!1;let s=new Set;e.save(),t.Range.foreach(r.rowColumnSegment,(t,n)=>{if(!a.getRowVisible(t)||!a.getColVisible(n))return;let c=r.getCellWithCoordByIndex(t,n,!1),{isMerged:l,isMergedMainCell:u,mergeInfo:d}=c,f=a.getCell(t,n);if(l&&(f=a.getCell(d.startRow,d.startColumn)),!(f!=null&&f.dataBar)||!this.isRenderDiffRangesByCell(d,i))return;if(l||u){let e=de(d);if(s.has(e))return;s.add(e)}let{color:p,value:m,startPoint:h,isGradient:g}=f.dataBar,{startX:_,endX:v,startY:y,endY:b}=l||u?d:c,x=v-_,S=b+o.FIX_ONE_PIXEL_BLUR_OFFSET-y,C=x-this._paddingRightAndLeft*2,w=S-this._paddingTopAndBottom*2;if(m>0){let t=Math.max(C*(1-h/100)*m/100,1),n=_+this._paddingRightAndLeft+h/100*C,r=y+this._paddingTopAndBottom;if(g){let i=e.createLinearGradient(n,r,n+t,r);i.addColorStop(0,p),i.addColorStop(1,`rgb(255 255 255)`),e.fillStyle=i,e.strokeStyle=p,e.lineWidth=1}else e.fillStyle=p;this._drawRectWithRoundedCorner(e,n,r,t,w,!1,!0,!0,!1),g&&e.stroke()}else{let t=Math.max(C*h/100*Math.abs(m)/100,1),n=_+this._paddingRightAndLeft+h/100*C-t,r=y+this._paddingTopAndBottom;if(g){let i=e.createLinearGradient(n,r,n+t,r);i.addColorStop(0,`rgb(255 255 255)`),i.addColorStop(1,p),e.fillStyle=i,e.strokeStyle=p,e.lineWidth=1}else e.fillStyle=p;this._drawRectWithRoundedCorner(e,n,r,t,w,!0,!1,!1,!0),g&&e.stroke()}}),e.restore()}_drawRectWithRoundedCorner(e,t,n,r,i,a,o,s,c){let l=this._radius;!i||!r||(e.beginPath(),e.moveTo(t+l,n),e.lineTo(t+r-l,n),o?e.arcTo(t+r,n,t+r,n+l,l):e.lineTo(t+r,n),e.lineTo(t+r,n+i-l),s?e.arcTo(t+r,n+i,t+r-l,n+i,l):e.lineTo(t+r,n+i),e.lineTo(t+l,n+i),c?e.arcTo(t,n+i,t,n+i-l,l):e.lineTo(t,n+i),e.lineTo(t,n+l),a?e.arcTo(t,n,t+l,n,l):e.lineTo(t,n),e.closePath(),e.fill())}};o.SpreadsheetExtensionRegistry.add(fe);let z=e=>Math.max(Math.min(100,e),0),pe=(e,n,r)=>{let i=r(e,n);if(i&&i.t===t.CellValueType.NUMBER){let e=Number(i.v);return Number.isNaN(e)?null:e}return null};var me=class extends R{preComputing(e,n,r){let a=r.rule,o=a.rule,s=r.worksheet,c=new t.ObjectMatrix;[a.rule.config.max,a.rule.config.min].every(e=>e.type===p.num)||Y(a.ranges,s.getMaxRows()-1,s.getMaxColumns()-1).forEach(e=>{t.Range.foreach(e,(e,n)=>{let i=r.getCellValue(e,n),a=i&&i.v;if(!U(a)&&(i==null?void 0:i.t)===t.CellValueType.NUMBER){let t=Number(a);!Number.isNaN(t)&&c.setValue(e,n,t)}})});let l=K(o.config.min,c,{...r,cfId:a.cfId}),u=K(o.config.max,c,{...r,cfId:a.cfId}),d=0,f=0;if(l.status===i.FormulaResultStatus.SUCCESS){let e=Number(l.result);d=Number.isNaN(e)?0:e}else{this._preComputingStatus$.next(L.preComputing);return}if(u.status===i.FormulaResultStatus.SUCCESS){let e=Number(u.result),t=Number.isNaN(e)?0:e;f=Math.max(t,d),d=Math.min(t,d);let n=50;if(d<0&&f<=0)n=100;else if(d<0&&f>0){let e=Math.abs(f)+Math.abs(d);n=Math.abs(d)/e*100}else d>=0&&f>0&&(n=0);this.setPreComputingCache({min:d,max:f,startPoint:n}),this._preComputingStatus$.next(L.preComputingEnd);return}this._preComputingStatus$.next(L.preComputing)}getCellResult(e,t,n,r){let{min:i,max:a,startPoint:o}=n,s=r.rule.rule,c=s.isShowValue,l=s.config.isGradient,u=pe(e,t,r.getCellValue);if(!(u===null||u<i||i===a||a<i)){if(u===0)return{color:ue,startPoint:o,value:0,isGradient:l,isShowValue:c};if(i<0&&a<=0){let e=a-i,t=z((a-u)/e*100);return t===0?void 0:{color:s.config.nativeColor||`#abd91a`,startPoint:o,value:-t,isGradient:l,isShowValue:c}}else if(i<0&&a>0)if(u>0){let e=z(Math.min(u/a,1)*100);return e===0?void 0:{color:s.config.positiveColor||`#ffbe38`,startPoint:o,value:e,isGradient:l,isShowValue:c}}else{let e=z(Math.min(Math.abs(u)/Math.abs(i),1)*100);return e===0?void 0:{color:s.config.nativeColor||`#abd91a`,startPoint:o,value:-e,isGradient:l,isShowValue:c}}else if(i>=0&&a>0){let e=a-i,t=z((1-(a-u)/e)*100);return t===0?void 0:{color:s.config.positiveColor||`#ffbe38`,startPoint:0,value:t,isGradient:l,isShowValue:c}}}}},he=class extends R{preComputing(e,n,r){let a=r.rule.rule,o=Y(r.rule.ranges,r.worksheet.getMaxRows()-1,r.worksheet.getMaxColumns()-1),s=(()=>{switch(a.subType){case f.average:{let e=0,n=0;return o.forEach(i=>{t.Range.foreach(i,(i,a)=>{let o=r.getCellValue(i,a),s=W(o);o&&o.t===t.CellValueType.NUMBER&&!U(s)&&(e+=Number(s)||0,n++)})}),{value:e/n,type:a.subType}}case f.uniqueValues:case f.duplicateValues:{let e=new Map;return o.forEach(n=>{t.Range.foreach(n,(t,n)=>{let i=W(r.getCellValue(t,n));if(!U(i)){let t=e.get(i);t?e.set(i,t+1):e.set(i,1)}})}),{value:e,type:a.subType}}case f.rank:{let e=[];o.forEach(n=>{t.Range.foreach(n,(n,i)=>{let a=r.getCellValue(n,i),o=W(a);a&&a.t===t.CellValueType.NUMBER&&!U(o)&&e.push(Number(o)||0)})}),e.sort((e,t)=>t-e);let n=r.rule.rule;if(n.isPercent){n.isBottom&&(e=e.toReversed());let r=t.Tools.clamp(n.value,0,100)/100,i=Math.floor(r*e.length),o=t.Tools.clamp(i-1,0,e.length-1);return{value:e[o],type:a.subType}}let i=Math.floor(t.Tools.clamp(n.isBottom?n.value-1:n.value,0,e.length));return n.isBottom?{value:e[e.length-i-1],type:a.subType}:{value:e[Math.max(i-1,0)],type:a.subType}}case f.formula:{let e=a,t=r.accessor.get(I);t.registerFormulaWithRange(r.unitId,r.subUnitId,r.rule.cfId,e.value,r.rule.ranges);let n=t.getFormulaMatrix(r.unitId,r.subUnitId,r.rule.cfId,e.value);return n&&n.status===i.FormulaResultStatus.SUCCESS?(this._preComputingStatus$.next(L.preComputingEnd),{value:n.result,type:a.subType}):(this._preComputingStatus$.next(L.preComputing),null)}case f.timePeriod:switch(a.operator){case l.last7Days:return{value:{start:(0,t.dayjs)().subtract(7,`day`).valueOf(),end:(0,t.dayjs)().valueOf()},type:a.subType};case l.lastMonth:return{value:{start:(0,t.dayjs)().startOf(`month`).subtract(1,`month`).valueOf(),end:(0,t.dayjs)().endOf(`month`).subtract(1,`month`).valueOf()},type:a.subType};case l.lastWeek:return{value:{start:(0,t.dayjs)().startOf(`week`).subtract(1,`week`).valueOf(),end:(0,t.dayjs)().endOf(`week`).subtract(1,`week`).valueOf()},type:a.subType};case l.nextMonth:return{value:{start:(0,t.dayjs)().startOf(`month`).add(1,`month`).valueOf(),end:(0,t.dayjs)().endOf(`month`).add(1,`month`).valueOf()},type:a.subType};case l.nextWeek:return{value:{start:(0,t.dayjs)().startOf(`week`).add(1,`week`).valueOf(),end:(0,t.dayjs)().endOf(`week`).add(1,`week`).valueOf()},type:a.subType};case l.thisMonth:return{value:{start:(0,t.dayjs)().startOf(`month`).valueOf(),end:(0,t.dayjs)().endOf(`month`).valueOf()},type:a.subType};case l.thisWeek:return{value:{start:(0,t.dayjs)().startOf(`week`).valueOf(),end:(0,t.dayjs)().endOf(`week`).valueOf()},type:a.subType};case l.today:return{value:{start:(0,t.dayjs)().startOf(`day`).valueOf(),end:(0,t.dayjs)().endOf(`day`).valueOf()},type:a.subType};case l.tomorrow:return{value:{start:(0,t.dayjs)().startOf(`day`).add(1,`day`).valueOf(),end:(0,t.dayjs)().endOf(`day`).add(1,`day`).valueOf()},type:a.subType};case l.yesterday:return{value:{start:(0,t.dayjs)().startOf(`day`).subtract(1,`day`).valueOf(),end:(0,t.dayjs)().endOf(`day`).subtract(1,`day`).valueOf()},type:a.subType}}}})();this.setPreComputingCache(s)}getCellResult(e,n,r,a){let o=a.getCellValue(e,n),s=a.rule.rule;return(()=>{switch(s.subType){case f.number:{let e=o&&Number(o.v),n=(o==null?void 0:o.t)===t.CellValueType.NUMBER,r=s;return n?U(e)||Number.isNaN(e)?void 0:q({operator:r.operator,value:r.value||0},e||0):!![u.notEqual,u.notBetween].includes(r.operator)}case f.text:{let e=s,t=W(o),n=U(t)?``:String(t),r=e.value||``;switch(e.operator){case c.beginsWith:return n.startsWith(r);case c.containsBlanks:return/^\s*$/.test(n);case c.notContainsBlanks:return!/^\s*$/.test(n);case c.containsErrors:return i.ERROR_TYPE_SET.has(n);case c.notContainsErrors:return!i.ERROR_TYPE_SET.has(n);case c.containsText:return n.indexOf(r)>-1;case c.notContainsText:return n.indexOf(r)===-1;case c.endsWith:return n.endsWith(r);case c.equal:return n===r;case c.notEqual:return n!==r;default:return!1}}case f.timePeriod:{let e=W(o);if(U(e)||Number.isNaN(Number(e))||(o==null?void 0:o.t)!==t.CellValueType.NUMBER||!r)return;let n=ye(Number(e)),{start:i,end:a}=r.value;return n>=i&&n<=a}case f.average:{let e=o&&o.v,n=Number(e),i=(o==null?void 0:o.t)===t.CellValueType.NUMBER,a=s;if(!i)return u.notEqual===a.operator;if(U(e)||Number.isNaN(n)||!r)return!1;let c=r.value;switch(a.operator){case u.greaterThan:return n>c;case u.greaterThanOrEqual:return n>=c;case u.lessThan:return n<c;case u.lessThanOrEqual:return n<=c;case u.equal:return H(n,c);case u.notEqual:return!H(n,c);default:return!1}}case f.rank:{let e=W(o),n=Number(e);if(U(e)||Number.isNaN(n)||(o==null?void 0:o.t)!==t.CellValueType.NUMBER||!r)return!1;let i=r.value;return s.isBottom?n<=i:n>=i}case f.uniqueValues:{let e=W(o);return U(e)||!r?!1:r.value.get(e)===1}case f.duplicateValues:{let e=W(o);if(U(e)||!r)return!1;let t=r.value.get(e);return t&&t!==1}case f.formula:{let t=r==null?void 0:r.value;if(t){let r=a.rule.ranges[0],i=e-r.startRow,o=n-r.startColumn;return t.getValue(i,o)===!0}return!1}}})()?s.style:{}}};let ge=(e,n,r)=>{let i=r(e,n);if(i&&i.t===t.CellValueType.NUMBER){let e=Number(i.v);return Number.isNaN(e)?null:e}return null};var _e=class extends R{preComputing(e,n,r){let a=r.rule.rule,o=r.worksheet,s=new t.ObjectMatrix;a.config.every(e=>e.value.type===p.num)||Y(r.rule.ranges,o.getMaxRows()-1,o.getMaxColumns()-1).forEach(e=>{t.Range.foreach(e,(e,n)=>{let i=r.getCellValue(e,n),a=i&&i.v;if(!U(a)&&(i==null?void 0:i.t)===t.CellValueType.NUMBER){let t=Number(a);!Number.isNaN(t)&&s.setValue(e,n,t)}})});let c=a.config.map(e=>K(e.value,s,{...r,cfId:r.rule.cfId}));if(!c.some(e=>e.status!==i.FormulaResultStatus.SUCCESS)){let e=c.map((e,t)=>({operator:a.config[t].operator,value:Number(e.result)||0})).reduce((e,t,n,r)=>{let i=a.config[n];if(!n||n===r.length-1)e.push({...t,iconId:i.iconId,iconType:i.iconType});else{let a=r[n-1];q(a,t.value)||e.push({...t,iconId:i.iconId,iconType:i.iconType})}return e},[]);this.setPreComputingCache(e),this._preComputingStatus$.next(L.preComputingEnd);return}this._preComputingStatus$.next(L.preComputing)}getCellResult(e,t,n,r){if(!n)return null;let i=ge(e,t,r.getCellValue);if(i===null)return;let a=r.rule.rule,o=a.isShowValue===void 0?!0:!!a.isShowValue;for(let e=0;e<n.length;e++){let t=n[e],r={...t},a={...t},{iconId:s,iconType:c}=t;if(e===0){if(q(t,i))return{iconId:s,iconType:c,isShowValue:o}}else if(e===n.length-1)return{iconId:s,iconType:c,isShowValue:o};else{let t=n[e-1];if(a.operator=xe(t.operator),a.value=t.value,q(r,i)&&q(a,i))return{iconId:s,iconType:c,isShowValue:o}}}}};let B=1e3*3*3,V=class extends t.Disposable{constructor(e,n,i,o){super(),this._injector=e,this._conditionalFormattingRuleModel=n,this._conditionalFormattingFormulaService=i,this._univerInstanceService=o,T(this,`_calculateUnitManagers`,new Map),T(this,`_rTreeManager`,new t.RTree),T(this,`_cellCache`,new t.LRUMap(B)),T(this,`_markDirty$`,new r.Subject),T(this,`markDirty$`,this._markDirty$.asObservable()),T(this,`_markRuleDirtyAtOnce`,(e,t,n,r=!0)=>{if(this._cellCache.clear(),r){let r=this._ensureCalculateUnitManager(e,t).get(n);r&&r.resetPreComputingCache()}this._markDirty$.next({unitId:e,subUnitId:t,cfId:n})}),T(this,`markRuleDirty`,(()=>{let e=new r.Subject;return this.disposeWithMe(e.pipe((0,a.bufferTime)(100),(0,a.filter)(e=>!!e.length),(0,a.map)(e=>{let t=new Set,n=[];return e.forEach(e=>{let r=`${e.unitId}_${e.subUnitId}_${e.cfId}`;if(t.has(r)){if(e.isNeedResetPreComputingCache){let t=n.find(t=>t.cfId===e.cfId);t.isNeedResetPreComputingCache=!0}return}t.add(r),n.push({...e})}),n})).subscribe(e=>{e.forEach(e=>{this._markRuleDirtyAtOnce(e.unitId,e.subUnitId,e.cfId,e.isNeedResetPreComputingCache)})})),(t,n,r,i=!0)=>{e.next({unitId:t,subUnitId:n,cfId:r,isNeedResetPreComputingCache:i})}})()),this._initRuleListener(),this._handleCustomFormulasSeparately(),this._initCFFormulaListener()}_initCFFormulaListener(){this.disposeWithMe(this._conditionalFormattingFormulaService.result$.subscribe(({unitId:e,subUnitId:t,cfId:n,isAllFinished:r})=>{r&&this._markRuleDirtyAtOnce(e,t,n,r)}))}getCellCfs(e,t,n,r){let i=this._createCacheKey(e,t,n,r);if(this._cellCache.has(i))return this._cellCache.get(i);let a=this._getCellCfs(e,t,n,r);return a.length&&this._cellCache.set(i,a),a}_getCellCfs(e,t,n,r){var i;let a=(i=this._conditionalFormattingRuleModel.getSubunitRules(e,t))==null?[]:i,o=this._ensureCalculateUnitManager(e,t),s=this._rTreeManager.bulkSearch([{unitId:e,sheetId:t,range:{startColumn:r,endColumn:r,startRow:n,endRow:n}}]),c=a.filter(e=>s.has(e.cfId));return c.length?c.map(e=>{let t=o.get(e.cfId);return t?{cfId:e.cfId,result:t.getCell(n,r)}:null}).filter(e=>!!e).map((e,t)=>({...e,priority:t})):[]}dispose(){this.clearCache(),super.dispose()}clearCache(){this._calculateUnitManagers.clear(),this._cellCache.clear(),this._rTreeManager.clear()}_handleCustomFormulasSeparately(){this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(e=>{if(e.type===`set`){let{unitId:t,subUnitId:n}=e,r=e.oldRule;r.rule.type===d.highlightCell&&r.rule.subType===f.formula&&this._conditionalFormattingFormulaService.deleteCache(t,n,r.cfId)}}))}_initRuleListener(){this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(e=>{let{unitId:t,subUnitId:n,rule:r}=e,{cfId:i,ranges:a}=r,o=this._ensureCalculateUnitManager(t,n);switch(this.markRuleDirty(t,n,i),e.type){case`add`:{this._rTreeManager.bulkInsert(a.map(e=>({unitId:t,sheetId:n,id:i,range:e})));let e=this._createRuleCalculateUnitInstance(t,n,r);if(!e)return;o.set(r.cfId,e);break}case`delete`:this._rTreeManager.bulkRemove(a.map(e=>({unitId:t,sheetId:n,id:i,range:e}))),o.delete(r.cfId);break;case`set`:{let s=e.oldRule;if(this._rTreeManager.bulkRemove(s.ranges.map(e=>({unitId:t,sheetId:n,id:s.cfId,range:e}))),this._rTreeManager.bulkInsert(a.map(e=>({unitId:t,sheetId:n,id:i,range:e}))),s.rule.type!==r.rule.type){let e=this._createRuleCalculateUnitInstance(t,n,r);if(!e)return;o.delete(s.cfId),o.set(r.cfId,e)}else{let e=o.get(s.cfId);if(!e)return;e.updateRule(r)}}}}))}_ensureCalculateUnitManager(e,t){let n=this._calculateUnitManagers.get(e);n||(n=new Map,this._calculateUnitManagers.set(e,n));let r=n.get(t);return r||(r=new Map,n.set(t,r)),r}_createRuleCalculateUnitInstance(e,t,n){let r=this._univerInstanceService.getUnit(e),i=r==null?void 0:r.getSheetBySheetId(t);if(!r||!i)return;let a={workbook:r,worksheet:i,unitId:e,subUnitId:t,accessor:this._injector,rule:n,limit:B,getCellValue:(e,t)=>i.getCellRaw(e,t)||{}};switch(n.rule.type){case d.colorScale:return new ce(a);case d.dataBar:return new me(a);case d.highlightCell:return new he(a);case d.iconSet:return new _e(a)}}_createCacheKey(e,t,n,r){return`${e}_${t}_${n}_${r}`}setCacheLength(e=B){this._cellCache.limit!==e&&(this._cellCache.limit=e,this._calculateUnitManagers.forEach(t=>{t.forEach(t=>{t.forEach(t=>{t.setCacheLength(e)})})}))}};V=F([P(0,(0,t.Inject)(t.Injector)),P(1,(0,t.Inject)(E)),P(2,(0,t.Inject)(I)),P(3,t.IUniverInstanceService)],V);function H(e,t){return Math.abs(e-t)<2**-52}let U=e=>e==null||typeof e==`string`&&e.trim()===``,W=e=>{var n;if(!e)return null;if(e.t===t.CellValueType.BOOLEAN)return e.v===t.BooleanNumber.TRUE?i.BooleanValue.TRUE:i.BooleanValue.FALSE;let r=e.v,a=(n=e.p)==null||(n=n.body)==null?void 0:n.dataStream.replace(/\r\n$/,``);return U(r)?U(a)?null:a:r},G=86400;function ve(e,t=!0){if(t&&e>=0){if(e===0)return[1900,1,0];if(e===60)return[1900,2,29];if(e<60)return[1900,e<32?1:2,(e-1)%31+1]}let n=e+68569+2415019,r=Math.floor(4*n/146097);n-=Math.floor((146097*r+3)/4);let i=Math.floor(4e3*(n+1)/1461001);n=n-Math.floor(1461*i/4)+31;let a=Math.floor(80*n/2447),o=n-Math.floor(2447*a/80);n=Math.floor(a/11);let s=a+2-12*n;return[100*(r-49)+i+n|0,s|0,o|0]}let ye=e=>{let n=e|0,r=G*(e-n),i=Math.floor(r);r-i>.9999&&(i+=1,i===G&&(i=0,n+=1));let a=i<0?G+i:i,[o,s,c]=ve(e,!0);return(0,t.dayjs)(`${o}/${s}/${c} ${Math.floor(a/60/60)%60}:${Math.floor(a/60)%60}:${Math.floor(a)%60}`).valueOf()},K=(e,t,n)=>{switch(e.type){case p.max:{let e=0;return t.forValue((t,n,r)=>{r>e&&(e=r)}),{status:i.FormulaResultStatus.SUCCESS,result:e}}case p.min:{let e;return t.forValue((t,n,r)=>{e===void 0&&(e=r),r<e&&(e=r)}),{status:i.FormulaResultStatus.SUCCESS,result:e}}case p.percent:{let n,r;t.forValue((e,t,i)=>{(n===void 0||r===void 0)&&(n=i,r=i),i>n&&(n=i),i<r&&(r=i)});let a=(n||0)-(r||0),o=Math.max(Math.min(Number(e.value)||0,100),0);return{status:i.FormulaResultStatus.SUCCESS,result:o/100*a+(r||0)}}case p.percentile:{let n=t.toNativeArray().sort((e,t)=>e-t),r=Math.max(Math.min(Number(e.value)||0,100),0),a=(n.length-1)*r/100,o=Math.floor(a),s=a-o,c=n[o]+(n[Math.min(o+1,n.length-1)]-n[o])*s;return{status:i.FormulaResultStatus.SUCCESS,result:c}}case p.formula:{let{accessor:t,unitId:r,subUnitId:i,cfId:a}=n,o=String(e.value),s=t.get(I);return s.registerFormulaWithRange(r,i,a,o),s.getFormulaResultWithCoords(r,i,a,o)}case p.num:default:{let t=Number(e.value);return{status:i.FormulaResultStatus.SUCCESS,result:Number.isNaN(t)?0:t}}}},be=(e,n,r,i)=>{let{accessor:a}=i,o=a.get(V),s=new t.ObjectMatrix;return r.ranges.forEach(i=>{t.Range.foreach(i,(t,i)=>{let a=o.getCellCfs(e,n,t,i);if(a){let e=a.find(e=>e.cfId===r.cfId);e!=null&&e.result&&s.setValue(t,i,e.result)}})}),s},q=(e,t)=>{switch(e.operator){case u.between:{if(typeof e.value!=`object`||!e.value.length)return;let n=Math.min(...e.value),r=Math.max(...e.value);return t>=n&&t<=r}case u.notBetween:{if(typeof e.value!=`object`||!e.value.length)return;let n=Math.min(...e.value),r=Math.max(...e.value);return!(t>=n&&t<=r)}case u.equal:return H(e.value||0,t);case u.notEqual:return!H(e.value||0,t);case u.greaterThan:return t>(e.value||0);case u.greaterThanOrEqual:return t>=(e.value||0);case u.lessThan:return t<(e.value||0);case u.lessThanOrEqual:return t<=(e.value||0);default:return!1}},xe=e=>{switch(e){case u.greaterThan:return u.lessThanOrEqual;case u.greaterThanOrEqual:return u.lessThan;case u.lessThan:return u.greaterThanOrEqual;case u.lessThanOrEqual:return u.greaterThan}return e},J=(e,n)=>{let r=e=>e.a===void 0?{...e,a:1}:e,i=e.findIndex(e=>e.value>=n),a=i-1;if(i===0)return e[0].color.toRgbString();if(a>=0){let o=e[a],s=e[i];if(o.color.isValid&&s.color.isValid){let e=r(o.color.toRgb()),i=r(s.color.toRgb()),a=s.value-o.value,c=(n-o.value)/a;return new t.ColorKit([`r`,`g`,`b`,`a`].reduce((t,n)=>{let r=e[n];return t[n]=(i[n]-r)*c+r,t},{})).toRgbString()}}else return e[e.length-1].color.toRgbString()},Y=(e,t,n)=>e.map(e=>{if(e.startColumn>n||e.startRow>t)return null;let r={...e};return r.endRow=Math.min(r.endRow,t),r.endColumn=Math.min(r.endColumn,n),r}).filter(e=>!!e);function Se(e){let n=0;return new t.ObjectMatrix(e).forValue((e,t,r)=>{n=Math.max(Number.isNaN(n)?0:n,Number(r))}),n}let X={feedback:{mistake:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%227.03704%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.87359%206.87332C6.6146%207.13231%206.6146%207.55221%206.87359%207.8112L9.062%209.99961L6.87356%2012.188C6.61457%2012.447%206.61457%2012.8669%206.87356%2013.1259C7.13255%2013.3849%207.55245%2013.3849%207.81144%2013.1259L9.99987%2010.9375L12.1882%2013.1258C12.4472%2013.3848%2012.8671%2013.3848%2013.1261%2013.1258C13.3851%2012.8669%2013.3851%2012.447%2013.1261%2012.188L10.9378%209.99961L13.1261%207.81127C13.3851%207.55228%2013.3851%207.13238%2013.1261%206.87339C12.8671%206.61441%2012.4472%206.61441%2012.1882%206.87339L9.99987%209.06173L7.81147%206.87332C7.55248%206.61433%207.13257%206.61433%206.87359%206.87332Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A`,warn:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%227.03704%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Cpath%20d%3D%22M9.16817%206.67735C9.16646%206.61745%209.1656%206.5875%209.16653%206.56236C9.18103%206.16817%209.49136%205.84883%209.88497%205.82306C9.91008%205.82141%209.94004%205.82141%209.99996%205.82141V5.82141C10.0599%205.82141%2010.0899%205.82141%2010.115%205.82306C10.5086%205.84883%2010.8189%206.16817%2010.8334%206.56236C10.8343%206.5875%2010.8335%206.61745%2010.8318%206.67735L10.7043%2011.131C10.6934%2011.5121%2010.3812%2011.8154%209.99995%2011.8154V11.8154C9.61866%2011.8154%209.30655%2011.5121%209.29564%2011.131L9.16817%206.67735Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3Crect%20x%3D%229.31488%22%20y%3D%2212.8086%22%20width%3D%221.37006%22%20height%3D%221.37006%22%20rx%3D%220.685032%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A`,correct:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M17.037%2010C17.037%2013.8865%2013.8864%2017.0371%209.99999%2017.0371C6.11354%2017.0371%202.96295%2013.8865%202.96295%2010C2.96295%206.1136%206.11354%202.96301%209.99999%202.96301C13.8864%202.96301%2017.037%206.1136%2017.037%2010Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3Cpath%20d%3D%22M13.9239%207.17477C13.6638%206.91472%2013.2422%206.91472%2012.9821%207.17477L8.74433%2011.4126L7.01786%209.6861C6.75781%209.42606%206.33619%209.42606%206.07614%209.6861C5.81609%209.94615%205.81609%2010.3678%206.07614%2010.6278L8.27349%2012.8252C8.53354%2013.0852%208.95516%2013.0852%209.21521%2012.8252L9.2195%2012.8209L13.9239%208.1165C14.1839%207.85645%2014.1839%207.43482%2013.9239%207.17477Z%22%20fill%3D%22%23FFFFFF%22%2F%3E%0A%3C%2Fsvg%3E%0A`},star:{starEmpty:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.8451%207.0699%2012.2165%207.33978%2012.6421%207.36863L16.2362%207.61233C16.5693%207.63492%2016.7048%208.05202%2016.4486%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.215%2011.2859%2013.319%2011.6996L14.1979%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6418%2015.5971L10.5908%2013.6817C10.2296%2013.4549%209.77045%2013.4549%209.40924%2013.6817L6.35828%2015.5971C6.07553%2015.7746%205.72072%2015.5168%205.80217%2015.1931L6.68105%2011.6996C6.7851%2011.2859%206.64322%2010.8493%206.31592%2010.5758L3.55145%208.26607C3.29525%208.05202%203.43078%207.63492%203.76386%207.61233L7.358%207.36863C7.78352%207.33978%208.15498%207.0699%208.31391%206.67412L9.65633%203.3312C9.78074%203.0214%2010.2193%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23fff%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A`,starIncomplete:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.845%207.0699%2012.2165%207.33978%2012.642%207.36863L16.2361%207.61233C16.5692%207.63492%2016.7047%208.05202%2016.4485%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.2149%2011.2859%2013.3189%2011.6996L14.1978%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6417%2015.5971L10.5908%2013.6817C10.2295%2013.4549%209.77039%2013.4549%209.40918%2013.6817L6.35822%2015.5971C6.07547%2015.7746%205.72066%2015.5168%205.80211%2015.1931L6.68098%2011.6996C6.78504%2011.2859%206.64316%2010.8493%206.31586%2010.5758L3.55139%208.26607C3.29519%208.05202%203.43072%207.63492%203.7638%207.61233L7.35793%207.36863C7.78346%207.33978%208.15491%207.0699%208.31385%206.67412L9.65627%203.3312C9.78068%203.0214%2010.2192%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23fff%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cmask%20id%3D%22mask1_613_177%22%20style%3D%22mask-type%3Aalpha%22%20maskUnits%3D%22userSpaceOnUse%22%20x%3D%220%22%20y%3D%220%22%20width%3D%2210%22%20height%3D%2220%22%3E%0A%3Crect%20width%3D%2210%22%20height%3D%2220%22%20fill%3D%22%23C4C4C4%22%2F%3E%0A%3C%2Fmask%3E%0A%3Cg%20mask%3D%22url(%23mask1_613_177)%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.845%207.0699%2012.2165%207.33978%2012.642%207.36863L16.2361%207.61233C16.5692%207.63492%2016.7047%208.05202%2016.4485%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.2149%2011.2859%2013.3189%2011.6996L14.1978%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6417%2015.5971L10.5908%2013.6817C10.2295%2013.4549%209.77039%2013.4549%209.40918%2013.6817L6.35822%2015.5971C6.07547%2015.7746%205.72066%2015.5168%205.80211%2015.1931L6.68098%2011.6996C6.78504%2011.2859%206.64316%2010.8493%206.31586%2010.5758L3.55139%208.26607C3.29519%208.05202%203.43072%207.63492%203.7638%207.61233L7.35793%207.36863C7.78346%207.33978%208.15491%207.0699%208.31385%206.67412L9.65627%203.3312C9.78068%203.0214%2010.2192%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A`,starFull:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.3437%203.3312L11.6861%206.67412C11.8451%207.0699%2012.2165%207.33978%2012.6421%207.36863L16.2362%207.61233C16.5693%207.63492%2016.7048%208.05202%2016.4486%208.26608L13.6841%2010.5758C13.3568%2010.8493%2013.215%2011.2859%2013.319%2011.6996L14.1979%2015.1931C14.2793%2015.5168%2013.9245%2015.7746%2013.6418%2015.5971L10.5908%2013.6817C10.2296%2013.4549%209.77045%2013.4549%209.40924%2013.6817L6.35828%2015.5971C6.07553%2015.7746%205.72072%2015.5168%205.80217%2015.1931L6.68105%2011.6996C6.7851%2011.2859%206.64322%2010.8493%206.31592%2010.5758L3.55145%208.26607C3.29525%208.05202%203.43078%207.63492%203.76386%207.61233L7.358%207.36863C7.78352%207.33978%208.15498%207.0699%208.31391%206.67412L9.65633%203.3312C9.78074%203.0214%2010.2193%203.0214%2010.3437%203.3312Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%23FFBD37%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A`},progress:{progress0:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3C%2Fsvg%3E%0A`,progress25:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M16.2963%209.99991C16.2963%209.17307%2016.1335%208.35432%2015.8171%207.59042C15.5006%206.82652%2015.0369%206.13242%2014.4522%205.54776C13.8675%204.96309%2013.1734%204.49931%2012.4095%204.18289C11.6456%203.86647%2010.8269%203.70361%2010%203.70361L10%209.99991H16.2963Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A`,progress50:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M10%2016.2962C11.6699%2016.2962%2013.2714%2015.6328%2014.4522%2014.4521C15.633%2013.2713%2016.2963%2011.6698%2016.2963%209.99991C16.2963%208.33003%2015.633%206.72854%2014.4522%205.54776C13.2714%204.36697%2011.6699%203.70361%2010%203.70361L10%209.99991L10%2016.2962Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A`,progress75:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Cpath%20d%3D%22M3.70374%209.99991C3.70374%2011.2452%204.07301%2012.4625%204.76485%2013.4979C5.4567%2014.5334%206.44005%2015.3404%207.59054%2015.8169C8.74104%2016.2935%2010.007%2016.4182%2011.2284%2016.1752C12.4497%2015.9323%2013.5716%2015.3326%2014.4522%2014.4521C15.3327%2013.5715%2015.9324%2012.4496%2016.1753%2011.2283C16.4183%2010.0069%2016.2936%208.74092%2015.8171%207.59042C15.3405%206.43992%2014.5335%205.45658%2013.4981%204.76473C12.4626%204.07288%2011.2453%203.70361%2010%203.70361L10%209.99991L3.70374%209.99991Z%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A`,progress100:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99993%22%20r%3D%226.66667%22%20stroke%3D%22%237A7A7A%22%20stroke-width%3D%220.740741%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%229.99991%22%20r%3D%226.2963%22%20fill%3D%22%237A7A7A%22%2F%3E%0A%3C%2Fsvg%3E%0A`},signal:{signal0:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A`,signal25:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A`,signal50:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A`,signal75:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93921%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70435%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A`,signal100:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%2214.4764%22%20y%3D%222.98926%22%20width%3D%222.3%22%20height%3D%2214.0597%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%2210.7255%22%20y%3D%225.93933%22%20width%3D%222.3%22%20height%3D%2211.1096%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%226.97455%22%20y%3D%229.70447%22%20width%3D%222.3%22%20height%3D%227.3443%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3Crect%20x%3D%223.22363%22%20y%3D%2213.3302%22%20width%3D%222.3%22%20height%3D%223.71851%22%20rx%3D%220.5%22%20fill%3D%22%230493EE%22%2F%3E%0A%3C%2Fsvg%3E%0A`},feeling:{guffaw:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M16.887%2010C16.887%2013.8037%2013.8036%2016.8871%209.99999%2016.8871C6.19638%2016.8871%203.11295%2013.8037%203.11295%2010C3.11295%206.19644%206.19638%203.11301%209.99999%203.11301C13.8036%203.11301%2016.887%206.19644%2016.887%2010Z%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M12.5355%2013.5821C13.0482%2013.1841%2013.3951%2012.6107%2013.5405%2012.0327C13.5934%2011.8226%2013.5051%2011.6349%2013.3518%2011.5331C13.2036%2011.4346%2013.0031%2011.4203%2012.8265%2011.5131C11.0615%2012.4407%208.94609%2012.4427%207.1828%2011.513C7.00629%2011.4199%206.80602%2011.4343%206.65798%2011.5329C6.50518%2011.6346%206.41701%2011.8217%206.46844%2012.0312C6.61029%2012.609%206.95079%2013.1833%207.46449%2013.5821C8.14361%2014.1093%209.05608%2014.3999%2010%2014.3999C10.9439%2014.3999%2011.8564%2014.1093%2012.5355%2013.5821Z%22%20fill%3D%22white%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.4%22%2F%3E%0A%3C%2Fsvg%3E%0A`,smile:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2011.8518C7.03705%2011.8518%207.77779%2013.7037%2010%2013.7037C12.2222%2013.7037%2012.963%2011.8518%2012.963%2011.8518%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A`,noninductive:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.9259%22%20width%3D%221.48148%22%20height%3D%221.11111%22%20rx%3D%220.555556%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.9259%22%20width%3D%221.48148%22%20height%3D%221.11111%22%20rx%3D%220.555556%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2012.5927C7.03705%2012.5927%208.14816%2012.5927%2010.3704%2012.5927C12.5926%2012.5927%2012.963%2012.5927%2012.963%2012.5927%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A`,dissatisfied:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.03705%2013.7037C7.03705%2013.7037%207.77779%2011.8519%2010%2011.8519C12.2222%2011.8519%2012.963%2013.7037%2012.963%2013.7037%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.962963%22%20stroke-linecap%3D%22round%22%2F%3E%0A%3C%2Fsvg%3E%0A`,impatient:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%229.99999%22%20cy%3D%2210%22%20r%3D%226.88704%22%20fill%3D%22%23FFBD37%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.3%22%2F%3E%0A%3Crect%20x%3D%227.40741%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Crect%20x%3D%2211.1111%22%20y%3D%227.40735%22%20width%3D%221.48148%22%20height%3D%221.48148%22%20rx%3D%220.740741%22%20fill%3D%22%238F5F00%22%2F%3E%0A%3Cpath%20d%3D%22M7.47573%2011.731C6.96306%2012.129%206.61613%2012.7024%206.47071%2013.2804C6.41784%2013.4905%206.50617%2013.6782%206.65942%2013.78C6.80761%2013.8785%207.00813%2013.8928%207.18477%2013.8C8.9498%2012.8724%2011.0652%2012.8704%2012.8285%2013.8002C13.005%2013.8932%2013.2052%2013.8788%2013.3533%2013.7802C13.5061%2013.6785%2013.5942%2013.4914%2013.5428%2013.2819C13.401%2012.7041%2013.0605%2012.1298%2012.5468%2011.731C11.8676%2011.2038%2010.9552%2010.9132%2010.0112%2010.9132C9.06732%2010.9132%208.15485%2011.2038%207.47573%2011.731Z%22%20fill%3D%22white%22%20stroke%3D%22%238F5F00%22%20stroke-width%3D%220.4%22%2F%3E%0A%3C%2Fsvg%3E%0A`},arrow:{"down-red":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M8.90467%203.99244C8.84611%204.1338%208.84611%204.31301%208.84611%204.67143V13.716L5.92068%2010.7906C5.66724%2010.5371%205.54052%2010.4104%205.39916%2010.3519C5.21067%2010.2738%204.9989%2010.2738%204.81041%2010.3519C4.66905%2010.4104%204.54233%2010.5371%204.28889%2010.7906C4.03545%2011.044%203.90873%2011.1707%203.85018%2011.3121C3.77211%2011.5006%203.77211%2011.7124%203.85018%2011.9008C3.90873%2012.0422%204.03545%2012.1689%204.28889%2012.4224L9.03476%2017.1682C9.07839%2017.2127%209.12737%2017.2617%209.18231%2017.3166L9.18239%2017.3167L9.18241%2017.3167C9.40545%2017.5398%209.53035%2017.6647%209.65346%2017.7313C9.67085%2017.7408%209.6882%2017.7492%209.70577%2017.7564C9.89425%2017.8345%2010.106%2017.8345%2010.2945%2017.7564C10.4359%2017.6979%2010.5626%2017.5712%2010.816%2017.3177C10.8986%2017.2352%2010.9677%2017.1661%2011.0253%2017.1056L15.7095%2012.4214L15.7095%2012.4213C15.963%2012.1679%2016.0897%2012.0412%2016.1482%2011.8998C16.2263%2011.7114%2016.2263%2011.4996%2016.1482%2011.3111C16.0897%2011.1697%2015.963%2011.043%2015.7095%2010.7896C15.4561%2010.5361%2015.3294%2010.4094%2015.188%2010.3509C14.9995%2010.2728%2014.7878%2010.2728%2014.5993%2010.3509C14.4579%2010.4094%2014.3312%2010.5361%2014.0778%2010.7896L14.0777%2010.7896L11.1538%2013.7135V4.67142C11.1538%204.31301%2011.1538%204.1338%2011.0953%203.99244C11.0172%203.80395%2010.8674%203.6542%2010.6789%203.57613C10.5376%203.51758%2010.3584%203.51758%209.99996%203.51758C9.64154%203.51758%209.46233%203.51758%209.32097%203.57613C9.13249%203.6542%208.98274%203.80395%208.90467%203.99244Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"right-gold":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.32508%2011.7609C3.46644%2011.8194%203.64565%2011.8194%204.00407%2011.8194H13.049L10.1235%2014.745C9.87002%2014.9984%209.7433%2015.1251%209.68475%2015.2665C9.60668%2015.455%209.60668%2015.6668%209.68475%2015.8552C9.7433%2015.9966%209.87002%2016.1233%2010.1235%2016.3768C10.3769%2016.6302%2010.5036%2016.7569%2010.645%2016.8155C10.8335%2016.8935%2011.0452%2016.8935%2011.2337%2016.8155C11.3751%2016.7569%2011.5018%2016.6302%2011.7552%2016.3768L16.5105%2011.6215C16.5524%2011.5803%2016.5983%2011.5344%2016.6493%2011.4834L16.6495%2011.4831C16.8561%2011.2765%2016.9785%2011.1542%2017.0484%2011.0394C17.0648%2011.0128%2017.0782%2010.9866%2017.0893%2010.9599C17.1674%2010.7714%2017.1674%2010.5596%2017.0893%2010.3711C17.0308%2010.2298%2016.904%2010.1031%2016.6506%209.84962C16.5685%209.76752%2016.4997%209.69872%2016.4394%209.64123L11.7542%204.95601C11.5007%204.70257%2011.374%204.57585%2011.2327%204.5173C11.0442%204.43923%2010.8324%204.43923%2010.6439%204.5173C10.5026%204.57585%2010.3758%204.70257%2010.1224%204.95601L10.1224%204.95601C9.86895%205.20945%209.74223%205.33617%209.68368%205.47753C9.60561%205.66601%209.60561%205.87779%209.68368%206.06627C9.74223%206.20764%209.86895%206.33436%2010.1224%206.5878L13.0463%209.51175H4.00407C3.64565%209.51175%203.46644%209.51175%203.32508%209.5703C3.1366%209.64837%202.98685%209.79812%202.90877%209.98661C2.85022%2010.128%202.85022%2010.3072%202.85022%2010.6656C2.85022%2011.024%202.85022%2011.2032%202.90877%2011.3446C2.98685%2011.5331%203.1366%2011.6828%203.32508%2011.7609Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"up-green":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M11.0936%2017.3406C11.1522%2017.1992%2011.1522%2017.02%2011.1522%2016.6616V7.61701L14.0776%2010.5424C14.3311%2010.7959%2014.4578%2010.9226%2014.5991%2010.9811C14.7876%2011.0592%2014.9994%2011.0592%2015.1879%2010.9811C15.3292%2010.9226%2015.456%2010.7959%2015.7094%2010.5424C15.9628%2010.289%2016.0896%2010.1623%2016.1481%2010.0209C16.2262%209.83243%2016.2262%209.62066%2016.1481%209.43217C16.0896%209.29081%2015.9628%209.16409%2015.7094%208.91065L10.9645%204.16576C10.9207%204.12105%2010.8714%204.07178%2010.8161%204.01648L10.8159%204.0163C10.5916%203.792%2010.4666%203.66696%2010.3428%203.60058C10.3261%203.59154%2010.3094%203.58358%2010.2925%203.57658C10.104%203.49851%209.89226%203.49851%209.70378%203.57658C9.56242%203.63514%209.4357%203.76186%209.18226%204.0153C9.09955%204.09801%209.03034%204.16722%208.97258%204.22785L4.28878%208.91166C4.03534%209.1651%203.90862%209.29182%203.85006%209.43318C3.77199%209.62166%203.77199%209.83344%203.85006%2010.0219C3.90862%2010.1633%204.03534%2010.29%204.28878%2010.5434C4.54221%2010.7969%204.66893%2010.9236%204.8103%2010.9822C4.99878%2011.0602%205.21056%2011.0602%205.39904%2010.9822C5.5404%2010.9236%205.66712%2010.7969%205.92056%2010.5434L5.92056%2010.5434L8.84449%207.61951V16.6616C8.84449%2017.02%208.84449%2017.1992%208.90305%2017.3406C8.98112%2017.5291%209.13087%2017.6788%209.31935%2017.7569C9.46072%2017.8154%209.63992%2017.8154%209.99834%2017.8154C10.3568%2017.8154%2010.536%2017.8154%2010.6773%2017.7569C10.8658%2017.6788%2011.0156%2017.5291%2011.0936%2017.3406Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"rightAndDown-gold":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.5062%206.72126C4.56476%206.86262%204.69148%206.98934%204.94492%207.24278L11.3404%2013.6382L7.20313%2013.6382C6.84471%2013.6382%206.66551%2013.6382%206.52414%2013.6968C6.33566%2013.7749%206.18591%2013.9246%206.10784%2014.1131C6.04928%2014.2545%206.04928%2014.4337%206.04928%2014.7921C6.04928%2015.1505%206.04928%2015.3297%206.10784%2015.4711C6.18591%2015.6596%206.33566%2015.8093%206.52414%2015.8874C6.66551%2015.9459%206.84471%2015.9459%207.20313%2015.9459L13.9194%2015.9459C13.9805%2015.9465%2014.0484%2015.9465%2014.1243%2015.9465H14.1243C14.4353%2015.9465%2014.6114%2015.9465%2014.7449%2015.9082C14.7659%2015.9023%2014.7859%2015.8954%2014.8052%2015.8874C14.9937%2015.8093%2015.1434%2015.6596%2015.2215%2015.4711C15.2801%2015.3297%2015.2801%2015.1505%2015.2801%2014.7921C15.2801%2014.6767%2015.2801%2014.5799%2015.2781%2014.497L15.2781%207.86957C15.2781%207.51115%2015.2781%207.33194%2015.2195%207.19058C15.1415%207.0021%2014.9917%206.85235%2014.8032%206.77428C14.6619%206.71572%2014.4827%206.71572%2014.1243%206.71572C13.7658%206.71572%2013.5866%206.71572%2013.4453%206.77428C13.2568%206.85235%2013.107%207.0021%2013.029%207.19058C12.9704%207.33194%2012.9704%207.51115%2012.9704%207.86957L12.9704%2012.0047L6.5767%205.61099C6.32326%205.35755%206.19654%205.23083%206.05518%205.17228C5.8667%205.09421%205.65492%205.09421%205.46644%205.17228C5.32508%205.23083%205.19836%205.35755%204.94492%205.61099C4.69148%205.86443%204.56476%205.99115%204.5062%206.13251C4.42813%206.32099%204.42813%206.53277%204.5062%206.72126Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"rightAndUp-gold":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.05431%2016.1597C6.19567%2016.1012%206.32239%2015.9745%206.57583%2015.721L12.9712%209.32568L12.9712%2013.4626C12.9712%2013.821%2012.9712%2014.0002%2013.0297%2014.1416C13.1078%2014.3301%2013.2576%2014.4798%2013.446%2014.5579C13.5874%2014.6164%2013.7666%2014.6164%2014.125%2014.6164C14.4834%2014.6164%2014.6626%2014.6164%2014.804%2014.5579C14.9925%2014.4798%2015.1422%2014.3301%2015.2203%2014.1416C15.2789%2014.0002%2015.2789%2013.821%2015.2789%2013.4626L15.2789%206.75233C15.2795%206.68972%2015.2795%206.62004%2015.2795%206.54182L15.2795%206.54157C15.2795%206.22585%2015.2795%206.04918%2015.2395%205.91495C15.2339%205.89605%2015.2276%205.878%2015.2203%205.86053C15.1422%205.67204%2014.9925%205.52229%2014.804%205.44422C14.6626%205.38567%2014.4834%205.38567%2014.125%205.38567L14.125%205.38567C14.0075%205.38567%2013.9093%205.38567%2013.8254%205.38773L7.20256%205.38773C6.84414%205.38773%206.66493%205.38773%206.52357%205.44628C6.33509%205.52436%206.18534%205.6741%206.10727%205.86259C6.04871%206.00395%206.04871%206.18315%206.04871%206.54156V6.54157L6.04871%206.54159C6.04871%206.9%206.04871%207.0792%206.10727%207.22056C6.18534%207.40905%206.33509%207.55879%206.52357%207.63687C6.66493%207.69542%206.84414%207.69542%207.20256%207.69542H11.3379L4.94405%2014.0892C4.69061%2014.3427%204.56389%2014.4694%204.50533%2014.6108C4.42726%2014.7992%204.42726%2015.011%204.50533%2015.1995C4.56389%2015.3409%204.69061%2015.4676%204.94405%2015.721C5.19749%2015.9745%205.32421%2016.1012%205.46557%2016.1597C5.65405%2016.2378%205.86583%2016.2378%206.05431%2016.1597Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"down-gray":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M8.90467%203.99244C8.84611%204.1338%208.84611%204.31301%208.84611%204.67143V13.716L5.92068%2010.7906C5.66724%2010.5371%205.54052%2010.4104%205.39916%2010.3519C5.21067%2010.2738%204.9989%2010.2738%204.81041%2010.3519C4.66905%2010.4104%204.54233%2010.5371%204.28889%2010.7906C4.03545%2011.044%203.90873%2011.1707%203.85018%2011.3121C3.77211%2011.5006%203.77211%2011.7124%203.85018%2011.9008C3.90873%2012.0422%204.03545%2012.1689%204.28889%2012.4224L9.03476%2017.1682C9.07839%2017.2127%209.12737%2017.2617%209.18231%2017.3166L9.18239%2017.3167L9.18241%2017.3167C9.40545%2017.5398%209.53035%2017.6647%209.65346%2017.7313C9.67085%2017.7408%209.6882%2017.7492%209.70577%2017.7564C9.89425%2017.8345%2010.106%2017.8345%2010.2945%2017.7564C10.4359%2017.6979%2010.5626%2017.5712%2010.816%2017.3177C10.8986%2017.2352%2010.9677%2017.1661%2011.0253%2017.1056L15.7095%2012.4214L15.7095%2012.4213C15.963%2012.1679%2016.0897%2012.0412%2016.1482%2011.8998C16.2263%2011.7114%2016.2263%2011.4996%2016.1482%2011.3111C16.0897%2011.1697%2015.963%2011.043%2015.7095%2010.7896C15.4561%2010.5361%2015.3294%2010.4094%2015.188%2010.3509C14.9995%2010.2728%2014.7878%2010.2728%2014.5993%2010.3509C14.4579%2010.4094%2014.3312%2010.5361%2014.0778%2010.7896L14.0777%2010.7896L11.1538%2013.7135V4.67142C11.1538%204.31301%2011.1538%204.1338%2011.0953%203.99244C11.0172%203.80395%2010.8674%203.6542%2010.6789%203.57613C10.5376%203.51758%2010.3584%203.51758%209.99996%203.51758C9.64154%203.51758%209.46233%203.51758%209.32097%203.57613C9.13249%203.6542%208.98274%203.80395%208.90467%203.99244Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"right-gray":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.32508%2011.7609C3.46644%2011.8194%203.64565%2011.8194%204.00407%2011.8194H13.049L10.1235%2014.745C9.87002%2014.9984%209.7433%2015.1251%209.68475%2015.2665C9.60668%2015.455%209.60668%2015.6668%209.68475%2015.8552C9.7433%2015.9966%209.87002%2016.1233%2010.1235%2016.3768C10.3769%2016.6302%2010.5036%2016.7569%2010.645%2016.8155C10.8335%2016.8935%2011.0452%2016.8935%2011.2337%2016.8155C11.3751%2016.7569%2011.5018%2016.6302%2011.7552%2016.3768L16.5105%2011.6215C16.5524%2011.5803%2016.5983%2011.5344%2016.6493%2011.4834L16.6495%2011.4831C16.8561%2011.2765%2016.9785%2011.1542%2017.0484%2011.0394C17.0648%2011.0128%2017.0782%2010.9866%2017.0893%2010.9599C17.1674%2010.7714%2017.1674%2010.5596%2017.0893%2010.3711C17.0308%2010.2298%2016.904%2010.1031%2016.6506%209.84962C16.5685%209.76752%2016.4997%209.69872%2016.4394%209.64123L11.7542%204.95601C11.5007%204.70257%2011.374%204.57585%2011.2327%204.5173C11.0442%204.43923%2010.8324%204.43923%2010.6439%204.5173C10.5026%204.57585%2010.3758%204.70257%2010.1224%204.95601L10.1224%204.95601C9.86895%205.20945%209.74223%205.33617%209.68368%205.47753C9.60561%205.66601%209.60561%205.87779%209.68368%206.06627C9.74223%206.20764%209.86895%206.33436%2010.1224%206.5878L13.0463%209.51175H4.00407C3.64565%209.51175%203.46644%209.51175%203.32508%209.5703C3.1366%209.64837%202.98685%209.79812%202.90877%209.98661C2.85022%2010.128%202.85022%2010.3072%202.85022%2010.6656C2.85022%2011.024%202.85022%2011.2032%202.90877%2011.3446C2.98685%2011.5331%203.1366%2011.6828%203.32508%2011.7609Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"up-gray":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M11.0936%2017.3406C11.1522%2017.1992%2011.1522%2017.02%2011.1522%2016.6616V7.61701L14.0776%2010.5424C14.3311%2010.7959%2014.4578%2010.9226%2014.5991%2010.9811C14.7876%2011.0592%2014.9994%2011.0592%2015.1879%2010.9811C15.3292%2010.9226%2015.456%2010.7959%2015.7094%2010.5424C15.9628%2010.289%2016.0896%2010.1623%2016.1481%2010.0209C16.2262%209.83243%2016.2262%209.62066%2016.1481%209.43217C16.0896%209.29081%2015.9628%209.16409%2015.7094%208.91065L10.9645%204.16576C10.9207%204.12105%2010.8714%204.07178%2010.8161%204.01648L10.8159%204.0163C10.5916%203.792%2010.4666%203.66696%2010.3428%203.60058C10.3261%203.59154%2010.3094%203.58358%2010.2925%203.57658C10.104%203.49851%209.89226%203.49851%209.70378%203.57658C9.56242%203.63514%209.4357%203.76186%209.18226%204.0153C9.09955%204.09801%209.03034%204.16722%208.97258%204.22785L4.28878%208.91166C4.03534%209.1651%203.90862%209.29182%203.85006%209.43318C3.77199%209.62166%203.77199%209.83344%203.85006%2010.0219C3.90862%2010.1633%204.03534%2010.29%204.28878%2010.5434C4.54221%2010.7969%204.66893%2010.9236%204.8103%2010.9822C4.99878%2011.0602%205.21056%2011.0602%205.39904%2010.9822C5.5404%2010.9236%205.66712%2010.7969%205.92056%2010.5434L5.92056%2010.5434L8.84449%207.61951V16.6616C8.84449%2017.02%208.84449%2017.1992%208.90305%2017.3406C8.98112%2017.5291%209.13087%2017.6788%209.31935%2017.7569C9.46072%2017.8154%209.63992%2017.8154%209.99834%2017.8154C10.3568%2017.8154%2010.536%2017.8154%2010.6773%2017.7569C10.8658%2017.6788%2011.0156%2017.5291%2011.0936%2017.3406Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"rightAndDown-gray":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.5062%206.72126C4.56476%206.86262%204.69148%206.98934%204.94492%207.24278L11.3404%2013.6382L7.20313%2013.6382C6.84471%2013.6382%206.66551%2013.6382%206.52414%2013.6968C6.33566%2013.7749%206.18591%2013.9246%206.10784%2014.1131C6.04928%2014.2545%206.04928%2014.4337%206.04928%2014.7921C6.04928%2015.1505%206.04928%2015.3297%206.10784%2015.4711C6.18591%2015.6596%206.33566%2015.8093%206.52414%2015.8874C6.66551%2015.9459%206.84471%2015.9459%207.20313%2015.9459L13.9194%2015.9459C13.9805%2015.9465%2014.0484%2015.9465%2014.1243%2015.9465H14.1243C14.4353%2015.9465%2014.6114%2015.9465%2014.7449%2015.9082C14.7659%2015.9023%2014.7859%2015.8954%2014.8052%2015.8874C14.9937%2015.8093%2015.1434%2015.6596%2015.2215%2015.4711C15.2801%2015.3297%2015.2801%2015.1505%2015.2801%2014.7921C15.2801%2014.6767%2015.2801%2014.5799%2015.2781%2014.497L15.2781%207.86957C15.2781%207.51115%2015.2781%207.33194%2015.2195%207.19058C15.1415%207.0021%2014.9917%206.85235%2014.8032%206.77428C14.6619%206.71572%2014.4827%206.71572%2014.1243%206.71572C13.7658%206.71572%2013.5866%206.71572%2013.4453%206.77428C13.2568%206.85235%2013.107%207.0021%2013.029%207.19058C12.9704%207.33194%2012.9704%207.51115%2012.9704%207.86957L12.9704%2012.0047L6.5767%205.61099C6.32326%205.35755%206.19654%205.23083%206.05518%205.17228C5.8667%205.09421%205.65492%205.09421%205.46644%205.17228C5.32508%205.23083%205.19836%205.35755%204.94492%205.61099C4.69148%205.86443%204.56476%205.99115%204.5062%206.13251C4.42813%206.32099%204.42813%206.53277%204.5062%206.72126Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"rightAndUp-gray":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.05431%2016.1597C6.19567%2016.1012%206.32239%2015.9745%206.57583%2015.721L12.9712%209.32568L12.9712%2013.4626C12.9712%2013.821%2012.9712%2014.0002%2013.0297%2014.1416C13.1078%2014.3301%2013.2576%2014.4798%2013.446%2014.5579C13.5874%2014.6164%2013.7666%2014.6164%2014.125%2014.6164C14.4834%2014.6164%2014.6626%2014.6164%2014.804%2014.5579C14.9925%2014.4798%2015.1422%2014.3301%2015.2203%2014.1416C15.2789%2014.0002%2015.2789%2013.821%2015.2789%2013.4626L15.2789%206.75233C15.2795%206.68972%2015.2795%206.62004%2015.2795%206.54182L15.2795%206.54157C15.2795%206.22585%2015.2795%206.04918%2015.2395%205.91495C15.2339%205.89605%2015.2276%205.878%2015.2203%205.86053C15.1422%205.67204%2014.9925%205.52229%2014.804%205.44422C14.6626%205.38567%2014.4834%205.38567%2014.125%205.38567L14.125%205.38567C14.0075%205.38567%2013.9093%205.38567%2013.8254%205.38773L7.20256%205.38773C6.84414%205.38773%206.66493%205.38773%206.52357%205.44628C6.33509%205.52436%206.18534%205.6741%206.10727%205.86259C6.04871%206.00395%206.04871%206.18315%206.04871%206.54156V6.54157L6.04871%206.54159C6.04871%206.9%206.04871%207.0792%206.10727%207.22056C6.18534%207.40905%206.33509%207.55879%206.52357%207.63687C6.66493%207.69542%206.84414%207.69542%207.20256%207.69542H11.3379L4.94405%2014.0892C4.69061%2014.3427%204.56389%2014.4694%204.50533%2014.6108C4.42726%2014.7992%204.42726%2015.011%204.50533%2015.1995C4.56389%2015.3409%204.69061%2015.4676%204.94405%2015.721C5.19749%2015.9745%205.32421%2016.1012%205.46557%2016.1597C5.65405%2016.2378%205.86583%2016.2378%206.05431%2016.1597Z%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A`},shape:{cross:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%223.70374%22%20y%3D%228.14795%22%20width%3D%2212.5926%22%20height%3D%223.7037%22%20rx%3D%220.740741%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A`,up:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M9.44533%205.81157C9.74012%205.47858%2010.2598%205.47858%2010.5546%205.81157L16.2868%2012.2867C16.71%2012.7647%2016.3706%2013.5184%2015.7322%2013.5184H4.26776C3.62933%2013.5184%203.28995%2012.7647%203.71313%2012.2867L9.44533%205.81157Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A`,down:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M10.5547%2014.1884C10.2599%2014.5214%209.74019%2014.5214%209.4454%2014.1884L3.71321%207.71335C3.29002%207.23532%203.6294%206.48161%204.26784%206.48161L15.7322%206.48161C16.3707%206.48161%2016.7101%207.23532%2016.2869%207.71335L10.5547%2014.1884Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"rhomboid-red":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M2.1415%2011.1984C1.8412%2010.9074%201.8412%2010.4256%202.1415%2010.1346L9.48467%203.01785C9.77196%202.73942%2010.2284%202.73942%2010.5157%203.01786L17.8586%2010.1346C18.1589%2010.4256%2018.1589%2010.9074%2017.8586%2011.1984L10.5157%2018.3151C10.2284%2018.5936%209.77196%2018.5936%209.48467%2018.3152L2.1415%2011.1984Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"rhomboid-gold":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M2.1415%2011.1984C1.8412%2010.9074%201.8412%2010.4256%202.1415%2010.1346L9.48467%203.01785C9.77196%202.73942%2010.2284%202.73942%2010.5157%203.01786L17.8586%2010.1346C18.1589%2010.4256%2018.1589%2010.9074%2017.8586%2011.1984L10.5157%2018.3151C10.2284%2018.5936%209.77196%2018.5936%209.48467%2018.3152L2.1415%2011.1984Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"roundness-greed":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"roundness-gold":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"roundness-red":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"roundness-pink":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23FB9D9D%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"roundness-gray":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22%23999999%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"roundness-black":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210.6664%22%20r%3D%227.03704%22%20fill%3D%22black%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"triangle-gold":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20clip-path%3D%22url(%23clip0_613_237)%22%3E%0A%3Cpath%20d%3D%22M9.32308%204.41301C9.58368%203.82623%2010.4164%203.82623%2010.677%204.413L15.9526%2016.2917C16.1701%2016.7815%2015.8115%2017.3331%2015.2756%2017.3331H4.72454C4.18858%2017.3331%203.83002%2016.7815%204.04756%2016.2917L9.32308%204.41301Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fg%3E%0A%3Cdefs%3E%0A%3CclipPath%20id%3D%22clip0_613_237%22%3E%0A%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%20transform%3D%22translate(0%200.666504)%22%2F%3E%0A%3C%2FclipPath%3E%0A%3C%2Fdefs%3E%0A%3C%2Fsvg%3E%0A`,"indicate-greed":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"indicate-gold":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"indicate-red":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%222.76941%22%20y%3D%222.76941%22%20width%3D%2214.4612%22%20height%3D%2214.4612%22%20rx%3D%223%22%20fill%3D%22black%22%2F%3E%0A%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%224.5%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A`},feedback2:{mistake2:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M4.12194%206.33702C4.1805%206.47839%204.30722%206.6051%204.56066%206.85854L8.36822%2010.6661L4.56062%2014.4737C4.30718%2014.7272%204.18046%2014.8539%204.12191%2014.9952C4.04384%2015.1837%204.04384%2015.3955%204.12191%2015.584C4.18046%2015.7253%204.30718%2015.8521%204.56062%2016.1055C4.81406%2016.3589%204.94078%2016.4857%205.08214%2016.5442C5.27062%2016.6223%205.4824%2016.6223%205.67089%2016.5442C5.81225%2016.4857%205.93897%2016.3589%206.19241%2016.1055L10%2012.2979L13.8074%2016.1053C14.0609%2016.3588%2014.1876%2016.4855%2014.329%2016.544C14.5174%2016.6221%2014.7292%2016.6221%2014.9177%2016.544C15.0591%2016.4855%2015.1858%2016.3588%2015.4392%2016.1053L15.4392%2016.1053C15.6927%2015.8519%2015.8194%2015.7252%2015.8779%2015.5838C15.956%2015.3953%2015.956%2015.1835%2015.8779%2014.9951C15.8194%2014.8537%2015.6927%2014.727%2015.4392%2014.4735L15.4392%2014.4735L11.6318%2010.6661L15.4392%206.85872C15.6926%206.60528%2015.8193%206.47856%2015.8779%206.3372C15.956%206.14871%2015.956%205.93694%2015.8779%205.74845C15.8193%205.60709%2015.6926%205.48037%2015.4392%205.22693C15.1857%204.97349%2015.059%204.84677%2014.9177%204.78822C14.7292%204.71015%2014.5174%204.71015%2014.3289%204.78822C14.1876%204.84677%2014.0608%204.97349%2013.8074%205.22693L10%209.03433L6.19244%205.22676C5.939%204.97332%205.81228%204.8466%205.67092%204.78805C5.48244%204.70997%205.27066%204.70997%205.08218%204.78805C4.94082%204.8466%204.8141%204.97332%204.56066%205.22676L4.56066%205.22676C4.30722%205.4802%204.1805%205.60692%204.12194%205.74828C4.04387%205.93676%204.04387%206.14854%204.12194%206.33702Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A`,warn2:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M8.49778%205.00963C8.48513%204.56774%208.47881%204.3468%208.56086%204.17746C8.63301%204.02856%208.75124%203.90689%208.89802%203.83052C9.06494%203.74365%209.28597%203.74365%209.72805%203.74365H10.272C10.714%203.74365%2010.9351%203.74365%2011.102%203.83052C11.2488%203.9069%2011.367%204.02856%2011.4392%204.17746C11.5212%204.3468%2011.5149%204.56775%2011.5022%205.00964L11.2644%2013.3173C11.2524%2013.737%2011.2464%2013.9468%2011.1609%2014.1065C11.0857%2014.2471%2010.9687%2014.3609%2010.826%2014.432C10.6639%2014.5129%2010.454%2014.5129%2010.0342%2014.5129H9.96582C9.54601%2014.5129%209.33611%2014.5129%209.17397%2014.432C9.0313%2014.3609%208.91426%2014.2471%208.83904%2014.1065C8.75357%2013.9468%208.74756%2013.737%208.73555%2013.3173L8.49778%205.00963Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3Crect%20x%3D%228.76917%22%20y%3D%2215.2817%22%20width%3D%222.46154%22%20height%3D%222.46154%22%20rx%3D%220.769231%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A`,correct2:`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cg%20clip-path%3D%22url(%23clip0_613_248)%22%3E%0A%3Cpath%20d%3D%22M15.689%205.69723C15.5476%205.75578%2015.4209%205.8825%2015.1675%206.13594L7.82436%2013.4791L4.83279%2010.4875C4.57935%2010.2341%204.45263%2010.1073%204.31127%2010.0488C4.12278%209.97071%203.91101%209.97071%203.72252%2010.0488C3.58116%2010.1073%203.45444%2010.2341%203.201%2010.4875C2.94756%2010.7409%202.82084%2010.8676%202.76229%2011.009C2.68422%2011.1975%202.68422%2011.4093%202.76229%2011.5978C2.82084%2011.7391%202.94756%2011.8658%203.201%2012.1193L7.0085%2015.9268C7.26194%2016.1802%207.38866%2016.3069%207.53002%2016.3655C7.7185%2016.4436%207.93028%2016.4436%208.11876%2016.3655C8.26013%2016.3069%208.38685%2016.1802%208.64028%2015.9268C8.66387%2015.9032%208.68636%2015.8807%208.7078%2015.8592L16.7993%207.76772C17.0527%207.51428%2017.1794%207.38756%2017.238%207.2462C17.3161%207.05772%2017.3161%206.84594%2017.238%206.65746C17.1794%206.5161%2017.0527%206.38938%2016.7993%206.13594C16.5458%205.8825%2016.4191%205.75578%2016.2777%205.69723C16.0893%205.61915%2015.8775%205.61915%2015.689%205.69723Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fg%3E%0A%3Cdefs%3E%0A%3CclipPath%20id%3D%22clip0_613_248%22%3E%0A%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%20transform%3D%22translate(0%200.666504)%22%2F%3E%0A%3C%2FclipPath%3E%0A%3C%2Fdefs%3E%0A%3C%2Fsvg%3E%0A`},flag:{"flag-green":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%2359D01E%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"flag-gold":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%23FFBD37%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"flag-red":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2221%22%20viewBox%3D%220%200%2020%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M15.4274%204.74935C14.0982%205.1012%2013.1363%205.13675%2012.3604%205.03379C11.5776%204.93009%2010.9487%204.68342%2010.2456%204.40416L10.2246%204.39527C9.53411%204.1212%208.76945%203.8175%207.81312%203.69157C6.84279%203.56268%205.71016%203.61898%204.24802%204.0049C4.09343%204.04217%203.95538%204.13393%203.85649%204.26515C3.7576%204.39636%203.70374%204.55925%203.70374%204.72712V17.3197C3.70374%2017.5162%203.79534%2017.7046%203.92654%2017.8435C4.05773%2017.9824%204.25893%2018.0605%204.44448%2018.0605C4.63002%2018.0605%204.84911%2017.9824%204.98031%2017.8435C5.11151%2017.7046%205.18522%2017.5162%205.18522%2017.3197V14.9123V12.5049C6.24649%2012.2738%206.97081%2012.2605%207.63962%2012.3486C8.42246%2012.4523%209.05139%2012.699%209.75448%2012.9782L9.77546%2012.9871C10.466%2013.2612%2011.2306%2013.5649%2012.1869%2013.6908C13.1601%2013.8197%2014.2976%2013.7627%2015.7667%2013.3738C15.8866%2013.3421%2016.0727%2013.2135%2016.1483%2013.111C16.2238%2013.0084%2016.2963%2012.8204%2016.2963%2012.6553V5.46787C16.2963%205.35535%2016.2721%205.24432%2016.2255%205.1432C16.1788%205.04208%2016.1111%204.95353%2016.0274%204.88428C15.9436%204.81502%2015.846%204.76688%2015.7421%204.7435C15.6382%204.72012%2015.494%204.73173%2015.4274%204.74935Z%22%20fill%3D%22%23FE4B4B%22%2F%3E%0A%3C%2Fsvg%3E%0A`},cell:{"cell-0":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"cell-25":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%224.00098%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"cell-50":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"cell-75":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211%22%20y%3D%2211.001%22%20width%3D%225%22%20height%3D%225%22%20rx%3D%221%22%20fill%3D%22%23E5E5E5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A`,"cell-100":`data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%2211.251%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%224.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3Crect%20x%3D%2211.25%22%20y%3D%224.25098%22%20width%3D%224.5%22%20height%3D%224.5%22%20rx%3D%220.75%22%20fill%3D%22%230493EE%22%20stroke%3D%22%230493EE%22%20stroke-width%3D%220.5%22%2F%3E%0A%3C%2Fsvg%3E%0A`}},Ce=[{title:`sheet.cf.iconSet.direction`,group:[{name:`3Arrows`,list:[X.arrow[`up-green`],X.arrow[`right-gold`],X.arrow[`down-red`]]},{name:`3ArrowsGray`,list:[X.arrow[`up-gray`],X.arrow[`right-gray`],X.arrow[`down-gray`]]},{name:`4Arrows`,list:[X.arrow[`up-green`],X.arrow[`rightAndUp-gold`],X.arrow[`rightAndDown-gold`],X.arrow[`down-red`]]},{name:`4ArrowsGray`,list:[X.arrow[`up-gray`],X.arrow[`rightAndUp-gray`],X.arrow[`rightAndDown-gray`],X.arrow[`down-gray`]]},{name:`5Arrows`,list:[X.arrow[`up-green`],X.arrow[`rightAndUp-gold`],X.arrow[`right-gold`],X.arrow[`rightAndDown-gold`],X.arrow[`down-red`]]},{name:`5ArrowsGray`,list:[X.arrow[`up-gray`],X.arrow[`rightAndUp-gray`],X.arrow[`right-gray`],X.arrow[`rightAndDown-gray`],X.arrow[`down-gray`]]},{name:`3Triangles`,list:[X.shape.up,X.shape.cross,X.shape.down]}]},{title:`sheet.cf.iconSet.shape`,group:[{name:`3TrafficLights1`,list:[X.shape[`roundness-greed`],X.shape[`roundness-gold`],X.shape[`roundness-red`]]},{name:`3Signs`,list:[X.shape[`roundness-greed`],X.shape[`triangle-gold`],X.shape[`rhomboid-red`]]},{name:`3TrafficLights2`,list:[X.shape[`indicate-greed`],X.shape[`indicate-gold`],X.shape[`indicate-red`]]},{name:`4RedToBlack`,list:[X.shape[`roundness-red`],X.shape[`roundness-pink`],X.shape[`roundness-gray`],X.shape[`roundness-black`]]},{name:`4TrafficLights`,list:[X.shape[`roundness-greed`],X.shape[`roundness-gold`],X.shape[`roundness-red`],X.shape[`roundness-black`]]}]},{title:`sheet.cf.iconSet.mark`,group:[{name:`3Symbols`,list:[X.feedback.correct,X.feedback.warn,X.feedback.mistake]},{name:`3Symbols2`,list:[X.feedback2.correct2,X.feedback2.warn2,X.feedback2.mistake2]},{name:`3Flags`,list:[X.flag[`flag-green`],X.flag[`flag-gold`],X.flag[`flag-red`]]}]},{title:`sheet.cf.iconSet.rank`,group:[{name:`4Rating`,list:[X.signal.signal25,X.signal.signal50,X.signal.signal75,X.signal.signal100]},{name:`5Rating`,list:[X.signal.signal0,X.signal.signal25,X.signal.signal50,X.signal.signal75,X.signal.signal100]},{name:`5Quarters`,list:[X.progress.progress100,X.progress.progress75,X.progress.progress50,X.progress.progress25,X.progress.progress0]},{name:`_5Felling`,list:[X.feeling.guffaw,X.feeling.smile,X.feeling.noninductive,X.feeling.dissatisfied,X.feeling.impatient]},{name:`5Boxes`,list:[X.cell[`cell-100`],X.cell[`cell-75`],X.cell[`cell-50`],X.cell[`cell-25`],X.cell[`cell-0`]]},{name:`3Stars`,list:[X.star.starFull,X.star.starIncomplete,X.star.starEmpty]}]}],Z=Ce.reduce((e,t)=>{let{group:n}=t;for(let t of n)e[t.name]=t.list;return e},{});for(let e in Z){let t=Z[e];Object.freeze(t)}var we=`@univerjs/sheets-conditional-formatting`,Te=`0.18.0`;let Ee=`ssheets-conditional-formatting.config`;Symbol(Ee);let De={},Q=class extends t.Disposable{get _conditionalFormattingViewModelV2(){return this._injector.get(V)}constructor(e,t,n,r,i,a){super(),this._conditionalFormattingRuleModel=e,this._injector=t,this._univerInstanceService=n,this._resourceManagerService=r,this._sheetInterceptorService=i,this._commandService=a,this._initCellChange(),this._initSnapshot(),this._initSheetChange()}composeStyle(e,n,r,i){let a=this._conditionalFormattingViewModelV2.getCellCfs(e,n,r,i);if(!(a!=null&&a.length))return null;let o=[],s=-1;for(let t of a){let r=this._conditionalFormattingRuleModel.getRule(e,n,t.cfId);r&&(o.push({rule:r,cacheItem:t}),s===-1&&r.stopIfTrue&&(s=o.length-1))}if(!o.length)return null;let c=s>-1?o.slice(0,s+1):o,l={};for(let e=c.length-1;e>=0;e--){let{rule:n,cacheItem:r}=c[e],i=n.rule.type;if(i===d.highlightCell)r.result&&(0,t.merge)(l,{style:r.result});else if(i===d.colorScale){let e=r.result;e&&typeof e==`string`&&(l.style={...l.style||{},bg:{rgb:e}})}else if(i===d.dataBar){let e=r.result;e&&(l.dataBar=e,l.isShowValue=e.isShowValue)}else if(i===d.iconSet){let e=r.result;e&&(l.iconSet=e,l.isShowValue=e.isShowValue)}}return l}_initSnapshot(){let e=e=>{let t=this._conditionalFormattingRuleModel.getUnitRules(e),n={};return t?(t.forEach((e,t)=>{n[t]=e}),JSON.stringify(n)):``},n=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:s,businesses:[t.UniverInstanceType.UNIVER_SHEET],toJson:t=>e(t),parseJson:e=>n(e),onUnLoad:e=>{this._conditionalFormattingRuleModel.deleteUnitId(e),!(0,t.isInternalEditorID)(e)&&this._conditionalFormattingViewModelV2.clearCache()},onLoad:(e,t)=>{Object.keys(t).forEach(n=>{[...t[n]].reverse().forEach(t=>{this._conditionalFormattingRuleModel.addRule(e,n,t)})})}}))}_initSheetChange(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{if(e.id===n.RemoveSheetCommand.id){let t=e.params,r=(0,n.getSheetCommandTarget)(this._univerInstanceService,t);if(!r)return{redos:[],undos:[]};let{unitId:i,subUnitId:a}=r,o=this._conditionalFormattingRuleModel.getSubunitRules(i,a);if(!o)return{redos:[],undos:[]};let s=[],c=[];return o.forEach(e=>{let t={unitId:i,subUnitId:a,cfId:e.cfId};s.push({id:k.id,params:t}),c.push(...O(this._injector,t))}),{redos:s,undos:c}}else if(e.id===n.CopySheetCommand.id){let t=e.params,r=(0,n.getSheetCommandTarget)(this._univerInstanceService,t);if(!r)return{redos:[],undos:[]};let{unitId:i,subUnitId:a}=r,{targetSubUnitId:o}=t,s=this._conditionalFormattingRuleModel.getSubunitRules(i,a);if(!s)return{redos:[],undos:[]};let c=[],l=[];return s.forEach(e=>{let t={unitId:i,subUnitId:o,rule:{...e,cfId:this._conditionalFormattingRuleModel.createCfId(i,o)}};c.push({id:j.id,params:t}),l.push(A(this._injector,t))}),{redos:c,undos:l}}return{redos:[],undos:[]}}}))}_initCellChange(){this.disposeWithMe(this._commandService.onCommandExecuted(e=>{let r=(e,t,n)=>{let r=new Set;return n.forEach(([n,i])=>{let a=this._conditionalFormattingViewModelV2.getCellCfs(e,t,n,i);a==null||a.forEach(e=>r.add(e.cfId))}),[...r].map(n=>this._conditionalFormattingRuleModel.getRule(e,t,n)).filter(e=>!!e)};switch(e.id){case n.SetRangeValuesMutation.id:{let{subUnitId:n,unitId:i,cellValue:a}=e.params,o=[];new t.ObjectMatrix(a).forValue((e,t,n)=>{n&&Object.keys(n).some(e=>[`p`,`v`].includes(e))&&o.push([e,t])}),r(i,n,o).forEach(e=>{this._conditionalFormattingViewModelV2.markRuleDirty(i,n,e.cfId)});break}case n.InsertColMutation.id:case n.RemoveColMutation.id:{let r=e.params,i=(0,n.getSheetCommandTarget)(this._univerInstanceService,r);if(!i)return;let{worksheet:a,unitId:o,subUnitId:s}=i,{range:c}=r,l={...c,endColumn:a.getColumnCount()-1},u=this._conditionalFormattingRuleModel.getSubunitRules(o,s);u&&u.filter(e=>e.ranges.some(e=>t.Rectangle.intersects(e,l))).forEach(e=>{this._conditionalFormattingViewModelV2.markRuleDirty(o,s,e.cfId)});break}case n.RemoveRowMutation.id:case n.InsertRowMutation.id:{let r=e.params,i=(0,n.getSheetCommandTarget)(this._univerInstanceService,r);if(!i)return;let{worksheet:a,unitId:o,subUnitId:s}=i,{range:c}=r,l={...c,endRow:a.getRowCount()-1},u=this._conditionalFormattingRuleModel.getSubunitRules(o,s);u&&u.filter(e=>e.ranges.some(e=>t.Rectangle.intersects(e,l))).forEach(e=>{this._conditionalFormattingViewModelV2.markRuleDirty(o,s,e.cfId)});break}case n.MoveRowsMutation.id:{let r=e.params,i=(0,n.getSheetCommandTarget)(this._univerInstanceService,r);if(!i)return;let{worksheet:a,unitId:o,subUnitId:s}=i,{sourceRange:c,targetRange:l}=r,u={startRow:Math.min(c.startRow,l.startRow),endRow:a.getRowCount()-1,startColumn:0,endColumn:a.getColumnCount()-1},d=this._conditionalFormattingRuleModel.getSubunitRules(o,s);d&&d.filter(e=>e.ranges.some(e=>t.Rectangle.intersects(e,u))).forEach(e=>{this._conditionalFormattingViewModelV2.markRuleDirty(o,s,e.cfId)});break}case n.MoveColsMutation.id:{let r=e.params,i=(0,n.getSheetCommandTarget)(this._univerInstanceService,r);if(!i)return;let{worksheet:a,unitId:o,subUnitId:s}=i,{sourceRange:c,targetRange:l}=r,u={startRow:0,endRow:a.getRowCount()-1,startColumn:Math.min(c.startColumn,l.startColumn),endColumn:a.getColumnCount()-1},d=this._conditionalFormattingRuleModel.getSubunitRules(o,s);d&&d.filter(e=>e.ranges.some(e=>t.Rectangle.intersects(e,u))).forEach(e=>{this._conditionalFormattingViewModelV2.markRuleDirty(o,s,e.cfId)});break}case n.MoveRangeMutation.id:{let{unitId:n,to:i,from:a}=e.params,o=e=>{let i=[];new t.ObjectMatrix(e.value).forValue((e,t)=>{i.push([e,t])}),r(n,e.subUnitId,i).forEach(t=>{this._conditionalFormattingViewModelV2.markRuleDirty(n,e.subUnitId,t.cfId)})};o(i),o(a);break}case n.ReorderRangeMutation.id:{let{range:n,unitId:r,subUnitId:i}=e.params,a=this._conditionalFormattingRuleModel.getSubunitRules(r,i);a&&a.filter(e=>e.ranges.some(e=>t.Rectangle.intersects(e,n))).forEach(e=>{this._conditionalFormattingViewModelV2.markRuleDirty(r,i,e.cfId)});break}}}))}};Q=F([P(0,(0,t.Inject)(E)),P(1,(0,t.Inject)(t.Injector)),P(2,(0,t.Inject)(t.IUniverInstanceService)),P(3,(0,t.Inject)(t.IResourceManagerService)),P(4,(0,t.Inject)(n.SheetInterceptorService)),P(5,(0,t.Inject)(t.ICommandService))],Q);let $=class extends t.Plugin{constructor(e=De,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{...a}=(0,t.merge)({},De,this._config);this._configService.setConfig(Ee,a),[[Q],[I],[E],[V]].forEach(e=>{this._injector.add(e)}),[ne,re,ie,ae,oe,se,j,k,M,D].forEach(e=>{this._commandService.registerCommand(e)})}onStarting(){this._injector.get(Q),(0,t.touchDependencies)(this._injector,[[Q],[V]])}};T($,`pluginName`,s),T($,`packageName`,we),T($,`version`,Te),T($,`type`,t.UniverInstanceType.UNIVER_SHEET),$=F([(0,t.DependentOn)(i.UniverFormulaEnginePlugin),P(1,(0,t.Inject)(t.Injector)),P(2,(0,t.Inject)(t.ICommandService)),P(3,t.IConfigService)],$);let Oe=`sheet-conditional-rule-icon`,ke=e=>{let{startRow:t,endRow:n,startColumn:r,endColumn:i}=e;return`${t}-${n}-${r}-${i}`};var Ae=class extends o.SheetExtension{constructor(){super(),T(this,`_paddingRightAndLeft`,2),T(this,`_width`,15),T(this,`_imageMap`,new Map),T(this,`uKey`,Oe),T(this,`Z_INDEX`,35),T(this,`_radius`,1),this._init()}draw(e,n,r,i){let{worksheet:a}=r;if(!a)return!1;let o=new Set;e.save(),t.Range.foreach(r.rowColumnSegment,(t,n)=>{if(!a.getRowVisible(t)||!a.getColVisible(n))return;let s=r.getCellWithCoordByIndex(t,n,!1),{isMerged:c,isMergedMainCell:l,mergeInfo:u}=s,d=a.getCell(t,n);if(c&&(d=a.getCell(u.startRow,u.startColumn)),!(d!=null&&d.iconSet))return;let{iconType:f,iconId:p}=d.iconSet;if(f===`EMPTY_ICON_TYPE`)return;let m=this._imageMap.get(this._createKey(f,p));if(!m||!this.isRenderDiffRangesByCell(u,i))return;if(c||l){let e=ke(u);if(o.has(e))return;o.add(e)}let{startX:h,endX:g,startY:_,endY:v}=c||l?u:s,y=g-h,b=v-_;if(this._width>b||this._width>y+this._paddingRightAndLeft*2)return;let x=(b-this._width)/2+_;e.drawImage(m,h+this._paddingRightAndLeft,x,this._width,this._width)}),e.restore()}_init(){for(let e in Z)Z[e].forEach((t,n)=>{let r=this._createKey(e,String(n)),i=new Image;i.onload=()=>{this._imageMap.set(r,i)},i.src=t})}_createKey(e,t){return`${e}_${t}`}};o.SpreadsheetExtensionRegistry.add(Ae);function je(e){if(typeof e!=`object`||!e)return e;let t={};for(let n in e)if(e.hasOwnProperty(n)){let r=je(e[n]);r!==void 0&&(t[n]=r)}return t}e.AddCfCommand=ne,e.AddConditionalRuleMutation=j,e.AddConditionalRuleMutationUndoFactory=A,e.CFNumberOperator=u,e.CFRuleType=d,e.CFSubRuleType=f,e.CFTextOperator=c,e.CFTimePeriodOperator=l,e.CFValueType=p,e.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH=B,e.ClearRangeCfCommand=re,e.ClearWorksheetCfCommand=ie,Object.defineProperty(e,`ConditionalFormattingFormulaService`,{enumerable:!0,get:function(){return I}}),e.ConditionalFormattingIcon=Ae,e.ConditionalFormattingRuleModel=E,Object.defineProperty(e,`ConditionalFormattingService`,{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,`ConditionalFormattingViewModel`,{enumerable:!0,get:function(){return V}}),e.DEFAULT_BG_COLOR=`#fff`,e.DEFAULT_FONT_COLOR=`#000000`,e.DEFAULT_PADDING=2,e.DEFAULT_WIDTH=15,e.DataBar=fe,e.DeleteCfCommand=ae,e.DeleteConditionalRuleMutation=k,e.DeleteConditionalRuleMutationUndoFactory=O,e.EMPTY_ICON_TYPE=`EMPTY_ICON_TYPE`,e.IconUKey=Oe,e.MoveCfCommand=oe,e.MoveConditionalRuleMutation=D,e.MoveConditionalRuleMutationUndoFactory=te,e.SHEET_CONDITIONAL_FORMATTING_PLUGIN=s,e.SetCfCommand=se,e.SetConditionalRuleMutation=M,Object.defineProperty(e,`UniverSheetsConditionalFormattingPlugin`,{enumerable:!0,get:function(){return $}}),e.anchorUndoFactory=b,e.compareWithNumber=q,e.createCfId=S,e.createDefaultRule=m,e.createDefaultValue=h,e.createDefaultValueByValueType=g,e.dataBarUKey=le,e.defaultDataBarNativeColor=`#abd91a`,e.defaultDataBarPositiveColor=`#ffbe38`,e.defaultPlaceholderColor=ue,e.filterRange=Y,e.findIndexByAnchor=_,e.getCacheStyleMatrix=be,e.getCellValue=W,e.getColorScaleFromValue=J,e.getMaxInFormulaResult=Se,e.getOppositeOperator=xe,e.getValueByType=K,e.iconGroup=Ce,e.iconMap=Z,e.isAnchorEqual=x,e.isFloatsEqual=H,e.isNullable=U,Object.defineProperty(e,`isRangesEqual`,{enumerable:!0,get:function(){return t.isRangesEqual}}),e.moveByAnchor=v,e.removeUndefinedAttr=je,e.serialTimeToTimestamp=ye,e.setConditionalRuleMutationUndoFactory=N,e.toYMD_1900=ve,e.transformSupportSymmetryAnchor=y});
|
|
4
3
|
|
|
5
4
|
// @univerjs/sheets-conditional-formatting/facade
|
|
6
|
-
(function(i,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("@univerjs/core"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/sheets/facade"),require("@univerjs/core/facade")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-conditional-formatting","@univerjs/sheets/facade","@univerjs/core/facade"],u):(i=typeof globalThis<"u"?globalThis:i||self,u(i.UniverSheetsConditionalFormattingFacade={},i.UniverCore,i.UniverSheetsConditionalFormatting,i.UniverSheetsFacade,i.UniverCoreFacade))})(this,(function(i,u,t,C,y){"use strict";var d=Object.defineProperty;var R=(i,u,t)=>u in i?d(i,u,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[u]=t;var T=(i,u,t)=>R(i,typeof u!="symbol"?u+"":u,t);class o{constructor(e={}){T(this,"_rule",{});this._rule=e,this._ensureAttr(this._rule,["rule"])}get _ruleConfig(){return this._rule.rule||null}_getDefaultConfig(e=t.CFRuleType.highlightCell){switch(e){case t.CFRuleType.colorScale:return{type:e,config:[{index:0,color:new u.ColorKit("").toRgbString(),value:{type:t.CFValueType.min}},{index:0,color:new u.ColorKit("green").toRgbString(),value:{type:t.CFValueType.max}}]};case t.CFRuleType.dataBar:return{type:e,isShowValue:!0,config:{min:{type:t.CFValueType.min},max:{type:t.CFValueType.max},positiveColor:new u.ColorKit("green").toRgbString(),nativeColor:new u.ColorKit("").toRgbString(),isGradient:!1}};case t.CFRuleType.highlightCell:return{type:e,subType:t.CFSubRuleType.text,operator:t.CFTextOperator.containsText,value:"abc",style:{}};case t.CFRuleType.iconSet:return{type:e,isShowValue:!0,config:[{operator:t.CFNumberOperator.greaterThanOrEqual,value:{type:t.CFValueType.min},iconType:t.EMPTY_ICON_TYPE,iconId:""},{operator:t.CFNumberOperator.greaterThanOrEqual,value:{type:t.CFValueType.percentile,value:.5},iconType:t.EMPTY_ICON_TYPE,iconId:""},{operator:t.CFNumberOperator.lessThanOrEqual,value:{type:t.CFValueType.max},iconType:t.EMPTY_ICON_TYPE,iconId:""}]}}}_ensureAttr(e,r){return r.reduce((l,s)=>(l[s]||(l[s]={}),l[s]),e),e}build(){var l;this._rule.cfId||(this._rule.cfId=t.createCfId()),this._rule.ranges||(this._rule.ranges=[]),this._rule.stopIfTrue===void 0&&(this._rule.stopIfTrue=!1),(l=this._rule.rule)!=null&&l.type||(this._rule.rule.type=t.CFRuleType.highlightCell,this._ensureAttr(this._rule,["rule","style"]));const e=this._getDefaultConfig(this._rule.rule.type);return{...this._rule,rule:{...e,...this._rule.rule}}}copy(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new o(e)}getRanges(){return this._rule.ranges||[]}getIconMap(){return t.iconMap}createCfId(){return t.createCfId()}setRanges(e){return this._rule.ranges=e,this}}class n extends o{constructor(e={}){super(e),this._ensureAttr(this._rule,["rule","style"])}copy(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new n(e)}setAverage(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.average,r.operator=e,this}setUniqueValues(){const e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.uniqueValues,this}setDuplicateValues(){const e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.duplicateValues,this}setRank(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.rank,r.isBottom=e.isBottom,r.isPercent=e.isPercent,r.value=e.value,this}setBackground(e){var r;if(((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell)if(e){this._ensureAttr(this._ruleConfig,["style","bg"]);const l=new u.ColorKit(e);this._ruleConfig.style.bg.rgb=l.toRgbString()}else delete this._ruleConfig.style.bg;return this}setBold(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style"]),this._ruleConfig.style.bl=e?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE),this}setFontColor(e){var r;if(((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell)if(e){const l=new u.ColorKit(e);this._ensureAttr(this._ruleConfig,["style","cl"]),this._ruleConfig.style.cl.rgb=l.toRgbString()}else delete this._ruleConfig.style.cl;return this}setItalic(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style"]),this._ruleConfig.style.it=e?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE),this}setStrikethrough(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style","st"]),this._ruleConfig.style.st.s=e?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE),this}setUnderline(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style","ul"]),this._ruleConfig.style.ul.s=e?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE),this}whenCellEmpty(){const e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.text,e.value="",e.operator=t.CFTextOperator.equal,this}whenCellNotEmpty(){const e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.text,e.value="",e.operator=t.CFTextOperator.notEqual,this}whenDate(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.timePeriod,r.operator=e,this}whenFormulaSatisfied(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.formula,r.value=e,this}whenNumberBetween(e,r){const l=Math.min(e,r),s=Math.max(e,r),h=this._ruleConfig;return h.type=t.CFRuleType.highlightCell,h.subType=t.CFSubRuleType.number,h.value=[l,s],h.operator=t.CFNumberOperator.between,this}whenNumberEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.equal,this}whenNumberGreaterThan(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.greaterThan,this}whenNumberGreaterThanOrEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.greaterThanOrEqual,this}whenNumberLessThan(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.lessThan,this}whenNumberLessThanOrEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.lessThanOrEqual,this}whenNumberNotBetween(e,r){const l=Math.min(e,r),s=Math.max(e,r),h=this._ruleConfig;return h.type=t.CFRuleType.highlightCell,h.subType=t.CFSubRuleType.number,h.value=[l,s],h.operator=t.CFNumberOperator.notBetween,this}whenNumberNotEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.notEqual,this}whenTextContains(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.containsText,this}whenTextDoesNotContain(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.notContainsText,this}whenTextEndsWith(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.endsWith,this}whenTextEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.equal,this}whenTextStartsWith(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.beginsWith,this}}class a extends o{copy(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new a(e)}setDataBar(e){const r=this._ruleConfig;return r.type=t.CFRuleType.dataBar,r.isShowValue=!!e.isShowValue,r.config={min:e.min,max:e.max,positiveColor:e.positiveColor,nativeColor:e.nativeColor,isGradient:!!e.isGradient},this}}class f extends o{copy(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new f(e)}setColorScale(e){const r=this._ruleConfig;return r.type=t.CFRuleType.colorScale,r.config=e,this}}class c extends o{copy(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new c(e)}setIconSet(e){const r=this._ruleConfig;return r.type=t.CFRuleType.iconSet,r.config=e.iconConfigs,r.isShowValue=e.isShowValue,this}}class p{constructor(e={}){this._initConfig=e}build(){return new o(this._initConfig).build()}setAverage(e){return new n(this._initConfig).setAverage(e)}setUniqueValues(){return new n(this._initConfig).setUniqueValues()}setDuplicateValues(){return new n(this._initConfig).setDuplicateValues()}setRank(e){return new n(this._initConfig).setRank(e)}getIconMap(){return t.iconMap}setIconSet(e){return new c(this._initConfig).setIconSet(e)}setColorScale(e){return new f(this._initConfig).setColorScale(e)}setDataBar(e){return new a(this._initConfig).setDataBar(e)}setBackground(e){return new n(this._initConfig).setBackground(e)}setBold(e){return new n(this._initConfig).setBold(e)}setFontColor(e){return new n(this._initConfig).setFontColor(e)}setItalic(e){return new n(this._initConfig).setItalic(e)}setStrikethrough(e){return new n(this._initConfig).setStrikethrough(e)}setUnderline(e){return new n(this._initConfig).setUnderline(e)}whenCellEmpty(){return new n(this._initConfig).whenCellEmpty()}whenCellNotEmpty(){return new n(this._initConfig).whenCellNotEmpty()}whenDate(e){return new n(this._initConfig).whenDate(e)}whenFormulaSatisfied(e){return new n(this._initConfig).whenFormulaSatisfied(e)}whenNumberBetween(e,r){return new n(this._initConfig).whenNumberBetween(e,r)}whenNumberEqualTo(e){return new n(this._initConfig).whenNumberEqualTo(e)}whenNumberGreaterThan(e){return new n(this._initConfig).whenNumberGreaterThan(e)}whenNumberGreaterThanOrEqualTo(e){return new n(this._initConfig).whenNumberGreaterThanOrEqualTo(e)}whenNumberLessThan(e){return new n(this._initConfig).whenNumberLessThan(e)}whenNumberLessThanOrEqualTo(e){return new n(this._initConfig).whenNumberLessThanOrEqualTo(e)}whenNumberNotBetween(e,r){return new n(this._initConfig).whenNumberNotBetween(e,r)}whenNumberNotEqualTo(e){return new n(this._initConfig).whenNumberNotEqualTo(e)}whenTextContains(e){return new n(this._initConfig).whenTextContains(e)}whenTextDoesNotContain(e){return new n(this._initConfig).whenTextDoesNotContain(e)}whenTextEndsWith(e){return new n(this._initConfig).whenTextEndsWith(e)}whenTextEqualTo(e){return new n(this._initConfig).whenTextEqualTo(e)}whenTextStartsWith(e){return new n(this._initConfig).whenTextStartsWith(e)}}class _ extends C.FRange{_getConditionalFormattingRuleModel(){return this._injector.get(t.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]].filter(r=>r.ranges.some(l=>u.Rectangle.intersects(l,this._range)))}createConditionalFormattingRule(){return new p({ranges:[this._range]})}addConditionalFormattingRule(e){const r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(t.AddCfCommand.id,r),this}deleteConditionalFormattingRule(e){const r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(t.DeleteCfCommand.id,r),this}moveConditionalFormattingRule(e,r,l="after"){const s={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:"self"},end:{id:r,type:l}};return this._commandService.syncExecuteCommand(t.MoveCfCommand.id,s),this}setConditionalFormattingRule(e,r){const l={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:r,cfId:e};return this._commandService.syncExecuteCommand(t.SetCfCommand.id,l),this}clearConditionalFormatRules(){const e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]};return this._commandService.syncExecuteCommand(t.ClearRangeCfCommand.id,e),this}}C.FRange.extend(_);class w extends C.FWorksheet{_getConditionalFormattingRuleModel(){return this._injector.get(t.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]]}createConditionalFormattingRule(){return new p}newConditionalFormattingRule(){return new p}addConditionalFormattingRule(e){const r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(t.AddCfCommand.id,r),this}deleteConditionalFormattingRule(e){const r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(t.DeleteCfCommand.id,r),this}moveConditionalFormattingRule(e,r,l="after"){const s={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:"self"},end:{id:r,type:l}};return this._commandService.syncExecuteCommand(t.MoveCfCommand.id,s),this}setConditionalFormattingRule(e,r){const l={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e,rule:r};return this._commandService.syncExecuteCommand(t.SetCfCommand.id,l),this}clearConditionalFormatRules(){const e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()};return this._commandService.syncExecuteCommand(t.ClearWorksheetCfCommand.id,e),this}}C.FWorksheet.extend(w);class b{get ConditionFormatNumberOperatorEnum(){return t.CFNumberOperator}get ConditionFormatTimePeriodOperatorEnum(){return t.CFTimePeriodOperator}}y.FEnum.extend(b),i.FConditionalFormattingBuilder=p,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
|
7
|
-
|
|
5
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/sheets-conditional-formatting`),require(`@univerjs/sheets/facade`),require(`@univerjs/core/facade`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets-conditional-formatting`,`@univerjs/sheets/facade`,`@univerjs/core/facade`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsConditionalFormattingFacade={},e.UniverCore,e.UniverSheetsConditionalFormatting,e.UniverSheetsFacade,e.UniverCoreFacade))})(this,function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function a(e){"@babel/helpers - typeof";return a=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},a(e)}function o(e,t){if(a(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(a(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function s(e){var t=o(e,`string`);return a(t)==`symbol`?t:t+``}function c(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=class e{get _ruleConfig(){return this._rule.rule||null}_getDefaultConfig(e=n.CFRuleType.highlightCell){switch(e){case n.CFRuleType.colorScale:return{type:e,config:[{index:0,color:new t.ColorKit(``).toRgbString(),value:{type:n.CFValueType.min}},{index:0,color:new t.ColorKit(`green`).toRgbString(),value:{type:n.CFValueType.max}}]};case n.CFRuleType.dataBar:return{type:e,isShowValue:!0,config:{min:{type:n.CFValueType.min},max:{type:n.CFValueType.max},positiveColor:new t.ColorKit(`green`).toRgbString(),nativeColor:new t.ColorKit(``).toRgbString(),isGradient:!1}};case n.CFRuleType.highlightCell:return{type:e,subType:n.CFSubRuleType.text,operator:n.CFTextOperator.containsText,value:`abc`,style:{}};case n.CFRuleType.iconSet:return{type:e,isShowValue:!0,config:[{operator:n.CFNumberOperator.greaterThanOrEqual,value:{type:n.CFValueType.min},iconType:n.EMPTY_ICON_TYPE,iconId:``},{operator:n.CFNumberOperator.greaterThanOrEqual,value:{type:n.CFValueType.percentile,value:.5},iconType:n.EMPTY_ICON_TYPE,iconId:``},{operator:n.CFNumberOperator.lessThanOrEqual,value:{type:n.CFValueType.max},iconType:n.EMPTY_ICON_TYPE,iconId:``}]}}}constructor(e={}){c(this,`_rule`,{}),this._rule=e,this._ensureAttr(this._rule,[`rule`])}_ensureAttr(e,t){return t.reduce((e,t)=>(e[t]||(e[t]={}),e[t]),e),e}build(){var e;this._rule.cfId||(this._rule.cfId=(0,n.createCfId)()),this._rule.ranges||(this._rule.ranges=[]),this._rule.stopIfTrue===void 0&&(this._rule.stopIfTrue=!1),(e=this._rule.rule)!=null&&e.type||(this._rule.rule.type=n.CFRuleType.highlightCell,this._ensureAttr(this._rule,[`rule`,`style`]));let t=this._getDefaultConfig(this._rule.rule.type);return{...this._rule,rule:{...t,...this._rule.rule}}}copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,n.createCfId)()),new e(r)}getRanges(){return this._rule.ranges||[]}getIconMap(){return n.iconMap}createCfId(){return(0,n.createCfId)()}setRanges(e){return this._rule.ranges=e,this}},u=class e extends l{constructor(e={}){super(e),this._ensureAttr(this._rule,[`rule`,`style`])}copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,n.createCfId)()),new e(r)}setAverage(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.average,t.operator=e,this}setUniqueValues(){let e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.uniqueValues,this}setDuplicateValues(){let e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.duplicateValues,this}setRank(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.rank,t.isBottom=e.isBottom,t.isPercent=e.isPercent,t.value=e.value,this}setBackground(e){var r;if(((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell)if(e){this._ensureAttr(this._ruleConfig,[`style`,`bg`]);let n=new t.ColorKit(e);this._ruleConfig.style.bg.rgb=n.toRgbString()}else delete this._ruleConfig.style.bg;return this}setBold(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`]),this._ruleConfig.style.bl=e?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE),this}setFontColor(e){var r;if(((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell)if(e){let n=new t.ColorKit(e);this._ensureAttr(this._ruleConfig,[`style`,`cl`]),this._ruleConfig.style.cl.rgb=n.toRgbString()}else delete this._ruleConfig.style.cl;return this}setItalic(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`]),this._ruleConfig.style.it=e?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE),this}setStrikethrough(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`,`st`]),this._ruleConfig.style.st.s=e?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE),this}setUnderline(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`,`ul`]),this._ruleConfig.style.ul.s=e?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE),this}whenCellEmpty(){let e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.text,e.value=``,e.operator=n.CFTextOperator.equal,this}whenCellNotEmpty(){let e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.text,e.value=``,e.operator=n.CFTextOperator.notEqual,this}whenDate(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.timePeriod,t.operator=e,this}whenFormulaSatisfied(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.formula,t.value=e,this}whenNumberBetween(e,t){let r=Math.min(e,t),i=Math.max(e,t),a=this._ruleConfig;return a.type=n.CFRuleType.highlightCell,a.subType=n.CFSubRuleType.number,a.value=[r,i],a.operator=n.CFNumberOperator.between,this}whenNumberEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.equal,this}whenNumberGreaterThan(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.greaterThan,this}whenNumberGreaterThanOrEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.greaterThanOrEqual,this}whenNumberLessThan(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.lessThan,this}whenNumberLessThanOrEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.lessThanOrEqual,this}whenNumberNotBetween(e,t){let r=Math.min(e,t),i=Math.max(e,t),a=this._ruleConfig;return a.type=n.CFRuleType.highlightCell,a.subType=n.CFSubRuleType.number,a.value=[r,i],a.operator=n.CFNumberOperator.notBetween,this}whenNumberNotEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.notEqual,this}whenTextContains(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.containsText,this}whenTextDoesNotContain(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.notContainsText,this}whenTextEndsWith(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.endsWith,this}whenTextEqualTo(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.equal,this}whenTextStartsWith(e){let t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.beginsWith,this}},d=class e extends l{copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,n.createCfId)()),new e(r)}setDataBar(e){let t=this._ruleConfig;return t.type=n.CFRuleType.dataBar,t.isShowValue=!!e.isShowValue,t.config={min:e.min,max:e.max,positiveColor:e.positiveColor,nativeColor:e.nativeColor,isGradient:!!e.isGradient},this}},f=class e extends l{copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,n.createCfId)()),new e(r)}setColorScale(e){let t=this._ruleConfig;return t.type=n.CFRuleType.colorScale,t.config=e,this}},p=class e extends l{copy(){let r=t.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,n.createCfId)()),new e(r)}setIconSet(e){let t=this._ruleConfig;return t.type=n.CFRuleType.iconSet,t.config=e.iconConfigs,t.isShowValue=e.isShowValue,this}},m=class{constructor(e={}){this._initConfig=e}build(){return new l(this._initConfig).build()}setAverage(e){return new u(this._initConfig).setAverage(e)}setUniqueValues(){return new u(this._initConfig).setUniqueValues()}setDuplicateValues(){return new u(this._initConfig).setDuplicateValues()}setRank(e){return new u(this._initConfig).setRank(e)}getIconMap(){return n.iconMap}setIconSet(e){return new p(this._initConfig).setIconSet(e)}setColorScale(e){return new f(this._initConfig).setColorScale(e)}setDataBar(e){return new d(this._initConfig).setDataBar(e)}setBackground(e){return new u(this._initConfig).setBackground(e)}setBold(e){return new u(this._initConfig).setBold(e)}setFontColor(e){return new u(this._initConfig).setFontColor(e)}setItalic(e){return new u(this._initConfig).setItalic(e)}setStrikethrough(e){return new u(this._initConfig).setStrikethrough(e)}setUnderline(e){return new u(this._initConfig).setUnderline(e)}whenCellEmpty(){return new u(this._initConfig).whenCellEmpty()}whenCellNotEmpty(){return new u(this._initConfig).whenCellNotEmpty()}whenDate(e){return new u(this._initConfig).whenDate(e)}whenFormulaSatisfied(e){return new u(this._initConfig).whenFormulaSatisfied(e)}whenNumberBetween(e,t){return new u(this._initConfig).whenNumberBetween(e,t)}whenNumberEqualTo(e){return new u(this._initConfig).whenNumberEqualTo(e)}whenNumberGreaterThan(e){return new u(this._initConfig).whenNumberGreaterThan(e)}whenNumberGreaterThanOrEqualTo(e){return new u(this._initConfig).whenNumberGreaterThanOrEqualTo(e)}whenNumberLessThan(e){return new u(this._initConfig).whenNumberLessThan(e)}whenNumberLessThanOrEqualTo(e){return new u(this._initConfig).whenNumberLessThanOrEqualTo(e)}whenNumberNotBetween(e,t){return new u(this._initConfig).whenNumberNotBetween(e,t)}whenNumberNotEqualTo(e){return new u(this._initConfig).whenNumberNotEqualTo(e)}whenTextContains(e){return new u(this._initConfig).whenTextContains(e)}whenTextDoesNotContain(e){return new u(this._initConfig).whenTextDoesNotContain(e)}whenTextEndsWith(e){return new u(this._initConfig).whenTextEndsWith(e)}whenTextEqualTo(e){return new u(this._initConfig).whenTextEqualTo(e)}whenTextStartsWith(e){return new u(this._initConfig).whenTextStartsWith(e)}},h=class extends r.FRange{_getConditionalFormattingRuleModel(){return this._injector.get(n.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]].filter(e=>e.ranges.some(e=>t.Rectangle.intersects(e,this._range)))}createConditionalFormattingRule(){return new m({ranges:[this._range]})}addConditionalFormattingRule(e){let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(n.AddCfCommand.id,t),this}deleteConditionalFormattingRule(e){let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(n.DeleteCfCommand.id,t),this}moveConditionalFormattingRule(e,t,r=`after`){let i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:`self`},end:{id:t,type:r}};return this._commandService.syncExecuteCommand(n.MoveCfCommand.id,i),this}setConditionalFormattingRule(e,t){let r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:t,cfId:e};return this._commandService.syncExecuteCommand(n.SetCfCommand.id,r),this}clearConditionalFormatRules(){let e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]};return this._commandService.syncExecuteCommand(n.ClearRangeCfCommand.id,e),this}};r.FRange.extend(h);var g=class extends r.FWorksheet{_getConditionalFormattingRuleModel(){return this._injector.get(n.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]]}createConditionalFormattingRule(){return new m}newConditionalFormattingRule(){return new m}addConditionalFormattingRule(e){let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(n.AddCfCommand.id,t),this}deleteConditionalFormattingRule(e){let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(n.DeleteCfCommand.id,t),this}moveConditionalFormattingRule(e,t,r=`after`){let i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:`self`},end:{id:t,type:r}};return this._commandService.syncExecuteCommand(n.MoveCfCommand.id,i),this}setConditionalFormattingRule(e,t){let r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e,rule:t};return this._commandService.syncExecuteCommand(n.SetCfCommand.id,r),this}clearConditionalFormatRules(){let e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()};return this._commandService.syncExecuteCommand(n.ClearWorksheetCfCommand.id,e),this}};r.FWorksheet.extend(g);var _=class{get ConditionFormatNumberOperatorEnum(){return n.CFNumberOperator}get ConditionFormatTimePeriodOperatorEnum(){return n.CFTimePeriodOperator}};i.FEnum.extend(_),e.FConditionalFormattingBuilder=m});
|
|
8
6
|
|
|
9
7
|
// @univerjs/sheets-conditional-formatting-ui/index
|
|
10
|
-
(function(P,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/ui"),require("react/jsx-runtime"),require("react"),require("@univerjs/design"),require("@univerjs/engine-formula"),require("@univerjs/sheets-formula-ui"),require("@univerjs/sheets-ui"),require("rxjs"),require("@univerjs/sheets-formula"),require("@univerjs/engine-render"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/sheets-conditional-formatting","@univerjs/ui","react/jsx-runtime","react","@univerjs/design","@univerjs/engine-formula","@univerjs/sheets-formula-ui","@univerjs/sheets-ui","rxjs","@univerjs/sheets-formula","@univerjs/engine-render","rxjs/operators"],s):(P=typeof globalThis<"u"?globalThis:P||self,s(P.UniverSheetsConditionalFormattingUi={},P.UniverCore,P.UniverSheets,P.UniverSheetsConditionalFormatting,P.UniverUi,P.React,P.React,P.UniverDesign,P.UniverEngineFormula,P.UniverSheetsFormulaUi,P.UniverSheetsUi,P.rxjs,P.UniverSheetsFormula,P.UniverEngineRender,P.rxjs.operators))})(this,(function(P,s,O,r,A,c,C,V,je,ie,q,K,nr,lr,se){"use strict";var Ft=Object.defineProperty;var $t=(P,s,O)=>s in P?Ft(P,s,{enumerable:!0,configurable:!0,writable:!0,value:O}):P[s]=O;var X=(P,s,O)=>$t(P,typeof s!="symbol"?s+"":s,O);const Ae={type:s.CommandType.COMMAND,id:"sheet.command.add-average-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,style:n,stopIfTrue:l,operator:u}=e,i=a.get(r.ConditionalFormattingRuleModel),v=a.get(s.ICommandService),d=a.get(s.IUniverInstanceService),f=O.getSheetCommandTarget(d);if(!f)return!1;const{unitId:o,subUnitId:p}=f,h=i.createCfId(o,p),b={ranges:t,cfId:h,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:u,style:n}};return v.executeCommand(r.AddConditionalRuleMutation.id,{unitId:o,subUnitId:p,rule:b})}},Fe={type:s.CommandType.COMMAND,id:"sheet.command.add-color-scale-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,config:n,stopIfTrue:l}=e,u=a.get(r.ConditionalFormattingRuleModel),i=a.get(s.ICommandService),v=a.get(s.IUniverInstanceService),d=O.getSheetCommandTarget(v);if(!d)return!1;const{unitId:f,subUnitId:o}=d,p=u.createCfId(f,o),h={ranges:t,cfId:p,stopIfTrue:!!l,rule:{type:r.CFRuleType.colorScale,config:n}};return i.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:o,rule:h})}},$e={type:s.CommandType.COMMAND,id:"sheet.command.add-data-bar-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,min:n,max:l,nativeColor:u,positiveColor:i,isGradient:v,stopIfTrue:d,isShowValue:f}=e,o=a.get(r.ConditionalFormattingRuleModel),p=a.get(s.IUniverInstanceService),h=O.getSheetCommandTarget(p);if(!h)return!1;const{unitId:b,subUnitId:S}=h,m=a.get(s.ICommandService),N=o.createCfId(b,S),w={ranges:t,cfId:N,stopIfTrue:!!d,rule:{type:r.CFRuleType.dataBar,isShowValue:f,config:{min:n,max:l,nativeColor:u,positiveColor:i,isGradient:v}}};return m.executeCommand(r.AddConditionalRuleMutation.id,{unitId:b,subUnitId:S,rule:w})}},Be={type:s.CommandType.COMMAND,id:"sheet.command.add-duplicate-values-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,style:n,stopIfTrue:l}=e,u=a.get(r.ConditionalFormattingRuleModel),i=a.get(s.ICommandService),v=a.get(s.IUniverInstanceService),d=O.getSheetCommandTarget(v);if(!d)return!1;const{unitId:f,subUnitId:o}=d,p=u.createCfId(f,o),h={ranges:t,cfId:p,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.duplicateValues,style:n}};return i.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:o,rule:h})}},He={type:s.CommandType.COMMAND,id:"sheet.command.add-number-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,style:n,stopIfTrue:l,operator:u,value:i}=e,v=a.get(r.ConditionalFormattingRuleModel),d=a.get(s.ICommandService),f=a.get(s.IUniverInstanceService),o=O.getSheetCommandTarget(f);if(!o)return!1;const{unitId:p,subUnitId:h}=o,b=v.createCfId(p,h);let S;if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(u)){const m=i;if(m.length!==2||!Array.isArray(m))return!1;S={ranges:t,cfId:b,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:u,style:n,value:m}}}else{const m=i;if(typeof m!="number")return!1;S={ranges:t,cfId:b,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:u,style:n,value:m}}}return d.executeCommand(r.AddConditionalRuleMutation.id,{unitId:p,subUnitId:h,rule:S})}},We={type:s.CommandType.COMMAND,id:"sheet.command.add-rank-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,style:n,stopIfTrue:l,isPercent:u,isBottom:i,value:v}=e,d=a.get(r.ConditionalFormattingRuleModel),f=a.get(s.IUniverInstanceService),o=a.get(s.ICommandService),p=O.getSheetCommandTarget(f);if(!p)return!1;const{unitId:h,subUnitId:b}=p,S=d.createCfId(h,b),m={ranges:t,cfId:S,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:u,isBottom:i,style:n,value:v}};return o.executeCommand(r.AddConditionalRuleMutation.id,{unitId:h,subUnitId:b,rule:m})}},qe={type:s.CommandType.COMMAND,id:"sheet.command.add-text-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,style:n,stopIfTrue:l,operator:u,value:i}=e,v=a.get(r.ConditionalFormattingRuleModel),d=a.get(s.IUniverInstanceService),f=O.getSheetCommandTarget(d);if(!f)return!1;const{unitId:o,subUnitId:p}=f,h=a.get(s.ICommandService),b=v.createCfId(o,p),S={ranges:t,cfId:b,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.text,operator:u,style:n,value:i}};return h.executeCommand(r.AddConditionalRuleMutation.id,{unitId:o,subUnitId:p,rule:S})}},Ge={type:s.CommandType.COMMAND,id:"sheet.command.add-time-period-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,style:n,stopIfTrue:l,operator:u}=e,i=a.get(r.ConditionalFormattingRuleModel),v=a.get(s.IUniverInstanceService),d=a.get(s.ICommandService),f=O.getSheetCommandTarget(v);if(!f)return!1;const{unitId:o,subUnitId:p}=f,h=i.createCfId(o,p),b={ranges:t,cfId:h,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.timePeriod,operator:u,style:n}};return d.executeCommand(r.AddConditionalRuleMutation.id,{unitId:o,subUnitId:p,rule:b})}},Ze={type:s.CommandType.COMMAND,id:"sheet.command.add-uniqueValues-conditional-rule",handler(a,e){if(!e)return!1;const{ranges:t,style:n,stopIfTrue:l}=e,u=a.get(r.ConditionalFormattingRuleModel),i=a.get(s.IUniverInstanceService),v=a.get(s.ICommandService),d=O.getSheetCommandTarget(i);if(!d)return!1;const{unitId:f,subUnitId:o}=d,p=u.createCfId(f,o),h={ranges:t,cfId:p,stopIfTrue:!!l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.uniqueValues,style:n}};return v.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:o,rule:h})}};function Y({ref:a,...e}){const{icon:t,id:n,className:l,extend:u,...i}=e,v=`univerjs-icon univerjs-icon-${n} ${l||""}`.trim(),d=C.useRef(`_${Er()}`);return ar(t,`${n}`,{defIds:t.defIds,idSuffix:d.current},{ref:a,className:v,...i},u)}function ar(a,e,t,n,l){return C.createElement(a.tag,{key:e,...xr(a,t,l),...n},(Nr(a,t).children||[]).map((u,i)=>ar(u,`${e}-${a.tag}-${i}`,t,void 0,l)))}function xr(a,e,t){const n={...a.attrs};t!=null&&t.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=t.colorChannel1),a.tag==="mask"&&n.id&&(n.id=n.id+e.idSuffix),Object.entries(n).forEach(([u,i])=>{u==="mask"&&typeof i=="string"&&(n[u]=i.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))});const{defIds:l}=e;return!l||l.length===0||(a.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+e.idSuffix),Object.entries(n).forEach(([u,i])=>{typeof i=="string"&&(n[u]=i.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))})),n}function Nr(a,e){var n;const{defIds:t}=e;return!t||t.length===0?a:a.tag==="defs"&&((n=a.children)!=null&&n.length)?{...a,children:a.children.map(l=>typeof l.attrs.id=="string"&&t&&t.includes(l.attrs.id)?{...l,attrs:{...l.attrs,id:l.attrs.id+e.idSuffix}}:l)}:a}function Er(){return Math.random().toString(36).substring(2,8)}Y.displayName="UniverIcon";const Rr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.65791 1.30005C3.77355 1.30005 3.05664 2.01696 3.05664 2.90132V12.8588C3.05664 13.8755 3.88086 14.6998 4.89759 14.6998H9.1016C11.2233 14.6998 12.9433 12.9798 12.9433 10.8581C12.9433 9.13925 11.8145 7.68407 10.2578 7.1934C10.8806 6.56856 11.2655 5.70659 11.2655 4.75472C11.2655 2.84676 9.71883 1.30005 7.81087 1.30005H4.65791ZM4.25664 2.90132C4.25664 2.6797 4.4363 2.50005 4.65791 2.50005H7.81087C9.05609 2.50005 10.0655 3.5095 10.0655 4.75472C10.0655 5.99993 9.05609 7.00938 7.81087 7.00938H4.25664V2.90132ZM4.25664 12.8588V8.21636H9.1016C10.5606 8.21636 11.7433 9.39909 11.7433 10.8581C11.7433 12.317 10.5606 13.4998 9.1016 13.4998H4.89759C4.5436 13.4998 4.25664 13.2128 4.25664 12.8588Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ur=C.forwardRef(function(e,t){return C.createElement(Y,Object.assign({},e,{id:"bold-icon",ref:t,icon:Rr}))});ur.displayName="BoldIcon";const Mr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Se=C.forwardRef(function(e,t){return C.createElement(Y,Object.assign({},e,{id:"delete-icon",ref:t,icon:Mr}))});Se.displayName="DeleteIcon";const Vr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},ir=C.forwardRef(function(e,t){return C.createElement(Y,Object.assign({},e,{id:"increase-icon",ref:t,icon:Vr}))});ir.displayName="IncreaseIcon";const Or={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.80385 1.40005H11.9997C12.3311 1.40005 12.5997 1.66868 12.5997 2.00005C12.5997 2.33143 12.3311 2.60005 11.9997 2.60005H10.1185L7.12251 13.4001H9.33324C9.66461 13.4001 9.93324 13.6687 9.93324 14.0001C9.93324 14.3314 9.66461 14.6001 9.33324 14.6001H6.34785C6.33847 14.6003 6.32905 14.6003 6.31962 14.6001H3.9999C3.66853 14.6001 3.3999 14.3314 3.3999 14.0001C3.3999 13.6687 3.66853 13.4001 3.9999 13.4001H5.87719L8.87322 2.60005H6.66641C6.33504 2.60005 6.06641 2.33143 6.06641 2.00005C6.06641 1.66868 6.33504 1.40005 6.66641 1.40005H9.52916C9.61698 1.37929 9.71064 1.3781 9.80385 1.40005Z"}}]},sr=C.forwardRef(function(e,t){return C.createElement(Y,Object.assign({},e,{id:"italic-icon",ref:t,icon:Or}))});sr.displayName="ItalicIcon";const Ur={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",fillRule:"evenodd",clipRule:"evenodd"}}]},Ye=C.forwardRef(function(e,t){return C.createElement(Y,Object.assign({},e,{id:"more-down-icon",ref:t,icon:Ur}))});Ye.displayName="MoreDownIcon";const kr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M6 5C6.55228 5 7 4.55228 7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4C5 4.55228 5.44772 5 6 5Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6 9C6.55228 9 7 8.55229 7 8C7 7.44772 6.55228 7 6 7C5.44772 7 5 7.44772 5 8C5 8.55229 5.44772 9 6 9Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M7 12C7 12.5523 6.55228 13 6 13C5.44772 13 5 12.5523 5 12C5 11.4477 5.44772 11 6 11C6.55228 11 7 11.4477 7 12Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10 5C10.5523 5 11 4.55228 11 4C11 3.44772 10.5523 3 10 3C9.44771 3 9 3.44772 9 4C9 4.55228 9.44771 5 10 5Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M11 8C11 8.55229 10.5523 9 10 9C9.44771 9 9 8.55229 9 8C9 7.44772 9.44771 7 10 7C10.5523 7 11 7.44772 11 8Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10 13C10.5523 13 11 12.5523 11 12C11 11.4477 10.5523 11 10 11C9.44771 11 9 11.4477 9 12C9 12.5523 9.44771 13 10 13Z"}}]},cr=C.forwardRef(function(e,t){return C.createElement(Y,Object.assign({},e,{id:"sequence-icon",ref:t,icon:kr}))});cr.displayName="SequenceIcon";const Pr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.00033 1.20996C6.43345 1.20996 5.23596 1.88077 4.64804 2.94304C4.06338 3.99943 4.15123 5.32084 4.90099 6.47062C5.08199 6.7482 5.45374 6.82648 5.73131 6.64548C6.00888 6.46448 6.08716 6.09273 5.90616 5.81516C5.36418 4.98402 5.35768 4.13897 5.69797 3.52412C6.035 2.91515 6.78176 2.40996 8.00033 2.40996C9.19423 2.40996 10.0017 2.93409 10.5236 3.46755C10.7871 3.73682 10.9756 4.00712 11.0974 4.20903C11.158 4.30951 11.2013 4.39164 11.2284 4.44625C11.2419 4.47351 11.2514 4.49377 11.2568 4.50588L11.2621 4.51771C11.3901 4.82216 11.7407 4.96686 12.046 4.83992C12.3519 4.71267 12.4968 4.36149 12.3695 4.05552L11.8231 4.28278C12.3695 4.05552 12.3697 4.0558 12.3695 4.05552L12.3691 4.05437L12.3685 4.05298L12.367 4.04953L12.3629 4.03993L12.3498 4.01036C12.3388 3.98619 12.3234 3.95326 12.3033 3.91282C12.2632 3.83203 12.2043 3.72072 12.1249 3.58908C11.9666 3.32674 11.7235 2.97805 11.3814 2.62834C10.6921 1.92381 9.59192 1.20996 8.00033 1.20996Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.11953 8.5999H7.88935C10.1109 9.46549 10.5895 10.7649 10.4268 11.6869C10.2475 12.703 9.26939 13.5898 8.00009 13.5898C6.63323 13.5898 5.77631 13.0502 5.25534 12.528C4.99021 12.2623 4.80823 11.9965 4.69365 11.7993C4.63659 11.7011 4.59698 11.6211 4.5727 11.5686C4.56059 11.5424 4.55236 11.5231 4.54774 11.512L4.54352 11.5016C4.4267 11.193 4.0823 11.0363 3.77279 11.1516C3.46228 11.2673 3.30438 11.6129 3.4201 11.9234L3.9649 11.7203C3.4201 11.9234 3.41998 11.9231 3.4201 11.9234L3.4206 11.9247L3.42118 11.9263L3.42262 11.9301L3.42661 11.9403C3.42977 11.9484 3.43394 11.9588 3.43914 11.9713C3.44956 11.9965 3.46418 12.0304 3.48334 12.0719C3.52161 12.1547 3.57828 12.2682 3.65608 12.4021C3.81124 12.6692 4.0534 13.0223 4.40584 13.3756C5.12 14.0914 6.27196 14.7898 8.00009 14.7898C9.82574 14.7898 11.3236 13.5101 11.6085 11.8955C11.812 10.7422 11.3901 9.55402 10.2665 8.5999H13.8804C14.2117 8.5999 14.4803 8.33127 14.4803 7.9999C14.4803 7.66853 14.2117 7.3999 13.8804 7.3999H8.01411C8.0048 7.39968 7.99551 7.39969 7.98625 7.3999H2.11953C1.78816 7.3999 1.51953 7.66853 1.51953 7.9999C1.51953 8.33127 1.78816 8.5999 2.11953 8.5999Z"}}]},or=C.forwardRef(function(e,t){return C.createElement(Y,Object.assign({},e,{id:"strikethrough-icon",ref:t,icon:Pr}))});or.displayName="StrikethroughIcon";const Dr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M4.46416 2.03237C4.46416 1.701 4.19553 1.43237 3.86416 1.43237C3.53279 1.43237 3.26416 1.701 3.26416 2.03237V7.33338C3.26416 10.0313 5.35834 12.2667 7.9999 12.2667C10.6415 12.2667 12.7356 10.0313 12.7356 7.33338V2.03237C12.7356 1.701 12.467 1.43237 12.1356 1.43237C11.8043 1.43237 11.5356 1.701 11.5356 2.03237V7.33338C11.5356 9.42194 9.92656 11.0667 7.9999 11.0667C6.07325 11.0667 4.46416 9.42194 4.46416 7.33338V2.03237Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M2.66641 13.4663C2.33504 13.4663 2.06641 13.7349 2.06641 14.0663C2.06641 14.3977 2.33504 14.6663 2.66641 14.6663H13.3331C13.6644 14.6663 13.9331 14.3977 13.9331 14.0663C13.9331 13.7349 13.6644 13.4663 13.3331 13.4663H2.66641Z"}}]},dr=C.forwardRef(function(e,t){return C.createElement(Y,Object.assign({},e,{id:"underline-icon",ref:t,icon:Dr}))});dr.displayName="UnderlineIcon";const Lr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"colorChannel1",d:"M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10.3014 1.70389C9.85268 0.479568 8.12109 0.479557 7.67238 1.70389L4.72235 9.75326C4.60832 10.0644 4.76811 10.4091 5.07924 10.5231C5.39038 10.6371 5.73504 10.4773 5.84907 10.1662L6.99975 7.02646C7.03588 7.03324 7.07314 7.03679 7.11123 7.03679H10.9778L12.1247 10.1662C12.2387 10.4773 12.5834 10.6371 12.8945 10.5231C13.2057 10.4091 13.3654 10.0644 13.2514 9.75326L10.3014 1.70389ZM10.538 5.83679L9.17467 2.11682C9.11057 1.94192 8.8632 1.94192 8.7991 2.11682L7.43576 5.83679H10.538Z",fillRule:"evenodd",clipRule:"evenodd"}}]},vr=C.forwardRef(function(e,t){return C.createElement(Y,Object.assign({},e,{id:"font-color-double-icon",ref:t,icon:Lr}))});vr.displayName="FontColorDoubleIcon";const jr={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.01281 1.36643C8.79386 0.585377 10.0602 0.585378 10.8412 1.36643L12.9223 3.44752C13.7034 4.22857 13.7034 5.4949 12.9223 6.27595L9.36445 9.83383C8.5834 10.6149 7.31707 10.6149 6.53602 9.83383L4.45493 7.75273C3.67388 6.97168 3.67388 5.70535 4.45493 4.9243L8.01281 1.36643ZM9.9927 2.21495C9.68028 1.90253 9.17375 1.90253 8.86133 2.21495L5.30346 5.77283L5.29671 5.77966L10.839 6.66224L12.0738 5.42742C12.3862 5.115 12.3862 4.60847 12.0738 4.29605L9.9927 2.21495Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M14.5179 9.48875C14.5179 9.99175 14.1101 10.3995 13.607 10.3995C13.1041 10.3995 12.6963 9.99175 12.6963 9.48875C12.6963 9.1773 13.0455 8.59966 13.3114 8.20487C13.4549 7.99177 13.7591 7.99177 13.9027 8.20486C14.1687 8.59965 14.5179 9.1773 14.5179 9.48875Z"}},{tag:"path",attrs:{fill:"colorChannel1",d:"M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z"}}]},pr=C.forwardRef(function(e,t){return C.createElement(Y,Object.assign({},e,{id:"paint-bucket-double-icon",ref:t,icon:jr}))});pr.displayName="PaintBucketDoubleIcon";const Ar={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 17",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.27177 13.714L13.5855 2.40025L14.434 3.24878L3.1203 14.5625L2.27177 13.714Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"colorChannel1",d:"M4.2603 1.82495L2.89617 1.82495C2.23343 1.82495 1.69617 2.36221 1.69617 3.02495L1.69617 4.38908L3.02617 4.38908L3.02617 3.15495L4.2603 3.15495L4.2603 1.82495ZM15.0092 4.38908L15.0092 3.02495C15.0092 2.36221 14.4719 1.82495 13.8092 1.82495L12.4451 1.82495L12.4451 3.15495L13.6792 3.15495L13.6792 4.38908L15.0092 4.38908ZM6.98856 1.82495L6.98856 3.15495L9.71681 3.15495L9.71681 1.82495L6.98856 1.82495ZM15.0092 7.11734L13.6792 7.11734L13.6792 9.84559L15.0092 9.84559L15.0092 7.11734ZM15.0092 12.5739L13.6792 12.5739L13.6792 13.808L12.4451 13.808L12.4451 15.138L13.8092 15.138C14.4719 15.138 15.0092 14.6007 15.0092 13.938L15.0092 12.5739ZM9.71681 15.138L9.71681 13.808L6.98856 13.808L6.98856 15.138L9.71681 15.138ZM4.2603 15.138L4.2603 13.808L3.02617 13.808L3.02617 12.5739L1.69617 12.5739L1.69617 13.938C1.69617 14.6007 2.23343 15.138 2.89617 15.138L4.2603 15.138ZM1.69617 9.8456L3.02617 9.8456L3.02617 7.11734L1.69617 7.11734L1.69617 9.8456Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ce=C.forwardRef(function(e,t){return C.createElement(Y,Object.assign({},e,{id:"slash-double-icon",ref:t,icon:Ar}))});ce.displayName="SlashDoubleIcon";const Q=a=>{const{color:e,onChange:t,disable:n=!1,Icon:l=pr,className:u}=a,i=C.useMemo(()=>new s.ColorKit(e),[e]),v=()=>{const d={className:V.clsx("univer-fill-primary-600",n&&u),extend:{colorChannel1:i.isValid?e:""}};return c.jsx(l,{...d})};return n?v():c.jsx(V.Dropdown,{overlay:c.jsx("div",{className:"univer-rounded-lg univer-p-4",children:c.jsx(V.ColorPicker,{value:e,onChange:t})}),children:c.jsx("span",{className:V.clsx("univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",u),children:v()})})},te=a=>{var u,i,v,d,f;const e=a.rule;if(!e)return null;const t=C.useMemo(()=>{if(e.type===r.CFRuleType.colorScale){const o=e.config.map((b,S)=>({color:new s.ColorKit(b.color),value:S})),p=o.length-1;return new Array(5).fill("").map((b,S,m)=>S*p/(m.length-1)).map(b=>r.getColorScaleFromValue(o,b))}return null},[e]),n=C.useMemo(()=>{if(e.type===r.CFRuleType.iconSet)return e.config.map(o=>{const p=r.iconMap[o.iconType];return p&&p[Number(o.iconId)]})},[e]),l="univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center univer-justify-center univer-text-xs";switch(e.type){case r.CFRuleType.dataBar:{const{isGradient:o}=e.config,p=o?`linear-gradient(to right, ${e.config.positiveColor||r.defaultDataBarPositiveColor}, rgb(255 255 255))`:e.config.positiveColor,h=o?`linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor||r.defaultDataBarNativeColor})`:e.config.nativeColor;return c.jsxs("div",{className:l,children:[c.jsx("div",{className:"univer-h-full univer-w-1/2 univer-border univer-border-solid",style:{background:h,borderColor:(u=e.config.nativeColor)!=null?u:r.defaultDataBarNativeColor}}),c.jsx("div",{className:"univer-h-full univer-w-1/2 univer-border univer-border-solid",style:{background:p,borderColor:(i=e.config.positiveColor)!=null?i:r.defaultDataBarPositiveColor}})]})}case r.CFRuleType.colorScale:return t&&c.jsx("div",{className:l,children:t.map((o,p)=>c.jsx("div",{className:"univer-h-full",style:{width:`${100/t.length}%`,background:o}},p))});case r.CFRuleType.iconSet:return n&&c.jsx("div",{className:l,children:n.map((o,p)=>o?c.jsx("img",{className:"univer-h-full",src:o,draggable:!1},p):c.jsx(ce,{},p))});case r.CFRuleType.highlightCell:{const{ul:o,st:p,it:h,bl:b,bg:S,cl:m}=e.style,N=(o==null?void 0:o.s)===s.BooleanNumber.TRUE,w=(p==null?void 0:p.s)===s.BooleanNumber.TRUE,E=h===s.BooleanNumber.TRUE,M=b===s.BooleanNumber.TRUE,R=(v=S==null?void 0:S.rgb)!=null?v:r.DEFAULT_BG_COLOR,g=(d=m==null?void 0:m.rgb)!=null?d:r.DEFAULT_FONT_COLOR,T={textDecoration:(f=`${N?"underline":""} ${w?"line-through":""}`.replace(/^ /,""))!=null?f:void 0,backgroundColor:R,color:g};return c.jsx("div",{className:V.clsx(l,{"univer-font-bold":M,"univer-italic":E}),style:T,children:"123"})}}},oe=V.clsx("univer-mt-5 univer-px-1 univer-py-2 univer-rounded",V.borderClassName),ee=(a,e)=>({label:e.t(`sheet.cf.valueType.${a}`),value:a}),ze=a=>{var S;const{type:e,className:t,onChange:n,id:l,value:u}=a,i=A.useDependency(s.IUniverInstanceService),v=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),d=(S=i.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:S.getSheetId(),f=C.useMemo(()=>String(u).startsWith("=")?String(u):"=",[u]),o=C.useMemo(()=>[r.CFValueType.max,r.CFValueType.min,"none"].includes(e)?{disabled:!0}:[r.CFValueType.percent,r.CFValueType.percentile].includes(e)?{min:0,max:100}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[e]),p=C.useRef(null),[h,b]=C.useState(!1);return A.useSidebarClick(m=>{var w;(w=p.current)!=null&&w.isClickOutSide(m)&&b(!1)}),e===r.CFValueType.formula?c.jsx("div",{className:"univer-ml-1 univer-w-full",children:c.jsx(ie.FormulaEditor,{ref:p,className:V.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",V.borderClassName),initValue:f,unitId:v,subUnitId:d,isFocus:h,onChange:(m="")=>{n(m||"")},onFocus:()=>b(!0)})}):c.jsx(V.InputNumber,{className:t,value:Number(a.value)||0,onChange:m=>a.onChange(m||0),...o})},Fr=a=>{var j;const{interceptorManager:e}=a,t=A.useDependency(s.LocaleService),n=((j=a.rule)==null?void 0:j.type)===r.CFRuleType.colorScale?a.rule:void 0,l=[ee(r.CFValueType.num,t),ee(r.CFValueType.percent,t),ee(r.CFValueType.percentile,t),ee(r.CFValueType.formula,t)],u=[ee(r.CFValueType.min,t),...l],i=[ee("none",t),...l],v=[ee(r.CFValueType.max,t),...l],[d,f]=C.useState(()=>{var x;const y=r.CFValueType.min;return n&&((x=n.config[0])==null?void 0:x.value.type)||y}),[o,p]=C.useState(()=>{var x;const y="none";return!n||n.config.length!==3?y:((x=n.config[1])==null?void 0:x.value.type)||y}),[h,b]=C.useState(()=>{var x;const y=r.CFValueType.max;return n&&((x=n.config[n.config.length-1])==null?void 0:x.value.type)||y}),[S,m]=C.useState(()=>{if(!n)return 10;const x=n.config[0];return(x==null?void 0:x.value.value)===void 0?10:x==null?void 0:x.value.value}),[N,w]=C.useState(()=>{var $;if(!n||n.config.length!==3)return 50;const x=($=n.config[1])==null?void 0:$.value.value;return x===void 0?50:x}),[E,M]=C.useState(()=>{var $;if(!n)return 90;const x=($=n.config[n.config.length-1])==null?void 0:$.value.value;return x===void 0?90:x}),[R,g]=C.useState(()=>{var x;const y="#d0d9fb";return n&&((x=n.config[0])==null?void 0:x.color)||y}),[T,_]=C.useState(()=>{var x;const y="#7790f3";return!n||n.config.length!==3?y:((x=n.config[1])==null?void 0:x.color)||y}),[I,k]=C.useState(()=>{var x;const y="#2e55ef";return n&&((x=n.config[n.config.length-1])==null?void 0:x.color)||y}),U=C.useMemo(()=>y=>{const{minType:x,medianType:$,maxType:D,minValue:F,medianValue:H,maxValue:W,minColor:Z,medianColor:J,maxColor:re}=y,z=[];return z.push({color:Z,value:{type:x,value:F}}),$!=="none"&&z.push({color:J,value:{type:$,value:H}}),z.push({color:re,value:{type:D,value:W}}),{config:z.map((De,Le)=>({...De,index:Le})),type:r.CFRuleType.colorScale}},[]);C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return U({minType:d,medianType:o,maxType:h,minValue:S,medianValue:N,maxValue:E,minColor:R,medianColor:T,maxColor:I})}}),[U,d,o,h,S,N,E,R,T,I,e]);const L=y=>{a.onChange(U(y))};return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.panel.styleRule")}),c.jsx("div",{className:oe,children:c.jsx(te,{rule:U({minType:d,medianType:o,maxType:h,minValue:S,medianValue:N,maxValue:E,minColor:R,medianColor:T,maxColor:I})})}),c.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.valueType.min")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[c.jsx(V.Select,{className:"univer-flex-shrink-0",options:u,value:d,onChange:y=>{f(y);const x=r.createDefaultValueByValueType(y,10);m(x),L({minType:y,medianType:o,maxType:h,minValue:x,medianValue:N,maxValue:E,minColor:R,medianColor:T,maxColor:I})}}),c.jsx(ze,{id:"min",className:"univer-ml-1",value:S,type:d,onChange:y=>{m(y),L({minType:d,medianType:o,maxType:h,minValue:y,medianValue:N,maxValue:E,minColor:R,medianColor:T,maxColor:I})}}),c.jsx(Q,{className:"univer-ml-1",color:R,onChange:y=>{g(y),L({minType:d,medianType:o,maxType:h,minValue:S,medianValue:N,maxValue:E,minColor:y,medianColor:T,maxColor:I})}})]}),c.jsx("div",{className:"univer-text-gray-600dark:!univer-text-gray-200 univer-mt-3 univer-text-xs",children:t.t("sheet.cf.panel.medianValue")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[c.jsx(V.Select,{className:"univer-flex-shrink-0",options:i,value:o,onChange:y=>{p(y);const x=r.createDefaultValueByValueType(y,50);w(x),L({minType:d,medianType:y,maxType:h,minValue:S,medianValue:x,maxValue:E,minColor:R,medianColor:T,maxColor:I})}}),c.jsx(ze,{id:"median",className:"univer-ml-1",value:N,type:o,onChange:y=>{w(y),L({minType:d,medianType:o,maxType:h,minValue:S,medianValue:y,maxValue:E,minColor:R,medianColor:T,maxColor:I})}}),o!=="none"&&c.jsx(Q,{className:"univer-ml-1",color:T,onChange:y=>{_(y),L({minType:d,medianType:o,maxType:h,minValue:S,medianValue:N,maxValue:E,minColor:R,medianColor:y,maxColor:I})}})]}),c.jsx("div",{className:"univer-mt-3 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.valueType.max")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-h-8 univer-items-center",children:[c.jsx(V.Select,{className:"univer-flex-shrink-0",options:v,value:h,onChange:y=>{b(y);const x=r.createDefaultValueByValueType(y,90);M(x),L({minType:d,medianType:o,maxType:y,minValue:S,medianValue:N,maxValue:x,minColor:R,medianColor:T,maxColor:I})}}),c.jsx(ze,{id:"max",className:"univer-ml-1",value:E,type:h,onChange:y=>{M(y),L({minType:d,medianType:o,maxType:h,minValue:S,medianValue:N,maxValue:y,minColor:R,medianColor:T,maxColor:I})}}),c.jsx(Q,{className:"univer-ml-1",color:I,onChange:y=>{k(y),L({minType:d,medianType:o,maxType:h,minValue:S,medianValue:N,maxValue:E,minColor:R,medianColor:T,maxColor:y})}})]})]})},ne=(a,e)=>({label:e.t(`sheet.cf.valueType.${a}`),value:a}),fr=a=>{var m;const{onChange:e,className:t,value:n,type:l,id:u,disabled:i=!1}=a,v=A.useDependency(s.IUniverInstanceService),d=v.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),f=(m=v.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:m.getSheetId(),o=C.useRef(null),[p,h]=C.useState(!1);A.useSidebarClick(N=>{var E;(E=o.current)!=null&&E.isClickOutSide(N)&&h(!1)});const b=C.useRef(n),S=C.useMemo(()=>[r.CFValueType.percentile,r.CFValueType.percent].includes(l)?{max:100,min:0}:{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER},[l]);if(l===r.CFValueType.formula){const N=String(b.current).startsWith("=")?String(b.current)||"":"=";return c.jsx("div",{className:"univer-ml-3 univer-w-full",children:c.jsx(ie.FormulaEditor,{ref:o,className:V.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",V.borderClassName),initValue:N,unitId:d,subUnitId:f,isFocus:p,onChange:(w="")=>{e(w||"")},onFocus:()=>h(!0)})})}return c.jsx(V.InputNumber,{className:t,value:Number(n)||0,disabled:i,onChange:N=>{e(N||0)},...S})},$r=a=>{var j;const{interceptorManager:e}=a,t=A.useDependency(s.LocaleService),n=((j=a.rule)==null?void 0:j.type)===r.CFRuleType.dataBar?a.rule:void 0,[l,u]=C.useState(()=>{var x;return n&&(x=n.config)!=null&&x.isGradient?"1":"0"}),[i,v]=C.useState(()=>{var y;return n&&((y=n.config)==null?void 0:y.positiveColor)||r.defaultDataBarPositiveColor}),[d,f]=C.useState(()=>{var y;return n&&((y=n.config)==null?void 0:y.nativeColor)||r.defaultDataBarNativeColor}),o=[ne(r.CFValueType.num,t),ne(r.CFValueType.percent,t),ne(r.CFValueType.percentile,t),ne(r.CFValueType.formula,t)],p=[ne(r.CFValueType.min,t),...o],h=[ne(r.CFValueType.max,t),...o],[b,S]=C.useState(()=>{var x;const y=p[0].value;return n&&((x=n.config)==null?void 0:x.min.type)||y}),[m,N]=C.useState(()=>{var x;const y=h[0].value;return n&&((x=n.config)==null?void 0:x.max.type)||y}),[w,E]=C.useState(()=>{var $;if(!n)return 0;const x=(($=n.config)==null?void 0:$.min)||{};return x.type===r.CFValueType.formula?x.value||"=":x.value||0}),[M,R]=C.useState(()=>{var $;if(!n)return 100;const x=(($=n.config)==null?void 0:$.max)||{};return x.type===r.CFValueType.formula?x.value||"=":x.value===void 0?100:x.value}),[g,T]=C.useState(()=>n?n.isShowValue===void 0?!0:!!n.isShowValue:!0),_=y=>({config:{min:{type:y.minValueType,value:y.minValue},max:{type:y.maxValueType,value:y.maxValue},isGradient:y.isGradient==="1",positiveColor:y.positiveColor||r.defaultDataBarPositiveColor,nativeColor:y.nativeColor||r.defaultDataBarNativeColor},type:r.CFRuleType.dataBar,isShowValue:y.isShowValue});C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return _({isGradient:l,minValue:w,minValueType:b,maxValue:M,maxValueType:m,positiveColor:i,nativeColor:d,isShowValue:g})}}),[l,w,b,M,m,i,d,e,g]);const I=y=>{a.onChange(_(y))},k=y=>{v(y),I({isGradient:l,minValue:w,minValueType:b,maxValue:M,maxValueType:m,positiveColor:y,nativeColor:d,isShowValue:g})},U=y=>{f(y),I({isGradient:l,minValue:w,minValueType:b,maxValue:M,maxValueType:m,positiveColor:i,nativeColor:y,isShowValue:g})},L=y=>o.map(x=>x.value).includes(y);return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.panel.styleRule")}),c.jsx("div",{className:oe,children:c.jsx(te,{rule:_({isGradient:l,minValue:w,minValueType:b,maxValue:M,maxValueType:m,positiveColor:i,nativeColor:d,isShowValue:g})})}),c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.panel.fillType")}),c.jsxs("div",{className:"univer-ml-1 univer-mt-3 univer-flex univer-items-center",children:[c.jsxs(V.RadioGroup,{value:l,onChange:y=>{u(y),I({isGradient:y,minValue:w,minValueType:b,maxValue:M,maxValueType:m,positiveColor:i,nativeColor:d,isShowValue:g})},children:[c.jsx(V.Radio,{value:"0",children:c.jsx("span",{className:"univer-text-xs",children:t.t("sheet.cf.panel.pureColor")})}),c.jsx(V.Radio,{value:"1",children:c.jsx("span",{className:"univer-text-xs",children:t.t("sheet.cf.panel.gradient")})})]}),c.jsxs("div",{className:"univer-ml-6 univer-flex univer-items-center univer-text-xs",children:[c.jsx(V.Checkbox,{checked:!g,onChange:y=>{T(!y),I({isGradient:y,minValue:w,minValueType:b,maxValue:M,maxValueType:m,positiveColor:i,nativeColor:d,isShowValue:!y})}}),t.t("sheet.cf.panel.onlyShowDataBar")]})]})]}),c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.panel.colorSet")}),c.jsxs("div",{className:"univer-ml-1 univer-mt-3 univer-flex univer-items-center",children:[c.jsxs("div",{className:"univer-flex univer-items-center",children:[c.jsx("div",{className:"univer-text-xs",children:t.t("sheet.cf.panel.native")}),c.jsx(Q,{color:d,onChange:U})]}),c.jsxs("div",{className:"univer-ml-3 univer-flex univer-items-center",children:[c.jsx("div",{className:"univer-text-xs",children:t.t("sheet.cf.panel.positive")}),c.jsx(Q,{color:i,onChange:k})]})]})]}),c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.valueType.min")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[c.jsx(V.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:p,value:b,onChange:y=>{S(y);const x=r.createDefaultValueByValueType(y,10);E(x),I({isGradient:l,minValue:x,minValueType:y,maxValue:M,maxValueType:m,positiveColor:i,nativeColor:d,isShowValue:g})}}),c.jsx(fr,{id:"min",className:"univer-ml-3",disabled:!L(b),type:b,value:w,onChange:y=>{E(y||0),I({isGradient:l,minValue:y||0,minValueType:b,maxValue:M,maxValueType:m,positiveColor:i,nativeColor:d,isShowValue:g})}})]}),c.jsx("div",{className:"univer-mt-3 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:t.t("sheet.cf.valueType.max")}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[c.jsx(V.Select,{className:"univer-w-1/2 univer-flex-shrink-0",options:h,value:m,onChange:y=>{N(y);const x=r.createDefaultValueByValueType(y,90);R(x),I({isGradient:l,minValue:w,minValueType:b,maxValue:x,maxValueType:y,positiveColor:i,nativeColor:d,isShowValue:g})}}),c.jsx(fr,{className:"univer-ml-3",disabled:!L(m),id:"max",type:m,value:M,onChange:y=>{R(y||0),I({isGradient:l,minValue:w,minValueType:b,maxValue:y||0,maxValueType:m,positiveColor:i,nativeColor:d,isShowValue:g})}})]})]})]})},Te=a=>[s.BooleanNumber.FALSE,void 0].includes(a)?s.BooleanNumber.TRUE:s.BooleanNumber.FALSE,_e=a=>a!==s.BooleanNumber.FALSE,Ke=a=>{const{style:e,onChange:t,className:n}=a,[l,u]=C.useState(()=>{if(e!=null&&e.bl)return e.bl}),[i,v]=C.useState(()=>{if(e!=null&&e.it)return e.it}),[d,f]=C.useState(()=>{if(e!=null&&e.ul)return e.ul.s}),[o,p]=C.useState(()=>{if(e!=null&&e.st)return e.st.s}),[h,b]=C.useState(()=>{var E;const w="#2f56ef";return(E=e==null?void 0:e.cl)!=null&&E.rgb?e.cl.rgb:w}),[S,m]=C.useState(()=>{var E;const w="#e8ecfc";return(E=e==null?void 0:e.bg)!=null&&E.rgb?e.bg.rgb:w});C.useEffect(()=>{const w={bl:l,it:i};h!==void 0&&(w.cl={rgb:h}),S!==void 0&&(w.bg={rgb:S}),o!==void 0&&(w.st={s:o}),d!==void 0&&(w.ul={s:d}),t(r.removeUndefinedAttr(w))},[l,i,d,o,h,S]);const N="univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-px-1";return c.jsxs("div",{className:V.clsx("univer-my-2.5 univer-flex univer-justify-between",n),children:[c.jsx("div",{className:V.clsx(N,{"univer-bg-gray-100 dark:!univer-bg-gray-700":_e(l||s.BooleanNumber.FALSE)}),onClick:()=>u(Te(l)),children:c.jsx(ur,{})}),c.jsx("div",{className:V.clsx(N,{"univer-bg-gray-100 dark:!univer-bg-gray-700":_e(i||s.BooleanNumber.FALSE)}),onClick:()=>v(Te(i)),children:c.jsx(sr,{})}),c.jsx("div",{className:V.clsx(N,{"univer-bg-gray-100 dark:!univer-bg-gray-700":_e(d||s.BooleanNumber.FALSE)}),onClick:()=>f(Te(d)),children:c.jsx(dr,{})}),c.jsx("div",{className:V.clsx(N,{"univer-bg-gray-100 dark:!univer-bg-gray-700":_e(o||s.BooleanNumber.FALSE)}),onClick:()=>p(Te(o)),children:c.jsx(or,{})}),c.jsx(Q,{color:h,onChange:b,Icon:vr}),c.jsx(Q,{color:S,onChange:m})]})},Br=a=>{var R;const{onChange:e,interceptorManager:t}=a,n=A.useDependency(s.LocaleService),u=A.useDependency(s.IUniverInstanceService).getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),i=u.getActiveSheet(),v=((R=a.rule)==null?void 0:R.type)===r.CFRuleType.highlightCell?a.rule:void 0,d=C.useRef(null),[f,o]=C.useState(!1),p=C.useRef(null),[h,b]=C.useState({}),[S,m]=C.useState(()=>(v==null?void 0:v.subType)===r.CFSubRuleType.formula?v.value:"="),[N,w]=C.useState(void 0),E=g=>({style:g.style,value:S,type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.formula});C.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return E({style:h})}}),[h,S,t]),C.useEffect(()=>t.intercept(t.getInterceptPoints().beforeSubmit,{handler:(T,_,I)=>N||S.length===1||!S.startsWith("=")?(w(n.t("sheet.cf.errorMessage.formulaError")),!1):I(T)}),[N,S]);const M=g=>{e(E(g))};return A.useSidebarClick(g=>{var _;(_=p.current)!=null&&_.isClickOutSide(g)&&o(!1)}),c.jsxs("div",{ref:d,children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:n.t("sheet.cf.panel.styleRule")}),c.jsx("div",{className:"univer-mt-3",children:c.jsx(ie.FormulaEditor,{ref:p,className:V.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",V.borderClassName),errorText:N,isFocus:f,initValue:S,unitId:u.getUnitId(),subUnitId:i==null?void 0:i.getSheetId(),onFocus:()=>{o(!0)},onChange:g=>{m(g),M({style:h})},onVerify:(g,T)=>{!g||T.length===1?w(n.t("sheet.cf.errorMessage.formulaError")):w(void 0)}})}),c.jsx("div",{className:oe,children:c.jsx(te,{rule:E({style:h})})}),c.jsx(Ke,{style:v==null?void 0:v.style,className:"univer-mt-3",onChange:g=>{b(g),M({style:g})}})]})},we=a=>c.jsxs("div",{className:"univer-relative",children:[c.jsx("div",{className:"univer-absolute univer-bottom-[-13px] univer-z-[999] univer-text-[10px] univer-text-red-500",children:a.errorText}),a.children]}),B=(a,e)=>({label:e.t(`sheet.cf.operator.${a}`),value:a}),Hr=a=>{const{type:e,operator:t,onChange:n,value:l,interceptorManager:u}=a,i=A.useDependency(s.LocaleService),[v,d]=C.useState(()=>typeof l=="number"?l:0),[f,o]=C.useState(""),[p,h]=C.useState(()=>typeof l=="string"?l:""),[b,S]=C.useState(""),[m,N]=C.useState(()=>Array.isArray(l)?l[0]===void 0?0:l[0]:0),[w,E]=C.useState(""),[M,R]=C.useState(()=>Array.isArray(l)?l[1]===void 0?100:l[1]:100),[g,T]=C.useState("");switch(C.useEffect(()=>{switch(e){case r.CFSubRuleType.text:{[r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(t)&&n(p);break}case r.CFSubRuleType.number:{[r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(t)&&n(v),[r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(t)&&n([m,M]);break}}},[e]),C.useEffect(()=>{const _=u.intercept(u.getInterceptPoints().beforeSubmit,{handler:(I,k,U)=>{switch(e){case r.CFSubRuleType.text:if([r.CFTextOperator.beginsWith,r.CFTextOperator.containsText,r.CFTextOperator.endsWith,r.CFTextOperator.notEqual,r.CFTextOperator.notContainsText,r.CFTextOperator.equal].includes(t))return p?U(I):(S(i.t("sheet.cf.errorMessage.notBlank")),!1)}return U(I)}});return()=>{_()}},[e,v,p,t]),e){case r.CFSubRuleType.text:{if([r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(t)){const _=I=>{h(I),n(I)};return c.jsx("div",{className:"univer-mt-3",children:c.jsx(we,{errorText:b,children:c.jsx(V.Input,{value:p,onChange:I=>{S(""),_(I)}})})})}break}case r.CFSubRuleType.number:{if([r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(t)){const _=I=>{d(I||0),n(I||0),o("")};return c.jsx("div",{className:"univer-mt-3",children:c.jsx(we,{errorText:f,children:c.jsx(V.InputNumber,{className:"univer-w-full",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:v,onChange:_})})})}if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(t)){const _=k=>{N(k||0),n([k||0,M]),E("")},I=k=>{R(k||0),n([m,k||0]),T("")};return c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[c.jsx(we,{errorText:w,children:c.jsx(V.InputNumber,{min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:m,onChange:_})}),c.jsx(we,{errorText:g,children:c.jsx(V.InputNumber,{className:"univer-ml-3",min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,value:M,onChange:I})})]})}}}return null},hr=(a,e)=>{switch(a){case r.CFSubRuleType.text:return[B(r.CFTextOperator.containsText,e),B(r.CFTextOperator.notContainsText,e),B(r.CFTextOperator.beginsWith,e),B(r.CFTextOperator.endsWith,e),B(r.CFTextOperator.equal,e),B(r.CFTextOperator.notEqual,e),B(r.CFTextOperator.containsBlanks,e),B(r.CFTextOperator.notContainsBlanks,e),B(r.CFTextOperator.containsErrors,e),B(r.CFTextOperator.notContainsErrors,e)];case r.CFSubRuleType.number:return[B(r.CFNumberOperator.between,e),B(r.CFNumberOperator.notBetween,e),B(r.CFNumberOperator.equal,e),B(r.CFNumberOperator.notEqual,e),B(r.CFNumberOperator.greaterThan,e),B(r.CFNumberOperator.greaterThanOrEqual,e),B(r.CFNumberOperator.lessThan,e),B(r.CFNumberOperator.lessThanOrEqual,e)];case r.CFSubRuleType.timePeriod:return[B(r.CFTimePeriodOperator.yesterday,e),B(r.CFTimePeriodOperator.today,e),B(r.CFTimePeriodOperator.tomorrow,e),B(r.CFTimePeriodOperator.last7Days,e),B(r.CFTimePeriodOperator.lastWeek,e),B(r.CFTimePeriodOperator.thisWeek,e),B(r.CFTimePeriodOperator.nextWeek,e),B(r.CFTimePeriodOperator.lastMonth,e),B(r.CFTimePeriodOperator.thisMonth,e),B(r.CFTimePeriodOperator.nextMonth,e)]}},gr=a=>{var R;const{interceptorManager:e,onChange:t}=a,n=A.useDependency(s.LocaleService),l=((R=a.rule)==null?void 0:R.type)===r.CFRuleType.highlightCell?a.rule:void 0,[u,i]=C.useState(()=>{const g=r.CFSubRuleType.text;return l&&l.subType||g}),v=[{value:r.CFSubRuleType.text,label:n.t("sheet.cf.subRuleType.text")},{value:r.CFSubRuleType.number,label:n.t("sheet.cf.subRuleType.number")},{value:r.CFSubRuleType.timePeriod,label:n.t("sheet.cf.subRuleType.timePeriod")},{value:r.CFSubRuleType.duplicateValues,label:n.t("sheet.cf.subRuleType.duplicateValues")},{value:r.CFSubRuleType.uniqueValues,label:n.t("sheet.cf.subRuleType.uniqueValues")}],d=C.useMemo(()=>hr(u,n),[u]),[f,o]=C.useState(()=>{const g=d?d[0].value:void 0;return l&&l.operator||g}),[p,h]=C.useState(()=>{var _;return l?(_=l.value)!=null?_:r.createDefaultValue(l.subType,l.operator):""}),[b,S]=C.useState({}),m=C.useMemo(()=>g=>{var T,_,I,k,U,L,j,y,x,$,D,F,H,W,Z;switch(g.subType||u){case r.CFSubRuleType.text:{if([r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(f))return{type:r.CFRuleType.highlightCell,subType:(T=g.subType)!=null?T:u,operator:(_=g.operator)!=null?_:f,style:(I=g.style)!=null?I:b,value:(k=g.value)!=null?k:p};break}case r.CFSubRuleType.number:{if([r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(f))return{type:r.CFRuleType.highlightCell,subType:(U=g.subType)!=null?U:u,operator:(L=g.operator)!=null?L:f,style:(j=g.style)!=null?j:b,value:(y=g.value)!=null?y:p};if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(f))return{type:r.CFRuleType.highlightCell,subType:(x=g.subType)!=null?x:u,operator:($=g.operator)!=null?$:f,style:(D=g.style)!=null?D:b,value:(F=g.value)!=null?F:p};break}}return{type:r.CFRuleType.highlightCell,subType:(H=g.subType)!=null?H:u,operator:(W=g.operator)!=null?W:f,style:(Z=g.style)!=null?Z:b}},[u,f,p,b]);C.useEffect(()=>e.intercept(e.getInterceptPoints().submit,{handler(){return m({})}}),[m,e]),C.useEffect(()=>{v.some(g=>g.value===u)||i(v[0].value)},[v]);const N=g=>{const T=g,_=hr(T,n),I=_&&_[0].value;i(T),o(I),I&&h(r.createDefaultValue(T,I)),t(m({subType:T,operator:I}))},w=g=>{const T=g;o(T),t(m({operator:T}))},E=g=>{h(g),t(m({value:g}))},M=C.useMemo(()=>`${u}_${f}_${Math.random()}`,[u,f]);return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:n.t("sheet.cf.panel.styleRule")}),c.jsxs("div",{className:"univer-flex univer-justify-between univer-gap-4",children:[c.jsx(V.Select,{className:"univer-mt-3 univer-w-full",onChange:N,value:u,options:v}),(d==null?void 0:d.length)&&c.jsx(V.Select,{className:"univer-mt-3 univer-w-full",onChange:w,value:f||"",options:d})]}),c.jsx(Hr,{value:p,interceptorManager:e,type:u,operator:f,rule:l,onChange:E},M),c.jsx("div",{className:oe,children:c.jsx(te,{rule:m({})})}),c.jsx(Ke,{style:l==null?void 0:l.style,className:"univer-ml-1",onChange:g=>{S(g),t(m({style:g}))}})]})},yr=(a,e)=>(r.iconMap[a]||[])[Number(e)]||"",Wr=a=>{var o;const{error:e,type:t,onChange:n}=a,l=A.useDependency(s.IUniverInstanceService),u=l.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),i=(o=l.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:o.getSheetId(),v=C.useRef(null),[d,f]=C.useState(!1);return A.useSidebarClick(p=>{var b;(b=v.current)!=null&&b.isClickOutSide(p)&&f(!1)}),c.jsx("div",{className:"univer-relative",children:t!==r.CFValueType.formula?c.jsxs(c.Fragment,{children:[c.jsx(V.InputNumber,{className:V.clsx({"univer-border-red-500":e}),value:Number(a.value)||0,onChange:p=>n(p!=null?p:0)}),e&&c.jsx("div",{className:"univer-absolute univer-text-xs univer-text-red-500",children:e})]}):c.jsx("div",{className:"univer-w-full",children:c.jsx(ie.FormulaEditor,{ref:v,className:V.clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent",V.borderClassName),initValue:String(a.value),unitId:u,subUnitId:i,isFocus:d,onChange:(p="")=>{n(p||"")},onFocus:()=>f(!0)})})})},Cr=(a,e,t)=>({operator:r.CFNumberOperator.greaterThan,value:{type:r.CFValueType.num,value:(t.length-1-e)*10},iconType:a,iconId:String(e)}),qr=C.forwardRef((a,e)=>{const{onClick:t}=a,n=A.useDependency(s.LocaleService),l=u=>{t(u)};return c.jsx("div",{ref:e,className:"univer-w-80",children:r.iconGroup.map((u,i)=>c.jsxs("div",{className:"univer-mb-3",children:[c.jsx("div",{className:"univer-mb-1 univer-text-sm",children:n.t(u.title)}),c.jsx("div",{className:"univer-flex univer-flex-wrap",children:u.group.map(v=>c.jsx("div",{className:"univer-mb-1 univer-flex univer-w-1/2 univer-items-center",onClick:()=>{l(v.name)},children:c.jsx("a",{className:"univer-flex univer-cursor-pointer univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",children:v.list.map((d,f)=>c.jsx("img",{className:"univer-size-5",src:d,draggable:!1},f))})},v.name))})]},i))})}),Gr=a=>{const{onClick:e}=a,t=C.useMemo(()=>{const l=[];for(const u in r.iconMap){const i=r.iconMap[u],v=u;i.forEach((d,f)=>{l.push({iconType:v,base64:d,iconId:String(f)})})}return l},[]),n=l=>{e(l.iconType,l.iconId)};return c.jsxs("div",{children:[c.jsxs("div",{className:"univer-mb-2.5 univer-flex univer-cursor-pointer univer-items-center univer-pl-1",onClick:()=>n({iconType:r.EMPTY_ICON_TYPE,iconId:""}),children:[c.jsx(ce,{className:"univer-size-5"}),c.jsx("span",{className:"univer-ml-2",children:"无单元格图标"})]}),c.jsx("div",{className:"univer-flex univer-w-64 univer-flex-wrap",children:t.map(l=>c.jsx("div",{className:"univer-mb-2 univer-mr-2 univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",children:c.jsx("img",{className:"univer-size-5",src:l.base64,draggable:!1,onClick:()=>n(l)})},`${l.iconType}_${l.iconId}`))})]})},Zr=a=>{const{onChange:e,configList:t,errorMap:n={}}=a,l=A.useDependency(s.LocaleService),u=[{label:l.t(`sheet.cf.symbol.${r.CFNumberOperator.greaterThan}`),value:r.CFNumberOperator.greaterThan},{label:l.t(`sheet.cf.symbol.${r.CFNumberOperator.greaterThanOrEqual}`),value:r.CFNumberOperator.greaterThanOrEqual}],i=[{label:l.t(`sheet.cf.valueType.${r.CFValueType.num}`),value:r.CFValueType.num},{label:l.t(`sheet.cf.valueType.${r.CFValueType.percent}`),value:r.CFValueType.percent},{label:l.t(`sheet.cf.valueType.${r.CFValueType.percentile}`),value:r.CFValueType.percentile},{label:l.t(`sheet.cf.valueType.${r.CFValueType.formula}`),value:r.CFValueType.formula}],v=(p,h)=>{e([String(h),"value","value"],p)},d=(p,h)=>{e([String(h),"operator"],p);const b=r.createDefaultValue(r.CFSubRuleType.number,p);v(b,h)},f=(p,h)=>{e([String(h),"value","type"],p);const b=t[h],S=r.createDefaultValue(r.CFSubRuleType.number,b.operator);v(S,h)};return C.useMemo(()=>t.map((p,h)=>{const b=n[h],S=yr(p.iconType,p.iconId),m=h===t.length-1,N=h===0,w=t[h-1],E=(w==null?void 0:w.value.type)===r.CFValueType.formula?l.t("sheet.cf.valueType.formula"):w==null?void 0:w.value.value,M=(R,g)=>{const T={...p,iconId:g,iconType:R};e([String(h)],T)};return c.jsxs("div",{className:h?"univer-mt-6":"univer-mt-3",children:[c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[c.jsxs("div",{className:"univer-w-[45%]",children:[l.t("sheet.cf.iconSet.icon"),h+1]}),c.jsx("div",{className:"univer-w-[45%]",children:c.jsxs(c.Fragment,{children:[!N&&!m&&l.t("sheet.cf.iconSet.rule"),!N&&!m&&c.jsxs("span",{className:"univer-font-medium univer-text-gray-600 dark:!univer-text-gray-200",children:[l.t("sheet.cf.iconSet.when"),l.t(`sheet.cf.symbol.${r.getOppositeOperator(w.operator)}`),E,m?"":` ${l.t("sheet.cf.iconSet.and")} `]})]})})]}),c.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4",children:[c.jsx("div",{className:"univer-flex univer-items-center",children:c.jsx(V.Dropdown,{overlay:c.jsx("div",{className:"univer-rounded-lg univer-p-4",children:c.jsx(Gr,{onClick:M,iconId:p.iconId,iconType:p.iconType})}),children:c.jsxs("div",{className:V.clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-gray-200",V.borderClassName),children:[S?c.jsx("img",{src:S,className:"univer-size-4",draggable:!1}):c.jsx(ce,{className:"univer-size-4"}),c.jsx(Ye,{})]})})}),m?c.jsxs("div",{className:"univer-mt-0 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[l.t("sheet.cf.iconSet.rule"),c.jsxs("span",{className:"univer-font-medium",children:[l.t("sheet.cf.iconSet.when"),l.t(`sheet.cf.symbol.${r.getOppositeOperator(w.operator)}`),E,m?"":` ${l.t("sheet.cf.iconSet.and")} `]})]}):c.jsx(V.Select,{options:u,value:p.operator,onChange:R=>{d(R,h)}})]}),m?c.jsx("div",{}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:[c.jsx("div",{children:l.t("sheet.cf.iconSet.type")}),c.jsx("div",{children:l.t("sheet.cf.iconSet.value")})]}),c.jsxs("div",{className:"univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4",children:[c.jsx(V.Select,{options:i,value:p.value.type,onChange:R=>{f(R,h)}}),c.jsx(Wr,{id:h,type:p.value.type,error:b,value:p.value.value||"",onChange:R=>{v(R,h)}})]})]})]},h)}),[t,n])},Yr=a=>{var R;const{interceptorManager:e}=a,t=((R=a.rule)==null?void 0:R.type)===r.CFRuleType.iconSet?a.rule:void 0,n=A.useDependency(s.LocaleService),[l,u]=C.useState({}),[i,v]=C.useState(()=>{const g=Object.keys(r.iconMap)[0];if(t&&t.config.length){const T=t.config[0].iconType;if(!t.config.some(I=>I.iconType!==T))return T}return g}),[d,f]=C.useState(()=>{if(t&&t.config.length)return s.Tools.deepClone(t==null?void 0:t.config);const g=r.iconMap[i]||[];return new Array(g.length).fill("").map((T,_,I)=>_===I.length-1?{operator:r.CFNumberOperator.lessThanOrEqual,value:{type:r.CFValueType.num,value:Number.MAX_SAFE_INTEGER},iconType:i,iconId:String(_)}:Cr(i,_,I))}),[o,p]=C.useState(()=>t?!!t.isShowValue:!0),h=C.useMemo(()=>{const g=d.map(T=>yr(T.iconType,T.iconId));return c.jsx("div",{className:"univer-flex univer-items-center",children:g.map((T,_)=>T?c.jsx("img",{className:"univer-size-5",src:T},_):c.jsx(ce,{className:"univer-size-5"},_))})},[d]),b=g=>{if(g.reduce((_,I,k)=>_.preType&&!_.result||g.length-1===k?_:I.value.type===r.CFValueType.formula?{preType:r.CFValueType.formula,result:!1}:_.preType?{result:_.preType===I.value.type,preType:I.value.type}:{result:!0,preType:I.value.type},{result:!0,preType:""}).result&&[r.CFValueType.num,r.CFValueType.percent,r.CFValueType.percentile].includes(g[0].value.type)){const _={};return g.forEach((I,k,U)=>{if(k-1<0||k===U.length-1)return;const j=g[k-1],y=r.getOppositeOperator(j.operator);r.compareWithNumber({operator:y,value:j.value.value},I.value.value)||(_[k]=`${n.t(`sheet.cf.form.${y}`,String(j.value.value))} `)}),_}return{}},S=(g,T)=>{s.get(d,g)!==T&&(s.set(d,g,T),f([...d]),u(b(d)))},m=g=>{v(g);const T=r.iconMap[g]||[],_=new Array(T.length).fill("").map((I,k,U)=>Cr(g,k,U));f(_),u(b(_))};C.useEffect(()=>{const g=e.intercept(e.getInterceptPoints().submit,{handler(){return{type:r.CFRuleType.iconSet,isShowValue:o,config:d}}});return()=>{g()}},[o,d,e]),C.useEffect(()=>{const g=e.intercept(e.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(l).length===0}});return()=>{g()}},[o,d,e,l]);const N=()=>{const g=d.map(T=>({...T}));d.forEach((T,_)=>{const I=d.length-1-_,k=g[I];T.iconId=k.iconId,T.iconType=k.iconType}),f([...d])},w=A.useDependency(A.ILayoutService),[E,M]=C.useState();return A.useScrollYOverContainer(E,w.rootContainerElement),c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600",children:n.t("sheet.cf.panel.styleRule")}),c.jsx("div",{className:"univer-mt-3",children:c.jsx(V.Dropdown,{overlay:c.jsx("div",{className:"univer-rounded-lg univer-p-4",children:c.jsx(qr,{ref:g=>{!E&&g&&M(g)},iconType:i,onClick:m})}),children:c.jsxs("div",{className:V.clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600",V.borderClassName),children:[h,c.jsx(Ye,{})]})})}),c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center univer-text-xs",children:[c.jsxs("div",{className:"univer-flex univer-items-center univer-text-xs",children:[c.jsx(V.Checkbox,{onChange:N}),n.t("sheet.cf.iconSet.reverseIconOrder")]}),c.jsxs("div",{className:"univer-ml-6 univer-flex univer-items-center univer-text-xs",children:[c.jsx(V.Checkbox,{checked:!o,onChange:g=>{p(!g)}}),n.t("sheet.cf.iconSet.onlyShowIcon")]})]}),c.jsx(Zr,{errorMap:l,onChange:S,configList:d})]})},zr=a=>{var N;const{onChange:e,interceptorManager:t}=a,n=A.useDependency(s.LocaleService),l=((N=a.rule)==null?void 0:N.type)===r.CFRuleType.highlightCell?a.rule:void 0,u=[{label:n.t("sheet.cf.panel.isNotBottom"),value:"isNotBottom"},{label:n.t("sheet.cf.panel.isBottom"),value:"isBottom"},{label:n.t("sheet.cf.panel.greaterThanAverage"),value:"greaterThanAverage"},{label:n.t("sheet.cf.panel.lessThanAverage"),value:"lessThanAverage"}],[i,v]=C.useState(()=>{const w=u[0].value,E=l==null?void 0:l.type;if(!l)return w;switch(E){case r.CFRuleType.highlightCell:switch(l.subType){case r.CFSubRuleType.average:return[r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual].includes(l.operator)?"greaterThanAverage":[r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(l.operator)?"lessThanAverage":w;case r.CFSubRuleType.rank:return l.isBottom?"isBottom":"isNotBottom"}}return w}),[d,f]=C.useState(()=>{const E=l==null?void 0:l.type;if(!l)return 10;switch(E){case r.CFRuleType.highlightCell:if(l.subType===r.CFSubRuleType.rank)return l.value||10}return 10}),[o,p]=C.useState(()=>{const E=l==null?void 0:l.type;if(!l)return!1;switch(E){case r.CFRuleType.highlightCell:if(l.subType===r.CFSubRuleType.rank)return l.isPercent||!1}return!1}),[h,b]=C.useState({}),S=w=>{const{type:E,isPercent:M,value:R,style:g}=w;if(E==="isNotBottom")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:M,isBottom:!1,value:R,style:g};if(E==="isBottom")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:M,isBottom:!0,value:R,style:g};if(E==="greaterThanAverage")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:r.CFNumberOperator.greaterThan,style:g};if(E==="lessThanAverage")return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:r.CFNumberOperator.lessThan,style:g}};C.useEffect(()=>t.intercept(t.getInterceptPoints().submit,{handler(){return S({type:i,isPercent:o,value:d,style:h})}}),[i,o,d,h,t]);const m=w=>{e(S(w))};return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:n.t("sheet.cf.panel.styleRule")}),c.jsx(V.Select,{className:"univer-mt-3 univer-w-full",value:i,options:u,onChange:w=>{v(w),m({type:w,isPercent:o,value:d,style:h})}}),["isNotBottom","isBottom"].includes(i)&&c.jsxs("div",{className:"univer-mt-3 univer-flex univer-items-center",children:[c.jsx(V.InputNumber,{min:1,max:1e3,value:d,onChange:w=>{const E=w||0;f(E),m({type:i,isPercent:o,value:E,style:h})}}),c.jsxs("div",{className:"univer-ml-3 univer-flex univer-items-center univer-text-xs",children:[c.jsx(V.Checkbox,{checked:o,onChange:w=>{p(!!w),m({type:i,isPercent:!!w,value:d,style:h})}}),n.t("sheet.cf.valueType.percent")]})]}),c.jsx("div",{className:oe,children:c.jsx(te,{rule:S({type:i,isPercent:o,value:d,style:h})})}),c.jsx(Ke,{style:l==null?void 0:l.style,className:"univer-mt-3",onChange:w=>{b(w),m({type:i,isPercent:o,value:d,style:w})}})]})},Kr=s.createInterceptorKey("beforeSubmit"),Xr=s.createInterceptorKey("submit"),mr=a=>a.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),br=a=>{var e;return(e=a.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:e.getSheetId()},Jr=a=>{var _,I,k;const e=A.useDependency(s.LocaleService),t=A.useDependency(s.ICommandService),n=A.useDependency(s.IUniverInstanceService),l=A.useDependency(r.ConditionalFormattingRuleModel),u=A.useDependency(O.SheetsSelectionsService),i=mr(n),v=br(n),[d,f]=C.useState(void 0),o=C.useRef((I=(_=a.rule)==null?void 0:_.ranges)!=null?I:[]),p=C.useMemo(()=>{var L,j,y;let U=(L=a.rule)==null?void 0:L.ranges;return U!=null&&U.length||(U=(y=(j=u.getCurrentSelections())==null?void 0:j.map(x=>x.range))!=null?y:[]),o.current=U,U!=null&&U.length?U.map(x=>{const $=je.serializeRange(x);return $==="NaN"?"":$}).filter(x=>!!x).join(","):""},[a.rule]),h=[{label:e.t("sheet.cf.ruleType.highlightCell"),value:"1"},{label:e.t("sheet.cf.panel.rankAndAverage"),value:"2"},{label:e.t("sheet.cf.ruleType.dataBar"),value:"3"},{label:e.t("sheet.cf.ruleType.colorScale"),value:"4"},{label:e.t("sheet.cf.ruleType.formula"),value:"5"},{label:e.t("sheet.cf.ruleType.iconSet"),value:"6"}],[b,S]=C.useState(()=>{var j,y;const U=(j=a.rule)==null?void 0:j.rule.type,L=h[0].value;if(!U)return L;switch(U){case r.CFRuleType.highlightCell:{switch((y=a.rule)==null?void 0:y.rule.subType){case r.CFSubRuleType.number:case r.CFSubRuleType.text:case r.CFSubRuleType.duplicateValues:case r.CFSubRuleType.uniqueValues:case r.CFSubRuleType.timePeriod:return"1";case r.CFSubRuleType.average:case r.CFSubRuleType.rank:return"2";case r.CFSubRuleType.formula:return"5"}break}case r.CFRuleType.dataBar:return"3";case r.CFRuleType.colorScale:return"4";case r.CFRuleType.iconSet:return"6"}return L}),m=C.useRef(void 0),N=C.useMemo(()=>new s.InterceptorManager({beforeSubmit:Kr,submit:Xr}),[]),w=C.useMemo(()=>{switch(b){case"1":return gr;case"2":return zr;case"3":return $r;case"4":return Fr;case"5":return Br;case"6":return Yr;default:return gr}},[b]);C.useEffect(()=>{const U=t.onCommandExecuted(L=>{if(L.id===O.RemoveSheetMutation.id){const j=L.params;j.subUnitId===v&&j.unitId===i&&a.onCancel()}L.id===O.SetWorksheetActiveOperation.id&&a.onCancel()});return()=>U.dispose()},[]);const E=U=>{m.current=U},M=U=>{const L=U.split(",").filter(j=>!!j).map(je.deserializeRangeWithSheet).map(j=>j.range);o.current=L},R=()=>{if(d)return;const L=(()=>{const y=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!y)throw new Error("No active sheet found");return o.current.map(D=>O.setEndForRange(D,y.getRowCount(),y.getColumnCount())).filter(D=>!(Number.isNaN(D.startRow)||Number.isNaN(D.startColumn)))})();if(N.fetchThroughInterceptors(N.getInterceptPoints().beforeSubmit)(!0,null)){const y=N.fetchThroughInterceptors(N.getInterceptPoints().submit)(null,null);if(y){const x=mr(n),$=br(n);if(!x||!$)throw new Error("No active sheet found");let D={};a.rule&&a.rule.cfId?(D={...a.rule,ranges:L,rule:y},t.executeCommand(r.SetCfCommand.id,{unitId:x,subUnitId:$,rule:D}),a.onCancel()):(D={cfId:l.createCfId(x,$),ranges:L,rule:y,stopIfTrue:!1},t.executeCommand(r.AddCfCommand.id,{unitId:x,subUnitId:$,rule:D}),a.onCancel())}}},g=()=>{a.onCancel()},T=(U,L)=>{U?L.length<1?f(e.t("sheet.cf.errorMessage.rangeError")):f(void 0):f(e.t("sheet.cf.errorMessage.rangeError"))};return c.jsxs("div",{children:[c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:e.t("sheet.cf.panel.range")}),c.jsxs("div",{className:"univer-mt-4",children:[c.jsx(ie.RangeSelector,{unitId:i,subUnitId:v,initialValue:p,onChange:(U,L)=>M(L),onVerify:T}),d&&c.jsx("div",{className:"univer-mt-1 univer-text-xs univer-text-red-500",children:d})]}),c.jsx("div",{className:"univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",children:e.t("sheet.cf.panel.styleType")}),c.jsx(V.Select,{className:"univer-mt-4 univer-w-full",value:b,options:h,onChange:U=>S(U)}),c.jsx(w,{interceptorManager:N,rule:(k=a.rule)==null?void 0:k.rule,onChange:E}),c.jsxs("div",{className:"univer-mt-4 univer-flex univer-justify-end",children:[c.jsx(V.Button,{onClick:g,children:e.t("sheet.cf.panel.cancel")}),c.jsx(V.Button,{className:"univer-ml-3",variant:"primary",onClick:R,children:e.t("sheet.cf.panel.submit")})]})]})};var Qr=Object.getOwnPropertyDescriptor,et=(a,e,t,n)=>{for(var l=n>1?void 0:n?Qr(e,t):e,u=a.length-1,i;u>=0;u--)(i=a[u])&&(l=i(l)||l);return l},rt=(a,e)=>(t,n)=>e(t,n,a);let le=class extends s.Disposable{constructor(e){super();X(this,"_initLocal",()=>{});X(this,"_findReplaceIndex",e=>{const t=/\{([^}]+)?\}/g,n=[];let l=t.exec(e);for(;l;)n.push({startIndex:l.index,key:Number(l[1]),endIndex:l.index+l[0].length-1}),l=t.exec(e);return n});this._localeService=e,this._initLocal()}tWithReactNode(e,...t){const n=this._localeService.getLocales(),l=e.split("."),u=n&&this._localeService.resolveKeyPath(n,l);if(typeof u=="string"){const i=[];return this._findReplaceIndex(u).forEach((v,d,f)=>{const o=f[d-1]||{endIndex:-1};if(o.endIndex+1<v.startIndex){const p=u.slice(o.endIndex+1,v.startIndex);p&&i.push(p)}if(t[v.key]&&i.push(t[v.key]),d===f.length-1){const p=u.slice(v.endIndex+1);p&&i.push(p)}}),i}return[]}};le=et([rt(0,s.Inject(s.LocaleService))],le);const tt=(a,e)=>{const t=a.rule;switch(t.type){case r.CFRuleType.colorScale:return e.t("sheet.cf.ruleType.colorScale");case r.CFRuleType.dataBar:return e.t("sheet.cf.ruleType.dataBar");case r.CFRuleType.iconSet:return e.t("sheet.cf.ruleType.iconSet");case r.CFRuleType.highlightCell:switch(t.subType){case r.CFSubRuleType.average:{const n=t.operator;return e.t(`sheet.cf.preview.describe.${n}`,e.t("sheet.cf.subRuleType.average"))}case r.CFSubRuleType.duplicateValues:return e.t("sheet.cf.subRuleType.duplicateValues");case r.CFSubRuleType.uniqueValues:return e.t("sheet.cf.subRuleType.uniqueValues");case r.CFSubRuleType.number:{const n=t.operator;return e.t(`sheet.cf.preview.describe.${n}`,...Array.isArray(t.value)?t.value.map(l=>String(l)):[String(t.value||"")])}case r.CFSubRuleType.text:{const n=t.operator;return e.t(`sheet.cf.preview.describe.${n}`,t.value||"")}case r.CFSubRuleType.timePeriod:{const n=t.operator;return e.t(`sheet.cf.preview.describe.${n}`)}case r.CFSubRuleType.rank:return t.isPercent?t.isBottom?e.t("sheet.cf.preview.describe.bottomNPercent",String(t.value)):e.t("sheet.cf.preview.describe.topNPercent",String(t.value)):t.isBottom?e.t("sheet.cf.preview.describe.bottomN",String(t.value)):e.t("sheet.cf.preview.describe.topN",String(t.value));case r.CFSubRuleType.formula:return e.t("sheet.cf.ruleType.formula")}}},nt=a=>{const{onClick:e}=a,t=A.useDependency(r.ConditionalFormattingRuleModel),n=A.useDependency(s.IUniverInstanceService),l=A.useDependency(O.SheetsSelectionsService),u=A.useDependency(s.ICommandService),i=A.useDependency(s.LocaleService),v=A.useDependency(s.Injector),d=A.useDependency(le),f=A.useObservable(()=>n.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),o=f.getUnitId(),p=f.getActiveSheet();if(!p)throw new Error("No active sheet found");const h=p.getSheetId(),[b,S]=C.useState([]),[m,N]=C.useState("2"),[w,E]=C.useState(0),[M,R]=C.useState(""),g=[{label:i.t("sheet.cf.panel.workSheet"),value:"2"},{label:i.t("sheet.cf.panel.selectedRange"),value:"1"}],T=()=>{const D=t.getSubunitRules(o,h);if(!D||!D.length)return[];if(m==="1"){const F=l.getCurrentLastSelection();if(!F)return[];const H=F.range;return D.filter(Z=>Z.ranges.some(J=>s.Rectangle.intersects(J,H)))}else if(m==="2")return[...D];return[]},[_,I]=C.useState(T);q.useHighlightRange(b),C.useEffect(()=>{const D=u.onCommandExecuted(F=>{F.id===O.SetWorksheetActiveOperation.id&&E(Math.random())});return()=>D.dispose()}),C.useEffect(()=>{I(T)},[m,w,o,h]),C.useEffect(()=>{if(m==="2")return;const D=new K.Observable(F=>{const H=[O.SetSelectionsOperation.id,r.AddConditionalRuleMutation.id,r.SetConditionalRuleMutation.id,r.DeleteConditionalRuleMutation.id,r.MoveConditionalRuleMutation.id],W=u.onCommandExecuted(Z=>{const{id:J,params:re}=Z,z=n.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getUnitId();H.includes(J)&&re.unitId===z&&F.next(null)});return()=>W.dispose()}).pipe(K.debounceTime(16)).subscribe(()=>{I(T)});return()=>{D.unsubscribe()}},[n,m,o,h]),C.useEffect(()=>{const D=t.$ruleChange.subscribe(()=>{E(Math.random())});return()=>D.unsubscribe()},[t]);const k=D=>{var W;const F=n.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),H=(W=n.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:W.getSheetId();if(!F||!H)throw new Error("No active sheet found");u.executeCommand(r.DeleteCfCommand.id,{unitId:F,subUnitId:H,cfId:D.cfId})},U=(D,F)=>{var W;const H=x[F.y];R((W=H==null?void 0:H.cfId)!=null?W:"")},L=(D,F,H)=>{var tr,De,Le;R("");const W=n.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),Z=(tr=n.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:tr.getSheetId();if(!W||!Z)throw new Error("No active sheet found");const J=jt=>{const At=x.length;return Math.min(At-1,Math.max(0,jt))},re=(De=x[J(F.y)])==null?void 0:De.cfId,z=(Le=x[J(H.y)])==null?void 0:Le.cfId;!re||!z||re!==z&&u.executeCommand(r.MoveCfCommand.id,{unitId:W,subUnitId:Z,start:{id:re,type:"self"},end:{id:z,type:H.y>F.y?"after":"before"}})},j=()=>{a.onCreate()},y=()=>{m==="2"?u.executeCommand(r.ClearWorksheetCfCommand.id):m==="1"&&_.map(F=>({unitId:o,subUnitId:h,cfId:F.cfId})).forEach(F=>{u.executeCommand(r.DeleteCfCommand.id,F)})},x=C.useMemo(()=>{const D=n.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET),F=D.getActiveSheet();return _.filter(H=>{const W=H.ranges;return O.checkRangesEditablePermission(v,D.getUnitId(),F.getSheetId(),W)})},[_]),$=C.useMemo(()=>{const D=n.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_SHEET),F=D.getActiveSheet();return _.every(H=>{const W=H.ranges;return O.checkRangesEditablePermission(v,D.getUnitId(),F.getSheetId(),W)})},[_]);return c.jsxs("div",{children:[c.jsxs("div",{className:`
|
|
8
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/sheets`),require(`@univerjs/sheets-conditional-formatting`),require(`@univerjs/ui`),require(`react`),require(`@univerjs/design`),require(`@univerjs/engine-formula`),require(`@univerjs/sheets-formula-ui`),require(`react/jsx-runtime`),require(`@univerjs/sheets-ui`),require(`rxjs`),require(`@univerjs/sheets-formula`),require(`@univerjs/engine-render`),require(`rxjs/operators`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets`,`@univerjs/sheets-conditional-formatting`,`@univerjs/ui`,`react`,`@univerjs/design`,`@univerjs/engine-formula`,`@univerjs/sheets-formula-ui`,`react/jsx-runtime`,`@univerjs/sheets-ui`,`rxjs`,`@univerjs/sheets-formula`,`@univerjs/engine-render`,`rxjs/operators`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsConditionalFormattingUi={},e.UniverCore,e.UniverSheets,e.UniverSheetsConditionalFormatting,e.UniverUi,e.React,e.UniverDesign,e.UniverEngineFormula,e.UniverSheetsFormulaUi,e.React,e.UniverSheetsUi,e.rxjs,e.UniverSheetsFormula,e.UniverEngineRender,e.rxjs.operators))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let h={type:t.CommandType.COMMAND,id:`sheet.command.add-average-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,operator:c}=i,l=e.get(r.ConditionalFormattingRuleModel),u=e.get(t.ICommandService),d=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!d)return!1;let{unitId:f,subUnitId:p}=d,m={ranges:a,cfId:l.createCfId(f,p),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:c,style:o}};return u.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:p,rule:m})}},g={type:t.CommandType.COMMAND,id:`sheet.command.add-color-scale-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,config:o,stopIfTrue:s}=i,c=e.get(r.ConditionalFormattingRuleModel),l=e.get(t.ICommandService),u=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!u)return!1;let{unitId:d,subUnitId:f}=u,p={ranges:a,cfId:c.createCfId(d,f),stopIfTrue:!!s,rule:{type:r.CFRuleType.colorScale,config:o}};return l.executeCommand(r.AddConditionalRuleMutation.id,{unitId:d,subUnitId:f,rule:p})}},_={type:t.CommandType.COMMAND,id:`sheet.command.add-data-bar-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,min:o,max:s,nativeColor:c,positiveColor:l,isGradient:u,stopIfTrue:d,isShowValue:f}=i,p=e.get(r.ConditionalFormattingRuleModel),m=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!m)return!1;let{unitId:h,subUnitId:g}=m,_=e.get(t.ICommandService),v={ranges:a,cfId:p.createCfId(h,g),stopIfTrue:!!d,rule:{type:r.CFRuleType.dataBar,isShowValue:f,config:{min:o,max:s,nativeColor:c,positiveColor:l,isGradient:u}}};return _.executeCommand(r.AddConditionalRuleMutation.id,{unitId:h,subUnitId:g,rule:v})}},v={type:t.CommandType.COMMAND,id:`sheet.command.add-duplicate-values-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s}=i,c=e.get(r.ConditionalFormattingRuleModel),l=e.get(t.ICommandService),u=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!u)return!1;let{unitId:d,subUnitId:f}=u,p={ranges:a,cfId:c.createCfId(d,f),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.duplicateValues,style:o}};return l.executeCommand(r.AddConditionalRuleMutation.id,{unitId:d,subUnitId:f,rule:p})}},y={type:t.CommandType.COMMAND,id:`sheet.command.add-number-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,operator:c,value:l}=i,u=e.get(r.ConditionalFormattingRuleModel),d=e.get(t.ICommandService),f=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!f)return!1;let{unitId:p,subUnitId:m}=f,h=u.createCfId(p,m),g;if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(c)){let e=l;if(e.length!==2||!Array.isArray(e))return!1;g={ranges:a,cfId:h,stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:c,style:o,value:e}}}else{let e=l;if(typeof e!=`number`)return!1;g={ranges:a,cfId:h,stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.number,operator:c,style:o,value:e}}}return d.executeCommand(r.AddConditionalRuleMutation.id,{unitId:p,subUnitId:m,rule:g})}},b={type:t.CommandType.COMMAND,id:`sheet.command.add-rank-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,isPercent:c,isBottom:l,value:u}=i,d=e.get(r.ConditionalFormattingRuleModel),f=e.get(t.IUniverInstanceService),p=e.get(t.ICommandService),m=(0,n.getSheetCommandTarget)(f);if(!m)return!1;let{unitId:h,subUnitId:g}=m,_={ranges:a,cfId:d.createCfId(h,g),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:c,isBottom:l,style:o,value:u}};return p.executeCommand(r.AddConditionalRuleMutation.id,{unitId:h,subUnitId:g,rule:_})}},x={type:t.CommandType.COMMAND,id:`sheet.command.add-text-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,operator:c,value:l}=i,u=e.get(r.ConditionalFormattingRuleModel),d=(0,n.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!d)return!1;let{unitId:f,subUnitId:p}=d,m=e.get(t.ICommandService),h={ranges:a,cfId:u.createCfId(f,p),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.text,operator:c,style:o,value:l}};return m.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:p,rule:h})}},S={type:t.CommandType.COMMAND,id:`sheet.command.add-time-period-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s,operator:c}=i,l=e.get(r.ConditionalFormattingRuleModel),u=e.get(t.IUniverInstanceService),d=e.get(t.ICommandService),f=(0,n.getSheetCommandTarget)(u);if(!f)return!1;let{unitId:p,subUnitId:m}=f,h={ranges:a,cfId:l.createCfId(p,m),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.timePeriod,operator:c,style:o}};return d.executeCommand(r.AddConditionalRuleMutation.id,{unitId:p,subUnitId:m,rule:h})}},C={type:t.CommandType.COMMAND,id:`sheet.command.add-uniqueValues-conditional-rule`,handler(e,i){if(!i)return!1;let{ranges:a,style:o,stopIfTrue:s}=i,c=e.get(r.ConditionalFormattingRuleModel),l=e.get(t.IUniverInstanceService),u=e.get(t.ICommandService),d=(0,n.getSheetCommandTarget)(l);if(!d)return!1;let{unitId:f,subUnitId:p}=d,m={ranges:a,cfId:c.createCfId(f,p),stopIfTrue:!!s,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.uniqueValues,style:o}};return u.executeCommand(r.AddConditionalRuleMutation.id,{unitId:f,subUnitId:p,rule:m})}};function w({ref:e,...t}){let{icon:n,id:r,className:i,extend:o,...s}=t,c=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),l=(0,a.useRef)(`_${O()}`);return T(n,`${r}`,{defIds:n.defIds,idSuffix:l.current},{ref:e,className:c,...s},o)}function T(e,t,n,r,i){return(0,a.createElement)(e.tag,{key:t,...E(e,n,i),...r},(D(e,n).children||[]).map((r,a)=>T(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function E(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function D(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function O(){return Math.random().toString(36).substring(2,8)}w.displayName=`UniverIcon`;let k={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M4.65791 1.30005C3.77355 1.30005 3.05664 2.01696 3.05664 2.90132V12.8588C3.05664 13.8755 3.88086 14.6998 4.89759 14.6998H9.1016C11.2233 14.6998 12.9433 12.9798 12.9433 10.8581C12.9433 9.13925 11.8145 7.68407 10.2578 7.1934C10.8806 6.56856 11.2655 5.70659 11.2655 4.75472C11.2655 2.84676 9.71883 1.30005 7.81087 1.30005H4.65791ZM4.25664 2.90132C4.25664 2.6797 4.4363 2.50005 4.65791 2.50005H7.81087C9.05609 2.50005 10.0655 3.5095 10.0655 4.75472C10.0655 5.99993 9.05609 7.00938 7.81087 7.00938H4.25664V2.90132ZM4.25664 12.8588V8.21636H9.1016C10.5606 8.21636 11.7433 9.39909 11.7433 10.8581C11.7433 12.317 10.5606 13.4998 9.1016 13.4998H4.89759C4.5436 13.4998 4.25664 13.2128 4.25664 12.8588Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},A=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(w,Object.assign({},e,{id:`bold-icon`,ref:t,icon:k}))});A.displayName=`BoldIcon`;let j={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M5.3313 1.4667C5.3313 1.13533 5.59993 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},M=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(w,Object.assign({},e,{id:`delete-icon`,ref:t,icon:j}))});M.displayName=`DeleteIcon`;let N={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z`}}]},P=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(w,Object.assign({},e,{id:`increase-icon`,ref:t,icon:N}))});P.displayName=`IncreaseIcon`;let F={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M9.80385 1.40005H11.9997C12.3311 1.40005 12.5997 1.66868 12.5997 2.00005C12.5997 2.33143 12.3311 2.60005 11.9997 2.60005H10.1185L7.12251 13.4001H9.33324C9.66461 13.4001 9.93324 13.6687 9.93324 14.0001C9.93324 14.3314 9.66461 14.6001 9.33324 14.6001H6.34785C6.33847 14.6003 6.32905 14.6003 6.31962 14.6001H3.9999C3.66853 14.6001 3.3999 14.3314 3.3999 14.0001C3.3999 13.6687 3.66853 13.4001 3.9999 13.4001H5.87719L8.87322 2.60005H6.66641C6.33504 2.60005 6.06641 2.33143 6.06641 2.00005C6.06641 1.66868 6.33504 1.40005 6.66641 1.40005H9.52916C9.61698 1.37929 9.71064 1.3781 9.80385 1.40005Z`}}]},ee=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(w,Object.assign({},e,{id:`italic-icon`,ref:t,icon:F}))});ee.displayName=`ItalicIcon`;let te={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},ne=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(w,Object.assign({},e,{id:`more-down-icon`,ref:t,icon:te}))});ne.displayName=`MoreDownIcon`;let re={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M6 5C6.55228 5 7 4.55228 7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4C5 4.55228 5.44772 5 6 5Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M6 9C6.55228 9 7 8.55229 7 8C7 7.44772 6.55228 7 6 7C5.44772 7 5 7.44772 5 8C5 8.55229 5.44772 9 6 9Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M7 12C7 12.5523 6.55228 13 6 13C5.44772 13 5 12.5523 5 12C5 11.4477 5.44772 11 6 11C6.55228 11 7 11.4477 7 12Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M10 5C10.5523 5 11 4.55228 11 4C11 3.44772 10.5523 3 10 3C9.44771 3 9 3.44772 9 4C9 4.55228 9.44771 5 10 5Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M11 8C11 8.55229 10.5523 9 10 9C9.44771 9 9 8.55229 9 8C9 7.44772 9.44771 7 10 7C10.5523 7 11 7.44772 11 8Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M10 13C10.5523 13 11 12.5523 11 12C11 11.4477 10.5523 11 10 11C9.44771 11 9 11.4477 9 12C9 12.5523 9.44771 13 10 13Z`}}]},ie=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(w,Object.assign({},e,{id:`sequence-icon`,ref:t,icon:re}))});ie.displayName=`SequenceIcon`;let ae={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8.00033 1.20996C6.43345 1.20996 5.23596 1.88077 4.64804 2.94304C4.06338 3.99943 4.15123 5.32084 4.90099 6.47062C5.08199 6.7482 5.45374 6.82648 5.73131 6.64548C6.00888 6.46448 6.08716 6.09273 5.90616 5.81516C5.36418 4.98402 5.35768 4.13897 5.69797 3.52412C6.035 2.91515 6.78176 2.40996 8.00033 2.40996C9.19423 2.40996 10.0017 2.93409 10.5236 3.46755C10.7871 3.73682 10.9756 4.00712 11.0974 4.20903C11.158 4.30951 11.2013 4.39164 11.2284 4.44625C11.2419 4.47351 11.2514 4.49377 11.2568 4.50588L11.2621 4.51771C11.3901 4.82216 11.7407 4.96686 12.046 4.83992C12.3519 4.71267 12.4968 4.36149 12.3695 4.05552L11.8231 4.28278C12.3695 4.05552 12.3697 4.0558 12.3695 4.05552L12.3691 4.05437L12.3685 4.05298L12.367 4.04953L12.3629 4.03993L12.3498 4.01036C12.3388 3.98619 12.3234 3.95326 12.3033 3.91282C12.2632 3.83203 12.2043 3.72072 12.1249 3.58908C11.9666 3.32674 11.7235 2.97805 11.3814 2.62834C10.6921 1.92381 9.59192 1.20996 8.00033 1.20996Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M2.11953 8.5999H7.88935C10.1109 9.46549 10.5895 10.7649 10.4268 11.6869C10.2475 12.703 9.26939 13.5898 8.00009 13.5898C6.63323 13.5898 5.77631 13.0502 5.25534 12.528C4.99021 12.2623 4.80823 11.9965 4.69365 11.7993C4.63659 11.7011 4.59698 11.6211 4.5727 11.5686C4.56059 11.5424 4.55236 11.5231 4.54774 11.512L4.54352 11.5016C4.4267 11.193 4.0823 11.0363 3.77279 11.1516C3.46228 11.2673 3.30438 11.6129 3.4201 11.9234L3.9649 11.7203C3.4201 11.9234 3.41998 11.9231 3.4201 11.9234L3.4206 11.9247L3.42118 11.9263L3.42262 11.9301L3.42661 11.9403C3.42977 11.9484 3.43394 11.9588 3.43914 11.9713C3.44956 11.9965 3.46418 12.0304 3.48334 12.0719C3.52161 12.1547 3.57828 12.2682 3.65608 12.4021C3.81124 12.6692 4.0534 13.0223 4.40584 13.3756C5.12 14.0914 6.27196 14.7898 8.00009 14.7898C9.82574 14.7898 11.3236 13.5101 11.6085 11.8955C11.812 10.7422 11.3901 9.55402 10.2665 8.5999H13.8804C14.2117 8.5999 14.4803 8.33127 14.4803 7.9999C14.4803 7.66853 14.2117 7.3999 13.8804 7.3999H8.01411C8.0048 7.39968 7.99551 7.39969 7.98625 7.3999H2.11953C1.78816 7.3999 1.51953 7.66853 1.51953 7.9999C1.51953 8.33127 1.78816 8.5999 2.11953 8.5999Z`}}]},oe=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(w,Object.assign({},e,{id:`strikethrough-icon`,ref:t,icon:ae}))});oe.displayName=`StrikethroughIcon`;let I={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M4.46416 2.03237C4.46416 1.701 4.19553 1.43237 3.86416 1.43237C3.53279 1.43237 3.26416 1.701 3.26416 2.03237V7.33338C3.26416 10.0313 5.35834 12.2667 7.9999 12.2667C10.6415 12.2667 12.7356 10.0313 12.7356 7.33338V2.03237C12.7356 1.701 12.467 1.43237 12.1356 1.43237C11.8043 1.43237 11.5356 1.701 11.5356 2.03237V7.33338C11.5356 9.42194 9.92656 11.0667 7.9999 11.0667C6.07325 11.0667 4.46416 9.42194 4.46416 7.33338V2.03237Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M2.66641 13.4663C2.33504 13.4663 2.06641 13.7349 2.06641 14.0663C2.06641 14.3977 2.33504 14.6663 2.66641 14.6663H13.3331C13.6644 14.6663 13.9331 14.3977 13.9331 14.0663C13.9331 13.7349 13.6644 13.4663 13.3331 13.4663H2.66641Z`}}]},se=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(w,Object.assign({},e,{id:`underline-icon`,ref:t,icon:I}))});se.displayName=`UnderlineIcon`;let ce={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`colorChannel1`,d:`M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M10.3014 1.70389C9.85268 0.479568 8.12109 0.479557 7.67238 1.70389L4.72235 9.75326C4.60832 10.0644 4.76811 10.4091 5.07924 10.5231C5.39038 10.6371 5.73504 10.4773 5.84907 10.1662L6.99975 7.02646C7.03588 7.03324 7.07314 7.03679 7.11123 7.03679H10.9778L12.1247 10.1662C12.2387 10.4773 12.5834 10.6371 12.8945 10.5231C13.2057 10.4091 13.3654 10.0644 13.2514 9.75326L10.3014 1.70389ZM10.538 5.83679L9.17467 2.11682C9.11057 1.94192 8.8632 1.94192 8.7991 2.11682L7.43576 5.83679H10.538Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},le=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(w,Object.assign({},e,{id:`font-color-double-icon`,ref:t,icon:ce}))});le.displayName=`FontColorDoubleIcon`;let ue={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8.01281 1.36643C8.79386 0.585377 10.0602 0.585378 10.8412 1.36643L12.9223 3.44752C13.7034 4.22857 13.7034 5.4949 12.9223 6.27595L9.36445 9.83383C8.5834 10.6149 7.31707 10.6149 6.53602 9.83383L4.45493 7.75273C3.67388 6.97168 3.67388 5.70535 4.45493 4.9243L8.01281 1.36643ZM9.9927 2.21495C9.68028 1.90253 9.17375 1.90253 8.86133 2.21495L5.30346 5.77283L5.29671 5.77966L10.839 6.66224L12.0738 5.42742C12.3862 5.115 12.3862 4.60847 12.0738 4.29605L9.9927 2.21495Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M14.5179 9.48875C14.5179 9.99175 14.1101 10.3995 13.607 10.3995C13.1041 10.3995 12.6963 9.99175 12.6963 9.48875C12.6963 9.1773 13.0455 8.59966 13.3114 8.20487C13.4549 7.99177 13.7591 7.99177 13.9027 8.20486C14.1687 8.59965 14.5179 9.1773 14.5179 9.48875Z`}},{tag:`path`,attrs:{fill:`colorChannel1`,d:`M1.98682 13.4992C1.98682 12.5603 2.74793 11.7992 3.68682 11.7992H14.2868C15.2257 11.7992 15.9868 12.5603 15.9868 13.4992V13.4992C15.9868 14.4381 15.2257 15.1992 14.2868 15.1992H3.68682C2.74793 15.1992 1.98682 14.4381 1.98682 13.4992V13.4992Z`}}]},de=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(w,Object.assign({},e,{id:`paint-bucket-double-icon`,ref:t,icon:ue}))});de.displayName=`PaintBucketDoubleIcon`;let fe={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 17`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M2.27177 13.714L13.5855 2.40025L14.434 3.24878L3.1203 14.5625L2.27177 13.714Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`colorChannel1`,d:`M4.2603 1.82495L2.89617 1.82495C2.23343 1.82495 1.69617 2.36221 1.69617 3.02495L1.69617 4.38908L3.02617 4.38908L3.02617 3.15495L4.2603 3.15495L4.2603 1.82495ZM15.0092 4.38908L15.0092 3.02495C15.0092 2.36221 14.4719 1.82495 13.8092 1.82495L12.4451 1.82495L12.4451 3.15495L13.6792 3.15495L13.6792 4.38908L15.0092 4.38908ZM6.98856 1.82495L6.98856 3.15495L9.71681 3.15495L9.71681 1.82495L6.98856 1.82495ZM15.0092 7.11734L13.6792 7.11734L13.6792 9.84559L15.0092 9.84559L15.0092 7.11734ZM15.0092 12.5739L13.6792 12.5739L13.6792 13.808L12.4451 13.808L12.4451 15.138L13.8092 15.138C14.4719 15.138 15.0092 14.6007 15.0092 13.938L15.0092 12.5739ZM9.71681 15.138L9.71681 13.808L6.98856 13.808L6.98856 15.138L9.71681 15.138ZM4.2603 15.138L4.2603 13.808L3.02617 13.808L3.02617 12.5739L1.69617 12.5739L1.69617 13.938C1.69617 14.6007 2.23343 15.138 2.89617 15.138L4.2603 15.138ZM1.69617 9.8456L3.02617 9.8456L3.02617 7.11734L1.69617 7.11734L1.69617 9.8456Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},L=(0,a.forwardRef)(function(e,t){return(0,a.createElement)(w,Object.assign({},e,{id:`slash-double-icon`,ref:t,icon:fe}))});L.displayName=`SlashDoubleIcon`;let R=e=>{let{color:n,onChange:r,disable:i=!1,Icon:s=de,className:c}=e,u=(0,a.useMemo)(()=>new t.ColorKit(n),[n]),d=()=>(0,l.jsx)(s,{className:(0,o.clsx)(`univer-fill-primary-600`,i&&c),extend:{colorChannel1:u.isValid?n:``}});return i?d():(0,l.jsx)(o.Dropdown,{overlay:(0,l.jsx)(`div`,{className:`univer-rounded-lg univer-p-4`,children:(0,l.jsx)(o.ColorPicker,{value:n,onChange:r})}),children:(0,l.jsx)(`span`,{className:(0,o.clsx)(`
|
|
9
|
+
univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-p-1
|
|
10
|
+
hover:univer-bg-gray-100
|
|
11
|
+
dark:hover:!univer-bg-gray-700
|
|
12
|
+
`,c),children:d()})})},z=e=>{let n=e.rule;if(!n)return null;let i=(0,a.useMemo)(()=>{if(n.type===r.CFRuleType.colorScale){let e=n.config.map((e,n)=>({color:new t.ColorKit(e.color),value:n})),i=e.length-1;return[,,,,,].fill(``).map((e,t,n)=>t*i/(n.length-1)).map(t=>(0,r.getColorScaleFromValue)(e,t))}return null},[n]),s=(0,a.useMemo)(()=>{if(n.type===r.CFRuleType.iconSet)return n.config.map(e=>{let t=r.iconMap[e.iconType];return t&&t[Number(e.iconId)]})},[n]),c=`univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center univer-justify-center univer-text-xs`;switch(n.type){case r.CFRuleType.dataBar:{var u,d;let{isGradient:e}=n.config,t=e?`linear-gradient(to right, ${n.config.positiveColor||r.defaultDataBarPositiveColor}, rgb(255 255 255))`:n.config.positiveColor;return(0,l.jsxs)(`div`,{className:c,children:[(0,l.jsx)(`div`,{className:`univer-h-full univer-w-1/2 univer-border univer-border-solid`,style:{background:e?`linear-gradient(to right, rgb(255 255 255),${n.config.nativeColor||r.defaultDataBarNativeColor})`:n.config.nativeColor,borderColor:(u=n.config.nativeColor)==null?r.defaultDataBarNativeColor:u}}),(0,l.jsx)(`div`,{className:`univer-h-full univer-w-1/2 univer-border univer-border-solid`,style:{background:t,borderColor:(d=n.config.positiveColor)==null?r.defaultDataBarPositiveColor:d}})]})}case r.CFRuleType.colorScale:return i&&(0,l.jsx)(`div`,{className:c,children:i.map((e,t)=>(0,l.jsx)(`div`,{className:`univer-h-full`,style:{width:`${100/i.length}%`,background:e}},t))});case r.CFRuleType.iconSet:return s&&(0,l.jsx)(`div`,{className:c,children:s.map((e,t)=>e?(0,l.jsx)(`img`,{className:`univer-h-full`,src:e,draggable:!1},t):(0,l.jsx)(L,{},t))});case r.CFRuleType.highlightCell:{var f,p,m;let{ul:e,st:i,it:a,bl:s,bg:u,cl:d}=n.style,h=(e==null?void 0:e.s)===t.BooleanNumber.TRUE,g=(i==null?void 0:i.s)===t.BooleanNumber.TRUE,_=a===t.BooleanNumber.TRUE,v=s===t.BooleanNumber.TRUE,y=(f=u==null?void 0:u.rgb)==null?r.DEFAULT_BG_COLOR:f,b=(p=d==null?void 0:d.rgb)==null?r.DEFAULT_FONT_COLOR:p,x={textDecoration:(m=`${h?`underline`:``} ${g?`line-through`:``}`.replace(/^ /,``))==null?void 0:m,backgroundColor:y,color:b};return(0,l.jsx)(`div`,{className:(0,o.clsx)(c,{"univer-font-bold":v,"univer-italic":_}),style:x,children:`123`})}}},B=(0,o.clsx)(`univer-mt-5 univer-px-1 univer-py-2 univer-rounded`,o.borderClassName),V=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),pe=e=>{var n;let{type:s,className:u,onChange:d,id:f,value:p}=e,m=(0,i.useDependency)(t.IUniverInstanceService),h=m.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),g=(n=m.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId(),_=(0,a.useMemo)(()=>String(p).startsWith(`=`)?String(p):`=`,[p]),v=(0,a.useMemo)(()=>[r.CFValueType.max,r.CFValueType.min,`none`].includes(s)?{disabled:!0}:[r.CFValueType.percent,r.CFValueType.percentile].includes(s)?{min:0,max:100}:{min:-(2**53-1),max:2**53-1},[s]),y=(0,a.useRef)(null),[b,x]=(0,a.useState)(!1);return(0,i.useSidebarClick)(e=>{var t;(t=y.current)!=null&&t.isClickOutSide(e)&&x(!1)}),s===r.CFValueType.formula?(0,l.jsx)(`div`,{className:`univer-ml-1 univer-w-full`,children:(0,l.jsx)(c.FormulaEditor,{ref:y,className:(0,o.clsx)(`
|
|
13
|
+
univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center
|
|
14
|
+
univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors
|
|
15
|
+
hover:univer-border-primary-600
|
|
16
|
+
dark:!univer-bg-gray-700 dark:!univer-text-white
|
|
17
|
+
[&>div:first-child]:univer-px-2.5
|
|
18
|
+
[&>div]:univer-h-5 [&>div]:univer-ring-transparent
|
|
19
|
+
`,o.borderClassName),initValue:_,unitId:h,subUnitId:g,isFocus:b,onChange:(e=``)=>{d(e||``)},onFocus:()=>x(!0)})}):(0,l.jsx)(o.InputNumber,{className:u,value:Number(e.value)||0,onChange:t=>e.onChange(t||0),...v})},me=e=>{var n;let{interceptorManager:s}=e,c=(0,i.useDependency)(t.LocaleService),u=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.colorScale?e.rule:void 0,d=[V(r.CFValueType.num,c),V(r.CFValueType.percent,c),V(r.CFValueType.percentile,c),V(r.CFValueType.formula,c)],f=[V(r.CFValueType.min,c),...d],p=[V(`none`,c),...d],m=[V(r.CFValueType.max,c),...d],[h,g]=(0,a.useState)(()=>{var e;let t=r.CFValueType.min;return u&&((e=u.config[0])==null?void 0:e.value.type)||t}),[_,v]=(0,a.useState)(()=>{var e;let t=`none`;return!u||u.config.length!==3?t:((e=u.config[1])==null?void 0:e.value.type)||t}),[y,b]=(0,a.useState)(()=>{var e;let t=r.CFValueType.max;return u&&((e=u.config[u.config.length-1])==null?void 0:e.value.type)||t}),[x,S]=(0,a.useState)(()=>{if(!u)return 10;let e=u.config[0];return(e==null?void 0:e.value.value)===void 0?10:e==null?void 0:e.value.value}),[C,w]=(0,a.useState)(()=>{var e;if(!u||u.config.length!==3)return 50;let t=(e=u.config[1])==null?void 0:e.value.value;return t===void 0?50:t}),[T,E]=(0,a.useState)(()=>{var e;if(!u)return 90;let t=(e=u.config[u.config.length-1])==null?void 0:e.value.value;return t===void 0?90:t}),[D,O]=(0,a.useState)(()=>{var e;return u&&((e=u.config[0])==null?void 0:e.color)||`#d0d9fb`}),[k,A]=(0,a.useState)(()=>{var e;let t=`#7790f3`;return!u||u.config.length!==3?t:((e=u.config[1])==null?void 0:e.color)||t}),[j,M]=(0,a.useState)(()=>{var e;return u&&((e=u.config[u.config.length-1])==null?void 0:e.color)||`#2e55ef`}),N=(0,a.useMemo)(()=>e=>{let{minType:t,medianType:n,maxType:i,minValue:a,medianValue:o,maxValue:s,minColor:c,medianColor:l,maxColor:u}=e,d=[];return d.push({color:c,value:{type:t,value:a}}),n!==`none`&&d.push({color:l,value:{type:n,value:o}}),d.push({color:u,value:{type:i,value:s}}),{config:d.map((e,t)=>({...e,index:t})),type:r.CFRuleType.colorScale}},[]);(0,a.useEffect)(()=>s.intercept(s.getInterceptPoints().submit,{handler(){return N({minType:h,medianType:_,maxType:y,minValue:x,medianValue:C,maxValue:T,minColor:D,medianColor:k,maxColor:j})}}),[N,h,_,y,x,C,T,D,k,j,s]);let P=t=>{e.onChange(N(t))};return(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`
|
|
20
|
+
univer-mt-4 univer-text-sm univer-text-gray-600
|
|
21
|
+
dark:!univer-text-gray-200
|
|
22
|
+
`,children:c.t(`sheet.cf.panel.styleRule`)}),(0,l.jsx)(`div`,{className:B,children:(0,l.jsx)(z,{rule:N({minType:h,medianType:_,maxType:y,minValue:x,medianValue:C,maxValue:T,minColor:D,medianColor:k,maxColor:j})})}),(0,l.jsx)(`div`,{className:`
|
|
23
|
+
univer-mt-3 univer-text-xs univer-text-gray-600
|
|
24
|
+
dark:!univer-text-gray-200
|
|
25
|
+
`,children:c.t(`sheet.cf.valueType.min`)}),(0,l.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-h-8 univer-items-center`,children:[(0,l.jsx)(o.Select,{className:`univer-flex-shrink-0`,options:f,value:h,onChange:e=>{g(e);let t=(0,r.createDefaultValueByValueType)(e,10);S(t),P({minType:e,medianType:_,maxType:y,minValue:t,medianValue:C,maxValue:T,minColor:D,medianColor:k,maxColor:j})}}),(0,l.jsx)(pe,{id:`min`,className:`univer-ml-1`,value:x,type:h,onChange:e=>{S(e),P({minType:h,medianType:_,maxType:y,minValue:e,medianValue:C,maxValue:T,minColor:D,medianColor:k,maxColor:j})}}),(0,l.jsx)(R,{className:`univer-ml-1`,color:D,onChange:e=>{O(e),P({minType:h,medianType:_,maxType:y,minValue:x,medianValue:C,maxValue:T,minColor:e,medianColor:k,maxColor:j})}})]}),(0,l.jsx)(`div`,{className:`
|
|
26
|
+
univer-text-gray-600dark:!univer-text-gray-200
|
|
27
|
+
univer-mt-3 univer-text-xs
|
|
28
|
+
`,children:c.t(`sheet.cf.panel.medianValue`)}),(0,l.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-h-8 univer-items-center`,children:[(0,l.jsx)(o.Select,{className:`univer-flex-shrink-0`,options:p,value:_,onChange:e=>{v(e);let t=(0,r.createDefaultValueByValueType)(e,50);w(t),P({minType:h,medianType:e,maxType:y,minValue:x,medianValue:t,maxValue:T,minColor:D,medianColor:k,maxColor:j})}}),(0,l.jsx)(pe,{id:`median`,className:`univer-ml-1`,value:C,type:_,onChange:e=>{w(e),P({minType:h,medianType:_,maxType:y,minValue:x,medianValue:e,maxValue:T,minColor:D,medianColor:k,maxColor:j})}}),_!==`none`&&(0,l.jsx)(R,{className:`univer-ml-1`,color:k,onChange:e=>{A(e),P({minType:h,medianType:_,maxType:y,minValue:x,medianValue:C,maxValue:T,minColor:D,medianColor:e,maxColor:j})}})]}),(0,l.jsx)(`div`,{className:`
|
|
29
|
+
univer-mt-3 univer-text-xs univer-text-gray-600
|
|
30
|
+
dark:!univer-text-gray-200
|
|
31
|
+
`,children:c.t(`sheet.cf.valueType.max`)}),(0,l.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-h-8 univer-items-center`,children:[(0,l.jsx)(o.Select,{className:`univer-flex-shrink-0`,options:m,value:y,onChange:e=>{b(e);let t=(0,r.createDefaultValueByValueType)(e,90);E(t),P({minType:h,medianType:_,maxType:e,minValue:x,medianValue:C,maxValue:t,minColor:D,medianColor:k,maxColor:j})}}),(0,l.jsx)(pe,{id:`max`,className:`univer-ml-1`,value:T,type:y,onChange:e=>{E(e),P({minType:h,medianType:_,maxType:y,minValue:x,medianValue:C,maxValue:e,minColor:D,medianColor:k,maxColor:j})}}),(0,l.jsx)(R,{className:`univer-ml-1`,color:j,onChange:e=>{M(e),P({minType:h,medianType:_,maxType:y,minValue:x,medianValue:C,maxValue:T,minColor:D,medianColor:k,maxColor:e})}})]})]})},H=(e,t)=>({label:t.t(`sheet.cf.valueType.${e}`),value:e}),he=e=>{var n;let{onChange:s,className:u,value:d,type:f,id:p,disabled:m=!1}=e,h=(0,i.useDependency)(t.IUniverInstanceService),g=h.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),_=(n=h.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId(),v=(0,a.useRef)(null),[y,b]=(0,a.useState)(!1);(0,i.useSidebarClick)(e=>{var t;(t=v.current)!=null&&t.isClickOutSide(e)&&b(!1)});let x=(0,a.useRef)(d),S=(0,a.useMemo)(()=>[r.CFValueType.percentile,r.CFValueType.percent].includes(f)?{max:100,min:0}:{min:-(2**53-1),max:2**53-1},[f]);if(f===r.CFValueType.formula){let e=String(x.current).startsWith(`=`)?String(x.current)||``:`=`;return(0,l.jsx)(`div`,{className:`univer-ml-3 univer-w-full`,children:(0,l.jsx)(c.FormulaEditor,{ref:v,className:(0,o.clsx)(`
|
|
32
|
+
univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center
|
|
33
|
+
univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors
|
|
34
|
+
hover:univer-border-primary-600
|
|
35
|
+
dark:!univer-bg-gray-700 dark:!univer-text-white
|
|
36
|
+
[&>div:first-child]:univer-px-2.5
|
|
37
|
+
[&>div]:univer-h-5 [&>div]:univer-ring-transparent
|
|
38
|
+
`,o.borderClassName),initValue:e,unitId:g,subUnitId:_,isFocus:y,onChange:(e=``)=>{s(e||``)},onFocus:()=>b(!0)})})}return(0,l.jsx)(o.InputNumber,{className:u,value:Number(d)||0,disabled:m,onChange:e=>{s(e||0)},...S})},ge=e=>{var n;let{interceptorManager:s}=e,c=(0,i.useDependency)(t.LocaleService),u=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.dataBar?e.rule:void 0,[d,f]=(0,a.useState)(()=>{var e;return u&&(e=u.config)!=null&&e.isGradient?`1`:`0`}),[p,m]=(0,a.useState)(()=>{var e;return u&&((e=u.config)==null?void 0:e.positiveColor)||r.defaultDataBarPositiveColor}),[h,g]=(0,a.useState)(()=>{var e;return u&&((e=u.config)==null?void 0:e.nativeColor)||r.defaultDataBarNativeColor}),_=[H(r.CFValueType.num,c),H(r.CFValueType.percent,c),H(r.CFValueType.percentile,c),H(r.CFValueType.formula,c)],v=[H(r.CFValueType.min,c),..._],y=[H(r.CFValueType.max,c),..._],[b,x]=(0,a.useState)(()=>{var e;let t=v[0].value;return u&&((e=u.config)==null?void 0:e.min.type)||t}),[S,C]=(0,a.useState)(()=>{var e;let t=y[0].value;return u&&((e=u.config)==null?void 0:e.max.type)||t}),[w,T]=(0,a.useState)(()=>{var e;if(!u)return 0;let t=((e=u.config)==null?void 0:e.min)||{};return t.type===r.CFValueType.formula?t.value||`=`:t.value||0}),[E,D]=(0,a.useState)(()=>{var e;if(!u)return 100;let t=((e=u.config)==null?void 0:e.max)||{};return t.type===r.CFValueType.formula?t.value||`=`:t.value===void 0?100:t.value}),[O,k]=(0,a.useState)(()=>u?u.isShowValue===void 0?!0:!!u.isShowValue:!0),A=e=>({config:{min:{type:e.minValueType,value:e.minValue},max:{type:e.maxValueType,value:e.maxValue},isGradient:e.isGradient===`1`,positiveColor:e.positiveColor||r.defaultDataBarPositiveColor,nativeColor:e.nativeColor||r.defaultDataBarNativeColor},type:r.CFRuleType.dataBar,isShowValue:e.isShowValue});(0,a.useEffect)(()=>s.intercept(s.getInterceptPoints().submit,{handler(){return A({isGradient:d,minValue:w,minValueType:b,maxValue:E,maxValueType:S,positiveColor:p,nativeColor:h,isShowValue:O})}}),[d,w,b,E,S,p,h,s,O]);let j=t=>{e.onChange(A(t))},M=e=>{m(e),j({isGradient:d,minValue:w,minValueType:b,maxValue:E,maxValueType:S,positiveColor:e,nativeColor:h,isShowValue:O})},N=e=>{g(e),j({isGradient:d,minValue:w,minValueType:b,maxValue:E,maxValueType:S,positiveColor:p,nativeColor:e,isShowValue:O})},P=e=>_.map(e=>e.value).includes(e);return(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`
|
|
39
|
+
univer-mt-4 univer-text-sm univer-text-gray-600
|
|
40
|
+
dark:!univer-text-gray-200
|
|
41
|
+
`,children:c.t(`sheet.cf.panel.styleRule`)}),(0,l.jsx)(`div`,{className:B,children:(0,l.jsx)(z,{rule:A({isGradient:d,minValue:w,minValueType:b,maxValue:E,maxValueType:S,positiveColor:p,nativeColor:h,isShowValue:O})})}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`
|
|
42
|
+
univer-mt-3 univer-text-sm univer-text-gray-600
|
|
43
|
+
dark:!univer-text-gray-200
|
|
44
|
+
`,children:c.t(`sheet.cf.panel.fillType`)}),(0,l.jsxs)(`div`,{className:`univer-ml-1 univer-mt-3 univer-flex univer-items-center`,children:[(0,l.jsxs)(o.RadioGroup,{value:d,onChange:e=>{f(e),j({isGradient:e,minValue:w,minValueType:b,maxValue:E,maxValueType:S,positiveColor:p,nativeColor:h,isShowValue:O})},children:[(0,l.jsx)(o.Radio,{value:`0`,children:(0,l.jsx)(`span`,{className:`univer-text-xs`,children:c.t(`sheet.cf.panel.pureColor`)})}),(0,l.jsx)(o.Radio,{value:`1`,children:(0,l.jsx)(`span`,{className:`univer-text-xs`,children:c.t(`sheet.cf.panel.gradient`)})})]}),(0,l.jsxs)(`div`,{className:`univer-ml-6 univer-flex univer-items-center univer-text-xs`,children:[(0,l.jsx)(o.Checkbox,{checked:!O,onChange:e=>{k(!e),j({isGradient:e,minValue:w,minValueType:b,maxValue:E,maxValueType:S,positiveColor:p,nativeColor:h,isShowValue:!e})}}),c.t(`sheet.cf.panel.onlyShowDataBar`)]})]})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`
|
|
45
|
+
univer-mt-3 univer-text-sm univer-text-gray-600
|
|
46
|
+
dark:!univer-text-gray-200
|
|
47
|
+
`,children:c.t(`sheet.cf.panel.colorSet`)}),(0,l.jsxs)(`div`,{className:`univer-ml-1 univer-mt-3 univer-flex univer-items-center`,children:[(0,l.jsxs)(`div`,{className:`univer-flex univer-items-center`,children:[(0,l.jsx)(`div`,{className:`univer-text-xs`,children:c.t(`sheet.cf.panel.native`)}),(0,l.jsx)(R,{color:h,onChange:N})]}),(0,l.jsxs)(`div`,{className:`univer-ml-3 univer-flex univer-items-center`,children:[(0,l.jsx)(`div`,{className:`univer-text-xs`,children:c.t(`sheet.cf.panel.positive`)}),(0,l.jsx)(R,{color:p,onChange:M})]})]})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`
|
|
48
|
+
univer-mt-3 univer-text-sm univer-text-gray-600
|
|
49
|
+
dark:!univer-text-gray-200
|
|
50
|
+
`,children:c.t(`sheet.cf.valueType.min`)}),(0,l.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center`,children:[(0,l.jsx)(o.Select,{className:`univer-w-1/2 univer-flex-shrink-0`,options:v,value:b,onChange:e=>{x(e);let t=(0,r.createDefaultValueByValueType)(e,10);T(t),j({isGradient:d,minValue:t,minValueType:e,maxValue:E,maxValueType:S,positiveColor:p,nativeColor:h,isShowValue:O})}}),(0,l.jsx)(he,{id:`min`,className:`univer-ml-3`,disabled:!P(b),type:b,value:w,onChange:e=>{T(e||0),j({isGradient:d,minValue:e||0,minValueType:b,maxValue:E,maxValueType:S,positiveColor:p,nativeColor:h,isShowValue:O})}})]}),(0,l.jsx)(`div`,{className:`
|
|
51
|
+
univer-mt-3 univer-text-sm univer-text-gray-600
|
|
52
|
+
dark:!univer-text-gray-200
|
|
53
|
+
`,children:c.t(`sheet.cf.valueType.max`)}),(0,l.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center`,children:[(0,l.jsx)(o.Select,{className:`univer-w-1/2 univer-flex-shrink-0`,options:y,value:S,onChange:e=>{C(e);let t=(0,r.createDefaultValueByValueType)(e,90);D(t),j({isGradient:d,minValue:w,minValueType:b,maxValue:t,maxValueType:e,positiveColor:p,nativeColor:h,isShowValue:O})}}),(0,l.jsx)(he,{className:`univer-ml-3`,disabled:!P(S),id:`max`,type:S,value:E,onChange:e=>{D(e||0),j({isGradient:d,minValue:w,minValueType:b,maxValue:e||0,maxValueType:S,positiveColor:p,nativeColor:h,isShowValue:O})}})]})]})]})},_e=e=>[t.BooleanNumber.FALSE,void 0].includes(e)?t.BooleanNumber.TRUE:t.BooleanNumber.FALSE,ve=e=>e!==t.BooleanNumber.FALSE,ye=e=>{let{style:n,onChange:i,className:s}=e,[c,u]=(0,a.useState)(()=>{if(n!=null&&n.bl)return n.bl}),[d,f]=(0,a.useState)(()=>{if(n!=null&&n.it)return n.it}),[p,m]=(0,a.useState)(()=>{if(n!=null&&n.ul)return n.ul.s}),[h,g]=(0,a.useState)(()=>{if(n!=null&&n.st)return n.st.s}),[_,v]=(0,a.useState)(()=>{var e;return!(n==null||(e=n.cl)==null)&&e.rgb?n.cl.rgb:`#2f56ef`}),[y,b]=(0,a.useState)(()=>{var e;return!(n==null||(e=n.bg)==null)&&e.rgb?n.bg.rgb:`#e8ecfc`});(0,a.useEffect)(()=>{let e={bl:c,it:d};_!==void 0&&(e.cl={rgb:_}),y!==void 0&&(e.bg={rgb:y}),h!==void 0&&(e.st={s:h}),p!==void 0&&(e.ul={s:p}),i((0,r.removeUndefinedAttr)(e))},[c,d,p,h,_,y]);let x=`univer-flex univer-cursor-pointer univer-items-center univer-rounded univer-px-1`;return(0,l.jsxs)(`div`,{className:(0,o.clsx)(`univer-my-2.5 univer-flex univer-justify-between`,s),children:[(0,l.jsx)(`div`,{className:(0,o.clsx)(x,{"univer-bg-gray-100 dark:!univer-bg-gray-700":ve(c||t.BooleanNumber.FALSE)}),onClick:()=>u(_e(c)),children:(0,l.jsx)(A,{})}),(0,l.jsx)(`div`,{className:(0,o.clsx)(x,{"univer-bg-gray-100 dark:!univer-bg-gray-700":ve(d||t.BooleanNumber.FALSE)}),onClick:()=>f(_e(d)),children:(0,l.jsx)(ee,{})}),(0,l.jsx)(`div`,{className:(0,o.clsx)(x,{"univer-bg-gray-100 dark:!univer-bg-gray-700":ve(p||t.BooleanNumber.FALSE)}),onClick:()=>m(_e(p)),children:(0,l.jsx)(se,{})}),(0,l.jsx)(`div`,{className:(0,o.clsx)(x,{"univer-bg-gray-100 dark:!univer-bg-gray-700":ve(h||t.BooleanNumber.FALSE)}),onClick:()=>g(_e(h)),children:(0,l.jsx)(oe,{})}),(0,l.jsx)(R,{color:_,onChange:v,Icon:le}),(0,l.jsx)(R,{color:y,onChange:b})]})},be=e=>{var n;let{onChange:s,interceptorManager:u}=e,d=(0,i.useDependency)(t.LocaleService),f=(0,i.useDependency)(t.IUniverInstanceService).getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET),p=f.getActiveSheet(),m=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.highlightCell?e.rule:void 0,h=(0,a.useRef)(null),[g,_]=(0,a.useState)(!1),v=(0,a.useRef)(null),[y,b]=(0,a.useState)({}),[x,S]=(0,a.useState)(()=>(m==null?void 0:m.subType)===r.CFSubRuleType.formula?m.value:`=`),[C,w]=(0,a.useState)(void 0),T=e=>({style:e.style,value:x,type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.formula});(0,a.useEffect)(()=>u.intercept(u.getInterceptPoints().submit,{handler(){return T({style:y,formula:x})}}),[y,x,u]),(0,a.useEffect)(()=>u.intercept(u.getInterceptPoints().beforeSubmit,{handler:(e,t,n)=>C||x.length===1||!x.startsWith(`=`)?(w(d.t(`sheet.cf.errorMessage.formulaError`)),!1):n(e)}),[C,x]);let E=e=>{s(T(e))};return(0,i.useSidebarClick)(e=>{var t;(t=v.current)!=null&&t.isClickOutSide(e)&&_(!1)}),(0,l.jsxs)(`div`,{ref:h,children:[(0,l.jsx)(`div`,{className:`
|
|
54
|
+
univer-mt-4 univer-text-sm univer-text-gray-600
|
|
55
|
+
dark:!univer-text-gray-200
|
|
56
|
+
`,children:d.t(`sheet.cf.panel.styleRule`)}),(0,l.jsx)(`div`,{className:`univer-mt-3`,children:(0,l.jsx)(c.FormulaEditor,{ref:v,className:(0,o.clsx)(`
|
|
57
|
+
univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center
|
|
58
|
+
univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors
|
|
59
|
+
hover:univer-border-primary-600
|
|
60
|
+
dark:!univer-bg-gray-700 dark:!univer-text-white
|
|
61
|
+
[&>div:first-child]:univer-px-2.5
|
|
62
|
+
[&>div]:univer-h-5 [&>div]:univer-ring-transparent
|
|
63
|
+
`,o.borderClassName),errorText:C,isFocus:g,initValue:x,unitId:f.getUnitId(),subUnitId:p==null?void 0:p.getSheetId(),onFocus:()=>{_(!0)},onChange:e=>{S(e),E({style:y,formula:e})},onVerify:(e,t)=>{!e||t.length===1?w(d.t(`sheet.cf.errorMessage.formulaError`)):w(void 0)}})}),(0,l.jsx)(`div`,{className:B,children:(0,l.jsx)(z,{rule:T({style:y,formula:x})})}),(0,l.jsx)(ye,{style:m==null?void 0:m.style,className:`univer-mt-3`,onChange:e=>{b(e),E({style:e,formula:x})}})]})},xe=e=>(0,l.jsxs)(`div`,{className:`univer-relative`,children:[(0,l.jsx)(`div`,{className:`univer-absolute univer-bottom-[-13px] univer-z-[999] univer-text-[10px] univer-text-red-500`,children:e.errorText}),e.children]}),U=(e,t)=>({label:t.t(`sheet.cf.operator.${e}`),value:e}),Se=e=>{let{type:n,operator:s,onChange:c,value:u,interceptorManager:d}=e,f=(0,i.useDependency)(t.LocaleService),[p,m]=(0,a.useState)(()=>typeof u==`number`?u:0),[h,g]=(0,a.useState)(``),[_,v]=(0,a.useState)(()=>typeof u==`string`?u:``),[y,b]=(0,a.useState)(``),[x,S]=(0,a.useState)(()=>Array.isArray(u)?u[0]===void 0?0:u[0]:0),[C,w]=(0,a.useState)(``),[T,E]=(0,a.useState)(()=>Array.isArray(u)?u[1]===void 0?100:u[1]:100),[D,O]=(0,a.useState)(``);switch((0,a.useEffect)(()=>{switch(n){case r.CFSubRuleType.text:[r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(s)&&c(_);break;case r.CFSubRuleType.number:[r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(s)&&c(p),[r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(s)&&c([x,T]);break}},[n]),(0,a.useEffect)(()=>{let e=d.intercept(d.getInterceptPoints().beforeSubmit,{handler:(e,t,i)=>{switch(n){case r.CFSubRuleType.text:if([r.CFTextOperator.beginsWith,r.CFTextOperator.containsText,r.CFTextOperator.endsWith,r.CFTextOperator.notEqual,r.CFTextOperator.notContainsText,r.CFTextOperator.equal].includes(s))return _?i(e):(b(f.t(`sheet.cf.errorMessage.notBlank`)),!1)}return i(e)}});return()=>{e()}},[n,p,_,s]),n){case r.CFSubRuleType.text:if([r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(s)){let e=e=>{v(e),c(e)};return(0,l.jsx)(`div`,{className:`univer-mt-3`,children:(0,l.jsx)(xe,{errorText:y,children:(0,l.jsx)(o.Input,{value:_,onChange:t=>{b(``),e(t)}})})})}break;case r.CFSubRuleType.number:if([r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(s))return(0,l.jsx)(`div`,{className:`univer-mt-3`,children:(0,l.jsx)(xe,{errorText:h,children:(0,l.jsx)(o.InputNumber,{className:`univer-w-full`,min:-(2**53-1),max:2**53-1,value:p,onChange:e=>{m(e||0),c(e||0),g(``)}})})});if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(s))return(0,l.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center`,children:[(0,l.jsx)(xe,{errorText:C,children:(0,l.jsx)(o.InputNumber,{min:-(2**53-1),max:2**53-1,value:x,onChange:e=>{S(e||0),c([e||0,T]),w(``)}})}),(0,l.jsx)(xe,{errorText:D,children:(0,l.jsx)(o.InputNumber,{className:`univer-ml-3`,min:-(2**53-1),max:2**53-1,value:T,onChange:e=>{E(e||0),c([x,e||0]),O(``)}})})]})}return null},Ce=(e,t)=>{switch(e){case r.CFSubRuleType.text:return[U(r.CFTextOperator.containsText,t),U(r.CFTextOperator.notContainsText,t),U(r.CFTextOperator.beginsWith,t),U(r.CFTextOperator.endsWith,t),U(r.CFTextOperator.equal,t),U(r.CFTextOperator.notEqual,t),U(r.CFTextOperator.containsBlanks,t),U(r.CFTextOperator.notContainsBlanks,t),U(r.CFTextOperator.containsErrors,t),U(r.CFTextOperator.notContainsErrors,t)];case r.CFSubRuleType.number:return[U(r.CFNumberOperator.between,t),U(r.CFNumberOperator.notBetween,t),U(r.CFNumberOperator.equal,t),U(r.CFNumberOperator.notEqual,t),U(r.CFNumberOperator.greaterThan,t),U(r.CFNumberOperator.greaterThanOrEqual,t),U(r.CFNumberOperator.lessThan,t),U(r.CFNumberOperator.lessThanOrEqual,t)];case r.CFSubRuleType.timePeriod:return[U(r.CFTimePeriodOperator.yesterday,t),U(r.CFTimePeriodOperator.today,t),U(r.CFTimePeriodOperator.tomorrow,t),U(r.CFTimePeriodOperator.last7Days,t),U(r.CFTimePeriodOperator.lastWeek,t),U(r.CFTimePeriodOperator.thisWeek,t),U(r.CFTimePeriodOperator.nextWeek,t),U(r.CFTimePeriodOperator.lastMonth,t),U(r.CFTimePeriodOperator.thisMonth,t),U(r.CFTimePeriodOperator.nextMonth,t)]}},we=e=>{var n;let{interceptorManager:s,onChange:c}=e,u=(0,i.useDependency)(t.LocaleService),d=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.highlightCell?e.rule:void 0,[f,p]=(0,a.useState)(()=>{let e=r.CFSubRuleType.text;return d&&d.subType||e}),m=[{value:r.CFSubRuleType.text,label:u.t(`sheet.cf.subRuleType.text`)},{value:r.CFSubRuleType.number,label:u.t(`sheet.cf.subRuleType.number`)},{value:r.CFSubRuleType.timePeriod,label:u.t(`sheet.cf.subRuleType.timePeriod`)},{value:r.CFSubRuleType.duplicateValues,label:u.t(`sheet.cf.subRuleType.duplicateValues`)},{value:r.CFSubRuleType.uniqueValues,label:u.t(`sheet.cf.subRuleType.uniqueValues`)}],h=(0,a.useMemo)(()=>Ce(f,u),[f]),[g,_]=(0,a.useState)(()=>{let e=h?h[0].value:void 0;return d&&d.operator||e}),[v,y]=(0,a.useState)(()=>{var e;return d?(e=d.value)==null?(0,r.createDefaultValue)(d.subType,d.operator):e:``}),[b,x]=(0,a.useState)({}),S=(0,a.useMemo)(()=>e=>{var t,n,i;switch(e.subType||f){case r.CFSubRuleType.text:if([r.CFTextOperator.beginsWith,r.CFTextOperator.endsWith,r.CFTextOperator.containsText,r.CFTextOperator.notContainsText,r.CFTextOperator.equal,r.CFTextOperator.notEqual].includes(g)){var a,o,s,c;return{type:r.CFRuleType.highlightCell,subType:(a=e.subType)==null?f:a,operator:(o=e.operator)==null?g:o,style:(s=e.style)==null?b:s,value:(c=e.value)==null?v:c}}break;case r.CFSubRuleType.number:if([r.CFNumberOperator.equal,r.CFNumberOperator.notEqual,r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual,r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(g)){var l,u,d,p;return{type:r.CFRuleType.highlightCell,subType:(l=e.subType)==null?f:l,operator:(u=e.operator)==null?g:u,style:(d=e.style)==null?b:d,value:(p=e.value)==null?v:p}}if([r.CFNumberOperator.between,r.CFNumberOperator.notBetween].includes(g)){var m,h,_,y;return{type:r.CFRuleType.highlightCell,subType:(m=e.subType)==null?f:m,operator:(h=e.operator)==null?g:h,style:(_=e.style)==null?b:_,value:(y=e.value)==null?v:y}}break}return{type:r.CFRuleType.highlightCell,subType:(t=e.subType)==null?f:t,operator:(n=e.operator)==null?g:n,style:(i=e.style)==null?b:i}},[f,g,v,b]);(0,a.useEffect)(()=>s.intercept(s.getInterceptPoints().submit,{handler(){return S({})}}),[S,s]),(0,a.useEffect)(()=>{m.some(e=>e.value===f)||p(m[0].value)},[m]);let C=e=>{let t=e,n=Ce(t,u),i=n&&n[0].value;p(t),_(i),i&&y((0,r.createDefaultValue)(t,i)),c(S({subType:t,operator:i}))},w=e=>{let t=e;_(t),c(S({operator:t}))},T=e=>{y(e),c(S({value:e}))},E=(0,a.useMemo)(()=>`${f}_${g}_${Math.random()}`,[f,g]);return(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`
|
|
64
|
+
univer-mt-4 univer-text-sm univer-text-gray-600
|
|
65
|
+
dark:!univer-text-gray-200
|
|
66
|
+
`,children:u.t(`sheet.cf.panel.styleRule`)}),(0,l.jsxs)(`div`,{className:`univer-flex univer-justify-between univer-gap-4`,children:[(0,l.jsx)(o.Select,{className:`univer-mt-3 univer-w-full`,onChange:C,value:f,options:m}),(h==null?void 0:h.length)&&(0,l.jsx)(o.Select,{className:`univer-mt-3 univer-w-full`,onChange:w,value:g||``,options:h})]}),(0,l.jsx)(Se,{value:v,interceptorManager:s,type:f,operator:g,rule:d,onChange:T},E),(0,l.jsx)(`div`,{className:B,children:(0,l.jsx)(z,{rule:S({})})}),(0,l.jsx)(ye,{style:d==null?void 0:d.style,className:`univer-ml-1`,onChange:e=>{x(e),c(S({style:e}))}})]})},Te=(e,t)=>(r.iconMap[e]||[])[Number(t)]||``,Ee=e=>{var n;let{error:s,type:u,onChange:d}=e,f=(0,i.useDependency)(t.IUniverInstanceService),p=f.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),m=(n=f.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId(),h=(0,a.useRef)(null),[g,_]=(0,a.useState)(!1);return(0,i.useSidebarClick)(e=>{var t;(t=h.current)!=null&&t.isClickOutSide(e)&&_(!1)}),(0,l.jsx)(`div`,{className:`univer-relative`,children:u===r.CFValueType.formula?(0,l.jsx)(`div`,{className:`univer-w-full`,children:(0,l.jsx)(c.FormulaEditor,{ref:h,className:(0,o.clsx)(`
|
|
67
|
+
univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center
|
|
68
|
+
univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors
|
|
69
|
+
hover:univer-border-primary-600
|
|
70
|
+
dark:!univer-bg-gray-700 dark:!univer-text-white
|
|
71
|
+
[&>div:first-child]:univer-px-2.5
|
|
72
|
+
[&>div]:univer-h-5 [&>div]:univer-ring-transparent
|
|
73
|
+
`,o.borderClassName),initValue:String(e.value),unitId:p,subUnitId:m,isFocus:g,onChange:(e=``)=>{d(e||``)},onFocus:()=>_(!0)})}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.InputNumber,{className:(0,o.clsx)({"univer-border-red-500":s}),value:Number(e.value)||0,onChange:e=>d(e==null?0:e)}),s&&(0,l.jsx)(`div`,{className:`univer-absolute univer-text-xs univer-text-red-500`,children:s})]})})},De=(e,t,n)=>({operator:r.CFNumberOperator.greaterThan,value:{type:r.CFValueType.num,value:(n.length-1-t)*10},iconType:e,iconId:String(t)}),Oe=(0,a.forwardRef)((e,n)=>{let{onClick:a}=e,o=(0,i.useDependency)(t.LocaleService),s=e=>{a(e)};return(0,l.jsx)(`div`,{ref:n,className:`univer-w-80`,children:r.iconGroup.map((e,t)=>(0,l.jsxs)(`div`,{className:`univer-mb-3`,children:[(0,l.jsx)(`div`,{className:`univer-mb-1 univer-text-sm`,children:o.t(e.title)}),(0,l.jsx)(`div`,{className:`univer-flex univer-flex-wrap`,children:e.group.map(e=>(0,l.jsx)(`div`,{className:`univer-mb-1 univer-flex univer-w-1/2 univer-items-center`,onClick:()=>{s(e.name)},children:(0,l.jsx)(`a`,{className:`
|
|
74
|
+
univer-flex univer-cursor-pointer univer-rounded
|
|
75
|
+
hover:univer-bg-gray-100
|
|
76
|
+
dark:hover:!univer-bg-gray-700
|
|
77
|
+
`,children:e.list.map((e,t)=>(0,l.jsx)(`img`,{className:`univer-size-5`,src:e,draggable:!1},t))})},e.name))})]},t))})}),ke=e=>{let{onClick:t}=e,n=(0,a.useMemo)(()=>{let e=[];for(let t in r.iconMap){let n=r.iconMap[t],i=t;n.forEach((t,n)=>{e.push({iconType:i,base64:t,iconId:String(n)})})}return e},[]),i=e=>{t(e.iconType,e.iconId)};return(0,l.jsxs)(`div`,{children:[(0,l.jsxs)(`div`,{className:`univer-mb-2.5 univer-flex univer-cursor-pointer univer-items-center univer-pl-1`,onClick:()=>i({iconType:r.EMPTY_ICON_TYPE,iconId:``,base64:``}),children:[(0,l.jsx)(L,{className:`univer-size-5`}),(0,l.jsx)(`span`,{className:`univer-ml-2`,children:`无单元格图标`})]}),(0,l.jsx)(`div`,{className:`univer-flex univer-w-64 univer-flex-wrap`,children:n.map(e=>(0,l.jsx)(`div`,{className:`
|
|
78
|
+
univer-mb-2 univer-mr-2 univer-flex univer-cursor-pointer univer-items-center
|
|
79
|
+
univer-justify-center univer-rounded
|
|
80
|
+
hover:univer-bg-gray-100
|
|
81
|
+
dark:hover:!univer-bg-gray-700
|
|
82
|
+
`,children:(0,l.jsx)(`img`,{className:`univer-size-5`,src:e.base64,draggable:!1,onClick:()=>i(e)})},`${e.iconType}_${e.iconId}`))})]})},Ae=e=>{let{onChange:n,configList:s,errorMap:c={}}=e,u=(0,i.useDependency)(t.LocaleService),d=[{label:u.t(`sheet.cf.symbol.${r.CFNumberOperator.greaterThan}`),value:r.CFNumberOperator.greaterThan},{label:u.t(`sheet.cf.symbol.${r.CFNumberOperator.greaterThanOrEqual}`),value:r.CFNumberOperator.greaterThanOrEqual}],f=[{label:u.t(`sheet.cf.valueType.${r.CFValueType.num}`),value:r.CFValueType.num},{label:u.t(`sheet.cf.valueType.${r.CFValueType.percent}`),value:r.CFValueType.percent},{label:u.t(`sheet.cf.valueType.${r.CFValueType.percentile}`),value:r.CFValueType.percentile},{label:u.t(`sheet.cf.valueType.${r.CFValueType.formula}`),value:r.CFValueType.formula}],p=(e,t)=>{n([String(t),`value`,`value`],e)},m=(e,t)=>{n([String(t),`operator`],e),p((0,r.createDefaultValue)(r.CFSubRuleType.number,e),t)},h=(e,t)=>{n([String(t),`value`,`type`],e);let i=s[t];p((0,r.createDefaultValue)(r.CFSubRuleType.number,i.operator),t)};return(0,a.useMemo)(()=>s.map((e,t)=>{let i=c[t],a=Te(e.iconType,e.iconId),g=t===s.length-1,_=t===0,v=s[t-1],y=(v==null?void 0:v.value.type)===r.CFValueType.formula?u.t(`sheet.cf.valueType.formula`):v==null?void 0:v.value.value;return(0,l.jsxs)(`div`,{className:t?`univer-mt-6`:`univer-mt-3`,children:[(0,l.jsxs)(`div`,{className:`
|
|
83
|
+
univer-mt-3 univer-flex univer-items-center univer-justify-between univer-text-sm
|
|
84
|
+
univer-text-gray-600
|
|
85
|
+
dark:!univer-text-gray-200
|
|
86
|
+
`,children:[(0,l.jsxs)(`div`,{className:`univer-w-[45%]`,children:[u.t(`sheet.cf.iconSet.icon`),t+1]}),(0,l.jsx)(`div`,{className:`univer-w-[45%]`,children:(0,l.jsxs)(l.Fragment,{children:[!_&&!g&&u.t(`sheet.cf.iconSet.rule`),!_&&!g&&(0,l.jsxs)(`span`,{className:`
|
|
87
|
+
univer-font-medium univer-text-gray-600
|
|
88
|
+
dark:!univer-text-gray-200
|
|
89
|
+
`,children:[u.t(`sheet.cf.iconSet.when`),u.t(`sheet.cf.symbol.${(0,r.getOppositeOperator)(v.operator)}`),y,g?``:` ${u.t(`sheet.cf.iconSet.and`)} `]})]})})]}),(0,l.jsxs)(`div`,{className:`univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4`,children:[(0,l.jsx)(`div`,{className:`univer-flex univer-items-center`,children:(0,l.jsx)(o.Dropdown,{overlay:(0,l.jsx)(`div`,{className:`univer-rounded-lg univer-p-4`,children:(0,l.jsx)(ke,{onClick:(r,i)=>{let a={...e,iconId:i,iconType:r};n([String(t)],a)},iconId:e.iconId,iconType:e.iconType})}),children:(0,l.jsxs)(`div`,{className:(0,o.clsx)(`
|
|
90
|
+
univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center
|
|
91
|
+
univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2
|
|
92
|
+
univer-text-xs univer-text-gray-600 univer-transition-all
|
|
93
|
+
hover:univer-border-primary-600
|
|
94
|
+
dark:!univer-text-gray-200
|
|
95
|
+
`,o.borderClassName),children:[a?(0,l.jsx)(`img`,{src:a,className:`univer-size-4`,draggable:!1}):(0,l.jsx)(L,{className:`univer-size-4`}),(0,l.jsx)(ne,{})]})})}),g?(0,l.jsxs)(`div`,{className:`
|
|
96
|
+
univer-mt-0 univer-text-sm univer-text-gray-600
|
|
97
|
+
dark:!univer-text-gray-200
|
|
98
|
+
`,children:[u.t(`sheet.cf.iconSet.rule`),(0,l.jsxs)(`span`,{className:`univer-font-medium`,children:[u.t(`sheet.cf.iconSet.when`),u.t(`sheet.cf.symbol.${(0,r.getOppositeOperator)(v.operator)}`),y,g?``:` ${u.t(`sheet.cf.iconSet.and`)} `]})]}):(0,l.jsx)(o.Select,{options:d,value:e.operator,onChange:e=>{m(e,t)}})]}),g?(0,l.jsx)(`div`,{}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`
|
|
99
|
+
univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4 univer-text-sm
|
|
100
|
+
univer-text-gray-600
|
|
101
|
+
dark:!univer-text-gray-200
|
|
102
|
+
`,children:[(0,l.jsx)(`div`,{children:u.t(`sheet.cf.iconSet.type`)}),(0,l.jsx)(`div`,{children:u.t(`sheet.cf.iconSet.value`)})]}),(0,l.jsxs)(`div`,{className:`univer-mt-3 univer-grid univer-grid-cols-2 univer-gap-4`,children:[(0,l.jsx)(o.Select,{options:f,value:e.value.type,onChange:e=>{h(e,t)}}),(0,l.jsx)(Ee,{id:t,type:e.value.type,error:i,value:e.value.value||``,onChange:e=>{p(e,t)}})]})]})]},t)}),[s,c])},je=e=>{var n;let{interceptorManager:s}=e,c=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.iconSet?e.rule:void 0,u=(0,i.useDependency)(t.LocaleService),[d,f]=(0,a.useState)({}),[p,m]=(0,a.useState)(()=>{let e=Object.keys(r.iconMap)[0];if(c&&c.config.length){let e=c.config[0].iconType;if(!c.config.some(t=>t.iconType!==e))return e}return e}),[h,g]=(0,a.useState)(()=>{if(c&&c.config.length)return t.Tools.deepClone(c==null?void 0:c.config);let e=r.iconMap[p]||[];return Array(e.length).fill(``).map((e,t,n)=>t===n.length-1?{operator:r.CFNumberOperator.lessThanOrEqual,value:{type:r.CFValueType.num,value:2**53-1},iconType:p,iconId:String(t)}:De(p,t,n))}),[_,v]=(0,a.useState)(()=>c?!!c.isShowValue:!0),y=(0,a.useMemo)(()=>(0,l.jsx)(`div`,{className:`univer-flex univer-items-center`,children:h.map(e=>Te(e.iconType,e.iconId)).map((e,t)=>e?(0,l.jsx)(`img`,{className:`univer-size-5`,src:e},t):(0,l.jsx)(L,{className:`univer-size-5`},t))}),[h]),b=e=>{if(e.reduce((t,n,i)=>t.preType&&!t.result||e.length-1===i?t:n.value.type===r.CFValueType.formula?{preType:r.CFValueType.formula,result:!1}:t.preType?{result:t.preType===n.value.type,preType:n.value.type}:{result:!0,preType:n.value.type},{result:!0,preType:``}).result&&[r.CFValueType.num,r.CFValueType.percent,r.CFValueType.percentile].includes(e[0].value.type)){let t={};return e.forEach((n,i,a)=>{if(i-1<0||i===a.length-1)return;let o=e[i-1],s=(0,r.getOppositeOperator)(o.operator);(0,r.compareWithNumber)({operator:s,value:o.value.value},n.value.value)||(t[i]=`${u.t(`sheet.cf.form.${s}`,String(o.value.value))} `)}),t}return{}},x=(e,n)=>{(0,t.get)(h,e)!==n&&((0,t.set)(h,e,n),g([...h]),f(b(h)))},S=e=>{m(e);let t=r.iconMap[e]||[],n=Array(t.length).fill(``).map((t,n,r)=>De(e,n,r));g(n),f(b(n))};(0,a.useEffect)(()=>{let e=s.intercept(s.getInterceptPoints().submit,{handler(){return{type:r.CFRuleType.iconSet,isShowValue:_,config:h}}});return()=>{e()}},[_,h,s]),(0,a.useEffect)(()=>{let e=s.intercept(s.getInterceptPoints().beforeSubmit,{handler(){return Object.keys(d).length===0}});return()=>{e()}},[_,h,s,d]);let C=()=>{let e=h.map(e=>({...e}));h.forEach((t,n)=>{let r=e[h.length-1-n];t.iconId=r.iconId,t.iconType=r.iconType}),g([...h])},w=(0,i.useDependency)(i.ILayoutService),[T,E]=(0,a.useState)();return(0,i.useScrollYOverContainer)(T,w.rootContainerElement),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`univer-mt-4 univer-text-sm univer-text-gray-600`,children:u.t(`sheet.cf.panel.styleRule`)}),(0,l.jsx)(`div`,{className:`univer-mt-3`,children:(0,l.jsx)(o.Dropdown,{overlay:(0,l.jsx)(`div`,{className:`univer-rounded-lg univer-p-4`,children:(0,l.jsx)(Oe,{ref:e=>{!T&&e&&E(e)},iconType:p,onClick:S})}),children:(0,l.jsxs)(`div`,{className:(0,o.clsx)(`
|
|
103
|
+
univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center
|
|
104
|
+
univer-justify-between univer-rounded-md univer-bg-white univer-px-4 univer-py-2
|
|
105
|
+
univer-text-xs univer-text-gray-600 univer-transition-all
|
|
106
|
+
hover:univer-border-primary-600
|
|
107
|
+
`,o.borderClassName),children:[y,(0,l.jsx)(ne,{})]})})}),(0,l.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center univer-text-xs`,children:[(0,l.jsxs)(`div`,{className:`univer-flex univer-items-center univer-text-xs`,children:[(0,l.jsx)(o.Checkbox,{onChange:C}),u.t(`sheet.cf.iconSet.reverseIconOrder`)]}),(0,l.jsxs)(`div`,{className:`univer-ml-6 univer-flex univer-items-center univer-text-xs`,children:[(0,l.jsx)(o.Checkbox,{checked:!_,onChange:e=>{v(!e)}}),u.t(`sheet.cf.iconSet.onlyShowIcon`)]})]}),(0,l.jsx)(Ae,{errorMap:d,onChange:x,configList:h})]})},Me=e=>{var n;let{onChange:s,interceptorManager:c}=e,u=(0,i.useDependency)(t.LocaleService),d=((n=e.rule)==null?void 0:n.type)===r.CFRuleType.highlightCell?e.rule:void 0,f=[{label:u.t(`sheet.cf.panel.isNotBottom`),value:`isNotBottom`},{label:u.t(`sheet.cf.panel.isBottom`),value:`isBottom`},{label:u.t(`sheet.cf.panel.greaterThanAverage`),value:`greaterThanAverage`},{label:u.t(`sheet.cf.panel.lessThanAverage`),value:`lessThanAverage`}],[p,m]=(0,a.useState)(()=>{let e=f[0].value,t=d==null?void 0:d.type;if(!d)return e;switch(t){case r.CFRuleType.highlightCell:switch(d.subType){case r.CFSubRuleType.average:return[r.CFNumberOperator.greaterThan,r.CFNumberOperator.greaterThanOrEqual].includes(d.operator)?`greaterThanAverage`:[r.CFNumberOperator.lessThan,r.CFNumberOperator.lessThanOrEqual].includes(d.operator)?`lessThanAverage`:e;case r.CFSubRuleType.rank:return d.isBottom?`isBottom`:`isNotBottom`}}return e}),[h,g]=(0,a.useState)(()=>{let e=d==null?void 0:d.type;if(!d)return 10;switch(e){case r.CFRuleType.highlightCell:switch(d.subType){case r.CFSubRuleType.rank:return d.value||10}}return 10}),[_,v]=(0,a.useState)(()=>{let e=d==null?void 0:d.type;if(!d)return!1;switch(e){case r.CFRuleType.highlightCell:switch(d.subType){case r.CFSubRuleType.rank:return d.isPercent||!1}}return!1}),[y,b]=(0,a.useState)({}),x=e=>{let{type:t,isPercent:n,value:i,style:a}=e;if(t===`isNotBottom`)return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:n,isBottom:!1,value:i,style:a};if(t===`isBottom`)return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank,isPercent:n,isBottom:!0,value:i,style:a};if(t===`greaterThanAverage`)return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:r.CFNumberOperator.greaterThan,style:a};if(t===`lessThanAverage`)return{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.average,operator:r.CFNumberOperator.lessThan,style:a}};(0,a.useEffect)(()=>c.intercept(c.getInterceptPoints().submit,{handler(){return x({type:p,isPercent:_,value:h,style:y})}}),[p,_,h,y,c]);let S=e=>{s(x(e))};return(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`
|
|
108
|
+
univer-mt-4 univer-text-sm univer-text-gray-600
|
|
109
|
+
dark:!univer-text-gray-200
|
|
110
|
+
`,children:u.t(`sheet.cf.panel.styleRule`)}),(0,l.jsx)(o.Select,{className:`univer-mt-3 univer-w-full`,value:p,options:f,onChange:e=>{m(e),S({type:e,isPercent:_,value:h,style:y})}}),[`isNotBottom`,`isBottom`].includes(p)&&(0,l.jsxs)(`div`,{className:`univer-mt-3 univer-flex univer-items-center`,children:[(0,l.jsx)(o.InputNumber,{min:1,max:1e3,value:h,onChange:e=>{let t=e||0;g(t),S({type:p,isPercent:_,value:t,style:y})}}),(0,l.jsxs)(`div`,{className:`univer-ml-3 univer-flex univer-items-center univer-text-xs`,children:[(0,l.jsx)(o.Checkbox,{checked:_,onChange:e=>{v(!!e),S({type:p,isPercent:!!e,value:h,style:y})}}),u.t(`sheet.cf.valueType.percent`)]})]}),(0,l.jsx)(`div`,{className:B,children:(0,l.jsx)(z,{rule:x({type:p,isPercent:_,value:h,style:y})})}),(0,l.jsx)(ye,{style:d==null?void 0:d.style,className:`univer-mt-3`,onChange:e=>{b(e),S({type:p,isPercent:_,value:h,style:e})}})]})},Ne=(0,t.createInterceptorKey)(`beforeSubmit`),Pe=(0,t.createInterceptorKey)(`submit`),Fe=e=>e.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),Ie=e=>{var n;return(n=e.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId()},Le=e=>{var u,d,f;let p=(0,i.useDependency)(t.LocaleService),m=(0,i.useDependency)(t.ICommandService),h=(0,i.useDependency)(t.IUniverInstanceService),g=(0,i.useDependency)(r.ConditionalFormattingRuleModel),_=(0,i.useDependency)(n.SheetsSelectionsService),v=Fe(h),y=Ie(h),[b,x]=(0,a.useState)(void 0),S=(0,a.useRef)((u=(d=e.rule)==null?void 0:d.ranges)==null?[]:u),C=(0,a.useMemo)(()=>{var t;let n=(t=e.rule)==null?void 0:t.ranges;if(!(n!=null&&n.length)){var r,i;n=(r=(i=_.getCurrentSelections())==null?void 0:i.map(e=>e.range))==null?[]:r}return S.current=n,n!=null&&n.length?n.map(e=>{let t=(0,s.serializeRange)(e);return t===`NaN`?``:t}).filter(e=>!!e).join(`,`):``},[e.rule]),w=[{label:p.t(`sheet.cf.ruleType.highlightCell`),value:`1`},{label:p.t(`sheet.cf.panel.rankAndAverage`),value:`2`},{label:p.t(`sheet.cf.ruleType.dataBar`),value:`3`},{label:p.t(`sheet.cf.ruleType.colorScale`),value:`4`},{label:p.t(`sheet.cf.ruleType.formula`),value:`5`},{label:p.t(`sheet.cf.ruleType.iconSet`),value:`6`}],[T,E]=(0,a.useState)(()=>{var t;let n=(t=e.rule)==null?void 0:t.rule.type,i=w[0].value;if(!n)return i;switch(n){case r.CFRuleType.highlightCell:var a;switch((a=e.rule)==null?void 0:a.rule.subType){case r.CFSubRuleType.number:case r.CFSubRuleType.text:case r.CFSubRuleType.duplicateValues:case r.CFSubRuleType.uniqueValues:case r.CFSubRuleType.timePeriod:return`1`;case r.CFSubRuleType.average:case r.CFSubRuleType.rank:return`2`;case r.CFSubRuleType.formula:return`5`}break;case r.CFRuleType.dataBar:return`3`;case r.CFRuleType.colorScale:return`4`;case r.CFRuleType.iconSet:return`6`}return i}),D=(0,a.useRef)(void 0),O=(0,a.useMemo)(()=>new t.InterceptorManager({beforeSubmit:Ne,submit:Pe}),[]),k=(0,a.useMemo)(()=>{switch(T){case`1`:return we;case`2`:return Me;case`3`:return ge;case`4`:return me;case`5`:return be;case`6`:return je;default:return we}},[T]);(0,a.useEffect)(()=>{let t=m.onCommandExecuted(t=>{if(t.id===n.RemoveSheetMutation.id){let n=t.params;n.subUnitId===y&&n.unitId===v&&e.onCancel()}t.id===n.SetWorksheetActiveOperation.id&&e.onCancel()});return()=>t.dispose()},[]);let A=e=>{D.current=e},j=e=>{S.current=e.split(`,`).filter(e=>!!e).map(s.deserializeRangeWithSheet).map(e=>e.range)};return(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`div`,{className:`
|
|
111
|
+
univer-mt-4 univer-text-sm univer-text-gray-600
|
|
112
|
+
dark:!univer-text-gray-200
|
|
113
|
+
`,children:p.t(`sheet.cf.panel.range`)}),(0,l.jsxs)(`div`,{className:`univer-mt-4`,children:[(0,l.jsx)(c.RangeSelector,{unitId:v,subUnitId:y,initialValue:C,onChange:(e,t)=>j(t),onVerify:(e,t)=>{e?t.length<1?x(p.t(`sheet.cf.errorMessage.rangeError`)):x(void 0):x(p.t(`sheet.cf.errorMessage.rangeError`))}}),b&&(0,l.jsx)(`div`,{className:`univer-mt-1 univer-text-xs univer-text-red-500`,children:b})]}),(0,l.jsx)(`div`,{className:`
|
|
114
|
+
univer-mt-4 univer-text-sm univer-text-gray-600
|
|
115
|
+
dark:!univer-text-gray-200
|
|
116
|
+
`,children:p.t(`sheet.cf.panel.styleType`)}),(0,l.jsx)(o.Select,{className:`univer-mt-4 univer-w-full`,value:T,options:w,onChange:e=>E(e)}),(0,l.jsx)(k,{interceptorManager:O,rule:(f=e.rule)==null?void 0:f.rule,onChange:A}),(0,l.jsxs)(`div`,{className:`univer-mt-4 univer-flex univer-justify-end`,children:[(0,l.jsx)(o.Button,{onClick:()=>{e.onCancel()},children:p.t(`sheet.cf.panel.cancel`)}),(0,l.jsx)(o.Button,{className:`univer-ml-3`,variant:`primary`,onClick:()=>{if(b)return;let i=(()=>{let e=h.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet();if(!e)throw Error(`No active sheet found`);return S.current.map(t=>(0,n.setEndForRange)(t,e.getRowCount(),e.getColumnCount())).filter(e=>!(Number.isNaN(e.startRow)||Number.isNaN(e.startColumn)))})();if(O.fetchThroughInterceptors(O.getInterceptPoints().beforeSubmit)(!0,null)){let t=O.fetchThroughInterceptors(O.getInterceptPoints().submit)(null,null);if(t){let n=Fe(h),a=Ie(h);if(!n||!a)throw Error(`No active sheet found`);let o={};e.rule&&e.rule.cfId?(o={...e.rule,ranges:i,rule:t},m.executeCommand(r.SetCfCommand.id,{unitId:n,subUnitId:a,rule:o}),e.onCancel()):(o={cfId:g.createCfId(n,a),ranges:i,rule:t,stopIfTrue:!1},m.executeCommand(r.AddCfCommand.id,{unitId:n,subUnitId:a,rule:o}),e.onCancel())}}},children:p.t(`sheet.cf.panel.submit`)})]})]})};function W(e){"@babel/helpers - typeof";return W=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},W(e)}function Re(e,t){if(W(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(W(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ze(e){var t=Re(e,`string`);return W(t)==`symbol`?t:t+``}function G(e,t,n){return(t=ze(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K(e,t){return function(n,r){t(n,r,e)}}function q(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let J=class extends t.Disposable{constructor(e){super(),this._localeService=e,G(this,`_initLocal`,()=>{}),G(this,`_findReplaceIndex`,e=>{let t=/\{([^}]+)?\}/g,n=[],r=t.exec(e);for(;r;)n.push({startIndex:r.index,key:Number(r[1]),endIndex:r.index+r[0].length-1}),r=t.exec(e);return n}),this._initLocal()}tWithReactNode(e,...t){let n=this._localeService.getLocales(),r=e.split(`.`),i=n&&this._localeService.resolveKeyPath(n,r);if(typeof i==`string`){let e=[];return this._findReplaceIndex(i).forEach((n,r,a)=>{let o=a[r-1]||{startIndex:0,endIndex:-1};if(o.endIndex+1<n.startIndex){let t=i.slice(o.endIndex+1,n.startIndex);t&&e.push(t)}if(t[n.key]&&e.push(t[n.key]),r===a.length-1){let t=i.slice(n.endIndex+1);t&&e.push(t)}}),e}return[]}};J=q([K(0,(0,t.Inject)(t.LocaleService))],J);let Be=(e,t)=>{let n=e.rule;switch(n.type){case r.CFRuleType.colorScale:return t.t(`sheet.cf.ruleType.colorScale`);case r.CFRuleType.dataBar:return t.t(`sheet.cf.ruleType.dataBar`);case r.CFRuleType.iconSet:return t.t(`sheet.cf.ruleType.iconSet`);case r.CFRuleType.highlightCell:switch(n.subType){case r.CFSubRuleType.average:{let e=n.operator;return t.t(`sheet.cf.preview.describe.${e}`,t.t(`sheet.cf.subRuleType.average`))}case r.CFSubRuleType.duplicateValues:return t.t(`sheet.cf.subRuleType.duplicateValues`);case r.CFSubRuleType.uniqueValues:return t.t(`sheet.cf.subRuleType.uniqueValues`);case r.CFSubRuleType.number:{let e=n.operator;return t.t(`sheet.cf.preview.describe.${e}`,...Array.isArray(n.value)?n.value.map(e=>String(e)):[String(n.value||``)])}case r.CFSubRuleType.text:{let e=n.operator;return t.t(`sheet.cf.preview.describe.${e}`,n.value||``)}case r.CFSubRuleType.timePeriod:{let e=n.operator;return t.t(`sheet.cf.preview.describe.${e}`)}case r.CFSubRuleType.rank:return n.isPercent?n.isBottom?t.t(`sheet.cf.preview.describe.bottomNPercent`,String(n.value)):t.t(`sheet.cf.preview.describe.topNPercent`,String(n.value)):n.isBottom?t.t(`sheet.cf.preview.describe.bottomN`,String(n.value)):t.t(`sheet.cf.preview.describe.topN`,String(n.value));case r.CFSubRuleType.formula:return t.t(`sheet.cf.ruleType.formula`)}}},Ve=e=>{let{onClick:c}=e,f=(0,i.useDependency)(r.ConditionalFormattingRuleModel),p=(0,i.useDependency)(t.IUniverInstanceService),m=(0,i.useDependency)(n.SheetsSelectionsService),h=(0,i.useDependency)(t.ICommandService),g=(0,i.useDependency)(t.LocaleService),_=(0,i.useDependency)(t.Injector),v=(0,i.useDependency)(J),y=(0,i.useObservable)(()=>p.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),b=y.getUnitId(),x=y.getActiveSheet();if(!x)throw Error(`No active sheet found`);let S=x.getSheetId(),[C,w]=(0,a.useState)([]),[T,E]=(0,a.useState)(`2`),[D,O]=(0,a.useState)(0),[k,A]=(0,a.useState)(``),j=[{label:g.t(`sheet.cf.panel.workSheet`),value:`2`},{label:g.t(`sheet.cf.panel.selectedRange`),value:`1`}],N=()=>{let e=f.getSubunitRules(b,S);if(!e||!e.length)return[];if(T===`1`){let n=m.getCurrentLastSelection();if(!n)return[];let r=n.range;return e.filter(e=>e.ranges.some(e=>t.Rectangle.intersects(e,r)))}else if(T===`2`)return[...e];return[]},[F,ee]=(0,a.useState)(N);(0,u.useHighlightRange)(C),(0,a.useEffect)(()=>{let e=h.onCommandExecuted(e=>{e.id===n.SetWorksheetActiveOperation.id&&O(Math.random())});return()=>e.dispose()}),(0,a.useEffect)(()=>{ee(N)},[T,D,b,S]),(0,a.useEffect)(()=>{if(T===`2`)return;let e=new d.Observable(e=>{let i=[n.SetSelectionsOperation.id,r.AddConditionalRuleMutation.id,r.SetConditionalRuleMutation.id,r.DeleteConditionalRuleMutation.id,r.MoveConditionalRuleMutation.id],a=h.onCommandExecuted(n=>{let{id:r,params:a}=n,o=p.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId();i.includes(r)&&a.unitId===o&&e.next(null)});return()=>a.dispose()}).pipe((0,d.debounceTime)(16)).subscribe(()=>{ee(N)});return()=>{e.unsubscribe()}},[p,T,b,S]),(0,a.useEffect)(()=>{let e=f.$ruleChange.subscribe(()=>{O(Math.random())});return()=>e.unsubscribe()},[f]);let te=e=>{var n;let i=p.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),a=(n=p.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:n.getSheetId();if(!i||!a)throw Error(`No active sheet found`);h.executeCommand(r.DeleteCfCommand.id,{unitId:i,subUnitId:a,cfId:e.cfId})},ne=(e,t)=>{var n;let r=I[t.y];A((n=r==null?void 0:r.cfId)==null?``:n)},re=(e,n,i)=>{var a,o,s;A(``);let c=p.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),l=(a=p.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:a.getSheetId();if(!c||!l)throw Error(`No active sheet found`);let u=e=>{let t=I.length;return Math.min(t-1,Math.max(0,e))},d=(o=I[u(n.y)])==null?void 0:o.cfId,f=(s=I[u(i.y)])==null?void 0:s.cfId;!d||!f||d!==f&&h.executeCommand(r.MoveCfCommand.id,{unitId:c,subUnitId:l,start:{id:d,type:`self`},end:{id:f,type:i.y>n.y?`after`:`before`}})},ae=()=>{e.onCreate()},oe=()=>{T===`2`?h.executeCommand(r.ClearWorksheetCfCommand.id):T===`1`&&F.map(e=>({unitId:b,subUnitId:S,cfId:e.cfId})).forEach(e=>{h.executeCommand(r.DeleteCfCommand.id,e)})},I=(0,a.useMemo)(()=>{let e=p.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),r=e.getActiveSheet();return F.filter(t=>{let i=t.ranges;return(0,n.checkRangesEditablePermission)(_,e.getUnitId(),r.getSheetId(),i)})},[F]),se=(0,a.useMemo)(()=>{let e=p.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET),r=e.getActiveSheet();return F.every(t=>{let i=t.ranges;return(0,n.checkRangesEditablePermission)(_,e.getUnitId(),r.getSheetId(),i)})},[F]);return(0,l.jsxs)(`div`,{children:[(0,l.jsxs)(`div`,{className:`
|
|
11
117
|
univer-mb-2 univer-flex univer-items-center univer-justify-between univer-gap-2 univer-text-sm
|
|
12
|
-
`,children:[c.jsx("div",{className:"univer-flex univer-items-center univer-gap-2",children:d.tWithReactNode("sheet.cf.panel.managerRuleSelect",c.jsx(V.Select,{className:"univer-w-36",options:g,value:m,onChange:D=>{N(D)}})).map((D,F)=>c.jsx("span",{children:D},F))}),c.jsxs("div",{className:"univer-flex univer-justify-end univer-space-x-2",children:[c.jsx(V.Tooltip,{title:i.t("sheet.cf.panel.createRule"),placement:"bottom",children:c.jsx("a",{className:"univer-size-5 univer-cursor-pointer",onClick:j,children:c.jsx(ir,{})})}),_.length&&$?c.jsx(V.Tooltip,{title:i.t("sheet.cf.panel.clear"),placement:"bottom",children:c.jsx("a",{className:"univer-size-5 univer-cursor-pointer",onClick:y,children:c.jsx(Se,{className:"univer-text-red-500"})})}):c.jsx("div",{children:c.jsx(Se,{className:"univer-text-gray-300"})})]})]}),c.jsx("div",{children:c.jsx(V.DraggableList,{className:"univer-w-full",draggableHandle:".draggableHandle",list:x,onListChange:()=>{},idKey:"cfId",rowHeight:60,margin:[0,10],onDragStop:L,onDragStart:U,itemRender:D=>c.jsxs("div",{className:V.clsx("univer-group univer-relative univer-flex univer-items-center univer-justify-between univer-rounded univer-py-2 univer-pl-5 univer-pr-8 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",{"univer-bg-gray-100 dark:!univer-bg-gray-700":M===D.cfId}),onMouseMove:()=>{D.ranges!==b&&S(D.ranges)},onMouseLeave:()=>S([]),onClick:()=>{e(D)},children:[c.jsx("div",{className:V.clsx("univer-absolute univer-left-0 univer-hidden univer-size-5 univer-cursor-grab univer-items-center univer-justify-center univer-rounded group-hover:univer-flex","draggableHandle"),onClick:F=>F.stopPropagation(),children:c.jsx(cr,{})}),c.jsxs("div",{className:"univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden",children:[c.jsx("div",{className:"univer-text-sm univer-text-gray-900 dark:!univer-text-white",children:tt(D,i)}),c.jsx("div",{className:"univer-text-xs univer-text-gray-400",children:D.ranges.map(F=>je.serializeRange(F)).join(",")})]}),c.jsx("div",{children:c.jsx(te,{rule:D.rule})}),c.jsx("div",{className:V.clsx("univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-red-500 group-hover:univer-flex hover:univer-bg-gray-200",{"univer-flex univer-items-center univer-justify-center":M===D.cfId}),onClick:F=>{F.stopPropagation(),k(D),S([])},children:c.jsx(Se,{})})]})})})]})},lt=a=>{const[e,t]=C.useState(a.rule),[n,l]=C.useState(!!a.rule),u=()=>{l(!0)},i=()=>{l(!1),t(void 0)},v=d=>{t(d),l(!0)};return c.jsx("div",{className:"univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4",children:n?c.jsx(Jr,{onCancel:i,rule:e}):c.jsx(nt,{onClick:v,onCreate:u})})};var at=Object.getOwnPropertyDescriptor,ut=(a,e,t,n)=>{for(var l=n>1?void 0:n?at(e,t):e,u=a.length-1,i;u>=0;u--)(i=a[u])&&(l=i(l)||l);return l},de=(a,e)=>(t,n)=>e(t,n,a);const xe="sheet.conditional.formatting.panel";let ve=class extends s.Disposable{constructor(e,t,n,l,u){super();X(this,"_sidebarDisposable",null);this._univerInstanceService=e,this._injector=t,this._componentManager=n,this._sidebarService=l,this._localeService=u,this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_SHEET).subscribe(i=>{var v;i||(v=this._sidebarDisposable)==null||v.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(i=>{i.id===xe&&(i.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){const t={id:xe,header:{title:this._localeService.t("sheet.cf.title")},children:{label:xe,rule:e,key:s.generateRandomId(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(t)}_initPanel(){this.disposeWithMe(this._componentManager.register(xe,lt))}};ve=ut([de(0,s.IUniverInstanceService),de(1,s.Inject(s.Injector)),de(2,s.Inject(A.ComponentManager)),de(3,s.Inject(A.ISidebarService)),de(4,s.Inject(s.LocaleService))],ve);var G=(a=>(a[a.createRule=1]="createRule",a[a.viewRule=2]="viewRule",a[a.highlightCell=3]="highlightCell",a[a.rank=4]="rank",a[a.formula=5]="formula",a[a.colorScale=6]="colorScale",a[a.dataBar=7]="dataBar",a[a.icon=8]="icon",a[a.clearRangeRules=9]="clearRangeRules",a[a.clearWorkSheetRules=10]="clearWorkSheetRules",a))(G||{});const pe={id:"sheet.operation.open.conditional.formatting.panel",type:s.CommandType.OPERATION,handler:(a,e)=>{var v;const t=a.get(ve),n=a.get(O.SheetsSelectionsService),l=a.get(s.ICommandService),u=((v=n.getCurrentSelections())==null?void 0:v.map(d=>d.range))||[];switch(e.value){case 3:{t.openPanel({...r.createDefaultRule(),ranges:u});break}case 4:{const d={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank}};t.openPanel(d);break}case 5:{const d={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.formula,value:"="}};t.openPanel(d);break}case 6:{const d={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.colorScale,config:[]}};t.openPanel(d);break}case 7:{const d={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.dataBar,isShowValue:!0}};t.openPanel(d);break}case 8:{const d={...r.createDefaultRule,ranges:u,rule:{type:r.CFRuleType.iconSet,config:[],isShowValue:!0}};t.openPanel(d);break}case 2:{t.openPanel();break}case 1:{t.openPanel({...r.createDefaultRule(),ranges:u});break}case 9:{l.executeCommand(r.ClearRangeCfCommand.id,{ranges:u});break}case 10:{l.executeCommand(r.ClearWorksheetCfCommand.id);break}}return!0}};var it=Object.getOwnPropertyDescriptor,st=(a,e,t,n)=>{for(var l=n>1?void 0:n?it(e,t):e,u=a.length-1,i;u>=0;u--)(i=a[u])&&(l=i(l)||l);return l},fe=(a,e)=>(t,n)=>e(t,n,a);P.ConditionalFormattingClearController=class extends s.Disposable{constructor(e,t,n,l,u){super(),this._injector=e,this._univerInstanceService=t,this._sheetInterceptorService=n,this._selectionManagerService=l,this._conditionalFormattingRuleModel=u,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{var u;const t=[],n=[],l={redos:t,undos:n};if([O.ClearSelectionFormatCommand.id,O.ClearSelectionAllCommand.id].includes(e.id)){const i=(u=this._selectionManagerService.getCurrentSelections())==null?void 0:u.map(S=>S.range);if(!i)return l;const v=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),d=v.getActiveSheet();if(!d)return l;const f=v.getUnitId(),o=d.getSheetId(),p=this._conditionalFormattingRuleModel.getSubunitRules(f,o);if(!p||!p.length)return l;const{redos:h,undos:b}=Ir(this._injector,p,i,f,o);t.push(...h),n.push(...b)}return l}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:t,ranges:n})=>{const l=[],u=[],i={redos:l,undos:u};if(!n||!n.length)return i;const v=this._conditionalFormattingRuleModel.getSubunitRules(e,t);if(!v||!v.length)return i;const{redos:d,undos:f}=Ir(this._injector,v,n,e,t);return l.push(...d),u.push(...f),i}}))}},P.ConditionalFormattingClearController=st([fe(0,s.Inject(s.Injector)),fe(1,s.Inject(s.IUniverInstanceService)),fe(2,s.Inject(O.SheetInterceptorService)),fe(3,s.Inject(O.SheetsSelectionsService)),fe(4,s.Inject(r.ConditionalFormattingRuleModel))],P.ConditionalFormattingClearController);function Ir(a,e,t,n,l){const u=[],i=[];return e.filter(v=>t.some(d=>v.ranges.some(f=>s.Rectangle.getIntersects(f,d)))).forEach(v=>{const f=new O.RangeMergeUtil().add(...v.ranges).subtract(...t).merge();if(f.length){const o={id:r.SetConditionalRuleMutation.id,params:{unitId:n,subUnitId:l,rule:{...v,ranges:f}}},p=r.setConditionalRuleMutationUndoFactory(a,o.params);u.push(o),i.push(...p)}else{const o={id:r.DeleteConditionalRuleMutation.id,params:{unitId:n,subUnitId:l,cfId:v.cfId}},p=r.DeleteConditionalRuleMutationUndoFactory(a,o.params);u.push(o),i.push(...p)}}),{redos:u,undos:i}}const Ne={name:"@univerjs/sheets-conditional-formatting-ui",version:"0.17.0"},Sr="sheets-conditional-formatting-ui.config",Ee={};var ct=Object.getOwnPropertyDescriptor,ot=(a,e,t,n)=>{for(var l=n>1?void 0:n?ct(e,t):e,u=a.length-1,i;u>=0;u--)(i=a[u])&&(l=i(l)||l);return l},Xe=(a,e)=>(t,n)=>e(t,n,a);let he=class extends s.Disposable{constructor(e,t,n){super();X(this,"_disposableMap",new Map);this._conditionalFormattingRuleModel=e,this._formulaRefRangeService=t,this._injector=n,this._initRefRange()}_getIdWithUnitId(e,t,n){return`${e}_${t}_${n}`}_getRuleFormulas(e){const t=[],n=e.rule;switch(n.type){case r.CFRuleType.highlightCell:n.subType===r.CFSubRuleType.formula&&t.push(n.value);break;case r.CFRuleType.dataBar:{const l=n;l.config.min.type===r.CFValueType.formula&&t.push(l.config.min.value),l.config.max.type===r.CFValueType.formula&&t.push(l.config.max.value);break}case r.CFRuleType.colorScale:{n.config.forEach(u=>{u.value.type===r.CFValueType.formula&&t.push(u.value.value)});break}case r.CFRuleType.iconSet:{n.config.forEach(u=>{u.value.type===r.CFValueType.formula&&t.push(u.value.value)});break}}return t}_updateRuleFormulas(e,t){const n=s.Tools.deepClone(e),l=n.rule;let u=0;switch(l.type){case r.CFRuleType.highlightCell:l.subType===r.CFSubRuleType.formula&&(l.value=t[u++]);break;case r.CFRuleType.dataBar:{const i=l;i.config.min.type===r.CFValueType.formula&&(i.config.min.value=t[u++]),i.config.max.type===r.CFValueType.formula&&(i.config.max.value=t[u++]);break}case r.CFRuleType.colorScale:{l.config.forEach(v=>{v.value.type===r.CFValueType.formula&&(v.value.value=t[u++])});break}case r.CFRuleType.iconSet:{l.config.forEach(v=>{v.value.type===r.CFValueType.formula&&(v.value.value=t[u++])});break}}return n}register(e,t,n){const l=n.ranges,u=this._getRuleFormulas(n),i=this._formulaRefRangeService.registerRangeFormula(e,t,l,u,d=>{if(d.length===0)return{undos:[{id:r.AddConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,rule:n}}],redos:[{id:r.DeleteConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,cfId:n.cfId}}]};const f=[],o=[],p=d[0],h=this._updateRuleFormulas(n,p.formulas);h.ranges=p.ranges,f.push({id:r.SetConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,cfId:n.cfId,rule:h}}),o.push(...r.setConditionalRuleMutationUndoFactory(this._injector,{unitId:e,subUnitId:t,cfId:n.cfId,rule:h}));for(let b=1;b<d.length;b++){const S=d[b],m=r.createCfId(),N=this._updateRuleFormulas(n,S.formulas);N.cfId=m,N.ranges=S.ranges,f.push({id:r.AddConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,rule:N}}),o.push(r.AddConditionalRuleMutationUndoFactory(this._injector,{unitId:e,subUnitId:t,rule:N}))}return{undos:o,redos:f}}),v=this._getIdWithUnitId(e,t,n.cfId);this._disposableMap.set(v,i)}_initRefRange(){const e=this._conditionalFormattingRuleModel.getAll();for(const[t,n]of e)for(const[l,u]of n)for(const i of u)this.register(t,l,i);this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(t=>{const{unitId:n,subUnitId:l,rule:u}=t;switch(t.type){case"add":{this.register(n,l,u);break}case"delete":{const i=this._getIdWithUnitId(n,l,u.cfId),v=this._disposableMap.get(i);v&&(v.dispose(),this._disposableMap.delete(i));break}case"set":{const i=this._getIdWithUnitId(n,l,u.cfId),v=this._disposableMap.get(i);v&&(v.dispose(),this._disposableMap.delete(i)),this.register(n,l,u);break}}})),this.disposeWithMe(s.toDisposable(()=>{this._disposableMap.forEach(t=>{t.dispose()}),this._disposableMap.clear()}))}};he=ot([Xe(0,s.Inject(r.ConditionalFormattingRuleModel)),Xe(1,s.Inject(nr.FormulaRefRangeService)),Xe(2,s.Inject(s.Injector))],he);var dt=Object.getOwnPropertyDescriptor,vt=(a,e,t,n)=>{for(var l=n>1?void 0:n?dt(e,t):e,u=a.length-1,i;u>=0;u--)(i=a[u])&&(l=i(l)||l);return l},ge=(a,e)=>(t,n)=>e(t,n,a);let ye=class extends s.Disposable{constructor(e,t,n,l,u){super();X(this,"_copyInfo");this._sheetClipboardService=e,this._conditionalFormattingRuleModel=t,this._injector=n,this._conditionalFormattingViewModel=l,this._univerInstanceService=u,this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(e,t,n)=>this._collectConditionalRule(e,t,n),onPasteCells:(e,t,n,l)=>{const{copyType:u=q.COPY_TYPE.COPY,pasteType:i}=l,{range:v}=e||{},{range:d}=t;return this._generateConditionalFormattingMutations(d,{copyType:u,pasteType:i,copyRange:v})}}))}_collectConditionalRule(e,t,n){const l=new s.ObjectMatrix,u={};this._copyInfo={matrix:l,info:{unitId:e,subUnitId:t,cfMap:u}};const i=this._injector.invoke(o=>O.rangeToDiscreteRange(n,o,e,t));if(!i)return;const{rows:v,cols:d}=i,f=new Set;v.forEach((o,p)=>{d.forEach((h,b)=>{const S=this._conditionalFormattingViewModel.getCellCfs(e,t,o,h);S&&(S.forEach(m=>f.add(m.cfId)),l.setValue(p,b,S.map(m=>m.cfId)))})}),f.forEach(o=>{const p=this._conditionalFormattingRuleModel.getRule(e,t,o);p&&(u[o]=p.rule)})}_generateConditionalFormattingMutations(e,t){const n=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),l=n.getActiveSheet(),u=n.getUnitId();if(!l)return{redos:[],undos:[]};const i=l.getSheetId();if(t.copyType===q.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!t.copyRange)return{redos:[],undos:[]};if(![q.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT,q.PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE,q.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_BESIDES_BORDER].includes(t.pasteType))return{redos:[],undos:[]};const{ranges:[d,f],mapFunc:o}=q.virtualizeDiscreteRanges([t.copyRange,e]),p=q.getRepeatRange(d,f,!0),h={};s.Range.foreach(f,(g,T)=>{const{row:_,col:I}=o(g,T),k=this._conditionalFormattingViewModel.getCellCfs(u,i,_,I);k&&k.forEach(U=>{if(!h[U.cfId]){const L=new s.ObjectMatrix;h[U.cfId]=L;const j=this._conditionalFormattingRuleModel.getRule(u,i,U.cfId);j==null||j.ranges.forEach(y=>{s.Range.foreach(y,(x,$)=>{L.setValue(x,$,1)})})}h[U.cfId].realDeleteValue(_,I)})});const{matrix:b,info:S}=this._copyInfo,m=[];let N=this._conditionalFormattingRuleModel.createCfId(u,i);const w={},E=g=>{if(w[g])return w[g];const T=S==null?void 0:S.cfMap[g],_=[...this._conditionalFormattingRuleModel.getSubunitRules(u,i)||[],...m].find(I=>s.Tools.diffValue(I.rule,T));if(_)return w[g]=_,_;{const I={rule:T,cfId:N,ranges:[],stopIfTrue:!1};return w[g]=I,m.push(I),N=`${Number(N)+1}`,I}};p.forEach(g=>{b&&b.forValue((T,_,I)=>{const k=s.Rectangle.getPositionRange({startRow:T,endRow:T,startColumn:_,endColumn:_},g.startRange),{row:U,col:L}=o(k.startRow,k.startColumn);I.forEach(j=>{if(!h[j]){const y=E(j),x=new s.ObjectMatrix;h[j]=x,y.ranges.forEach($=>{s.Range.foreach($,(D,F)=>{x.setValue(D,F,1)})})}h[j].setValue(U,L,1)})})});const M=[],R=[];for(const g in h){const T=h[g],_=O.findAllRectangle(O.createTopMatrixFromMatrix(T));if(!_.length){const I={unitId:u,subUnitId:i,cfId:g};M.push({id:r.DeleteConditionalRuleMutation.id,params:I}),R.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,I))}if(m.some(I=>I.cfId===g)){const I=E(g),k={unitId:u,subUnitId:i,rule:{...I,ranges:_}};M.push({id:r.AddConditionalRuleMutation.id,params:k}),R.push(r.AddConditionalRuleMutationUndoFactory(this._injector,k))}else{const I=this._conditionalFormattingRuleModel.getRule(u,i,g);if(!I)continue;const k={unitId:u,subUnitId:i,rule:{...I,ranges:_}};M.push({id:r.SetConditionalRuleMutation.id,params:k}),R.push(...r.setConditionalRuleMutationUndoFactory(this._injector,k))}}return{redos:M,undos:R}}};ye=vt([ge(0,s.Inject(q.ISheetClipboardService)),ge(1,s.Inject(r.ConditionalFormattingRuleModel)),ge(2,s.Inject(s.Injector)),ge(3,s.Inject(r.ConditionalFormattingViewModel)),ge(4,s.Inject(s.IUniverInstanceService))],ye);var pt=Object.getOwnPropertyDescriptor,ft=(a,e,t,n)=>{for(var l=n>1?void 0:n?pt(e,t):e,u=a.length-1,i;u>=0;u--)(i=a[u])&&(l=i(l)||l);return l},Je=(a,e)=>(t,n)=>e(t,n,a);let Ce=class extends s.Disposable{constructor(a,e,t){super(),this._localeService=a,this._commandService=e,this._sheetPermissionCheckController=t,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(a=>{if(a.id===r.AddCfCommand.id){const{unitId:e,subUnitId:t,rule:{ranges:n}}=a.params;this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[O.WorkbookEditablePermission],rangeTypes:[O.RangeProtectionPermissionEditPoint],worksheetTypes:[O.WorksheetEditPermission,O.WorksheetSetCellStylePermission]},n,e,t)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr"))}}))}};Ce=ft([Je(0,s.Inject(s.LocaleService)),Je(1,s.ICommandService),Je(2,s.Inject(O.SheetPermissionCheckController))],Ce);var ht=Object.getOwnPropertyDescriptor,gt=(a,e,t,n)=>{for(var l=n>1?void 0:n?ht(e,t):e,u=a.length-1,i;u>=0;u--)(i=a[u])&&(l=i(l)||l);return l},ae=(a,e)=>(t,n)=>e(t,n,a);let me=class extends s.Disposable{constructor(e,t,n,l,u,i){super();X(this,"_ruleChangeCacheMap",new Map);this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=l,this._conditionalFormattingViewModel=u,this._conditionalFormattingRuleModel=i,this._initViewModelInterceptor(),this._initSkeleton(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}_markDirtySkeleton(){var t,n,l;const e=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getUnitId();(t=this._renderManagerService.getRenderById(e))==null||t.with(q.SheetSkeletonManagerService).reCalculate(),(l=(n=this._renderManagerService.getRenderById(e))==null?void 0:n.mainComponent)==null||l.makeDirty()}_initSkeleton(){this.disposeWithMe(K.merge(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe(se.bufferTime(16),se.filter(e=>!!e.length),se.filter(e=>{const t=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!t)return!1;const n=t.getActiveSheet();return n?e.filter(l=>l.unitId===t.getUnitId()&&l.subUnitId===n.getSheetId()).length>0:!1})).subscribe(()=>this._markDirtySkeleton()))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(O.INTERCEPTOR_POINT.CELL_CONTENT,{effect:s.InterceptorEffectEnum.Style,handler:(e,t,n)=>{const l=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(!l)return n(e);const u=t.workbook.getStyles(),i=(typeof(e==null?void 0:e.s)=="string"?u.get(e==null?void 0:e.s):e==null?void 0:e.s)||{},v=e===t.rawData?{...t.rawData}:e;if(l.style){const d={...i,...l.style};Object.assign(v,{s:d})}return v.fontRenderExtension||(v.fontRenderExtension={},l.isShowValue!==void 0&&(v.fontRenderExtension.isSkip=!l.isShowValue)),l.dataBar&&(v.dataBar=l.dataBar),l.iconSet&&(v.iconSet=l.iconSet,v.fontRenderExtension.leftOffset=r.DEFAULT_PADDING+r.DEFAULT_WIDTH),n(v)},priority:10}))}};me=gt([ae(0,s.Inject(O.SheetInterceptorService)),ae(1,s.Inject(r.ConditionalFormattingService)),ae(2,s.Inject(s.IUniverInstanceService)),ae(3,s.Inject(lr.IRenderManagerService)),ae(4,s.Inject(r.ConditionalFormattingViewModel)),ae(5,s.Inject(r.ConditionalFormattingRuleModel))],me);var yt=Object.defineProperty,Ct=Object.getOwnPropertyDescriptor,mt=(a,e,t)=>e in a?yt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,bt=(a,e,t,n)=>{for(var l=n>1?void 0:n?Ct(e,t):e,u=a.length-1,i;u>=0;u--)(i=a[u])&&(l=i(l)||l);return l},Qe=(a,e)=>(t,n)=>e(t,n,a),Re=(a,e,t)=>mt(a,typeof e!="symbol"?e+"":e,t);P.UniverSheetsConditionalFormattingMobileUIPlugin=class extends s.Plugin{constructor(e=Ee,t,n,l){super(),this._config=e,this._injector=t,this._commandService=n,this._configService=l;const{menu:u,...i}=s.merge({},Ee,this._config);u&&this._configService.setConfig("menu",u,{merge:!0}),this._configService.setConfig(Sr,i),this._initCommand(),this._injector.add([me]),this._injector.add([ye]),this._injector.add([Ce]),this._injector.add([le]),this._injector.add([he])}_initCommand(){[Ae,Fe,$e,Be,He,We,qe,Ge,Ze,pe].forEach(e=>{this._commandService.registerCommand(e)})}},Re(P.UniverSheetsConditionalFormattingMobileUIPlugin,"pluginName",`${r.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`),Re(P.UniverSheetsConditionalFormattingMobileUIPlugin,"packageName",Ne.name),Re(P.UniverSheetsConditionalFormattingMobileUIPlugin,"version",Ne.version),Re(P.UniverSheetsConditionalFormattingMobileUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),P.UniverSheetsConditionalFormattingMobileUIPlugin=bt([s.DependentOn(r.UniverSheetsConditionalFormattingPlugin),Qe(1,s.Inject(s.Injector)),Qe(2,s.Inject(s.ICommandService)),Qe(3,s.IConfigService)],P.UniverSheetsConditionalFormattingMobileUIPlugin);var It=Object.getOwnPropertyDescriptor,St=(a,e,t,n)=>{for(var l=n>1?void 0:n?It(e,t):e,u=a.length-1,i;u>=0;u--)(i=a[u])&&(l=i(l)||l);return l},be=(a,e)=>(t,n)=>e(t,n,a);let Me=class extends s.Disposable{constructor(a,e,t,n,l){super(),this._injector=a,this._univerInstanceService=e,this._autoFillService=t,this._conditionalFormattingRuleModel=n,this._conditionalFormattingViewModel=l,this._initAutoFill()}_initAutoFill(){const a=()=>({redos:[],undos:[]}),e=(l,u,i,v,d)=>{var b;const f=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getUnitId(),o=(b=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:b.getSheetId();if(!f||!o)return;const p={startRow:l.row,startColumn:l.col,endColumn:l.col,endRow:l.row},h={startRow:u.row,startColumn:u.col,endColumn:u.col,endRow:u.row};s.Range.foreach(i,(S,m)=>{const N=s.Rectangle.getPositionRange({startRow:S,startColumn:m,endColumn:m,endRow:S},p),w=s.Rectangle.getPositionRange({startRow:S,startColumn:m,endColumn:m,endRow:S},h),{row:E,col:M}=d(N.startRow,N.startColumn),R=this._conditionalFormattingViewModel.getCellCfs(f,o,E,M),{row:g,col:T}=d(w.startRow,w.startColumn),_=this._conditionalFormattingViewModel.getCellCfs(f,o,g,T);_&&_.forEach(I=>{let k=v.get(I.cfId);if(!v.get(I.cfId)){const U=this._conditionalFormattingRuleModel.getRule(f,o,I.cfId);if(!U)return;k=new s.ObjectMatrix,U.ranges.forEach(L=>{s.Range.foreach(L,(j,y)=>{k.setValue(j,y,1)})}),v.set(I.cfId,k)}k.realDeleteValue(g,T)}),R&&R.forEach(I=>{let k=v.get(I.cfId);if(!v.get(I.cfId)){const U=this._conditionalFormattingRuleModel.getRule(f,o,I.cfId);if(!U)return;k=new s.ObjectMatrix,U.ranges.forEach(L=>{s.Range.foreach(L,(j,y)=>{k.setValue(j,y,1)})}),v.set(I.cfId,k)}k.setValue(g,T,1)})})},t=(l,u)=>{var w,E,M;const i=(w=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:w.getUnitId(),v=(M=(E=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:E.getActiveSheet())==null?void 0:M.getSheetId(),d=new Map,f=[],o=[];if(!i||!v)return a();const p=q.virtualizeDiscreteRanges([l,u]),[h,b]=p.ranges,{mapFunc:S}=p,m={row:h.startRow,col:h.startColumn};return O.AutoFillTools.getAutoFillRepeatRange(h,b).forEach(R=>{e(m,R.repeatStartCell,R.relativeRange,d,S)}),d.forEach((R,g)=>{const T=this._conditionalFormattingRuleModel.getRule(i,v,g);if(!T)return;const _=O.findAllRectangle(O.createTopMatrixFromMatrix(R));if(_.length){const I={unitId:i,subUnitId:v,rule:{...T,ranges:_}};f.push({id:r.SetConditionalRuleMutation.id,params:I}),o.push(...r.setConditionalRuleMutationUndoFactory(this._injector,I))}else{const I={unitId:i,subUnitId:v,cfId:T.cfId};f.push({id:r.DeleteConditionalRuleMutation.id,params:I}),o.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,I))}}),{undos:o,redos:f}},n={id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(l,u,i)=>{if(i===O.AUTO_FILL_APPLY_TYPE.COPY||i===O.AUTO_FILL_APPLY_TYPE.ONLY_FORMAT||i===O.AUTO_FILL_APPLY_TYPE.SERIES){const{source:v,target:d}=l;return t(v,d)}return a()}};this.disposeWithMe(this._autoFillService.addHook(n))}};Me=St([be(0,s.Inject(s.Injector)),be(1,s.Inject(s.IUniverInstanceService)),be(2,s.Inject(O.IAutoFillService)),be(3,s.Inject(r.ConditionalFormattingRuleModel)),be(4,s.Inject(r.ConditionalFormattingViewModel))],Me);var Tt=Object.getOwnPropertyDescriptor,_t=(a,e,t,n)=>{for(var l=n>1?void 0:n?Tt(e,t):e,u=a.length-1,i;u>=0;u--)(i=a[u])&&(l=i(l)||l);return l},Tr=(a,e)=>(t,n)=>e(t,n,a);let Ve=class extends s.Disposable{constructor(a,e){super(),this._sheetInterceptorService=a,this._conditionalFormattingService=e,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe(s.toDisposable(this._sheetInterceptorService.writeCellInterceptor.intercept(O.AFTER_CELL_EDIT,{handler:(a,e,t)=>{var i,v,d;a||t(a);const n=this._conditionalFormattingService.composeStyle(e.unitId,e.subUnitId,e.row,e.col),l=(i=n==null?void 0:n.style)!=null?i:{},u=Object.keys(l);if(a!=null&&a.p)return(d=(v=a.p.body)==null?void 0:v.textRuns)==null||d.forEach(f=>{f.ts&&u.forEach(o=>{var p;(p=f.ts)==null||delete p[o]})}),t(a);{const f={...(typeof(a==null?void 0:a.s)=="string"?e.workbook.getStyles().get(a.s):a==null?void 0:a.s)||{}};u.forEach(p=>{delete f[p]});const o={...a,s:{...f}};return t(o)}}})))}};Ve=_t([Tr(0,s.Inject(O.SheetInterceptorService)),Tr(1,s.Inject(r.ConditionalFormattingService))],Ve);var wt=Object.getOwnPropertyDescriptor,xt=(a,e,t,n)=>{for(var l=n>1?void 0:n?wt(e,t):e,u=a.length-1,i;u>=0;u--)(i=a[u])&&(l=i(l)||l);return l},ue=(a,e)=>(t,n)=>e(t,n,a);const Nt=(a,e)=>{const t=o=>o.endRow-o.startRow+1,n=o=>o.endColumn-o.startColumn+1,l=t(e)%t(a),u=n(e)%n(a),i=Math.floor(t(e)/t(a)),v=Math.floor(n(e)/n(a)),d=[],f={startRow:0,endRow:t(a)-1,startColumn:0,endColumn:n(a)-1};if(t(e)===1&&n(e)===1){const o={startRow:e.startRow,endRow:e.startRow,startColumn:e.startColumn,endColumn:e.startColumn};return d.push({repeatRelativeRange:f,startRange:o}),d}for(let o=0;o<i+(l?.1:0);o++)for(let p=0;p<v+(u?.1:0);p++){const h=t(a)*o,b=n(a)*p,S={startRow:h+e.startRow,endRow:h+e.startRow,startColumn:b+e.startColumn,endColumn:b+e.startColumn};let m=f;o===i&&l&&(m={...m},m.endRow=m.endRow-(t(a)-l)),p===v&&u&&(m={...m},m.endColumn=m.endColumn-(n(a)-u)),d.push({repeatRelativeRange:m,startRange:S})}return d};let Oe=class extends s.Disposable{constructor(e,t,n,l,u,i){super();X(this,"_painterConfig",null);this._injector=e,this._univerInstanceService=t,this._formatPainterService=n,this._sheetsSelectionsService=l,this._conditionalFormattingRuleModel=u,this._conditionalFormattingViewModel=i,this._initFormattingPainter()}_initFormattingPainter(){const e=()=>({redos:[],undos:[]}),t=(u,i,v,d,f)=>{const{unitId:o,subUnitId:p}=this._painterConfig,{targetUnitId:h,targetSubUnitId:b}=f,S={startRow:u.row,startColumn:u.col,endColumn:u.col,endRow:u.row},m={startRow:i.row,startColumn:i.col,endColumn:i.col,endRow:i.row};s.Range.foreach(v,(N,w)=>{const E=s.Rectangle.getPositionRange({startRow:N,startColumn:w,endColumn:w,endRow:N},S),M=s.Rectangle.getPositionRange({startRow:N,startColumn:w,endColumn:w,endRow:N},m),R=this._conditionalFormattingViewModel.getCellCfs(o,p,E.startRow,E.startColumn),g=this._conditionalFormattingViewModel.getCellCfs(h,b,M.startRow,M.startColumn);g&&g.forEach(T=>{let _=d.get(T.cfId);if(!d.get(T.cfId)){const I=this._conditionalFormattingRuleModel.getRule(h,b,T.cfId);if(!I)return;_=new s.ObjectMatrix,I.ranges.forEach(k=>{s.Range.foreach(k,(U,L)=>{_.setValue(U,L,1)})}),d.set(T.cfId,_)}_.realDeleteValue(M.startRow,M.startColumn)}),R&&R.forEach(T=>{const _=d.get(T.cfId);_&&_.setValue(M.startRow,M.startColumn,1)})})},n=(u,i,v)=>{var E;const{range:d,unitId:f,subUnitId:o}=this._painterConfig,p=u!==f||o!==i,h=new Map,b=[],S=[];if(!u||!i||!f||!o)return e();const m=(E=this._conditionalFormattingRuleModel.getSubunitRules(f,o))!=null?E:[];m==null||m.forEach(M=>{const{ranges:R,cfId:g}=M;if(R.some(T=>s.Rectangle.intersects(d,T))){const T=new s.ObjectMatrix;p||R.forEach(_=>{s.Range.foreach(_,(I,k)=>{T.setValue(I,k,1)})}),h.set(g,T)}});const N={row:d.startRow,col:d.startColumn};return Nt(d,v).forEach(M=>{t(N,{row:M.startRange.startRow,col:M.startRange.startColumn},M.repeatRelativeRange,h,{targetUnitId:u,targetSubUnitId:i})}),h.forEach((M,R)=>{if(p){const g=this._conditionalFormattingRuleModel.getRule(u,i,R),T=O.findAllRectangle(O.createTopMatrixFromMatrix(M));if(g)if(T.length){const _={unitId:u,subUnitId:i,rule:{...g,ranges:T}};b.push({id:r.SetConditionalRuleMutation.id,params:_}),S.push(...r.setConditionalRuleMutationUndoFactory(this._injector,_))}else{const _={unitId:u,subUnitId:i,cfId:g.cfId};b.push({id:r.DeleteConditionalRuleMutation.id,params:_}),S.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,_))}else if(T.length){const _=this._conditionalFormattingRuleModel.getRule(f,o,R);if(_){const I={unitId:u,subUnitId:i,rule:{...s.Tools.deepClone(_),cfId:this._conditionalFormattingRuleModel.createCfId(u,i),ranges:T}};b.push({id:r.AddConditionalRuleMutation.id,params:I}),S.push(r.AddConditionalRuleMutationUndoFactory(this._injector,I))}}}else{const g=this._conditionalFormattingRuleModel.getRule(f,o,R);if(!g)return;const T=O.findAllRectangle(O.createTopMatrixFromMatrix(M));if(T.length){const _={unitId:f,subUnitId:o,rule:{...g,ranges:T}};b.push({id:r.SetConditionalRuleMutation.id,params:_}),S.push(...r.setConditionalRuleMutationUndoFactory(this._injector,_))}else{const _={unitId:f,subUnitId:o,cfId:g.cfId};b.push({id:r.DeleteConditionalRuleMutation.id,params:_}),S.push(...r.DeleteConditionalRuleMutationUndoFactory(this._injector,_))}}}),{undos:S,redos:b}},l={id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:u=>{var i,v,d;switch(u){case q.FormatPainterStatus.INFINITE:case q.FormatPainterStatus.ONCE:{const f=(i=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:i.getUnitId(),o=(d=(v=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:v.getActiveSheet())==null?void 0:d.getSheetId(),p=this._sheetsSelectionsService.getCurrentLastSelection(),h=p==null?void 0:p.range;f&&o&&h&&(this._painterConfig={unitId:f,subUnitId:o,range:h});break}case q.FormatPainterStatus.OFF:{this._painterConfig=null;break}}},onApply:(u,i,v)=>this._painterConfig?n(u,i,v):{redos:[],undos:[]}};this._formatPainterService.addHook(l)}};Oe=xt([ue(0,s.Inject(s.Injector)),ue(1,s.Inject(s.IUniverInstanceService)),ue(2,s.Inject(q.IFormatPainterService)),ue(3,s.Inject(O.SheetsSelectionsService)),ue(4,s.Inject(r.ConditionalFormattingRuleModel)),ue(5,s.Inject(r.ConditionalFormattingViewModel))],Oe);var Et=Object.getOwnPropertyDescriptor,Rt=(a,e,t,n)=>{for(var l=n>1?void 0:n?Et(e,t):e,u=a.length-1,i;u>=0;u--)(i=a[u])&&(l=i(l)||l);return l},er=(a,e)=>(t,n)=>e(t,n,a);let Ue=class extends s.Disposable{constructor(a,e,t){super(),this._conditionalFormattingViewModel=a,this._univerInstanceService=e,this._renderManagerService=t,this._init()}_init(){const a=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),e=t=>{const n=t.getUnitId(),l=this._renderManagerService.getRenderById(n);if(!l)return;const u=l.with(q.SheetSkeletonManagerService);this.disposeWithMe(u.currentSkeleton$.subscribe(i=>{if(i){const v=i.skeleton.rowColumnSegment,d=v.endColumn-v.startColumn+1,o=(v.endRow-v.startRow+1)*d*9,p=Math.max(r.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,o);this._conditionalFormattingViewModel.setCacheLength(p)}}))};a&&e(a),this._univerInstanceService.getCurrentTypeOfUnit$(s.UniverInstanceType.UNIVER_SHEET).subscribe(t=>{t&&e(t)})}};Ue=Rt([er(0,s.Inject(r.ConditionalFormattingViewModel)),er(1,s.IUniverInstanceService),er(2,lr.IRenderManagerService)],Ue);const _r=[O.SetWorksheetActiveOperation.id,r.AddConditionalRuleMutation.id,r.SetConditionalRuleMutation.id,r.DeleteConditionalRuleMutation.id,r.MoveConditionalRuleMutation.id],Ie=[{label:{name:"sheet.cf.ruleType.highlightCell",selectable:!1},value:G.highlightCell},{label:{name:"sheet.cf.panel.rankAndAverage",selectable:!1},value:G.rank},{label:{name:"sheet.cf.ruleType.formula",selectable:!1},value:G.formula},{label:{name:"sheet.cf.ruleType.colorScale",selectable:!1},value:G.colorScale},{label:{name:"sheet.cf.ruleType.dataBar",selectable:!1},value:G.dataBar},{label:{name:"sheet.cf.ruleType.iconSet",selectable:!1},value:G.icon},{label:{name:"sheet.cf.menu.manageConditionalFormatting",selectable:!1},value:G.viewRule},{label:{name:"sheet.cf.menu.createConditionalFormatting",selectable:!1},value:G.createRule},{label:{name:"sheet.cf.menu.clearRangeRules",selectable:!1},value:G.clearRangeRules,disabled:!1},{label:{name:"sheet.cf.menu.clearWorkSheetRules",selectable:!1},value:G.clearWorkSheetRules}],Mt=a=>{const e=a.get(O.SheetsSelectionsService),t=a.get(s.ICommandService),n=a.get(s.IUniverInstanceService),l=a.get(r.ConditionalFormattingRuleModel),u=new K.Observable(d=>K.merge(e.selectionMoveEnd$,e.selectionSet$,new K.Observable(f=>{const o=t.onCommandExecuted(p=>{var m;const{id:h,params:b}=p,S=(m=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:m.getUnitId();_r.includes(h)&&b.unitId===S&&f.next(null)});return()=>o.dispose()})).pipe(se.debounceTime(16)).subscribe(()=>{var m;const f=((m=e.getCurrentSelections())==null?void 0:m.map(N=>N.range))||[],o=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!o)return;const p=o.getActiveSheet();if(!p)return;const S=(l.getSubunitRules(o.getUnitId(),p.getSheetId())||[]).filter(N=>N.ranges.some(w=>f.some(E=>s.Rectangle.intersects(E,w)))).map(N=>N.ranges).every(N=>O.checkRangesEditablePermission(a,o.getUnitId(),p.getSheetId(),N));d.next(S)})),i=new K.Observable(d=>new K.Observable(f=>{const o=t.onCommandExecuted(p=>{var m;const{id:h,params:b}=p,S=(m=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET))==null?void 0:m.getUnitId();_r.includes(h)&&b.unitId===S&&f.next(null)});return()=>o.dispose()}).pipe(se.debounceTime(16)).subscribe(()=>{const f=n.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET);if(!f)return;const o=f.getActiveSheet();if(!o)return;const p=l.getSubunitRules(f.getUnitId(),o.getSheetId())||[];if(!p.length)return d.next(!1),!1;const h=p.map(b=>b.ranges).every(b=>O.checkRangesEditablePermission(a,f.getUnitId(),o.getSheetId(),b));d.next(h)})),v=new K.Observable(d=>{u.subscribe(f=>{const o=Ie.find(p=>p.value===G.clearRangeRules);o&&(o.disabled=!f,d.next(Ie))}),i.subscribe(f=>{const o=Ie.find(p=>p.value===G.clearWorkSheetRules);o&&(o.disabled=!f,d.next(Ie))}),d.next(Ie)});return{id:pe.id,type:A.MenuItemType.SELECTOR,icon:"ConditionsDoubleIcon",tooltip:"sheet.cf.title",selections:v,hidden$:A.getMenuHiddenObservable(a,s.UniverInstanceType.UNIVER_SHEET),disabled$:q.getCurrentRangeDisable$(a,{workbookTypes:[O.WorkbookEditablePermission],worksheetTypes:[O.WorksheetSetCellStylePermission,O.WorksheetEditPermission],rangeTypes:[O.RangeProtectionPermissionEditPoint]})}},Vt={[A.RibbonDataGroup.RULES]:{[pe.id]:{order:1,menuItemFactory:Mt}}};var Ot=Object.getOwnPropertyDescriptor,Ut=(a,e,t,n)=>{for(var l=n>1?void 0:n?Ot(e,t):e,u=a.length-1,i;u>=0;u--)(i=a[u])&&(l=i(l)||l);return l},wr=(a,e)=>(t,n)=>e(t,n,a);let ke=class extends s.Disposable{constructor(e,t){super();X(this,"_sidebarDisposable",null);this._injector=e,this._menuManagerService=t,this._menuManagerService.mergeMenu(Vt)}};ke=Ut([wr(0,s.Inject(s.Injector)),wr(1,A.IMenuManagerService)],ke);var kt=Object.defineProperty,Pt=Object.getOwnPropertyDescriptor,Dt=(a,e,t)=>e in a?kt(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Lt=(a,e,t,n)=>{for(var l=n>1?void 0:n?Pt(e,t):e,u=a.length-1,i;u>=0;u--)(i=a[u])&&(l=i(l)||l);return l},rr=(a,e)=>(t,n)=>e(t,n,a),Pe=(a,e,t)=>Dt(a,typeof e!="symbol"?e+"":e,t);P.UniverSheetsConditionalFormattingUIPlugin=class extends s.Plugin{constructor(e=Ee,t,n,l){super(),this._config=e,this._injector=t,this._commandService=n,this._configService=l;const{menu:u,...i}=s.merge({},Ee,this._config);u&&this._configService.setConfig("menu",u,{merge:!0}),this._configService.setConfig(Sr,i),this._initCommand()}onStarting(){s.registerDependencies(this._injector,[[me],[ye],[Me],[Ce],[ve],[ke],[le],[Ve],[P.ConditionalFormattingClearController],[Oe],[Ue],[he]]),s.touchDependencies(this._injector,[[me],[he]])}onReady(){s.touchDependencies(this._injector,[[ke],[ve]])}onRendered(){s.touchDependencies(this._injector,[[Me],[P.ConditionalFormattingClearController],[ye],[Ve],[le],[Oe],[Ce],[Ue]])}_initCommand(){[Ae,Fe,$e,Be,He,We,qe,Ge,Ze,pe].forEach(e=>{this._commandService.registerCommand(e)})}},Pe(P.UniverSheetsConditionalFormattingUIPlugin,"pluginName",`${r.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`),Pe(P.UniverSheetsConditionalFormattingUIPlugin,"packageName",Ne.name),Pe(P.UniverSheetsConditionalFormattingUIPlugin,"version",Ne.version),Pe(P.UniverSheetsConditionalFormattingUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),P.UniverSheetsConditionalFormattingUIPlugin=Lt([s.DependentOn(r.UniverSheetsConditionalFormattingPlugin,nr.UniverSheetsFormulaPlugin),rr(1,s.Inject(s.Injector)),rr(2,s.Inject(s.ICommandService)),rr(3,s.IConfigService)],P.UniverSheetsConditionalFormattingUIPlugin),P.AddAverageCfCommand=Ae,P.AddColorScaleConditionalRuleCommand=Fe,P.AddDataBarConditionalRuleCommand=$e,P.AddDuplicateValuesCfCommand=Be,P.AddNumberCfCommand=He,P.AddRankCfCommand=We,P.AddTextCfCommand=qe,P.AddTimePeriodCfCommand=Ge,P.AddUniqueValuesCfCommand=Ze,P.OpenConditionalFormattingOperator=pe,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})}));
|
|
13
|
-
|
|
118
|
+
`,children:[(0,l.jsx)(`div`,{className:`univer-flex univer-items-center univer-gap-2`,children:v.tWithReactNode(`sheet.cf.panel.managerRuleSelect`,(0,l.jsx)(o.Select,{className:`univer-w-36`,options:j,value:T,onChange:e=>{E(e)}})).map((e,t)=>(0,l.jsx)(`span`,{children:e},t))}),(0,l.jsxs)(`div`,{className:`univer-flex univer-justify-end univer-space-x-2`,children:[(0,l.jsx)(o.Tooltip,{title:g.t(`sheet.cf.panel.createRule`),placement:`bottom`,children:(0,l.jsx)(`a`,{className:`univer-size-5 univer-cursor-pointer`,onClick:ae,children:(0,l.jsx)(P,{})})}),F.length&&se?(0,l.jsx)(o.Tooltip,{title:g.t(`sheet.cf.panel.clear`),placement:`bottom`,children:(0,l.jsx)(`a`,{className:`univer-size-5 univer-cursor-pointer`,onClick:oe,children:(0,l.jsx)(M,{className:`univer-text-red-500`})})}):(0,l.jsx)(`div`,{children:(0,l.jsx)(M,{className:`univer-text-gray-300`})})]})]}),(0,l.jsx)(`div`,{children:(0,l.jsx)(o.DraggableList,{className:`univer-w-full`,draggableHandle:`.draggableHandle`,list:I,onListChange:()=>void 0,idKey:`cfId`,rowHeight:60,margin:[0,10],onDragStop:re,onDragStart:ne,itemRender:e=>(0,l.jsxs)(`div`,{className:(0,o.clsx)(`
|
|
119
|
+
univer-group univer-relative univer-flex univer-items-center univer-justify-between
|
|
120
|
+
univer-rounded univer-py-2 univer-pl-5 univer-pr-8
|
|
121
|
+
hover:univer-bg-gray-100
|
|
122
|
+
dark:hover:!univer-bg-gray-700
|
|
123
|
+
`,{"univer-bg-gray-100 dark:!univer-bg-gray-700":k===e.cfId}),onMouseMove:()=>{e.ranges!==C&&w(e.ranges)},onMouseLeave:()=>w([]),onClick:()=>{c(e)},children:[(0,l.jsx)(`div`,{className:(0,o.clsx)(`
|
|
124
|
+
univer-absolute univer-left-0 univer-hidden univer-size-5 univer-cursor-grab
|
|
125
|
+
univer-items-center univer-justify-center univer-rounded
|
|
126
|
+
group-hover:univer-flex
|
|
127
|
+
`,`draggableHandle`),onClick:e=>e.stopPropagation(),children:(0,l.jsx)(ie,{})}),(0,l.jsxs)(`div`,{className:`univer-min-w-0 univer-max-w-full univer-flex-shrink univer-overflow-hidden`,children:[(0,l.jsx)(`div`,{className:`
|
|
128
|
+
univer-text-sm univer-text-gray-900
|
|
129
|
+
dark:!univer-text-white
|
|
130
|
+
`,children:Be(e,g)}),(0,l.jsx)(`div`,{className:`univer-text-xs univer-text-gray-400`,children:e.ranges.map(e=>(0,s.serializeRange)(e)).join(`,`)})]}),(0,l.jsx)(`div`,{children:(0,l.jsx)(z,{rule:e.rule})}),(0,l.jsx)(`div`,{className:(0,o.clsx)(`
|
|
131
|
+
univer-absolute univer-right-1 univer-hidden univer-size-6 univer-cursor-pointer
|
|
132
|
+
univer-items-center univer-justify-center univer-rounded univer-text-red-500
|
|
133
|
+
group-hover:univer-flex
|
|
134
|
+
hover:univer-bg-gray-200
|
|
135
|
+
`,{"univer-flex univer-items-center univer-justify-center":k===e.cfId}),onClick:t=>{t.stopPropagation(),te(e),w([])},children:(0,l.jsx)(M,{})})]})})})]})},He=e=>{let[t,n]=(0,a.useState)(e.rule),[r,i]=(0,a.useState)(!!e.rule);return(0,l.jsx)(`div`,{className:`univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4`,children:r?(0,l.jsx)(Le,{onCancel:()=>{i(!1),n(void 0)},rule:t}):(0,l.jsx)(Ve,{onClick:e=>{n(e),i(!0)},onCreate:()=>{i(!0)}})})},Ue=`sheet.conditional.formatting.panel`,We=class extends t.Disposable{constructor(e,n,r,i,a){super(),this._univerInstanceService=e,this._injector=n,this._componentManager=r,this._sidebarService=i,this._localeService=a,G(this,`_sidebarDisposable`,null),this._initPanel(),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).subscribe(e=>{var t;e||(t=this._sidebarDisposable)==null||t.dispose()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(e=>{e.id===Ue&&(e.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}openPanel(e){let n={id:Ue,header:{title:this._localeService.t(`sheet.cf.title`)},children:{label:Ue,rule:e,key:(0,t.generateRandomId)(4)},onClose:()=>this._sidebarDisposable=null};this._sidebarDisposable=this._sidebarService.open(n)}_initPanel(){this.disposeWithMe(this._componentManager.register(Ue,He))}};We=q([K(0,t.IUniverInstanceService),K(1,(0,t.Inject)(t.Injector)),K(2,(0,t.Inject)(i.ComponentManager)),K(3,(0,t.Inject)(i.ISidebarService)),K(4,(0,t.Inject)(t.LocaleService))],We);let Y=function(e){return e[e.createRule=1]=`createRule`,e[e.viewRule=2]=`viewRule`,e[e.highlightCell=3]=`highlightCell`,e[e.rank=4]=`rank`,e[e.formula=5]=`formula`,e[e.colorScale=6]=`colorScale`,e[e.dataBar=7]=`dataBar`,e[e.icon=8]=`icon`,e[e.clearRangeRules=9]=`clearRangeRules`,e[e.clearWorkSheetRules=10]=`clearWorkSheetRules`,e}({}),Ge={id:`sheet.operation.open.conditional.formatting.panel`,type:t.CommandType.OPERATION,handler:(e,i)=>{var a;let o=e.get(We),s=e.get(n.SheetsSelectionsService),c=e.get(t.ICommandService),l=((a=s.getCurrentSelections())==null?void 0:a.map(e=>e.range))||[];switch(i.value){case Y.highlightCell:o.openPanel({...(0,r.createDefaultRule)(),ranges:l});break;case Y.rank:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.rank}};o.openPanel(e);break}case Y.formula:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.highlightCell,subType:r.CFSubRuleType.formula,value:`=`}};o.openPanel(e);break}case Y.colorScale:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.colorScale,config:[]}};o.openPanel(e);break}case Y.dataBar:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.dataBar,isShowValue:!0}};o.openPanel(e);break}case Y.icon:{let e={...r.createDefaultRule,ranges:l,rule:{type:r.CFRuleType.iconSet,config:[],isShowValue:!0}};o.openPanel(e);break}case Y.viewRule:o.openPanel();break;case Y.createRule:o.openPanel({...(0,r.createDefaultRule)(),ranges:l});break;case Y.clearRangeRules:c.executeCommand(r.ClearRangeCfCommand.id,{ranges:l});break;case Y.clearWorkSheetRules:c.executeCommand(r.ClearWorksheetCfCommand.id);break}return!0}},Ke=class extends t.Disposable{constructor(e,t,n,r,i){super(),this._injector=e,this._univerInstanceService=t,this._sheetInterceptorService=n,this._selectionManagerService=r,this._conditionalFormattingRuleModel=i,this._init()}_init(){this.disposeWithMe(this._sheetInterceptorService.interceptCommand({getMutations:e=>{let r=[],i=[],a={redos:r,undos:i};if([n.ClearSelectionFormatCommand.id,n.ClearSelectionAllCommand.id].includes(e.id)){var o;let e=(o=this._selectionManagerService.getCurrentSelections())==null?void 0:o.map(e=>e.range);if(!e)return a;let n=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET),s=n.getActiveSheet();if(!s)return a;let c=n.getUnitId(),l=s.getSheetId(),u=this._conditionalFormattingRuleModel.getSubunitRules(c,l);if(!u||!u.length)return a;let{redos:d,undos:f}=qe(this._injector,u,e,c,l);r.push(...d),i.push(...f)}return a}})),this.disposeWithMe(this._sheetInterceptorService.interceptRanges({getMutations:({unitId:e,subUnitId:t,ranges:n})=>{let r=[],i=[],a={redos:r,undos:i};if(!n||!n.length)return a;let o=this._conditionalFormattingRuleModel.getSubunitRules(e,t);if(!o||!o.length)return a;let{redos:s,undos:c}=qe(this._injector,o,n,e,t);return r.push(...s),i.push(...c),a}}))}};Ke=q([K(0,(0,t.Inject)(t.Injector)),K(1,(0,t.Inject)(t.IUniverInstanceService)),K(2,(0,t.Inject)(n.SheetInterceptorService)),K(3,(0,t.Inject)(n.SheetsSelectionsService)),K(4,(0,t.Inject)(r.ConditionalFormattingRuleModel))],Ke);function qe(e,i,a,o,s){let c=[],l=[];return i.filter(e=>a.some(n=>e.ranges.some(e=>t.Rectangle.getIntersects(e,n)))).forEach(t=>{let i=new n.RangeMergeUtil().add(...t.ranges).subtract(...a).merge();if(i.length){let n={id:r.SetConditionalRuleMutation.id,params:{unitId:o,subUnitId:s,rule:{...t,ranges:i}}},a=(0,r.setConditionalRuleMutationUndoFactory)(e,n.params);c.push(n),l.push(...a)}else{let n={id:r.DeleteConditionalRuleMutation.id,params:{unitId:o,subUnitId:s,cfId:t.cfId}},i=(0,r.DeleteConditionalRuleMutationUndoFactory)(e,n.params);c.push(n),l.push(...i)}}),{redos:c,undos:l}}var Je=`@univerjs/sheets-conditional-formatting-ui`,Ye=`0.18.0`;let Xe=`sheets-conditional-formatting-ui.config`;Symbol(Xe);let Ze={},X=class extends t.Disposable{constructor(e,t,n){super(),this._conditionalFormattingRuleModel=e,this._formulaRefRangeService=t,this._injector=n,G(this,`_disposableMap`,new Map),this._initRefRange()}_getIdWithUnitId(e,t,n){return`${e}_${t}_${n}`}_getRuleFormulas(e){let t=[],n=e.rule;switch(n.type){case r.CFRuleType.highlightCell:n.subType===r.CFSubRuleType.formula&&t.push(n.value);break;case r.CFRuleType.dataBar:{let e=n;e.config.min.type===r.CFValueType.formula&&t.push(e.config.min.value),e.config.max.type===r.CFValueType.formula&&t.push(e.config.max.value);break}case r.CFRuleType.colorScale:n.config.forEach(e=>{e.value.type===r.CFValueType.formula&&t.push(e.value.value)});break;case r.CFRuleType.iconSet:n.config.forEach(e=>{e.value.type===r.CFValueType.formula&&t.push(e.value.value)});break}return t}_updateRuleFormulas(e,n){let i=t.Tools.deepClone(e),a=i.rule,o=0;switch(a.type){case r.CFRuleType.highlightCell:a.subType===r.CFSubRuleType.formula&&(a.value=n[o++]);break;case r.CFRuleType.dataBar:{let e=a;e.config.min.type===r.CFValueType.formula&&(e.config.min.value=n[o++]),e.config.max.type===r.CFValueType.formula&&(e.config.max.value=n[o++]);break}case r.CFRuleType.colorScale:a.config.forEach(e=>{e.value.type===r.CFValueType.formula&&(e.value.value=n[o++])});break;case r.CFRuleType.iconSet:a.config.forEach(e=>{e.value.type===r.CFValueType.formula&&(e.value.value=n[o++])});break}return i}register(e,t,n){let i=n.ranges,a=this._getRuleFormulas(n),o=this._formulaRefRangeService.registerRangeFormula(e,t,i,a,i=>{if(i.length===0)return{undos:[{id:r.AddConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,rule:n}}],redos:[{id:r.DeleteConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,cfId:n.cfId}}]};let a=[],o=[],s=i[0],c=this._updateRuleFormulas(n,s.formulas);c.ranges=s.ranges,a.push({id:r.SetConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,cfId:n.cfId,rule:c}}),o.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,{unitId:e,subUnitId:t,cfId:n.cfId,rule:c}));for(let s=1;s<i.length;s++){let c=i[s],l=(0,r.createCfId)(),u=this._updateRuleFormulas(n,c.formulas);u.cfId=l,u.ranges=c.ranges,a.push({id:r.AddConditionalRuleMutation.id,params:{unitId:e,subUnitId:t,rule:u}}),o.push((0,r.AddConditionalRuleMutationUndoFactory)(this._injector,{unitId:e,subUnitId:t,rule:u}))}return{undos:o,redos:a}}),s=this._getIdWithUnitId(e,t,n.cfId);this._disposableMap.set(s,o)}_initRefRange(){let e=this._conditionalFormattingRuleModel.getAll();for(let[t,n]of e)for(let[e,r]of n)for(let n of r)this.register(t,e,n);this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe(e=>{let{unitId:t,subUnitId:n,rule:r}=e;switch(e.type){case`add`:this.register(t,n,r);break;case`delete`:{let e=this._getIdWithUnitId(t,n,r.cfId),i=this._disposableMap.get(e);i&&(i.dispose(),this._disposableMap.delete(e));break}case`set`:{let e=this._getIdWithUnitId(t,n,r.cfId),i=this._disposableMap.get(e);i&&(i.dispose(),this._disposableMap.delete(e)),this.register(t,n,r);break}}})),this.disposeWithMe((0,t.toDisposable)(()=>{this._disposableMap.forEach(e=>{e.dispose()}),this._disposableMap.clear()}))}};X=q([K(0,(0,t.Inject)(r.ConditionalFormattingRuleModel)),K(1,(0,t.Inject)(f.FormulaRefRangeService)),K(2,(0,t.Inject)(t.Injector))],X);let Qe=class extends t.Disposable{constructor(e,t,n,r,i){super(),this._sheetClipboardService=e,this._conditionalFormattingRuleModel=t,this._injector=n,this._conditionalFormattingViewModel=r,this._univerInstanceService=i,G(this,`_copyInfo`,void 0),this._initClipboardHook()}_initClipboardHook(){this.disposeWithMe(this._sheetClipboardService.addClipboardHook({id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onBeforeCopy:(e,t,n)=>this._collectConditionalRule(e,t,n),onPasteCells:(e,t,n,r)=>{let{copyType:i=u.COPY_TYPE.COPY,pasteType:a}=r,{range:o}=e||{},{range:s}=t;return this._generateConditionalFormattingMutations(s,{copyType:i,pasteType:a,copyRange:o})}}))}_collectConditionalRule(e,r,i){let a=new t.ObjectMatrix,o={};this._copyInfo={matrix:a,info:{unitId:e,subUnitId:r,cfMap:o}};let s=this._injector.invoke(t=>(0,n.rangeToDiscreteRange)(i,t,e,r));if(!s)return;let{rows:c,cols:l}=s,u=new Set;c.forEach((t,n)=>{l.forEach((i,o)=>{let s=this._conditionalFormattingViewModel.getCellCfs(e,r,t,i);s&&(s.forEach(e=>u.add(e.cfId)),a.setValue(n,o,s.map(e=>e.cfId)))})}),u.forEach(t=>{let n=this._conditionalFormattingRuleModel.getRule(e,r,t);n&&(o[t]=n.rule)})}_generateConditionalFormattingMutations(e,i){let a=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET),o=a.getActiveSheet(),s=a.getUnitId();if(!o)return{redos:[],undos:[]};let c=o.getSheetId();if(i.copyType===u.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!i.copyRange||![u.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT,u.PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE,u.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_BESIDES_BORDER].includes(i.pasteType))return{redos:[],undos:[]};let{ranges:[l,d],mapFunc:f}=(0,u.virtualizeDiscreteRanges)([i.copyRange,e]),p=(0,u.getRepeatRange)(l,d,!0),m={};t.Range.foreach(d,(e,n)=>{let{row:r,col:i}=f(e,n),a=this._conditionalFormattingViewModel.getCellCfs(s,c,r,i);a&&a.forEach(e=>{if(!m[e.cfId]){let n=new t.ObjectMatrix;m[e.cfId]=n;let r=this._conditionalFormattingRuleModel.getRule(s,c,e.cfId);r==null||r.ranges.forEach(e=>{t.Range.foreach(e,(e,t)=>{n.setValue(e,t,1)})})}m[e.cfId].realDeleteValue(r,i)})});let{matrix:h,info:g}=this._copyInfo,_=[],v=this._conditionalFormattingRuleModel.createCfId(s,c),y={},b=e=>{if(y[e])return y[e];let n=g==null?void 0:g.cfMap[e],r=[...this._conditionalFormattingRuleModel.getSubunitRules(s,c)||[],..._].find(e=>t.Tools.diffValue(e.rule,n));if(r)return y[e]=r,r;{let t={rule:n,cfId:v,ranges:[],stopIfTrue:!1};return y[e]=t,_.push(t),v=`${Number(v)+1}`,t}};p.forEach(e=>{h&&h.forValue((n,r,i)=>{let a=t.Rectangle.getPositionRange({startRow:n,endRow:n,startColumn:r,endColumn:r},e.startRange),{row:o,col:s}=f(a.startRow,a.startColumn);i.forEach(e=>{if(!m[e]){let n=b(e),r=new t.ObjectMatrix;m[e]=r,n.ranges.forEach(e=>{t.Range.foreach(e,(e,t)=>{r.setValue(e,t,1)})})}m[e].setValue(o,s,1)})})});let x=[],S=[];for(let e in m){let t=m[e],i=(0,n.findAllRectangle)((0,n.createTopMatrixFromMatrix)(t));if(!i.length){let t={unitId:s,subUnitId:c,cfId:e};x.push({id:r.DeleteConditionalRuleMutation.id,params:t}),S.push(...(0,r.DeleteConditionalRuleMutationUndoFactory)(this._injector,t))}if(_.some(t=>t.cfId===e)){let t={unitId:s,subUnitId:c,rule:{...b(e),ranges:i}};x.push({id:r.AddConditionalRuleMutation.id,params:t}),S.push((0,r.AddConditionalRuleMutationUndoFactory)(this._injector,t))}else{let t=this._conditionalFormattingRuleModel.getRule(s,c,e);if(!t)continue;let n={unitId:s,subUnitId:c,rule:{...t,ranges:i}};x.push({id:r.SetConditionalRuleMutation.id,params:n}),S.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,n))}}return{redos:x,undos:S}}};Qe=q([K(0,(0,t.Inject)(u.ISheetClipboardService)),K(1,(0,t.Inject)(r.ConditionalFormattingRuleModel)),K(2,(0,t.Inject)(t.Injector)),K(3,(0,t.Inject)(r.ConditionalFormattingViewModel)),K(4,(0,t.Inject)(t.IUniverInstanceService))],Qe);let $e=class extends t.Disposable{constructor(e,t,n){super(),this._localeService=e,this._commandService=t,this._sheetPermissionCheckController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{if(e.id===r.AddCfCommand.id){let{unitId:t,subUnitId:r,rule:{ranges:i}}=e.params;this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[n.WorkbookEditablePermission],rangeTypes:[n.RangeProtectionPermissionEditPoint],worksheetTypes:[n.WorksheetEditPermission,n.WorksheetSetCellStylePermission]},i,t,r)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.setStyleErr`))}}))}};$e=q([K(0,(0,t.Inject)(t.LocaleService)),K(1,t.ICommandService),K(2,(0,t.Inject)(n.SheetPermissionCheckController))],$e);let et=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._univerInstanceService=n,this._renderManagerService=r,this._conditionalFormattingViewModel=i,this._conditionalFormattingRuleModel=a,G(this,`_ruleChangeCacheMap`,new Map),this._initViewModelInterceptor(),this._initSkeleton(),this.disposeWithMe(()=>{this._ruleChangeCacheMap.clear()})}_markDirtySkeleton(){var e,n;let r=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET).getUnitId();(e=this._renderManagerService.getRenderById(r))==null||e.with(u.SheetSkeletonManagerService).reCalculate(),(n=this._renderManagerService.getRenderById(r))==null||(n=n.mainComponent)==null||n.makeDirty()}_initSkeleton(){this.disposeWithMe((0,d.merge)(this._conditionalFormattingRuleModel.$ruleChange,this._conditionalFormattingViewModel.markDirty$).pipe((0,m.bufferTime)(16),(0,m.filter)(e=>!!e.length),(0,m.filter)(e=>{let n=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET);if(!n)return!1;let r=n.getActiveSheet();return r?e.filter(e=>e.unitId===n.getUnitId()&&e.subUnitId===r.getSheetId()).length>0:!1})).subscribe(()=>this._markDirtySkeleton()))}_initViewModelInterceptor(){this.disposeWithMe(this._sheetInterceptorService.intercept(n.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Style,handler:(e,t,n)=>{let i=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col);if(!i)return n(e);let a=t.workbook.getStyles(),o=(typeof(e==null?void 0:e.s)==`string`?a.get(e==null?void 0:e.s):e==null?void 0:e.s)||{},s=e===t.rawData?{...t.rawData}:e;if(i.style){let e={...o,...i.style};Object.assign(s,{s:e})}return s.fontRenderExtension||(s.fontRenderExtension={},i.isShowValue!==void 0&&(s.fontRenderExtension.isSkip=!i.isShowValue)),i.dataBar&&(s.dataBar=i.dataBar),i.iconSet&&(s.iconSet=i.iconSet,s.fontRenderExtension.leftOffset=r.DEFAULT_PADDING+r.DEFAULT_WIDTH),n(s)},priority:10}))}};et=q([K(0,(0,t.Inject)(n.SheetInterceptorService)),K(1,(0,t.Inject)(r.ConditionalFormattingService)),K(2,(0,t.Inject)(t.IUniverInstanceService)),K(3,(0,t.Inject)(p.IRenderManagerService)),K(4,(0,t.Inject)(r.ConditionalFormattingViewModel)),K(5,(0,t.Inject)(r.ConditionalFormattingRuleModel))],et);let Z=class extends t.Plugin{constructor(e=Ze,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},Ze,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(Xe,o),this._initCommand(),this._injector.add([et]),this._injector.add([Qe]),this._injector.add([$e]),this._injector.add([J]),this._injector.add([X])}_initCommand(){[h,g,_,v,y,b,x,S,C,Ge].forEach(e=>{this._commandService.registerCommand(e)})}};G(Z,`pluginName`,`${r.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_MOBILE_UI_PLUGIN`),G(Z,`packageName`,Je),G(Z,`version`,Ye),G(Z,`type`,t.UniverInstanceType.UNIVER_SHEET),Z=q([(0,t.DependentOn)(r.UniverSheetsConditionalFormattingPlugin),K(1,(0,t.Inject)(t.Injector)),K(2,(0,t.Inject)(t.ICommandService)),K(3,t.IConfigService)],Z);let tt=class extends t.Disposable{constructor(e,t,n,r,i){super(),this._injector=e,this._univerInstanceService=t,this._autoFillService=n,this._conditionalFormattingRuleModel=r,this._conditionalFormattingViewModel=i,this._initAutoFill()}_initAutoFill(){let e=()=>({redos:[],undos:[]}),i=(e,n,r,i,a)=>{var o;let s=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET).getUnitId(),c=(o=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET).getActiveSheet())==null?void 0:o.getSheetId();if(!s||!c)return;let l={startRow:e.row,startColumn:e.col,endColumn:e.col,endRow:e.row},u={startRow:n.row,startColumn:n.col,endColumn:n.col,endRow:n.row};t.Range.foreach(r,(e,n)=>{let r=t.Rectangle.getPositionRange({startRow:e,startColumn:n,endColumn:n,endRow:e},l),o=t.Rectangle.getPositionRange({startRow:e,startColumn:n,endColumn:n,endRow:e},u),{row:d,col:f}=a(r.startRow,r.startColumn),p=this._conditionalFormattingViewModel.getCellCfs(s,c,d,f),{row:m,col:h}=a(o.startRow,o.startColumn),g=this._conditionalFormattingViewModel.getCellCfs(s,c,m,h);g&&g.forEach(e=>{let n=i.get(e.cfId);if(!i.get(e.cfId)){let r=this._conditionalFormattingRuleModel.getRule(s,c,e.cfId);if(!r)return;n=new t.ObjectMatrix,r.ranges.forEach(e=>{t.Range.foreach(e,(e,t)=>{n.setValue(e,t,1)})}),i.set(e.cfId,n)}n.realDeleteValue(m,h)}),p&&p.forEach(e=>{let n=i.get(e.cfId);if(!i.get(e.cfId)){let r=this._conditionalFormattingRuleModel.getRule(s,c,e.cfId);if(!r)return;n=new t.ObjectMatrix,r.ranges.forEach(e=>{t.Range.foreach(e,(e,t)=>{n.setValue(e,t,1)})}),i.set(e.cfId,n)}n.setValue(m,h,1)})})},a=(a,o)=>{var s,c;let l=(s=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:s.getUnitId(),d=(c=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET))==null||(c=c.getActiveSheet())==null?void 0:c.getSheetId(),f=new Map,p=[],m=[];if(!l||!d)return e();let h=(0,u.virtualizeDiscreteRanges)([a,o]),[g,_]=h.ranges,{mapFunc:v}=h,y={row:g.startRow,col:g.startColumn};return n.AutoFillTools.getAutoFillRepeatRange(g,_).forEach(e=>{i(y,e.repeatStartCell,e.relativeRange,f,v)}),f.forEach((e,t)=>{let i=this._conditionalFormattingRuleModel.getRule(l,d,t);if(!i)return;let a=(0,n.findAllRectangle)((0,n.createTopMatrixFromMatrix)(e));if(a.length){let e={unitId:l,subUnitId:d,rule:{...i,ranges:a}};p.push({id:r.SetConditionalRuleMutation.id,params:e}),m.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,e))}else{let e={unitId:l,subUnitId:d,cfId:i.cfId};p.push({id:r.DeleteConditionalRuleMutation.id,params:e}),m.push(...(0,r.DeleteConditionalRuleMutationUndoFactory)(this._injector,e))}}),{undos:m,redos:p}},o={id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onFillData:(t,r,i)=>{if(i===n.AUTO_FILL_APPLY_TYPE.COPY||i===n.AUTO_FILL_APPLY_TYPE.ONLY_FORMAT||i===n.AUTO_FILL_APPLY_TYPE.SERIES){let{source:e,target:n}=t;return a(e,n)}return e()}};this.disposeWithMe(this._autoFillService.addHook(o))}};tt=q([K(0,(0,t.Inject)(t.Injector)),K(1,(0,t.Inject)(t.IUniverInstanceService)),K(2,(0,t.Inject)(n.IAutoFillService)),K(3,(0,t.Inject)(r.ConditionalFormattingRuleModel)),K(4,(0,t.Inject)(r.ConditionalFormattingViewModel))],tt);let nt=class extends t.Disposable{constructor(e,t){super(),this._sheetInterceptorService=e,this._conditionalFormattingService=t,this._initInterceptorEditorEnd()}_initInterceptorEditorEnd(){this.disposeWithMe((0,t.toDisposable)(this._sheetInterceptorService.writeCellInterceptor.intercept(n.AFTER_CELL_EDIT,{handler:(e,t,n)=>{var r;e||n(e);let i=this._conditionalFormattingService.composeStyle(t.unitId,t.subUnitId,t.row,t.col),a=(r=i==null?void 0:i.style)==null?{}:r,o=Object.keys(a);if(e!=null&&e.p){var s;return(s=e.p.body)==null||(s=s.textRuns)==null||s.forEach(e=>{e.ts&&o.forEach(t=>{var n;(n=e.ts)==null||delete n[t]})}),n(e)}else{let r={...(typeof(e==null?void 0:e.s)==`string`?t.workbook.getStyles().get(e.s):e==null?void 0:e.s)||{}};return o.forEach(e=>{delete r[e]}),n({...e,s:{...r}})}}})))}};nt=q([K(0,(0,t.Inject)(n.SheetInterceptorService)),K(1,(0,t.Inject)(r.ConditionalFormattingService))],nt);let rt=(e,t)=>{let n=e=>e.endRow-e.startRow+1,r=e=>e.endColumn-e.startColumn+1,i=n(t)%n(e),a=r(t)%r(e),o=Math.floor(n(t)/n(e)),s=Math.floor(r(t)/r(e)),c=[],l={startRow:0,endRow:n(e)-1,startColumn:0,endColumn:r(e)-1};if(n(t)===1&&r(t)===1){let e={startRow:t.startRow,endRow:t.startRow,startColumn:t.startColumn,endColumn:t.startColumn};return c.push({repeatRelativeRange:l,startRange:e}),c}for(let u=0;u<o+(i?.1:0);u++)for(let d=0;d<s+(a?.1:0);d++){let f=n(e)*u,p=r(e)*d,m={startRow:f+t.startRow,endRow:f+t.startRow,startColumn:p+t.startColumn,endColumn:p+t.startColumn},h=l;u===o&&i&&(h={...h},h.endRow-=n(e)-i),d===s&&a&&(h={...h},h.endColumn-=r(e)-a),c.push({repeatRelativeRange:h,startRange:m})}return c},it=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._injector=e,this._univerInstanceService=t,this._formatPainterService=n,this._sheetsSelectionsService=r,this._conditionalFormattingRuleModel=i,this._conditionalFormattingViewModel=a,G(this,`_painterConfig`,null),this._initFormattingPainter()}_initFormattingPainter(){let e=()=>({redos:[],undos:[]}),i=(e,n,r,i,a)=>{let{unitId:o,subUnitId:s}=this._painterConfig,{targetUnitId:c,targetSubUnitId:l}=a,u={startRow:e.row,startColumn:e.col,endColumn:e.col,endRow:e.row},d={startRow:n.row,startColumn:n.col,endColumn:n.col,endRow:n.row};t.Range.foreach(r,(e,n)=>{let r=t.Rectangle.getPositionRange({startRow:e,startColumn:n,endColumn:n,endRow:e},u),a=t.Rectangle.getPositionRange({startRow:e,startColumn:n,endColumn:n,endRow:e},d),f=this._conditionalFormattingViewModel.getCellCfs(o,s,r.startRow,r.startColumn),p=this._conditionalFormattingViewModel.getCellCfs(c,l,a.startRow,a.startColumn);p&&p.forEach(e=>{let n=i.get(e.cfId);if(!i.get(e.cfId)){let r=this._conditionalFormattingRuleModel.getRule(c,l,e.cfId);if(!r)return;n=new t.ObjectMatrix,r.ranges.forEach(e=>{t.Range.foreach(e,(e,t)=>{n.setValue(e,t,1)})}),i.set(e.cfId,n)}n.realDeleteValue(a.startRow,a.startColumn)}),f&&f.forEach(e=>{let t=i.get(e.cfId);t&&t.setValue(a.startRow,a.startColumn,1)})})},a=(a,o,s)=>{var c;let{range:l,unitId:u,subUnitId:d}=this._painterConfig,f=a!==u||d!==o,p=new Map,m=[],h=[];if(!a||!o||!u||!d)return e();let g=(c=this._conditionalFormattingRuleModel.getSubunitRules(u,d))==null?[]:c;g==null||g.forEach(e=>{let{ranges:n,cfId:r}=e;if(n.some(e=>t.Rectangle.intersects(l,e))){let e=new t.ObjectMatrix;f||n.forEach(n=>{t.Range.foreach(n,(t,n)=>{e.setValue(t,n,1)})}),p.set(r,e)}});let _={row:l.startRow,col:l.startColumn};return rt(l,s).forEach(e=>{i(_,{row:e.startRange.startRow,col:e.startRange.startColumn},e.repeatRelativeRange,p,{targetUnitId:a,targetSubUnitId:o})}),p.forEach((e,i)=>{if(f){let s=this._conditionalFormattingRuleModel.getRule(a,o,i),c=(0,n.findAllRectangle)((0,n.createTopMatrixFromMatrix)(e));if(!s){if(c.length){let e=this._conditionalFormattingRuleModel.getRule(u,d,i);if(e){let n={unitId:a,subUnitId:o,rule:{...t.Tools.deepClone(e),cfId:this._conditionalFormattingRuleModel.createCfId(a,o),ranges:c}};m.push({id:r.AddConditionalRuleMutation.id,params:n}),h.push((0,r.AddConditionalRuleMutationUndoFactory)(this._injector,n))}}}else if(c.length){let e={unitId:a,subUnitId:o,rule:{...s,ranges:c}};m.push({id:r.SetConditionalRuleMutation.id,params:e}),h.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,e))}else{let e={unitId:a,subUnitId:o,cfId:s.cfId};m.push({id:r.DeleteConditionalRuleMutation.id,params:e}),h.push(...(0,r.DeleteConditionalRuleMutationUndoFactory)(this._injector,e))}}else{let t=this._conditionalFormattingRuleModel.getRule(u,d,i);if(!t)return;let a=(0,n.findAllRectangle)((0,n.createTopMatrixFromMatrix)(e));if(a.length){let e={unitId:u,subUnitId:d,rule:{...t,ranges:a}};m.push({id:r.SetConditionalRuleMutation.id,params:e}),h.push(...(0,r.setConditionalRuleMutationUndoFactory)(this._injector,e))}else{let e={unitId:u,subUnitId:d,cfId:t.cfId};m.push({id:r.DeleteConditionalRuleMutation.id,params:e}),h.push(...(0,r.DeleteConditionalRuleMutationUndoFactory)(this._injector,e))}}}),{undos:h,redos:m}},o={id:r.SHEET_CONDITIONAL_FORMATTING_PLUGIN,onStatusChange:e=>{switch(e){case u.FormatPainterStatus.INFINITE:case u.FormatPainterStatus.ONCE:{var n,r;let e=(n=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:n.getUnitId(),i=(r=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET))==null||(r=r.getActiveSheet())==null?void 0:r.getSheetId(),a=this._sheetsSelectionsService.getCurrentLastSelection(),o=a==null?void 0:a.range;e&&i&&o&&(this._painterConfig={unitId:e,subUnitId:i,range:o});break}case u.FormatPainterStatus.OFF:this._painterConfig=null;break}},onApply:(e,t,n)=>this._painterConfig?a(e,t,n):{redos:[],undos:[]}};this._formatPainterService.addHook(o)}};it=q([K(0,(0,t.Inject)(t.Injector)),K(1,(0,t.Inject)(t.IUniverInstanceService)),K(2,(0,t.Inject)(u.IFormatPainterService)),K(3,(0,t.Inject)(n.SheetsSelectionsService)),K(4,(0,t.Inject)(r.ConditionalFormattingRuleModel)),K(5,(0,t.Inject)(r.ConditionalFormattingViewModel))],it);let at=class extends t.Disposable{constructor(e,t,n){super(),this._conditionalFormattingViewModel=e,this._univerInstanceService=t,this._renderManagerService=n,this._init()}_init(){let e=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET),n=e=>{let t=e.getUnitId(),n=this._renderManagerService.getRenderById(t);if(!n)return;let i=n.with(u.SheetSkeletonManagerService);this.disposeWithMe(i.currentSkeleton$.subscribe(e=>{if(e){let t=e.skeleton.rowColumnSegment,n=t.endColumn-t.startColumn+1,i=(t.endRow-t.startRow+1)*n*9,a=Math.max(r.CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,i);this._conditionalFormattingViewModel.setCacheLength(a)}}))};e&&n(e),this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).subscribe(e=>{e&&n(e)})}};at=q([K(0,(0,t.Inject)(r.ConditionalFormattingViewModel)),K(1,t.IUniverInstanceService),K(2,p.IRenderManagerService)],at);let ot=[n.SetWorksheetActiveOperation.id,r.AddConditionalRuleMutation.id,r.SetConditionalRuleMutation.id,r.DeleteConditionalRuleMutation.id,r.MoveConditionalRuleMutation.id],Q=[{label:{name:`sheet.cf.ruleType.highlightCell`,selectable:!1},value:Y.highlightCell},{label:{name:`sheet.cf.panel.rankAndAverage`,selectable:!1},value:Y.rank},{label:{name:`sheet.cf.ruleType.formula`,selectable:!1},value:Y.formula},{label:{name:`sheet.cf.ruleType.colorScale`,selectable:!1},value:Y.colorScale},{label:{name:`sheet.cf.ruleType.dataBar`,selectable:!1},value:Y.dataBar},{label:{name:`sheet.cf.ruleType.iconSet`,selectable:!1},value:Y.icon},{label:{name:`sheet.cf.menu.manageConditionalFormatting`,selectable:!1},value:Y.viewRule},{label:{name:`sheet.cf.menu.createConditionalFormatting`,selectable:!1},value:Y.createRule},{label:{name:`sheet.cf.menu.clearRangeRules`,selectable:!1},value:Y.clearRangeRules,disabled:!1},{label:{name:`sheet.cf.menu.clearWorkSheetRules`,selectable:!1},value:Y.clearWorkSheetRules}],st=e=>{let a=e.get(n.SheetsSelectionsService),o=e.get(t.ICommandService),s=e.get(t.IUniverInstanceService),c=e.get(r.ConditionalFormattingRuleModel),l=new d.Observable(r=>(0,d.merge)(a.selectionMoveEnd$,a.selectionSet$,new d.Observable(e=>{let n=o.onCommandExecuted(n=>{var r;let{id:i,params:a}=n,o=(r=s.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:r.getUnitId();ot.includes(i)&&a.unitId===o&&e.next(null)});return()=>n.dispose()})).pipe((0,m.debounceTime)(16)).subscribe(()=>{var i;let o=((i=a.getCurrentSelections())==null?void 0:i.map(e=>e.range))||[],l=s.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET);if(!l)return;let u=l.getActiveSheet();if(!u)return;let d=(c.getSubunitRules(l.getUnitId(),u.getSheetId())||[]).filter(e=>e.ranges.some(e=>o.some(n=>t.Rectangle.intersects(n,e)))).map(e=>e.ranges).every(t=>(0,n.checkRangesEditablePermission)(e,l.getUnitId(),u.getSheetId(),t));r.next(d)})),f=new d.Observable(r=>new d.Observable(e=>{let n=o.onCommandExecuted(n=>{var r;let{id:i,params:a}=n,o=(r=s.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET))==null?void 0:r.getUnitId();ot.includes(i)&&a.unitId===o&&e.next(null)});return()=>n.dispose()}).pipe((0,m.debounceTime)(16)).subscribe(()=>{let i=s.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET);if(!i)return;let a=i.getActiveSheet();if(!a)return;let o=c.getSubunitRules(i.getUnitId(),a.getSheetId())||[];if(!o.length)return r.next(!1),!1;let l=o.map(e=>e.ranges).every(t=>(0,n.checkRangesEditablePermission)(e,i.getUnitId(),a.getSheetId(),t));r.next(l)})),p=new d.Observable(e=>{l.subscribe(t=>{let n=Q.find(e=>e.value===Y.clearRangeRules);n&&(n.disabled=!t,e.next(Q))}),f.subscribe(t=>{let n=Q.find(e=>e.value===Y.clearWorkSheetRules);n&&(n.disabled=!t,e.next(Q))}),e.next(Q)});return{id:Ge.id,type:i.MenuItemType.SELECTOR,icon:`ConditionsDoubleIcon`,tooltip:`sheet.cf.title`,selections:p,hidden$:(0,i.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,u.getCurrentRangeDisable$)(e,{workbookTypes:[n.WorkbookEditablePermission],worksheetTypes:[n.WorksheetSetCellStylePermission,n.WorksheetEditPermission],rangeTypes:[n.RangeProtectionPermissionEditPoint]})}},ct={[i.RibbonDataGroup.RULES]:{[Ge.id]:{order:1,menuItemFactory:st}}},lt=class extends t.Disposable{constructor(e,t){super(),this._injector=e,this._menuManagerService=t,G(this,`_sidebarDisposable`,null),this._menuManagerService.mergeMenu(ct)}};lt=q([K(0,(0,t.Inject)(t.Injector)),K(1,i.IMenuManagerService)],lt);let $=class extends t.Plugin{constructor(e=Ze,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},Ze,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(Xe,o),this._initCommand()}onStarting(){(0,t.registerDependencies)(this._injector,[[et],[Qe],[tt],[$e],[We],[lt],[J],[nt],[Ke],[it],[at],[X]]),(0,t.touchDependencies)(this._injector,[[et],[X]])}onReady(){(0,t.touchDependencies)(this._injector,[[lt],[We]])}onRendered(){(0,t.touchDependencies)(this._injector,[[tt],[Ke],[Qe],[nt],[J],[it],[$e],[at]])}_initCommand(){[h,g,_,v,y,b,x,S,C,Ge].forEach(e=>{this._commandService.registerCommand(e)})}};G($,`pluginName`,`${r.SHEET_CONDITIONAL_FORMATTING_PLUGIN}_UI_PLUGIN`),G($,`packageName`,Je),G($,`version`,Ye),G($,`type`,t.UniverInstanceType.UNIVER_SHEET),$=q([(0,t.DependentOn)(r.UniverSheetsConditionalFormattingPlugin,f.UniverSheetsFormulaPlugin),K(1,(0,t.Inject)(t.Injector)),K(2,(0,t.Inject)(t.ICommandService)),K(3,t.IConfigService)],$),e.AddAverageCfCommand=h,e.AddColorScaleConditionalRuleCommand=g,e.AddDataBarConditionalRuleCommand=_,e.AddDuplicateValuesCfCommand=v,e.AddNumberCfCommand=y,e.AddRankCfCommand=b,e.AddTextCfCommand=x,e.AddTimePeriodCfCommand=S,e.AddUniqueValuesCfCommand=C,Object.defineProperty(e,`ConditionalFormattingClearController`,{enumerable:!0,get:function(){return Ke}}),e.OpenConditionalFormattingOperator=Ge,Object.defineProperty(e,`UniverSheetsConditionalFormattingMobileUIPlugin`,{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,`UniverSheetsConditionalFormattingUIPlugin`,{enumerable:!0,get:function(){return $}})});
|
|
14
136
|
|
|
15
137
|
// index
|
|
16
138
|
(function(e,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/sheets-conditional-formatting"),require("@univerjs/sheets-conditional-formatting-ui"),require("@univerjs/sheets-conditional-formatting/lib/facade")):typeof define=="function"&&define.amd?define(["exports","@univerjs/sheets-conditional-formatting","@univerjs/sheets-conditional-formatting-ui","@univerjs/sheets-conditional-formatting/lib/facade"],i):(e=typeof globalThis<"u"?globalThis:e||self,i(e.UniverPresetSheetsConditionalFormatting={},e.UniverSheetsConditionalFormatting,e.UniverSheetsConditionalFormattingUi))})(this,(function(e,i,n){"use strict";function t(){return{plugins:[i.UniverSheetsConditionalFormattingPlugin,n.UniverSheetsConditionalFormattingUIPlugin].filter(o=>!!o)}}e.UniverSheetsConditionalFormattingPreset=t,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|