@bluepic/embed 0.4.0-next.205 → 0.4.0-next.207

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.
@@ -4,6 +4,13 @@ type __VLS_Props = {
4
4
  name: string;
5
5
  label?: string;
6
6
  icon?: () => VNode[] | VNode;
7
+ /**
8
+ * Rendered AFTER the label — a count, a status dot. Separate from `icon`
9
+ * because it trails the name rather than introducing it, and because a
10
+ * tab that carries a number wants that number to read as part of the tab
11
+ * rather than as a second word in its name.
12
+ */
13
+ suffix?: () => VNode[] | VNode;
7
14
  }[];
8
15
  secondary?: boolean;
9
16
  size?: 'tiny' | 'small' | 'medium' | 'large';
@@ -34,9 +34,9 @@ function v(t, n = t) {
34
34
  e.enqueue(r), i += r.byteLength;
35
35
  }
36
36
  }
37
- }, cancel(e) {
37
+ }, async cancel(e) {
38
38
  var i;
39
- (i = n.throw) == null || i.call(n, e);
39
+ await ((i = n.throw) == null ? void 0 : i.call(n, e));
40
40
  } });
41
41
  }
42
42
  function S(t) {
@@ -46,17 +46,17 @@ function I(t, n, e) {
46
46
  let [i, o] = function(r) {
47
47
  return r ? r instanceof Uint8Array ? [r, 1] : ArrayBuffer.isView(r) || r instanceof ArrayBuffer ? [u(r), 1] : [y(r), 0] : [void 0, 0];
48
48
  }(n);
49
- if (t instanceof File) return { i: p(i || y(t.name)), o: BigInt(t.size), u: o };
49
+ if (t instanceof File) return { i: w(i || y(t.name)), o: BigInt(t.size), u: o };
50
50
  if (t instanceof Response) {
51
51
  const r = t.headers.get("content-disposition"), f = r && r.match(/;\s*filename\*?\s*=\s*(?:UTF-\d+''|)["']?([^;"'\r\n]*)["']?(?:;|$)/i), a = f && f[1] || t.url && new URL(t.url).pathname.split("/").findLast(Boolean), l = a && decodeURIComponent(a), d = e || +t.headers.get("content-length");
52
- return { i: p(i || y(l)), o: BigInt(d), u: o };
52
+ return { i: w(i || y(l)), o: BigInt(d), u: o };
53
53
  }
54
- return i = p(i, t !== void 0 || e !== void 0), typeof t == "string" ? { i, o: BigInt(y(t).length), u: o } : t instanceof Blob ? { i, o: BigInt(t.size), u: o } : t instanceof ArrayBuffer || ArrayBuffer.isView(t) ? { i, o: BigInt(t.byteLength), u: o } : { i, o: R(t, e), u: o };
54
+ return i = w(i, t !== void 0 || e !== void 0), typeof t == "string" ? { i, o: BigInt(y(t).length), u: o } : t instanceof Blob ? { i, o: BigInt(t.size), u: o } : t instanceof ArrayBuffer || ArrayBuffer.isView(t) ? { i, o: BigInt(t.byteLength), u: o } : { i, o: R(t, e), u: o };
55
55
  }
56
56
  function R(t, n) {
57
57
  return n > -1 ? BigInt(n) : t ? void 0 : 0n;
58
58
  }
59
- function p(t, n = 1) {
59
+ function w(t, n = 1) {
60
60
  if (!t || t.every((e) => e === 47)) throw new Error("The file must have a name.");
61
61
  if (n) for (; t[t.length - 1] === 47; ) t = t.subarray(0, -1);
62
62
  else t[t.length - 1] !== 47 && (t = new Uint8Array([...t, 47]));
@@ -153,10 +153,10 @@ function j(t, n = {}) {
153
153
  const r = [];
154
154
  let f = 0n, a = 0n, l = 0;
155
155
  for await (const s of i) {
156
- const w = L(s, o.buffersAreUTF8);
157
- yield N(s, w), yield new Uint8Array(s.i), s.isFile && (yield* T(s));
156
+ const p = L(s, o.buffersAreUTF8);
157
+ yield N(s, p), yield new Uint8Array(s.i), s.isFile && (yield* T(s));
158
158
  const h = s.o >= 0xffffffffn, m = 12 * (f >= 0xffffffffn) | 28 * h;
159
- yield E(s, h), r.push(z(s, f, w, m)), r.push(s.i), m && r.push(V(s, f, m)), h && (f += 8n), a++, f += BigInt(46 + s.i.length) + s.o, l || (l = h);
159
+ yield E(s, h), r.push(z(s, f, p, m)), r.push(s.i), m && r.push(V(s, f, m)), h && (f += 8n), a++, f += BigInt(46 + s.i.length) + s.o, l || (l = h);
160
160
  }
161
161
  let d = 0n;
162
162
  for (const s of r) yield s, d += BigInt(s.length);
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(t,n,e){const i=Number(0xffffffffn&n),o=Number(n>>32n);this.setUint32(t+(e?0:4),i,e),this.setUint32(t+(e?4:0),o,e)}});var U=t=>new DataView(new ArrayBuffer(t)),u=t=>new Uint8Array(t.buffer||t),y=t=>new TextEncoder().encode(String(t)),c=t=>Math.min(4294967295,Number(t)),b=t=>Math.min(65535,Number(t));function R(t,n,e){n===void 0||n instanceof Date||(n=new Date(n));const i=t!==void 0;if(e||(e=i?436:509),t instanceof File)return{isFile:i,t:n||new Date(t.lastModified),bytes:t.stream(),mode:e};if(t instanceof Response)return{isFile:i,t:n||new Date(t.headers.get("Last-Modified")||Date.now()),bytes:t.body,mode:e};if(n===void 0)n=new Date;else if(isNaN(n))throw new Error("Invalid modification date.");if(!i)return{isFile:i,t:n,mode:e};if(typeof t=="string")return{isFile:i,t:n,bytes:y(t),mode:e};if(t instanceof Blob)return{isFile:i,t:n,bytes:t.stream(),mode:e};if(t instanceof Uint8Array||t instanceof ReadableStream)return{isFile:i,t:n,bytes:t,mode:e};if(t instanceof ArrayBuffer||ArrayBuffer.isView(t))return{isFile:i,t:n,bytes:u(t),mode:e};if(Symbol.asyncIterator in t)return{isFile:i,t:n,bytes:v(t[Symbol.asyncIterator]()),mode:e};throw new TypeError("Unsupported input format.")}function v(t,n=t){return new ReadableStream({async pull(e){let i=0;for(;e.desiredSize>i;){const o=await t.next();if(!o.value){e.close();break}{const r=M(o.value);e.enqueue(r),i+=r.byteLength}}},async cancel(e){var i;await((i=n.throw)==null?void 0:i.call(n,e))}})}function M(t){return typeof t=="string"?y(t):t instanceof Uint8Array?t:u(t)}function I(t,n,e){let[i,o]=function(r){return r?r instanceof Uint8Array?[r,1]:ArrayBuffer.isView(r)||r instanceof ArrayBuffer?[u(r),1]:[y(r),0]:[void 0,0]}(n);if(t instanceof File)return{i:w(i||y(t.name)),o:BigInt(t.size),u:o};if(t instanceof Response){const r=t.headers.get("content-disposition"),f=r&&r.match(/;\s*filename\*?\s*=\s*(?:UTF-\d+''|)["']?([^;"'\r\n]*)["']?(?:;|$)/i),a=f&&f[1]||t.url&&new URL(t.url).pathname.split("/").findLast(Boolean),l=a&&decodeURIComponent(a),d=e||+t.headers.get("content-length");return{i:w(i||y(l)),o:BigInt(d),u:o}}return i=w(i,t!==void 0||e!==void 0),typeof t=="string"?{i,o:BigInt(y(t).length),u:o}:t instanceof Blob?{i,o:BigInt(t.size),u:o}:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?{i,o:BigInt(t.byteLength),u:o}:{i,o:T(t,e),u:o}}function T(t,n){return n>-1?BigInt(n):t?void 0:0n}function w(t,n=1){if(!t||t.every(e=>e===47))throw new Error("The file must have a name.");if(n)for(;t[t.length-1]===47;)t=t.subarray(0,-1);else t[t.length-1]!==47&&(t=new Uint8Array([...t,47]));return t}var F=new Uint32Array(256);for(let t=0;t<256;++t){let n=t;for(let e=0;e<8;++e)n=n>>>1^(1&n&&3988292384);F[t]=n}function B(t,n=0){n=~n;for(var e=0,i=t.length;e<i;e++)n=n>>>8^F[255&n^t[e]];return~n>>>0}function A(t,n,e=0){const i=t.getSeconds()>>1|t.getMinutes()<<5|t.getHours()<<11,o=t.getDate()|t.getMonth()+1<<5|t.getFullYear()-1980<<9;n.setUint16(e,i,1),n.setUint16(e+2,o,1)}function L({i:t,u:n},e){return 8*(!n||(e??function(i){try{N.decode(i)}catch{return 0}return 1}(t)))}var N=new TextDecoder("utf8",{fatal:1});function E(t,n=0){const e=U(30);return e.setUint32(0,1347093252),e.setUint32(4,754976768|n),A(t.t,e,10),e.setUint16(26,t.i.length,1),u(e)}async function*z(t){let{bytes:n}=t;if("then"in n&&(n=await n),n instanceof Uint8Array)yield n,t.l=B(n,0),t.o=BigInt(n.length);else{t.o=0n;const e=n.getReader();for(;;){const{value:i,done:o}=await e.read();if(o)break;t.l=B(i,t.l),t.o+=BigInt(i.length),yield i}}}function V(t,n){const e=U(16+(n?8:0));return e.setUint32(0,1347094280),e.setUint32(4,t.isFile?t.l:0,1),n?(e.setBigUint64(8,t.o,1),e.setBigUint64(16,t.o,1)):(e.setUint32(8,c(t.o),1),e.setUint32(12,c(t.o),1)),u(e)}function C(t,n,e=0,i=0){const o=U(46);return o.setUint32(0,1347092738),o.setUint32(4,755182848),o.setUint16(8,2048|e),A(t.t,o,12),o.setUint32(16,t.isFile?t.l:0,1),o.setUint32(20,c(t.o),1),o.setUint32(24,c(t.o),1),o.setUint16(28,t.i.length,1),o.setUint16(30,i,1),o.setUint16(40,t.mode|(t.isFile?32768:16384),1),o.setUint32(42,c(n),1),u(o)}function j(t,n,e){const i=U(e);return i.setUint16(0,1,1),i.setUint16(2,e-4,1),16&e&&(i.setBigUint64(4,t.o,1),i.setBigUint64(12,t.o,1)),i.setBigUint64(e-8,n,1),u(i)}function S(t){return t instanceof File||t instanceof Response?[[t],[t]]:[[t.input,t.name,t.size],[t.input,t.lastModified,t.mode]]}var D=t=>function(n){let e=BigInt(22),i=0n,o=0;for(const r of n){if(!r.i)throw new Error("Every file must have a non-empty name.");if(r.o===void 0)throw new Error(`Missing size for file "${new TextDecoder().decode(r.i)}".`);const f=r.o>=0xffffffffn,a=i>=0xffffffffn;i+=BigInt(46+r.i.length+(f&&8))+r.o,e+=BigInt(r.i.length+46+(12*a|28*f)),o||(o=f)}return(o||i>=0xffffffffn)&&(e+=BigInt(76)),e+i}(function*(n){for(const e of n)yield I(...S(e)[0])}(t));function O(t,n={}){const e={"Content-Type":"application/zip","Content-Disposition":"attachment"};return(typeof n.length=="bigint"||Number.isInteger(n.length))&&n.length>0&&(e["Content-Length"]=String(n.length)),n.metadata&&(e["Content-Length"]=String(D(n.metadata))),new Response(x(t,n),{headers:e})}function x(t,n={}){const e=function(i){var r;const o=i[Symbol.iterator in i?Symbol.iterator:Symbol.asyncIterator]();return{async next(){const f=await o.next();if(f.done)return f;const[a,l]=S(f.value);return{done:0,value:Object.assign(R(...l),I(...a))}},throw:(r=o.throw)==null?void 0:r.bind(o),[Symbol.asyncIterator](){return this}}}(t);return v(async function*(i,o){const r=[];let f=0n,a=0n,l=0;for await(const s of i){const p=L(s,o.buffersAreUTF8);yield E(s,p),yield new Uint8Array(s.i),s.isFile&&(yield*z(s));const h=s.o>=0xffffffffn,m=12*(f>=0xffffffffn)|28*h;yield V(s,h),r.push(C(s,f,p,m)),r.push(s.i),m&&r.push(j(s,f,m)),h&&(f+=8n),a++,f+=BigInt(46+s.i.length)+s.o,l||(l=h)}let d=0n;for(const s of r)yield s,d+=BigInt(s.length);if(l||f>=0xffffffffn){const s=U(76);s.setUint32(0,1347094022),s.setBigUint64(4,BigInt(44),1),s.setUint32(12,755182848),s.setBigUint64(24,a,1),s.setBigUint64(32,a,1),s.setBigUint64(40,d,1),s.setBigUint64(48,f,1),s.setUint32(56,1347094023),s.setBigUint64(64,f+d,1),s.setUint32(72,1,1),yield u(s)}const g=U(22);g.setUint32(0,1347093766),g.setUint16(8,b(a),1),g.setUint16(10,b(a),1),g.setUint32(12,c(d),1),g.setUint32(16,c(f),1),yield u(g)}(e,n),e)}exports.downloadZip=O;exports.makeZip=x;exports.predictLength=D;