@protobase/ui 0.22.1 → 0.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/export/cells.js +4 -1
- package/dist/app/field-editor.js +1 -1
- package/dist/app/hand-order/hand-order.js +1 -1
- package/dist/app/incoming-relations.js +1 -1
- package/dist/app/pages/field-value.js +1 -1
- package/dist/app/record-page.js +11 -7
- package/dist/app/related-section.js +11 -6
- package/dist/app/related-value.js +14 -0
- package/dist/data-grid/cell-text.js +2 -2
- package/dist/data-grid/cells.js +2 -1
- package/dist/filter-panel/filter-config.js +2 -0
- package/dist/format/date.js +5 -4
- package/dist/live/columns-from-model.js +1 -0
- package/dist/live/display-value.js +11 -6
- package/dist/live/filter-string.js +4 -0
- package/dist/package.js +1 -1
- package/dist/shell/assets/app-3MBLkJAB.js +69 -0
- package/dist/shell/assets/export-worker-C1djGgjD.js +2 -0
- package/dist/shell/assets/{index-BvrIX29L.js → index-K4WBo5hS.js} +1 -1
- package/dist/shell/assets/{maplibre-DEGWdV6B.js → maplibre-CPwgBgXC.js} +1 -1
- package/dist/shell/assets/{markdown-content-DdB7hUqJ.js → markdown-content-kdNPOEJy.js} +1 -1
- package/dist/shell/assets/{record-map-C_dz1z7c.js → record-map-C57pIfol.js} +1 -1
- package/dist/shell/assets/{records-map-ByiKJWnW.js → records-map-B8_M8kjM.js} +1 -1
- package/dist/shell/assets/{shared-protobase-ui-Di_9bo0v.js → shared-protobase-ui-BRE7ZUBU.js} +1 -1
- package/dist/shell/index.html +3 -3
- package/dist/shell/protobase.shell.json +1 -1
- package/package.json +4 -4
- package/dist/shell/assets/app-xO_xPXCq.js +0 -69
- package/dist/shell/assets/export-worker-BoAr3vuF.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(function(){let e=(e,t)=>t?.[e]??e,t=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,n=/* @__PURE__ */ new Map,r=e=>{let t=n.get(e);if(t)return t;let r=new Intl.DateTimeFormat(`en-US`,{timeZone:e,hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`});return n.set(e,r),r},i=(e,t)=>{let n=Object.fromEntries(r(t).formatToParts(e).map(e=>[e.type,e.value]));return{year:Number(n.year),month:Number(n.month),day:Number(n.day),hour:Number(n.hour),minute:Number(n.minute),second:Number(n.second)}},a=(e,t)=>{let n=i(e,t);return Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)-Math.floor(e/1e3)*1e3},o=new Intl.DateTimeFormat(`en-GB`,{day:`numeric`,month:`short`,year:`numeric`,timeZone:`UTC`});new Intl.DateTimeFormat(`en-GB`,{day:`numeric`,month:`short`,timeZone:`UTC`}),new Intl.DateTimeFormat(`en-GB`,{month:`long`,year:`numeric`,timeZone:`UTC`}),new Intl.DateTimeFormat(`en-GB`,{weekday:`short`,timeZone:`UTC`}),new Intl.DateTimeFormat(`en-GB`,{weekday:`long`,day:`numeric`,month:`short`,year:`numeric`,timeZone:`UTC`});let s=e=>o.format(e),c=/* @__PURE__ */ new Map,l=e=>{let t=c.get(e);if(t)return t;let n={day:new Intl.DateTimeFormat(`en-GB`,{day:`numeric`,month:`short`,year:`numeric`,timeZone:e}),time:new Intl.DateTimeFormat(`en-GB`,{hour:`2-digit`,minute:`2-digit`,hour12:!1,timeZone:e})};return c.set(e,n),n},u=(e,n=t())=>{let r=l(n);return`${r.day.format(e)}, ${r.time.format(e)}`};new Intl.RelativeTimeFormat(`en`,{numeric:`auto`});let d=e=>typeof e==`object`&&!!e&&typeof e.uri==`string`,f=e=>typeof e==`object`&&!!e&&typeof e.uploaded?.value==`string`,p=e=>{if(f(e))return{...e.uploaded.file,...e.preview&&{url:e.preview},corrected:e.uploaded.corrected};if(d(e))return`missing`in e?{name:`File missing`,type:``,missing:!0}:e},m=(e,t)=>`${t.prefix??``}${e}${t.suffix??``}`,h=(n,r,i={},a=t())=>{if(r==null||r===``)return`—`;switch(n.type){case`boolean`:return r?`Yes`:`No`;case`file`:return p(r)?.name??`—`;case`enum`:return e(String(r),i.valueLabels);case`timestamp`:return u(Date.parse(String(r)),a);case`date`:return s(Date.parse(String(r)));case`decimal`:{let e=i.decimals===void 0?String(r):Number(r).toFixed(i.decimals);return i.format===`percent`?`${Number(r)}%`:m(Number(e).toLocaleString(`en-IE`,{minimumFractionDigits:i.decimals??0,maximumFractionDigits:i.decimals??20}),i)}case`integer`:case`bigint`:return m(String(r),i);default:return typeof r==`object`?JSON.stringify(r):String(r)}},g={kind:`empty`},_=e=>({kind:`text`,value:e}),v=e=>e==null||e===``,y=(e,t,n)=>n[e.name]?.[String(t)]??String(t),b=(e,t)=>d(e)?t===`raw`?e.uri:p(e)?.name??e.uri:String(e),x=(e,t,n,r)=>{if(v(t))return``;let{field:i,hints:a}=e;return i.type===`file`?b(t,r):i.type===`relation`?r===`shown`?y(e,t,n):String(t):r===`shown`?h(i,t,a):typeof t==`object`?JSON.stringify(t):String(t)},S=e=>e/864e5+25569,C={shown:{date:`d mmm yyyy`,timestamp:`d mmm yyyy, hh:mm`},raw:{date:`yyyy-mm-dd`,timestamp:`yyyy-mm-dd hh:mm:ss`}},w=e=>[...e??``].map(e=>`\\${e}`).join(``),T=e=>{if(e.format===`percent`)return`General\\%`;let t=e.decimals===void 0?`General`:e.decimals>0?`#,##0.${`0`.repeat(e.decimals)}`:`#,##0`,n=`${w(e.prefix)}${t}${w(e.suffix)}`;return n===`General`?void 0:n},E=(e,t,n)=>{let r=Number(t);if(!Number.isFinite(r)||e.field.type===`bigint`&&!Number.isSafeInteger(r))return _(String(t));let i=n===`shown`?T(e.hints):void 0;return i?{kind:`number`,value:r,format:i}:{kind:`number`,value:r}},D=(e,t,n,r)=>{let i=Date.parse(String(t));if(Number.isNaN(i))return _(String(t));let o=e===`timestamp`&&n===`shown`?i+a(i,r):i;return{kind:`number`,value:S(o),format:C[n][e]}},O=(e,n,r,i,a=t())=>{if(v(n))return g;let{field:o}=e;switch(o.type){case`boolean`:return{kind:`boolean`,value:!!n};case`integer`:case`bigint`:case`decimal`:return E(e,n,i);case`date`:case`timestamp`:return D(o.type,n,i,a);case`relation`:return i===`shown`?_(y(e,n,r)):typeof n==`number`?{kind:`number`,value:n}:_(String(n));default:return _(x(e,n,r,i))}},k=new Uint8Array([239,187,191]),A=/[",\r\n]/,j=/^[=+\-@\t\r]/,M=e=>A.test(e)?`"${e.replaceAll(`"`,`""`)}"`:e,N=e=>M(j.test(e)?`'${e}`:e),P=e=>`${e.join(`,`)}\r\n`;var F=Uint8Array,I=Uint16Array,ee=Int32Array,te=new F([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ne=new F([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),L=new F([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),re=function(e,t){for(var n=new I(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new ee(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},R=re(te,2),z=R.b,B=R.r;z[28]=258,B[258]=28;var V=re(ne,0);V.b;for(var H=V.r,ie=new I(32768),U=0;U<32768;++U){var W=(U&43690)>>1|(U&21845)<<1;W=(W&52428)>>2|(W&13107)<<2,W=(W&61680)>>4|(W&3855)<<4,ie[U]=((W&65280)>>8|(W&255)<<8)>>1}for(var G=(function(e,t,n){for(var r=e.length,i=0,a=new I(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new I(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new I(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[ie[d]>>c]=l}else for(s=new I(r),i=0;i<r;++i)e[i]&&(s[i]=ie[o[e[i]-1]++]>>15-e[i]);return s}),K=new F(288),U=0;U<144;++U)K[U]=8;for(var U=144;U<256;++U)K[U]=9;for(var U=256;U<280;++U)K[U]=7;for(var U=280;U<288;++U)K[U]=8;for(var q=new F(32),U=0;U<32;++U)q[U]=5;var ae=/*#__PURE__*/ G(K,9,0),oe=/*#__PURE__*/ G(q,5,0),se=function(e){return(e+7)/8|0},ce=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new F(e.subarray(t,n))},le=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],J=function(e,t,n){var r=Error(t||le[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,J),!n)throw r;return r},Y=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},X=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},ue=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:ge,l:0};if(i==1){var o=new F(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new I(f+1),m=de(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return{t:new F(p),l:m}},de=function(e,t,n){return e.s==-1?Math.max(de(e.l,t,n+1),de(e.r,t,n+1)):t[e.s]=n},fe=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new I(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},Z=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},pe=function(e,t,n){var r=n.length,i=se(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},me=function(e,t,n,r,i,a,o,s,c,l,u){Y(t,u++,n),++i[256];for(var d=ue(i,15),f=d.t,p=d.l,m=ue(a,15),h=m.t,g=m.l,_=fe(f),v=_.c,y=_.n,b=fe(h),x=b.c,S=b.n,C=new I(19),w=0;w<v.length;++w)++C[v[w]&31];for(var w=0;w<x.length;++w)++C[x[w]&31];for(var T=ue(C,7),E=T.t,D=T.l,O=19;O>4&&!E[L[O-1]];--O);var k=l+5<<3,A=Z(i,K)+Z(a,q)+o,j=Z(i,f)+Z(a,h)+o+14+3*O+Z(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=j)return pe(t,u,e.subarray(c,c+l));var M,N,P,F;if(Y(t,u,1+(j<A)),u+=2,j<A){M=G(f,p,0),N=f,P=G(h,g,0),F=h;var ee=G(E,D,0);Y(t,u,y-257),Y(t,u+5,S-1),Y(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)Y(t,u+3*w,E[L[w]]);u+=3*O;for(var re=[v,x],R=0;R<2;++R)for(var z=re[R],w=0;w<z.length;++w){var B=z[w]&31;Y(t,u,ee[B]),u+=E[B],B>15&&(Y(t,u,z[w]>>5&127),u+=z[w]>>12)}}else M=ae,N=K,P=oe,F=q;for(var w=0;w<s;++w){var V=r[w];if(V>255){var B=V>>18&31;X(t,u,M[B+257]),u+=N[B+257],B>7&&(Y(t,u,V>>23&31),u+=te[B]);var H=V&31;X(t,u,P[H]),u+=F[H],H>3&&(X(t,u,V>>5&8191),u+=ne[H])}else X(t,u,M[V]),u+=N[V]}return X(t,u,M[256]),u+N[256]},he=/*#__PURE__*/ new ee([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ge=/*#__PURE__*/ new F(0),_e=function(e,t,n,r,i,a){var o=a.z||e.length,s=new F(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=he[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new I(32768),g=a.h||new I(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new ee(25e3),x=new I(288),S=new I(32),C=0,w=0,T=a.i||0,E=0,D=a.w||0,O=0;T+2<o;++T){var k=y(T),A=T&32767,j=g[k];if(h[A]=j,g[k]=A,D<=T){var M=o-T;if((C>7e3||E>24576)&&(M>423||!l)){u=me(e,c,0,b,x,S,w,E,O,T-O,u),E=C=w=0,O=T;for(var N=0;N<286;++N)x[N]=0;for(var N=0;N<30;++N)S[N]=0}var P=2,L=0,re=p,R=A-j&32767;if(M>2&&k==y(T-R))for(var z=Math.min(f,M)-1,V=Math.min(32767,T),ie=Math.min(258,M);R<=V&&--re&&A!=j;){if(e[T+P]==e[T+P-R]){for(var U=0;U<ie&&e[T+U]==e[T+U-R];++U);if(U>P){if(P=U,L=R,U>z)break;for(var W=Math.min(R,U-2),G=0,N=0;N<W;++N){var K=T-R+N&32767,q=K-h[K]&32767;q>G&&(G=q,j=K)}}}A=j,j=h[A],R+=A-j&32767}if(L){b[E++]=268435456|B[P]<<18|H[L];var ae=B[P]&31,oe=H[L]&31;w+=te[ae]+ne[oe],++x[257+ae],++S[oe],D=T+P,++C}else b[E++]=e[T],++x[e[T]]}}for(T=Math.max(T,D);T<o;++T)b[E++]=e[T],++x[e[T]];u=me(e,c,l,b,x,S,w,E,O,T-O,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=g,a.p=h,a.i=T,a.w=D)}else{for(var T=a.w||0;T<o+l;T+=65535){var le=T+65535;le>=o&&(c[u/8|0]=l,le=o),u=pe(c,u+1,e.subarray(T,le))}a.i=o}return ce(s,0,r+se(u)+i)},ve=/*#__PURE__*/ (function(){for(var e=/* @__PURE__ */ new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),ye=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=ve[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},be=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new F(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return _e(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},xe=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},Q=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Se=/* @__PURE__ */ function(){function e(e,t){if(typeof e==`function`&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new F(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return e.prototype.p=function(e,t){this.ondata(be(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||J(5),this.s.l&&J(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var r=new F(n&-32768);r.set(this.b.subarray(0,this.s.z)),this.b=r}var i=this.b.length-this.s.z;this.b.set(e.subarray(0,i),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(i),32768),this.s.z=e.length-i+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=t&1,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2),t&&(this.s=this.o={},this.b=ge)},e.prototype.flush=function(e){if(this.ondata||J(5),this.s.l&&J(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2,e){var t=new F(6);t[0]=this.s.r>>3;var n=pe(t,this.s.r,ge);this.s.r=0,this.ondata(t.subarray(0,n>>3),!1)}},e}(),Ce=typeof TextEncoder<`u`&&/*#__PURE__*/ new TextEncoder,we=typeof TextDecoder<`u`&&/*#__PURE__*/ new TextDecoder;try{we.decode(ge,{stream:!0})}catch{}function Te(e,t){if(t){for(var n=new F(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(Ce)return Ce.encode(e);for(var i=e.length,a=new F(e.length+(e.length>>1)),o=0,s=function(e){a[o++]=e},r=0;r<i;++r){if(o+5>a.length){var c=new F(o+8+(i-r<<1));c.set(a),a=c}var l=e.charCodeAt(r);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|e.charCodeAt(++r)&1023,s(240|l>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|l&63)):(s(224|l>>12),s(128|l>>6&63),s(128|l&63))}return ce(a,0,o)}var Ee=function(e){return e==1?3:e<6?2:+(e==9)},De=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&J(9),t+=r+4}return t},Oe=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=De(l);Q(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&J(10),Q(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(Q(e,t,n.crc),Q(e,t+4,a<0?-a-2:a),Q(e,t+8,n.size)),Q(e,t+12,c),Q(e,t+14,d),t+=16,o!=null&&(Q(e,t,u),Q(e,t+6,n.attrs),Q(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;Q(e,t,+m),Q(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},ke=function(e,t,n,r,i){Q(e,t,101010256),Q(e,t+8,n),Q(e,t+10,n),Q(e,t+12,r),Q(e,t+16,i)},Ae=/* @__PURE__ */ function(){function e(e){this.filename=e,this.c=ye(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){this.ondata||J(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}(),je=/* @__PURE__ */ function(){function e(e,t){var n=this;t||={},Ae.call(this,e),this.d=new Se(t,function(e,t){n.ondata(null,e,t)}),this.compression=8,this.flag=Ee(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){Ae.prototype.push.call(this,e,t)},e}(),Me=/* @__PURE__ */ function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(this.ondata||J(5),this.d&2)this.ondata(J(4+(this.d&1)*8,0,1),null,!1);else{var n=Te(e.filename),r=n.length,i=e.comment,a=i&&Te(i),o=r!=e.filename.length||a&&i.length!=a.length,s=r+De(e.extra)+30;r>65535&&this.ondata(J(11,0,1),null,!1);var c=new F(s);Oe(c,0,e,n,o,-1);var l=[c],u=function(){for(var e=0,n=l;e<n.length;e++){var r=n[e];t.ondata(null,r,!1)}l=[]},d=this.d;this.d=0;var f=this.u.length,p=xe(e,{f:n,u:o,o:a,t:function(){e.terminate&&e.terminate()},r:function(){if(u(),d){var e=t.u[f+1];e?e.r():t.d=1}d=1}}),m=0;e.ondata=function(n,r,i){if(n)t.ondata(n,r,i),t.terminate();else if(m+=r.length,l.push(r),i){var a=new F(16);Q(a,0,134695760),Q(a,4,e.crc),Q(a,8,m),Q(a,12,e.size),l.push(a),p.c=m,p.b=s+m+16,p.crc=e.crc,p.size=e.size,d&&p.r(),d=1}else d&&u()},this.u.push(p)}},e.prototype.end=function(){var e=this;if(this.d&2){this.ondata(J(4+(this.d&1)*8,0,1),null,!0);return}this.d?this.e():this.u.push({r:function(){e.d&1&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,n=0,r=0,i=this.u;r<i.length;r++){var a=i[r];n+=46+a.f.length+De(a.extra)+(a.o?a.o.length:0)}for(var o=new F(n+22),s=0,c=this.u;s<c.length;s++){var a=c[s];Oe(o,e,a,a.f,a.u,-a.c-2,t,a.o),e+=46+a.f.length+De(a.extra)+(a.o?a.o.length:0),t+=a.b}ke(o,e,this.u.length,n,t),this.ondata(null,o,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}();let Ne=/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g,Pe=e=>e.replace(Ne,``).replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`),Fe=e=>{let t=String.fromCharCode(65+e%26);return e<26?t:Fe(Math.floor(e/26)-1)+t},Ie=(e,t,n=``)=>`<c r="${e}"${n} t="inlineStr"><is><t xml:space="preserve">${Pe(t.slice(0,32767))}</t></is></c>`,$=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
|
-
`,Le=`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,Re=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,ze=`http://schemas.openxmlformats.org/package/2006/relationships`,Be=`${$}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/></Types>`,Ve=`${$}<Relationships xmlns="${ze}"><Relationship Id="rId1" Type="${Re}/officeDocument" Target="xl/workbook.xml"/></Relationships>`,He=`${$}<Relationships xmlns="${ze}"><Relationship Id="rId1" Type="${Re}/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="${Re}/styles" Target="styles.xml"/></Relationships>`,Ue=e=>e.replace(/[:\\/?*[\]]/g,` `).slice(0,31).trim()||`Sheet1`,We=e=>`${$}<workbook xmlns="${Le}" xmlns:r="${Re}"><sheets><sheet name="${Pe(Ue(e))}" sheetId="1" r:id="rId1"/></sheets></workbook>`,Ge=e=>{let t=e.map((e,t)=>`<numFmt numFmtId="${164+t}" formatCode="${Pe(e)}"/>`).join(``),n=e.map((e,t)=>`<xf numFmtId="${164+t}" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>`).join(``);return`${$}<styleSheet xmlns="${Le}">${e.length>0?`<numFmts count="${e.length}">${t}</numFmts>`:``}<fonts count="2"><font><sz val="11"/><name val="Calibri"/></font><font><b/><sz val="11"/><name val="Calibri"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="${2+e.length}"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/><xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/>${n}</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>`},Ke=new TextEncoder,qe=(e,t)=>{let n=new Me((e,n,r)=>{if(e)throw e;t(n,r)}),r=(e,t)=>{let r=new je(e,{level:6});n.add(r),r.push(Ke.encode(t),!0)};r(`[Content_Types].xml`,Be),r(`_rels/.rels`,Ve),r(`xl/workbook.xml`,We(e.name)),r(`xl/_rels/workbook.xml.rels`,He);let i=new je(`xl/worksheets/sheet1.xml`,{level:6});n.add(i);let a=e.widths.map((e,t)=>`<col min="${t+1}" max="${t+1}" width="${e}" customWidth="1"/>`).join(``),o=`<row r="1">${e.headers.map((e,t)=>Ie(`${Fe(t)}1`,e,` s="1"`)).join(``)}</row>`;i.push(Ke.encode(`${$}<worksheet xmlns="${Le}"><sheetViews><sheetView workbookViewId="0"><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews>${a?`<cols>${a}</cols>`:``}<sheetData>${o}`));let s=e.headers.map((e,t)=>Fe(t)),c=[],l=e=>{let t=c.indexOf(e);return t>=0?t+2:(c.push(e),c.length+1)},u=(e,t)=>{switch(e.kind){case`empty`:return``;case`text`:return Ie(t,e.value);case`boolean`:return`<c r="${t}" t="b"><v>${+!!e.value}</v></c>`;case`number`:return`<c r="${t}"${e.format?` s="${l(e.format)}"`:``}><v>${e.value}</v></c>`}},d=1;return{rows:e=>{let t=``;for(let n of e){if(d+=1,d>1048576)throw Error(`A sheet holds at most 1048575 rows`);t+=`<row r="${d}">${n.map((e,t)=>u(e,`${s[t]}${d}`)).join(``)}</row>`}i.push(Ke.encode(t))},finish:()=>{i.push(Ke.encode(`</sheetData></worksheet>`),!0),r(`xl/styles.xml`,Ge(c)),n.end()}}},Je=/* @__PURE__ */ new Set([`text`,`uuid`,`enum`,`relation`,`file`,`json`,`currency`,`country`]),Ye=(e,t,n)=>e.map(e=>{let r=Math.max(e.header.length,...t.map(t=>x(e,t[e.name],n,`shown`).length));return Math.min(60,Math.max(8,r+2))}),Xe=(e,t)=>{let n=new TextEncoder;t(k),t(n.encode(P(e.columns.map(e=>M(e.header)))));let r=(t,n,r)=>{let i=x(t,n[t.name],r,e.mode);return Je.has(t.field.type)?N(i):M(i)};return{page:(i,a)=>{t(n.encode(i.map(t=>P(e.columns.map(e=>r(e,t,a)))).join(``)))},finish:()=>void 0}},Ze=(e,t)=>{let n,r=(n,r)=>qe({name:e.name,headers:e.columns.map(e=>e.header),widths:Ye(e.columns,n,r)},t);return{page:(t,i)=>{n??=r(t,i),n.rows(t.map(t=>e.columns.map(n=>O(n,t[n.name],i,e.mode))))},finish:()=>{n??=r([],{}),n.finish()}}},Qe=(e,t)=>e.format===`csv`?Xe(e,t):Ze(e,t),$e=e=>{let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},et=(()=>{let e,t=[];return n=>{if(n.kind===`start`)e=Qe(n.plan,e=>t.push(e));else if(e)n.kind===`page`?e.page(n.records,n.labels):e.finish();else throw Error(`The export was not started`);let r=$e(t);return t=[],r}})(),tt=self;tt.onmessage=e=>{let t=et(e.data);tt.postMessage({bytes:t},[t.buffer])}})();
|