@ddunigma/node 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +12 -20
- package/dist/Ddu64Secure-CRWKMJLL.js +1 -0
- package/dist/Ddu64Secure-VAMXBO3O.cjs +1 -0
- package/dist/Ddu64SecureBrowser-EZBTEXVI.cjs +1 -0
- package/dist/Ddu64SecureBrowser-FR3TZJQ7.js +1 -0
- package/dist/{ObfuscationLayer-4rCOCRWH.d.cts → ObfuscationLayer-CK0ptcW-.d.cts} +1 -1
- package/dist/{ObfuscationLayer-DTlA723P.d.ts → ObfuscationLayer-CotTuQ5X.d.ts} +1 -1
- package/dist/{WebStreams-CY9E19f5.d.cts → WebStreams-BSCrvsT3.d.cts} +1 -1
- package/dist/{WebStreams-C16QV2Dz.d.ts → WebStreams-CJyGMELL.d.ts} +1 -1
- package/dist/browser.cjs +1 -1
- package/dist/browser.d.cts +12 -21
- package/dist/browser.d.ts +12 -21
- package/dist/browser.js +1 -1
- package/dist/chunk-3TG2ZEF2.cjs +1 -0
- package/dist/chunk-4247T4B7.cjs +1 -0
- package/dist/chunk-5VZELPTG.js +1 -0
- package/dist/chunk-6AYKT6DL.cjs +1 -0
- package/dist/chunk-A3OZJS5G.cjs +9 -0
- package/dist/chunk-DMUAPREO.cjs +1 -0
- package/dist/chunk-DVOLAE33.js +1 -0
- package/dist/chunk-EY5OURIG.cjs +1 -0
- package/dist/chunk-FQI54AXA.cjs +1 -0
- package/dist/chunk-IZSFO3ET.js +1 -0
- package/dist/chunk-LZFOWWT2.js +1 -0
- package/dist/chunk-Q7QV2G7V.js +1 -0
- package/dist/chunk-TCRCZHZC.js +9 -0
- package/dist/chunk-UNBJQMMP.js +1 -0
- package/dist/{core-BsIwjJK-.d.cts → core-ihIEWmI5.d.cts} +9 -11
- package/dist/{core-BsIwjJK-.d.ts → core-ihIEWmI5.d.ts} +9 -11
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +24 -23
- package/dist/index.d.ts +24 -23
- package/dist/index.js +1 -1
- package/dist/secure.browser.cjs +1 -1
- package/dist/secure.browser.d.cts +4 -4
- package/dist/secure.browser.d.ts +4 -4
- package/dist/secure.browser.js +1 -1
- package/dist/secure.cjs +1 -1
- package/dist/secure.d.cts +4 -4
- package/dist/secure.d.ts +4 -4
- package/dist/secure.js +1 -1
- package/docs/REFERENCE.md +53 -55
- package/package.json +1 -1
- package/dist/chunk-6N7QYPEJ.js +0 -1
- package/dist/chunk-7KUEHTG2.js +0 -1
- package/dist/chunk-BDP7E7K3.cjs +0 -1
- package/dist/chunk-JBUTKSCC.cjs +0 -9
- package/dist/chunk-LCOYWJWO.cjs +0 -1
- package/dist/chunk-VW2SZR2Z.js +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
이 프로젝트의 주요 변경 사항을 기록합니다.
|
|
4
4
|
|
|
5
|
+
## Unreleased
|
|
6
|
+
|
|
7
|
+
### 기본 진입점에 lazy secure 추가 (편의성 개선)
|
|
8
|
+
|
|
9
|
+
기본 진입점(`@ddunigma/node`, `@ddunigma/node/browser`)에서 secure 옵션(`compress`,
|
|
10
|
+
`encryptionKey`)이 감지된 **비동기** 호출은 이제 secure 래퍼(`Ddu64Secure`/`Ddu64SecureBrowser`)를
|
|
11
|
+
`import()`로 지연 로드해 그대로 처리합니다. lean 정적 import 그래프는 유지되며(어댑터는 동적
|
|
12
|
+
청크에만 포함), 순수 인코딩/난독화 경로는 종전대로 어댑터를 로드하지 않습니다.
|
|
13
|
+
|
|
14
|
+
- 대상 async 메서드: `encodeAsync`/`decodeAsync`/`decodeToUint8ArrayAsync`/`decodeToBufferAsync`,
|
|
15
|
+
그리고 압축 통계용 `getStatsAsync`(Node·브라우저 대칭).
|
|
16
|
+
- 동기 secure(예: `encode({ compress: true })`)는 여전히 지원하지 않으며, `encode`/`decode`/
|
|
17
|
+
`decodeToUint8Array`/`getStats`가 대칭적으로 `Ddu64AdapterError`를 던져 `encodeAsync`/
|
|
18
|
+
`decodeAsync`/`getStatsAsync` 또는 `@ddunigma/node/secure`를 안내합니다.
|
|
19
|
+
- **타입 표면 변경(주의):** 기본 진입점의 공개 옵션 타입이 `DduBaseOptions` → `DduOptions`
|
|
20
|
+
(secure 전체)로 넓어졌습니다. 이에 따라 6.0의 **컴파일 단계 차단**(`encode(x, { compress: true })`가
|
|
21
|
+
타입 에러)이 **런타임 가드**로 전환됩니다. 동기 메서드에 secure 옵션을 넘기면 컴파일은
|
|
22
|
+
통과하고 호출 시 위 `Ddu64AdapterError`가 발생합니다.
|
|
23
|
+
- 명시 `adapter`를 기본 진입점 생성자에 주입하면 base 코어가 sync/async secure를 직접 처리하며
|
|
24
|
+
lazy 우회 및 동기 가드가 비활성화됩니다.
|
|
25
|
+
- 성능: adapter 판정을 생성 시점 boolean 캐시로 옮겨, async hot-path에서 호출마다 발생하던
|
|
26
|
+
`getCharSetInfo()` 할당(charset 배열 복사 + 정보 객체)을 제거했습니다.
|
|
27
|
+
|
|
5
28
|
## 6.0.0
|
|
6
29
|
|
|
7
30
|
이전 published 버전(5.0.0) 대비 호환성에 영향을 주는 변경이 포함되어 메이저로 올립니다.
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@ddunigma/node)
|
|
4
4
|
|
|
5
|
+
커스텀 charset을 사용하는 Base64 스타일 인코더/디코더 라이브러리입니다.
|
|
6
|
+
|
|
5
7
|
V2 추가사항
|
|
6
8
|
|
|
7
9
|
- 이제 한글 종성 결합 시스템을 활용하여 8개 기본 문자 × 8개 종성으로 64가지 조합을 만들어, 6비트를 한 글자로 표현합니다.
|
|
@@ -41,12 +43,12 @@ dduV1.decode(".우땨땨이?땨뜌.이.뜌이?이!.우우땨이?우뜌.우땨뜌
|
|
|
41
43
|
|
|
42
44
|
## 진입점
|
|
43
45
|
|
|
44
|
-
| 진입점 | 기능
|
|
45
|
-
| ------------------------ |
|
|
46
|
-
| `@ddunigma/node` | 인코딩 +
|
|
47
|
-
| `@ddunigma/node/browser` | 인코딩 +
|
|
48
|
-
| `@ddunigma/node/secure` | 압축/암호화/체크섬/Web Streams
|
|
49
|
-
| `@ddunigma/node/core` | 순수 인코딩/디코딩
|
|
46
|
+
| 진입점 | 기능 | 용도 |
|
|
47
|
+
| ------------------------ | ---------------------------------------------- | ---------------------------- |
|
|
48
|
+
| `@ddunigma/node` | 인코딩 + 난독화, async encode/decode secure lazy | Node 기본 |
|
|
49
|
+
| `@ddunigma/node/browser` | 인코딩 + 난독화, async encode/decode secure lazy | 브라우저/Workers 기본 |
|
|
50
|
+
| `@ddunigma/node/secure` | sync/async 압축/암호화/체크섬/Web Streams | 배터리 명시 사용 |
|
|
51
|
+
| `@ddunigma/node/core` | 순수 인코딩/디코딩 | 최소 번들 |
|
|
50
52
|
|
|
51
53
|
```typescript
|
|
52
54
|
import { Ddu64 as NodeDdu64 } from "@ddunigma/node";
|
|
@@ -65,13 +67,10 @@ const encoded = ddu.encode("재미있는 난독화");
|
|
|
65
67
|
const decoded = ddu.decode(encoded);
|
|
66
68
|
```
|
|
67
69
|
|
|
68
|
-
키 없는 난독화는 암호화가 아닙니다. 동일 입력은 항상 동일 출력이 되어 기밀성·변조 방지를 제공하지
|
|
69
|
-
않습니다.
|
|
70
|
-
|
|
71
70
|
## 압축, 암호화, 체크섬
|
|
72
71
|
|
|
73
72
|
```typescript
|
|
74
|
-
import { Ddu64 } from "@ddunigma/node
|
|
73
|
+
import { Ddu64 } from "@ddunigma/node";
|
|
75
74
|
|
|
76
75
|
const ddu = new Ddu64({
|
|
77
76
|
compress: true,
|
|
@@ -84,20 +83,13 @@ const ddu = new Ddu64({
|
|
|
84
83
|
checksum: true,
|
|
85
84
|
});
|
|
86
85
|
|
|
87
|
-
const encoded = ddu.
|
|
88
|
-
const decoded = ddu.
|
|
86
|
+
const encoded = await ddu.encodeAsync("보호할 데이터");
|
|
87
|
+
const decoded = await ddu.decodeAsync(encoded);
|
|
89
88
|
```
|
|
90
89
|
|
|
91
|
-
|
|
92
|
-
`iterations`를 명시하세요.
|
|
90
|
+
동기 압축/암호화가 필요하면 `@ddunigma/node/secure`를 import하세요.
|
|
93
91
|
|
|
94
92
|
## Reference
|
|
95
93
|
|
|
96
94
|
전체 옵션, 커스텀 charset, URL-Safe, Web Streams, `/core` 고급 사용법은
|
|
97
95
|
[docs/REFERENCE.md](docs/REFERENCE.md)를 보세요.
|
|
98
|
-
|
|
99
|
-
## Migration notes
|
|
100
|
-
|
|
101
|
-
6.0에서 압축/암호화/체크섬/Web Streams는 기본 진입점에서 `@ddunigma/node/secure`로 이동했습니다.
|
|
102
|
-
WASM API(`preloadWasm`, `getWasmCodec`, `wasmThreshold`)는 제거됐습니다. 기존 wire format은 유지되어
|
|
103
|
-
기존 데이터는 그대로 디코딩됩니다.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as Ddu64Secure}from'./chunk-UNBJQMMP.js';import'./chunk-5VZELPTG.js';import'./chunk-TCRCZHZC.js';import'./chunk-IZK7KCU7.js';import'./chunk-7EPVCA2F.js';import'./chunk-Q6SCBUV2.js';import'./chunk-EI7MMDWY.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkDMUAPREO_cjs=require('./chunk-DMUAPREO.cjs');require('./chunk-4247T4B7.cjs'),require('./chunk-A3OZJS5G.cjs'),require('./chunk-ZTGECGM2.cjs'),require('./chunk-76X5J2OF.cjs'),require('./chunk-JY2ZPBJK.cjs'),require('./chunk-BCUBYE76.cjs');Object.defineProperty(exports,"Ddu64Secure",{enumerable:true,get:function(){return chunkDMUAPREO_cjs.a}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunk6AYKT6DL_cjs=require('./chunk-6AYKT6DL.cjs');require('./chunk-4247T4B7.cjs'),require('./chunk-A3OZJS5G.cjs'),require('./chunk-HUUB5BUS.cjs'),require('./chunk-ZTGECGM2.cjs'),require('./chunk-JY2ZPBJK.cjs'),require('./chunk-BCUBYE76.cjs');Object.defineProperty(exports,"Ddu64SecureBrowser",{enumerable:true,get:function(){return chunk6AYKT6DL_cjs.a}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as Ddu64SecureBrowser}from'./chunk-LZFOWWT2.js';import'./chunk-5VZELPTG.js';import'./chunk-TCRCZHZC.js';import'./chunk-6ZYMNHFT.js';import'./chunk-IZK7KCU7.js';import'./chunk-Q6SCBUV2.js';import'./chunk-EI7MMDWY.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PlatformAdapter, I as KeyDerivationOptions, D as Ddu64Core,
|
|
1
|
+
import { P as PlatformAdapter, I as KeyDerivationOptions, D as Ddu64Core, a as DduSecureConstructorOptions, H as DduStreamOptions } from './core-ihIEWmI5.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 브라우저 플랫폼 어댑터 구현.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PlatformAdapter, I as KeyDerivationOptions, D as Ddu64Core,
|
|
1
|
+
import { P as PlatformAdapter, I as KeyDerivationOptions, D as Ddu64Core, a as DduSecureConstructorOptions, H as DduStreamOptions } from './core-ihIEWmI5.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 브라우저 플랫폼 어댑터 구현.
|
package/dist/browser.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkEY5OURIG_cjs=require('./chunk-EY5OURIG.cjs'),chunk3TG2ZEF2_cjs=require('./chunk-3TG2ZEF2.cjs'),chunk4247T4B7_cjs=require('./chunk-4247T4B7.cjs'),chunkA3OZJS5G_cjs=require('./chunk-A3OZJS5G.cjs'),chunkZTGECGM2_cjs=require('./chunk-ZTGECGM2.cjs'),chunkBCUBYE76_cjs=require('./chunk-BCUBYE76.cjs');var s=class extends chunkA3OZJS5G_cjs.i{static{chunkBCUBYE76_cjs.a(this,"Ddu64Browser");}#t;#r;#s;#n;#e;constructor(r,e,n){let o=chunkA3OZJS5G_cjs.b(r,e,n),t={...o.dduOptions,...o.dduChar!==void 0?{dduChar:o.dduChar}:{},...o.paddingChar!==void 0?{paddingChar:o.paddingChar}:{},obfuscationLayerFactory:o.dduOptions?.obfuscationLayerFactory??(c=>new chunk4247T4B7_cjs.a(c))};super(t),this.#t=t,this.#s=t.compress===true,this.#n=t.encryptionKey!==void 0,this.#e=t.adapter!==void 0;}async encodeAsync(r,e){return this.#d(e)?(await this.#o()).encodeAsync(r,e):super.encodeAsync(r,e)}async decodeToUint8ArrayAsync(r,e){return this.#d(e)?(await this.#o()).decodeToUint8ArrayAsync(r,e):super.decodeToUint8ArrayAsync(r,e)}getStatsAsync(r,e){return !this.#e&&this.#u(e)?this.#o().then(n=>n.getStatsAsync(r,e)):super.getStatsAsync(r,e)}#o(){return this.#r||(this.#r=import('./Ddu64SecureBrowser-EZBTEXVI.cjs').then(({Ddu64SecureBrowser:r})=>new r(this.#t))),this.#r}#d(r){return this.#e?false:this.#u(r)||this.#n}#u(r){return (r?.compress??this.#s)===true}};Object.defineProperty(exports,"detectRuntime",{enumerable:true,get:function(){return chunkEY5OURIG_cjs.a}});Object.defineProperty(exports,"CharsetBuilder",{enumerable:true,get:function(){return chunk3TG2ZEF2_cjs.a}});Object.defineProperty(exports,"HangulObfuscationLayer",{enumerable:true,get:function(){return chunk4247T4B7_cjs.a}});Object.defineProperty(exports,"createEncoderObfuscationLayer",{enumerable:true,get:function(){return chunk4247T4B7_cjs.b}});Object.defineProperty(exports,"Ddu64Core",{enumerable:true,get:function(){return chunkA3OZJS5G_cjs.i}});Object.defineProperty(exports,"DduSetSymbol",{enumerable:true,get:function(){return chunkA3OZJS5G_cjs.a}});Object.defineProperty(exports,"Ddu64AdapterError",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.m}});Object.defineProperty(exports,"Ddu64CharsetError",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.j}});Object.defineProperty(exports,"Ddu64ChecksumError",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.i}});Object.defineProperty(exports,"Ddu64CompressionError",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.e}});Object.defineProperty(exports,"Ddu64DecodeError",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.d}});Object.defineProperty(exports,"Ddu64DecompressionError",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.f}});Object.defineProperty(exports,"Ddu64DecryptionError",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.h}});Object.defineProperty(exports,"Ddu64EncodeError",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.c}});Object.defineProperty(exports,"Ddu64EncryptionError",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.g}});Object.defineProperty(exports,"Ddu64Error",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.b}});Object.defineProperty(exports,"Ddu64ErrorCode",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.a}});Object.defineProperty(exports,"Ddu64InvalidInputError",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.k}});Object.defineProperty(exports,"Ddu64LimitError",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.l}});Object.defineProperty(exports,"Ddu64ObfuscationError",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.n}});Object.defineProperty(exports,"Ddu64StreamError",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.o}});Object.defineProperty(exports,"isDdu64Error",{enumerable:true,get:function(){return chunkZTGECGM2_cjs.p}});exports.Ddu64=s;exports.Ddu64Browser=s;
|
package/dist/browser.d.cts
CHANGED
|
@@ -1,38 +1,29 @@
|
|
|
1
|
-
import { D as Ddu64Core, a as
|
|
2
|
-
export { C as CharSetConfig, d as CharSetInfo, e as CharsetBuilder, f as Ddu64AdapterError, g as Ddu64CharsetError, h as Ddu64ChecksumError, i as Ddu64CompressionError, j as Ddu64DecodeError, k as Ddu64DecompressionError, l as Ddu64DecryptionError, m as Ddu64EncodeError, n as Ddu64EncryptionError, o as Ddu64Error, p as Ddu64ErrorCode, q as Ddu64ErrorOptions, r as Ddu64InvalidInputError, s as Ddu64LimitError, t as Ddu64ObfuscationError, u as Ddu64Operation, v as Ddu64StreamError, w as
|
|
3
|
-
export { H as HangulObfuscationLayer, c as createEncoderObfuscationLayer, d as detectRuntime } from './ObfuscationLayer-
|
|
1
|
+
import { D as Ddu64Core, a as DduSecureConstructorOptions, b as DduOptions, c as DduEncodeStats } from './core-ihIEWmI5.cjs';
|
|
2
|
+
export { C as CharSetConfig, d as CharSetInfo, e as CharsetBuilder, f as Ddu64AdapterError, g as Ddu64CharsetError, h as Ddu64ChecksumError, i as Ddu64CompressionError, j as Ddu64DecodeError, k as Ddu64DecompressionError, l as Ddu64DecryptionError, m as Ddu64EncodeError, n as Ddu64EncryptionError, o as Ddu64Error, p as Ddu64ErrorCode, q as Ddu64ErrorOptions, r as Ddu64InvalidInputError, s as Ddu64LimitError, t as Ddu64ObfuscationError, u as Ddu64Operation, v as Ddu64StreamError, w as DduBaseConstructorOptions, x as DduBaseOptions, y as DduProgressInfo, z as DduSetSymbol, A as DduSetSymbolInput, E as EncodingProfile, O as ObfuscationLayer, B as isDdu64Error } from './core-ihIEWmI5.cjs';
|
|
3
|
+
export { H as HangulObfuscationLayer, c as createEncoderObfuscationLayer, d as detectRuntime } from './ObfuscationLayer-CK0ptcW-.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Browser 전용 기본
|
|
6
|
+
* Browser 전용 기본 Ddu64 래퍼.
|
|
7
7
|
*
|
|
8
8
|
* Ddu64Core를 확장하여 인코딩 + 한글 난독화(라이브러리 주목적)를 제공합니다:
|
|
9
9
|
* - HangulObfuscationLayer 자동 주입 → 키 없는 한글 난독화 사용 가능
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
* secure
|
|
11
|
+
* 기본 경로는 BrowserAdapter를 주입하지 않습니다. 압축/암호화가 명시된 비동기 호출만
|
|
12
|
+
* secure 브라우저 래퍼를 동적 import하여 BrowserAdapter를 지연 주입합니다.
|
|
13
13
|
* Node.js 내장 모듈도, WebCrypto/CompressionStream 어댑터도 정적 import하지 않습니다.
|
|
14
14
|
*
|
|
15
15
|
* @module Ddu64Browser
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
declare class Ddu64Browser extends Ddu64Core {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
encode(input: Uint8Array | string, options?: DduBaseOptions): string;
|
|
19
|
+
#private;
|
|
20
|
+
constructor(dduChar?: string[] | string | DduSecureConstructorOptions, paddingChar?: string, dduOptions?: DduSecureConstructorOptions);
|
|
22
21
|
/** @group Async */
|
|
23
|
-
encodeAsync(input: Uint8Array | string, options?:
|
|
24
|
-
/** @group Sync */
|
|
25
|
-
decode(input: string, options?: DduBaseOptions): string;
|
|
22
|
+
encodeAsync(input: Uint8Array | string, options?: DduOptions): Promise<string>;
|
|
26
23
|
/** @group Async */
|
|
27
|
-
|
|
28
|
-
/** @group Sync */
|
|
29
|
-
decodeToUint8Array(input: string, options?: DduBaseOptions): Uint8Array;
|
|
30
|
-
/** @group Async */
|
|
31
|
-
decodeToUint8ArrayAsync(input: string, options?: DduBaseOptions): Promise<Uint8Array>;
|
|
32
|
-
/** @group Introspection */
|
|
33
|
-
getStats(input: Uint8Array | string, options?: DduBaseOptions): DduEncodeStats;
|
|
24
|
+
decodeToUint8ArrayAsync(input: string, options?: DduOptions): Promise<Uint8Array>;
|
|
34
25
|
/** @group Introspection */
|
|
35
|
-
getStatsAsync(input: Uint8Array | string, options?:
|
|
26
|
+
getStatsAsync(input: Uint8Array | string, options?: DduOptions): Promise<DduEncodeStats>;
|
|
36
27
|
}
|
|
37
28
|
|
|
38
|
-
export { Ddu64Browser as Ddu64, Ddu64Browser, Ddu64Core,
|
|
29
|
+
export { Ddu64Browser as Ddu64, Ddu64Browser, Ddu64Core, DduEncodeStats };
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,38 +1,29 @@
|
|
|
1
|
-
import { D as Ddu64Core, a as
|
|
2
|
-
export { C as CharSetConfig, d as CharSetInfo, e as CharsetBuilder, f as Ddu64AdapterError, g as Ddu64CharsetError, h as Ddu64ChecksumError, i as Ddu64CompressionError, j as Ddu64DecodeError, k as Ddu64DecompressionError, l as Ddu64DecryptionError, m as Ddu64EncodeError, n as Ddu64EncryptionError, o as Ddu64Error, p as Ddu64ErrorCode, q as Ddu64ErrorOptions, r as Ddu64InvalidInputError, s as Ddu64LimitError, t as Ddu64ObfuscationError, u as Ddu64Operation, v as Ddu64StreamError, w as
|
|
3
|
-
export { H as HangulObfuscationLayer, c as createEncoderObfuscationLayer, d as detectRuntime } from './ObfuscationLayer-
|
|
1
|
+
import { D as Ddu64Core, a as DduSecureConstructorOptions, b as DduOptions, c as DduEncodeStats } from './core-ihIEWmI5.js';
|
|
2
|
+
export { C as CharSetConfig, d as CharSetInfo, e as CharsetBuilder, f as Ddu64AdapterError, g as Ddu64CharsetError, h as Ddu64ChecksumError, i as Ddu64CompressionError, j as Ddu64DecodeError, k as Ddu64DecompressionError, l as Ddu64DecryptionError, m as Ddu64EncodeError, n as Ddu64EncryptionError, o as Ddu64Error, p as Ddu64ErrorCode, q as Ddu64ErrorOptions, r as Ddu64InvalidInputError, s as Ddu64LimitError, t as Ddu64ObfuscationError, u as Ddu64Operation, v as Ddu64StreamError, w as DduBaseConstructorOptions, x as DduBaseOptions, y as DduProgressInfo, z as DduSetSymbol, A as DduSetSymbolInput, E as EncodingProfile, O as ObfuscationLayer, B as isDdu64Error } from './core-ihIEWmI5.js';
|
|
3
|
+
export { H as HangulObfuscationLayer, c as createEncoderObfuscationLayer, d as detectRuntime } from './ObfuscationLayer-CotTuQ5X.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Browser 전용 기본
|
|
6
|
+
* Browser 전용 기본 Ddu64 래퍼.
|
|
7
7
|
*
|
|
8
8
|
* Ddu64Core를 확장하여 인코딩 + 한글 난독화(라이브러리 주목적)를 제공합니다:
|
|
9
9
|
* - HangulObfuscationLayer 자동 주입 → 키 없는 한글 난독화 사용 가능
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
* secure
|
|
11
|
+
* 기본 경로는 BrowserAdapter를 주입하지 않습니다. 압축/암호화가 명시된 비동기 호출만
|
|
12
|
+
* secure 브라우저 래퍼를 동적 import하여 BrowserAdapter를 지연 주입합니다.
|
|
13
13
|
* Node.js 내장 모듈도, WebCrypto/CompressionStream 어댑터도 정적 import하지 않습니다.
|
|
14
14
|
*
|
|
15
15
|
* @module Ddu64Browser
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
declare class Ddu64Browser extends Ddu64Core {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
encode(input: Uint8Array | string, options?: DduBaseOptions): string;
|
|
19
|
+
#private;
|
|
20
|
+
constructor(dduChar?: string[] | string | DduSecureConstructorOptions, paddingChar?: string, dduOptions?: DduSecureConstructorOptions);
|
|
22
21
|
/** @group Async */
|
|
23
|
-
encodeAsync(input: Uint8Array | string, options?:
|
|
24
|
-
/** @group Sync */
|
|
25
|
-
decode(input: string, options?: DduBaseOptions): string;
|
|
22
|
+
encodeAsync(input: Uint8Array | string, options?: DduOptions): Promise<string>;
|
|
26
23
|
/** @group Async */
|
|
27
|
-
|
|
28
|
-
/** @group Sync */
|
|
29
|
-
decodeToUint8Array(input: string, options?: DduBaseOptions): Uint8Array;
|
|
30
|
-
/** @group Async */
|
|
31
|
-
decodeToUint8ArrayAsync(input: string, options?: DduBaseOptions): Promise<Uint8Array>;
|
|
32
|
-
/** @group Introspection */
|
|
33
|
-
getStats(input: Uint8Array | string, options?: DduBaseOptions): DduEncodeStats;
|
|
24
|
+
decodeToUint8ArrayAsync(input: string, options?: DduOptions): Promise<Uint8Array>;
|
|
34
25
|
/** @group Introspection */
|
|
35
|
-
getStatsAsync(input: Uint8Array | string, options?:
|
|
26
|
+
getStatsAsync(input: Uint8Array | string, options?: DduOptions): Promise<DduEncodeStats>;
|
|
36
27
|
}
|
|
37
28
|
|
|
38
|
-
export { Ddu64Browser as Ddu64, Ddu64Browser, Ddu64Core,
|
|
29
|
+
export { Ddu64Browser as Ddu64, Ddu64Browser, Ddu64Core, DduEncodeStats };
|
package/dist/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-
|
|
1
|
+
export{a as detectRuntime}from'./chunk-DVOLAE33.js';export{a as CharsetBuilder}from'./chunk-IZSFO3ET.js';import {a as a$1}from'./chunk-5VZELPTG.js';export{a as HangulObfuscationLayer,b as createEncoderObfuscationLayer}from'./chunk-5VZELPTG.js';import {i,b}from'./chunk-TCRCZHZC.js';export{i as Ddu64Core,a as DduSetSymbol}from'./chunk-TCRCZHZC.js';export{m as Ddu64AdapterError,j as Ddu64CharsetError,i as Ddu64ChecksumError,e as Ddu64CompressionError,d as Ddu64DecodeError,f as Ddu64DecompressionError,h as Ddu64DecryptionError,c as Ddu64EncodeError,g as Ddu64EncryptionError,b as Ddu64Error,a as Ddu64ErrorCode,k as Ddu64InvalidInputError,l as Ddu64LimitError,n as Ddu64ObfuscationError,o as Ddu64StreamError,p as isDdu64Error}from'./chunk-IZK7KCU7.js';import {a}from'./chunk-EI7MMDWY.js';var s=class extends i{static{a(this,"Ddu64Browser");}#t;#r;#s;#n;#e;constructor(r,e,n){let o=b(r,e,n),t={...o.dduOptions,...o.dduChar!==void 0?{dduChar:o.dduChar}:{},...o.paddingChar!==void 0?{paddingChar:o.paddingChar}:{},obfuscationLayerFactory:o.dduOptions?.obfuscationLayerFactory??(c=>new a$1(c))};super(t),this.#t=t,this.#s=t.compress===true,this.#n=t.encryptionKey!==void 0,this.#e=t.adapter!==void 0;}async encodeAsync(r,e){return this.#d(e)?(await this.#o()).encodeAsync(r,e):super.encodeAsync(r,e)}async decodeToUint8ArrayAsync(r,e){return this.#d(e)?(await this.#o()).decodeToUint8ArrayAsync(r,e):super.decodeToUint8ArrayAsync(r,e)}getStatsAsync(r,e){return !this.#e&&this.#u(e)?this.#o().then(n=>n.getStatsAsync(r,e)):super.getStatsAsync(r,e)}#o(){return this.#r||(this.#r=import('./Ddu64SecureBrowser-FR3TZJQ7.js').then(({Ddu64SecureBrowser:r})=>new r(this.#t))),this.#r}#d(r){return this.#e?false:this.#u(r)||this.#n}#u(r){return (r?.compress??this.#s)===true}};export{s as Ddu64,s as Ddu64Browser};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkBCUBYE76_cjs=require('./chunk-BCUBYE76.cjs');var h=class s{static{chunkBCUBYE76_cjs.a(this,"CharsetBuilder");}chars=[];constructor(){}static create(){return new s}static fromUnicodeRange(r,e){return new s().addUnicodeRange(r,e)}static fromString(r){return new s().addString(r)}static base64(){return new s().addString("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")}static base32(){return new s().addString("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567")}static uppercase(){return s.fromUnicodeRange(65,90)}static lowercase(){return s.fromUnicodeRange(97,122)}static digits(){return s.fromUnicodeRange(48,57)}static hangulJamo(){return new s().addUnicodeRange(4352,4370).addUnicodeRange(4449,4469).addUnicodeRange(4520,4546)}addUnicodeRange(r,e){if(!Number.isInteger(r)||!Number.isInteger(e)||r<0||e>1114111||r>e)throw new RangeError("Unicode range must use integer code points with 0 <= start <= end <= 0x10FFFF");for(let t=r;t<=e;t++)this.chars.push(String.fromCodePoint(t));return this}addString(r){return typeof r=="string"?this.chars.push(...r):this.chars.push(...r),this}add(...r){return this.chars.push(...r),this}excludeConfusing(){let r=new Set(["0","O","o","1","l","I","i","|","L"]);return this.chars=this.chars.filter(e=>!r.has(e)),this}exclude(...r){let e=new Set(r);return this.chars=this.chars.filter(t=>!e.has(t)),this}excludeUrlUnsafe(){let r=new Set(["+","/","=","?","&","#","%"," "]);return this.chars=this.chars.filter(e=>!r.has(e)),this}unique(){return this.chars=[...new Set(this.chars)],this}shuffle(r){let e=r!==void 0?this.seededRandom(r):Math.random;for(let t=this.chars.length-1;t>0;t--){let i=Math.floor(e()*(t+1));[this.chars[t],this.chars[i]]=[this.chars[i],this.chars[t]];}return this}seededRandom(r){let e=r|0||1;return ()=>(e^=e<<13,e^=e>>17,e^=e<<5,(e>>>0)/4294967296)}limit(r){if(!Number.isSafeInteger(r)||r<0)throw new RangeError("Charset limit must be a non-negative safe integer");return this.chars=this.chars.slice(0,r),this}limitToPowerOfTwo(){let r=this.chars.length;if(r===0)return this;let e=1<<Math.floor(Math.log2(r));return this.chars=this.chars.slice(0,e),this}sort(){return this.chars.sort(),this}reverse(){return this.chars.reverse(),this}get length(){return this.chars.length}buildString(){return this.chars.join("")}build(){return [...this.chars]}buildWithPadding(r){let e=[...this.chars],t=r;if(!t){let i=["=",".","_","-","~","!"];for(let n of i)if(!e.includes(n)){t=n;break}if(!t)throw new Error("Cannot find suitable padding character")}if(t.length!==1)throw new Error("Padding character must be one UTF-16 code unit");if(e.includes(t))throw new Error("Padding character must not appear in charset");return {charset:e,padding:t}}};exports.a=h;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkA3OZJS5G_cjs=require('./chunk-A3OZJS5G.cjs'),chunkZTGECGM2_cjs=require('./chunk-ZTGECGM2.cjs'),chunkBCUBYE76_cjs=require('./chunk-BCUBYE76.cjs');var i=44032,h=55203,c=h-i+1;function u(t){if(t.length===0)throw new chunkZTGECGM2_cjs.n("[Ddu64 obfuscation] Alphabet must not be empty.");if(t.length>c)throw new chunkZTGECGM2_cjs.n(`[Ddu64 obfuscation] Alphabet size (${t.length}) exceeds available Hangul syllables (${c}).`);let r=Math.floor(c/t.length),n=new Map;for(let e=0;e<t.length;e++)n.set(t[e],e);return {alphabet:t,syllablesPerChar:r,charToIndex:n}}chunkBCUBYE76_cjs.a(u,"buildSyllableMap");function g(t,r,n){let e=i+t*n.syllablesPerChar,o=r%n.syllablesPerChar;return e+o}chunkBCUBYE76_cjs.a(g,"charToSyllable");function d(t,r){if(t<i||t>h)return -1;let n=t-i,e=Math.floor(n/r.syllablesPerChar);return e>=r.alphabet.length?-1:e}chunkBCUBYE76_cjs.a(d,"syllableToCharIndex");var f=class{static{chunkBCUBYE76_cjs.a(this,"HangulObfuscationLayer");}config;constructor(r){this.config=u(r);}obfuscate(r){if(r.length===0)return "";let n=new Array(r.length);for(let e=0;e<r.length;e++){let o=r[e],s=this.config.charToIndex.get(o);if(s===void 0)throw new chunkZTGECGM2_cjs.n(`[Ddu64 obfuscation] Character "${o}" (U+${o.charCodeAt(0).toString(16).padStart(4,"0").toUpperCase()}) not found in obfuscation alphabet.`);let p=g(s,e,this.config);n[e]=String.fromCharCode(p);}return n.join("")}deobfuscate(r){if(r.length===0)return "";let n=new Array(r.length);for(let e=0;e<r.length;e++){let o=r.charCodeAt(e),s=d(o,this.config);if(s===-1)throw new chunkZTGECGM2_cjs.n(`[Ddu64 obfuscation] Invalid syllable at position ${e}: U+${o.toString(16).padStart(4,"0").toUpperCase()} is not in the mapped range.`);n[e]=this.config.alphabet[s];}return n.join("")}};function A(t,r){return new f(chunkA3OZJS5G_cjs.g(t,r))}chunkBCUBYE76_cjs.a(A,"createEncoderObfuscationLayer");exports.a=f;exports.b=A;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {g as g$1}from'./chunk-TCRCZHZC.js';import {n}from'./chunk-IZK7KCU7.js';import {a}from'./chunk-EI7MMDWY.js';var i=44032,h=55203,c=h-i+1;function u(t){if(t.length===0)throw new n("[Ddu64 obfuscation] Alphabet must not be empty.");if(t.length>c)throw new n(`[Ddu64 obfuscation] Alphabet size (${t.length}) exceeds available Hangul syllables (${c}).`);let r=Math.floor(c/t.length),n$1=new Map;for(let e=0;e<t.length;e++)n$1.set(t[e],e);return {alphabet:t,syllablesPerChar:r,charToIndex:n$1}}a(u,"buildSyllableMap");function g(t,r,n){let e=i+t*n.syllablesPerChar,o=r%n.syllablesPerChar;return e+o}a(g,"charToSyllable");function d(t,r){if(t<i||t>h)return -1;let n=t-i,e=Math.floor(n/r.syllablesPerChar);return e>=r.alphabet.length?-1:e}a(d,"syllableToCharIndex");var f=class{static{a(this,"HangulObfuscationLayer");}config;constructor(r){this.config=u(r);}obfuscate(r){if(r.length===0)return "";let n$1=new Array(r.length);for(let e=0;e<r.length;e++){let o=r[e],s=this.config.charToIndex.get(o);if(s===void 0)throw new n(`[Ddu64 obfuscation] Character "${o}" (U+${o.charCodeAt(0).toString(16).padStart(4,"0").toUpperCase()}) not found in obfuscation alphabet.`);let p=g(s,e,this.config);n$1[e]=String.fromCharCode(p);}return n$1.join("")}deobfuscate(r){if(r.length===0)return "";let n$1=new Array(r.length);for(let e=0;e<r.length;e++){let o=r.charCodeAt(e),s=d(o,this.config);if(s===-1)throw new n(`[Ddu64 obfuscation] Invalid syllable at position ${e}: U+${o.toString(16).padStart(4,"0").toUpperCase()} is not in the mapped range.`);n$1[e]=this.config.alphabet[s];}return n$1.join("")}};function A(t,r){return new f(g$1(t,r))}a(A,"createEncoderObfuscationLayer");export{f as a,A as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunk4247T4B7_cjs=require('./chunk-4247T4B7.cjs'),chunkA3OZJS5G_cjs=require('./chunk-A3OZJS5G.cjs'),chunkHUUB5BUS_cjs=require('./chunk-HUUB5BUS.cjs'),chunkBCUBYE76_cjs=require('./chunk-BCUBYE76.cjs');var s=class extends chunkA3OZJS5G_cjs.i{static{chunkBCUBYE76_cjs.a(this,"Ddu64SecureBrowser");}constructor(a,u,p){let r=chunkA3OZJS5G_cjs.b(a,u,p),i={...r.dduOptions,...r.dduChar!==void 0?{dduChar:r.dduChar}:{},...r.paddingChar!==void 0?{paddingChar:r.paddingChar}:{},adapter:r.dduOptions?.adapter,adapterFactory:r.dduOptions?.adapterFactory??(()=>new chunkHUUB5BUS_cjs.a),obfuscationLayerFactory:r.dduOptions?.obfuscationLayerFactory??(c=>new chunk4247T4B7_cjs.a(c))};super(i);}};exports.a=s;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';var chunkZTGECGM2_cjs=require('./chunk-ZTGECGM2.cjs'),chunkBCUBYE76_cjs=require('./chunk-BCUBYE76.cjs');var Ae=(n=>(n.DDU="ddu",n.DDU_V1="ddu_v1",n.ONECHARSET="oneCharSet",n))(Ae||{}),de={dduSetSymbol:"ddu",usePowerOfTwo:true,requiredLength:64};function Se(e,r,t){return e!=null&&typeof e=="object"&&!Array.isArray(e)?{dduChar:void 0,paddingChar:void 0,dduOptions:e}:{dduChar:e,paddingChar:r,dduOptions:t}}chunkBCUBYE76_cjs.a(Se,"resolveConstructorArgs");function Pe(e,r){return e<=1?0:r?Math.floor(Math.log2(e)):Math.ceil(Math.log2(e))}chunkBCUBYE76_cjs.a(Pe,"calculateBitLength");function we(e){return e>0&&(e&e-1)===0}chunkBCUBYE76_cjs.a(we,"isPowerOfTwo");function De(e){return e<31?1<<e:Math.pow(2,e)}chunkBCUBYE76_cjs.a(De,"maxValueForBitLength");var Tr=(()=>{let e=new Uint32Array(256);for(let r=0;r<256;r++){let t=r;for(let n=0;n<8;n++)t=t>>>1^(t&1?3988292384:0);e[r]=t;}return e})();function U(e){let r=4294967295;for(let t=0;t<e.length;t++)r=r>>>8^Tr[(r^e[t])&255];return ((r^4294967295)>>>0).toString(16).padStart(8,"0")}chunkBCUBYE76_cjs.a(U,"calculateCRC32");function ce(e,r){let t=Math.max(e.length,r.length),n=e.length^r.length;for(let o=0;o<t;o++){let a=o<e.length?e.charCodeAt(o):0,s=o<r.length?r.charCodeAt(o):0;n|=a^s;}return n===0}chunkBCUBYE76_cjs.a(ce,"constantTimeEquals");var Ee=["-","_","."];function ke(e){return e.length===0?e:e.replaceAll("+","-").replaceAll("/","_").replaceAll("=",".")}chunkBCUBYE76_cjs.a(ke,"toUrlSafe");function xe(e){return e.length===0?e:e.replaceAll("-","+").replaceAll("_","/").replaceAll(".","=")}chunkBCUBYE76_cjs.a(xe,"fromUrlSafe");function ve(e,r,t){if(r<=0||e.length<=r)return e;let n=Math.ceil(e.length/r),o=new Array(n*2-1),a=0;for(let s=0;s<e.length;s+=r)o[a++]=e.slice(s,s+r),s+r<e.length&&(o[a++]=t);return o.join("")}chunkBCUBYE76_cjs.a(ve,"splitIntoChunks");function Ue(e,r){if(e.length===0)return e;let t=r&&r!==`
|
|
2
|
+
`&&r!==`\r
|
|
3
|
+
`&&r!=="\r"?r:"",n=e.includes(`
|
|
4
|
+
`)||e.includes("\r"),o=t.length>0&&e.includes(t);if(!n&&!o)return e;let a=n?e.replace(/[\r\n]/g,""):e;return o&&(a=a.replaceAll(t,"")),a}chunkBCUBYE76_cjs.a(Ue,"removeChunks");var Oe={"":0,\u3131:1,\u3132:2,\u3133:3,\u3134:4,\u3135:5,\u3136:6,\u3137:7,\u3139:8,\u313A:9,\u313B:10,\u313C:11,\u313D:12,\u313E:13,\u313F:14,\u3140:15,\u3141:16,\u3142:17,\u3144:18,\u3145:19,\u3146:20,\u3147:21,\u3148:22,\u314A:23,\u314B:24,\u314C:25,\u314D:26,\u314E:27};function Be(e){return Object.prototype.hasOwnProperty.call(Oe,e)}chunkBCUBYE76_cjs.a(Be,"isKnownCodaChar");function Mr(e,r){let t=e.charCodeAt(0);if(t<44032||t>55203)return e;let n=t-(t-44032)%28,o=Oe[r]??0;return String.fromCharCode(n+o)}chunkBCUBYE76_cjs.a(Mr,"combineCoda");function Y(e,r){let t=new Array(e.length*r.length),n=0;for(let o of e)for(let a of r)t[n++]=Mr(o,a);return t}chunkBCUBYE76_cjs.a(Y,"buildCodaCharset");function X(e,r){let n=e===void 0||!Number.isFinite(e)?6:Math.floor(e);return Math.min(r==="brotli"?11:9,Math.max(0,n))}chunkBCUBYE76_cjs.a(X,"normalizeCompressionLevel");var Kr=new TextEncoder,_r=new TextDecoder;function K(e){return Kr.encode(e)}chunkBCUBYE76_cjs.a(K,"stringToBytes");function ue(e){return _r.decode(e)}chunkBCUBYE76_cjs.a(ue,"bytesToString");var Nr={symbol:"ddu",charSet:["\uB70C","\uB568","\uC774","\uC6B0","\uC57C","\uB4C0","\uB31C","\uB3A8"],codaChar:["","\u3131","\u3132","\u3137","\u3148","\u3147","\u3145","\u3146"],maxRequiredLength:64,bitLength:6,paddingChar:"\uBB50",useRepeatPadding:true},zr={symbol:"ddu_v1",charSet:["\uB70C","\uB568","\uC774","\uC6B0","\uC57C","!","?","."],maxRequiredLength:8,bitLength:6,paddingChar:"\uBB50",useRepeatPadding:true,usePowerOfTwo:false,encodingProfile:{bitLength:6,usePowerOfTwo:false,bitsPerPadChar:2}},$r={symbol:"oneCharSet",charSet:["A","s","q","r","0","z","3","t","y","1","5","2","4","E","B","C","Q","F","R","T","U","W","V","X","Y","Z","b","a","c","d","D","G","L","H","I","-","J","K","M","O","N","f","e","h","g","P","i","S","k","l","m","u","j","v","n","o","p","9","w","6","7","8","x","_"],paddingChar:"=",maxRequiredLength:64,bitLength:6};function Z(e){switch(e){case "ddu":return Nr;case "ddu_v1":return zr;case "oneCharSet":return $r;default:return}}chunkBCUBYE76_cjs.a(Z,"getCharSet");var Fr=65536;function Le(e,r,t,n){let o=chunkBCUBYE76_cjs.a((a,s,c,d,u)=>{if(Vr(c,t?.usePowerOfTwo)&&c>0){let h=Math.floor(Math.log2(c)),f=1<<h;return {charSet:a.length===f?a:a.slice(0,f),padding:s,requiredLength:f,bitLength:h,isPredefined:d,useRepeatPadding:u}}return {charSet:a.length===c?a:a.slice(0,c),padding:s,requiredLength:c,bitLength:c>0?Math.ceil(Math.log2(c)):0,isPredefined:d,useRepeatPadding:u}},"buildMeta");try{let a=e??t?.dduChar,s=r??t?.paddingChar;if(a){if(!s)throw new Error("[Ddu64 Constructor] paddingChar is required when dduChar is provided.");let h=typeof a=="string"?[...a]:[...a],f=t?.codaChar,m=f?!0:t?.useRepeatPadding??!1;if(f&&f.length>0){if(n){let g=f.filter(P=>!Be(P));if(g.length>0)throw new Error(`[Ddu64 Constructor] Unknown coda character(s): [${g.join(", ")}]. Coda must be empty ("") or a Hangul jongseong jamo (\u3131, \u3132, \u3133, \u2026 \u314E). Unknown coda collapses to no-coda and can create duplicate symbols.`)}h=Y(h,f);}if(n&&new Set(h).size!==h.length){let P=h.filter((C,S)=>h.indexOf(C)!==S);throw new Error(`[Ddu64 Constructor] Character set contains duplicate characters: [${[...new Set(P)].join(", ")}]`)}let y=t?.requiredLength??h.length;if(h.length<y)throw new Error("[Ddu64 Constructor] Insufficient characters.");return o(h,s,y,!1,m)}let c=t?.dduSetSymbol??de.dduSetSymbol??"ddu",d=Hr(c),u=d.codaChar?Y(d.charSet,d.codaChar):d.charSet,l=o(u,d.paddingChar,d.maxRequiredLength,!0,d.useRepeatPadding),p=d.encodingProfile;return p?(l.encodingProfile=p,l.bitLength=p.bitLength,l.usePowerOfTwo=p.usePowerOfTwo,l.bitsPerPadChar=p.bitsPerPadChar):(l.bitsPerPadChar=d.bitsPerPadChar,l.usePowerOfTwo=d.usePowerOfTwo,d.usePowerOfTwo===!1&&(l.bitLength=d.bitLength)),l}catch(a){if(n)throw a;return le(t)}}chunkBCUBYE76_cjs.a(Le,"resolveInitialCharSet");function Re(e,r,t){let n=[e,null];for(let a of n){let s=a?{...a}:le(t);try{let c=s.charSet,d=s.requiredLength,u=Array.from(new Set(c));if(u.length!==c.length){if(r){let h=c.filter((f,m)=>c.indexOf(f)!==m);throw new Error(`[Ddu64 normalizeCharSet] Character set contains duplicate characters: [${[...new Set(h)].join(", ")}]`)}c=u,s.isPredefined||(d=c.length);}if(c.length<d)throw new Error(`[Ddu64 normalizeCharSet] Insufficient characters. Required: ${d}, Has: ${c.length}`);if(d<2)throw new Error("[Ddu64 normalizeCharSet] At least 2 unique characters required.");if(c.length===0)throw new Error("[Ddu64 normalizeCharSet] Empty charset.");if(c.find(h=>h.length!==1)){if(r)throw new Error("[Ddu64 normalizeCharSet] Multi-character symbols are not supported.");continue}if(c.length>Fr){if(r)throw new Error("[Ddu64 normalizeCharSet] Charset size exceeds maximum supported size of 65536.");continue}if(s.padding.length!==1)throw new Error(`[Ddu64 normalizeCharSet] Padding length mismatch. Expected 1, got ${s.padding.length}`);if(c.includes(s.padding)){if(r)throw new Error(`[Ddu64 normalizeCharSet] Padding character "${s.padding}" conflicts with charset.`);c=c.filter(h=>h!==s.padding);}for(let h of c){if(h.includes(`
|
|
5
|
+
`)||h.includes("\r"))throw new Error("[Ddu64 normalizeCharSet] Newline and carriage return characters are reserved.");if(Ie(h))throw new Error(`[Ddu64 normalizeCharSet] Lone surrogate code unit (U+${h.charCodeAt(0).toString(16).toUpperCase()}) is not allowed; it corrupts on UTF-8/URL/JSON boundaries.`)}if(s.padding.includes(`
|
|
6
|
+
`)||s.padding.includes("\r"))throw new Error("[Ddu64 normalizeCharSet] Newline and carriage return characters are reserved.");if(Ie(s.padding))throw new Error("[Ddu64 normalizeCharSet] Padding character must not be a lone surrogate code unit.");return {charSet:c.length===d?c:c.slice(0,d),padding:s.padding,isPredefined:s.isPredefined}}catch(c){if(r)throw c}}let o=le(t);return {charSet:o.charSet.slice(0,o.requiredLength),padding:o.padding,isPredefined:true}}chunkBCUBYE76_cjs.a(Re,"normalizeCharSet");function Te(e,r,t){for(let n of Ee){for(let o of e)if(o.includes(n)){let a=`[Ddu64 Constructor] URL-Safe mode conflict: charset character "${o}" contains "${n}".`;if(t)throw new Error(a);return false}if(r.includes(n)){let o=`[Ddu64 Constructor] URL-Safe mode conflict: padding character "${r}" contains "${n}".`;if(t)throw new Error(o);return false}}return true}chunkBCUBYE76_cjs.a(Te,"isUrlSafeCompatible");function Ie(e){if(e.length!==1)return false;let r=e.charCodeAt(0);return r>=55296&&r<=57343}chunkBCUBYE76_cjs.a(Ie,"isLoneSurrogate");function Vr(e,r){return r!==void 0?r?e>0:false:e>0&&(e&e-1)===0}chunkBCUBYE76_cjs.a(Vr,"shouldUsePowerOfTwo");function Hr(e){let r=Z(e);if(!r)throw new Error(`CharSet with symbol ${e} not found`);return r}chunkBCUBYE76_cjs.a(Hr,"getCharSetOrThrow");function le(e){let r=e?.dduSetSymbol??de.dduSetSymbol??"oneCharSet",t=Z(r)??Z("oneCharSet");if(!t)throw new Error("Critical: No fallback CharSet available");return {charSet:t.codaChar?Y(t.charSet,t.codaChar):t.charSet,padding:t.paddingChar,requiredLength:t.maxRequiredLength,bitLength:t.encodingProfile?.bitLength??t.bitLength,isPredefined:true,useRepeatPadding:t.useRepeatPadding,bitsPerPadChar:t.encodingProfile?.bitsPerPadChar??t.bitsPerPadChar,usePowerOfTwo:t.encodingProfile?.usePowerOfTwo??t.usePowerOfTwo,encodingProfile:t.encodingProfile}}chunkBCUBYE76_cjs.a(le,"getFallbackCharSet");var qr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Me(e,r,t,n){return t&&n===6&&r==="="&&e.join("")===qr}chunkBCUBYE76_cjs.a(Me,"canUseNativeBase64FastPath");function Ke(e){let r=Gr(e);if(r===null)return null;let t=0,n=r.length;for(;n>0&&r[n-1]==="=";)t++,n--;return {payload:r.slice(0,n),paddingBits:t===2?4:t===1?2:0}}chunkBCUBYE76_cjs.a(Ke,"encodeNativeBase64");function _e(e,r,t){let n=r===4?2:r===2?1:r===0?0:-1;if(n<0)return null;for(let o=0;o<e.length;o++)if(!t(e.charCodeAt(o)))return null;return jr(e+"=".repeat(n))}chunkBCUBYE76_cjs.a(_e,"decodeNativeBase64");function Gr(e){let r=e.toBase64;if(typeof r=="function")return r.call(e);let t=globalThis.Buffer;return t?.from?t.from(e.buffer,e.byteOffset,e.byteLength).toString("base64"):null}chunkBCUBYE76_cjs.a(Gr,"bytesToBase64");function jr(e){let r=Uint8Array;if(typeof r.fromBase64=="function")return r.fromBase64(e);let t=globalThis.Buffer;if(t?.from){let n=t.from(e,"base64");return new Uint8Array(n)}return null}chunkBCUBYE76_cjs.a(jr,"base64ToBytes");function J(e,r){if(!e)throw new chunkZTGECGM2_cjs.m("[Ddu64 adapter] No platform adapter available. Use encodeAsync()/decodeAsync() in browser environments, or provide an adapter via options.adapter.",r);return e}chunkBCUBYE76_cjs.a(J,"requireSyncAdapter");function Ne(e,r,t){let n=J(e.adapter,"encode");if(!n.encryptSync)throw new chunkZTGECGM2_cjs.m("[Ddu64 encrypt] Sync encryption unavailable. Use encodeAsync() in browser environments.","encode");let o=Ve(e,n,"encrypt","encode");return n.encryptSync(r,o,t)}chunkBCUBYE76_cjs.a(Ne,"encryptSyncWithAdapter");function ze(e,r,t){let n=J(e.adapter,"decode");if(!n.decryptSync)throw new chunkZTGECGM2_cjs.m("[Ddu64 decrypt] Sync decryption unavailable. Use decodeAsync() in browser environments.","decode");let o=Ve(e,n,"decrypt","decode");return n.decryptSync(r,o,t)}chunkBCUBYE76_cjs.a(ze,"decryptSyncWithAdapter");function $e(e,r,t,n){let o=J(e,"encode");if(t==="brotli"){if(!o.brotliCompressSync)throw new chunkZTGECGM2_cjs.m("[Ddu64 compress] Brotli compression is unavailable in the current runtime.","encode");return o.brotliCompressSync(r,n)}if(!o.deflateSync)throw new chunkZTGECGM2_cjs.m("[Ddu64 compress] Sync compression unavailable. Use encodeAsync() in browser environments.","encode");return o.deflateSync(r,n)}chunkBCUBYE76_cjs.a($e,"compressSyncWithAdapter");function Fe(e,r,t,n){let o=J(e,"decode");if(t==="brotli"){if(!o.brotliDecompressSync)throw new chunkZTGECGM2_cjs.m("[Ddu64 decompress] Brotli decompression is unavailable in the current runtime.","decode");return o.brotliDecompressSync(r,n)}if(!o.inflateSync)throw new chunkZTGECGM2_cjs.m("[Ddu64 decompress] Sync decompression unavailable. Use decodeAsync() in browser environments.","decode");return o.inflateSync(r,n)}chunkBCUBYE76_cjs.a(Fe,"decompressSyncWithAdapter");function Ve(e,r,t,n){if(e.encryptionKeyHash)return e.encryptionKeyHash;if(!r.deriveKeySync){let a=t==="encrypt"?"encodeAsync":"decodeAsync";throw new chunkZTGECGM2_cjs.m(`[Ddu64 ${t}] Sync key derivation unavailable. Use ${a}() in browser environments.`,n)}let o=r.deriveKeySync(e.encryptionKey,e.keyDerivation);return e.setEncryptionKeyHash(o),o}chunkBCUBYE76_cjs.a(Ve,"getSyncKeyHash");function Q(e,r){throw chunkZTGECGM2_cjs.p(e)?e:new r(chunkZTGECGM2_cjs.q(e),e)}chunkBCUBYE76_cjs.a(Q,"rethrowTyped");function He(e,r,t){try{return Ne(e,r,t)}catch(n){Q(n,chunkZTGECGM2_cjs.g);}}chunkBCUBYE76_cjs.a(He,"runEncryptSync");function qe(e,r,t){try{return ze(e,r,t)}catch(n){Q(n,chunkZTGECGM2_cjs.h);}}chunkBCUBYE76_cjs.a(qe,"runDecryptSync");function fe(e,r,t,n){try{return $e(e,r,t,n)}catch(o){Q(o,chunkZTGECGM2_cjs.e);}}chunkBCUBYE76_cjs.a(fe,"runCompressSync");function Ge(e,r,t,n){try{return Fe(e,r,t,n)}catch(o){Q(o,chunkZTGECGM2_cjs.f);}}chunkBCUBYE76_cjs.a(Ge,"runDecompressSync");async function je(e,r,t){try{let n=ee(e.adapter,"encode"),o=await Xe(e,n);return await n.encrypt(r,o,t)}catch(n){throw re(n,"encode","encrypt")}}chunkBCUBYE76_cjs.a(je,"encryptAsyncWithAdapter");async function We(e,r,t){try{let n=ee(e.adapter,"decode"),o=await Xe(e,n);return await n.decrypt(r,o,t)}catch(n){throw re(n,"decode","decrypt")}}chunkBCUBYE76_cjs.a(We,"decryptAsyncWithAdapter");async function he(e,r,t,n){try{let o=ee(e,"encode");if(t==="brotli"){if(!o.brotliCompress)throw new chunkZTGECGM2_cjs.m("[Ddu64 compress] Brotli compression is unavailable in the current runtime.","encode");return await o.brotliCompress(r,n)}return await o.deflate(r,n)}catch(o){throw re(o,"encode","compress")}}chunkBCUBYE76_cjs.a(he,"compressAsyncWithAdapter");async function Ye(e,r,t,n){try{let o=ee(e,"decode");if(t==="brotli"){if(!o.brotliDecompress)throw new chunkZTGECGM2_cjs.m("[Ddu64 decompress] Brotli decompression is unavailable in the current runtime.","decode");return await o.brotliDecompress(r,n)}return await o.inflate(r,n)}catch(o){throw re(o,"decode","decompress")}}chunkBCUBYE76_cjs.a(Ye,"decompressAsyncWithAdapter");function ee(e,r){if(!e)throw new chunkZTGECGM2_cjs.m("[Ddu64 adapter] No platform adapter available. Use @ddunigma/node or @ddunigma/node/browser, or provide an adapter via options.adapter.",r);return e}chunkBCUBYE76_cjs.a(ee,"requireAsyncAdapter");async function Xe(e,r){if(e.encryptionKeyHash)return e.encryptionKeyHash;if(e.encryptionKeyHashPromise)return e.encryptionKeyHashPromise;let t=r.deriveKey(e.encryptionKey,e.keyDerivation).then(n=>(e.setEncryptionKeyHash(n),n)).finally(()=>{e.encryptionKeyHashPromise=void 0;});return e.encryptionKeyHashPromise=t,t}chunkBCUBYE76_cjs.a(Xe,"getAsyncKeyHash");function re(e,r,t){if(chunkZTGECGM2_cjs.p(e))return e;let n=chunkZTGECGM2_cjs.q(e);switch(t){case "compress":return new chunkZTGECGM2_cjs.e(n,e);case "decompress":return new chunkZTGECGM2_cjs.f(n,e);case "encrypt":return new chunkZTGECGM2_cjs.g(n,e);case "decrypt":return new chunkZTGECGM2_cjs.h(n,e)}}chunkBCUBYE76_cjs.a(re,"toAsyncGatewayError");var Ze=new Map;function Je(e,r=false){let t=r?e.join(""):void 0;if(t!==void 0){let u=Ze.get(t);if(u)return u}let n=new Uint16Array(e.length),o=65535,a=0;for(let u=0;u<e.length;u++){let l=e[u].charCodeAt(0);n[u]=l,l>a&&(a=l),l<o&&(o=l);}let s=e.length>0?o:0,c=new Int32Array(a-s+1);c.fill(-1);for(let u=0;u<e.length;u++)c[n[u]-s]=u;let d={charCodeLookup:c,charCodes:n,lookupOffset:s};return t!==void 0&&Ze.set(t,d),d}chunkBCUBYE76_cjs.a(Je,"buildCharsetLookupTables");function _(e,r,t){let n=r-t;return n>=0&&n<e.length?e[n]:-1}chunkBCUBYE76_cjs.a(_,"lookupCharIndex");var Qe=8;function er(e,r,t,n){return Math.ceil(e/(n?1:2))*t-r}chunkBCUBYE76_cjs.a(er,"decodedBitCount");function x(e,r,t,n){if(e===void 0)return r;if(e===Number.POSITIVE_INFINITY)return Number.POSITIVE_INFINITY;if(!Number.isFinite(e)||e<=0){if(t)throw new chunkZTGECGM2_cjs.k(`[Ddu64 options] Invalid ${n}. Must be a positive finite number or Infinity.`);return r}return Math.floor(e)}chunkBCUBYE76_cjs.a(x,"normalizeLimit");function rr(e,r,t,n){if(e===0)return 0;if(r<0||r>=t)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Invalid padding bits: ${r}`);let o=er(e,r,t,n);if(o<0)throw new chunkZTGECGM2_cjs.d("[Ddu64 decode] Invalid decoded bit length");return Math.ceil(o/Qe)}chunkBCUBYE76_cjs.a(rr,"estimateDecodedBytes");function tr(e,r){if(!r&&e.length%2!==0)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Invalid encoded length for variable charset. Expected multiple of 2, got ${e.length}`)}chunkBCUBYE76_cjs.a(tr,"assertEncodedInputAligned");function nr(e,r,t,n){if(e.length===0)return;let o=er(e.length,r,t,n);if(o<0||o%Qe!==0)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Invalid encoded bit length. Expected a whole number of bytes, got ${o} bits.`)}chunkBCUBYE76_cjs.a(nr,"assertDecodedBitLength");function or(e,r,t,n,o,a){if(r===0)return;if(e.length===0)throw new chunkZTGECGM2_cjs.d("[Ddu64 decode] Invalid padding bits without payload");let s=(1<<r)-1,c;if(t){let d=e[e.length-1],u=_(n,d.charCodeAt(0),a);if(u<0)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Invalid character "${d}" at ${e.length-1}`);c=u;}else {let d=e[e.length-2],u=e[e.length-1],l=_(n,d.charCodeAt(0),a),p=_(n,u.charCodeAt(0),a);if(l<0||p<0)throw new chunkZTGECGM2_cjs.d("[Ddu64 decode] Invalid character in final encoded chunk");c=l*o+p;}if((c&s)!==0)throw new chunkZTGECGM2_cjs.d("[Ddu64 decode] Invalid non-zero padding bits in final symbol")}chunkBCUBYE76_cjs.a(or,"assertCanonicalPadding");var N="DDS1",z="ELYSIA",$="GRISEO";var Wr=new TextEncoder;function O(e,r,t){let n=t-r.length;if(n<0)return false;for(let o=0;o<r.length;o++)if(e.charCodeAt(n+o)!==r.charCodeAt(o))return false;return true}chunkBCUBYE76_cjs.a(O,"endsWithAt");function ir(e,r,t,n=2){let o=e.length,a=r.length,s={cleanedInput:e,paddingBits:0,isEncrypted:false,pipelineVersion:2};if(a===0||o<a)return s;let d=Math.max(0,t-1).toString().length;for(let u=Math.min(d,o);u>=1;u--){let l=o-u,p=true;for(let C=l;C<o;C++){let S=e.charCodeAt(C);if(S<48||S>57){p=false;break}}if(!p||u>1&&e.charCodeAt(l)===48)continue;let h=0;for(let C=l;C<o;C++)h=h*10+(e.charCodeAt(C)-48);if(h>=t)continue;let f=l,m=false,y,g=2;f>=2&&O(e,"V4",f)?(g=4,f-=2):f>=2&&O(e,"V3",f)&&(g=3,f-=2),f>=3&&O(e,"ENC",f)&&(m=true,f-=3),f>=z.length&&O(e,z,f)?(y="deflate",f-=z.length):f>=$.length&&O(e,$,f)&&(y="brotli",f-=$.length);let P=f-a;if(P>=0&&O(e,r,f))return {cleanedInput:e.substring(0,P),paddingBits:h,compressionAlgorithm:y,isEncrypted:m,pipelineVersion:g}}if(O(e,r,o)){let u=0,l=o;for(;l>=a&&O(e,r,l);)u++,l-=a;if(u>0){let p=u*n;if(p<t)return {cleanedInput:e.substring(0,l),paddingBits:p,isEncrypted:false,pipelineVersion:2}}}return s}chunkBCUBYE76_cjs.a(ir,"parseFooter");function Yr(e){let r=e.lastIndexOf("CHK");if(r===-1)return {data:e,checksum:null};let t=e.slice(r+3);return t.length!==8||!/^[0-9a-f]+$/i.test(t)?{data:e,checksum:null}:{data:e.slice(0,r),checksum:t.toLowerCase()}}chunkBCUBYE76_cjs.a(Yr,"extractChecksum");var Xr=/^[0-9a-f]{8}$/i;function ar(e){let r=e.length;if(r>=11){let n=e.charCodeAt(r-11),o=e.charCodeAt(r-10),a=e[r-9];if(n===67&&o===75&&(a==="P"||a==="O")){let s=e.slice(r-8);if(Xr.test(s))return {data:e.slice(0,r-11),checksum:s.toLowerCase(),scope:a==="P"?"plaintext":"output"}}}let t=Yr(e);return {data:t.data,checksum:t.checksum,scope:null}}chunkBCUBYE76_cjs.a(ar,"extractScopedChecksum");function Zr(e){return e.length*2+N.length+2}chunkBCUBYE76_cjs.a(Zr,"getStreamHeaderLength");function $t(e,r){let t=r.compressionAlgorithm==="brotli"?"B":r.compressionAlgorithm==="deflate"?"D":"N",n=r.encrypted?"1":"0";return `${e}${N}${t}${n}${e}`}chunkBCUBYE76_cjs.a($t,"buildStreamHeader");function Ft(e,r){let t=Zr(r);if(e.length<t||!e.startsWith(r))return null;let n=r.length;if(e.slice(n,n+N.length)!==N)throw new Error("[wireFormat] Invalid stream header magic");let a=e[n+N.length],s=e[n+N.length+1];if(e.slice(t-r.length,t)!==r)throw new Error("[wireFormat] Invalid stream header terminator");let d=a==="B"?"brotli":a==="D"?"deflate":a==="N"?void 0:null;if(d===null)throw new Error("[wireFormat] Invalid stream header compression flag");if(s!=="0"&&s!=="1")throw new Error("[wireFormat] Invalid stream header encryption flag");return {compressionAlgorithm:d,encrypted:s==="1"}}chunkBCUBYE76_cjs.a(Ft,"parseStreamHeader");function sr(e){let{paddingBits:r,compressionAlgorithm:t,isEncrypted:n,paddingChar:o,useRepeatPadding:a,bitsPerPadChar:s=2,pipelineVersion:c=2}=e;if(!n&&c!==2)throw new Error("[wireFormat] Pipeline version markers require encryption");if(r===0&&!t&&!n&&c===2)return "";if(a&&!t&&!n&&c===2&&r>0&&r%s===0){let u=r/s;return o.repeat(u)}return o+(t==="deflate"?z:t==="brotli"?$:"")+(n?"ENC":"")+(c===4?"V4":c===3?"V3":"")+r.toString()}chunkBCUBYE76_cjs.a(sr,"buildFooter");function te(e){return Wr.encode(`ddunigma:wire:v4;enc=1;compress=${e.compressionAlgorithm??"none"}`)}chunkBCUBYE76_cjs.a(te,"buildEncryptionAAD");function dr(e,r,t){let n=r?.checksum??t.defaultChecksum,o=r?.compress!==false,a=r?.encrypt!==false,s=e;t.reportDecodeStart(e.length);let c=x(r?.maxEncodedChars,t.defaultMaxEncodedChars,true,"maxEncodedChars");if(e.length>c)throw new chunkZTGECGM2_cjs.l(`[Ddu64 decode] Encoded input exceeds limit. Length: ${e.length}, Limit: ${c} characters`,"decode");let d=r?.chunkSeparator??t.defaultChunkSeparator;s=Ue(s,d),t.urlSafe&&(s=xe(s));let u=null,l=null;if(n){let B=ar(s);if(u=B.checksum,l=B.scope,s=B.data,!u)throw new chunkZTGECGM2_cjs.i("[Ddu64 checksum] Checksum verification requested, but no checksum marker was found.")}t.shouldObfuscate(r)&&(s=t.deobfuscate(s));let{cleanedInput:p,paddingBits:h,compressionAlgorithm:f,isEncrypted:m,pipelineVersion:y}=ir(s,t.paddingChar,t.bitLength,t.bitsPerPadChar);if((r?.requireEncryption??t.defaultRequireEncryption)&&a&&!m)throw new chunkZTGECGM2_cjs.h("[Ddu64 decode] Encryption is required, but the payload has no authenticated encryption footer.");if(m&&a&&!t.encryptionKey)throw new chunkZTGECGM2_cjs.h("[Ddu64 decode] Encrypted payload requires an encryptionKey");let P=m&&y===4?te({compressionAlgorithm:f}):void 0;tr(p,t.usePowerOfTwo),or(p,h,t.usePowerOfTwo,t.dduCharCodeLookup,t.charSetSize,t.dduCharCodeLookupOffset),nr(p,h,t.bitLength,t.usePowerOfTwo);let C=x(r?.maxDecodedBytes,t.defaultMaxDecodedBytes,true,"maxDecodedBytes"),S=rr(p.length,h,t.bitLength,t.usePowerOfTwo);if(S>C)throw new chunkZTGECGM2_cjs.l(`[Ddu64 decode] Decoded output exceeds limit. Estimated: ${S} bytes, Limit: ${C} bytes`,"decode");return t.reportBitpackDecode(p.length,e.length),{decoded:t.decodeChars(p,h),extractedChecksum:u,extractedChecksumScope:l,compressionAlgorithm:f,isEncrypted:m,pipelineVersion:y,encryptionAAD:P,allowInternalDecompress:o,allowInternalDecrypt:a}}chunkBCUBYE76_cjs.a(dr,"runDecodePrelude");function cr(e){return e.omitFooter?"":sr({paddingBits:e.paddingBits,compressionAlgorithm:e.compressionAlgorithm,isEncrypted:e.isEncrypted,paddingChar:e.paddingChar,useRepeatPadding:e.useRepeatPadding&&!e.compressionAlgorithm&&!e.isEncrypted,bitsPerPadChar:e.bitsPerPadChar,pipelineVersion:e.isEncrypted?e.pipelineVersion:2})}chunkBCUBYE76_cjs.a(cr,"buildEncodeFooter");function ur(e){let r=e.encoded;if(e.shouldObfuscate(e.options)&&(r=e.getObfuscationLayer().obfuscate(r)),e.shouldChecksum&&e.checksum){let t=e.checksumScope==="plaintext"?"P":"O";r=r+"CK"+t+e.checksum;}return e.urlSafe&&(r=ke(r)),e.chunkSize&&e.chunkSize>0&&(e.assertSafeChunkSeparator(r,e.chunkSeparator),r=ve(r,e.chunkSize,e.chunkSeparator)),r}chunkBCUBYE76_cjs.a(ur,"applyPostEncoding");var pe=8192;function lr(e,r,t){let n=e.length;if(n===0)return {payload:"",paddingBits:0};let o=Math.ceil(n*8/r),a=Math.min(o,pe),s=new Uint16Array(a),c=[],d=0,u=0;if(r===6){let l=0;for(;l+2<n;l+=3){let h=e[l],f=e[l+1],m=e[l+2];s[d++]=t[h>>>2],d===a&&(c.push(String.fromCharCode.apply(null,s)),d=0),s[d++]=t[(h&3)<<4|f>>>4],d===a&&(c.push(String.fromCharCode.apply(null,s)),d=0),s[d++]=t[(f&15)<<2|m>>>6],d===a&&(c.push(String.fromCharCode.apply(null,s)),d=0),s[d++]=t[m&63],d===a&&(c.push(String.fromCharCode.apply(null,s)),d=0);}let p=n-l;if(p===1){let h=e[l];s[d++]=t[h>>>2],d===a&&(c.push(String.fromCharCode.apply(null,s)),d=0),s[d++]=t[(h&3)<<4],d===a&&(c.push(String.fromCharCode.apply(null,s)),d=0),u=4;}else if(p===2){let h=e[l],f=e[l+1];s[d++]=t[h>>>2],d===a&&(c.push(String.fromCharCode.apply(null,s)),d=0),s[d++]=t[(h&3)<<4|f>>>4],d===a&&(c.push(String.fromCharCode.apply(null,s)),d=0),s[d++]=t[(f&15)<<2],d===a&&(c.push(String.fromCharCode.apply(null,s)),d=0),u=2;}}else if(r===8)for(let l=0;l<n;l++)s[d++]=t[e[l]],d===a&&(c.push(String.fromCharCode.apply(null,s)),d=0);else {let l=(1<<r)-1,p=0,h=0;for(let f=0;f<n;f++)for(p=p<<8|e[f],h+=8;h>=r;)h-=r,s[d++]=t[p>>h&l],d===a&&(c.push(String.fromCharCode.apply(null,s)),d=0),p&=(1<<h)-1;h>0&&(u=r-h,s[d++]=t[p<<u&l]);}return d>0&&c.push(String.fromCharCode.apply(null,s.subarray(0,d))),{payload:c.length===1?c[0]:c.join(""),paddingBits:u}}chunkBCUBYE76_cjs.a(lr,"packPow2ToString");function fr(e,r,t,n,o){let a=e.length;if(a===0)return new Uint8Array(0);let s=Math.ceil((a*t-r)/8),c=new Uint8Array(s+1),d=0,u=n.length;if(t===6){let f=a-a%4;f===a&&r>0&&(f-=4);let m=0;for(;m<f;m+=4){let C=e.charCodeAt(m)-o,S=C>=0&&C<u?n[C]:-1;if(S<0)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Invalid character "${e[m]}" at ${m}`);let D=e.charCodeAt(m+1)-o,B=D>=0&&D<u?n[D]:-1;if(B<0)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Invalid character "${e[m+1]}" at ${m+1}`);let ne=e.charCodeAt(m+2)-o,oe=ne>=0&&ne<u?n[ne]:-1;if(oe<0)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Invalid character "${e[m+2]}" at ${m+2}`);let ie=e.charCodeAt(m+3)-o,ge=ie>=0&&ie<u?n[ie]:-1;if(ge<0)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Invalid character "${e[m+3]}" at ${m+3}`);c[d++]=S<<2|B>>>4,c[d++]=(B&15)<<4|oe>>>2,c[d++]=(oe&3)<<6|ge;}let y=0,g=0,P=a-1;for(;m<a;m++){let S=e.charCodeAt(m)-o,D=S>=0&&S<u?n[S]:-1;if(D<0)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Invalid character "${e[m]}" at ${m}`);for(y=y<<6|D,g+=6,m===P&&r>0&&(y>>=r,g-=r);g>=8;)g-=8,c[d++]=y>>g&255,y&=(1<<g)-1;}return c.subarray(0,d)}if(t===8&&r===0){for(let f=0;f<a;f++){let y=e.charCodeAt(f)-o,g=y>=0&&y<u?n[y]:-1;if(g<0)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Invalid character "${e[f]}" at ${f}`);c[d++]=g;}return c.subarray(0,d)}let l=0,p=0,h=a-1;for(let f=0;f<a;f++){let y=e.charCodeAt(f)-o,g=y>=0&&y<u?n[y]:-1;if(g<0)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Invalid character "${e[f]}" at ${f}`);for(l=l<<t|g,p+=t,f===h&&r>0&&(l>>=r,p-=r);p>=8;)p-=8,c[d++]=l>>p&255,l&=(1<<p)-1;}return c.subarray(0,d)}chunkBCUBYE76_cjs.a(fr,"unpackPow2FromString");function hr(e,r,t,n){let o=e.length;if(o===0)return {payload:"",paddingBits:0};let a=[],s=new Uint16Array(pe),c=0,d=0,u=0,l=0,p=chunkBCUBYE76_cjs.a(h=>{s[c++]=h,c===pe&&(a.push(String.fromCharCode.apply(null,s)),c=0);},"pushCode");for(let h=0;h<o;h++)for(d=d<<8|e[h],u+=8;u>=r;){u-=r;let f=d>>u,m=f/t|0;p(n[m]),p(n[f-m*t]),d&=(1<<u)-1;}if(u>0){l=r-u;let h=d<<l,f=h/t|0;p(n[f]),p(n[h-f*t]);}return c>0&&a.push(String.fromCharCode.apply(null,s.subarray(0,c))),{payload:a.length===1?a[0]:a.join(""),paddingBits:l}}chunkBCUBYE76_cjs.a(hr,"packNonPow2ToString");function pr(e,r,t,n,o,a){let s=e.length;if(s===0)return new Uint8Array(0);let c=Math.ceil(s/2),d=Math.ceil((c*t-r)/8),u=new Uint8Array(d+1),l=0,p=De(t),h=o.length,f=0,m=0;for(let y=0;y<s;y+=2){let g=e.charCodeAt(y)-a,P=g>=0&&g<h?o[g]:-1;if(P<0)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Invalid character "${e[y]}" at ${y}`);if(y+1>=s)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Truncated symbol pair at ${y+1}`);let C=e.charCodeAt(y+1)-a,S=C>=0&&C<h?o[C]:-1;if(S<0)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Invalid character "${e[y+1]}" at ${y+1}`);let D=P*n+S;if(D>=p)throw new chunkZTGECGM2_cjs.d(`[Ddu64 decode] Value ${D} exceeds range at position ${y}`);for(f=f<<t|D,m+=t,y+2>=s&&r>0&&(f>>=r,m-=r);m>=8;)m-=8,u[l++]=f>>m&255,f&=(1<<m)-1;}return u.subarray(0,l)}chunkBCUBYE76_cjs.a(pr,"unpackNonPow2FromString");function mr(e,r,t,n,o){if(e.length===0)return "";let a=o.canUseNativeBase64?Ke(e):null,s,c;if(a)s=a.paddingBits,c=a.payload;else if(o.bitPackConfig.usePowerOfTwo){let u=lr(e,o.bitPackConfig.bitLength,o.dduCharCodes);s=u.paddingBits,c=u.payload;}else {let u=hr(e,o.bitPackConfig.bitLength,o.bitPackConfig.charsetSize,o.dduCharCodes);s=u.paddingBits,c=u.payload;}let d=cr({paddingBits:s,compressionAlgorithm:r,isEncrypted:t,paddingChar:o.paddingChar,useRepeatPadding:o.useRepeatPadding,bitsPerPadChar:o.bitsPerPadChar,pipelineVersion:o.encryptedPipelineVersion,omitFooter:n?.omitFooter});return c+d}chunkBCUBYE76_cjs.a(mr,"encodePayload");function yr(e,r,t){if(e.length===0)return new Uint8Array(0);let o=t.canUseNativeBase64?_e(e,r,a=>_(t.dduCharCodeLookup,a,t.dduCharCodeLookupOffset)>=0):null;return o||(t.bitPackConfig.usePowerOfTwo?fr(e,r,t.bitPackConfig.bitLength,t.dduCharCodeLookup,t.dduCharCodeLookupOffset):pr(e,r,t.bitPackConfig.bitLength,t.bitPackConfig.charsetSize,t.dduCharCodeLookup,t.dduCharCodeLookupOffset))}chunkBCUBYE76_cjs.a(yr,"decodePayload");function gr(e,r){let t=new Set(e);t.add(r);let n=z+$+"ENC"+"V3"+"V4";for(let o of n)t.add(o);for(let o of "0123456789")t.add(o);return [...t]}chunkBCUBYE76_cjs.a(gr,"buildObfuscationAlphabet");function k(e,r="construct"){if(e===void 0)return;if(typeof e!="object"||e===null||Array.isArray(e))throw new chunkZTGECGM2_cjs.k("[Ddu64 options] Options must be an object.",r);let t=e;E(e.compress,"compress",r),E(t.encrypt,"encrypt",r),E(e.checksum,"checksum",r),E(t.omitFooter,"omitFooter",r),E(e.obfuscate,"obfuscate",r),E(e.requireEncryption,"requireEncryption",r),e.compressionLevel!==void 0&&(typeof e.compressionLevel!="number"||!Number.isFinite(e.compressionLevel))&&A(r,"compressionLevel must be a finite number"),e.onProgress!==void 0&&typeof e.onProgress!="function"&&A(r,"onProgress must be a function"),e.compressionAlgorithm!==void 0&&e.compressionAlgorithm!=="deflate"&&e.compressionAlgorithm!=="brotli"&&A(r,`compressionAlgorithm must be "deflate" or "brotli", got ${String(e.compressionAlgorithm)}`),e.checksumScope!==void 0&&e.checksumScope!=="plaintext"&&e.checksumScope!=="output"&&A(r,`checksumScope must be "plaintext" or "output", got ${String(e.checksumScope)}`),e.chunkSize!==void 0&&(!Number.isSafeInteger(e.chunkSize)||e.chunkSize<0)&&A(r,"chunkSize must be a non-negative safe integer (0 disables chunking)"),e.chunkSeparator!==void 0&&typeof e.chunkSeparator!="string"&&A(r,"chunkSeparator must be a string"),e.chunkSize!==void 0&&e.chunkSize>0&&e.chunkSeparator===""&&A(r,"chunkSeparator must not be empty when chunkSize is enabled"),V(e.maxDecodedBytes,"maxDecodedBytes",r),V(e.maxEncodedChars,"maxEncodedChars",r),V(e.maxDecompressedBytes,"maxDecompressedBytes",r),"maxBufferedBytes"in e&&V(e.maxBufferedBytes,"maxBufferedBytes",r),"maxBufferedChars"in e&&V(e.maxBufferedChars,"maxBufferedChars",r);let n=e;E(n.throwOnError,"throwOnError",r),E(n.urlSafe,"urlSafe",r),E(n.useRepeatPadding,"useRepeatPadding",r),E(n.usePowerOfTwo,"usePowerOfTwo",r),n.encryptionKey!==void 0&&(typeof n.encryptionKey!="string"||n.encryptionKey.length===0)&&A(r,"encryptionKey must be a non-empty string"),n.dduChar!==void 0&&typeof n.dduChar!="string"&&!(Array.isArray(n.dduChar)&&n.dduChar.every(a=>typeof a=="string"))&&A(r,"dduChar must be a string or string array"),n.paddingChar!==void 0&&typeof n.paddingChar!="string"&&A(r,"paddingChar must be a string"),n.codaChar!==void 0&&!(Array.isArray(n.codaChar)&&n.codaChar.every(a=>typeof a=="string"))&&A(r,"codaChar must be a string array"),n.requiredLength!==void 0&&(!Number.isSafeInteger(n.requiredLength)||n.requiredLength<=0)&&A(r,"requiredLength must be a positive safe integer"),n.adapter!==void 0&&(typeof n.adapter!="object"||n.adapter===null)&&A(r,"adapter must be an object");let o="keyDerivation"in e?e.keyDerivation:void 0;o!==void 0&&((typeof o!="object"||o===null)&&A(r,"keyDerivation must be an object"),o.algorithm!==void 0&&o.algorithm!=="sha256"&&o.algorithm!=="pbkdf2"&&A(r,`keyDerivation.algorithm must be "sha256" or "pbkdf2", got ${String(o.algorithm)}`),o.hash!==void 0&&o.hash!=="SHA-256"&&o.hash!=="SHA-384"&&o.hash!=="SHA-512"&&A(r,`Unsupported PBKDF2 hash: ${String(o.hash)}`),o.iterations!==void 0&&(!Number.isFinite(o.iterations)||o.iterations<=0)&&A(r,"keyDerivation.iterations must be a positive finite number"),o.salt!==void 0&&typeof o.salt!="string"&&!Cr(o.salt)&&A(r,"keyDerivation.salt must be a string or Uint8Array"));}chunkBCUBYE76_cjs.a(k,"validateRuntimeOptions");function H(e,r="encode"){if(typeof e!="string"&&!Cr(e))throw new chunkZTGECGM2_cjs.k("[Ddu64 input] Encode input must be a string or Uint8Array.",r)}chunkBCUBYE76_cjs.a(H,"validateEncodeInput");function q(e,r="decode"){if(typeof e!="string")throw new chunkZTGECGM2_cjs.k("[Ddu64 input] Decode input must be a string.",r)}chunkBCUBYE76_cjs.a(q,"validateDecodeInput");function Cr(e){return ArrayBuffer.isView(e)&&Object.prototype.toString.call(e)==="[object Uint8Array]"}chunkBCUBYE76_cjs.a(Cr,"isUint8Array");function E(e,r,t){e!==void 0&&typeof e!="boolean"&&A(t,`${r} must be a boolean`);}chunkBCUBYE76_cjs.a(E,"validateBoolean");function V(e,r,t){e!==void 0&&e!==Number.POSITIVE_INFINITY&&(!Number.isSafeInteger(e)||e<=0)&&A(t,`${r} must be a positive safe integer or Infinity`);}chunkBCUBYE76_cjs.a(V,"validatePositiveLimit");function A(e,r){throw new chunkZTGECGM2_cjs.k(`[Ddu64 options] Invalid ${r}.`,e)}chunkBCUBYE76_cjs.a(A,"invalid");function br(e,r,t){let n=e.decoded,o=e.extractedChecksumScope??r?.checksumScope??"plaintext";return o==="output"&&Dr(e,t),n=tt(e,t,n),n=nt(e,r,t,n),o==="plaintext"&&Er(e,t,n),n=ot(e,t,n),xr(t,n),n}chunkBCUBYE76_cjs.a(br,"runSyncDecodePipeline");async function Ar(e,r,t){let n=e.decoded,o=e.extractedChecksumScope??r?.checksumScope??"plaintext";if(o==="output"&&Dr(e,t),Sr(e,t)&&(v(t,n.length,55,"decrypt"),n=await t.decrypt(n,e.encryptionAAD)),wr(e)){let a=kr(r,t);v(t,n.length,70,"decompress"),n=await t.decompress(n,e.compressionAlgorithm,a);}return o==="plaintext"&&Er(e,t,n),Pr(e,t)&&(v(t,n.length,90,"decrypt"),n=await t.decrypt(n,e.encryptionAAD)),xr(t,n),n}chunkBCUBYE76_cjs.a(Ar,"runAsyncDecodePipeline");function tt(e,r,t){return Sr(e,r)?(v(r,t.length,55,"decrypt"),r.decrypt(t,e.encryptionAAD)):t}chunkBCUBYE76_cjs.a(tt,"runPreDecompressDecrypt");function nt(e,r,t,n){if(!wr(e))return n;let o=kr(r,t);return v(t,n.length,70,"decompress"),t.decompress(n,e.compressionAlgorithm,o)}chunkBCUBYE76_cjs.a(nt,"runDecompress");function ot(e,r,t){return Pr(e,r)?(v(r,t.length,90,"decrypt"),r.decrypt(t,e.encryptionAAD)):t}chunkBCUBYE76_cjs.a(ot,"runPostChecksumDecrypt");function Sr(e,r){return (e.pipelineVersion===3||e.pipelineVersion===4)&&e.isEncrypted&&!!r.encryptionKey&&e.allowInternalDecrypt}chunkBCUBYE76_cjs.a(Sr,"shouldRunPreDecompressDecrypt");function Pr(e,r){return e.pipelineVersion===2&&e.isEncrypted&&!!r.encryptionKey&&e.allowInternalDecrypt}chunkBCUBYE76_cjs.a(Pr,"shouldRunPostChecksumDecrypt");function wr(e){return !!e.compressionAlgorithm&&e.allowInternalDecompress&&(e.pipelineVersion===2||!e.isEncrypted||e.allowInternalDecrypt)}chunkBCUBYE76_cjs.a(wr,"shouldDecompress");function Dr(e,r){if(!e.extractedChecksum)return;v(r,e.decoded.length,85,"checksum");let t=U(e.decoded);if(!ce(t,e.extractedChecksum))throw new chunkZTGECGM2_cjs.i(`[Ddu64 decode] Checksum mismatch. Expected: ${e.extractedChecksum}, Got: ${t}`)}chunkBCUBYE76_cjs.a(Dr,"verifyWireChecksum");function Er(e,r,t){if(!e.extractedChecksum||!(e.pipelineVersion===2||!e.isEncrypted||e.allowInternalDecrypt))return;v(r,t.length,85,"checksum");let n=U(t);if(!ce(n,e.extractedChecksum))throw new chunkZTGECGM2_cjs.i(`[Ddu64 decode] Checksum mismatch. Expected: ${e.extractedChecksum}, Got: ${n}`)}chunkBCUBYE76_cjs.a(Er,"verifyDecodedChecksum");function kr(e,r){return x(e?.maxDecompressedBytes,r.defaultMaxDecompressedBytes,true,"maxDecompressedBytes")}chunkBCUBYE76_cjs.a(kr,"getMaxDecompressedBytes");function v(e,r,t,n){e.reportProgress({processedBytes:r,totalBytes:r,percent:t,stage:n});}chunkBCUBYE76_cjs.a(v,"reportStage");function xr(e,r){v(e,r.length,100,"done");}chunkBCUBYE76_cjs.a(xr,"reportDone");function me(e,r,t){let n=Ur(r,t),o=typeof e=="string"?K(e):e;Or(t,o.length);let a="";n.shouldChecksum&&n.checksumScope==="plaintext"&&(a=U(o));let s,c;if(n.shouldCompress){let{algo:u,level:l}=vr(r,t);Br(t,o.length);let p=t.compress(o,u,l);p.length<o.length&&(c=p.length,o=p,s=u);}let d=false;return n.shouldEncrypt&&(Ir(t,o.length),o=t.encrypt(o,t.getEncryptionAAD(s)),d=true),n.shouldChecksum&&n.checksumScope==="output"&&(a=U(o)),{encoded:t.finalize(o,s,d,a,n.shouldChecksum,n.checksumScope,n.chunkSize,n.chunkSeparator),compressedSize:c}}chunkBCUBYE76_cjs.a(me,"runSyncEncodePipeline");async function ye(e,r,t){let n=Ur(r,t),o=typeof e=="string"?K(e):e;Or(t,o.length);let a="";n.shouldChecksum&&n.checksumScope==="plaintext"&&(a=U(o));let s,c;if(n.shouldCompress){let{algo:u,level:l}=vr(r,t);Br(t,o.length);let p=await t.compress(o,u,l);p.length<o.length&&(c=p.length,o=p,s=u);}let d=false;return n.shouldEncrypt&&(Ir(t,o.length),o=await t.encrypt(o,t.getEncryptionAAD(s)),d=true),n.shouldChecksum&&n.checksumScope==="output"&&(a=U(o)),{encoded:t.finalize(o,s,d,a,n.shouldChecksum,n.checksumScope,n.chunkSize,n.chunkSeparator),compressedSize:c}}chunkBCUBYE76_cjs.a(ye,"runAsyncEncodePipeline");function vr(e,r){let t=e?.compressionAlgorithm??r.defaultCompressionAlgorithm,n=X(e?.compressionLevel??r.defaultCompressionLevel,t);return {algo:t,level:n}}chunkBCUBYE76_cjs.a(vr,"resolveCompressionParams");function Ur(e,r){return {shouldCompress:e?.compress??r.defaultCompress,shouldChecksum:e?.checksum??r.defaultChecksum,checksumScope:e?.checksumScope??r.defaultChecksumScope,shouldEncrypt:(e?.encrypt??true)&&r.hasEncryptionKey,chunkSize:e?.chunkSize??r.defaultChunkSize,chunkSeparator:e?.chunkSeparator??r.defaultChunkSeparator}}chunkBCUBYE76_cjs.a(Ur,"resolveEncodeSettings");function Or(e,r){e.reportProgress({processedBytes:0,totalBytes:r,percent:0,stage:"start"});}chunkBCUBYE76_cjs.a(Or,"reportStart");function Br(e,r){e.reportProgress({processedBytes:r,totalBytes:r,percent:20,stage:"compress"});}chunkBCUBYE76_cjs.a(Br,"reportCompress");function Ir(e,r){e.reportProgress({processedBytes:r,totalBytes:r,percent:45,stage:"encrypt"});}chunkBCUBYE76_cjs.a(Ir,"reportEncrypt");var it=64*1024*1024,at=64*1024*1024,st=256*1024*1024,Lr=28,Rr=class{static{chunkBCUBYE76_cjs.a(this,"Ddu64Core");}dduChar;dduCharCodes;paddingChar;bitLength;usePowerOfTwo;dduCharCodeLookup;dduCharCodeLookupOffset;defaultCompress;defaultMaxDecodedBytes;defaultMaxEncodedChars;defaultMaxDecompressedBytes;urlSafe;encryptionKey;keyDerivation;encryptionKeyHash;syncGatewayContext;defaultChecksum;defaultChecksumScope;defaultChunkSize;defaultChunkSeparator;defaultCompressionLevel;defaultCompressionAlgorithm;useRepeatPadding;bitsPerPadChar;bitPackConfig;canUseNativeBase64;payloadCodecContext;adapter;adapterFactory;obfuscationLayerFactory;defaultObfuscate;defaultOnProgress;defaultRequireEncryption;obfuscationLayer;constructor(r,t,n){let o=Se(r,t,n);r=o.dduChar,t=o.paddingChar,n=o.dduOptions,k(n);let a=n?.throwOnError??true;this.adapter=n?.adapter,this.adapterFactory=n?.adapterFactory,this.obfuscationLayerFactory=n?.obfuscationLayerFactory;let s,c;try{s=Le(r,t,n,a),c=Re(s,a,n);}catch(y){throw chunkZTGECGM2_cjs.p(y)?y:new chunkZTGECGM2_cjs.j(chunkZTGECGM2_cjs.q(y),y)}this.dduChar=c.charSet,this.paddingChar=c.padding;let d=c.isPredefined;this.defaultCompress=n?.compress??false,this.defaultMaxDecodedBytes=x(n?.maxDecodedBytes,it,a,"maxDecodedBytes"),this.defaultMaxDecompressedBytes=x(n?.maxDecompressedBytes,at,a,"maxDecompressedBytes"),this.defaultMaxEncodedChars=x(n?.maxEncodedChars,this.defaultMaxDecodedBytes===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:Math.max(st,this.defaultMaxDecodedBytes*4),a,"maxEncodedChars");let u=this.dduChar.length,l=we(u),p=n?.usePowerOfTwo,h=s.encodingProfile;this.usePowerOfTwo=h?.usePowerOfTwo??s.usePowerOfTwo??(p!==void 0?p&&l:l);let f=h?.bitLength??(s.isPredefined&&s.usePowerOfTwo!==void 0?s.bitLength:void 0);this.bitLength=f??Pe(u,this.usePowerOfTwo);let m=Je(this.dduChar,d);this.dduCharCodeLookup=m.charCodeLookup,this.dduCharCodeLookupOffset=m.lookupOffset,this.dduCharCodes=m.charCodes,this.urlSafe=dt(this.dduChar,this.paddingChar,n?.urlSafe??false,a),this.encryptionKey=n?.encryptionKey,this.keyDerivation=n?.keyDerivation,this.defaultChecksum=n?.checksum??false,this.defaultChecksumScope=n?.checksumScope??"output",this.defaultChunkSize=n?.chunkSize,this.defaultChunkSeparator=n?.chunkSeparator??`
|
|
7
|
+
`,this.defaultCompressionAlgorithm=n?.compressionAlgorithm??"deflate",this.defaultCompressionLevel=X(n?.compressionLevel,this.defaultCompressionAlgorithm),this.useRepeatPadding=n?.useRepeatPadding??s.useRepeatPadding??false,this.bitsPerPadChar=h?.bitsPerPadChar??s.bitsPerPadChar??2,this.defaultObfuscate=n?.obfuscate??false,this.defaultOnProgress=n?.onProgress,this.defaultRequireEncryption=n?.requireEncryption??this.encryptionKey!==void 0,this.bitPackConfig={bitLength:this.bitLength,usePowerOfTwo:this.usePowerOfTwo,charsetSize:u},this.canUseNativeBase64=Me(this.dduChar,this.paddingChar,this.usePowerOfTwo,this.bitLength),this.payloadCodecContext={bitPackConfig:this.bitPackConfig,canUseNativeBase64:this.canUseNativeBase64,dduCharCodes:this.dduCharCodes,dduCharCodeLookup:this.dduCharCodeLookup,dduCharCodeLookupOffset:this.dduCharCodeLookupOffset,paddingChar:this.paddingChar,useRepeatPadding:this.useRepeatPadding,bitsPerPadChar:this.bitsPerPadChar,encryptedPipelineVersion:4};}encode(r,t){try{return k(t,"encode"),H(r),this.encodeInternal(r,t).encoded}catch(n){throw chunkZTGECGM2_cjs.r(n,"encode")}}decode(r,t){try{k(t,"decode"),q(r);let n=this.decodeToUint8Array(r,t);return ue(n)}catch(n){throw chunkZTGECGM2_cjs.r(n,"decode")}}decodeToUint8Array(r,t){try{return k(t,"decode"),q(r),this.decodeToUint8ArrayInternal(r,t)}catch(n){throw chunkZTGECGM2_cjs.r(n,"decode")}}decodeToUint8ArrayInternal(r,t){let n=this.decodePrelude(r,t);return br(n,t,{...this.buildDecodeBaseContext(t),decrypt:chunkBCUBYE76_cjs.a((o,a)=>qe(this.getSyncGatewayContext(),o,a),"decrypt"),decompress:chunkBCUBYE76_cjs.a((o,a,s)=>Ge(this.getAdapter(),o,a,s),"decompress")})}async encodeAsync(r,t){try{return k(t,"encode"),H(r),await this.encodeAsyncInternal(r,t)}catch(n){throw chunkZTGECGM2_cjs.r(n,"encode")}}async encodeAsyncInternal(r,t){return (await ye(r,t,{...this.buildEncodeBaseContext(t),compress:chunkBCUBYE76_cjs.a((o,a,s)=>he(this.getAdapter(),o,a,s),"compress"),encrypt:chunkBCUBYE76_cjs.a((o,a)=>je(this.getSyncGatewayContext(),o,a),"encrypt")})).encoded}async decodeAsync(r,t){try{k(t,"decode"),q(r);let n=await this.decodeToUint8ArrayAsync(r,t);return ue(n)}catch(n){throw chunkZTGECGM2_cjs.r(n,"decode")}}async decodeToUint8ArrayAsync(r,t){try{return k(t,"decode"),q(r),await this.decodeToUint8ArrayAsyncInternal(r,t)}catch(n){throw chunkZTGECGM2_cjs.r(n,"decode")}}async decodeToUint8ArrayAsyncInternal(r,t){let n=this.decodePrelude(r,t);return Ar(n,t,{...this.buildDecodeBaseContext(t),decrypt:chunkBCUBYE76_cjs.a((o,a)=>We(this.getSyncGatewayContext(),o,a),"decrypt"),decompress:chunkBCUBYE76_cjs.a((o,a,s)=>Ye(this.getAdapter(),o,a,s),"decompress")})}buildDecodeBaseContext(r){return {encryptionKey:this.encryptionKey,defaultMaxDecompressedBytes:this.defaultMaxDecompressedBytes,reportProgress:chunkBCUBYE76_cjs.a(t=>this.reportProgress(r,t),"reportProgress")}}getCharSetInfo(){return {charSet:[...this.dduChar],paddingChar:this.paddingChar,bitLength:this.bitLength,usePowerOfTwo:this.usePowerOfTwo,encoding:"utf-8",defaultCompress:this.defaultCompress,defaultMaxDecodedBytes:this.defaultMaxDecodedBytes,defaultMaxDecompressedBytes:this.defaultMaxDecompressedBytes,urlSafe:this.urlSafe,hasEncryptionKey:!!this.encryptionKey,defaultChecksum:this.defaultChecksum,defaultChecksumScope:this.defaultChecksumScope,defaultObfuscate:this.defaultObfuscate,defaultRequireEncryption:this.defaultRequireEncryption,defaultChunkSize:this.defaultChunkSize,defaultChunkSeparator:this.defaultChunkSeparator,defaultCompressionLevel:this.defaultCompressionLevel,defaultCompressionAlgorithm:this.defaultCompressionAlgorithm}}getStats(r,t){k(t,"encode"),H(r);let n=typeof r=="string"?K(r):r,{encoded:o,compressedSize:a}=this.encodeStatsInternal(n,t);return this.buildEncodeStats(n.length,o.length,a,t)}async getStatsAsync(r,t){k(t,"encode"),H(r);let n=typeof r=="string"?K(r):r,{encoded:o,compressedSize:a}=await this.encodeStatsAsyncInternal(n,t);return this.buildEncodeStats(n.length,o.length,a,t)}buildEncodeStats(r,t,n,o){let a=r>0?t/r:0,c=(o?.compress??this.defaultCompress)&&n!==void 0&&r>0?n/r:void 0;return {originalSize:r,encodedSize:t,compressedSize:n,compressionRatio:c,expansionRatio:a,charsetSize:this.dduChar.length,bitLength:this.bitLength}}encodeInternal(r,t){return me(r,t,{...this.buildEncodeBaseContext(t),compress:chunkBCUBYE76_cjs.a((n,o,a)=>fe(this.getAdapter(),n,o,a),"compress"),encrypt:chunkBCUBYE76_cjs.a((n,o)=>He(this.getSyncGatewayContext(),n,o),"encrypt")})}encodeStatsInternal(r,t){return me(r,t,{...this.buildEncodeBaseContext(t),compress:chunkBCUBYE76_cjs.a((n,o,a)=>fe(this.getAdapter(),n,o,a),"compress"),encrypt:chunkBCUBYE76_cjs.a(n=>new Uint8Array(n.length+Lr),"encrypt")})}async encodeStatsAsyncInternal(r,t){return ye(r,t,{...this.buildEncodeBaseContext(t),compress:chunkBCUBYE76_cjs.a((n,o,a)=>he(this.getAdapter(),n,o,a),"compress"),encrypt:chunkBCUBYE76_cjs.a(async n=>new Uint8Array(n.length+Lr),"encrypt")})}buildEncodeBaseContext(r){return {defaultCompress:this.defaultCompress,defaultChecksum:this.defaultChecksum,defaultChecksumScope:this.defaultChecksumScope,defaultChunkSize:this.defaultChunkSize,defaultChunkSeparator:this.defaultChunkSeparator,defaultCompressionLevel:this.defaultCompressionLevel,defaultCompressionAlgorithm:this.defaultCompressionAlgorithm,hasEncryptionKey:!!this.encryptionKey,reportProgress:chunkBCUBYE76_cjs.a(t=>this.reportProgress(r,t),"reportProgress"),getEncryptionAAD:chunkBCUBYE76_cjs.a(t=>te({compressionAlgorithm:t}),"getEncryptionAAD"),finalize:chunkBCUBYE76_cjs.a((t,n,o,a,s,c,d,u)=>this.finalizeEncode(t,n,o,a,s,c,d,u,r),"finalize")}}finalizeEncode(r,t,n,o,a,s,c,d,u){this.reportProgress(u,{processedBytes:r.length,totalBytes:r.length,percent:70,stage:"encode"});let l=mr(r,t,n,u,this.getPayloadCodecContext());return l=this.applyPostEncoding(l,u,o,a,s,c,d),this.reportProgress(u,{processedBytes:r.length,totalBytes:r.length,percent:100,stage:"done"}),l}applyPostEncoding(r,t,n,o,a,s,c){return ur({encoded:r,options:t,checksum:n,shouldChecksum:o,checksumScope:a,chunkSize:s,chunkSeparator:c,urlSafe:this.urlSafe,shouldObfuscate:chunkBCUBYE76_cjs.a(d=>this.shouldObfuscate(d),"shouldObfuscate"),getObfuscationLayer:chunkBCUBYE76_cjs.a(()=>this.getObfuscationLayer(),"getObfuscationLayer"),assertSafeChunkSeparator:chunkBCUBYE76_cjs.a((d,u)=>this.assertSafeChunkSeparator(d,u),"assertSafeChunkSeparator")})}decodePrelude(r,t){return dr(r,t,{defaultChecksum:this.defaultChecksum,defaultChunkSeparator:this.defaultChunkSeparator,defaultMaxDecodedBytes:this.defaultMaxDecodedBytes,defaultMaxEncodedChars:this.defaultMaxEncodedChars,urlSafe:this.urlSafe,paddingChar:this.paddingChar,bitLength:this.bitLength,bitsPerPadChar:this.bitsPerPadChar,usePowerOfTwo:this.usePowerOfTwo,dduCharCodeLookup:this.dduCharCodeLookup,dduCharCodeLookupOffset:this.dduCharCodeLookupOffset,charSetSize:this.dduChar.length,encryptionKey:this.encryptionKey,defaultRequireEncryption:this.defaultRequireEncryption,shouldObfuscate:chunkBCUBYE76_cjs.a(n=>this.shouldObfuscate(n),"shouldObfuscate"),deobfuscate:chunkBCUBYE76_cjs.a(n=>this.getObfuscationLayer().deobfuscate(n),"deobfuscate"),decodeChars:chunkBCUBYE76_cjs.a((n,o)=>yr(n,o,this.getPayloadCodecContext()),"decodeChars"),reportDecodeStart:chunkBCUBYE76_cjs.a(n=>{this.reportProgress(t,{processedBytes:0,totalBytes:n,percent:0,stage:"start"});},"reportDecodeStart"),reportBitpackDecode:chunkBCUBYE76_cjs.a((n,o)=>{this.reportProgress(t,{processedBytes:n,totalBytes:o,percent:30,stage:"decode"});},"reportBitpackDecode")})}getPayloadCodecContext(){return this.payloadCodecContext}reportProgress(r,t){(r?.onProgress??this.defaultOnProgress)?.(t);}getAdapter(){return this.adapter===void 0&&this.adapterFactory!==void 0&&(this.adapter=this.adapterFactory()),this.adapter}getSyncGatewayContext(){if(!this.syncGatewayContext){let r={adapter:this.getAdapter(),encryptionKey:this.encryptionKey,keyDerivation:this.keyDerivation,encryptionKeyHash:this.encryptionKeyHash,setEncryptionKeyHash:chunkBCUBYE76_cjs.a(t=>{this.encryptionKeyHash=t,r.encryptionKeyHash=t;},"setEncryptionKeyHash")};this.syncGatewayContext=r;}return this.syncGatewayContext}getObfuscationLayer(){if(!this.obfuscationLayer){if(!this.obfuscationLayerFactory)throw new chunkZTGECGM2_cjs.n("[Ddu64 obfuscation] No obfuscation layer is wired. Use Ddu64Node/Ddu64Browser (batteries-included), or inject `obfuscationLayerFactory` when constructing Ddu64Core directly.");this.obfuscationLayer=this.obfuscationLayerFactory(gr(this.dduChar,this.paddingChar));}return this.obfuscationLayer}shouldObfuscate(r){return r?.obfuscate??this.defaultObfuscate}assertSafeChunkSeparator(r,t){if(!(t.length===0||this.isLineBreakSeparator(t))&&r.includes(t))throw new chunkZTGECGM2_cjs.c(`[Ddu64 chunking] Unsafe chunkSeparator "${t}" appears in encoded output. Use a separator that cannot be produced by the charset, footer, checksum, or URL-safe output.`)}isLineBreakSeparator(r){return r===`
|
|
8
|
+
`||r===`\r
|
|
9
|
+
`||r==="\r"}};function dt(e,r,t,n){try{return t?Te(e,r,n):!1}catch(o){throw chunkZTGECGM2_cjs.p(o)?o:new chunkZTGECGM2_cjs.j(chunkZTGECGM2_cjs.q(o),o)}}chunkBCUBYE76_cjs.a(dt,"validateFinalCharsetConfiguration");exports.a=Ae;exports.b=Se;exports.c=x;exports.d=Zr;exports.e=$t;exports.f=Ft;exports.g=gr;exports.h=k;exports.i=Rr;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunk4247T4B7_cjs=require('./chunk-4247T4B7.cjs'),chunkA3OZJS5G_cjs=require('./chunk-A3OZJS5G.cjs'),chunk76X5J2OF_cjs=require('./chunk-76X5J2OF.cjs'),chunkBCUBYE76_cjs=require('./chunk-BCUBYE76.cjs');var a=class extends chunkA3OZJS5G_cjs.i{static{chunkBCUBYE76_cjs.a(this,"Ddu64Secure");}constructor(e,o,r){let t=chunkA3OZJS5G_cjs.b(e,o,r),c={...t.dduOptions,...t.dduChar!==void 0?{dduChar:t.dduChar}:{},...t.paddingChar!==void 0?{paddingChar:t.paddingChar}:{},adapter:t.dduOptions?.adapter,adapterFactory:t.dduOptions?.adapterFactory??(()=>new chunk76X5J2OF_cjs.a),obfuscationLayerFactory:t.dduOptions?.obfuscationLayerFactory??(f=>new chunk4247T4B7_cjs.a(f))};super(c);}decodeToBuffer(e,o){let r=this.decodeToUint8Array(e,o);return Buffer.from(r.buffer,r.byteOffset,r.byteLength)}async decodeToBufferAsync(e,o){let r=await this.decodeToUint8ArrayAsync(e,o);return Buffer.from(r.buffer,r.byteOffset,r.byteLength)}};exports.a=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-EI7MMDWY.js';function o(){let e=globalThis;return e.Deno?.version?.deno?"deno":e.Bun?.version?"bun":e.process?.versions?.node?"node":typeof e.EdgeRuntime=="string"||typeof e.WebSocketPair<"u"&&e.crypto?.subtle?"edge":typeof e.crypto<"u"&&e.crypto?.subtle?"browser":"unknown"}a(o,"detectRuntime");export{o as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkBCUBYE76_cjs=require('./chunk-BCUBYE76.cjs');function o(){let e=globalThis;return e.Deno?.version?.deno?"deno":e.Bun?.version?"bun":e.process?.versions?.node?"node":typeof e.EdgeRuntime=="string"||typeof e.WebSocketPair<"u"&&e.crypto?.subtle?"edge":typeof e.crypto<"u"&&e.crypto?.subtle?"browser":"unknown"}chunkBCUBYE76_cjs.a(o,"detectRuntime");exports.a=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkA3OZJS5G_cjs=require('./chunk-A3OZJS5G.cjs'),chunkZTGECGM2_cjs=require('./chunk-ZTGECGM2.cjs'),chunkBCUBYE76_cjs=require('./chunk-BCUBYE76.cjs');var I=64*1024*1024,O=64*1024*1024;function _(r,e){chunkA3OZJS5G_cjs.h(e,"stream");let n=r.getCharSetInfo(),u=e?.compress??n.defaultCompress,l=n.hasEncryptionKey,S=e?.checksum??n.defaultChecksum,A=u?e?.compressionAlgorithm??n.defaultCompressionAlgorithm:void 0,t=n.paddingChar,p=chunkA3OZJS5G_cjs.c(e?.maxBufferedBytes,I,true,"maxBufferedBytes"),f=T(n,{compressed:u,encrypted:l,checksum:S}),m=false,d=[],i=0,a=null;return new TransformStream({async transform(s,o){if(f){if(!m){let k=chunkA3OZJS5G_cjs.e(t,{compressionAlgorithm:void 0,encrypted:false});o.enqueue(k),m=true;}let c;a&&a.length>0?(c=new Uint8Array(a.length+s.length),c.set(a,0),c.set(s,a.length)):c=s;let C=n.bitLength,g=q(C,8)/8,h=Math.floor(c.length/g)*g;if(h>0){let k=c.subarray(0,h),x=await r.encodeAsync(k,{compress:false,encrypt:false,checksum:false,chunkSize:0,chunkSeparator:void 0,omitFooter:true});o.enqueue(x);}h<c.length?a=c.slice(h):a=null;}else {if(i+s.length>p){o.error(new chunkZTGECGM2_cjs.l(`[WebStreams encode] Buffered input exceeds limit. Limit: ${p} bytes`,"stream"));return}d.push(s),i+=s.length;}},async flush(s){try{if(f){if(!m){let o=chunkA3OZJS5G_cjs.e(t,{compressionAlgorithm:void 0,encrypted:!1});s.enqueue(o);}if(a&&a.length>0){let o=await r.encodeAsync(a,{compress:!1,encrypt:!1,checksum:!1,chunkSize:0,chunkSeparator:void 0});s.enqueue(o);}a=null;}else {let o=chunkA3OZJS5G_cjs.e(t,{compressionAlgorithm:A,encrypted:l});s.enqueue(o);let c=new Uint8Array(i),C=0;for(let h of d)c.set(h,C),C+=h.length;let g=await r.encodeAsync(c,{...e,compress:u,encrypt:l,checksum:S,chunkSize:0,chunkSeparator:void 0});g.length>0&&s.enqueue(g),d=[],i=0;}}catch(o){s.error(chunkZTGECGM2_cjs.r(o,"stream"));}}})}chunkBCUBYE76_cjs.a(_,"createReadableEncodeStream");function z(r,e){chunkA3OZJS5G_cjs.h(e,"stream");let n=r.getCharSetInfo(),u=n.paddingChar,l=chunkA3OZJS5G_cjs.d(u),S=e?.checksum??n.defaultChecksum,A=chunkA3OZJS5G_cjs.c(e?.maxBufferedChars,O,true,"maxBufferedChars"),t="",p=false,f=null;return new TransformStream({async transform(m,d){try{if(t+=m,t.length>A)throw new chunkZTGECGM2_cjs.l(`[WebStreams decode] Buffered encoded input exceeds limit. Limit: ${A} characters`,"stream");if(!p&&t.length>=l){if(!t.startsWith(u))throw new Error("[WebStreams decode] Invalid or missing stream header");if(f=chunkA3OZJS5G_cjs.f(t,u),f===null)throw new Error("[WebStreams decode] Invalid or missing stream header");if(f.encrypted&&!n.hasEncryptionKey)throw new Error("[WebStreams decode] Encrypted stream requires an encryptionKey");p=!0,t=t.slice(l);}}catch(i){d.error(chunkZTGECGM2_cjs.r(i,"stream"));}},async flush(m){try{if(!p){if(t.length===0)return;throw new Error("[WebStreams decode] Incomplete stream header")}let d=f.compressionAlgorithm,i=await r.decodeToUint8ArrayAsync(t,{...e,compress:e?.compress,compressionAlgorithm:d,checksum:S,chunkSize:void 0,chunkSeparator:void 0});i.length>0&&m.enqueue(i),t="";}catch(d){m.error(chunkZTGECGM2_cjs.r(d,"stream"));}}})}chunkBCUBYE76_cjs.a(z,"createReadableDecodeStream");function T(r,e){return r.usePowerOfTwo&&!e.compressed&&!e.encrypted&&!e.checksum}chunkBCUBYE76_cjs.a(T,"canUseChunkStreaming");function q(r,e){return r*e/F(r,e)}chunkBCUBYE76_cjs.a(q,"lcm");function F(r,e){for(;e!==0;){let n=e;e=r%e,r=n;}return r}chunkBCUBYE76_cjs.a(F,"gcd");exports.a=_;exports.b=z;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-EI7MMDWY.js';var h=class s{static{a(this,"CharsetBuilder");}chars=[];constructor(){}static create(){return new s}static fromUnicodeRange(r,e){return new s().addUnicodeRange(r,e)}static fromString(r){return new s().addString(r)}static base64(){return new s().addString("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")}static base32(){return new s().addString("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567")}static uppercase(){return s.fromUnicodeRange(65,90)}static lowercase(){return s.fromUnicodeRange(97,122)}static digits(){return s.fromUnicodeRange(48,57)}static hangulJamo(){return new s().addUnicodeRange(4352,4370).addUnicodeRange(4449,4469).addUnicodeRange(4520,4546)}addUnicodeRange(r,e){if(!Number.isInteger(r)||!Number.isInteger(e)||r<0||e>1114111||r>e)throw new RangeError("Unicode range must use integer code points with 0 <= start <= end <= 0x10FFFF");for(let t=r;t<=e;t++)this.chars.push(String.fromCodePoint(t));return this}addString(r){return typeof r=="string"?this.chars.push(...r):this.chars.push(...r),this}add(...r){return this.chars.push(...r),this}excludeConfusing(){let r=new Set(["0","O","o","1","l","I","i","|","L"]);return this.chars=this.chars.filter(e=>!r.has(e)),this}exclude(...r){let e=new Set(r);return this.chars=this.chars.filter(t=>!e.has(t)),this}excludeUrlUnsafe(){let r=new Set(["+","/","=","?","&","#","%"," "]);return this.chars=this.chars.filter(e=>!r.has(e)),this}unique(){return this.chars=[...new Set(this.chars)],this}shuffle(r){let e=r!==void 0?this.seededRandom(r):Math.random;for(let t=this.chars.length-1;t>0;t--){let i=Math.floor(e()*(t+1));[this.chars[t],this.chars[i]]=[this.chars[i],this.chars[t]];}return this}seededRandom(r){let e=r|0||1;return ()=>(e^=e<<13,e^=e>>17,e^=e<<5,(e>>>0)/4294967296)}limit(r){if(!Number.isSafeInteger(r)||r<0)throw new RangeError("Charset limit must be a non-negative safe integer");return this.chars=this.chars.slice(0,r),this}limitToPowerOfTwo(){let r=this.chars.length;if(r===0)return this;let e=1<<Math.floor(Math.log2(r));return this.chars=this.chars.slice(0,e),this}sort(){return this.chars.sort(),this}reverse(){return this.chars.reverse(),this}get length(){return this.chars.length}buildString(){return this.chars.join("")}build(){return [...this.chars]}buildWithPadding(r){let e=[...this.chars],t=r;if(!t){let i=["=",".","_","-","~","!"];for(let n of i)if(!e.includes(n)){t=n;break}if(!t)throw new Error("Cannot find suitable padding character")}if(t.length!==1)throw new Error("Padding character must be one UTF-16 code unit");if(e.includes(t))throw new Error("Padding character must not appear in charset");return {charset:e,padding:t}}};export{h as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-5VZELPTG.js';import {i,b}from'./chunk-TCRCZHZC.js';import {a as a$2}from'./chunk-6ZYMNHFT.js';import {a}from'./chunk-EI7MMDWY.js';var s=class extends i{static{a(this,"Ddu64SecureBrowser");}constructor(a,u,p){let r=b(a,u,p),i={...r.dduOptions,...r.dduChar!==void 0?{dduChar:r.dduChar}:{},...r.paddingChar!==void 0?{paddingChar:r.paddingChar}:{},adapter:r.dduOptions?.adapter,adapterFactory:r.dduOptions?.adapterFactory??(()=>new a$2),obfuscationLayerFactory:r.dduOptions?.obfuscationLayerFactory??(c=>new a$1(c))};super(i);}};export{s as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {h,c,e,d,f}from'./chunk-TCRCZHZC.js';import {r,l}from'./chunk-IZK7KCU7.js';import {a}from'./chunk-EI7MMDWY.js';var I=64*1024*1024,O=64*1024*1024;function _(r$1,e$1){h(e$1,"stream");let n=r$1.getCharSetInfo(),u=e$1?.compress??n.defaultCompress,l$1=n.hasEncryptionKey,S=e$1?.checksum??n.defaultChecksum,A=u?e$1?.compressionAlgorithm??n.defaultCompressionAlgorithm:void 0,t=n.paddingChar,p=c(e$1?.maxBufferedBytes,I,true,"maxBufferedBytes"),f=T(n,{compressed:u,encrypted:l$1,checksum:S}),m=false,d=[],i=0,a=null;return new TransformStream({async transform(s,o){if(f){if(!m){let k=e(t,{compressionAlgorithm:void 0,encrypted:false});o.enqueue(k),m=true;}let c;a&&a.length>0?(c=new Uint8Array(a.length+s.length),c.set(a,0),c.set(s,a.length)):c=s;let C=n.bitLength,g=q(C,8)/8,h=Math.floor(c.length/g)*g;if(h>0){let k=c.subarray(0,h),x=await r$1.encodeAsync(k,{compress:false,encrypt:false,checksum:false,chunkSize:0,chunkSeparator:void 0,omitFooter:true});o.enqueue(x);}h<c.length?a=c.slice(h):a=null;}else {if(i+s.length>p){o.error(new l(`[WebStreams encode] Buffered input exceeds limit. Limit: ${p} bytes`,"stream"));return}d.push(s),i+=s.length;}},async flush(s){try{if(f){if(!m){let o=e(t,{compressionAlgorithm:void 0,encrypted:!1});s.enqueue(o);}if(a&&a.length>0){let o=await r$1.encodeAsync(a,{compress:!1,encrypt:!1,checksum:!1,chunkSize:0,chunkSeparator:void 0});s.enqueue(o);}a=null;}else {let o=e(t,{compressionAlgorithm:A,encrypted:l$1});s.enqueue(o);let c=new Uint8Array(i),C=0;for(let h of d)c.set(h,C),C+=h.length;let g=await r$1.encodeAsync(c,{...e$1,compress:u,encrypt:l$1,checksum:S,chunkSize:0,chunkSeparator:void 0});g.length>0&&s.enqueue(g),d=[],i=0;}}catch(o){s.error(r(o,"stream"));}}})}a(_,"createReadableEncodeStream");function z(r$1,e){h(e,"stream");let n=r$1.getCharSetInfo(),u=n.paddingChar,l$1=d(u),S=e?.checksum??n.defaultChecksum,A=c(e?.maxBufferedChars,O,true,"maxBufferedChars"),t="",p=false,f$1=null;return new TransformStream({async transform(m,d){try{if(t+=m,t.length>A)throw new l(`[WebStreams decode] Buffered encoded input exceeds limit. Limit: ${A} characters`,"stream");if(!p&&t.length>=l$1){if(!t.startsWith(u))throw new Error("[WebStreams decode] Invalid or missing stream header");if(f$1=f(t,u),f$1===null)throw new Error("[WebStreams decode] Invalid or missing stream header");if(f$1.encrypted&&!n.hasEncryptionKey)throw new Error("[WebStreams decode] Encrypted stream requires an encryptionKey");p=!0,t=t.slice(l$1);}}catch(i){d.error(r(i,"stream"));}},async flush(m){try{if(!p){if(t.length===0)return;throw new Error("[WebStreams decode] Incomplete stream header")}let d=f$1.compressionAlgorithm,i=await r$1.decodeToUint8ArrayAsync(t,{...e,compress:e?.compress,compressionAlgorithm:d,checksum:S,chunkSize:void 0,chunkSeparator:void 0});i.length>0&&m.enqueue(i),t="";}catch(d){m.error(r(d,"stream"));}}})}a(z,"createReadableDecodeStream");function T(r,e){return r.usePowerOfTwo&&!e.compressed&&!e.encrypted&&!e.checksum}a(T,"canUseChunkStreaming");function q(r,e){return r*e/F(r,e)}a(q,"lcm");function F(r,e){for(;e!==0;){let n=e;e=r%e,r=n;}return r}a(F,"gcd");export{_ as a,z as b};
|