UNPKG

@mertdeveci55/univer-import-export

Version:

Excel/CSV import and export library for Univer spreadsheets with full format preservation

1 lines 146 kB
import{customAlphabet as e,nanoid as t}from"nanoid";import r from"papaparse";import n from"dayjs";import l from"@progress/jszip-esm";import*as a from"xlsx";import i from"@zwight/exceljs";const s=()=>"undefined"!=typeof process&&process.env?"development"===process.env.NODE_ENV||"true"===process.env.DEBUG:"undefined"!=typeof window&&!0===window.__DEBUG__,o=(...e)=>{s()&&console.log&&console.log(...e)},c=(...e)=>{s()&&console.warn&&console.warn(...e)},u=(...e)=>{console.error&&console.error(...e)},h=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],d={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25},f="docProps/core.xml",g="docProps/app.xml",m="xl/workbook.xml",p="xl/styles.xml";let E={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"yyyy/m/d",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"yyyy/m/d h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@"};const C={0:"00000000",1:"00FFFFFF",2:"00FF0000",3:"0000FF00",4:"000000FF",5:"00FFFF00",6:"00FF00FF",7:"0000FFFF",8:"00000000",9:"00FFFFFF",10:"00FF0000",11:"0000FF00",12:"000000FF",13:"00FFFF00",14:"00FF00FF",15:"0000FFFF",16:"00800000",17:"00008000",18:"00000080",19:"00808000",20:"00800080",21:"00008080",22:"00C0C0C0",23:"00808080",24:"009999FF",25:"00993366",26:"00FFFFCC",27:"00CCFFFF",28:"00660066",29:"00FF8080",30:"000066CC",31:"00CCCCFF",32:"00000080",33:"00FF00FF",34:"00FFFF00",35:"0000FFFF",36:"00800080",37:"00800000",38:"00008080",39:"000000FF",40:"0000CCFF",41:"00CCFFFF",42:"00CCFFCC",43:"00FFFF99",44:"0099CCFF",45:"00FF99CC",46:"00CC99FF",47:"00FFCC99",48:"003366FF",49:"0033CCCC",50:"0099CC00",51:"00FFCC00",52:"00FF9900",53:"00FF6600",54:"00666699",55:"00969696",56:"00003366",57:"00339966",58:"00003300",59:"00333300",60:"00993300",61:"00993366",62:"00333399",63:"00333333",64:null,65:null},y={none:0,thin:1,hair:2,dotted:3,dashed:4,dashDot:5,dashDotDot:6,double:7,medium:8,mediumDashed:9,mediumDashDot:10,mediumDashDotDot:11,slantDashDot:12,thick:13};let T={"yyyy/m/d;@":"yyyy/MM/dd","yyyy&quot;\u5e74&quot;m&quot;\u6708&quot;d&quot;\u65e5&quot;;@":"yyyy&quot;\u5e74&quot;MM&quot;\u6708&quot;dd&quot;\u65e5&quot;","[$-409]yyyy/m/d\\ h:mm\\ AM/PM;@":"yyyy/MM/dd hh:mm AM/PM"};const w={0:"defualt",1:"Roman",2:"Swiss",3:"Modern",4:"Script",5:"Decorative"},R={list:"dropdown",whole:"number_integer",decimal:"number_decimal",custom:"text_content",textLength:"text_length",date:"date",unknown1:"number",unknown2:"checkbox",unknown3:"validity"},S=["number","number_integer","number_decimal","text_length"],b={common:{between:"bw",notBetween:"nb",equal:"eq",notEqualTo:"ne",moreThanThe:"gt",lessThan:"lt",greaterOrEqualTo:"gte",lessThanOrEqualTo:"lte"},text_content:{include:"include",exclude:"exclude",equal:"equal"},date:{between:"bw",notBetween:"nb",equal:"eq",notEqualTo:"ne",earlierThan:"bf",noEarlierThan:"nbf",laterThan:"af",noLaterThan:"naf"},validity:{card:"card",phone:"phone"}};var A,v,I;function L(e){let t=e.split("!"),r="";if(t.length>1?(t[0],r=t[1]):r=t[0],-1==r.indexOf(":")){let e=parseInt(r.replace(/[^0-9]/g,""))-1,t=F(r.replace(/[^A-Za-z]/g,""));return isNaN(e)||isNaN(t)?null:{row:[e,e],column:[t,t]}}{let e=r.split(":"),t=[],n=[];return t[0]=parseInt(e[0].replace(/[^0-9]/g,""))-1,t[1]=parseInt(e[1].replace(/[^0-9]/g,""))-1,t[0]>t[1]?null:(n[0]=F(e[0].replace(/[^A-Za-z]/g,"")),n[1]=F(e[1].replace(/[^A-Za-z]/g,"")),n[0]>n[1]?null:{row:t,column:n})}}function F(e){let t=(e=e.toUpperCase()).length;if(0==t)return NaN;let r=e.split(""),n=h.length,l=0;for(let e=t-1;e>=0;e--)l+=e==t-1?d[r[e]]:Math.pow(n,t-e-1)*(d[r[e]]+1);return l}function N(e){let t=h.length;if(e<t)return h[e];{let r=0,n="",l=1,a=0;for(;e>=t/(t-1)*(Math.pow(t,l++)-1);)a=l;r=e-t/(t-1)*(Math.pow(t,a-1)-1)+1;for(let e=a;e>0;e--){let l=r;if(1==e)return l%=t,0==l&&(l=26),n+h[l-1];l=Math.ceil(l/Math.pow(t,e-1)),n+=h[l-1],e>1&&(r-=(l-1)*t)}}}function O(e){return null==e?0:e/914400*72/.75}function x(e,t,r){let n=e[t];return n=null==n?r:n,n}function M(e){return Math.round(8*(e-.83)+5)}function P(e){return Math.round(e/.75)}function _(e){var t=e.toLowerCase();if(t&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)){if(4===t.length){for(var r="#",n=1;n<4;n+=1)r+=t.slice(n,n+1).concat(t.slice(n,n+1));t=r}var l=[];for(n=1;n<7;n+=2)l.push(parseInt("0x"+t.slice(n,n+2)));return l}return null}function D(e){null==e&&(e="Sheet");let t=navigator.userAgent.replace(/[^a-zA-Z0-9]/g,"").split(""),r="";for(let e=0;e<5;e++)r+=t[Math.round(Math.random()*(t.length-1))];return e+"_"+r+"_"+(new Date).getTime()}function B(e){return null==e||0==e.length?e:e.replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#34;/g,'"').replace(/&#39;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ").replace(/&apos;/g,"'").replace(/&iexcl;/g,"\xa1").replace(/&cent;/g,"\xa2").replace(/&pound;/g,"\xa3").replace(/&curren;/g,"\xa4").replace(/&yen;/g,"\xa5").replace(/&brvbar;/g,"\xa6").replace(/&sect;/g,"\xa7").replace(/&uml;/g,"\xa8").replace(/&copy;/g,"\xa9").replace(/&ordf;/g,"\xaa").replace(/&laquo;/g,"\xab").replace(/&not;/g,"\xac").replace(/&shy;/g,"\xad").replace(/&reg;/g,"\xae").replace(/&macr;/g,"\xaf").replace(/&deg;/g,"\xb0").replace(/&plusmn;/g,"\xb1").replace(/&sup2;/g,"\xb2").replace(/&sup3;/g,"\xb3").replace(/&acute;/g,"\xb4").replace(/&micro;/g,"\xb5").replace(/&para;/g,"\xb6").replace(/&middot;/g,"\xb7").replace(/&cedil;/g,"\xb8").replace(/&sup1;/g,"\xb9").replace(/&ordm;/g,"\xba").replace(/&raquo;/g,"\xbb").replace(/&frac14;/g,"\xbc").replace(/&frac12;/g,"\xbd").replace(/&frac34;/g,"\xbe").replace(/&iquest;/g,"\xbf").replace(/&times;/g,"\xd7").replace(/&divide;/g,"\xf7").replace(/&Agrave;/g,"\xc0").replace(/&Aacute;/g,"\xc1").replace(/&Acirc;/g,"\xc2").replace(/&Atilde;/g,"\xc3").replace(/&Auml;/g,"\xc4").replace(/&Aring;/g,"\xc5").replace(/&AElig;/g,"\xc6").replace(/&Ccedil;/g,"\xc7").replace(/&Egrave;/g,"\xc8").replace(/&Eacute;/g,"\xc9").replace(/&Ecirc;/g,"\xca").replace(/&Euml;/g,"\xcb").replace(/&Igrave;/g,"\xcc").replace(/&Iacute;/g,"\xcd").replace(/&Icirc;/g,"\xce").replace(/&Iuml;/g,"\xcf").replace(/&ETH;/g,"\xd0").replace(/&Ntilde;/g,"\xd1").replace(/&Ograve;/g,"\xd2").replace(/&Oacute;/g,"\xd3").replace(/&Ocirc;/g,"\xd4").replace(/&Otilde;/g,"\xd5").replace(/&Ouml;/g,"\xd6").replace(/&Oslash;/g,"\xd8").replace(/&Ugrave;/g,"\xd9").replace(/&Uacute;/g,"\xda").replace(/&Ucirc;/g,"\xdb").replace(/&Uuml;/g,"\xdc").replace(/&Yacute;/g,"\xdd").replace(/&THORN;/g,"\xde").replace(/&szlig;/g,"\xdf").replace(/&agrave;/g,"\xe0").replace(/&aacute;/g,"\xe1").replace(/&acirc;/g,"\xe2").replace(/&atilde;/g,"\xe3").replace(/&auml;/g,"\xe4").replace(/&aring;/g,"\xe5").replace(/&aelig;/g,"\xe6").replace(/&ccedil;/g,"\xe7").replace(/&egrave;/g,"\xe8").replace(/&eacute;/g,"\xe9").replace(/&ecirc;/g,"\xea").replace(/&euml;/g,"\xeb").replace(/&igrave;/g,"\xec").replace(/&iacute;/g,"\xed").replace(/&icirc;/g,"\xee").replace(/&iuml;/g,"\xef").replace(/&eth;/g,"\xf0").replace(/&ntilde;/g,"\xf1").replace(/&ograve;/g,"\xf2").replace(/&oacute;/g,"\xf3").replace(/&ocirc;/g,"\xf4").replace(/&otilde;/g,"\xf5").replace(/&ouml;/g,"\xf6").replace(/&oslash;/g,"\xf8").replace(/&ugrave;/g,"\xf9").replace(/&uacute;/g,"\xfa").replace(/&ucirc;/g,"\xfb").replace(/&uuml;/g,"\xfc").replace(/&yacute;/g,"\xfd").replace(/&thorn;/g,"\xfe").replace(/&yuml;/g,"\xff")}!function(e){e[e.Stack=1073741824]="Stack",e[e.PercentStack=1610612736]="PercentStack",e[e.Horizontal=268435456]="Horizontal"}(A||(A={})),function(e){e[e.None=0]="None",e[e.Line=2]="Line",e[e.Column=4]="Column",e[e.ColumnStacked=1073741828]="ColumnStacked",e[e.ColumnPercentStacked=1610612740]="ColumnPercentStacked",e[e.Bar=268435460]="Bar",e[e.BarStacked=1342177284]="BarStacked",e[e.BarPercentStacked=1879048196]="BarPercentStacked",e[e.Pie=8]="Pie",e[e.Doughnut=264]="Doughnut",e[e.Area=16]="Area",e[e.AreaStacked=1073741840]="AreaStacked",e[e.AreaPercentStacked=1610612752]="AreaPercentStacked",e[e.Radar=32]="Radar",e[e.Scatter=64]="Scatter",e[e.Combination=128]="Combination"}(v||(v={})),function(e){e[e.Empty=0]="Empty",e[e.CategoryName=2]="CategoryName",e[e.SeriesName=4]="SeriesName",e[e.Value=8]="Value",e[e.Percentage=16]="Percentage"}(I||(I={}));class k{static trim(e){return null==e&&(e=""),e.replace(/(^\s*)|(\s*$)/g,"")}static functionCopy(e,t,r){let n=this;if(null==n.operatorjson){let e=n.operator.split("|"),t={};for(let r=0;r<e.length;r++)t[e[r].toString()]=1;n.operatorjson=t}null==t&&(t="down"),null==r&&(r=1),"="==e.substr(0,1)&&(e=e.substr(1));let l=e.split(""),a=0,i="",s="",o={bracket:0,comma:0,squote:0,dquote:0};for(;a<l.length;){let e=l[a];if("("==e&&0==o.dquote)o.bracket+=1,i.length>0?s+=i+"(":s+="(",i="";else if(")"==e&&0==o.dquote)o.bracket-=1,s+=n.functionCopy(i,t,r)+")",i="";else if('"'==e&&0==o.squote)o.dquote>0?(s+=i+'"',o.dquote-=1,i=""):(o.dquote+=1,i+='"');else if(","==e&&0==o.dquote)s+=n.functionCopy(i,t,r)+",",i="";else if("&"==e&&0==o.dquote)i.length>0?(s+=n.functionCopy(i,t,r)+"&",i=""):s+="&";else if(e in n.operatorjson&&0==o.dquote){let o="";a+1<l.length&&(o=l[a+1]);let c=a-1,u=null;if(c>=0)do{u=l[c--]}while(c>=0&&" "==u);e+o in n.operatorjson?(i.length>0?(s+=n.functionCopy(i,t,r)+e+o,i=""):s+=e+o,a++):/[^0-9]/.test(o)||"-"!=e||"("!=u&&null!=u&&","!=u&&" "!=u&&!(u in n.operatorjson)?i.length>0?(s+=n.functionCopy(i,t,r)+e,i=""):s+=e:i+=e}else i+=e;a==l.length-1&&(n.iscelldata(n.trim(i))?"down"==t?s+=n.downparam(n.trim(i),r):"up"==t?s+=n.upparam(n.trim(i),r):"left"==t?s+=n.leftparam(n.trim(i),r):"right"==t&&(s+=n.rightparam(n.trim(i),r)):s+=n.trim(i)),a++}return s}static downparam(e,t){return this.updateparam("d",e,t)}static upparam(e,t){return this.updateparam("u",e,t)}static leftparam(e,t){return this.updateparam("l",e,t)}static rightparam(e,t){return this.updateparam("r",e,t)}static updateparam(e,t,r){let n,l=this,a=t.split("!"),i="";if(a.length>1?(n=a[1],i=a[0]+"!"):n=a[0],-1==n.indexOf(":")){let a=parseInt(n.replace(/[^0-9]/g,"")),s=F(n.replace(/[^A-Za-z]/g,"")),o=q(n),c=o[0]?"$":"",u=o[1]?"$":"";return"u"==e?o[0]||(a-=r):"d"==e?o[0]||(a+=r):"r"==e?o[1]||(s+=r):"l"==e&&(o[1]||(s-=r)),a<0||s<0?l.error.r:isNaN(a)||isNaN(s)?isNaN(a)?isNaN(s)?t:i+u+N(s):i+c+a:i+u+N(s)+c+a}{n=n.split(":");let a=[],s=[];if(a[0]=parseInt(n[0].replace(/[^0-9]/g,"")),a[1]=parseInt(n[1].replace(/[^0-9]/g,"")),a[0]>a[1])return t;if(s[0]=F(n[0].replace(/[^A-Za-z]/g,"")),s[1]=F(n[1].replace(/[^A-Za-z]/g,"")),s[0]>s[1])return t;let o=q(n[0]),c=q(n[1]),u=o[0]?"$":"",h=o[1]?"$":"",d=c[0]?"$":"",f=c[1]?"$":"";return"u"==e?(o[0]||(a[0]-=r),c[0]||(a[1]-=r)):"r"==e?(o[1]||(s[0]+=r),c[1]||(s[1]+=r)):"l"==e?(o[1]||(s[0]-=r),c[1]||(s[1]-=r)):(o[0]||(a[0]+=r),c[0]||(a[1]+=r)),a[0]<0||s[0]<0?l.error.r:isNaN(s[0])&&isNaN(s[1])?i+u+a[0]+":"+d+a[1]:isNaN(a[0])&&isNaN(a[1])?i+h+N(s[0])+":"+f+N(s[1]):i+h+N(s[0])+u+a[0]+":"+f+N(s[1])+d+a[1]}}static iscelldata(e){let t,r=e.split("!");t=r.length>1?r[1]:r[0];let n=/^(([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+))$/g,l=/^(((([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+)))|((([a-zA-Z]+)|([$][a-zA-Z]+))))$/g;if(-1==t.indexOf(":")){let e=parseInt(t.replace(/[^0-9]/g,""))-1,r=F(t.replace(/[^A-Za-z]/g,""));return!(isNaN(e)||isNaN(r)||!t.toString().match(n))||!!isNaN(e)&&(isNaN(r),!1)}{l=/^(((([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+)))|((([a-zA-Z]+)|([$][a-zA-Z]+)))|((([0-9]+)|([$][0-9]+s))))$/g,t=t.split(":");let e=[],r=[];return e[0]=parseInt(t[0].replace(/[^0-9]/g,""))-1,e[1]=parseInt(t[1].replace(/[^0-9]/g,""))-1,!(e[0]>e[1]||(r[0]=F(t[0].replace(/[^A-Za-z]/g,"")),r[1]=F(t[1].replace(/[^A-Za-z]/g,"")),r[0]>r[1]||!t[0].toString().match(l)||!t[1].toString().match(l)))}}}function G(e){return!!/[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/.test(e)||!/[^\u4e00-\u9fa5]/.test(e)}function U(e){return!/[^\u0800-\u4e00]/.test(e)}function H(e){return e>12592&&e<12687||e>=44032&&e<=55203}function X(e){if(!e||e?.length<=0)return[];let t=(n=(e=e.toUpperCase()).split(" ").filter(e=>e&&e.trim()),n?.map(e=>{if(e.includes(":")){let t=e.split(":");2===t?.length&&(n=n.concat(function(e){let t=[];const r=new RegExp(/[A-Z]+|[0-9]+/g),n=e[0]?.match(r),l=e[1]?.match(r),a=Math.max(F(n[0]),F(l[0])),i=Math.min(F(n[0]),F(l[0])),s=Math.max(parseInt(n[1]),parseInt(l[1])),o=Math.min(parseInt(n[1]),parseInt(l[1]));for(let e=i;e<=a;e++)for(let r=o;r<=s;r++)t.push(`${N(e)}${r}`);return t}(t))).splice(n.indexOf(e),1)}}),n.filter((e,t,r)=>r.indexOf(e)===t)),r=[];var n;for(let e=0;e<t.length;e++){let n=W(t[e]);n&&r.push(n)}return r}function W(e){let t=e.match(/[A-Z]+|[0-9]+/g),r=t.length,n=new RegExp("^[A-Z]+$"),l="";for(let e=r-1;e>=0;e--){let r=t[e];n.test(r)?l+=F(r)+"_":l+=parseInt(r)-1+"_"}return l.substring(0,l.length-1)}function V(e){if(!e&&e?.length<=0)return"";const t=e.length,r=e.lastIndexOf("!"),n=[e.slice(0,r),e.slice(r+1,t)],l=n[1]||"",a=l.indexOf("R"),i=l.indexOf("C"),s=Number(l.slice(a+1,i)),o=N(Number(l.slice(i+1,l?.length))-1);return`${n[0]}!${o}${s}`}function $(e){if(!e||e?.length<=0)return{};const t=new RegExp("</x14:formula[^]>","g"),r=e.match(t)?.length,n=`</x14:formula${r}>`,l=e.indexOf(n);let a=e.substring(0,l+n.length);a=a.replace(/<xm:f>/g,"").replace(/<\/xm:f>/g,"").replace(/x14:/g,"").replace(/\/x14:/g,"");const i=a,s=e.indexOf("<xm:sqref>"),o=e.indexOf("</xm:sqref>");return{formula:i,sqref:e.substring(s+10,o)}}function z(e){if(!e||e?.length<=0)return[];const t=new RegExp("formula","g"),r=(e.match(t)?.length||0)/2;if(0===r)return[];let n=[];for(let t=1;t<=r;t++){const r=`<formula${t}>`?.length,l=e.indexOf(`<formula${t}>`),a=e.indexOf(`</formula${t}>`),i=e.substring(l+r,a);n.push(B(i.replace(/&quot;|^\"|\"$/g,"")))}return n}function q(e){e.indexOf("!")>-1&&(e=e.split("!")[1]);const t=e.match(/^(\$?)([A-Za-z]+)(\$?)(\d+)$/);if(!t)return[!1,!1];const r="$"===t[1];return["$"===t[3],r]}function j(e){if(null==e||0===e.length)return Number.NaN;const t=e.toLowerCase().split(""),r=t.length,n=e=>e.charCodeAt(0)-96;let l=0,a=0;for(let e=0;e<r;e++)a=n(t[e]),l+=a*26**(r-e-1);return 0===l?Number.NaN:l-1}k.operator="==|!=|<>|<=|>=|=|+|-|>|<|/|*|%|&|^",k.error={v:"#VALUE!",n:"#NAME?",na:"#N/A",r:"#REF!",d:"#DIV/0!",nm:"#NUM!",nl:"#NULL!",sp:"#SPILL!"},k.operatorjson=null;const Y="A".charCodeAt(0),Z="Z".charCodeAt(0);function K(e){const t=Z-Y+1;let r="";for(;e>=0;)r=String.fromCharCode(e%t+Y)+r,e=Math.floor(e/t)-1;return r}function J(e){if(null==e)return e;try{return Number.isNaN(Number(e))?e:Number(e)}catch(t){return e}}function Q(r=21,n){return n?e(n,r)():t(r)}function ee(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return null}}function te(e){return"[object Object]"===Object.prototype.toString.call(e)}class re{escapeXmlAttributes(e){let t=!1;const r=e.replace(/([\w:]+)="([^"]*)"/g,(e,r,n)=>{if(n.includes(">")){const e=n.replace(/>/g,"__GT__");return t=!0,o(`\ud83d\udd04 [ReadXml] Escaping attribute: ${r}="${n}" -> ${r}="${e}"`),`${r}="${e}"`}return e});return t&&o("\ud83d\udd04 [ReadXml] Escaped problematic characters in XML"),r}unescapeXmlAttributes(e){return e.includes("__GT__")?(o("\ud83d\udd04 [ReadXml] Unescaping XML attributes"),e.replace(/__GT__/g,">")):e}getElementsByOneTag(e,t){const r=this.escapeXmlAttributes(t);let n;if(e.indexOf("|")>-1){let t=e.split("|"),r="";for(let e=0;e<t.length;e++){let n=t[e];r+="|<"+n+" [^>]+?[^/]>[\\s\\S]*?</"+n+">|<"+n+" [^>]+?/>|<"+n+">[\\s\\S]*?</"+n+">|<"+n+"/>"}r=r.substr(1,r.length),n=new RegExp(r,"g")}else n=new RegExp("<"+e+" [^>]+?[^/]>[\\s\\S]*?</"+e+">|<"+e+" [^>]+?/>|<"+e+">[\\s\\S]*?</"+e+">|<"+e+"/>","g");let l=r.match(n);return null==l?[]:l.map(e=>this.unescapeXmlAttributes(e))}getElementByTagLink(e,t){const r=(new DOMParser).parseFromString(t,"text/xml");let n=Array.from(r.children);if(e.indexOf("/")>-1){let t=e.split("/");for(let e=0;e<t.length;e++){const r=t[e],l=n.findIndex(e=>Array.from(e.children).findIndex(e=>e.tagName===r)>-1);if(-1===l&&e<=t.length-1)return[];n=Array.from(n[l].children).filter(e=>e.tagName===r)}}else n=Array.from(n[0].children).filter(t=>t.tagName===e);const l=new XMLSerializer;return n.map(e=>l.serializeToString(e))}}class ne extends re{constructor(e){super(),this.originFile=e}getElementsByTagName(e,t,r=!0){let n=this.getFileByName(t);r||(n=t);let l,a=e.split("/");for(let e in a){let t=a[e];if(null==l)l=this.getElementsByOneTag(t,n);else if(l instanceof Array){let e=[];for(let r in l){let n=l[r];e=e.concat(this.getElementsByOneTag(t,n))}l=e}else l=this.getElementsByOneTag(t,l)}let i=[];for(let e=0;e<l.length;e++){let t=new le(l[e]);i.push(t)}return i}getElementsByTagNameLink(e,t,r=!0){let n=this.getFileByName(t);r||(n=t);const l=this.getElementByTagLink(e,n);let a=[];for(let e=0;e<l.length;e++){let t=new le(l[e]);a.push(t)}return a}getFileByName(e){for(let t in this.originFile)if(t.indexOf(e)>-1)return this.originFile[t];return""}}class le extends re{constructor(e){super(),this.elementString=e,this.setValue();const t=new RegExp('[a-zA-Z0-9_:]*?=".*?"',"g");let r=this.container.match(t);if(this.attributeList={},null!=r)for(let e in r){let t=r[e];if(0==t.length)continue;let n=t.substr(0,t.indexOf("=")),l=t.substr(t.indexOf("=")+1);null!=n&&null!=l&&0!=n.length&&0!=l.length&&(this.attributeList[n]=l.substr(1,l.length-2))}}get(e){return this.attributeList[e]}getInnerElements(e){let t=this.getElementsByOneTag(e,this.elementString),r=[];for(let e=0;e<t.length;e++){let n=new le(t[e]);r.push(n)}return 0==r.length?null:r}getInnerElementsTagLink(e){const t=this.getElementByTagLink(e,this.elementString);let r=[];for(let e=0;e<t.length;e++){let n=new le(t[e]);r.push(n)}return 0==r.length?null:r}setValue(){let e=this.elementString;if("/>"==e.substr(e.length-2,2))this.value="",this.container=e;else{let t=this.getFirstTag(),r=new RegExp("(<"+t+" [^>]+?[^/]>)([\\s\\S]*?)</"+t+">|(<"+t+">)([\\s\\S]*?)</"+t+">","g").exec(e);null!=r&&(null!=r[1]?(this.container=r[1],this.value=r[2]):(this.container=r[3],this.value=r[4]))}}getFirstTag(){let e=this.elementString,t=e.substr(0,e.indexOf(" "));return(""==t||t.indexOf(">")>-1)&&(t=e.substr(0,e.indexOf(">"))),t=t.substr(1,t.length),t}}function ae(e,t,r="g"){let n=e.attributeList,l=t.clrScheme,a=t.indexedColors;t.mruColors;let i,s=function(e,t){let r={};if(null==e||0==e.length)return t;for(let n in t){let l=t[n],a=e[parseInt(n)];if(null==a)r[n]=l;else{let e=a.attributeList.rgb;r[n]=e}}return r}(a,C),o=n.indexed,c=n.rgb,u=n.theme,h=n.tint;if(null!=o)i=s[parseInt(o)],null!=i&&(i=i.substring(i.length-6,i.length),i="#"+i);else if(null!=c)c=c.substring(c.length-6,c.length),i="#"+c;else if(null!=u){let e=parseInt(u);0==e?e=1:1==e?e=0:2==e?e=3:3==e&&(e=2);let t=l[e];if(null!=t){let e=t.getInnerElements("a:sysClr|a:srgbClr");if(null!=e){let t=e[0],r=t.attributeList;t.container.indexOf("sysClr")>-1?null!=r.lastClr?i="#"+r.lastClr:null!=r.val&&(i="#"+r.val):t.container.indexOf("srgbClr")>-1&&(i="#"+r.val)}}}if(null!=h){let e=parseFloat(h);null!=i&&(i=function(e,t){let r=e.substring(e.length-6,e.length),n=_("#"+r),l=function(e,t,r){e/=255,t/=255,r/=255;var n,l,a=Math.max(e,t,r),i=Math.min(e,t,r),s=(a+i)/2;if(a==i)n=l=0;else{var o=a-i;switch(l=s>.5?o/(2-a-i):o/(a+i),a){case e:n=(t-r)/o+(t<r?6:0);break;case t:n=(r-e)/o+2;break;case r:n=(e-t)/o+4}n/=6}return[n,l,s]}(n[0],n[1],n[2]);if(t>0)l[2]=l[2]*(1-t)+t;else{if(!(t<0))return"#"+r;l[2]=l[2]*(1+t)}return function(e){if(/^(rgb|RGB)/.test(e)){for(var t=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(","),r="#",n=0;n<t.length;n++){var l=Number(t[n]).toString(16);l.length<2&&(l="0"+l),r+=l}return 7!==r.length&&(r=e),r}if(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e)){var a=e.replace(/#/,"").split("");if(6===a.length)return e;if(3===a.length){var i="#";for(n=0;n<a.length;n+=1)i+=a[n]+a[n];return i}}return e}("RGB("+function(e,t,r){var n,l,a;if(0==t)n=l=a=r;else{var i=function(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e},s=r<.5?r*(1+t):r+t-r*t,o=2*r-s;n=i(o,s,e+1/3),l=i(o,s,e),a=i(o,s,e-1/3)}return[Math.round(255*n),Math.round(255*l),Math.round(255*a)]}(l[0],l[1],l[2]).join(",")+")")}(i,e))}return i}function ie(e,t){let r,n=e.getInnerElements(t);if(null!=n&&n.length>0)if("b"==t||"i"==t||"strike"==t)r="1";else if("u"==t){let e=n[0].attributeList.val;r="double"==e?"2":"singleAccounting"==e?"3":"doubleAccounting"==e?"4":"1"}else if("vertAlign"==t){let e=n[0].attributeList.val;"subscript"==e?r="1":"superscript"==e&&(r="2")}else r=n[0].attributeList.val;return r}class se{}class oe{}class ce{}class ue{}class he{}class de{}class fe{}class ge{}class me{}class pe{}class Ee{}class Ce{}class ye{}class Te{}class we{}class Re{}class Se{}var be;function Ae(e,t){if(null==e)return null;let r=e[0],n=r.attributeList.style;if(null==n||"none"==n)return null;let l=r.getInnerElements("color"),a="#000000";null!=l&&(a=ae(l[0],t,"b"),null==a&&(a="#000000"));let i=new Ce;return i.style=y[n],i.color=a,i}function ve(e,t){const r=new Ee;let n=!1;if(!e)return{borderCellValue:r,isAdd:n};let l=e.getInnerElements("left"),a=e.getInnerElements("right"),i=e.getInnerElements("top"),s=e.getInnerElements("bottom"),o=e.getInnerElements("diagonal"),c=e.getInnerElements("start"),u=e.getInnerElements("end"),h=Ae(l,t),d=Ae(a,t),f=Ae(i,t),g=Ae(s,t),m=Ae(o,t),p=Ae(c,t),E=Ae(u,t);if(null!=p&&null!=p.color&&(r.l=p,n=!0),null!=E&&null!=E.color&&(r.r=E,n=!0),null!=h&&null!=h.color&&(r.l=h,n=!0),null!=d&&null!=d.color&&(r.r=d,n=!0),null!=f&&null!=f.color&&(r.t=f,n=!0),null!=g&&null!=g.color&&(r.b=g,n=!0),null!=m&&null!=m.color){const t=e.attributeList.diagonalUp,l=e.attributeList.diagonalDown;"1"===t&&(r.bl_tr=m),"1"===l&&(r.tl_br=m),n=!0}return{borderCellValue:r,isAdd:n}}function Ie(e,t){let r=e.getInnerElements("patternFill");if(null!=r){let e,n,l=r[0],a=l.getInnerElements("fgColor"),i=l.getInnerElements("bgColor");if(null!=a&&(e=ae(a[0],t)),null!=i&&(n=ae(i[0],t)),null!=e)return e;if(null!=n)return n}else if(null!=e.getInnerElements("gradientFill"))return null}function Le(e,t){let r=null;const n=new de;let l=e.getInnerElements("sz"),a=e.getInnerElements("color"),i=e.getInnerElements("name"),s=e.getInnerElements("family");e.getInnerElements("charset");let o=e.getInnerElements("b"),c=e.getInnerElements("i"),u=e.getInnerElements("strike"),h=e.getInnerElements("u");if(null!=l&&l.length>0){let e=l[0].attributeList.val;null!=e&&(n.fs=parseInt(e))}if(null!=a&&a.length>0){let e=ae(a[0],t,"t");null!=e&&(n.fc=e)}if(null!=s&&s.length>0){let e=s[0].attributeList.val;null!=e&&(r=w[e])}if(null!=i&&i.length>0){let e=i[0].attributeList.val;null!=e&&(n.ff=e)}if(null!=o&&o.length>0){let e=o[0].attributeList.val;n.bl="0"==e?0:1}if(null!=c&&c.length>0){let e=c[0].attributeList.val;n.it="0"==e?0:1}if(null!=u&&u.length>0){let e=u[0].attributeList.val;n.cl="0"==e?0:1}if(null!=h&&h.length>0){let e=h[0].attributeList.val;n.un="single"==e?1:"double"==e?2:"singleAccounting"==e?3:"doubleAccounting"==e?4:0}return{cellValue:n,familyFont:r}}!function(e){e[e.NONE=0]="NONE",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL"}(be||(be={}));const Fe=e=>e.split(" ").map(e=>{const t=e.split(":"),r=parseInt(t[0].replace(/[^0-9]/g,""))-1,n=j(t[0].replace(/[^A-Za-z]/g,"")),l=q(t[0]),a=1===t.length?r:parseInt(t[1].replace(/[^0-9]/g,""))-1,i=1===t.length?n:j(t[1].replace(/[^A-Za-z]/g,"")),s=1===t.length?l:q(t[1]),o=e=>!0===e[0]&&!0===e[1]?be.ALL:!0===e[0]?be.ROW:!0===e[1]?be.COLUMN:be.NONE;return{startRow:r,startColumn:n,endRow:a,endColumn:i,startAbsoluteRefType:o(l),endAbsoluteRefType:o(s),rangeType:0}});var Ne;!function(e){e.UTF8="UTF-8",e.GBK="GBK",e.CP936="CP936",e.ISO8859="ISO-8859"}(Ne||(Ne={}));const Oe=e=>e.replace(/_x000D_/g,"").replace(/&#13;&#10;/g,"\r\n").replace(/&#13;/g,"\r").replace(/&#10;/g,"\n");class xe extends he{constructor(e,t,r,n,l,a,i,s,o){super(),this.cell=e,this.sheetFile=a,this.styles=r,this.sharedStrings=n,this.readXml=o,this.mergeCells=l,this.cellImages=i,this.imageList=s,this.cellSize=t;let c=e.attributeList,u=c.r,h=c.s,d=c.t,f=L(u);this.r=f.row[0],this.c=f.column[0],this.v=this.generateValue(h,d)}generateValue(e,t){let r=this.cell.getInnerElements("v"),n=this.cell.getInnerElements("f");null==r&&(r=this.cell.getInnerElements("t"));let l=this.styles.cellXfs,a=this.styles.cellStyleXfs;this.styles.cellStyles;let i=this.styles.fonts,s=this.styles.fills,o=this.styles.borders,c=this.styles.numfmts;this.styles.clrScheme;let u=this.sharedStrings,h=new de;if(null!=n){let e=n[0].attributeList,t=e.t,r=e.ref,l=e.si,a=n[0].value;"shared"==t?(this._fomulaRef=r,this._formulaType=t,this._formulaSi=l):"array"==t&&(this._fomulaRef=r,this._formulaType=t),(null!=r||null!=a&&a.length>0)&&(a=B(a),h.f="="===a[0]?a:"="+a,h.f.startsWith("=+")&&(h.f="="+h.f.substring(2)),"array"!=t&&"shared"!=t||(h.ft=t,r&&(h.ref=r)))}let d,f=null;if(null!=e){let r,n,u,g,m,p,E,C,y,T=l[parseInt(e)],w=T.attributeList.xfId;if(null!=w){let e=a[parseInt(w)],t=e.attributeList,l=t.applyNumberFormat,i=t.applyFont,s=t.applyFill,o=t.applyBorder,c=t.applyAlignment;if(t.applyProtection,d=t.quotePrefix,"0"!=l&&null!=t.numFmtId&&(r=t.numFmtId),"0"!=i&&null!=t.fontId&&(n=t.fontId),"0"!=s&&null!=t.fillId&&(u=t.fillId),"0"!=o&&null!=t.borderId&&(g=t.borderId),null!=c&&"0"!=c){let t=e.getInnerElements("alignment");if(null!=t){let e=t[0].attributeList;null!=e.horizontal&&(m=e.horizontal),null!=e.vertical&&(p=e.vertical),null!=e.wrapText&&(E=e.wrapText),null!=e.textRotation&&(C=e.textRotation),null!=e.shrinkToFit&&e.shrinkToFit,null!=e.indent&&(y=e.indent)}}}let R=T.attributeList.applyNumberFormat,S=T.attributeList.applyFont,b=T.attributeList.applyFill,A=T.attributeList.applyBorder,v=T.attributeList.applyAlignment;if(null!=T.attributeList.applyProtection&&T.attributeList.applyProtection,null!=T.attributeList.quotePrefix&&(d=T.attributeList.quotePrefix),"0"!=R&&null!=T.attributeList.numFmtId&&(r=T.attributeList.numFmtId),"0"!=S&&(n=T.attributeList.fontId),"0"!=b&&(u=T.attributeList.fillId),"0"!=A&&(g=T.attributeList.borderId),"0"!=v){let e=T.getInnerElements("alignment");if(null!=e&&e.length>0){let t=e[0].attributeList;null!=t.horizontal&&(m=t.horizontal),null!=t.vertical&&(p=t.vertical),null!=t.wrapText&&(E=t.wrapText),null!=t.textRotation&&(C=t.textRotation),null!=t.shrinkToFit&&t.shrinkToFit,null!=t.indent&&(y=t.indent)}}if(null!=r){let e=c[parseInt(r)],n=new fe;n.fa=B(e),n.t=t||"d",h.ct=n}if(null!=u){let e=Ie(s[parseInt(u)],this.styles);null!=e&&(h.bg=e)}if(null!=n){let e=i[parseInt(n)];if(null!=e){const{cellValue:t,familyFont:r}=Le(e,this.styles);h={...h,...t},f=r}}if(null!=m&&(h.ht="center"==m||"centerContinuous"==m?0:"left"==m?1:"right"==m?2:"distributed"==m?0:"fill"==m||"general"==m?1:"justify"==m?0:1),h.vt=null!=p?"bottom"==p?2:"center"==p||"distributed"==p||"justify"==p?0:1:2,h.tb=null!=E&&"1"==E?2:1,null!=C&&("255"==C?h.tr=3:(h.tr=0,h.rt=parseInt(C))),null!=y){const e=parseInt(y);isNaN(e)||(h.ti=e)}if(null!=g){let e=o[parseInt(g)],t=new pe;t.rangeType="cell";const{isAdd:r,borderCellValue:n}=ve(e,this.styles);n.row_index=this.r,n.col_index=this.c,r&&(t.value=n,this._borderObject=t)}}else h.tb=1;if(null!=r){let e=r[0].value;/&#\d+;/.test(e)&&(e=this.htmlDecode(e));const n=e=>{let t=e.getInnerElements("r");if(null==t){let t=e.getInnerElements("t");if(null!=t){let e="";if(t.forEach(t=>{e+=t.value}),e=B(e),/&#\d+;/.test(e)&&(e=this.htmlDecode(e)),"Roman"==f&&e.length>0){let t=e.split(""),r=null,n="",l=null,a="Times New Roman";null!=h.ff&&(a=h.ff);let i=h.ct;null==i&&(i=new fe),null==i.s&&(i.s=[]);for(let e=0;e<t.length;e++){let s=t[e],o=null,c=a;if(G(s)?(o="c",c="\u5b8b\u4f53"):U(s)?(o="j",c="Yu Gothic"):H(s)?(o="k",c="Malgun Gothic"):o="e",o!=r&&null!=r||e==t.length-1){let a=new ge;if(a.ff=l,null!=h.fc&&(a.fc=h.fc),null!=h.fs&&(a.fs=h.fs),null!=h.cl&&(a.cl=h.cl),null!=h.un&&(a.un=h.un),null!=h.bl&&(a.bl=h.bl),null!=h.it&&(a.it=h.it),e==t.length-1){if(o!=r){a.ff=l,a.v=n,i.s.push(a);let e=new ge;e.ff=c,e.v=s,null!=h.fc&&(e.fc=h.fc),null!=h.fs&&(e.fs=h.fs),null!=h.cl&&(e.cl=h.cl),null!=h.un&&(e.un=h.un),null!=h.bl&&(e.bl=h.bl),null!=h.it&&(e.it=h.it),i.s.push(e);break}a.ff=c,a.v=n+s}else a.v=n;i.s.push(a),n=s}else n+=s;r=o,l=c}i.t="inlineStr",h.ct=i}else if(e=Oe(e),e.indexOf("\r\n")>-1||e.indexOf("\n")>-1){let t=new ge;t.v=e;let r=h.ct;null==r&&(r=new fe),null!=h.ff&&(t.ff=h.ff),null!=h.fc&&(t.fc=h.fc),null!=h.fs&&(t.fs=h.fs),null!=h.cl&&(t.cl=h.cl),null!=h.un&&(t.un=h.un),null!=h.bl&&(t.bl=h.bl),null!=h.it&&(t.it=h.it),r.t="inlineStr",r.s=[t],h.ct=r}else h.v=e,d="1"}}else{let e=[];t.forEach(t=>{let r=t.getInnerElements("t"),n=t.getInnerElements("rPr"),l=new ge;if(null!=r&&r.length>0){let e=r[0].value;e=Oe(e),e=B(e),l.v=e}if(null!=n&&n.length>0){let e=n[0],t=ie(e,"sz"),r=ie(e,"rFont");ie(e,"family"),ie(e,"charset"),ie(e,"scheme");let a,i,s=ie(e,"b"),o=ie(e,"i"),c=ie(e,"u"),u=ie(e,"strike"),d=ie(e,"vertAlign"),f=e.getInnerElements("color");null!=f&&f.length>0&&(a=ae(f[0],this.styles,"t")),null!=r&&(i=r),null!=i?l.ff=i:null!=h.ff&&(l.ff=h.ff),null!=a&&(l.fc=a),null!=t?l.fs=parseInt(t):null!=h.fs&&(l.fs=h.fs),null!=u?l.cl=parseInt(u):null!=h.cl&&(l.cl=h.cl),null!=c?l.un=parseInt(c):null!=h.un&&(l.un=h.un),null!=s?l.bl=parseInt(s):null!=h.bl&&(l.bl=h.bl),null!=o?l.it=parseInt(o):null!=h.it&&(l.it=h.it),null!=d&&(l.va=parseInt(d))}else null==l.ff&&null!=h.ff&&(l.ff=h.ff),null==l.fc&&null!=h.fc&&(l.fc=h.fc),null==l.fs&&null!=h.fs&&(l.fs=h.fs),null==l.cl&&null!=h.cl&&(l.cl=h.cl),null==l.un&&null!=h.un&&(l.un=h.un),null==l.bl&&null!=h.bl&&(l.bl=h.bl),null==l.it&&null!=h.it&&(l.it=h.it);e.push(l)});let r=h.ct;null==r&&(r=new fe),r.t="inlineStr",r.s=e,h.ct=r}};if("s"==t)n(u[parseInt(r[0].value)]);else if("inlineStr"==t&&null!=r){h.v=this.htmlDecode(e);let t=h.ct;null==t&&(t=new fe),t.t="s",h.ct=t;let r=this.cell.getInnerElements("is");r.length&&n(r[0])}else if("str"==t&&e.includes("=DISPIMG")){let t=h.ct;null==t&&(t=new fe),t.t="str",t.ci=this.getCellImage(h,e),h.ct=t}else e=B(e),h.v=e}if(null!=d&&(h.qp=parseInt(d)),null!==t&&!h.ct?.t){let e=new fe;e.t=t||"d",h.ct=e}return h}htmlDecode(e){return e.replace(/&#(x)?([^&]{1,5});/g,function(e,t,r){return String.fromCharCode(parseInt(r,t?16:10))})}getCellImage(e,t){const r=this.extractImageId(t);let n={};return this.cellImages.forEach(e=>{const t=e.getInnerElements("xdr:pic")[0],l=t.getInnerElements("xdr:nvPicPr")[0].getInnerElements("xdr:cNvPr")[0],a=t.getInnerElements("xdr:blipFill")[0].getInnerElements("a:blip")[0],i=l.get("name"),s=a.get("r:embed");if(r==i){const e=this.getBase64ByRid(s,"xl/_rels/cellimages.xml.rels");n=e;let r=0,a=0,i=0,o=0;const c=t.getInnerElements("xdr:spPr")[0].getInnerElements("a:xfrm")[0],u=c.getInnerElements("a:off")[0],h=c.getInnerElements("a:ext")[0];i=O(parseInt(h.get("cx"))),o=O(parseInt(h.get("cy"))),r=O(parseInt(u.get("x"))),a=O(parseInt(u.get("y")));const d=i/this.cellSize.width,f=o/this.cellSize.height;d>1&&d>f&&(o/=d,i=this.cellSize.width),f>1&&f>d&&(i/=f,o=this.cellSize.height);let g={height:o,left:r,top:a,width:i};n.default=g,n.descr=l.get("descr")}}),n}extractImageId(e){const t=e.match(/ID_[A-Za-z0-9]{32}/);return t?t[0]:null}getBase64ByRid(e,t){let r=this.readXml.getElementsByTagName("Relationships/Relationship",t);if(null!=r&&r.length>0)for(let t=0;t<r.length;t++){let n=r[t].attributeList,l=x(n,"Id",null),a=x(n,"Target",null);if(l==e)return a=a.replace(/\.\.\//g,""),a="xl/"+a,this.imageList.getImageByName(a)}return{}}}var Me,Pe,_e,De,Be;!function(e){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"}(Me||(Me={})),function(e){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"}(Pe||(Pe={})),function(e){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||(_e={})),function(e){e.highlightCell="highlightCell",e.dataBar="dataBar",e.colorScale="colorScale",e.iconSet="iconSet"}(De||(De={})),function(e){e.uniqueValues="uniqueValues",e.duplicateValues="duplicateValues",e.rank="rank",e.text="text",e.timePeriod="timePeriod",e.number="number",e.average="average",e.formula="formula"}(Be||(Be={}));class ke{constructor(e,t,r){this.stopIfTrue=!1,this.handleRules=(e,t,r)=>{const{attributeList:n,value:l,extLst:a,isExtLst:i}=e,s=x(n,"type","expression"),o={type:De.highlightCell},c=x(n,"operator",""),u=x(n,"rank",""),h=t.getElementsByTagName("formula",l,!1);switch(x(n,"aboveAverage",""),c&&(o.operator=c),(h[0]?.value||"0"==h[0]?.value)&&(o.value=J(h[0]?.value)),s){case"expression":o.subType=Be.formula;break;case"cellIs":o.subType=Be.number;break;case"top10":o.subType=Be.rank;const e=x(n,"percent","0"),s=x(n,"bottom","0");u&&(o.value=J(u)),o.isBottom="1"===s,o.isPercent="1"===e;break;case"aboveAverage":o.subType=Be.average,o.operator=o.operator||_e.lessThan;break;case"timePeriod":o.subType=Be.timePeriod,o.operator=x(n,"timePeriod",void 0);break;case"duplicateValues":o.subType=Be.duplicateValues;break;case"containsText":o.subType=Be.text,o.operator="containsText",o.value=x(n,"text","");break;case"colorScale":const c=t.getElementsByTagName("colorScale/cfvo",l,!1),h=t.getElementsByTagName("colorScale/color",l,!1);o.type=De.colorScale,o.config=c.map((e,t)=>{const n=x(e.attributeList,"type",""),l=x(e.attributeList,"val",void 0);return{index:0,color:h[t]?ae(h[t],r):void 0,value:{type:n,value:J(l)}}});break;case"dataBar":o.type=De.dataBar;const d=t.getElementsByTagName("dataBar",l,!1)?.[0],f=t.getElementsByTagName("cfvo",d.value,!1),g=t.getElementsByTagName("color",d.value,!1),m=x(d.attributeList,"showValue","1");o.isShowValue="1"===m;let p=g[0]?ae(g[0],r):void 0,E=!0,C="";if(a){const e=x(t.getElementsByTagName("x14:dataBar",a.value,!1)[0].attributeList,"gradient",null),n=t.getElementsByTagName("x14:dataBar/x14:negativeFillColor",a.value,!1)?.[0];C=n?ae(n,r):void 0,E="0"!==e}o.config={min:{type:x(f[0]?.attributeList,"type","min"),value:J(x(f[0]?.attributeList,"val",void 0))},max:{type:x(f[1]?.attributeList,"type","max"),value:J(x(f[1]?.attributeList,"val",void 0))},isGradient:E,positiveColor:p,nativeColor:C};break;case"iconSet":if(o.type=De.iconSet,i){const e=t.getElementsByTagName("x14:iconSet",l,!1)[0],r=t.getElementsByTagName("x14:iconSet/x14:cfvo",l,!1),n=t.getElementsByTagName("x14:iconSet/x14:cfIcon",l,!1),a="1"===x(e?.attributeList,"custom","0");o.isShowValue="0"!==e?.attributeList?.showValue,o.config=r.map((r,l)=>{const i=t.getElementsByTagName("xm:f",r.value,!1)[0];let s=n[l]?.attributeList;const o=a?s?.iconSet:e?.attributeList.iconSet,c=J(o.charAt(0))-J(s?.iconId)-1;return{operator:_e.greaterThanOrEqual,value:{type:r.attributeList.type,value:J(i?.value)},iconType:o,iconId:c}}).reverse()}else{const e=t.getElementsByTagName("iconSet",l,!1),r=t.getElementsByTagName("iconSet/cfvo",l,!1);o.isShowValue="0"!==e[0]?.attributeList?.showValue,o.config=r.map((t,r)=>({operator:o.operator||_e.greaterThanOrEqual,value:{type:t.attributeList.type,value:J(t.attributeList.val)},iconType:e[0].attributeList.iconSet,iconId:r}))}}const d=x(n,"dxfId",null);if(d){let e=r.dxfs;const t=null!==d?e[Number(d)]:void 0,n=t.getInnerElements("font")?.[0],l=t.getInnerElements("numFmt")?.[0],a=t.getInnerElements("fill")?.[0],i=t.getInnerElements("border")?.[0];let s=r.numfmts,c={};if(i){const{borderCellValue:e}=ve(i,r);c.border=e}if(a){const e=Ie(a,r);c.bg=e}if(l){let e=s[parseInt(l?.attributeList?.numFmtId)],t=new fe;t.fa=e?B(e):l.attributeList.formatCode,c.ct=t}if(n){const{cellValue:e}=Le(n,c);c={...c,...e}}o.style=c}this.rule=o};const{attributeList:n,parentAttribute:l}=e;l?.sqref&&(this.ranges=Fe(l.sqref)),this.order=Number(x(n,"priority","1")),this.cfId=D("condition"),this.stopIfTrue="1"===x(n,"stopIfTrue","0"),this.handleRules(e,t,r)}}class Ge{constructor(e,t){let r=e.attributeList,n=e.value,l=x(r,"type",void 0);if(!l)return;this.uid=D("verification");let a=[],i="";const s=x(r,"operator",void 0),o="1"===x(r,"allowBlank",void 0),c="1"===x(r,"showInputMessage",void 0),u="1"===x(r,"showErrorMessage",void 0),h=x(r,"prompt",void 0),d=x(r,"promptTitle",void 0),f=x(r,"error",void 0),g=x(r,"errorTitle",void 0),m=x(r,"errorStyle","stop");if(new RegExp(/<x14:formula1>|<xm:sqref>/g).test(n)&&t?.length>=0){const e=$(n);i=e?.sqref,a=z(e?.formula)}else a=z(n),i=x(r,"sqref",null);let p=a?.length>=1?a[0]:void 0,E=2===a?.length?a[1]:void 0;switch(i&&(this.ranges=Fe(i)),this.type=l,this.allowBlank=o,this.operator=s,this.formula1=p,this.formula2=E,this.showErrorMessage=u,this.showInputMessage=c,this.prompt=h,this.promptTitle=d,this.error=f,this.errorTitle=g,m){case"information":this.errorStyle=0;break;case"warning":this.errorStyle=2;break;case"stop":this.errorStyle=1}this.ranges=Fe(i)}}class Ue{constructor(e,t){const r=e.getElementsByTagName("autoFilter",t)[0];if(!r)return;this.ref=Fe(r.attributeList.ref)?.[0];const n=r.getInnerElements("filterColumn");this.filterColumns=n?.map(e=>{const t=e.getInnerElements("customFilters")?.[0],r=e.getInnerElements("filters")?.[0];let n,l,a=J(e.attributeList.colId);if(a=this.ref?a+this.ref.startRow:a,t){const e=t.getInnerElements("customFilter");n={and:"1"===t.attributeList?.and?1:void 0,customFilters:e.map(e=>({val:Oe(e.attributeList.val),operator:e.attributeList?.operator}))}}if(r){const e=r.getInnerElements("filter");l={blank:"1"===r.attributeList?.blank,filters:e.map(e=>Oe(e.attributeList.val))}}return{colId:a,filters:l,customFilters:n}})}}class He{constructor(e){const t=x(e.attributeList,"xSplit","0"),r=x(e.attributeList,"ySplit","0");this.horizen=Number(r),this.vertical=Number(t)}}const Xe=(e,t)=>{const r=e.getElementsByTagName("c:barChart",t)[0],n=e.getElementsByTagName("c:lineChart",t)[0],l=e.getElementsByTagName("c:pieChart",t)[0],a=e.getElementsByTagName("c:doughnutChart",t)[0],i=e.getElementsByTagName("c:areaChart",t)[0],s=e.getElementsByTagName("c:radarChart",t)[0],o=e.getElementsByTagName("c:scatterChart",t)[0];let c=[],u=r,h=v.Column;if(r){const e=r.getInnerElements("c:barDir")?.[0]?.get("val"),t=r.getInnerElements("c:grouping")?.[0]?.get("val");"col"===e?(h=v.Column,"stacked"===t?h=v.ColumnStacked:"percentStacked"===t&&(h=v.ColumnPercentStacked)):"bar"===e&&(h=v.Bar,"stacked"===t?h=v.BarStacked:"percentStacked"===t&&(h=v.BarPercentStacked)),u=r,c.push({chartEle:u,chartType:h})}if(n&&(u=n,h=v.Line,c.push({chartEle:u,chartType:h})),l&&(u=l,h=v.Pie,c.push({chartEle:u,chartType:h})),a&&(u=a,h=v.Doughnut,c.push({chartEle:u,chartType:h})),i){u=i,h=v.Area;const e=i.getInnerElements("c:grouping")?.[0]?.get("val");"stacked"===e?h=v.AreaStacked:"percentStacked"===e&&(h=v.AreaPercentStacked),c.push({chartEle:u,chartType:h})}return s&&(u=s,h=v.Radar,c.push({chartEle:u,chartType:h})),o&&(u=o,h=v.Scatter,c.push({chartEle:u,chartType:h})),c.length>1&&(h=v.Combination,u=c),{chartEle:u,chartType:h}};class We extends Re{constructor(e,t,r,n){super(),this.id=e,this.type="chart",this.data={chartType:n,range:r,border:"#979DAC",background:"rgba(0,0,0,0)",isRowDirection:!0};let l=0,a=0,i=0,s=0;const o=t.getInnerElements("a:off")[0],c=t.getInnerElements("a:ext")[0];i=O(parseInt(c.get("cx"))),s=O(parseInt(c.get("cy"))),l=O(parseInt(o.get("x"))),a=O(parseInt(o.get("y"))),this.transform={width:i,height:s,top:a,left:l}}}class Ve{constructor({graphicFrame:e,readXml:t,drawingRelsFile:r,styles:n}){this.getChartRange=e=>{try{let t=0,r=0,n=0,l=0;if(Array.isArray(e))e.map(e=>this.getChartRef(e.chartEle.value)).forEach((e,a)=>{0===a?(t=e.maxColumn,r=e.maxRow,n=e.minColumn,l=e.minRow):(t=Math.max(t,e.maxColumn),r=Math.max(r,e.maxRow),n=Math.min(n,e.minColumn),l=Math.min(l,e.minRow))});else{const a=this.getChartRef(e.value);t=a.maxColumn,r=a.maxRow,n=a.minColumn,l=a.minRow}const a=K(t)+(r+1);return K(n)+(l+1)+":"+a}catch(e){return u("Error getting chart range:",e),"A1:B2"}},this.getChartRef=e=>{try{const t=this.readXml.getElementsByTagName("c:ser/c:cat/c:numRef/c:f",e,!1)?.[0],r=this.readXml.getElementsByTagName("c:ser/c:cat/c:strRef/c:f",e,!1)?.[0],n=this.readXml.getElementsByTagName("c:ser/c:xVal/c:strRef/c:f",e,!1)?.[0],l=this.readXml.getElementsByTagName("c:ser/c:xVal/c:numRef/c:f",e,!1)?.[0],a=t||r||n||l,i=this.readXml.getElementsByTagName("c:ser/c:tx/c:strRef/c:f",e,!1),s=this.readXml.getElementsByTagName("c:ser/c:val/c:numRef/c:f",e,!1),o=i?.[i.length-1]||s?.[s.length-1],u=a;if(!(u&&o&&u.value&&o.value))return c("Chart missing data references, using default range"),{maxColumn:1,maxRow:1,minColumn:0,minRow:0};const h=L(u.value),d=L(o.value),f=[...h.column,...d.column],g=[...h.row,...d.row],m=Math.max(...f);return{maxColumn:m,maxRow:Math.max(...g),minColumn:Math.min(...f),minRow:Math.min(...g)}}catch(e){return u("Error parsing chart references:",e),{maxColumn:1,maxRow:1,minColumn:0,minRow:0}}},this.readXml=t;const l=e.getInnerElements("xdr:xfrm")[0],a=function(e){const{rid:t,fileName:r,callback:n,readXml:l}=e;let a=l.getElementsByTagName("Relationships/Relationship",r);if(null!=a&&a.length>0)for(let e=0;e<a.length;e++){let r=a[e].attributeList,l=x(r,"Id",null),i=x(r,"Target",null);if(l==t)return i=i.replace(/\.\.\//g,""),n?n(i):i}return null}({rid:t.getElementsByTagName("a:graphic/a:graphicData/c:chart",e.value,!1)[0].get("r:id"),fileName:r,readXml:t}),{chartEle:i,chartType:s}=Xe(t,a),o=this.getChartRange(i),h=Q();this.image=new We(h,l,o,s);const d=new $e({id:h,range:o,chartType:s,chartFile:a,readXml:t,image:this.image,styles:n});this.chart=d.model}}class $e extends Se{constructor(e){super(),this.getStyle=e=>{const t=this.readXml.getElementsByTagNameLink("c:spPr",this.chartFile)[0],r=t.getInnerElements("a:solidFill")[0],n=t.getInnerElements("a:ln")[0],l=r?this.getColor(r.getInnerElements("a:schemeClr")[0]):void 0,a=n?this.getColor(n.getInnerElements("a:schemeClr")[0]):void 0,i=this.getAllTitle(),s=this.readXml.getElementsByTagNameLink("c:chart/c:autoTitleDeleted",this.chartFile)[0],o=this.readXml.getElementsByTagNameLink("c:chart/c:plotArea",this.chartFile)[0],c=this.getAxis(o?.getInnerElements("c:catAx")?.[0]),u=this.getAxis(o?.getInnerElements("c:valAx")?.[0]),h=this.readXml.getElementsByTagNameLink("c:chart/c:legend",this.chartFile)[0],d=this.getLegend(h);return{titles:{...i,titlePosition:"1"===s?.get("val")?"hide":"top"},runtime:{},width:e.transform.width,height:e.transform.height,backgroundColor:l,borderColor:a,xAxis:c,yAxis:u,legend:d,...this.getChartSeries()}},this.getChartSeries=()=>{const{chartEle:e,chartType:t}=Xe(this.readXml,this.chartFile);if(!e)return{};if(Array.isArray(e))return{seriesStyleMap:e.map(e=>this.getChartSeriesBase(e.chartEle,e.chartType,!0)).reduce((e,t)=>Object.assign(e,t),{})};const r=e.getInnerElementsTagLink("c:dLbls")[0].getInnerElements("c:showVal")[0];return{allSeriesStyle:{label:{visible:!!r&&"1"===r.get("val")}},seriesStyleMap:this.getChartSeriesBase(e,t)}},this.getChartSeriesBase=(e,t,r)=>{const n=e.getInnerElements("c:ser"),l={};return n.forEach(e=>{const n=e.getInnerElements("c:idx")[0],a=parseInt(n.get("val"))+1,i=e.getInnerElements("c:spPr")[0],s=i?.getInnerElementsTagLink("a:solidFill")?.[0],o=i?.getInnerElements("a:ln")?.[0],c=this.getColor(s?.getInnerElements("a:schemeClr")?.[0]),u=s?.getInnerElements("a:alpha")?.[0]?.get("val"),h=o?this.getLine(o):void 0,d=e.getInnerElements("c:dLbls")[0],f=d.getInnerElements("c:showVal")?.[0]?.get("val"),g=d.getInnerElements("c:showCatName")?.[0]?.get("val"),m=d.getInnerElements("c:showSerName")?.[0]?.get("val"),p=d.getInnerElements("c:showPercent")?.[0]?.get("val"),E=this.getBaseStyle(d.getInnerElements("a:defRPr")?.[0]),C=0|("1"===f?I.Value:0)|("1"===g?I.CategoryName:0)|("1"===m?I.SeriesName:0)|("1"===p?I.Percentage:0),y={border:h,label:{visible:!!C,contentType:C,...E},color:c,fillOpacity:u?parseInt(u)/1e5:1,chartType:r?t:void 0};let T=this.getExtraSerise(y,e,t);l[a]=T}),l},this.getExtraSerise=(e,t,r)=>{if(r===v.Line){e.border?.color&&(e.color=e.border.color);const r=t.getInnerElements("c:marker")[0],n=r.getInnerElements("c:symbol")?.[0]?.get("val"),l=r.getInnerElements("c:size")?.[0]?.get("val"),a=r.getInnerElementsTagLink("c:spPr/a:solidFill/a:schemeClr")?.[0],i=this.getColor(a);e.point={color:i,size:l?parseInt(l):void 0,shape:"none"===n&&e.label.visible?"circle":n}}return e},this.getLegend=e=>{if(!e)return{position:"hide"};const t=e.getInnerElements("c:legendPos")[0]?.get("val"),r=e.getInnerElements("c:txPr")[0].getInnerElements("a:pPr")[0],n=this.getBaseStyle(r.getInnerElements("a:defRPr")[0]);return{position:t?{t:"top",b:"bottom",l:"left",r:"right"}[t]:"bottom",label:n}},this.getAxis=e=>{if(!e)return;const t=!e.getInnerElementsTagLink("c:spPr/a:ln/a:noFill")?.length,r=e.getInnerElements("c:scaling")[0],n="maxMin"===r?.getInnerElements("c:orientation")[0]?.get("val"),l=r?.getInnerElements("c:max")?.[0]?.get("val"),a=r?.getInnerElements("c:min")?.[0]?.get("val"),i=e.getInnerElements("c:lblAlgn")?.[0]?.get("val"),s=e.getInnerElements("c:txPr")[0],o=s.getInnerElements("a:pPr")[0],c=s?.getInnerElements("a:bodyPr")?.[0]?.get("rot"),u=this.getBaseStyle(o.getInnerElements("a:defRPr")[0]),h=e.getInnerElements("c:majorGridlines")?.[0],d=h?.getInnerElements("a:ln")[0],f=d?.get("w")?O(parseInt(d.get("w"))):void 0,g=e.getInnerElements("c:majorTickMark")?.[0],m=this.getColor(d?.getInnerElements("a:schemeClr")?.[0]);return{lineVisible:t,reverse:n,max:l?parseInt(l):void 0,min:a?parseInt(a):void 0,label:{axisTitleAlign:i?{l:"start",r:"end",ctr:"center"}[i]:"center",rotate:c&&parseInt(c)>0?parseInt(c)/6e4:0,...u},gridLine:{visible:!!h?.value,width:f,color:m},tick:{visible:"none"!==g?.get("val"),position:"out"===g?.get("val")?"outside":"inside",lineWidth:f}}},this.getLine=e=>{const t=e?.get("w")?O(parseInt(e.get("w"))):0,r=this.getColor(e?.getInnerElements("a:schemeClr")?.[0]),n=e.getInnerElements("a:prstDash")?.[0]?.get("val"),l={solid:"solid",dot:"dotted",dash:"dashed",sysDot:"dotted",sysDash:"dashed",lgDash:"dashed"};return{dashType:n&&l[n]?l[n]:"solid",color:r,width:t}},this.getAllTitle=()=>{const e=this.readXml.getElementsByTagNameLink("c:chart/c:title",this.chartFile)[0],t=this.readXml.getElementsByTagNameLink("c:chart/c:plotArea/c:catAx/c:title",this.chartFile)[0],r=this.readXml.getElementsByTagNameLink("c:chart/c:plotArea/c:valAx/c:title",this.chartFile)[0];return{title:this.getTitle(e),xAxisTitle:this.getTitle(t),yAxisTitle:this.getTitle(r)}},this.getTitle=e=>{if(!e)return;const t=e.getInnerElements("a:r"),r=e.getInnerElements("a:pPr")[0],n=this.getBaseStyle(r.getInnerElements("a:defRPr")[0]),l=t?.map(e=>this.getBaseStyle(e.getInnerElements("a:rPr")?.[0]))||[];return{content:t?.map(e=>e.getInnerElements("a:t")[0].value).join(""),...n,...l.length?l[0]:{}}},this.getBaseStyle=e=>{if(!e)return{};const t=e.getInnerElements("a:schemeClr")?.[0],r=e.getInnerElements("a:solidFill")?.[0],n=!t&&r?this.getThemColor(r):this.getColor(t),l={};return e.get("sz")&&(l.fontSize=parseInt(e.get("sz"))/100),e.get("b")&&(l.bold="1"===e.get("b")),e.get("i")&&(l.italic="1"===e.get("i")),n&&(l.color=n),l},this.getColor=e=>{if(!e)return;const t=e.get("val"),r=this.styles.clrScheme.find(e=>{const r=e.getInnerElements("a:sysClr|a:srgbClr")[0];return!!e.container.includes(t)||("tx1"===t?"windowText"===r.get("val"):"bg1"===t&&"window"===r.get("val"))});let n="#000000";r&&(n=this.getThemColor(r));const l=e.getInnerElements("a:lumMod")?.[0]?.get("val"),a=e.getInnerElements("a:lumOff")?.[0]?.get("val");return`rgb(${_(n).map(e=>{const t=l?e*parseInt(l)/1e5:e,r=a?Math.round(parseInt(a)/1e5*255):0;return Math.round(t+r)}).join(",")})`},this.getThemColor=e=>{let t="#000000";const r=e.getInnerElements("a:sysClr|a:srgbClr");if(null!=r){const e=r[0],n=e.attributeList;e.container.indexOf("sysClr")>-1?null!=n.lastClr?t="#"+n.lastClr:null!=n.val&&(t="#"+n.val):e.container.indexOf("srgbClr")>-1&&(t="#"+n.val)}return t},this.getContext=()=>({categoryIndex:0,seriesIndexes:this.readXml.getElementsByTagName("c:ser",this.chartFile).map(e=>{const t=e.getInnerElements("c:idx")[0];return parseInt(t.get("val"))+1})});const{id:t,range:r,chartType:n,chartFile:l,readXml:a,image:i,styles:s}=e;this.styles=s,this.range=r,this.chartType=n,this.readXml=a,this.chartFile=l,this.isRowDirection=!0,this.id=t,this.context=this.getContext(),this.style=this.getStyle(i)}get model(){return{id:this.id,range:this.range,chartType:this.chartType,context:this.context,style:this.style,isRowDirection:this.isRowDirection}}}class ze extends ce{constructor(e,t,r,n=!1,l){if(super(),this.getImageBaseInfo=(e,t)=>{let r=this.readXml.getElementsByTagName("xdr:twoCellAnchor",e),n=this.readXml.getElementsByTagName("xdr:oneCellAnchor",e);if(r=[...r,...n],null!=r&&r.length>0)for(let e=0;e<r.length;e++){let n=r[e],l=n.getInnerElements("xdr:from"),a=n.getInnerElements("xdr:to");if(null!=l&&l.length>0){let e,r,i=l[0];a?e=a[0]:r=n.getInnerElements("xdr:ext")[0];let s={};n.getInnerElements("xdr:graphicFrame")&&(s=this.getGraphic(n,t)),n.getInnerElements("xdr:pic")&&(s=this.getImage(n,t));let o=0,c=0,u=0,h=0;if(s.fromCol=this.getXdrValue(i.getInnerElements("xdr:col")),s.fromColOff=O(this.getXdrValue(i.getInnerElements("xdr:colOff"))),s.fromRow=this.getXdrValue(i.getInnerElements("xdr:row")),s.fromRowOff=O(this.getXdrValue(i.getInnerElements("xdr:rowOff"))),e)s.toCol=this.getXdrValue(e.getInnerElements("xdr:col")),s.toColOff=O(this.getXdrValue(e.getInnerElements("xdr:colOff"))),s.toRow=this.getXdrValue(e.getInnerElements("xdr:row")),s.toRowOff=O(this.getXdrValue(e.getInnerElements("xdr:rowOff")));else{let e=r.attributeList;u=O(parseInt