@stakekit/widget 0.0.273 → 0.0.274
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/index.bundle.js +7 -7
- package/dist/package/index.package.js +1951 -1746
- package/dist/types/domain/types/yields.d.ts +2 -1
- package/dist/types/hooks/api/use-dashboard-yield-catalog.d.ts +20 -0
- package/dist/types/hooks/api/use-token-list-yields.d.ts +11 -1
- package/dist/types/hooks/api/use-yield-summaries.d.ts +50 -0
- package/dist/types/pages/details/earn-page/components/select-token-section/select-token-list-item.d.ts +3 -1
- package/dist/types/pages/details/earn-page/state/types.d.ts +9 -1
- package/dist/website/assets/{basic-Bo7SBwII.js → basic-BVJnMIHl.js} +1 -1
- package/dist/website/assets/{basic-ThspdnuL.js → basic-CibIan8y.js} +1 -1
- package/dist/website/assets/{browser-DskDvf4V.js → browser--EMMYaan.js} +1 -1
- package/dist/website/assets/{build-DN0pJtdR.js → build-BPw0SHWb.js} +1 -1
- package/dist/website/assets/{build-BmJ27Vry.js → build-DFEPAT8y.js} +1 -1
- package/dist/website/assets/{cardano-connector-B2Ea9uXJ.js → cardano-connector-CbHZBb34.js} +1 -1
- package/dist/website/assets/{core-BFFu4TZK.js → core-BSLy_t4A.js} +2 -2
- package/dist/website/assets/{dist-BC-yZnz1.js → dist-BRCQU1Li.js} +1 -1
- package/dist/website/assets/{dist-DwMZ-Epn.js → dist-DAbkzFAO.js} +1 -1
- package/dist/website/assets/en_US-IFPOGBSL-BzV0u3lE.js +1 -0
- package/dist/website/assets/{esm-Bvq2M2B2.js → esm-FztE-O2S.js} +1 -1
- package/dist/website/assets/{exports-BEqJeoxC.js → exports-DiWzDOxG.js} +1 -1
- package/dist/website/assets/index-BIOEiLJw.js +2044 -0
- package/dist/website/assets/{index.es-qQnPYJtJ.js → index.es-D3Xa7Qme.js} +2 -2
- package/dist/website/assets/{ledger-connector-C520fQQY.js → ledger-connector-6wqonZoy.js} +1 -1
- package/dist/website/assets/{receive-Dcx0aHWA.js → receive-BN_rE1dd.js} +1 -1
- package/dist/website/assets/{registry-CvkKYDcW.js → registry-DLj0P6dj.js} +1 -1
- package/dist/website/assets/{safe-connector-CDGYW3b8.js → safe-connector-NQlNJxmf.js} +1 -1
- package/dist/website/assets/{socials-BDwTFvCa.js → socials-C3M2JNCz.js} +1 -1
- package/dist/website/assets/{solana-connector-BcHaSaSq.js → solana-connector-hzwYOzto.js} +1 -1
- package/dist/website/assets/{substrate-connector-DxYe9s4o.js → substrate-connector-CCxDFYG6.js} +1 -1
- package/dist/website/assets/{ton-connector-sD5IEuy2.js → ton-connector-DlVKNF8w.js} +1 -1
- package/dist/website/assets/{tron-connector-DgBR_biA.js → tron-connector-C6xS9wMC.js} +3 -3
- package/dist/website/assets/tx-CXZ9mGxZ.js +1 -0
- package/dist/website/assets/{wallet-manager-4JkYZ_Wn.js → wallet-manager-BxPcB4lR.js} +3 -3
- package/dist/website/assets/{wui-qr-code-CadVdoQK.js → wui-qr-code-CNh2d2fT.js} +1 -1
- package/dist/website/index.html +1 -1
- package/package.json +1 -1
- package/dist/website/assets/en_US-IFPOGBSL-DY8aJwVh.js +0 -1
- package/dist/website/assets/index-DTVV95ia.js +0 -2044
- package/dist/website/assets/tx-Cjn1Xzt5.js +0 -1
|
@@ -45,8 +45,9 @@ export type ValidatorsConfig = Map<SupportedSKChains | "*", {
|
|
|
45
45
|
}>;
|
|
46
46
|
export type DashboardYieldCategory = "stake" | "defi" | "rwa";
|
|
47
47
|
export declare const dashboardYieldCategories: readonly ["stake", "defi", "rwa"];
|
|
48
|
+
export declare const getApiYieldTypesForDashboardCategory: (category: DashboardYieldCategory) => ApiYieldType[];
|
|
49
|
+
export declare const getDashboardYieldCategoryForApiYieldType: (yieldType: ApiYieldType) => DashboardYieldCategory;
|
|
48
50
|
export declare const getDashboardYieldCategory: (yieldDto: Yield) => DashboardYieldCategory | null;
|
|
49
|
-
export declare const getAvailableDashboardYieldCategories: (yields: Iterable<Yield>) => DashboardYieldCategory[];
|
|
50
51
|
export declare const filterValidators: ({ validatorsConfig, validators, network, yieldId, }: {
|
|
51
52
|
validatorsConfig: ValidatorsConfig;
|
|
52
53
|
validators: ValidatorDto[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TokenDto } from "../../domain/types/tokens";
|
|
2
|
+
import { type DashboardYieldCategory } from "../../domain/types/yields";
|
|
3
|
+
type DashboardCategoryInitialSelection = {
|
|
4
|
+
token: TokenDto;
|
|
5
|
+
yieldId: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Discovers available dashboard earn categories with one network-scoped,
|
|
9
|
+
* reward-rate-sorted probe per category (no dependency on the wallet's token
|
|
10
|
+
* holdings, no per-yield legacy hydration). The first visible summary of each
|
|
11
|
+
* probe seeds that category's initial token + yield selection.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useDashboardYieldCatalog: ({ enabled, }?: {
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
}) => {
|
|
16
|
+
availableCategories: DashboardYieldCategory[];
|
|
17
|
+
initialSelectionByCategory: Map<DashboardYieldCategory, DashboardCategoryInitialSelection>;
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import type { TokenBalanceScanResponseDto } from "../../domain/types/token-balance";
|
|
2
|
+
import { type DashboardYieldCategory } from "../../domain/types/yields";
|
|
2
3
|
import type { YieldDto } from "../../generated/api/yield";
|
|
4
|
+
import { useApiClient } from "../../providers/api/api-client-provider";
|
|
3
5
|
export type TokenMaxYieldRate = {
|
|
4
6
|
rateFormatted: string;
|
|
5
7
|
rateTypeLabel: string;
|
|
6
8
|
};
|
|
9
|
+
export declare const fetchTokenListYieldSummaries: ({ apiClient, signal, tokenBalances, }: {
|
|
10
|
+
apiClient: ReturnType<typeof useApiClient>;
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
tokenBalances: ReadonlyArray<TokenBalanceScanResponseDto>;
|
|
13
|
+
}) => Promise<YieldDto[]>;
|
|
14
|
+
export declare const getDashboardCategoryYieldIdsForToken: (availableYieldIds: ReadonlyArray<string>, yieldsById: ReadonlyMap<string, YieldDto>, category: DashboardYieldCategory) => string[];
|
|
7
15
|
export declare const getMaxYieldRateForToken: (availableYieldIds: ReadonlyArray<string>, yieldsById: ReadonlyMap<string, YieldDto>) => TokenMaxYieldRate | null;
|
|
8
|
-
export declare const useTokenListYields: (tokenBalances: ReadonlyArray<TokenBalanceScanResponseDto
|
|
16
|
+
export declare const useTokenListYields: (tokenBalances: ReadonlyArray<TokenBalanceScanResponseDto>, dashboardYieldCategory?: DashboardYieldCategory | null) => {
|
|
17
|
+
yieldIdsByToken: Map<string, string[]>;
|
|
18
|
+
yieldCountsByToken: Map<string, number>;
|
|
9
19
|
maxYieldRatesByToken: Map<string, TokenMaxYieldRate>;
|
|
10
20
|
isLoading: boolean;
|
|
11
21
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { YieldDto, YieldsControllerGetYieldsParams } from "../../generated/api/yield";
|
|
2
|
+
import type { useApiClient } from "../../providers/api/api-client-provider";
|
|
3
|
+
/**
|
|
4
|
+
* A yield "summary" is the new yields API DTO, returned by
|
|
5
|
+
* `YieldsControllerGetYields`. It contains everything category discovery and
|
|
6
|
+
* list rendering need (`token`, `rewardRate`, `status`, `metadata`,
|
|
7
|
+
* `mechanics.type`, `providerId`) and intentionally does NOT include the legacy
|
|
8
|
+
* `__fallback__` hydration, which is only required for a selected yield.
|
|
9
|
+
*/
|
|
10
|
+
export type YieldSummary = YieldDto;
|
|
11
|
+
export declare const DEFAULT_YIELD_SUMMARIES_PAGE_LIMIT = 50;
|
|
12
|
+
export type YieldSummariesParams = Pick<YieldsControllerGetYieldsParams, "network" | "types" | "inputToken" | "sort" | "limit">;
|
|
13
|
+
/**
|
|
14
|
+
* A summary is "visible" when it is enterable, on a supported chain, and has a
|
|
15
|
+
* non-zero reward rate (matching the dashboard catalog's display semantics).
|
|
16
|
+
*/
|
|
17
|
+
export declare const isVisibleYieldSummary: (summary: YieldSummary) => boolean;
|
|
18
|
+
export declare const getYieldSummariesQueryKey: (params: YieldSummariesParams & {
|
|
19
|
+
allPages?: boolean;
|
|
20
|
+
}) => (string | (YieldSummariesParams & {
|
|
21
|
+
allPages?: boolean;
|
|
22
|
+
}))[];
|
|
23
|
+
type FetchArgs = {
|
|
24
|
+
apiClient: ReturnType<typeof useApiClient>;
|
|
25
|
+
params: YieldSummariesParams;
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
};
|
|
28
|
+
type FetchByIdsArgs = {
|
|
29
|
+
apiClient: ReturnType<typeof useApiClient>;
|
|
30
|
+
chunkSize?: number;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
suppressRichErrors?: boolean;
|
|
33
|
+
yieldIds: ReadonlyArray<string>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Fetch a single page of yield summaries.
|
|
37
|
+
*/
|
|
38
|
+
export declare const fetchYieldSummariesPage: ({ apiClient, params, signal, }: FetchArgs) => Promise<YieldSummary[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Fetch yield summaries by ID without ever sending an unbounded `yieldIds`
|
|
41
|
+
* query array. Results are ordered according to the first occurrence of each
|
|
42
|
+
* requested ID.
|
|
43
|
+
*/
|
|
44
|
+
export declare const fetchYieldSummariesByIds: ({ apiClient, chunkSize, signal, suppressRichErrors, yieldIds, }: FetchByIdsArgs) => Promise<YieldSummary[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Fetch every page of yield summaries for the given params, looping `offset`
|
|
47
|
+
* until all `total` items have been retrieved.
|
|
48
|
+
*/
|
|
49
|
+
export declare const fetchAllYieldSummaries: ({ apiClient, params, signal, }: FetchArgs) => Promise<YieldSummary[]>;
|
|
50
|
+
export {};
|
|
@@ -4,8 +4,10 @@ type Props = {
|
|
|
4
4
|
item: TokenBalanceScanResponseDto;
|
|
5
5
|
isConnected: boolean;
|
|
6
6
|
isSelected: boolean;
|
|
7
|
+
availableYieldsCount?: number;
|
|
8
|
+
canSelectToken?: boolean;
|
|
7
9
|
maxYieldRate?: TokenMaxYieldRate;
|
|
8
10
|
onTokenBalanceSelect: (tokenBalance: TokenBalanceScanResponseDto) => void;
|
|
9
11
|
};
|
|
10
|
-
export declare const SelectTokenListItem: import("react").MemoExoticComponent<({ item, isConnected, isSelected, maxYieldRate, onTokenBalanceSelect, }: Props) => import("react/jsx-runtime").JSX.Element>;
|
|
12
|
+
export declare const SelectTokenListItem: import("react").MemoExoticComponent<({ item, isConnected, isSelected, availableYieldsCount, canSelectToken, maxYieldRate, onTokenBalanceSelect, }: Props) => import("react/jsx-runtime").JSX.Element>;
|
|
11
13
|
export {};
|
|
@@ -6,6 +6,7 @@ import type { TokenDto } from "../../../../domain/types/tokens";
|
|
|
6
6
|
import type { TronResourceType } from "../../../../domain/types/tron";
|
|
7
7
|
import type { DashboardYieldCategory, Yield } from "../../../../domain/types/yields";
|
|
8
8
|
import type { ValidatorDto } from "../../../../generated/api/yield";
|
|
9
|
+
import type { TokenMaxYieldRate } from "../../../../hooks/api/use-token-list-yields";
|
|
9
10
|
import type { useEstimatedRewards } from "../../../../hooks/use-estimated-rewards";
|
|
10
11
|
import type { useProvidersDetails } from "../../../../hooks/use-provider-details";
|
|
11
12
|
import type { useRewardTokenDetails } from "../../../../hooks/use-reward-token-details";
|
|
@@ -21,6 +22,10 @@ export type State = {
|
|
|
21
22
|
selectedProviderYieldId: Maybe<Yield["id"]>;
|
|
22
23
|
};
|
|
23
24
|
type TokenBalanceSelectAction = Action<"token/select", TokenDto>;
|
|
25
|
+
type DashboardTokenYieldSelectAction = Action<"dashboard/token-yield/select", {
|
|
26
|
+
token: TokenDto;
|
|
27
|
+
yieldDto: Yield;
|
|
28
|
+
}>;
|
|
24
29
|
type YieldSelectAction = Action<"yield/select", Yield>;
|
|
25
30
|
type StakeAmountChangeAction = Action<"stakeAmount/change", BigNumber>;
|
|
26
31
|
type StakeAmountMaxAction = Action<"stakeAmount/max", BigNumber>;
|
|
@@ -30,7 +35,7 @@ type ValidatorMultiSelectAction = Action<"validator/multiselect", ValidatorDto>;
|
|
|
30
35
|
type ValidatorRemoveAction = Action<"validator/remove", ValidatorDto>;
|
|
31
36
|
type SelectTronResourceAction = Action<"tronResource/select", TronResourceType>;
|
|
32
37
|
type ProviderYieldIdSelectAction = Action<"providerYieldId/select", Yield["id"]>;
|
|
33
|
-
export type Actions = TokenBalanceSelectAction | YieldSelectAction | StakeAmountChangeAction | StakeAmountMaxAction | StateResetAction | ValidatorSelectAction | ValidatorMultiSelectAction | ValidatorRemoveAction | SelectTronResourceAction | ProviderYieldIdSelectAction;
|
|
38
|
+
export type Actions = TokenBalanceSelectAction | DashboardTokenYieldSelectAction | YieldSelectAction | StakeAmountChangeAction | StakeAmountMaxAction | StateResetAction | ValidatorSelectAction | ValidatorMultiSelectAction | ValidatorRemoveAction | SelectTronResourceAction | ProviderYieldIdSelectAction;
|
|
34
39
|
export type ExtraData = {
|
|
35
40
|
actions: {
|
|
36
41
|
onMaxClick: () => void;
|
|
@@ -92,6 +97,9 @@ export type EarnPageContextType = {
|
|
|
92
97
|
all: TokenBalanceScanResponseDto[];
|
|
93
98
|
filtered: TokenBalanceScanResponseDto[];
|
|
94
99
|
}>;
|
|
100
|
+
tokenMaxYieldRatesByToken: ReadonlyMap<string, TokenMaxYieldRate>;
|
|
101
|
+
tokenYieldCountsByToken: ReadonlyMap<string, number>;
|
|
102
|
+
tokenListYieldsIsLoading: boolean;
|
|
95
103
|
onTokenSearch: (value: string) => void;
|
|
96
104
|
onValidatorSearch: (value: string) => void;
|
|
97
105
|
validatorSearch: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as e}from"./chunk-CzyJ72yW.js";import{A as t,C as n,D as r,E as i,O as a,S as o,T as s,_ as c,b as l,h as u,i as d,j as f,k as ee,n as p,o as m,p as te,r as ne,t as h,u as re,x as g,y as _}from"./exports-CHrRDjNC.js";import{i as v,l as y,o as ie,t as b}from"./lit-element-CPGuB_v8.js";import"./lit-CDbVcvTE.js";import{d as ae,f as oe}from"./index-
|
|
1
|
+
import{s as e}from"./chunk-CzyJ72yW.js";import{A as t,C as n,D as r,E as i,O as a,S as o,T as s,_ as c,b as l,h as u,i as d,j as f,k as ee,n as p,o as m,p as te,r as ne,t as h,u as re,x as g,y as _}from"./exports-CHrRDjNC.js";import{i as v,l as y,o as ie,t as b}from"./lit-element-CPGuB_v8.js";import"./lit-CDbVcvTE.js";import{d as ae,f as oe}from"./index-BIOEiLJw.js";import{a as x,o as S,s as C,t as se}from"./class-map-BhcOy3ep.js";import{n as ce,t as le}from"./ref-CQce-LA_.js";import{t as ue}from"./browser--EMMYaan.js";import"./wui-text-C_lTk8eD.js";var de=y`
|
|
2
2
|
:host {
|
|
3
3
|
position: relative;
|
|
4
4
|
background-color: var(--wui-color-gray-glass-002);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as e}from"./chunk-CzyJ72yW.js";import{i as t,l as n,o as r,t as i}from"./lit-element-CPGuB_v8.js";import"./lit-CVrrzrGA.js";import{a,o,s,t as c}from"./class-map-BhcOy3ep.js";import"./class-map-fHNEycfA.js";import{n as l,t as u}from"./ref-CQce-LA_.js";import"./ref-Cjfeo2-0.js";import{t as ee}from"./browser
|
|
1
|
+
import{s as e}from"./chunk-CzyJ72yW.js";import{i as t,l as n,o as r,t as i}from"./lit-element-CPGuB_v8.js";import"./lit-CVrrzrGA.js";import{a,o,s,t as c}from"./class-map-BhcOy3ep.js";import"./class-map-fHNEycfA.js";import{n as l,t as u}from"./ref-CQce-LA_.js";import"./ref-Cjfeo2-0.js";import{t as ee}from"./browser--EMMYaan.js";import{A as d,C as f,E as te,F as ne,O as p,S as m,T as h,_ as re,a as g,b as ie,g as _,i as ae,j as oe,k as v,n as y,p as se,r as b,s as x,u as ce,x as S,y as C}from"./ConstantsUtil-BucnOgVd.js";import"./wui-text-D1LKVPJb.js";import{n as le,t as ue}from"./ConnectorUtil-Dbdhp6gz.js";var de=n`
|
|
2
2
|
:host {
|
|
3
3
|
position: relative;
|
|
4
4
|
background-color: var(--wui-color-gray-glass-002);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./chunk-CzyJ72yW.js";import{i as t}from"./index-
|
|
1
|
+
import{t as e}from"./chunk-CzyJ72yW.js";import{i as t}from"./index-BIOEiLJw.js";var n=e(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),r=e((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),i=e((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),a=e(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),o=e(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),s=e((e=>{var t=r().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),c=e((e=>{var t=r().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),l=e((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),u=e((e=>{var t=i(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),d=e((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),f=e((e=>{var t=d();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),p=e(((e,t)=>{var n=f();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),m=e((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),h=e((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
2
2
|
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),g=e((e=>{var t=m(),n=h();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),_=e((e=>{var t=r(),n=u(),a=i(),o=g(),s=m(),c=7973,l=t.getBCHDigit(c);function d(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function f(e,t){return o.getCharCountIndicator(e,t)+4}function p(e,t){let n=0;return e.forEach(function(e){let r=f(e.mode,t);n+=r+e.getBitsLength()}),n}function h(t,n){for(let r=1;r<=40;r++)if(p(t,r)<=e.getCapacity(r,n,o.MIXED))return r}e.from=function(e,t){return s.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,i){if(!s.isValid(e))throw Error(`Invalid QR Code version`);i===void 0&&(i=o.BYTE);let a=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(i===o.MIXED)return a;let c=a-f(i,e);switch(i){case o.NUMERIC:return Math.floor(c/10*3);case o.ALPHANUMERIC:return Math.floor(c/11*2);case o.KANJI:return Math.floor(c/13);case o.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,r=a.from(t,a.M);if(Array.isArray(e)){if(e.length>1)return h(e,r);if(e.length===0)return 1;n=e[0]}else n=e;return d(n.mode,n.getLength(),r)},e.getEncodedBits=function(e){if(!s.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-l>=0;)n^=c<<t.getBCHDigit(n)-l;return e<<12|n}})),v=e((e=>{var t=r(),n=1335,i=21522,a=t.getBCHDigit(n);e.getEncodedBits=function(e,r){let o=e.bit<<3|r,s=o<<10;for(;t.getBCHDigit(s)-a>=0;)s^=n<<t.getBCHDigit(s)-a;return(o<<10|s)^i}})),y=e(((e,t)=>{var n=g();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),b=e(((e,t)=>{var n=g(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),x=e(((e,t)=>{t.exports=function(e){for(var t=[],n=e.length,r=0;r<n;r++){var i=e.charCodeAt(r);if(i>=55296&&i<=56319&&n>r+1){var a=e.charCodeAt(r+1);a>=56320&&a<=57343&&(i=(i-55296)*1024+a-56320+65536,r+=1)}if(i<128){t.push(i);continue}if(i<2048){t.push(i>>6|192),t.push(i&63|128);continue}if(i<55296||i>=57344&&i<65536){t.push(i>>12|224),t.push(i>>6&63|128),t.push(i&63|128);continue}if(i>=65536&&i<=1114111){t.push(i>>18|240),t.push(i>>12&63|128),t.push(i>>6&63|128),t.push(i&63|128);continue}t.push(239,191,189)}return new Uint8Array(t).buffer}})),S=e(((e,t)=>{var n=x(),r=g();function i(e){this.mode=r.BYTE,typeof e==`string`&&(e=n(e)),this.data=new Uint8Array(e)}i.getBitsLength=function(e){return e*8},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=i})),C=e(((e,t)=>{var n=g(),i=r();function a(e){this.mode=n.KANJI,this.data=e}a.getBitsLength=function(e){return e*13},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=i.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
3
3
|
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=a})),w=e((e=>{var n=g(),i=y(),a=b(),o=S(),s=C(),c=h(),l=r(),u=t();function d(e){return unescape(encodeURIComponent(e)).length}function f(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function p(e){let t=f(c.NUMERIC,n.NUMERIC,e),r=f(c.ALPHANUMERIC,n.ALPHANUMERIC,e),i,a;return l.isKanjiModeEnabled()?(i=f(c.BYTE,n.BYTE,e),a=f(c.KANJI,n.KANJI,e)):(i=f(c.BYTE_KANJI,n.BYTE,e),a=[]),t.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function m(e,t){switch(t){case n.NUMERIC:return i.getBitsLength(e);case n.ALPHANUMERIC:return a.getBitsLength(e);case n.KANJI:return s.getBitsLength(e);case n.BYTE:return o.getBitsLength(e)}}function _(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function v(e){let t=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case n.NUMERIC:t.push([i,{data:i.data,mode:n.ALPHANUMERIC,length:i.length},{data:i.data,mode:n.BYTE,length:i.length}]);break;case n.ALPHANUMERIC:t.push([i,{data:i.data,mode:n.BYTE,length:i.length}]);break;case n.KANJI:t.push([i,{data:i.data,mode:n.BYTE,length:d(i.data)}]);break;case n.BYTE:t.push([{data:i.data,mode:n.BYTE,length:d(i.data)}])}}return t}function x(e,t){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=m(r[o].lastCount+l.length,l.mode)-m(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=m(l.length,l.mode)+4+n.getCharCountIndicator(l.mode,t))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function w(e,t){let r,c=n.getBestModeForData(e);if(r=n.from(t,c),r!==n.BYTE&&r.bit<c.bit)throw Error(`"`+e+`" cannot be encoded with mode `+n.toString(r)+`.
|
|
4
4
|
Suggested mode is: `+n.toString(c));switch(r===n.KANJI&&!l.isKanjiModeEnabled()&&(r=n.BYTE),r){case n.NUMERIC:return new i(e);case n.ALPHANUMERIC:return new a(e);case n.KANJI:return new s(e);case n.BYTE:return new o(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(w(t,null)):t.data&&e.push(w(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=x(v(p(t,l.isKanjiModeEnabled())),n),i=u.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(_(a))},e.rawSplit=function(t){return e.fromArray(p(t,l.isKanjiModeEnabled()))}})),T=e((e=>{var t=r(),n=i(),d=a(),f=o(),m=s(),h=c(),y=l(),b=u(),x=p(),S=_(),C=v(),T=g(),E=w();function D(e,t){let n=e.size,r=h.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function O(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function k(e,t){let n=m.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function A(e,t){let n=e.size,r=S.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function j(e,t,n){let r=e.size,i=C.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function M(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function N(e,n,r){let i=new d;r.forEach(function(t){i.put(t.mode.bit,4),i.put(t.getLength(),T.getCharCountIndicator(t.mode,e)),t.write(i)});let a=(t.getSymbolTotalCodewords(e)-b.getTotalCodewordsCount(e,n))*8;for(i.getLengthInBits()+4<=a&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);let o=(a-i.getLengthInBits())/8;for(let e=0;e<o;e++)i.put(e%2?17:236,8);return P(i,e,n)}function P(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-b.getTotalCodewordsCount(n,r),o=b.getBlocksCount(n,r),s=o-i%o,c=Math.floor(i/o),l=Math.floor(a/o),u=l+1,d=c-l,f=new x(d),p=0,m=Array(o),h=Array(o),g=0,_=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?l:u;m[e]=_.slice(p,p+t),h[e]=f.encode(m[e]),p+=t,g=Math.max(g,t)}let v=new Uint8Array(i),y=0,S,C;for(S=0;S<g;S++)for(C=0;C<o;C++)S<m[C].length&&(v[y++]=m[C][S]);for(S=0;S<d;S++)for(C=0;C<o;C++)v[y++]=h[C][S];return v}function F(e,n,r,i){let a;if(Array.isArray(e))a=E.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=E.rawSplit(e);t=S.getBestVersionForData(n,r)}a=E.fromString(e,t||40)}else throw Error(`Invalid data`);let o=S.getBestVersionForData(a,r);if(!o)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=o;else if(n<o)throw Error(`
|