UNPKG

@mescius/spread-sheets

Version:

A Complete Microsoft Excel-like JavaScript Spreadsheet for Enterprise Applications

12 lines 4.82 MB
/*! * * SpreadJS Library 18.0.6 * * Copyright(c) MESCIUS inc. All rights reserved. * * Licensed under the SpreadJS Commercial License. * us.sales@mescius.com * https://developer.mescius.com/spreadjs * */ var GC;!function(){var e,i,t;function r(t){var n,n,n=i[t];return void 0!==n||(n=i[t]={exports:{}},e[t].call(n.exports,n,n.exports,r)),n.exports}e={"./all.entry.js":function(t,n,e){(GC=GC||{}).Spread=GC.Spread||{},GC.Spread=e("./node_modules_local/@spreadjs/js-sheets-common/index.js"),GC.Spread.CalcEngine=e("./node_modules_local/@spreadjs/js-calc/index.js"),GC.Spread.CalcEngine.BasicFunctions=e("./node_modules_local/@spreadjs/js-calc-basicfunctions/index.js"),GC.Spread.CalcEngine.AdvancedFunctions=e("./node_modules_local/@spreadjs/js-calc-advancedfunctions/index.js"),GC.Data=e("./node_modules_local/@spreadjs/js-data-manager/index.js"),GC.Spread.Sheets=e("./dist/core/core.entry.js"),GC.Spread.Sheets.Bindings=e("./dist/plugins/data/data.entry.js"),GC.Spread.Sheets.Outlines=e("./dist/plugins/group/group.entry.js"),GC.Spread.Sheets.CalcEngine=e("./dist/plugins/sheetsCalc/sheetsCalc.entry.js"),GC.Spread.Sheets.ConditionalFormatting=e("./dist/plugins/conditional/conditional.entry.js"),GC.Spread.Sheets.DataValidation=e("./dist/plugins/validation/datavalidation.entry.js"),GC.Spread.Sheets.Search=e("./dist/plugins/search/search.entry.js"),GC.Spread.Sheets.Touch=e("./dist/plugins/touch/touch.entry.js"),GC.Spread.Sheets.FloatingObjects=e("./dist/plugins/floatingObject/floatingobject.entry.js"),GC.Spread.Sheets.Sparklines=e("./dist/plugins/sparkline/sparkline-wrapper.entry.js"),GC.Spread.Sheets.Comments=e("./dist/plugins/comment/comment.entry.js"),GC.Spread.Sheets.CellState=e("./dist/plugins/cellState/cellstate.entry.js"),GC.Spread.Sheets.CellTypes=e("./dist/plugins/celltype/celltypes.entry.js"),GC.Spread.Sheets.Filter=e("./dist/plugins/filter/filter.entry.js"),GC.Spread.Sheets.Tables=e("./dist/plugins/table/table.entry.js"),GC.Spread.Sheets.Fill=e("./dist/plugins/fill/fill.entry.js"),GC.Spread.Sheets.ContextMenu=e("./dist/plugins/contextMenu/context-menu.entry.js"),GC.Spread.Sheets.FormulaTextBox=e("./dist/plugins/formulaTextbox/formulaTextBox.entry.js"),GC.Spread.Sheets.OutlineColumn=e("./dist/plugins/outlineColumn/outlineColumn.entry.js"),GC.Spread.Sheets.DragMerge=e("./dist/plugins/dragMerge/dragMerge.entry.js"),GC.Spread.Sheets.StatusBar=e("./dist/plugins/statusBar/statusBar.entry.js"),GC.Spread.Sheets.AutoMerge=e("./dist/plugins/autoMerge/autoMerge.js"),GC.Spread.Sheets.Hyperlink=e("./dist/plugins/hyperlink/hyperlink.js"),GC.Spread.Sheets.NameBox=e("./dist/plugins/namebox/namebox.entry.js"),GC.Spread.Sheets.Components=e("./dist/plugins/components/index.js"),GC.Spread.Sheets.InputMask=e("./dist/plugins/inputMask/inputMask.entry.js"),GC.Spread.Sheets.Spacing=e("./dist/plugins/spacing/spacing.entry.js"),GC.Spread.Sheets.DataRange=e("./dist/plugins/dataRange/dataRange.entry.js"),t.exports=GC.Spread},"./dist/core/celltype/basecelltype.js":function(e,u,t){"use strict";var c,v,ht,dt,g,Q,w,l,h,d,m,t,J,s,K,Mt,X,vt,y,M,q,L,it,C,F,S,T,$,tt,rt,j,nt,x,_,A,gt,k,pt,mt,Ct,bt,i,D,wt,St,O,o,N,E,r,R,B,P,I,G,U,n,a,H;function et(t){var n=t.isPrinting,t=t.printZoomFactor;return n&&typeof t===x&&1!==t}function z(t){var n;return!(t instanceof CanvasRenderingContext2D)&&!C(t._ae)}function V(t,n){var e,i,r,e=0,i=t.font+n,r=!z(t);return r&&o[i]?e=o[i]:(e=q(t,t.font,n),r&&(o[i]=e)),e}function b(){}function Y(t,n){var e;return n/2-t/2+(8<t?gt((t-8)/5+2):1)-1}function Z(t,n,e){return J(t.x)||(t.x+=n.width),t.width=t.width-n.width-e.width,t}function ot(t,n,e,i,r){var o,a,o=e+" - "+n+" - "+t;return u.wordWrapInfoCache||(u.wordWrapInfoCache={}),a=2e3,C(u.clearCacheTimer)&&(u.clearCacheTimer=setTimeout(function(){u.wordWrapInfoCache=null,u.clearCacheTimer=null},a)),u.wordWrapInfoCache[o]||(u.wordWrapInfoCache[o]=ht.q.un(t,n,e,!1,r)),u.wordWrapInfoCache[o]}function at(t,n){return dt.W.gfe(t,Q.IconPosition.left)&&(n+=1),dt.W.gfe(t,Q.IconPosition.right)&&(n+=2),n}function ut(t,n){return dt.W.gfe(t,Q.IconPosition.left)&&--n,dt.W.gfe(t,Q.IconPosition.right)&&(n-=2),n}function W(t,n,e){var t=t.text;return(t=e?(0,ht.W3e)(t):t)===n}function st(t){return t&&(ht.util.Yf(t)||ht.util.Hcr(t))}function ct(t,n){var e="inherit";return e=n&&"="!==n[0]&&(t===Q.TextDirectionType.rightToLeft||t===Q.TextDirectionType.context&&st(n))?"rtl":e}function f(){this.allowOverflow=!1,this.typeName="0"}function ft(t,n,e,i){var r,o,r=t.conditionalFormats;return r&&(o=t.getValue(n,e,i),r.O(n,e,i))&&r.U(t,n,e,o,i).iconSet}function lt(t,n,e){for(var i,r,o,i=0,r=0;r<t.length;r++)o=void 0,o=t[r].style&&t[r].style.font?t[r].style.font:n,i=Math.max(K(o,A,X(t[r].text))/e,i),(t[r].style&&1===t[r].style.vertAlign||2===t[r].style.vertAlign)&&(i=Math.max(K(o,A,X(t[r].text))/e+2*dt.W.V(o,O).fontSize*.218,i));return i}function xt(t,n,e,i,r){var o,a,u,s,c,f,o=ht.q.J();if(!o)return 0;for(u=a=0;u<t.length;u++)s=void 0,s=t[u].style&&t[u].style.font?t[u].style.font:n,t[u].style&&t[u].style.vertAlign&&(s=dt.W.V(s,O).font),vt(o,s),c="",c=u===t.length-1&&r?ht.q.tt(t[u].text):t[u].text,f=0,i?f=K(s)*c.length/e:J(t[u].text)||(f=q(o,s,t[u].text)/e),a+=f;return a}function Tt(t,n,e,i,r){var o,a,u,o;if(!ht.q.J())return 0;for(u=a=0;u<t.length;u++)a+=xt(t[u],n,e,i,r);return a}function At(t,n,e,i,r,o,a,u,s){var c,f,l,h,d,v,g,p,m,b,w,v,g,y,M,a,C,S,x,T,p,m,c=a.backColor,f=a.backgroundImage,l=a.isVerticalText,h=a.textIndent&&0!==a.textIndent,d=a.backgroundImageLayout,v=s.row,g=s.col,p=s.sheet,m=p.Jt,b=s.sheet&&s.sheet.getSpan(v,g,s.sheetArea),w=a&&(a.borderLeft||a.borderTop||a.borderRight||a.borderBottom),y=0,M=n,a=p.options.rightToLeft&&bt(a.textOrientation)<90?-a.textOrientation:a.textOrientation;t.save(),g+1<p.getColumnCount()&&(x=m.qt(v,g+1)),0<=g-1&&(T=m.qt(v,g-1)),p=function(t){return t!==A&&t&&-90<=t&&t<=90},m=function(){t.fillRect(n,e,i,r)},a&&0!==a&&w&&u&&!b&&!l&&!h&&(v=bt(a*Math.PI/180),g=Ct(v),y=gt(r/g),-90<a&&a<0&&(x&&!p(x.textOrientation)&&(S=x.backColor),M=n-y),0<a&&a<90&&(T&&!p(T.textOrientation)&&(S=T.backColor),M=n+y),C=function(){t.beginPath(),t.moveTo(M,e),t.lineTo(M+i,e),t.lineTo(n+i,e+r),t.lineTo(n,e+r),t.fill()}),c&&(S&&dt.W.setFillStyle(t,S,n,e,i,r,m),C?dt.W.setFillStyle(t,c,Math.min(M,n),e,i+y,r,C):c!==s.parentBackColor&&dt.W.setFillStyle(t,c,n,e,i,r,m)),I.nt(t,n,e,i,r,f,d,o),t.restore()}function It(t,n,e,i,r,o,a){var t;(0===t||5===t||a)&&ft(n,e,i,r)&&(t=kt(n),o.x+=t,o.width-=t)}function kt(t){return parseInt(j*t.zoom(),10)}function yt(t,n,e,i){var r=t.cellPadding,o=0,t=t.labelOptions;return(r=e?t?t.margin:"0":r)&&(o=typeof(o=parseInt(Rt(r)[n],10))===x&&0<o?o:0),i===A?o:o*i}function Nt(t){var n={context:t,value:0};return a.et(t.sheet,"getOutlineColumnOffset",n),n.value}function jt(t,n){var n={context:t,value:0,cellStyle:n};return a.et(t.sheet,"getCellButtonAutoWidth",n),n.value}function Dt(t,n){var n={context:t,value:0,cellStyle:n};return gn(n),a.et(t.sheet,"getSpecialIconsAutoWidth",n),n.value}function _t(t,n){var n={context:t,value:0,cellStyle:n};return a.et(t.sheet,"getCellButtonAutoHeight",n),n.value}function Ot(t,n){var n={context:t,value:0,cellStyle:n};return pn(n),a.et(t.sheet,"getSpecialIconsAutoHeight",n),n.value}function Et(t,n,e,i){var r,i,r,n,o,r=i&&i.sheet;r&&e&&(i=i.canvasOffset||r.rt.it(),r=r.ot(),(n=(n=n.backColor||"white").stops?(o=n.stops)[0]&&o[0].color:n).backgroundColor&&(n=n.backgroundColor),(0,v.GC$)(t).width(e.width).height(e.height).css({top:i.top+r.y+e.y-2,left:i.left+r.x+e.x-2,"background-color":n}))}function Rt(t){var n,t,e,i,r,n=["0","0","0","0"];return typeof t===nt&&(r=i=void 0,1===(e=(t=t.split(" ",4)).length)?n=[i=t[0],i,i,i]:2===e?n=[i=t[0],r=t[1],i,r]:3===e?(r=t[1],n=[t[0],r,t[2],r]):4===e&&(n=[t[0],t[1],t[2],t[3]])),n}function Lt(t,n){var e,i,r,o,a,e=yt(t,0),i=yt(t,2),r=yt(t,0,!0),o=yt(t,2,!0);if(!(yt(t,3,!0)+yt(t,1,!0)>=n.width))if(0===(a=(a=t.labelOptions.alignment)===A?t.labelOptions.alignment=0:a)||1===a||2===a){if(0<e&&r+o<e)return 1}else if((3===a||4===a||5===a)&&e<n.height&&0<i&&r+o<i)return 1}function Ft(t,n){var e,i,r,o,a,e=yt(n,0),i=yt(n,3,!0),r=yt(n,2,!0),o=t.clone(),a=n.labelOptions.alignment;return 0===a||1===a||2===a?e<t.height&&(o.height=e-r+1):3!==a&&4!==a&&5!==a||(o.height=t.height-r),o.x+=i,o.width-=i+yt(n,1,!0),o}function Bt(t){var n="left";return 1===t||4===t?n="center":2!==t&&5!==t||(n="right"),n}function Pt(t,n,e,i){var r,e,o,a,u,s,c,t,f,l,h,i,d,v,r=new ht.Point(t.x,t.y),e=parseInt(e.fontSize,10),o=yt(n,0),a=yt(n,2),u=yt(n,3,!0),s=yt(n,1,!0),c=t.width,t=t.height,f,l,h=8<e?1:2,i=i-(i/2-e/2+(8<e?Math.floor((e-8)/5+2):1)-1)+yt(n,0,!0),d=i+1,v=t<o+a?o+i:t-a+i-1;switch(n.labelOptions.alignment){case 0:r.x+=u+h+1,r.y+=d;break;case 1:r.x+=u+(c-u-s)/2,r.y+=d;break;case 2:r.x+=c-s-2,r.y+=d;break;case 3:r.x+=u+h+1,r.y+=v;break;case 4:r.x+=u+(c-u-s)/2,r.y+=v;break;case 5:r.x+=c-s-2,r.y+=v}return r}function Gt(t,n){var e,i,r,o,a,u,e=yt(n,3,!0),i=yt(n,1,!0),r=yt(n,0,!0),o=yt(n,2,!0),a=t.clone(),u=n.labelOptions.alignment;return a.x=e+1,a.width-=e+i,0===u||1===u||2===u?(a.y=r,a.height=yt(n,0)-r-o):3!==u&&4!==u&&5!==u||(a.y=t.height-yt(n,2)+r,a.height=yt(n,2)-r-o),2!==u&&5!==u||(a.width-=2),a}function Ut(t,n,e,i){var r,o;if(s(n,nt))return V(t,n);if(e&&n&&n[0]&&n[0].value)return n[0].value.length*K(t.font);for(i&&Array.isArray(n)&&(n=(0,ht.getTextContentWithoutEndBlank)(n)),o=r=0;o<n.length;o++)"fillingChar"!==n[o].type&&(r+=V(t,n[o].value));return r}function Ht(t){for(var n,e,i,r,o,a,e=null==(n=t[0])?void 0:n.type,i=0,r=[t[0]],o=1;o<t.length;o++)a=t[o],e===D&&a.type===D?r[i].value+=a.value:(r.push(a),e=a.type,i++);return r}function zt(t,n,e,i,r){var i,i=i?Math.floor(n/r):Math.floor(n/q(t,t.font,e));return new Array(i+1).join(e)}function Vt(t){var t=t.clone();return t.width--,t.height--,t}function Yt(t,n,e,i){for(var r,o,a,r=0;r<t.length;r++)o=void 0,t[r].style=t[r].style||{},(a=t[r].style).font?(o=dt.W.V(a.font,e).font,J(i)||(o=dt.W.V(o,i).font)):o="object"==typeof n?n.font:n,a.font=o}function Zt(t,n,e,i,r){var o=e*mt(-i)+r*pt(-i),e=e*mt(-i)+r*pt(-i),a,u;return new ht.Rect(t-o/2,n-e/2,o,e)}function Wt(t){return"string"==typeof t.src&&0<t.src.length&&-1===t.src.indexOf("<script")}function Qt(t,n,e,i){var r,r,r,o;C(e)||(a.et(i.sheet,"beforePaintDecoration",o={context:i,style:e}),null!=(r=e.decoration)&&r.cornerFold&&Jt(t,n,e.decoration.cornerFold,i),0<(null==(r=null==(r=e.decoration)?void 0:r.icons)?void 0:r.length)&&Kt(t,n,e.decoration.icons.filter(Wt),e.vAlign,i))}function Jt(t,n,e,i){var r,o,e,a,u,s,n,c,r,i,e,f,l,h,d,r=e.size,o=e.position,e=e.color;C(r)&&(r=6),C(o)&&(o=g.CornerPosition.leftTop),a=n.x,u=n.y,s=n.height,n=n.width,r=r*(c=i.sheet).zoom(),t&&0<n&&0<s&&(t.save(),t.rect(a,u,n,s),t.clip(),t.fillStyle=e||"#FF3D00",t.beginPath(),t.fillStyle=e,d=h=l=f=e=i=void 0,o&g.CornerPosition.leftTop&&(f=i=a,l=(e=u)+r,h=i+r,d=e,t.moveTo(i,e),t.lineTo(f,l),t.lineTo(h,d),t.fill()),o&g.CornerPosition.rightBottom&&(l=(e=u+s)-r,h=(f=i=a+n)-r,d=e,t.moveTo(i,e),t.lineTo(f,l),t.lineTo(h,d),t.fill()),o&g.CornerPosition.leftBottom&&(f=i=a,l=(e=u+s)-r,h=i+r,d=e,t.moveTo(i,e),t.lineTo(f,l),t.lineTo(h,d),t.fill()),o&g.CornerPosition.rightTop&&(l=(e=u)+r,h=(f=i=a+n)-r,d=e,t.moveTo(i,e),t.lineTo(f,l),t.lineTo(h,d),t.fill()),t.closePath(),t.restore())}function Kt(t,n,e,i,r){var o,e,a,a,u,s,c;!r.cellOverflowLayout&&0<e.length&&(o=e.filter(function(t){return C(t.position)||t.position===Q.IconPosition.left}),e=e.filter(function(t){return t.position===Q.IconPosition.right}),0<(a=o.concat(e)).length)&&(dn(a,r),t)&&(a=vn(n.clone(),r),t.save(),t.rect(a.x,a.y,a.width,a.height),t.clip(),t.beginPath(),s=u=a.x,c=a.x+a.width,0<o.length&&(s=u=en(t,o,a,i,r)),0<e.length&&(c=u=tn(t,e,a,i,r)),t.restore(),n.width=n.x+n.width-(a.x+a.width-c)-s,n.x=s)}function Xt(t,n,e,i,r){var o,e,a,u;t&&0<e.length&&(o=e.filter(function(t){return t.position===Q.IconPosition.outsideLeft&&Wt(t)}),e=e.filter(function(t){return t.position===Q.IconPosition.outsideRight&&Wt(t)}),a=3,u=n.x,0<o.length||0<e.length)&&(dn(o,r),dn(e,r),2===r.columnHeaderFitMode&&r.cornerX&&((n=n.clone()).height=n.height-(r.cornerY-n.y)-1,n.y=r.cornerY-1),0<o.length&&(n.x=u-3,qt(t,o,n,i,r)),0<e.length)&&(n.x=u+3,$t(t,e,n,i,r))}function qt(t,n,e,i,r){nn(t,n,e.x,e,i,r)}function $t(t,n,e,i,r){rn(t,n,e.x+e.width,e,i,r)}function tn(t,n,e,i,r){return nn(t,n,e.x+e.width,e,i,r)}function nn(t,n,e,i,r,o){var a,u,s,c,a,u;for(e-=ln(o),s=n.length-1;0<=s;s--)e-=c=p(o,n[s],"width"),an(t,n[s],e,i.y,c,i.height,o,i,r);return e}function en(t,n,e,i,r){return rn(t,n,e.x,e,i,r)}function rn(t,n,e,i,r,o){var a,u,s,c,a,u;for(e+=ln(o),s=0;s<n.length;s++)c=p(o,n[s],"width"),an(t,n[s],e,i.y,c,i.height,o,i,r),e+=c;return e}function on(t,n){var e,i,r,o,n,a,t,u,u,n,e=n.ctx,i=n.style,r=n.context,o=n.textRect,n=n.availRect;!C(i.decoration)&&e&&(a="beforeFillTextArea"===t?Q.IconPosition.leftOfText:Q.IconPosition.rightOfText,t=i.decoration.icons&&i.decoration.icons.filter(function(t){return t.position===a&&Wt(t)}))&&0<t.length&&(dn(t,r),2===r.columnHeaderFitMode&&r.cornerX&&(u=r.cellRect.x+r.cellRect.width-(n.x+n.width),(n=n.clone()).width=r.cornerX-n.x-u,n.height=n.height-(r.cornerY-n.y)-1,n.y=r.cornerY-1),u=void 0,n=cn(n,o,a),e.save(),e.rect(n.x,n.y,n.width,n.height),e.clip(),e.beginPath(),a===Q.IconPosition.leftOfText?(u=tn(e,t,n,i.vAlign,r),o.x=u):(u=en(e,t,n,i.vAlign,r),o.width=u-o.x),e.restore())}function an(t,n,e,i,r,o,a,u,s){var c,f,l,e,r,o,h,s,n,a,n,h,i,d;t.save(),t.beginPath(),t.rect(e,i,r,o),t.clip(),c=0,f=hn(a),l=n.src,f.getState(l)?f.qh(l)&&(e=new ht.Rect(e,i,r,o),r=p(a,n,"width"),o=p(a,n,"height"),s=fn(e,h=new ht.Rect(0,0,r,o),s,ln(a)),n.position!==Q.IconPosition.leftOfText&&n.position!==Q.IconPosition.rightOfText||((n=a.textRect)&&(s.y=wt(n.y-n.height/2-h.height/2,i+4)),s.y+s.height>e.y+e.height&&(s.y=wt(s.y-(s.y+s.height-e.y-e.height),e.y))),n=(a=f.getImage(l)).width,h=a.height,ht.mt.Tt.msie&&(E[l]||(a.style.position="absolute",a.style.left="-10000px",a.style.top="-100000px",document.body.appendChild(a),E[l]={width:a.width,height:a.height},document.body.removeChild(a)),n=E[l].width,h=E[l].height),u&&ht.mt.Tt.msie&&s.x+s.width>u.x+u.width?0<(i=c=u.x+u.width-s.x)&&t.drawImage(a,0,0,i*(d=n/r),h,k(s.x),k(s.y),i,o):(c=r,t.drawImage(a,0,0,n,h,k(s.x),k(s.y),c,o))):f.addImage(l,"anonymous"),t.restore()}function un(t){var n=t.context,e=t.style,t=t.externals;dt.W.Xue(e)&&(t.left=t.left.concat(sn(n,e,Q.IconPosition.leftOfText)),t.right=t.right.concat(sn(n,e,Q.IconPosition.rightOfText)))}function sn(n,t,e){for(var i,r,o,a,i=!1,r=0,o=t.decoration.icons;r<o.length;r++)if((a=o[r]).Ltr){i=!0;break}return t.decoration.icons.filter(function(t){return t.position===e&&(!n.cellOverflowLayout||i)}).map(function(t){return{width:p(n,t,"width"),height:p(n,t,"height"),isStick:t.Ltr}})}function cn(t,n,e){switch(e){case Q.IconPosition.leftOfText:return new ht.Rect(t.x,t.y,n.x-t.x,t.height);case Q.IconPosition.rightOfText:return new ht.Rect(n.x+n.width,t.y,t.x+t.width-n.x-n.width,t.height)}}function fn(t,n,e,i){var r,o=2*i;switch(e){case Q.VerticalAlign.top:r=0+o;break;case Q.VerticalAlign.bottom:r=Math.max(0,t.height-n.height)-o;break;default:r=Math.max(0,(t.height-n.height)/2)}return new ht.Rect(t.x,t.y+r,Math.min(n.width,t.width),Math.min(n.height,t.height))}function ln(t){return et(t)?t.printZoomFactor:t.sheet.zoom()}function p(t,n,e){var n=n[e],e=ln(t);return(n=C(n)||isNaN(n)||n<=0?12:n)*e}function hn(t){var n=t.sheet,e;return n.MC||t.imageLoader||n.BO()}function dn(t,n){for(var e,i,r,e=hn(n),i=0;i<t.length;i++)(r=t[i].src)&&e.addImage(r,"anonymous")}function vn(t,n){return 2===n.columnHeaderFitMode&&n.cornerX&&(t.width=n.cornerX-t.x,t.height=t.height-(n.cornerY-t.y)-1,t.y=n.cornerY-1),t}function gn(t){mn(t,"width")}function pn(t){mn(t,"height")}function mn(t,n){var e,i,r,o,a,e=t.cellStyle;if(e.decoration&&e.decoration.icons&&0!==e.decoration.icons.length){for(i=e.decoration.icons,o=r=0;o<i.length;o++)a=i[o],dt.W.Kue(a)&&(r+=p(t.context,a,n));t.value=r}}function bn(t,n,e){var n,i,t,r,o,e,i,n=(t.length-1)*n,i=t[0],t=t[t.length-1],r,o=document.createElement("canvas").getContext("2d");return o.font=e.font,e=o.measureText(i),i=o.measureText(t),{height:n=e.actualBoundingBoxAscent+i.actualBoundingBoxDescent+n,descenderHeight:i.actualBoundingBoxDescent}}function wn(t,n,e,i,r,o,a,u){var s,c,f,l,h,s=e.content;if(s&&0<s.length)for(l=0<(l=o-a-(f=Ut(t,s,!0))-2)?l:0,h=void 0,c=0;c<s.length;c++)"fillingChar"===s[c].type||"numberPlaceholder"===s[c].type?r+=l:"placeholder"===s[c].type?r+=s[c].value?s[c].value.length*u:0:r+=h=s[c].value?s[c].value.length*u:0;else if(n)for(c=0;c<n.length;c++)r=yn(t,n[c],i,r).y;return r}function yn(t,n,e,i){var t,r,o,a;if(n&&0<n.length)for(t=t.font,r=K(t,A,X(n)),o=Y(dt.W.V(t,1).fontSize,r),a=0;a<n.length;a++)i=i+r-o,i+=o;return{x:e,y:i}}Object.defineProperty(u,"__esModule",{value:!0}),u.Context=u.Base=u.paintStyleDecorationOutSideIcons=u.paintDecoration=u.cellTypeContext_paintBackground=u.clearCacheTimer=u.wordWrapInfoCache=u.isPrintZoomFactorExist=void 0,c=t("Common"),v=t("./dist/core/util/domUtil.js"),ht=t("./dist/core/util/common.js"),dt=t("./dist/core/worksheet/stylehelper.js"),g=t("./dist/core/core.interface.js"),Q=t("./dist/core/core.enum.js"),w=t("./dist/core/celltype/celltype.ns.js"),l=t("CalcEngine"),h=c.Common.CultureManager,d=c.Common.st,m=c.Common.ct,t=c.Common.lt,J=t.ht,s=t.dt,K=ht.mt.vt,Mt=ht.mt.gt,X=ht.mt.pt,vt=ht.mt.bt,y=ht.mt.yt,M=ht.mt.wt,q=ht.mt.Mt,L=ht.mt.Ct,it=ht.mt.St,C=c.Common.lt.ht,F=v.GC$.extend,S=ht.mt.Tt,T="left",$="right",tt="center",rt="alphabetic",j=16,nt="string",x="number",_=null,A=void 0,gt=Math.floor,k=Math.ceil,pt=Math.sin,mt=Math.cos,Ct=Math.tan,bt=Math.abs,i="General",D="text",wt=Math.max,St=Math.min,O=.7,o={},N="...",E={},R=" ",B=new RegExp(r="\xa0","g"),H=P={top:0,0:"top",right:1,1:"right",bottom:2,2:"bottom",left:3,3:"left"},u.isPrintZoomFactorExist=et,b.At=function(t){var t,n,e,t=t.split("e")[1];if(t&&0<t.length&&("+"===t[0]?n=!0:"-"===t[0]&&(n=!1),e=t.slice(1)),void 0!==n)return{isAdd:n,length:e}},b.It=function(t,n,e){var i,r,i=b.xt,r=i[n+e];return r||(r=q(t,n,e),i[n+e]=r),r},b.Nt=function(t,n,e,i,r){var o,r,a,a,r,a,u,s,s,c,u,f,a,l,h,o,d,v,g,p,m,o=i.font;if(e=e-1-ut(i,3)*r,r=i.textIndent&&0!==i.textIndent,a=i.isVerticalText,typeof n!==x||!0===i.shrinkToFit||a||r)return i._autoFormatter;if(a=n<0,n=bt(n),r=a?b.It(t,o,"-"):0,a=n.toString(),(u=b.At(a))&&!1===u.isAdd&&(s=ht.mt.toPlainString(n)).split(".")[1].length<10&&(a=s,u=A),s=void 0,c=b.Dt(i._autoFormatter,n),u)return s=u.length.toString().length,s=wt(s,2),b._t(t,e,i,s,r,u.isAdd,c);if(u=r,f=b.It(t,o,"0"),a=a.split("."),u+=h=f*(l=Math.round(n).toString().length),o=b.It(t,o,"."),d=void 0,h<=e){if(!a[1]||0===a[1].length)return i._autoFormatter;if((u=u+a[1].length*f+o)<=e)return i._autoFormatter;if(n<.001)return s=a[1].length.toString().length,s=wt(s,2),b._t(t,e,i,s,r,!1,c);for(g=Math.floor((v=e-r-h-o)/f),d="0",0<(g=Math.min(g,a[1].length))&&(d+="."),p=0;p<g;p++)d+="0";return d}return s=(m=Math.round(n)).toString().length.toString().length,s=wt(s,2),b._t(t,e,i,s,r,!0,c)},b._t=function(t,n,e,i,r,o,a){var e,u,s,c,f,l,h,n,r,d,v,g,e=e.font,u=b.It(t,e,"0"),s=b.It(t,e,"E"),c=b.It(t,e,"+"),f=b.It(t,e,"-"),l,h,n=n-r-i*u-s-(o?c:f)-u,r=n-b.It(t,e,".");if(r<=u)return o?"0E+00":0<n?"0E-00":"0";for(d=Math.floor(r/u),d=Math.min(d,a),v="0",g=0;g<d;g++)0===g&&(v+="."),v+="0";return v+=o?"E+00":"E-00"},b.Et=function(t,n,e,i,r){var o,r,a,u,s,i,c,f,l,o=i.font;if(e=e-1-ut(i,3)*r,r=i.textIndent||0,u=e,(u=1!==(a=i.hAlign)&&0<r?e-8*r:e)<(s=q(t,o,n))){for(i=b.It(t,o,"#"),c=Math.floor(e/i),f="",l=0;l<c;l++)f+="#";return f}return n},b.nt=function(t,n,e,i,r,o,a,u){var s,c,f,l,h,d,v,g,p,m,b,w;if(o&&"none"!==o&&u)try{u.getState(o)?(s=u.getImage(o),c=void 0,S.msie&&((c=document.createElement("div")).appendChild(s),document.body.appendChild(c)),f=s.width,l=s.height,S.msie&&(c.removeChild(s),document.body.removeChild(c)),d=h=0,v=f,g=l,p=i,m=r,b=n,w=e,1===a?(v=f<=i?f:i,g=l<=r?l:r,b=f<i&&0<f?k(n+i/2-f/2):n,w=l<r&&0<l?k(e+r/2-l/2):e,p=v,m=g):2===a?0<r&&0<l&&f/l<i/r?b=n+i/2-(p=f/l*r)/2:0<i&&0<f&&l/f<r/i&&(w=e+r/2-(m=l/f*i)/2):3===a&&(p=v=f<=i?f:i,m=g=l<=r?l:r),t.drawImage(s,0,0,v,g,b,w,p,m)):u.addImage(o)}catch(t){}},b.Bt=function(t,n,e,i,r){var o,a,u,s,c,f,l,h,d,v,g,p,m,b,w,b,y,M,C,S,C,x,T,A,S,t,C,I,k,N,t,o=0,a=r&&r.sheet,u=r.sheetArea,s=r.row,c=r.col,f=e.textIndent,l=e.hAlign,h=e.isVerticalText,d,v=1===u&&1===a.Lt(c)?-90:e.textOrientation,g=e.borderTop||e.borderBottom||e.borderLeft||e.borderRight,w=e.font;if(v&&-90<=v&&v<=90&&(b=bt(v*Math.PI/180),m=pt(b),b=mt(b)),a&&typeof n===nt&&n)if(y=[],M=void 0,t&&t.richText)if(t={text:(t=t.converted?t:ht.util.g0(t)).text,richText:t.converted},C=e.formatter||e._autoFormatter,C=(S=a.getCellType(s,c,u)).Ft(C,t.text),Yt(M=F(!0,[],S.Pt(t,n,C,w,e.foreColor)),w,i),h)if(e.wordWrap||5===l){if(x=a.Gt(s,u),(T=a.getSpan(s,c,u))&&T.row>=s&&T.col>=c&&1<T.rowCount)for(A=s+1;A<s+T.rowCount;A++)x+=a.Gt(A,u);for((S=0)<f&&(S=8*f*i),0<(t=yt(e,0))&&(x-=t),0<(C=yt(e,2))&&(x-=C),x++,y=ht.q.Ht((0,ht.W3e)(n),x-ut(e,3)-S,w,M,h),p=0;p<y.length;p++)o+=lt(y[p].textInfos,w,i)}else o=lt(M,w,i);else{if(e.wordWrap||5===l){for(I=(0,ht.W3e)(n).split(/\r\n|\r|\n/),p=0;p<I.length;p++)y.push((0,ht.zt)(I[p]));for(y=ht.q.Vt(y,ht.q.Yt(M)),p=0;p<y.length;p++)o=Math.max(o,Tt(y[p],w,i,h,!0))}else o=xt(M,w,i);0<f&&4!==l&&(o+=1===l||5===l?8*f*2:8*f),ft(a,s,c,r.sheetArea)&&(o+=kt(a))}else if(y=(0,ht.W3e)(n).split(/\r\n|\r|\n/),N=K(k=w)/i,h)if(e.wordWrap||5===l)for(p=0;p<y.length;p++)o+=N;else o=N;else{if(e.wordWrap||5===l){if(v)return t=a.Gt(s,u),ht.q.Zt(s,c,m,b,n,k,t);for(p=0;p<y.length;p++)o=Math.max(o,ht.q.Wt(y[p],k,!0)/i)}else o=v?g?(4+N)/m:b*(a.Qt(n,k)/i)+N*m:4===e.hAlign?a.Jt.Kt(c,u):a.Qt(n,k)/i;0<f&&4!==l&&(o+=1===l||5===l?8*f*2:8*f),ft(a,s,c,r.sheetArea)&&(o+=j)}return o},b.Xt=function(t,n,e,i){for(var r,o,a,u,r=t.Jt.Kt(e,i),o=e+1;o<t.getColumnCount(i)&&(a=t.Jt.qt(n,o,i),u=t.Jt.$t(n,o,i,1,{style:a}),C(u))&&!a.watermark&&!(a.cellType&&"1"!==a.cellType.typeName||a.cellButtons&&0<a.cellButtons.length||dt.W.Jue(a))&&4===a.hAlign;o++)r+=t.Jt.Kt(o,i);return r},b.tn=function(t,n,e,i,r){var o,a,u,s,c,f,l,h,d,v,g,p,m,b,w,y,M,C,S,x,T,h,A,I,k,N,h,j,h,T,D,T,_,D,O,E,l,R,f,x,S,T,h,o=0,u=r&&r.sheet,s=e.font,c=e.isVerticalText,f=e.textIndent,l=e.vAlign,h=e.hAlign,d=e.textOrientation,v=r.row,g=r.col,p=r.sheetArea,k=u.outlineColumn&&u.outlineColumn.Un(g),N=0<f?8*f*i:0;if(1!==h&&5!==h||(N*=2),d&&-90<=d&&d<=90&&(h=bt(d*Math.PI/180),A=pt(h),I=mt(h)),u&&typeof n===nt&&n)if(j=[],h=void 0,t&&t.richText)if(t={text:(t=t.converted?t:ht.util.g0(t)).text,richText:t.converted},T=e.formatter||e._autoFormatter,T=(D=u.getCellType(v,g,p)).Ft(T,t.text),Yt(h=F(!0,[],D.Pt(t,n,T,s,e.foreColor)),s,i),c){if(e.wordWrap||5===e.hAlign){for(_=(0,ht.W3e)(n).split(/\r\n|\r|\n/),a=0;a<_.length;a++)j.push((0,ht.zt)(_[a]));for(j=ht.q.Vt(j,ht.q.Yt(h)),a=0;a<j.length;a++)o=Math.max(o,Tt(j[a],s,i,c,!0))}else o=xt(h,s,i,c);0<f&&(o+=1===l?8*f*2:8*f)}else if(e.wordWrap||5===e.hAlign){if(m=u.nn(g,p),(y=u.getSpan(v,g,p))&&y.row>=v&&y.col>=g&&1<y.colCount)for(M=g+1;M<g+y.colCount;M++)m+=u.nn(M,p);for(S=yt(e,1),0<(x=yt(e,3))&&(m-=x),0<S&&(m-=S),m++,j=ht.q.Ht((0,ht.W3e)(n),m-ut(e,3)-N,s,h),a=0;a<j.length;a++)o+=lt(j[a].textInfos,s,i)}else o=lt(h,s,i);else if(D=e.font,O=K(D)/i,c){if(e.wordWrap||5===e.hAlign)for(j=(0,ht.W3e)(n).split(/\r\n|\r|\n/),a=0;a<j.length;a++)E=j[a].length*O,o=Math.max(o,E);else o=n.length*O;0<f&&(o+=1===l?8*f*2:8*f)}else if(e.wordWrap||5===e.hAlign){if(p=r.sheetArea,m=4===e.hAlign?this.Xt(r.sheet,v,g,p):u.nn(g,p),b=u.Gt(v,p),(y=u.getSpan(v,g,p))&&y.row>=v&&y.col>=g&&1<y.colCount){for(M=g+1;M<g+y.colCount;M++)m+=u.nn(M,p);for(C=v+1;C<v+y.rowCount;C++)b+=u.Gt(C,p)}if(S=yt(e,1),0<(x=yt(e,3))&&(m-=x),0<S&&(m-=S),0<(T=yt(e,0))&&(b-=T),0<(h=yt(e,2))&&(b-=h),e.cellButtons&&0<e.cellButtons.length&&(m-=jt(r,e)),dt.W.Jue(e)&&(m-=Dt(r,e)),e.cellType&&e.cellType.Tfe&&(m-=e.cellType.Tfe(i)),1===p&&(R=!!((l=u.rowFilter&&u.rowFilter())&&l.rn(v,g,p)&&l.filterButtonVisible(g)))&&(m-=u.an(new ht.Rect(0,0,m,b),p).width),d)return f=(b-O*I)/A,j=ht.q.un((0,ht.W3e)(n),f,D),o=A*(w=u.Qt(j[0],D)/i)+O*I;o=(j=L(t)?[n]:(x=N,!k||p===Q.SheetArea.colHeader&&u.NMi||(S=u.outlineColumn.ost())&&(T=S[v])&&(h=T.cellContent)&&"number"==typeof h.left&&(x=h.left),ht.q.un((0,ht.W3e)(n),m-ut(e,3)-x,D))).length*O}else o=d?A*(w=u.Qt(n,D)/i)+O*I:O;return o},b.cn=function(t,n,e,i,r,o,a,u,s,c,f,l){var h;1===s?(t.beginPath(),(h=t.createLinearGradient(n,e+1,n,e+r-2)).addColorStop(0,u.borderLeftColor),h.addColorStop(1,u.borderRightColor),t.strokeStyle!==h&&(t.strokeStyle=h),o.borderLeft||(t.moveTo(n+.5,e),t.lineTo(n+.5,e+r)),o.borderRight||(t.moveTo(n+i-.5,e),t.lineTo(n+i-.5,e+r)),c&&!o.borderTop&&(t.moveTo(n,e+.5),t.lineTo(n+i,e+.5)),t.stroke(),u.borderBottomWidth&&!o.borderBottom&&(t.beginPath(),t.strokeStyle!==u.borderBottomColor&&(t.strokeStyle=u.borderBottomColor),t.moveTo(n+1,e+r-.5),t.lineTo(n+i,e+r-.5),t.stroke())):(t.beginPath(),(h=t.createLinearGradient(n,e,n+i-2,e)).addColorStop(0,u.borderTopColor),h.addColorStop(1,u.borderBottomColor),t.strokeStyle!==h&&(t.strokeStyle=h),o.borderTop||(t.moveTo(n,e+.5),t.lineTo(n+i,e+.5)),o.borderBottom||(t.moveTo(n,e+r-.5),t.lineTo(n+i,e+r-.5)),f&&!o.borderLeft&&(t.moveTo(n+.5,e),t.lineTo(n+.5,e+r)),t.stroke(),!u.borderRightWidth||o.borderRight||l||(t.beginPath(),t.strokeStyle!==u.borderRightColor&&(t.strokeStyle=u.borderRightColor),t.moveTo(n+i-.5,e+1),t.lineTo(n+i-.5,e+r),t.stroke()))},b.hn=function(t,n){var n,n=2===n?"active":4===n?"inactive":0===n?"disabled":"auto";(0,v.GC$)(t).css("ime-mode",n)},b.dn=function(t,n,e,i,r,o,a){var u,s,s,c,f;return!!(n&&"SparklineExValue"===n.typeName&&(s=(u=a.sheet)&&u.parent)&&(s=s.getSparklineEx(n.name)))&&(f={zoomFactor:c=et(a)?a.printZoomFactor:u.zoom(),sheet:u,rowIndex:a.row,columnIndex:a.col,isPrinting:a.isPrinting},2===a.columnHeaderFitMode&&(r=u.getColumnWidth(a.col,a.sheetArea)+1),s.paint(t,n.value,e,i,r,o,f),!0)},b.xt={},b.Dt=function(t,n){var e,t,n,n,t,t;return t&&t.vn&&(t=(e=t.vn(n)).format(n))&&t[1]&&"decimalSeparator"===t[1].type?(n=t[2])&&n.type===x?(n=n.value,t=(t=t[3])&&"exponent"===t.type&&t.value&&-1<t.value.indexOf("E"),!J(n)&&t?n.length:5):0:5},b.gn=yt,I=b,u.Context=I,U={"\u3008":w.VCRT.DEG90,"\u3009":w.VCRT.DEG90,"\u300c":w.VCRT.DEG90,"\u300d":w.VCRT.DEG90,"\uff62":w.VCRT.DEG90,"\uff63":w.VCRT.DEG90,"(":w.VCRT.DEG90,")":w.VCRT.DEG90,"[":w.VCRT.DEG90,"]":w.VCRT.DEG90,"\uff3b":w.VCRT.DEG90,"\uff3d":w.VCRT.DEG90,"{":w.VCRT.DEG90,"}":w.VCRT.DEG90,"\uff5b":w.VCRT.DEG90,"\uff5d":w.VCRT.DEG90,"\u3016":w.VCRT.DEG90,"\u3017":w.VCRT.DEG90,"\u3014":w.VCRT.DEG90,"\u3015":w.VCRT.DEG90,"\u3010":w.VCRT.DEG90,"\u3011":w.VCRT.DEG90,"\u300a":w.VCRT.DEG90,"\u300b":w.VCRT.DEG90,"\u300e":w.VCRT.DEG90,"\u300f":w.VCRT.DEG90,"\uff08":w.VCRT.DEG90,"\uff09":w.VCRT.DEG90,"\uff1d":w.VCRT.DEG90,"\uff3f":w.VCRT.DEG90,"\uff5c":w.VCRT.DEG90,"\uff5e":w.VCRT.DEG90_FLIP_V,"\u30fc":w.VCRT.DEG90,"<":w.VCRT.DEG90,">":w.VCRT.DEG90,"\u3001":w.VCRT.DEG90_FLIP_H,"\u3002":w.VCRT.DEG90},n={},(G=['"\uff2d\uff33 \u30b4\u30b7\u30c3\u30af"','"\uff2d\uff33 \uff30\u30b4\u30b7\u30c3\u30af"','"\uff2d\uff33 \u660e\u671d"','"\uff2d\uff33 \uff30\u660e\u671d"','"MS UI Gothic"',"\u30e1\u30a4\u30ea\u30aa","Meiryo",'"Meiryo UI"','"Yu Gothic"','"Yu Gothic UI"','"Yu Mincho"',"\u6e38\u30b4\u30b7\u30c3\u30af","\u6e38\u660e\u671d",'"MS Gothic"','"MS PGothic"','"MS Mincho"','"MS PMincho"']).forEach(function(t){n[t]=(0,ht.RF)(U),n[t]["\ufe5b"]=w.VCRT.DEG90,n[t]["\ufe5c"]=w.VCRT.DEG90,n[t]["\ufe5d"]=w.VCRT.DEG90,n[t]["\ufe5e"]=w.VCRT.DEG90,n[t]["\u2015"]=w.VCRT.DEG90}),["\u7b49\u7ebf",'"\u7b49\u7ebf Light"'].forEach(function(t){n[t]=(0,ht.RF)(U),n[t]["\uff5e"]=w.VCRT.DEG90}),["Aptos",'"Aptos Light"',"Calibri",'"Calibri Light"',"\u5b8b\u4f53"].forEach(function(t){n[t]=(0,ht.RF)(U),n[t]["\uff5e"]=w.VCRT.DEG90,n[t]["\u2015"]=w.VCRT.DEG90}),(0,w.rotatedCharsForVertical)(n),f.prototype.Bye=function(t,n){var e;f.et(t.sheet,"beforePaintCellContent",{context:t,style:n})},f.prototype.pn=function(t,n,e,i){var t={ctx:t,options:{rect:n,context:e,value:i}};return f.et(e.sheet,"paintCellPadding",t),t.options.rect},f.prototype.bn=function(t,n,e){var n={context:t,options:{dom:n,cellRect:e,contentRect:e.clone(),leftExternalRect:new ht.Rect(0,0,0,0),rightExternalRect:new ht.Rect(0,0,0,0)}};return f.et(t.sheet,"onCreateCellEditor",n),n.options.dom},f.prototype.yn=function(t,n,e){var n={ctx:null,options:{rect:n.clone(),context:t,value:null,style:e}};return f.et(t.sheet,"getCellButtonRect",n),n.options.rect},f.prototype.wn=function(t,n,e,i){var n={context:t,options:{dom:n,cellRect:e,cellStyle:i,contentRect:e.clone(),leftExternalRect:new ht.Rect(0,0,0,0),rightExternalRect:new ht.Rect(0,0,0,0)}};return f.et(t.sheet,"onActivateCellEditor",n),n},f.prototype.Mn=function(t,n,e,i){var n={context:t,contentContainer:n,editorBounds:e,cellStyle:i,contentRect:e.clone(),leftExternalRect:new ht.Rect(0,0,0,0),rightExternalRect:new ht.Rect(0,0,0,0)};return f.et(t.sheet,"onUpdateContainer",n),n},f.prototype.Cn=function(t,n,e){var n={context:t,options:{dom:n,cellRect:e,contentRect:e.clone(),leftExternalRect:new ht.Rect(0,0,0,0),rightExternalRect:new ht.Rect(0,0,0,0)}};return f.et(t.sheet,"onDeactivateCellEditor",n),n.options.dom},f.prototype.Sn=function(t,n,e){var i=this;i.deactivateEditor(t,n),i.Cn(n,t,e)},f.prototype.Tn=function(t,n,e,i){var r,o,a,u,i,u,o,i,o,u,s,r=e.labelOptions;r&&(o=i.sheet,a=e.watermark)&&(u=r.visibility,i=o.getText(i.row,i.col,i.sheetArea),1!==u)&&(2!==u&&u!==A||""!==i)&&(u=o.zoom(),i=void 0,i=(o=r.font)?dt.W.V(o,u):dt.W.x2e(e,1),o=K(i.font),u=Ft(n,e),s=void 0,s=Lt(e,n)?Pt(n,e,i,o):s)&&(t.save(),t.textAlign=Bt(r.alignment),t.textBaseline="alphabetic",vt(t,i.font),t.fillStyle=r.foreColor||e.foreColor||"grey",t.rect(u.x,u.y,u.width,u.height),t.clip(),t.beginPath(),t.fillText(a,s.x,s.y),t.restore())},f.prototype.An=function(t,n,e){var i,r,o,a,n,i=t.clone(),r=yt(n,0,!1,e),o=yt(n,1,!1,e),a=yt(n,2,!1,e),n=yt(n,3,!1,e);return 0<r&&(i.y+=r,i.height-=r),0<a&&(i.height-=a),0<n&&(i.x+=n,i.width-=n),0<o&&(i.width-=o),o+n>=t.width&&(i.width=0),r+a>=t.height&&(i.height=0),i},f.prototype.In=function(t,n,e,i){var r,o,r,r=this,o=et(i)?i.printZoomFactor:i.sheet.zoom();return n=r.An(n,e,o),f.et(i.sheet,"getCellPaddingRect",r={ctx:t,options:{rect:n,context:i}}),r.options.rect},f.prototype.xn=function(t,n,e,i){var r,o,i,a,u,s,c,o,f,l,n,a,h,d,r=e.labelOptions;r&&(i=(o=i.sheet).getText(i.row,i.col,i.sheetArea),a=e.watermark,1!==(u=r.visibility))&&a&&(s=r.font||e.font||o.Dn.Nn(),1!==(c=o.zoom())&&(s=o.Dn._n(s)),o=K(s),f=Lt(e,n)?Gt(n,e):f)&&((l=(0,v.GC$)(ht.mt.En("span"))).text(a),n=(2===u||u===A)&&""===i,a=f.height-o,h=f.y+(n&&0<a?a:0),l.css({display:"block",position:"absolute",left:f.x,top:h,width:f.width,height:f.height,font:y(s),color:r.foreColor||e.foreColor||"grey",textAlign:Bt(r.alignment),overflow:"hidden",whiteSpace:"nowrap"}).attr("gcUIElement","gcEditorLabel"),(0,v.GC$)(t).append(l),n)&&(d=setInterval(function(){h--,l.css("top",h),h<=f.y&&clearInterval(d)},20))},f.prototype.jn=function(t){var n,e,i,r,i,n=this,e=ht.mt.En("div");return e.style.cssText="position: absolute; margin: 0;padding: 0 ;overflow: hidden; box-sizing: content-box;resize: none;outline: none;border: 2px #5292f7 solid;box-shadow: 1px 2px 5px rgba(0,0,0,0.4);background-color: white",(i=ht.mt.En("div")).style.cssText="position: absolute; outline: none; border: none;",(0,v.GC$)(e).append((0,v.GC$)(i)),(r=n.createEditorElement(t,e))&&(0,v.GC$)(i).append((0,v.GC$)(r)),i=t.sheetArea,n.bn(t,e,t.sheet.getCellRect(t.row,t.col,1===i?-1:A,2===i?-1:A)),e},f.prototype.On=function(t,n,e,i){var r,e,e,o,a,u,e,s,o,c,f;t&&t.firstChild&&(r=this,Et(t,n,e=Vt(e),i),o=(e=r.wn(i,t,e,n)).options.contentRect,a=e.options.cellRect,u=e.options.leftExternalRect,e=e.options.rightExternalRect,r.xn&&r.xn(t,o,n,i),s=i.sheet.zoom(),o=Z(o=r.An?r.An(o,n,s):o,u,e),c=t.firstChild,f=ct(n.textDirection,n.textDirection===Q.TextDirectionType.context?i.sheet.getValue(i.row,i.col):_),(0,v.GC$)(c).css({left:(+(0,v.GC$)(c).css("left").replace("px","")||0)+yt(n,3,!1,s),top:(+(0,v.GC$)(c).css("top").replace("px","")||0)+yt(n,0,!1,s),direction:f}),r.activateEditor(t.firstChild.firstChild,n,o,i,a,u,e))},f.prototype.updateEditorContainer=function(t,n,e,i,r,o,a){var n,t,n,u,s,t;t&&n&&(t=(n=t.parentNode)?n.parentNode:A)&&r&&(n=(0,v.GC$)(t),u=r.width,s=r.height,0<u&&(n.width(u),t=t.lastChild,e)&&"gcEditorLabel"===t.getAttribute("gcUIElement")&&(0,v.GC$)(t).width(u-yt(e,3,!0)-yt(e,1,!0)-2),0<s&&n.height(s),J(r.x)||n.css("left",r.x+"px"),J(r.y)||n.css("top",r.y+"px"))},f.prototype.Rn=function(t,n,e,i){var r,o,e,t,e,a,u,t,o,a,a,u,t,s,c,e,r=this,o=t.firstChild,e=Vt(e);Et(t,n,e,i),e=(t=r.Mn(i,o,e,n)).editorBounds,a=t.contentRect,u=t.leftExternalRect,t=t.rightExternalRect,o=o.firstChild,a=Z(a=r.An?r.An(a,n,i.sheet.zoom()):a,u,t),a=r.updateEditor(o,n,a,i,e,u,t),u={width:u.width,height:u.height},t={width:t.width,height:t.height},c=!isNaN(a&&a.width)&&a.width+u.width+t.width>e.width?a.width+u.width+t.width:e.width,e=!isNaN(a&&a.height)&&a.height+u.height+t.height>e.height?a.height+u.height+t.height:e.height,r.updateEditorContainer(o,a,n,i,s={width:c,height:e},u,t)},f.prototype.Bn=function(t,n,e,i,r){return this.getCellAndPaddingHitInfo(t,n,e,i,r)},f.prototype.Ln=function(t,n,e,i,r){var o,t,o=jt(r,e)+Nt(r)+Dt(r,e),t=this.getAutoFitWidth(t,n,e,i,r);return 0<t&&(o+=t+yt(e,3,!1)+yt(e,1,!1)),o},f.prototype.Fn=function(t,n,e,i,r){var o,t,o=0,t=this.getAutoFitHeight(t,n,e,i,r);return 0<t&&(o+=t+yt(e,0,!1)+yt(e,2,!1)),o=Math.max(Ot(r,e),o),Math.max(_t(r,e),o)},f.prototype.paintValue=function(t,n,e,i,r,o,a,u){var s,c,f,l,l,s=this,c={};u.quotePrefix=a.quotePrefix,(f=this.format(M(n),a.formatter||a._autoFormatter,c,u))&&(f=this.MUr(f,c,a,u),l=new ht.Rect(e,i,r,o),this.adjustRectForIconSet(a.hAlign,u.sheet,u.row,u.col,u.sheetArea,l,c.content&&this.hasInfilling(c.content)),e=l.x,r=l.width,l=s.Pn(t,f,a,u,e,i,r,o),this.paintText(t,n,e,i,r,o,a,u,f,c,A,l.externals))},f.prototype.MUr=function(t,n,e,i){var e=(0,ht.isIgnoreEndBlank)(e,i),i=t;return t&&t.endsWith(R)&&e&&(i=(0,ht.W3e)(t),(0,ht.removeEndSpaceOfFormattedData)(n)),i},f.prototype.Gn=function(t,n,e,i){var t=0<t?8*t*i:0;return t=n&&n.Un(e)?0:t},f.prototype.Ft=function(t,n){return!!(!t||s(t,nt)&&t===i||t&&t.formatString&&t.formatString()===i)||!(n&&(!isNaN(n)||"TRUE"===n.toUpperCase()||"FALSE"===n.toUpperCase())&&"@"!==t)},f.prototype.Hn=function(t){for(var n,e,n=0,e=0;e<t.length;e++)n+=t[e].width;return n},f.prototype.Iye=function(t){for(var n,t,e,i,r,o,a,n=t.left,t=t.right,e=0,i=n;e<i.length;e++)if((r=i[e]).isStick)return!0;for(o=0,a=t;o<a.length;o++)if((r=a[o]).isStick)return!0;return!1},f.prototype.zn=function(t){for(var n,e,n=0,e=0;e<t.length;e++)n+=t[e].height;return n},f.prototype.Vn=function(t,n,e,i,r){var o;f.et(n.sheet,"beforePaintLabel",{ctx:t,options:{rect:e,context:n,value:i,style:r}})},f.prototype.Pn=function(t,n,e,i,r,o,a,u){var t={ctx:t,text:n,rect:new ht.Rect(r,o,a,u),style:e,context:i,externals:{left:[],right:[]}};return f.et(i.sheet,"beforePaintText",t),un(t),t},f.prototype.Yn=function(t,n,e,i,r,o,a,u,s){var t={ctx:t,style:n,context:e,textRect:new ht.Rect(i,r,o,a),availRect:u};return f.et(e.sheet,s,t),on(s,t),t},f.prototype.Zn=function(t,n,e,i,r,o,a,u){return this.Yn(t,n,e,i,r,o,a,u,"beforeFillTextArea")},f.prototype.Wn=function(t,n,e,i,r,o,a,u){return this.Yn(t,n,e,i,r,o,a,u,"afterFillTextArea")},f.prototype.paintText=function(t,n,e,i,r,o,a,u,s,c,f,l){var h,d,v,g,p,m,b,w,y,M,w,y,m,h=this;t.save(),t.beginPath(),d=a.textOrientation,v=a.textIndent&&0!==a.textIndent,g=a.hAlign,p=a.isVerticalText&&4!==g,4===g&&(d=0,v=!1),m=u.sheet,b=u.sheetArea,w=m.rowFilter&&m.rowFilter(),y=u.columnHeaderFitMode,!(M=!!(w&&w.rn(u.row,u.col,b)&&w.filterButtonVisible(u.col)))||y!==Q.ColumnHeaderFitMode.normal&&y!==Q.ColumnHeaderFitMode.vertical||(C(u.cornerX)||(r=u.cornerX-e),r-=m.an(new ht.Rect(e,i,r,o),b).width),w=a.wordWrap,y=a.shrinkToFit,m=a.showEllipsis,5===g&&(u.sheet.options.showFormulas&&u.isFormula?(a.hAlign=1,a.wordWrap=!1):a.wordWrap=!0,a.shrinkToFit=!1,a.showEllipsis=!1),n&&n.richText&&0<n.richText.length&&W(n,s,a.wordWrap)||p?h.Qn(t,n,e,i,r,o,a,u,s,c,f,l):0!==d&&!J(d)&&-90<=d&&d<=90&&!v&&!p?h.Kn(t,n,e,i,r,o,a,u,s,c,f,l):h.Jn(t,n,e,i,r,o,a,u,s,c,f,l),5===g&&(a.hAlign=5,a.wordWrap=w,a.shrinkToFit=y,a.showEllipsis=m),t.restore()},f.prototype.Xn=function(t,n,e,i,r,o,a,u,s,c){for(var f,l,h,d,v,g,p,m,b,w,y,M,C,S,x,T,A,I,f=n.sheet,l=n.row,h=n.col,d=r.vAlign,v=n.sheetArea,g=0;g<e.length;g++)if(p=e[g].text,m=i[g].lineHeight,b=1===d?0:u,w=this.qn(t,"0"),y="",(M=o)-1-2-b<p.length*m){if(M<3*w)c.push(0),y=N;else if(C=gt((M-1-2-3*w-(1===d?0:u))/m),(S=0)===d){for(x=0;x<C;x++)y+=p[x];T=y.length,3*w+((y+=N).length-3)*m+u>M-1-2?(y=y.substring(0,y.length-4)+N,c.push(y.split(N)[0].length)):c.push(T)}else if(1===d){for(A=0;A<k(C/2);A++)y+=I=p.charAt(A),S=A;for(T=y.length,y+=N,A=k(p.length-C/2);A<p.length;A++)y+=I=p.charAt(A);3*w+(y.length-3)*m+u>M-1-2?(y=y.replace(p[S],""),c.push(y.split(N)[0].length)):c.push(T),s[g].y=a+(o-(3*w+(y.length-3)*m))/2}else{for(c.push(0),x=p.length-1;x>=p.length-C;x--)y=p[x]+y;3*w+((y=N+y).length-3)*m+u>M-1-2&&(y=y.replace(p[p.length-C],"")),s[g].y=a+o-u-(3*w+(y.length-3)*m)-2}e[g].textInfos[0].text=y,f.Ut.$n(l,h,p,v)}else f.Ut.$n(l,h,null,v)},f.prototype.Qn=function(t,n,e,i,r,o,a,u,s,c,f,l){var h,d,v,g,p,h,m,b,w,y,M,C,S,y,x,p,h,d,l,p,T,A,b,S,I,k,N,x,f,h,j,D;if(n&&n.richText&&(n={text:(n=n.converted?n:ht.util.g0(n)).text,richText:n.converted}),v=this,g=new ht.Rect(e,i,r,o),p=u.sheet?u.sheet.zoom():1,h=u.printZoomFactor,h=et(u)?h:_,m=v.Gn(a.textIndent,u.sheet.outlineColumn,u.col,h?h*p:p),b=u.cellOverflowLayout&&u.cellOverflowLayout.expandedWidth,w=a.hAlign,y=a.formatter||a._autoFormatter,3===w&&(w=Mt(w,n,y)),C=!!(M=a.isVerticalText&&4!==w)&&X(s),S=a.font,y=v.Ft(y,n&&n.text),x=F(!0,[],v.Pt(n,s,y,S,a.foreColor)),(0,ht.resetFillStyle)(t,u.sheet,a,f),n&&n.richText&&0<n.richText.length&&v.te(x,S,p,h),h=p=0,l&&(p=v.Hn(l.left),h=v.Hn(l.right),d=v.Iye(l)),l=p+h,p={left:p,right:h,isStick:d},!a.wordWrap&&a.shrinkToFit&&(4===a.hAlign?v.ne(x,b-l,o,a,S,1,M):v.ne(x,r-l,o,a,S,1,M)),T=v.ee(t,s,a.font,M?o:r-l,m,M?a.vAlign:a.hAlign,a.wordWrap,M,x),A=v.re(T,a,w,f),b=v.oe(t,a,e,i,r,o,a.wordWrap,u.cellOverflowLayout,w,m,M,(null==(h=T[0])?void 0:h.textLength)||0,(null==(d=A[0])?void 0:d.lineHeight)||0),S=!1,a.showEllipsis&&M&&n&&!n.richText&&(S=!0),I=[],I=4===w?v.ae(e,i,u.cellOverflowLayout.expandedWidth,o,w,a.vAlign,m,M,C,T,A,p,S,a):v.ae(e,i,r,o,w,a.vAlign,m,M,C,T,A,p,S,a),k=T.length,N=[],S&&c&&(c.content&&1===c.content.length&&"text"===c.content[0].type||!c.content&&1===T.length&&T[0].text)&&this.Xn(t,u,T,A,a,o,i,m,I,N),1===k&&c&&!y)v.ue(t,u.sheet,s,c,I[0].x,I[0].y,r,o,w,a,b?b.width:0,b?b.height:0,m,M,T[0].textLength,u,p,g);else{for(f=(x=v.se(T,I)).textWidth,h=x.textStart,v.Zn(t,a,u,h,I[0].y,f,0,g),j=r-l-4-2*m,D=0;D<k;D++)v.ce(t,u.sheet,I[D].x,I[D].y,A[D],w,T[D],N[D],j,u.cellRect,0===D);v.Wn(t,a,u,h,I[0].y,f,0,g)}},f.prototype.se=function(t,n){var e,i,r;if(!t||0===t.length||!n||0===n.length)return{textWidth:0,textStart:(null==n?void 0:n[0].x)||0};for(e=t[0].textLength,i=n[0].x,r=0;r<t.length;r++)t[r].textLength>e&&(e=t[r].textLength,i=n[r].x);return{textWidth:e,textStart:i}},f.prototype.qn=V,f.prototype.fe=function(t,n,e,i,r,o,a){var u,s,e,c,f,t,l,h,r,d,v,g,p,m,b,w,y,M,C,S,C,s=t.sheetArea,u=e,e=this.qn(i,u),c=t.sheet,f=t.row,t=t.col,l=r,h=0,r=this.qn(i,"0"),d;if(h=this.qn(i,N),l-1-2-(v=1===o?0:a)<e){if(g="",2===o)for(p=u.length-1;0<=p;p--){if(l-1-2-a<h){m=g.length,g=N+g.substring(1,m);break}g=(b=u.charAt(p))+g,h+=w=this.qn(i,b)}else if(1===o){for(y=k((l-h)/r),p=0;p<y/2;p++)g+=b=u.charAt(p);for(g+=N,p=gt(u.length-y/2);p<u.length;p++)g+=b=u.charAt(p);for(M=this.qn(i,g);l-1-2<M&&g!==N;)S=(C=g.split(N))[0],C=C[1],g=S.length>C.length?S.substring(0,S.length-1)+N+C:S+N+C.substring(1,C.length),M=this.qn(i,g)}else for(p=0;p<u.length;p++){if(l-1-2-a<h){m=g.length,g=g.substring(0,m-1)+N;break}g+=b=u.charAt(p),h+=w=this.qn(i,b)}n.content=[{value:g,type:"text"}],c.Ut.$n(f,t,u,s)}},f.prototype.Jn=function(t,n,e,i,r,o,a,u,s,c,f,l){var h,d,v,g,p,m,b,L,w,y,M,C,F,S,x,T,A,B,P,I,k,f,v,f,N,j,G,l,U,H,z,D,V,j,b,N,Y,w,N,m,w,v,T,m,Z,_,v,O,g,E,R,R,E,o,f,n,j,R,E,g,W,h=this,d=0,v=a.textIndent,g=a.wordWrap,p=a.hAlign,m=a.vAlign,b=a.shrinkToFit,L=a.textDecoration,w="left",y=2,M=2,C=a.font,F=0,S=[],x=0,T=u.sheet,A=new ht.Rect(e,i,r,o),B=u.cellOverflowLayout&&u.cellOverflowLayout.expandedWidth,P=u.offsetX;if(P=P||0,4===p&&(v=0),J(u.fontInfo)&&(u.fontInfo=dt.W.x2e(a,T.zoom()),et(u))&&(u.fontInfo=dt.W.V(u.fontInfo.font,u.printZoomFactor)),I=parseInt(u.fontInfo.fontSize,10),J(u.lineHeight)&&(u.lineHeight=K(dt.W.x2e(a,T.zoom()).font,!1,X(s))),k=u.lineHeight,(0,ht.resetFillStyle)(t,T,a,f),f=T.zoom()||1,et(u)&&(f*=u.printZoomFactor),0<v&&(d=8*v*f),T.outlineColumn&&T.outlineColumn.Un(u.col)&&(d=0),3===p&&(p=Mt(p,n,a.formatter||a._autoFormatter)),v=1,vt(t,C),N=f=0,l&&(f=h.Hn(l.left),N=h.Hn(l.right),j=h.Iye(l)),G=f+N,l={left:f,right:N,isStick:j},!g&&b){for(H={value:!1},z=void(U=0),D=0;D<3&&!1===H.value&&(V=t.measureText(s).width,U=wt(0,r-4-(1===p?0:d)-G),(U=4===p?wt(0,B-4-d-G):U)<V);D++)C=(z=dt.W.V(C,U/V,H,!0)).font,vt(t,C);z&&(v=I/z.fontSize,I=z.fontSize)}if(j=(j=T.parent&&T.parent.options.numbersFitMode===Q.NumbersFitMode.overflow||!1)||(c&&c.content?!(!c.content||1!==c.content.length||"text"!==c.content[0].type):"string"==typeof n&&n===s),!g&&!b&&a.showEllipsis&&j&&this.fe(u,c,s,t,r,p,d),y+=d+f,1===p||4===p||5===p?(y=(r+f-N)/2,w=tt):2===p&&(y=r-N-1-2,w=$,y=at(a,y-=d)),t.textAlign!==w&&(t.textAlign=w),b=0,g&&(b=r-G-(N=ut(a,3))-(1===p||5===p?2*d:d),4===p&&(b=B-G-N-d),--b,1<(x=(S=u.isPrinting?ht.q.un(s,b,C,!1,t):ot(s,b,C,!1,t)).length))&&0!==m&&(F=(x-1)*k),M=(M+(k-(w=k/2-I/2+(Y=8<I?gt((I-8)/5+2):1)-1)))/v,1===m?M=(o-F)/2+k/2-w:2===m&&(M=o-(F+2+w)/v),t.textBaseline!==rt&&(t.textBaseline=rt),m=(N=u.cellOverflowLayout)&&N.layout,w=4===p&&T.options.rightToLeft,v={x:m?w?e+r-m.width:m.x:e+1,y:m?m.y:i+1,width:m?m.width:r-2,height:m?m.height:o-2},N&&4===p&&(y+=(N.expandedWidth-r)/2),y+=P,T=m&&m.width>r||4===p,m=v.x,Z=v.y,_=v.width,v=v.height,g)if(t.rect(m,Z,_,v),t.clip(),t.beginPath(),O=i+M,1<x||5===p)if(g=e+y,t.textAlign===tt?g-=b/2:t.textAlign===$&&(g-=b),R=O,(E=bn(S,k,a)).descenderHeight&&(R+=E.descenderHeight),u.textRect=new ht.Rect(g,St(R+(S.length-1)*k,i+o),b,St(E.height,o)),5===p)R=y,E=2+d+f+P,!j&&!it(a.formatter)&&typeof a.formatter===nt&&"object"!=typeof n||j&&1===x&&!h.SAe(S[0])?h.he(t,s,c,e+R,i+M,1,_,d,L,Y,I,u,a,l,A,T):(h.Zn(t,a,u,g,O,b,k*x,A),h.Z3e(t,S,e,O,b,R,E,k,a,I,Y),h.Wn(t,a,u,g,O,b,k*x,A));else{for(h.Zn(t,a,u,g,O,b,k*x,A),D=0;D<x;D++)t.direction=ct(a.textDirection,S[D]),t.fillText(S[D],e+y,O),L&&(V=t.measureText(S[D]).width,h.le(t,L,e+y,O,V,I,Y)),O+=k;h.Wn(t,a,u,g,O,b,k*x,A)}else h.he(t,s,c,e+y,i+M,p,_,d,L,Y,I,u,a,l,A,T);else f=_-(e+1-m)<(o=u.ysr=q(t,t.font,s)+G)||v<k||0!==P,4===p&&(f=!0),n=yt(a,0),j=yt(a,1),R=yt(a,2),E=yt(a,3),f||(1===p||4===p?N&&((g=o/2)>N.backgroundLeftWidth||g>N.backgroundRightWidth)&&(f=!0):(_<o+d+n+R||v<F+E+j)&&(f=!0)),f&&(t.rect(m,Z,_,v),t.clip(),t.beginPath()),h.he(t,s,c,W=w?e+r-y:e+y,i+M,p,_,d,L,Y,I,u,a,l,A,T)},f.prototype.SAe=function(t){var t=ht.q.Q3e(t);return 1<t.length||1===t.length&&0<t[0].prefixSpaceCount},f.prototype.Z3e=function(t,n,e,i,r,o,a,u,s,c,f){for(var l,h,d,v,g,p,m,b,w,y,w,M,C,S,x,x,l=n.length,h=i,d=s.textDecoration,v=this,g=r,p=0;p<l;p++){if(m=n[p]){if(1===(b=ht.q.Q3e(m)).length)t.textAlign=tt,t.fillText(m,e+o,h),d&&(w=t.measureText(m).width,v.le(t,d,e+o,h,w,c,f));else for(t.textAlign=T,y=t.measureText(" ").width,w=t.measureText(m).width,M=e+a,(C=0)<b[0].prefixSpaceCount?M+=C=(g-w)/b.length:C=(g-w)/(b.length-1),S=0;S<b.length;S++)M+=(x=b[S]).prefixSpaceCount*y,t.fillText(x.word,M,h),x=t.measureText(x.word).width,d&&v.le(t,d,M,h,x,c,f),M+=x+C}h+=u}},f.prototype.Kn=function(t,L,F,n,e,i,r,o,B,a,P,G){var U,u,s,c,H,z,V,f,l,h,Y,d,v,g,Z,p,m,b,W,w,w,y,M,Q,C,J,S,x,T,A,w,K,X,I,w,k,N,q,$,j,D,_,tt,nt,O,et,it,rt,ot,at,E,R,ut,st,ct,ft,lt,a,P,L,G,z,J,H,s,u=this,s=r.wordWrap,c=r.hAlign,H=r.vAlign,z=r.shrinkToFit,V=r.textDecoration,f=2,l=2,h=r.font,Y=[],d=0,p=parseInt(o.fontInfo.fontSize,10),m=o.sheet,W=new ht.Rect(F,n,e,i),w=o.cellOverflowLayout,w=w&&w.layout,y=r&&(r.borderLeft||r.borderTop||r.borderRight||r.borderBottom)&&!m.getSpan(o.row,o.col,o.sheetArea),M=m.options.rightToLeft&&bt(r.textOrientation)<90?-r.textOrientation:r.textOrientation,Q=M*Math.PI/180,C=bt(Q),J=mt(C),S=pt(C),x=Ct(C),T=o.lineHeight,A=90===M||-90===M;if(y&&(-90<M&&M<0&&(b=!1),0<M)&&M<90&&(b=!0),K=(w={x:w?w.x:F+1,y:w?w.y:n+1,width:w?w.width:e-2,height:w?w.height:i-2}).x,X=w.y,I=w.width,w=w.height,k=T/2*pt(C),N=T/2*mt(C),$=T/2-p/2+(q=8<p?gt((p-8)/5+2):1)-1,a&&a.content&&0<a.content.length&&!z&&(B=u.de(t,a.content,i-4,h)),j=m.Qt(B,h),(0,ht.resetFillStyle)(t,m,r,P),3===c&&(c=Mt(c,L,r.formatter||r._autoFormatter,M)),vt(t,h),_=D=0,G&&(D=u.Hn(G.left),_=u.Hn(G.right)),!s&&z)for(nt={value:!1},O=tt=0;O<3&&!1===nt.value&&(tt=wt(0,(i-4-2*N)/S))<j;O++)h=dt.W.V(h,tt/j,nt,!0).font,vt(t,h),p=null!=(U=r._fontSizeDigit)?U:parseInt(o.fontInfo.fontSize,10),j=m.Qt(B,h),k=(T=ht.mt.vt(h))/2*pt(C),N=T/2*mt(C);if(it=et=0,s)for(d=(Y=ht.q.un(B,it=(i-4-2*N)/S,h,!1,t)).length,j=m.Qt(Y[0],h),rt=0;rt<d;rt++)et<(ot=m.Qt(Y[rt],h))&&(et=ot);switch(v=j/2*J,g=(s?et:j)/2*S,5===c&&(M<0&&(c=2,A)&&1===d&&(_=(I-T)/2),0<M&&(c=0,A)&&1===d&&(D=(I-T)/2),A)&&1<d&&(T=(I-T)/(d-1))<o.lineHeight&&(T=o.lineHeight),at=""+c+(H=i<=(Z=(s?et:j)*S+2*N)?2:H)){case"00":f+=v+k+D,l+=g,A||(l+=N),y&&(f=(i-l)/x*(b?1:-1)+(T/2+2)/S+D);break;case"01":f+=v+k+D,l=i/2,y&&(f=(i-l)/x*(b?1:-1)+(T/2+2)/S+D);break;case"02":f+=v+k+D,l+=g,A||(l+=N),y&&(f=l/x*(b?1:-1)+(T/2+2)/S+D),l=i-l;break;case"10":f=(e+D-_)/2,l+=g,A||(l+=N),y&&(f+=(b?1:-1)*(i-l)/x);break;case"11":f=(e+D-_)/2,l=i/2,y&&(f+=(b?1:-1)*(i-l)/x);break;case"12":f=(e+D-_)/2,l+=g,A||(l+=N),y&&(f+=(b?1:-1)*l/x),l=i-l;break;case"20":f=e-2-v-k-_,l+=g,A||(l+=N),y&&(f=e+(i-l)/x*(b?1:-1)-(T/2+2)/S-_);break;case"21":f=e-2-v-k-_,l=i/2,y&&(f=e+(i-l)/x*(b?1:-1)-(T/2+2)/S-_);break;case"22":f=e-2-v-k-_,l+=g,A||(l+=N),y&&(f=e+l/x*(b?1:-1)-(T/2+2)/S-_),l=i-l}if(s)if(E=F+f,R=T/S,ut=void 0,90===Math.abs(M)&&(ft=I<j*d+(st=yt(r,1))+(ct=yt(r,3)))&&(t.rect(K,X,I,w),t.clip()),1<d){for(1===c&&(E-=(lt=d%2!=0)?R*(d-1)/2:d/2*R-.5*R),P=(a=Zt(E,n+l,j,Q,T)).width+R*(d-1),L=a.height,G=a.y,z=a.x-R*(d-1),o.textRect=new ht.Rect(z,St(n+2*l,W.y+W.height),P,2*l-T/2),u.Zn(t,r,o,z,G,P,L,W),O=0;O<d;O++)ut=O,(0<r.textOrientation&&2===c||r.textOrientation<0&&(0===c||1===c))&&(ut=d-O-1),u.ve(t,Q,Y[ut],E,n+l,V,p,q,$),E=2===c?E-R:E+R;u.Wn(t,r,o,z,G,P,L,W)}else u.me(t,B,F,n,f,l,o,r,j,Q,V,p,q,T,$,W);else J=j*S+p*S+2,H=yt(r,0),s=yt(r,2),(ft=w-(n+1-X)<J||w<T||w<J+H+s)&&(t.rect(K,X,I,w),t.clip()),u.me(t,B,F,n,f,l,o,r,j,Q,V,p,q,T,$,W)},f.prototype.me=function(t,n,e,i,r,o,a,u,s,c,f,l,h,d,v,g){var p,m,b,w,y,m,M,p=this,m=Zt(e,i,s,c,d),b=m.width,w=m.height,y=m.x,m=m.y;(dt.W.qme(u)||dt.W.$me(u))&&(M=bt(c),y=e+r-(b=s*mt(M)+d*pt(M))/2,m=i+o-(w=s*pt(M)+d*mt(M))/2),a.textRect=new ht.Rect(y,St(m+w,g.height+g.y),b,w),p.Zn(t,u,a,y,m,b,w,g),p.ve(t,c,n,e+r,i+o,f,l,h,v),p.Wn(t,u,a,y,m,b,w,g)},f.prototype.te=function(t,n,e,i){Yt(t,n,e,i)},f.prototype.ne=function(t,n,e,i,r,o,a){for(var u,s,c,f,l,u=0,s={value:!1},c=0;c<3&&!1===s.value&&(f=xt(t,r,o,a),u=wt(0,(a?e:n)-4),(u=(a?i.vAlign:1!==i.hAlign&&i.textIndent)?wt(0,u-8*i.textIndent*o):u)<f);c++)for(l=0;l<t.length;l++)t[l].style.font=dt.W.V(t[l].style.font,u/f,s,!0).font},f.prototype.Pt=function(t,n,e,i,r){var t=t&&t.richText;return t=!J(t)&&e?t:[{style:{font:i,foreColor:r},text:n}]},f.prototype.oe=function(t,n,e,i,r,o,a,u,s,c,f,l,h){var d,r,d,o,v,g,p,d=u&&u.layout,r={x:d?d.x:e+1,y:d?d.y:i+1,width:d?d.width:r-2,height:d?d.height:o-2},d=r.x,o=r.y,v=r.width,g=r.height;return(a||(p=this.ge(n,s,n.vAlign,e,i,g,v,d,o,l,h,c,f,u)))&&(t.rect(d,o,v,g),t.clip(),t.beginPath()),r},f.prototype.ge=function(t,n,e,i,r,o,a,u,s,c,f,l,h,d){var v,g,p,m,t,h,g=yt(t,0),p=yt(t,1),m=yt(t,2),t=yt(t,3);return h?(!(v=o-(r+1-s)<c||a<f)&&1!==e&&o<c+l+g+m||a<f+t+p)&&(v=!0):(v=a-(i+1-u)<c||o<f)||(1===n?d&&((h=c/2)>d.backgroundLeftWidth||h>d.backgroundRightWidth)&&(v=!0):(a<c+l+t+p||o<f+g+m)&&(v=!0)),v},f.prototype.ee=function(t,n,e,i,r,o,a,u,s){var c,f,l,h,h;if(i=1===o||5===o?i-3-2*r:i-3-r,a&&n)return ht.q.Ht(n,i,e,s,u,t);for(f=c=0;f<s.length;f++)l=s[f].text,u?c+=K(s[f].style.font)*(l?l.length:0):(h=dt.W.V(s[f].style.font,1),h=s[f].style.vertAlign?h.fontSize*O+"px "+h.fontFamily:s[f].style.font,c+=q(t,h,l));return[{textLength:c,text:n,textInfos:s}]},f.prototype.ue=function(t,n,e,i,r,o,a,u,s,c,f,l,h,d,v,g,p,m){var b,w,y,b=dt.W.x2e(c,1).fontSize,w=8<b?gt((b-8)/5+2):1;this.pe(t,n,c),d?this.be(t,e,i,c,r,o,l,h,l,g,p,m):this.he(t,e,i,r,o,s,f,h,c.textDecoration,w,b,g,c,p,m,y=a<f,v)},f.prototype.be=function(t,n,e,i,r,o,a,u,s,c,f,l){var h,d,v,g,p,m,b,w,h=this,d=e.content,g=o;if(c.textRect=new ht.Rect(r,g,s,wn(t,n,e,r,o,a,u,s)-g),h.Zn(t,i,c,r,g,s,s*n.length,l),d&&0<d.length)for(m=0<(m=a-u-(p=Ut(t,d,!0))-2)?m:0,b=void 0,v=0;v<d.length;v++)"fillingChar"===d[v].type?(w=zt(t,m,d[v].value,!0),this.ye(t,w,r,o),o+=m):"placeholder"===d[v].type?o+=d[v].value?d[v].value.length*s:0:"numberPlaceholder"===d[v].type?o+=s:(this.ye(t,d[v].value,r,o),o+=b=d[v].value?d[v].value.length*s:0);else if(n)for(v=0;v<n.length;v++)o=this.ye(t,n[v],r,o,s).y;h.Wn(t,i,c,r,g,s,o-g,l)},f.prototype.we=function(t){var n=T;return 1===t?n=tt:2===t&&(n=$),n},f.prototype.Fgr=function(t,n){for(var e,i,e=n&&" "===t.text[0]?0:t.textInfos.findIndex(function(t){return 0<t.text.length&&" "!==t.text}),i=t.textInfos.length-1;e<i&&(0===t.textInfos[i].text.length||" "===t.textInfos[i].text);)i--;return t.textInfos.slice(e,i+1)},f.prototype.ce=function(t,n,e,i,r,o,a,u,s,c,f){for(var o,l,h,d,v,g,o=!r.isVerticalText&&5===o,l=o?this.Fgr(a,f):a.textInfos,h=[],d=0;d<l.length;d++)h.push(F(!0,{},r,l[d].style));for(v=0,o&&1<l.length&&s&&(v=(s-a.textLength)/(l.length-1))<0&&(v=0),d=0;d<l.length;d++)e=(g=this.Me(t,n,e,i,h[d],l[d].text,u,c)).x+v,i=g.y},f.prototype.re=function(t,n,e,i){for(var r,o,a,u,r=[],o=t.length,a=0;a<o;a++)u=this.Ce(n,e,i,t[a].textInfos),r.push(u);return r},f.prototype.Ce=function(t,n,e,i){va