oneie 5.10.3 → 5.10.5
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/README.md +3 -1
- package/dist/package.json +2 -2
- package/dist/src/age-ykxfse4q.js +1 -0
- package/dist/src/client-jmg0wrcs.js +1 -0
- package/dist/src/evm-tx-696p259p.js +1 -0
- package/dist/src/hl-run-504g94yf.js +1 -0
- package/dist/src/{index-y4xe5pm7.js → index-495kg2sw.js} +3 -3
- package/dist/src/index-qnc5g670.js +12 -0
- package/dist/src/index-w7vk3rba.js +2170 -0
- package/dist/src/index.js +601 -600
- package/dist/src/message-key-fm6jghr3.js +1 -0
- package/dist/src/message-lock-6femzj9k.js +5 -0
- package/dist/src/sweep-order-0v9a9tww.js +1 -0
- package/dist/src/{sweep-runner-mk3ek1mk.js → sweep-runner-reazw8ge.js} +1 -1
- package/dist/src/wallet-yfdfpx1k.js +1 -0
- package/package.json +2 -2
- package/dist/src/age-74tmaw4t.js +0 -1
- package/dist/src/client-3daam667.js +0 -1
- package/dist/src/evm-tx-33z1n2zx.js +0 -1
- package/dist/src/hl-run-bx11y304.js +0 -1
- package/dist/src/index-exa86q8e.js +0 -2170
- package/dist/src/index-stdwesmk.js +0 -12
- package/dist/src/message-key-sy2jmj5v.js +0 -1
- package/dist/src/message-lock-9p4jbjtc.js +0 -5
- package/dist/src/sweep-order-yf30eb7c.js +0 -1
- package/dist/src/wallet-e3473qat.js +0 -1
package/README.md
CHANGED
|
@@ -407,6 +407,7 @@ one prove spec.json [--out D] [--check] # time your MCP against the
|
|
|
407
407
|
one finance [--days 7|30|90] # ONE's own books: the eight-number health line (platform owners only)
|
|
408
408
|
one finance pnl [--months N] # the P&L by month; open rulings shown, never added
|
|
409
409
|
one ramp status # add money / cash out: open or not, every reason, what comes next (anyone)
|
|
410
|
+
one settings send-hold <slug> on|off|status # a workspace's draft hold: where on, customer emails after the first reply wait for approval (owner above, or staff)
|
|
410
411
|
one front-desk set <slug> --file playbook.json # a client's AI front desk playbook: answers, qualifying questions, booking rules, hand-off (owner)
|
|
411
412
|
one front-desk get <slug> # read the playbook back as written (owner)
|
|
412
413
|
one alerts show <slug> # who a visitor's "I want a person" reaches: your team, then the agency above (owner)
|
|
@@ -421,7 +422,8 @@ one workflow pull <id> --slug S [--out D] # round-trip a workflow's s
|
|
|
421
422
|
one workflow push <id> <file> --slug S [--commit] # apply a diff — simulates first, --commit persists
|
|
422
423
|
one workflow run <id> --slug S # start a run
|
|
423
424
|
one plugin list | add <name> | buy <name> | grant <name> --to <slug> # browse, install, buy, or resell a plugin
|
|
424
|
-
one staff invite [email] | add-agent <name> # invite a human or create an agent staff member
|
|
425
|
+
one staff invite [email] | add-agent <name> # invite a human or create an agent staff member (--claim: a short account link; --signin: mail a sign-in link, works for an existing account)
|
|
426
|
+
one pay link [amount] [--email E] [--net testnet] # one short link that opens an account for someone and carries USDC into it; prints the command that funds it
|
|
425
427
|
one links create <actorId> --to <path> # mint a personalised, actor-bound tracked link
|
|
426
428
|
one video access <room> <open|members> --workspace S # switch an existing meeting room in place (members = signed-in members only)
|
|
427
429
|
one broadcast list | send <id> # blasts to a workspace audience
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oneie",
|
|
3
|
-
"version": "5.10.
|
|
3
|
+
"version": "5.10.5",
|
|
4
4
|
"description": "Give your agent financial superpowers. One command makes a key on your machine, five wallets, a shop and a test sale — your agent can sell and be paid in USDC, and asks you before real money moves.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@noble/curves": "^2.2.0",
|
|
49
49
|
"@noble/hashes": "^2.2.0",
|
|
50
50
|
"@oneie/evals": "^0.2.0",
|
|
51
|
-
"@oneie/sdk": "^0.17.
|
|
51
|
+
"@oneie/sdk": "^0.17.12",
|
|
52
52
|
"@types/node": "^25.6.0",
|
|
53
53
|
"commander": "^12.0.0",
|
|
54
54
|
"tsx": "^4.0.0",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Mn,ot,En,hr,c,$n,gr,Fn,Sr,Ar,br,yr,wr,kr,vr,xr,Er,$r,_r,Tr}from"./index-qnc5g670.js";export{ot as AGE_ARMOR_BEGIN,En as AGE_ARMOR_END,Mn as AGE_VERSION_LINE,c as AgeError,hr as MAX_STANZAS,kr as armor,vr as dearmor,Sr as decodeIdentity,gr as decodeRecipient,wr as decrypt,Fn as encodeIdentity,$n as encodeRecipient,br as encrypt,xr as extractArmored,Er as looksLikeAge,_r as openBytes,Tr as openText,yr as parseHeader,Ar as recipientOf,$r as sealText};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,a,s,n,e}from"./index-w7vk3rba.js";export{s as authHeaders,n as jsonMode,e as out,r as resolveBase,a as resolveKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E,ue}from"./index-w7vk3rba.js";var i=(e)=>Array.from(e,(t)=>t.toString(16).padStart(2,"0")).join("");function a(e){let t=e.replace(/^0x/,"");if(t.length%2||/[^0-9a-fA-F]/.test(t))throw Error("bad hex");let r=new Uint8Array(t.length/2);for(let n=0;n<r.length;n++)r[n]=parseInt(t.slice(n*2,n*2+2),16);return r}function d(e){let t=e.toLowerCase().replace(/^0x/,""),r=i(ue(new TextEncoder().encode(t))),n="0x";for(let o=0;o<t.length;o++)n+=parseInt(r[o],16)>=8?t[o].toUpperCase():t[o];return n}function A(e){let t=e.trim();if(/^0x[0-9a-fA-F]{64}$/.test(t))return"That looks like a Sui address, not an Ethereum one.";if(!/^0x[0-9a-fA-F]{40}$/.test(t))return"Enter an Ethereum address: 0x followed by 40 hex characters.";if(/^0x0{40}$/.test(t))return"That is the zero address — anything sent there is burned.";let r=t.slice(2);if(r!==r.toLowerCase()&&r!==r.toUpperCase()&&d(t)!==t)return"Address checksum does not match — check for a typo.";return null}function g(e){let t=[];while(e>0)t.unshift(e&255),e=Math.floor(e/256);return Uint8Array.from(t)}function c(e){let t=new Uint8Array(e.reduce((n,o)=>n+o.length,0)),r=0;for(let n of e)t.set(n,r),r+=n.length;return t}function f(e,t){if(e<56)return Uint8Array.of(t+e);let r=g(e);return c([Uint8Array.of(t+55+r.length),r])}function u(e){if(e instanceof Uint8Array){if(e.length===1&&e[0]<128)return e;return c([f(e.length,128),e])}let t=c(e.map(u));return c([f(t.length,192),t])}function s(e){let t=BigInt(e);if(t<0n)throw Error("negative integer in transaction");let r=[];while(t>0n)r.unshift(Number(t&0xffn)),t>>=8n;return Uint8Array.from(r)}function l(e){return[s(e.chainId),s(e.nonce),s(e.maxPriorityFeePerGas),s(e.maxFeePerGas),s(e.gasLimit),a(e.to),s(e.value),a(e.data),[]]}function w(e,t){let r=ue(c([Uint8Array.of(2),u(l(e))])),n=E.sign(r,t,{prehash:!1,format:"recovered"}),o=n[0],h=n.slice(1,33),p=n.slice(33,65),x=u([...l(e),s(o),s(BigInt(`0x${i(h)}`)),s(BigInt(`0x${i(p)}`))]);return`0x02${i(x)}`}function b(e){return`0x${i(ue(a(e)))}`}function U(e){let t=E.getPublicKey(e,!1);return d(`0x${i(ue(t.slice(1)).slice(12))}`)}function k(e,t){return`0xa9059cbb${e.toLowerCase().replace(/^0x/,"").padStart(64,"0")}${t.toString(16).padStart(64,"0")}`}export{d as checksumAddress,k as encodeErc20Transfer,U as evmAddressFromKey,A as evmRecipientProblem,b as evmTxHash,a as hexToBytes,u as rlpEncode,w as signEip1559};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C,Vn,v,ne,Ie,je,K,ye,Fe,Vt,Zt,y,pt,tn,nn,I}from"./index-w7vk3rba.js";import{join as bn,sep as wn}from"node:path";/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var $e={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Ot={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]};var ze=BigInt(2);function Tt(e){let t=$e.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),d=e*e*e%t,u=d*d*e%t,m=y(u,r,t)*u%t,f=y(m,r,t)*u%t,_=y(f,ze,t)*d%t,S=y(_,i,t)*_%t,h=y(S,s,t)*S%t,w=y(h,a,t)*h%t,A=y(w,c,t)*w%t,x=y(A,a,t)*h%t,P=y(x,r,t)*u%t,O=y(P,o,t)*S%t,z=y(O,n,t)*d%t,M=y(z,ze,t);if(!ke.eql(ke.sqr(M),e))throw Error("Cannot find square root");return M}var ke=pt($e.p,{sqrt:Tt}),Dt=tn($e,{Fp:ke,endo:Ot}),se=nn(Dt,Zt),On=Object.create(null);var fe=10;function Me(e,t,r){let n=Number(e),i=Number(t);if(!(n>0)||!(i>0)||!Number.isInteger(r)||r<0)return null;let s=10**r,o=Math.floor(n/i*s+0.000000001);if(o<=0)return null;let a=(o/s).toFixed(r);return r>0?a.replace(/\.?0+$/,""):a}class l extends Error{code;detail;constructor(e,t){super(t?`${e}: ${t}`:e);this.code=e;this.detail=t;this.name="HlRefusal"}}var Ve={perp:6,spot:8},Et=/^\d+(\.\d+)?$/;function ie(e,t="value"){if(typeof e!=="string"||!Et.test(e.trim()))throw new l("bad_decimal",`${t}=${String(e)}`);let[r,n=""]=e.trim().split(".");return r=r.replace(/^0+(?=\d)/,""),n=n.replace(/0+$/,""),n?`${r}.${n}`:r}var L=(e)=>e.includes(".")?e.split(".")[1].length:0,Ae=(e)=>/^0(\.0*)?$/.test(e),Pt=(e)=>!e.includes(".");function We(e){let t=e.replace(".","").replace(/^0+/,"");if(!e.includes("."))return t.replace(/0+$/,"").length||1;return t.length||1}function Ke(e,t){let r=ie(e,"size");if(Ae(r))throw new l("size_zero");if(L(r)>t)throw new l("size_too_precise",`${r} has ${L(r)} decimals, max ${t}`);return r}function _e(e,t,r){let n=ie(e,"price");if(Ae(n))throw new l("price_zero");if(Pt(n))return n;if(We(n)>5)throw new l("price_sig_figs",`${n} has ${We(n)} significant figures, max 5`);let i=Ve[r]-t;if(L(n)>i)throw new l("price_too_precise",`${n} has ${L(n)} decimals, max ${i}`);return n}function V(e){let t=ie(e,"amount");if(Ae(t))throw new l("amount_zero");if(L(t)>6)throw new l("amount_too_precise",`${t} has ${L(t)} decimals, max 6`);return t}function Xe(e,t,r,n,i){let s=Number(ie(e,"mid"));if(!(s>0))throw new l("price_zero","mid");if(!(r>=0&&r<1))throw new l("bad_slippage",String(r));let o=s*(t?1+r:1-r),a=Number(o.toPrecision(5)),c=Math.max(0,Ve[i]-n);return _e(ie(a.toFixed(c),"price"),n,i)}var Ge={mainnet:"https://api.hyperliquid.xyz/info",testnet:"https://api.hyperliquid-testnet.xyz/info"};var X=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),oe=1e4,W=110000;function Rt(e,t){let r=new Map,n=new Map,i=(d,...u)=>{n.set(d.asset,d);for(let m of u)if(!r.has(m))r.set(m,d)},s=X(e)?e:{};(Array.isArray(s.universe)?s.universe:[]).forEach((d,u)=>{if(!X(d)||typeof d.name!=="string"||typeof d.szDecimals!=="number")return;i({coin:d.name,label:d.name,asset:u,szDecimals:d.szDecimals,kind:"perp",delisted:d.isDelisted===!0,...typeof d.maxLeverage==="number"?{maxLeverage:d.maxLeverage}:{},...d.onlyIsolated===!0?{onlyIsolated:!0}:{}},d.name)});let a=X(t)?t:{},c=new Map;for(let d of Array.isArray(a.tokens)?a.tokens:[])if(X(d)&&typeof d.index==="number")c.set(d.index,d);for(let d of Array.isArray(a.universe)?a.universe:[]){if(!X(d)||typeof d.index!=="number"||typeof d.name!=="string"||!Array.isArray(d.tokens))continue;let[u,m]=d.tokens,f=c.get(u),_=c.get(m);if(!f||typeof f.szDecimals!=="number")continue;let S=`${String(f.name)}/${String(_?.name??"?")}`;i({coin:d.name,label:S,asset:oe+d.index,szDecimals:f.szDecimals,kind:"spot",delisted:!1},d.name,S)}return{byName:r,byIndex:n}}function Se(e,t){let r=e.byName.get(t);if(!r)throw new l("unknown_asset",t);if(r.delisted)throw new l("asset_delisted",t);return r}function ve(e,t){if(t>=W)throw new l("builder_dex_unsupported",String(t));let r=e.byIndex.get(t);if(!r)throw new l("unknown_asset",String(t));return r}async function H(e,t,r={}){let n=r.fetchImpl??fetch;try{let i=await n(Ge[t],{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(r.timeoutMs??5000)});if(!i.ok)return{ok:!1,error:"hyperliquid_unavailable",detail:`status_${i.status}`};return{ok:!0,data:await i.json()}}catch(i){return{ok:!1,error:"hyperliquid_unavailable",detail:i.message}}}async function Oe(e,t={}){let[r,n]=await Promise.all([H({type:"meta"},e,t),H({type:"spotMeta"},e,t)]);if(!r.ok)return r;if(!n.ok)return n;return{ok:!0,data:Rt(r.data,n.data)}}async function Je(e,t={}){let r=await H({type:"allMids"},e,t);if(!r.ok)return r;let n={};if(X(r.data)){for(let[i,s]of Object.entries(r.data))if(typeof s==="string"&&/^\d+(\.\d+)?$/.test(s))n[i]=s}return{ok:!0,data:n}}var Bt=["Gtc","Ioc","Alo"],Ht=/^0x[0-9a-fA-F]{32}$/,Ut=/^0x[0-9a-fA-F]{40}$/;function Te(e){let t=e.tif??"Gtc";if(!Bt.includes(t))throw new l("bad_tif",String(t));if(e.asset.delisted)throw new l("asset_delisted",e.asset.coin);let r=Ke(e.sz,e.asset.szDecimals),n=_e(e.px,e.asset.szDecimals,e.asset.kind);if(e.cloid!==void 0&&!Ht.test(e.cloid))throw new l("bad_cloid",e.cloid);let i={a:e.asset.asset,b:e.isBuy,p:n,s:r,r:e.reduceOnly??!1,t:{limit:{tif:t}}};if(e.cloid!==void 0)i.c=e.cloid.toLowerCase();return i}function De(e){return{type:"order",orders:[Te(e)],grouping:"na"}}function Ye(e){let t=Xe(e.mid,e.isBuy,e.slippage??0.05,e.asset.szDecimals,e.asset.kind);return De({asset:e.asset,isBuy:e.isBuy,sz:e.sz,px:t,tif:"Ioc",reduceOnly:e.reduceOnly,cloid:e.cloid})}function pe(e){let t=e.asset.asset;if(!Number.isSafeInteger(t)||t<0)throw new l("unknown_asset",String(t));if(t>=W)throw new l("builder_dex_unsupported",String(t));if(!Number.isSafeInteger(e.oid)||e.oid<0)throw new l("bad_oid",String(e.oid));return{type:"cancel",cancels:[{a:t,o:e.oid}]}}function G(e){let t=e.asset.asset;if(!Number.isSafeInteger(t)||t<0)throw new l("unknown_asset",String(t));if(t>=W)throw new l("builder_dex_unsupported",String(t));if(e.asset.kind==="spot"||t>=oe)throw new l("leverage_spot",e.asset.coin);if(typeof e.isCross!=="boolean")throw new l("bad_leverage","isCross must be true or false");if(!Number.isSafeInteger(e.leverage)||e.leverage<1)throw new l("bad_leverage",String(e.leverage));if(e.asset.maxLeverage!==void 0&&e.leverage>e.asset.maxLeverage)throw new l("leverage_too_high",`${e.leverage}x, max ${e.asset.maxLeverage}x on ${e.asset.coin}`);if(e.isCross&&e.asset.onlyIsolated)throw new l("cross_not_allowed",e.asset.coin);return{type:"updateLeverage",asset:t,isCross:e.isCross,leverage:e.leverage}}function Ze(e){if(!Number.isSafeInteger(e)||e<=0)throw new l("nonce_required",String(e));return e}function ge(e){return{type:"usdClassTransfer",amount:V(e.amount),toPerp:e.toPerp,nonce:Ze(e.nonce)}}function me(e){if(!Ut.test(e.destination))throw new l("bad_address",e.destination);return{type:"withdraw3",destination:e.destination.toLowerCase(),amount:V(e.amount),time:Ze(e.time)}}var Lt=BigInt(0),ae=BigInt(1),Nt=BigInt(2),Ct=BigInt(7),Ft=BigInt(256),jt=BigInt(113),tt=[],nt=[],rt=[];for(let e=0,t=ae,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],tt.push(2*(5*n+r)),nt.push((e+1)*(e+2)/2%64);let i=Lt;for(let s=0;s<7;s++)if(t=(t<<ae^(t>>Ct)*jt)%Ft,t&Nt)i^=ae<<(ae<<BigInt(s))-ae;rt.push(i)}var st=Vt(rt,!0),qt=st[0],zt=st[1],Mt=(e,t,r)=>e<<r|t>>>32-r,Wt=(e,t,r)=>t<<r|e>>>32-r,Kt=(e,t,r)=>t<<r-32|e>>>64-r,Xt=(e,t,r)=>e<<r-32|t>>>64-r,Qe=(e,t,r)=>r>32?Kt(e,t,r):Mt(e,t,r),et=(e,t,r)=>r>32?Xt(e,t,r):Wt(e,t,r),J=new Uint32Array(10);function Gt(e,t=24){if(!(e instanceof Uint32Array))throw TypeError('"s" expected Uint32Array(50), got type='+typeof e);if(e.length!==50)throw RangeError('"s" expected Uint32Array(50), got length='+e.length);if(C(t,"rounds"),t<1||t>24)throw Error('"rounds" expected integer 1..24');for(let r=24-t;r<24;r++){for(let s=0;s<10;s++)J[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let o=(s+8)%10,a=(s+2)%10,c=J[a],d=J[a+1],u=Qe(c,d,1)^J[o],m=et(c,d,1)^J[o+1];for(let f=0;f<50;f+=10)e[s+f]^=u,e[s+f+1]^=m}let n=e[2],i=e[3];for(let s=0;s<24;s++){let o=nt[s],a=Qe(n,i,o),c=et(n,i,o),d=tt[s];n=e[d],i=e[d+1],e[d]=a,e[d+1]=c}for(let s=0;s<50;s+=10){let o=e[s],a=e[s+1],c=e[s+2],d=e[s+3];e[s]^=~e[s+2]&e[s+4],e[s+1]^=~e[s+3]&e[s+5],e[s+2]^=~e[s+4]&e[s+6],e[s+3]^=~e[s+5]&e[s+7],e[s+4]^=~e[s+6]&e[s+8],e[s+5]^=~e[s+7]&e[s+9],e[s+6]^=~e[s+8]&o,e[s+7]^=~e[s+9]&a,e[s+8]^=~o&c,e[s+9]^=~a&d}e[0]^=qt[r],e[1]^=zt[r]}K(J)}class Ee{state;pos=0;posOut=0;finished=!1;state32;destroyed=!1;blockLen;suffix;outputLen;canXOF;enableXOF=!1;rounds;constructor(e,t,r,n=!1,i=24){if(C(e,"blockLen"),C(t,"suffix"),C(i,"rounds"),Vn(n,"enableXOF"),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.canXOF=n,this.rounds=i,C(r,"outputLen"),!(0<e&&e<200))throw Error('"blockLen" must be 1..199');this.state=new Uint8Array(200),this.state32=je(this.state)}clone(){return this._cloneInto()}keccak(){ye(this.state32),Gt(this.state32,this.rounds),ye(this.state32),this.posOut=0,this.pos=0}update(e){ne(this),v(e);let{blockLen:t,state:r,state32:n}=this,i=e.length,s=t%4===0&&e.byteOffset%4===0,o=t/4,a=s&&i>=t?je(e):void 0;for(let c=0;c<i;){if(a!==void 0&&this.pos===0&&c%4===0&&i-c>=t){for(let u=0,m=c/4;u<o;u++)n[u]^=a[m+u];c+=t,this.pos=t,this.keccak();continue}let d=Math.min(t-this.pos,i-c);for(let u=0;u<d;u++)r[this.pos++]^=e[c++];if(this.pos===t)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:n}=this;if(e[r]^=t,(t&128)!==0&&r===n-1)this.keccak();e[n-1]^=128,this.keccak()}writeInto(e){ne(this,!1),v(e),this.finish();let t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){if(this.posOut>=r)this.keccak();let s=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+s),n),this.posOut+=s,n+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not enabled");return this.writeInto(e)}xof(e){return C(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Ie(e,this),this.finished)throw Error("digest() was already called");this.writeInto(e.length===this.outputLen?e:e.subarray(0,this.outputLen)),this.destroy()}digest(){let e=new Uint8Array(this.outputLen);return this.digestInto(e),e}destroy(){this.destroyed=!0,K(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:s}=this;return e||=new Ee(t,r,n,s,i),e.blockLen=t,e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=s,e.canXOF=this.canXOF,e.destroyed=this.destroyed,e}}var Jt=(e,t,r,n={})=>Fe(()=>new Ee(t,e,r),n);var N=Jt(1,136,32);var Y=[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],F=(e)=>Array.from(e,(t)=>t.toString(16).padStart(2,"0")).join(""),j=(e)=>`0x${F(e)}`;function q(e){let t=e.startsWith("0x")?e.slice(2):e;if(t.length%2!==0||!/^[0-9a-fA-F]*$/.test(t))throw new l("bad_hex",e);let r=new Uint8Array(t.length/2);for(let n=0;n<r.length;n++)r[n]=parseInt(t.slice(2*n,2*n+2),16);return r}function he(e){if(e<0n||e>=1n<<256n)throw new l("eip712_range",String(e));let t=new Uint8Array(32);for(let r=31;r>=0;r--)t[r]=Number(e&0xffn),e>>=8n;return t}function it(e,t,r){let n;if(typeof e==="bigint")n=e;else if(typeof e==="number"&&Number.isSafeInteger(e))n=BigInt(e);else if(typeof e==="string"&&/^(0x[0-9a-fA-F]+|\d+)$/.test(e))n=BigInt(e);else throw new l("eip712_value",`${r} not a uint`);if(n<0n||n>=1n<<BigInt(t))throw new l("eip712_range",r);return n}function Yt(e,t){switch(e.type){case"string":if(typeof t!=="string")throw new l("eip712_value",`${e.name} not a string`);return N(new TextEncoder().encode(t));case"bytes32":{let r=t instanceof Uint8Array?t:typeof t==="string"?q(t):null;if(!r||r.length!==32)throw new l("eip712_value",`${e.name} not bytes32`);return r}case"address":{if(typeof t!=="string"||!/^0x[0-9a-fA-F]{40}$/.test(t))throw new l("eip712_value",`${e.name} not an address`);return he(BigInt(t))}case"bool":if(typeof t!=="boolean")throw new l("eip712_value",`${e.name} not a bool`);return he(t?1n:0n);case"uint64":return he(it(t,64,e.name));case"uint256":return he(it(t,256,e.name));default:throw new l("eip712_type",String(e.type))}}var Qt=(e,t)=>`${e}(${t.map((r)=>`${r.type} ${r.name}`).join(",")})`;function ot(e,t,r){let n=[N(new TextEncoder().encode(Qt(e,t)))];for(let s of t){if(!(s.name in r))throw new l("eip712_missing",s.name);n.push(Yt(s,r[s.name]))}let i=new Uint8Array(n.length*32);return n.forEach((s,o)=>i.set(s,o*32)),N(i)}function Z(e){let t=e.types[e.primaryType];if(!t)throw new l("eip712_type",e.primaryType);let r=ot("EIP712Domain",Y,e.domain),n=ot(e.primaryType,t,e.message),i=new Uint8Array(66);return i[0]=25,i[1]=1,i.set(r,2),i.set(n,34),N(i)}class ce extends Error{code;constructor(e,t){super(`${e}: ${t}`);this.code=e}}var en=(1n<<64n)-1n,rn=-(1n<<63n);function Q(e){let t=[];return be(t,e,"$"),Uint8Array.from(t)}function B(e,t,r){for(let n=r-1;n>=0;n--)e.push(Number(t>>BigInt(8*n)&0xffn))}function at(e,t,r){if(t>en||t<rn)throw new ce("msgpack_int_range",r);if(t>=0n){if(t<=0x7fn)e.push(Number(t));else if(t<=0xffn)e.push(204),B(e,t,1);else if(t<=0xffffn)e.push(205),B(e,t,2);else if(t<=0xffffffffn)e.push(206),B(e,t,4);else e.push(207),B(e,t,8);return}let n=(i)=>t+(1n<<BigInt(i));if(t>=-32n)e.push(Number(n(8)));else if(t>=-128n)e.push(208),B(e,n(8),1);else if(t>=-32768n)e.push(209),B(e,n(16),2);else if(t>=-2147483648n)e.push(210),B(e,n(32),4);else e.push(211),B(e,n(64),8)}function Pe(e,t,r,n,i){if(t<=n)e.push(r|t);else if(i[0]!==null&&t<=255)e.push(i[0]),B(e,BigInt(t),1);else if(t<=65535)e.push(i[1]),B(e,BigInt(t),2);else e.push(i[2]),B(e,BigInt(t),4)}function be(e,t,r){if(t===null){e.push(192);return}if(t===void 0)throw new ce("msgpack_undefined",r);if(typeof t==="boolean"){e.push(t?195:194);return}if(typeof t==="bigint"){at(e,t,r);return}if(typeof t==="number"){if(!Number.isSafeInteger(t))throw new ce("msgpack_float",`${r}=${t}`);at(e,BigInt(t),r);return}if(typeof t==="string"){let n=new TextEncoder().encode(t);Pe(e,n.length,160,31,[217,218,219]);for(let i of n)e.push(i);return}if(Array.isArray(t)){Pe(e,t.length,144,15,[null,220,221]),t.forEach((n,i)=>be(e,n,`${r}[${i}]`));return}if(typeof t==="object"&&Object.getPrototypeOf(t)===Object.prototype){let n=Object.keys(t);Pe(e,n.length,128,15,[null,222,223]);for(let i of n)be(e,i,r),be(e,t[i],`${r}.${i}`);return}throw new ce("msgpack_type",`${r}: ${typeof t}`)}var we={mainnet:"https://api.hyperliquid.xyz/exchange",testnet:"https://api.hyperliquid-testnet.xyz/exchange"},Re="0x66eee",dt="0x0000000000000000000000000000000000000000",ut=/^0x[0-9a-fA-F]{40}$/;function ct(e){let t=BigInt(e);if(t<0n||t>=1n<<64n)throw new l("eip712_range",String(e));let r=new Uint8Array(8);for(let n=7;n>=0;n--)r[n]=Number(t&0xffn),t>>=8n;return r}function sn(e,t,r,n){let i=[Q(e),ct(r)];if(t===null)i.push(Uint8Array.of(0));else i.push(Uint8Array.of(1),q(t));if(n!==null)i.push(Uint8Array.of(0),ct(n));let s=new Uint8Array(i.reduce((a,c)=>a+c.length,0)),o=0;for(let a of i)s.set(a,o),o+=a.length;return s}var on={name:"Exchange",version:"1",chainId:1337,verifyingContract:dt},an=[{name:"source",type:"string"},{name:"connectionId",type:"bytes32"}];function cn(e,t){return{domain:on,types:{Agent:an,EIP712Domain:Y},primaryType:"Agent",message:{source:t==="mainnet"?"a":"b",connectionId:j(e)}}}var ln={usdClassTransfer:{primaryType:"HyperliquidTransaction:UsdClassTransfer",fields:[{name:"hyperliquidChain",type:"string"},{name:"amount",type:"string"},{name:"toPerp",type:"bool"},{name:"nonce",type:"uint64"}],nonceField:"nonce"},withdraw3:{primaryType:"HyperliquidTransaction:Withdraw",fields:[{name:"hyperliquidChain",type:"string"},{name:"destination",type:"string"},{name:"amount",type:"string"},{name:"time",type:"uint64"}],nonceField:"time"}};function dn(e,t,r,n,i=Re){if(!/^0x[0-9a-fA-F]+$/.test(i))throw new l("bad_hex",i);let s={...r,hyperliquidChain:n==="mainnet"?"Mainnet":"Testnet"},o={};for(let a of t){if(!(a.name in s))throw new l("eip712_missing",a.name);o[a.name]=s[a.name]}return{domain:{name:"HyperliquidSignTransaction",version:"1",chainId:Number(BigInt(i)),verifyingContract:dt},types:{[e]:t,EIP712Domain:Y},primaryType:e,message:o}}var ft=(e,t)=>F(Q(e))===F(Q(t)),gt=(e)=>e.type==="order"||e.type==="cancel"||e.type==="updateLeverage";function un(e,t){let r=ve(t,e.a),n=e.t?.limit?.tif;return Te({asset:r,isBuy:e.b,sz:e.s,px:e.p,tif:n,reduceOnly:e.r,cloid:e.c})}var fn=(e,t)=>{let r=Object.keys(e).sort(),n=Object.keys(t).sort();return r.join()===n.join()&&r.every((i)=>ft(e[i],t[i]))};function lt(e,t){let{hyperliquidChain:r,signatureChainId:n,...i}=e,s=t.net==="mainnet"?"Mainnet":"Testnet";if(r!==void 0&&r!==s)throw new l("unsupported_action",`hyperliquidChain ${String(r)} on ${t.net}`);let o=(t.signatureChainId??Re).toLowerCase();if(n!==void 0&&String(n).toLowerCase()!==o)throw new l("unsupported_action",`signatureChainId ${String(n)} ≠ ${o}`);return i}function pn(e,t){let r=t.assets;if(!e||typeof e!=="object")throw new l("unsupported_action","not an object");let n,i=e;switch(e.type){case"order":{if(!r)throw new l("meta_required","an order is checked against meta + spotMeta before it is signed");let o=Array.isArray(e.orders)?e.orders:[];if(o.length===0)throw new l("unsupported_action","order with no orders");n={type:"order",orders:o.map((a)=>un(a,r)),grouping:"na"};break}case"cancel":{let o=e.cancels??[];if(o.length===0)throw new l("unsupported_action","cancel with no cancels");n={type:"cancel",cancels:o.map((a)=>pe({asset:r?ve(r,a.a):{asset:a.a},oid:a.o}).cancels[0])};break}case"updateLeverage":{let o=e,a=r&&Number.isSafeInteger(o.asset)&&o.asset<W?r.byIndex.get(o.asset):void 0;if(r&&!a&&Number.isSafeInteger(o.asset)&&o.asset<W)throw new l("unknown_asset",String(o.asset));n=G({asset:a??{asset:o.asset,kind:o.asset>=oe?"spot":"perp",coin:String(o.asset)},leverage:o.leverage,isCross:o.isCross});break}case"usdClassTransfer":{i=lt(e,t);let o=i;if(typeof o.toPerp!=="boolean")throw new l("unsupported_action","toPerp");n=ge({amount:o.amount,toPerp:o.toPerp,nonce:o.nonce});break}case"withdraw3":{i=lt(e,t);let o=i;n=me({destination:o.destination,amount:o.amount,time:o.time});break}default:throw new l("unsupported_action",String(e.type))}if(!(gt(n)?ft(n,i):fn(n,i)))throw new l("unsupported_action","action is not in canonical form");return n}function ee(e,t){let r=pn(e,t);if(gt(r)){if(t.nonce===void 0||!Number.isSafeInteger(t.nonce)||t.nonce<0)throw new l("nonce_required");if(t.vaultAddress!==void 0&&!ut.test(t.vaultAddress))throw new l("bad_address",t.vaultAddress);if(t.expiresAfter!==void 0&&(!Number.isSafeInteger(t.expiresAfter)||t.expiresAfter<=0))throw new l("expires_unsupported",String(t.expiresAfter));let c=t.vaultAddress?.toLowerCase()??null,d=t.expiresAfter??null,u=sn(r,c,t.nonce,d),m=N(u),f=cn(m,t.net);return{kind:"l1",network:t.net,action:r,nonce:t.nonce,vaultAddress:c,expiresAfter:d,msgpackHex:F(Q(r)),hashInputHex:F(u),connectionId:j(m),typedData:f,digest:j(Z(f)),exchangeUrl:we[t.net],posted:!1}}if(t.vaultAddress!==void 0)throw new l("vault_unsupported",r.type);if(t.expiresAfter!==void 0)throw new l("expires_unsupported",r.type);let n=ln[r.type],i=r[n.nonceField];if(t.nonce!==void 0&&t.nonce!==i)throw new l("nonce_mismatch",`${t.nonce} ≠ ${i}`);let s=t.signatureChainId??Re,o={type:r.type,signatureChainId:s,hyperliquidChain:t.net==="mainnet"?"Mainnet":"Testnet",...Object.fromEntries(Object.entries(r).filter(([c])=>c!=="type"))},a=dn(n.primaryType,n.fields,o,t.net,s);return{kind:"user",network:t.net,action:o,nonce:i,vaultAddress:null,expiresAfter:null,msgpackHex:null,hashInputHex:null,connectionId:null,typedData:a,digest:j(Z(a)),exchangeUrl:we[t.net],posted:!1}}function gn(e){let t=q(e);if(t.length!==65)throw new l("bad_signature",`length ${t.length}`);let r=t[64]<27?t[64]+27:t[64];if(r!==27&&r!==28)throw new l("bad_signature",`v=${t[64]}`);return{r:j(t.slice(0,32)),s:j(t.slice(32,64)),v:r}}function mn(e,t){let r=typeof e==="string"?q(e):e,n=(a)=>BigInt(a).toString(16).padStart(64,"0");if(t.v!==27&&t.v!==28)throw new l("bad_signature",`v=${t.v}`);let i=q(`${(t.v-27).toString(16).padStart(2,"0")}${n(t.r)}${n(t.s)}`),s=se.recoverPublicKey(i,r,{prehash:!1}),o=se.Point.fromBytes(s).toBytes(!1);return j(N(o.slice(1)).slice(12))}async function Be(e,t,r,n={}){let i=ee(e,t);if(n.expectDigest!==void 0&&n.expectDigest.toLowerCase()!==i.digest)throw new l("signer_mismatch","the digest shown is not the digest being signed");if(!ut.test(r.address))throw new l("bad_address",r.address);let{EIP712Domain:s,...o}=i.typedData.types,a=await r.signTypedData(i.typedData.domain,o,i.typedData.message),c=gn(a),d=mn(i.digest,c);if(d!==r.address.toLowerCase())throw new l("signer_mismatch",`recovered ${d}, expected ${r.address}`);return{dry:i,request:{action:i.action,nonce:i.nonce,signature:c,vaultAddress:i.vaultAddress,expiresAfter:i.expiresAfter}}}var xe=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e);function hn(e){if(!xe(e))return{ok:!1,error:"exchange_unavailable",detail:"not json"};if(e.status!=="ok")return{ok:!1,error:"exchange_refused",detail:typeof e.response==="string"?e.response:"err",response:e.response};let t=e.response,n=(xe(t)&&xe(t.data)&&Array.isArray(t.data.statuses)?t.data.statuses:[]).find((i)=>xe(i)&&typeof i.error==="string");if(n)return{ok:!1,error:"exchange_refused",detail:String(n.error),response:t};return{ok:!0,response:t}}async function He(e,t,r={}){let n=r.fetchImpl??fetch;try{let i=await n(we[t],{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(r.timeoutMs??1e4)}),s=await i.text(),o;try{o=JSON.parse(s)}catch{return{ok:!1,error:"exchange_unavailable",detail:`status_${i.status}: ${s.slice(0,200)}`}}return hn(o)}catch(i){return{ok:!1,error:"exchange_unavailable",detail:i.message}}}var Ue=/^0x[0-9a-fA-F]{40}$/,U=(e)=>e.testnet?"testnet":"mainnet";function g(e,t,r={}){return{data:{ok:!1,error:e,detail:t,...r}}}class xt extends Error{code;constructor(e,t){super(t);this.code=e}}function E(e,t={}){if(e instanceof l)return g(e.code,e.detail??e.message,t);let r=e?.code;return g(typeof r==="string"?r:"hl_error",e?.message??String(e),t)}function Le(e,t){let r=L(e),n=L(t),i=(BigInt(e.replace(".",""))*BigInt(t.replace(".",""))).toString().padStart(r+n+1,"0"),s=i.length-(r+n),o=i.slice(s).replace(/0+$/,"");return o?`${i.slice(0,s)}.${o}`:i.slice(0,s)}function kt(e){let t=q(e.privateKeyHex);return{address:e.address,async signTypedData(r,n,i){let s=Object.keys(n);if(s.length!==1)throw new l("eip712_type",`expected one primary type, got ${s.length}`);let o=Z({domain:r,types:{...n,EIP712Domain:Y},primaryType:s[0],message:i}),a=se.sign(o,t,{prehash:!1,format:"recovered"}),c=new Uint8Array(65);return c.set(a.slice(1,65),0),c[64]=a[0]+27,`0x${F(c)}`}}}var D=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),te=(e)=>typeof e==="string"&&/^-?\d+(\.\d+)?$/.test(e)?e:null;async function le(e,t,r){let[n,i]=await Promise.all([H({type:"clearinghouseState",user:e},t,{fetchImpl:r.fetchImpl}),H({type:"spotClearinghouseState",user:e},t,{fetchImpl:r.fetchImpl})]);if(!n.ok||!i.ok)return null;let s=D(n.data)?n.data:{},o=D(s.marginSummary)?s.marginSummary:{},a=D(i.data)&&Array.isArray(i.data.balances)?i.data.balances:[];return{perps:{accountValue:te(o.accountValue),withdrawable:te(s.withdrawable)},spot:a.filter(D).map((c)=>({coin:String(c.coin??"?"),total:String(c.total??"?"),hold:String(c.hold??"?")}))}}function de(e,t){if(!t)return[`${e} not read — Hyperliquid did not answer (never shown as 0)`];let r=t.spot.length?t.spot.map((n)=>`${n.total} ${n.coin}${n.hold!=="0"&&n.hold!=="0.0"?` (${n.hold} held)`:""}`).join(" · "):"empty";return[`${e} perps ${t.perps.accountValue??"—"} USDC (withdrawable ${t.perps.withdrawable??"—"}) · spot ${r} — never summed`]}async function ue(e,t,r){let n=e?.trim();if(n)return Ue.test(n)?{ok:!0,address:n}:g("bad_address","A Hyperliquid account is a 0x address of 40 hex characters.");let i=await r.ask("wallet:get",{});if(typeof i.error==="string"||i.ok===!1)return g(String(i.error??"wallet_read_failed"),"Could not read your workspace wallet — pass an address.");let o=(Array.isArray(i.addresses)?i.addresses:[]).filter((c)=>c.chain==="evm"&&typeof c.address==="string"&&Ue.test(c.address)&&(!t||c.actor===t)),a=[...new Map(o.map((c)=>[c.address.toLowerCase(),c])).values()];if(a.length===0)return g("no_evm_address","Your workspace has no EVM address registered — pass one.");if(a.length>1)return g("ambiguous_address",`Several EVM addresses — pass one, or --actor <id>: ${a.map((c)=>`${c.actor??"?"} ${c.address}`).join(" · ")}`);return{ok:!0,address:a[0].address}}async function kr(e,t){let r=U(e),n=await ue(e.address,e.actor,t);if(!(("ok"in n)&&n.ok===!0))return n;let i=await H({type:"clearinghouseState",user:n.address},r,{fetchImpl:t.fetchImpl});if(!i.ok)return g(i.error,i.detail,{network:r});let s=D(i.data)?i.data:{},o=D(s.marginSummary)?s.marginSummary:{},a=(Array.isArray(s.assetPositions)?s.assetPositions:[]).map((c)=>D(c)&&D(c.position)?c.position:null).filter((c)=>c!==null).map((c)=>({coin:String(c.coin??"?"),size:String(c.szi??"?"),entryPx:c.entryPx??null,positionValue:c.positionValue??null,unrealizedPnl:c.unrealizedPnl??null,liquidationPx:c.liquidationPx??null,leverage:D(c.leverage)?c.leverage:null}));return t.say([`${n.address} on ${r} — perps account ${te(o.accountValue)??"—"} USDC, withdrawable ${te(s.withdrawable)??"—"}`,...a.length?a.map((c)=>` ${c.coin.padEnd(8)} ${c.size.startsWith("-")?"short":"long "} ${c.size.replace(/^-/,"")} @ ${String(c.entryPx??"—")} value ${String(c.positionValue??"—")} pnl ${String(c.unrealizedPnl??"—")} liq ${String(c.liquidationPx??"—")}`):[" no open perps positions (spot holdings: one hl balance)"]]),{data:{ok:!0,network:r,address:n.address,accountValue:te(o.accountValue),withdrawable:te(s.withdrawable),positions:a}}}async function $r(e,t){let r=U(e),n=await ue(e.address,e.actor,t);if(!(("ok"in n)&&n.ok===!0))return n;let i=await H({type:"openOrders",user:n.address},r,{fetchImpl:t.fetchImpl});if(!i.ok)return g(i.error,i.detail,{network:r});if(!Array.isArray(i.data))return g("hyperliquid_unavailable","openOrders did not answer a list",{network:r});let s=i.data.filter(D).map((o)=>({coin:String(o.coin??"?"),side:o.side==="B"?"buy":o.side==="A"?"sell":String(o.side??"?"),size:String(o.sz??"?"),limitPx:String(o.limitPx??"?"),oid:o.oid??null,timestamp:o.timestamp??null}));return t.say([`${n.address} on ${r} — ${s.length} resting order${s.length===1?"":"s"}`,...s.map((o)=>` ${o.side.padEnd(4)} ${o.size} ${o.coin} @ ${o.limitPx} oid ${String(o.oid)} cancel: one hl cancel ${o.coin} ${String(o.oid)}${r==="testnet"?" --testnet":""}`)]),{data:{ok:!0,network:r,address:n.address,count:s.length,orders:s}}}var xn="Hyperliquid takes its own trading fee on a fill (maker or taker, by your fee tier); ONE computes none and takes none.";function $t(e){if(e===void 0)return 0.05;if(!/^\d{1,4}$/.test(e)||Number(e)<1||Number(e)>2000)return g("bad_slippage","--slippage is basis points, 1–2000 (default 500 = 5%, the python SDK default).");return Number(e)/1e4}var kn="A perp is its name (BTC, ETH, HYPE); a spot pair is BASE/QUOTE (HYPE/USDC, UBTC/USDC) or its @index.";async function qe(e,t,r){let n=await Oe(t,{fetchImpl:r.fetchImpl});if(!n.ok)return g(n.error,n.detail,{network:t});try{return{table:n.data,info:Se(n.data,e)}}catch(i){return E(i,{network:t,next:kn})}}async function At(e,t,r){let n=await Je(t,{fetchImpl:r.fetchImpl});if(!n.ok)return g(n.error,n.detail,{network:t});return n.data[e.coin]??g("mid_unavailable",`allMids has no price for ${e.coin} (${e.label}) — a market order needs one; pass --limit <px>.`,{network:t})}async function Ar(e,t){let r=U(e),n=e.side.toLowerCase();if(n!=="buy"&&n!=="sell")return g("bad_side","The side is buy or sell.");if(e.tif!==void 0&&e.limit===void 0&&e.tif!=="Ioc")return g("bad_tif","A market order is IOC by construction — --tif needs --limit.");let i=$t(e.slippage);if(typeof i!=="number")return i;let s=await qe(e.coin,r,t);if("data"in s)return s;let o=null;if(e.limit===void 0){let a=await At(s.info,r,t);if(typeof a!=="string")return a;o=a}return _t({...e,side:n},r,s.table,s.info,o,i)}function _t(e,t,r,n,i,s){let o=e.side,a=o==="buy",c=e.reduceOnly===!0,d=[e.limit!==void 0?`--limit ${e.limit}`:"",e.tif?`--tif ${e.tif}`:"",c?"--reduce-only":"",e.slippage?`--slippage ${e.slippage}`:""].filter(Boolean).join(" ");return{cmdline:`one hl order ${o} ${e.size} ${e.coin}${d?` ${d}`:""}`,build(u){let m=e.limit!==void 0?De({asset:n,isBuy:a,sz:e.size,px:e.limit,tif:e.tif??"Gtc",reduceOnly:c}):Ye({asset:n,isBuy:a,sz:e.size,mid:i,slippage:s,reduceOnly:c}),f=m.orders[0],_=n.kind==="spot"?"spot":"perps",S=Le(f.s,f.p),h=f.t.limit.tif,w=e.limit===void 0?`now, at ${a?"up to":"no less than"} ${f.p} (mid ${i} ${a?"+":"−"} ${s*100}%) — IOC: fills what it can at that cap, cancels the rest`:h==="Gtc"?`at ${f.p} or better — Gtc: rests on the book until filled or cancelled`:h==="Ioc"?`at ${f.p} or better — IOC: fills what it can now, cancels the rest`:`at ${f.p} — Alo (post-only): refused if it would take liquidity`,A=[`${a?"Buy":"Sell"} ${f.s} ${n.label} (${_}, asset ${f.a}) ${w}.`,`${a?"At most":"About"} ${S} USDC notional before fees.`,n.kind==="spot"?a?"Pays USDC from your SPOT balance.":`Sells ${n.label.split("/")[0]} you hold in SPOT for USDC.`:`${c?"Reduce-only: it can only shrink a position you already hold.":"Opens or adds to a perps position; margin comes from your PERPS balance — spot USDC backs it only if the account is in unified mode (move it first: one hl transfer <amount> --to perps)."}`,xn];return{action:m,opts:{net:t,nonce:u,assets:r},words:A,facts:{coin:n.coin,label:n.label,kind:n.kind,asset:f.a,side:o,size:f.s,price:f.p,tif:h,reduceOnly:c,notionalUsdc:S,...i?{mid:i,slippageBps:Math.round(s*1e4)}:{}}}}}}async function _r(e,t){let r=U(e);if(!/^\d{1,16}$/.test(e.oid)||!Number.isSafeInteger(Number(e.oid)))return g("bad_oid","The order id is the whole number `one hl orders` prints.");let n=await Oe(r,{fetchImpl:t.fetchImpl});if(!n.ok)return g(n.error,n.detail,{network:r});let i;try{i=Se(n.data,e.coin)}catch(o){return E(o,{network:r})}let s=Number(e.oid);return{cmdline:`one hl cancel ${e.coin} ${e.oid}`,build(o){return{action:pe({asset:i,oid:s}),opts:{net:r,nonce:o,assets:n.data},words:[`Cancel resting order ${s} on ${i.label} (asset ${i.asset}). Nothing is bought or sold; an order already filled cannot be cancelled and Hyperliquid will say so.`],facts:{coin:i.coin,label:i.label,asset:i.asset,oid:s}}}}}async function Sr(e,t){let r=U(e),n=(e.to??"").toLowerCase();if(n!=="perps"&&n!=="spot")return g("bad_to","--to perps (spot → perps) or --to spot (perps → spot).");let i=n==="perps";try{V(e.amount)}catch(s){return E(s,{network:r})}return{cmdline:`one hl transfer ${e.amount} --to ${n}`,build(s){let o=ge({amount:e.amount,toPerp:i,nonce:s});return{action:o,opts:{net:r},words:[`Move ${o.amount} USDC from ${i?"SPOT to PERPS":"PERPS to SPOT"} on the same Hyperliquid account. Nothing leaves Hyperliquid; ONE takes nothing.`,i?"Perps USDC can margin a position and is what `one hl withdraw` sends out.":"Spot USDC can buy spot pairs; it no longer margins perps positions.","Whether the account needs this depends on its mode — read the `abstraction` line."],facts:{amount:o.amount,toPerp:i}}}}}async function vr(e,t,r){let n=U(e);if(e.to!==void 0&&!Ue.test(e.to))return g("bad_address","--to is an Arbitrum 0x address of 40 hex characters.");try{V(e.amount)}catch(s){return E(s,{network:n})}let i=null;if(!e.live&&e.to===void 0){let s=await ue(e.address,e.actor,t);if(!(("ok"in s)&&s.ok===!0))return{data:{...s.data,next:"Name the destination: --to 0x… (a live withdraw defaults to the vault's own address)"}};i=s.address}return{cmdline:`one hl withdraw ${e.amount}${e.to?` --to ${e.to}`:""}`,build(s,o){let a=o??i,c=e.to??a;if(!c)throw new l("bad_address","no destination");let d=a===null||c.toLowerCase()!==a.toLowerCase();if(r&&o!==null&&d)throw new xt("to_other_refused",`An agent withdraws only to its own address (${o}); ${c} is another. A person signs that one.`);let u=me({destination:c,amount:e.amount,time:s});return{action:u,opts:{net:n},words:[`Send ${u.amount} USDC from the PERPS balance${a?` of ${a}`:""} to ${c} on Arbitrum.${d?" THIS IS SOMEONE ELSE'S ADDRESS (toOther) — a withdrawal cannot be undone.":" That is the same key on Arbitrum — your own address."}`,"Hyperliquid documents a 1 USDC withdrawal fee (unverified here): what lands is in its answer and the Arbitrum receipt, not computed by ONE.","Withdrawals leave from PERPS on a split account (move spot USDC first: one hl transfer <amount> --to perps); a unified account may withdraw from its one balance — unverified, the exchange's answer is the record.","ONE's Arbitrum signer is external: ONE cannot send it on from Arbitrum. Open that address in MetaMask or Rabby (same key)."],facts:{amount:u.amount,destination:u.destination,toOther:d}}}}}function St(e){if(!/^\d{1,4}$/.test(e.trim()))return g("bad_leverage",`Leverage is a whole number of times (1, 3, 5 …), not ${JSON.stringify(e)}.`);return Number(e.trim())}function vt(e,t,r,n,i,s){let o=G({asset:e,leverage:t,isCross:r}),a=r?"cross":"isolated";return{action:o,opts:{net:n,nonce:s,assets:i},words:[`Set ${e.label} (perps, asset ${e.asset}) to ${t}x ${a}${e.maxLeverage!==void 0?` (Hyperliquid allows up to ${e.maxLeverage}x here)`:""}. This moves no money — it sets how the NEXT order on ${e.coin} is margined.`,r?"Cross: margin is shared with every other cross position on this account — a loss here can draw on all of it.":"Isolated: a position's margin is only what you put on it — a liquidation loses that margin and no more.","Hyperliquid may refuse a change while a position on this coin is open (switching cross ↔ isolated, or less leverage than the position needs); its answer is the record."],facts:{coin:e.coin,label:e.label,asset:e.asset,leverage:t,isCross:r,mode:a,...e.maxLeverage!==void 0?{maxLeverage:e.maxLeverage}:{}}}}async function Ir(e,t){let r=U(e),n=St(e.leverage);if(typeof n!=="number")return n;let i=await qe(e.coin,r,t);if("data"in i)return i;let s=e.cross===!0;try{G({asset:i.info,leverage:n,isCross:s})}catch(o){return E(o,{network:r})}return{cmdline:`one hl leverage ${e.coin} ${n}${s?" --cross":""}`,build:(o)=>vt(i.info,n,s,r,i.table,o)}}async function mt(e,t,r,n){let i=await H({type:"activeAssetData",user:e,coin:t},r,{fetchImpl:n.fetchImpl});if(!i.ok||!D(i.data)||!D(i.data.leverage))return null;let s=i.data.leverage;return(s.type==="cross"||s.type==="isolated")&&typeof s.value==="number"?{type:s.type,value:s.value}:null}async function $n(e,t){let r=U(e),n=e.side.toLowerCase();if(n!=="buy"&&n!=="sell")return g("bad_side","The side is buy or sell.");if(!/^\d+(\.\d+)?$/.test(e.usd)||!(Number(e.usd)>0))return g("bad_usd",`--usd is a dollar amount (20, 12.5), not ${JSON.stringify(e.usd)}.`);let i=null;if(e.lev!==void 0){let A=St(e.lev);if(typeof A!=="number")return A;i=A}let s=$t(e.slippage);if(typeof s!=="number")return s;let o=await qe(e.coin,r,t);if("data"in o)return o;let{info:a,table:c}=o,d=e.cross===!0;if(i!==null)try{G({asset:a,leverage:i,isCross:d})}catch(A){return E(A,{network:r})}else if(d)return g("cross_needs_lev","--cross sets the margin mode together with the leverage — pass --lev <n> too.",{network:r});let u=await At(a,r,t);if(typeof u!=="string")return u;let m=i!==null?Le(e.usd,String(i)):e.usd,f=Me(m,u,a.szDecimals),_=f===null?"0":Le(f,u),S=i!==null?`$${e.usd} × ${i}x = $${m}`:`$${e.usd}`;if(f===null||Number(_)<fe)return g("below_minimum",`${S} buys ${f??"less than one lot of"} ${a.label}${f?`, worth $${_} at mid ${u}`:""} — under Hyperliquid's $${fe} minimum order value. Nothing was signed and the leverage was not touched.`,{network:r,next:`Ask for more: --usd ${Math.ceil(fe*1.05/(i??1))}${i!==null?` --lev ${i}`:""}`});let h=[`--usd ${e.usd}`,i!==null?`--lev ${i}`:"",d?"--cross":"",e.slippage?`--slippage ${e.slippage}`:""].filter(Boolean).join(" "),w=_t({side:n,size:f,coin:e.coin,slippage:e.slippage},r,c,a,u,s);return{cmdline:`one hl ${n} ${e.coin} ${h}`,side:n,info:a,table:c,usd:e.usd,lev:i,isCross:d,mid:u,size:f,notionalUsdc:_,order:w}}function It(e,t){let r=e.dir??".",n=I(t.env);if(n){let i=t.realpath(r),s=t.realpath(bn(t.home,".one","agents"));if(!(i!==null&&s!==null&&i.startsWith(s+wn)))return g("agent_shell",`This shell is driven by ${n}. A live Hyperliquid action here may sign only with the agent's OWN vault (a folder under ~/.one/agents/), and ${r} is not one. Run it yourself in a terminal no agent drives.`);if(!e.yes)return g("agent_shell_needs_yes",`This shell is driven by ${n}. Signing with the agent's own vault (${r}) needs --yes — no one is here to answer a prompt.`);return null}if(!t.interactive&&!e.yes)return g("confirm_required","Not at a terminal (or --json), so no one can answer [y/N] — pass --yes to sign without the prompt.");return null}function Ne(e){return[`action ${JSON.stringify(e.action)}`,`typed data ${JSON.stringify(e.typedData)}`,`digest ${e.digest}`,...e.connectionId?[`connectionId ${e.connectionId}`,`msgpack ${e.msgpackHex}`]:[],`nonce ${e.nonce}${e.vaultAddress?` vault ${e.vaultAddress}`:""}`,`posts to ${e.exchangeUrl} (from this machine, never through ONE)`]}function Ce(e){return{kind:e.kind,action:e.action,typedData:e.typedData,digest:e.digest,connectionId:e.connectionId,msgpackHex:e.msgpackHex,nonce:e.nonce,exchangeUrl:e.exchangeUrl}}function ht(e){if(typeof e!=="string")return"abstraction not read — whether this account is unified is unknown";if(/unified|portfolio/i.test(e))return`abstraction ${JSON.stringify(e)} — spot USDC already backs perps on this account, so Hyperliquid may REFUSE this transfer or not need it (unverified: its answer is the record)`;return`abstraction ${JSON.stringify(e)} — spot and perps are separate balances; the transfer is how USDC moves between them`}async function yt(e,t,r){if(!e)return null;let n=await H({type:"userAbstraction",user:e},t,{fetchImpl:r.fetchImpl});return n.ok?n.data:null}async function Or(e,t,r,n,i={}){let s=U(t),o=t.live?It(t,n):null;if(o)return{data:{network:s,...o.data}};let a=await r();if("data"in a)return{data:{network:s,...a.data}};if(!t.live){let x,P;try{x=a.build(n.now(),null),P=ee(x.action,x.opts)}catch(p){return E(p,{network:s})}let O=i.abstractionFor??null;if(e==="transfer"&&!O){let p=await ue(void 0,void 0,n);if("ok"in p&&p.ok===!0)O=p.address}let z=e==="transfer"?await yt(O,s,n):void 0,M=`${a.cmdline}${s==="testnet"?" --testnet":""} --live --dir <your vault folder>`;return n.say([`DRY RUN — nothing signed, nothing sent · ${e} on ${s}`,...x.words.map((p)=>` ${p}`),...e==="transfer"?[ht(z),...O?[`account ${O}`]:[]]:[],...Ne(P),`next ${M}`]),{data:{ok:!0,live:!1,posted:!1,network:s,verb:e,consequence:x.words,...x.facts,...e==="transfer"?{abstraction:z??null,account:O}:{},...Ce(P),next:M}}}let c=await n.unlock(t.dir??".");if("error"in c)return g("vault_unavailable",c.error,{network:s,next:"Name the folder that holds .one/wallet.json: --dir ~/.one/<you>"});let d=c.keys.find((x)=>x.chain==="evm");if(!d)return g("no_evm_key",`The vault at ${t.dir??"."} holds no EVM key.`,{network:s});let u=kt(d),m,f;try{m=a.build(n.now(),u.address),f=ee(m.action,m.opts)}catch(x){return E(x,{network:s,signer:u.address})}let _=await le(u.address,s,n),S=e==="transfer"?await yt(u.address,s,n):void 0;if(n.say([`LIVE · ${e} on ${s} · signer ${u.address} (the vault's EVM key)`,...de("before",_),...m.words.map((x)=>` ${x}`),...e==="transfer"?[ht(S)]:[],...Ne(f)]),!t.yes){if(!await n.confirm(`Sign this digest with ${u.address} and post it to Hyperliquid ${s}? [y/N] `))return{data:{ok:!1,error:"declined",network:s,signer:u.address,posted:!1,detail:"Nothing signed, nothing sent."}}}let h;try{({request:h}=await Be(m.action,m.opts,u,{expectDigest:f.digest}))}catch(x){return E(x,{network:s,signer:u.address,posted:!1})}let w=await He(h,s,{fetchImpl:n.fetchImpl}),A=await le(u.address,s,n);return n.say([`exchange ${JSON.stringify(w.ok?w.response:{error:w.error,detail:w.detail,response:w.response??null})}`,...de("after ",A)]),{data:{ok:w.ok,...w.ok?{}:{error:w.error,detail:w.detail},live:!0,posted:!0,network:s,verb:e,signer:u.address,...m.facts,...e==="transfer"?{abstraction:S??null}:{},...Ce(f),signature:h.signature,exchange:w.ok?w.response:w.response??null,balanceBefore:_,balanceAfter:A}}}function bt(e){return{step:e.step,consequence:e.built.words,...Ce(e.dry)}}function wt(e,t,r){return[`step ${e} of ${t} — ${r.step==="leverage"?"updateLeverage":"order"}`,...r.built.words.map((n)=>` ${n}`),...Ne(r.dry)]}var An=(e)=>e?`${e.value}x ${e.type}`:"not read";async function Tr(e,t,r={}){let n=U(e),i=e.live?It(e,t):null;if(i)return{data:{network:n,...i.data}};let s=await $n(e,t);if("data"in s)return{data:{network:n,...s.data}};let o=s.isCross?"cross":"isolated",a=(p)=>s.lev!==null&&!(p&&p.value===s.lev&&p.type===o),c=(p,k)=>{let b=[],T=t.now();if(a(p)){let re=vt(s.info,s.lev,s.isCross,n,s.table,T);b.push({step:"leverage",built:re,dry:ee(re.action,re.opts)}),T=Math.max(t.now(),T+1)}let R=s.order.build(T,k);return b.push({step:"order",built:R,dry:ee(R.action,R.opts)}),b},d=s.lev!==null?(Number(s.notionalUsdc)/s.lev).toFixed(2):null,u=`${s.lev!==null?`$${s.usd} × ${s.lev}x`:`$${s.usd}`} ÷ mid ${s.mid} = ${s.size} ${s.info.label}, worth $${s.notionalUsdc} — floored to ${s.info.szDecimals} decimals, never more than asked${d?`; margin about $${d} USDC at ${s.lev}x`:""}.`,m=(p,k)=>s.lev===null?"leverage unchanged — no --lev, so the order uses whatever this account has set on the coin":a(p)?`leverage now ${An(p)}${k?` on ${k}`:""}${p?"":" (no answer, or no account to read)"} — asked ${s.lev}x ${o}, so updateLeverage goes FIRST and the order only if it is accepted`:`leverage already ${s.lev}x ${o}${k?` on ${k}`:""} — no updateLeverage step`,f=(p,k)=>({...p[p.length-1].built.facts,verb:s.side,side:s.side,coin:s.info.coin,label:s.info.label,usd:s.usd,leverage:s.lev,mode:s.lev!==null?o:null,mid:s.mid,size:s.size,notionalUsdc:s.notionalUsdc,...d?{marginUsdc:d}:{},leverageStep:p[0].step==="leverage",current:k});if(!e.live){let p=null,k=null;if(s.lev!==null){let R=await ue(e.address,e.actor,t);if("ok"in R&&R.ok===!0)p=R.address,k=await mt(p,s.info.coin,n,t)}let b;try{b=c(k,null)}catch(R){return E(R,{network:n})}let T=`${s.cmdline}${n==="testnet"?" --testnet":""} --live --dir <your vault folder>`;return t.say([`DRY RUN — nothing signed, nothing sent · ${s.side} on ${n}`,` ${u}`,m(k,p),...b.flatMap((R,re)=>wt(re+1,b.length,R)),`next ${T}`]),{data:{ok:!0,live:!1,posted:!1,network:n,...f(b,k),account:p,steps:b.map(bt),next:T}}}let _=await t.unlock(e.dir??".");if("error"in _)return g("vault_unavailable",_.error,{network:n,next:"Name the folder that holds .one/wallet.json: --dir ~/.one/<you>"});let S=_.keys.find((p)=>p.chain==="evm");if(!S)return g("no_evm_key",`The vault at ${e.dir??"."} holds no EVM key.`,{network:n});let h=kt(S),w=s.lev!==null?await mt(h.address,s.info.coin,n,t):null,A;try{A=c(w,h.address)}catch(p){return E(p,{network:n,signer:h.address})}let x=await le(h.address,n,t);t.say([`LIVE · ${s.side} on ${n} · signer ${h.address} (the vault's EVM key)`,...de("before",x),` ${u}`,m(w,h.address),...A.flatMap((p,k)=>wt(k+1,A.length,p))]);let P={live:!0,network:n,signer:h.address,...f(A,w)};if(!e.yes){let p=A.length===2?"Sign both steps (leverage, then the order only if Hyperliquid accepts it)":"Sign this order";if(!await t.confirm(`${p} with ${h.address} and post to Hyperliquid ${n}? [y/N] `))return{data:{ok:!1,error:"declined",...P,posted:!1,orderPosted:!1,detail:"Nothing signed, nothing sent."}}}let O=[];for(let p of A){let k;try{({request:k}=await Be(p.built.action,p.built.opts,h,{expectDigest:p.dry.digest}))}catch(T){return E(T,{...P,posted:O.length>0,orderPosted:!1,steps:O})}r.onSign?.(p.step);let b=await He(k,n,{fetchImpl:t.fetchImpl});if(t.say([`exchange ${p.step}: ${JSON.stringify(b.ok?b.response:{error:b.error,detail:b.detail,response:b.response??null})}`]),O.push({...bt(p),signature:k.signature,posted:!0,accepted:b.ok,exchange:b.ok?b.response:b.response??null}),!b.ok){let T=await le(h.address,n,t);if(t.say(de("after ",T)),p.step==="leverage")return{data:{ok:!1,error:"leverage_refused",detail:b.detail,exchangeError:b.error,...P,posted:!0,orderPosted:!1,steps:O,balanceBefore:x,balanceAfter:T,next:"The order was never signed. Fix what Hyperliquid named (close the position, or keep its mode), or drop --lev to trade at the current setting."}};return{data:{ok:!1,error:b.error,detail:b.detail,...P,posted:!0,orderPosted:!0,steps:O,exchange:b.response??null,balanceBefore:x,balanceAfter:T}}}}let z=await le(h.address,n,t);t.say(de("after ",z));let M=O[O.length-1];return{data:{ok:!0,...P,posted:!0,orderPosted:!0,steps:O,exchange:M.exchange,balanceBefore:x,balanceAfter:z}}}export{ht as abstractionWords,It as liveGate,_r as prepareCancel,Ir as prepareLeverage,Ar as prepareOrder,Sr as prepareTransfer,$n as prepareUsdOrder,vr as prepareWithdraw,le as readBalance,mt as readLeverage,ue as resolveAccount,Or as runAction,$r as runOrders,kr as runPositions,Tr as runUsdOrder,kt as vaultSigner};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)}function
|
|
1
|
+
var Rr=900000,Kn=120000;function Tn(n){return["ONE sweep order",`workspace: ${n.workspace}`,`agent: ${n.actor}`,`chain: ${n.chain}`,`destination: ${n.destination}`,`amount: ${n.amount.toString()}`,`nonce: ${n.nonce}`,`expires: ${n.expiresAt}`].join(`
|
|
2
|
+
`)}function Hn(n){return["ONE agent handover",`agent: ${n.agent}`,`from: ${n.from}`,`to: ${n.to}`,`chain: ${n.chain}`,`nonce: ${n.nonce}`,`expires: ${n.expiresAt}`].join(`
|
|
3
3
|
`)}
|
|
4
|
-
export{
|
|
4
|
+
export{Rr,Kn,Tn,Hn};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{x,d,We,p,j,we,Z,On,Ge,T}from"./index-w7vk3rba.js";/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function zt(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function yt(t){if(typeof t!=="boolean")throw TypeError(`boolean expected, not ${t}`)}function ct(t){if(typeof t!=="number")throw TypeError("number expected, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw RangeError("positive integer expected, got "+t)}function P(t,e,o=""){let n=zt(t),r=t?.length,i=e!==void 0;if(!n||i&&r!==e){let s=o&&`"${o}" `,a=i?` of length ${e}`:"",f=n?`length=${r}`:`type=${typeof t}`,h=s+"expected Uint8Array"+a+", got "+f;if(!n)throw TypeError(h);throw RangeError(h)}return t}function gt(t,e=!0){if(t.destroyed)throw Error("Hash instance has been destroyed");if(e&&t.finished)throw Error("Hash#digest() has already been called")}function mt(t,e,o=!1){P(t,void 0,"output");let n=e.outputLen;if(t.length<n)throw RangeError("digestInto() expects output buffer of length at least "+n);if(o&&!at(t))throw Error("invalid output, must be aligned")}function V(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function D(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function jt(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}var et=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),$t=(t)=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;var Wt=(t)=>{for(let e=0;e<t.length;e++)t[e]=$t(t[e]);return t},q=et?(t)=>t:Wt;function Lt(t,e){if(e==null||typeof e!=="object")throw Error("options must be defined");return Object.assign(t,e)}function Ut(t,e){if(t.length!==e.length)return!1;let o=0;for(let n=0;n<t.length;n++)o|=t[n]^e[n];return o===0}function Et(t,e,o){let n=e,r=o||(()=>[]),i=(a,f)=>n(f,...r(a)).update(a).digest(),s=n(new Uint8Array(t),...r(new Uint8Array(0)));return i.outputLen=s.outputLen,i.blockLen=s.blockLen,i.create=(a,...f)=>n(a,...f),i}var _t=(t,e)=>{function o(n,...r){if(P(n,void 0,"key"),t.nonceLength!==void 0){let l=r[0];P(l,t.varSizeNonce?void 0:t.nonceLength,"nonce")}let i=t.tagLength;if(i&&r[1]!==void 0)P(r[1],void 0,"AAD");let s=e(n,...r),a=(l,y)=>{if(y!==void 0){if(l!==2)throw Error("cipher output not supported");P(y,void 0,"output")}},f=!1;return{encrypt(l,y){if(f)throw Error("cannot encrypt() twice with same key + nonce");return f=!0,P(l),a(s.encrypt.length,y),s.encrypt(l,y)},decrypt(l,y){if(P(l),i&&l.length<i)throw Error('"ciphertext" expected length bigger than tagLength='+i);return a(s.decrypt.length,y),s.decrypt(l,y)}}}return Object.assign(o,t),o};function lt(t,e,o=!0){if(e===void 0)return new Uint8Array(t);if(P(e,void 0,"output"),e.length!==t)throw Error('"output" expected Uint8Array of length '+t+", got: "+e.length);if(o&&!at(e))throw Error("invalid output, must be aligned");return e}function Bt(t,e,o){ct(t),ct(e),yt(o);let n=new Uint8Array(16),r=jt(n);return r.setBigUint64(0,BigInt(e),o),r.setBigUint64(8,BigInt(t),o),n}function at(t){return t.byteOffset%4===0}function ht(t){return Uint8Array.from(P(t))}var It=(t)=>Uint8Array.from(t.split(""),(e)=>e.charCodeAt(0)),Xt=(()=>q(V(It("expand 16-byte k"))))(),Ft=(()=>q(V(It("expand 32-byte k"))))();function L(t,e){return t<<e|t>>>32-e}var ut=64,Gt=16,xt=(()=>4294967295)(),Tt=Uint32Array.of();function Dt(t,e,o,n,r,i,s,a){let f=r.length,h=new Uint8Array(ut),l=V(h),y=et&&at(r)&&at(i),b=y?V(r):Tt,g=y?V(i):Tt;if(!et){for(let w=0;w<f;s++){if(t(e,o,n,l,s,a),q(l),s>=xt)throw Error("arx: counter overflow");let m=Math.min(ut,f-w);for(let E=0,U;E<m;E++)U=w+E,i[U]=r[U]^h[E];w+=m}return}for(let w=0;w<f;s++){if(t(e,o,n,l,s,a),s>=xt)throw Error("arx: counter overflow");let m=Math.min(ut,f-w);if(y&&m===ut){let E=w/4;if(w%4!==0)throw Error("arx: invalid block position");for(let U=0,z;U<Gt;U++)z=E+U,g[z]=b[z]^l[U];w+=ut;continue}for(let E=0,U;E<m;E++)U=w+E,i[U]=r[U]^h[E];w+=m}}function kt(t,e){let{allowShortKeys:o,extendNonceFn:n,counterLength:r,counterRight:i,rounds:s}=Lt({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!=="function")throw Error("core must be a function");return ct(r),ct(s),yt(i),yt(o),(a,f,h,l,y=0)=>{P(a,void 0,"key"),P(f,void 0,"nonce"),P(h,void 0,"data");let b=h.length;if(l=lt(b,l,!1),ct(y),y<0||y>=xt)throw Error("arx: counter overflow");let g=[],w=a.length,m,E;if(w===32)g.push(m=ht(a)),E=Ft;else if(w===16&&o)m=new Uint8Array(32),m.set(a),m.set(a,16),E=Xt,g.push(m);else throw P(a,32,"arx key"),Error("invalid key size");if(!et||!at(f))g.push(f=ht(f));let U=V(m);if(n){if(f.length!==24)throw Error("arx: extended nonce must be 24 bytes");let G=f.subarray(0,16);if(et)n(E,U,V(G),U);else{let J=q(Uint32Array.from(E));n(J,U,V(G),U),D(J),q(U)}f=f.subarray(16)}else if(!et)q(U);let z=16-r;if(z!==f.length)throw Error(`arx: nonce must be ${z} or 16 bytes`);if(z!==12){let G=new Uint8Array(12);G.set(f,i?0:12-f.length),f=G,g.push(f)}let tt=q(V(f));try{return Dt(t,E,U,tt,h,l,y,s),l}finally{D(...g)}}}function W(t,e){return t[e++]&255|(t[e++]&255)<<8}class At{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(t){t=ht(P(t,32,"key"));let e=W(t,0),o=W(t,2),n=W(t,4),r=W(t,6),i=W(t,8),s=W(t,10),a=W(t,12),f=W(t,14);this.r[0]=e&8191,this.r[1]=(e>>>13|o<<3)&8191,this.r[2]=(o>>>10|n<<6)&7939,this.r[3]=(n>>>7|r<<9)&8191,this.r[4]=(r>>>4|i<<12)&255,this.r[5]=i>>>1&8190,this.r[6]=(i>>>14|s<<2)&8191,this.r[7]=(s>>>11|a<<5)&8065,this.r[8]=(a>>>8|f<<8)&8191,this.r[9]=f>>>5&127;for(let h=0;h<8;h++)this.pad[h]=W(t,16+2*h)}process(t,e,o=!1){let n=o?0:2048,{h:r,r:i}=this,s=i[0],a=i[1],f=i[2],h=i[3],l=i[4],y=i[5],b=i[6],g=i[7],w=i[8],m=i[9],E=W(t,e+0),U=W(t,e+2),z=W(t,e+4),tt=W(t,e+6),G=W(t,e+8),J=W(t,e+10),X=W(t,e+12),F=W(t,e+14),_=r[0]+(E&8191),B=r[1]+((E>>>13|U<<3)&8191),I=r[2]+((U>>>10|z<<6)&8191),k=r[3]+((z>>>7|tt<<9)&8191),A=r[4]+((tt>>>4|G<<12)&8191),R=r[5]+(G>>>1&8191),C=r[6]+((G>>>14|J<<2)&8191),O=r[7]+((J>>>11|X<<5)&8191),S=r[8]+((X>>>8|F<<8)&8191),N=r[9]+(F>>>5|n),u=0,v=u+_*s+B*(5*m)+I*(5*w)+k*(5*g)+A*(5*b);u=v>>>13,v&=8191,v+=R*(5*y)+C*(5*l)+O*(5*h)+S*(5*f)+N*(5*a),u+=v>>>13,v&=8191;let K=u+_*a+B*s+I*(5*m)+k*(5*w)+A*(5*g);u=K>>>13,K&=8191,K+=R*(5*b)+C*(5*y)+O*(5*l)+S*(5*h)+N*(5*f),u+=K>>>13,K&=8191;let H=u+_*f+B*a+I*s+k*(5*m)+A*(5*w);u=H>>>13,H&=8191,H+=R*(5*g)+C*(5*b)+O*(5*y)+S*(5*l)+N*(5*h),u+=H>>>13,H&=8191;let M=u+_*h+B*f+I*a+k*s+A*(5*m);u=M>>>13,M&=8191,M+=R*(5*w)+C*(5*g)+O*(5*b)+S*(5*y)+N*(5*l),u+=M>>>13,M&=8191;let Y=u+_*l+B*h+I*f+k*a+A*s;u=Y>>>13,Y&=8191,Y+=R*(5*m)+C*(5*w)+O*(5*g)+S*(5*b)+N*(5*y),u+=Y>>>13,Y&=8191;let nt=u+_*y+B*l+I*h+k*f+A*a;u=nt>>>13,nt&=8191,nt+=R*s+C*(5*m)+O*(5*w)+S*(5*g)+N*(5*b),u+=nt>>>13,nt&=8191;let rt=u+_*b+B*y+I*l+k*h+A*f;u=rt>>>13,rt&=8191,rt+=R*a+C*s+O*(5*m)+S*(5*w)+N*(5*g),u+=rt>>>13,rt&=8191;let st=u+_*g+B*b+I*y+k*l+A*h;u=st>>>13,st&=8191,st+=R*f+C*a+O*s+S*(5*m)+N*(5*w),u+=st>>>13,st&=8191;let it=u+_*w+B*g+I*b+k*y+A*l;u=it>>>13,it&=8191,it+=R*h+C*f+O*a+S*s+N*(5*m),u+=it>>>13,it&=8191;let ft=u+_*m+B*w+I*g+k*b+A*y;u=ft>>>13,ft&=8191,ft+=R*l+C*h+O*f+S*a+N*s,u+=ft>>>13,ft&=8191,u=(u<<2)+u|0,u=u+v|0,v=u&8191,u=u>>>13,K+=u,r[0]=v,r[1]=K,r[2]=H,r[3]=M,r[4]=Y,r[5]=nt,r[6]=rt,r[7]=st,r[8]=it,r[9]=ft}finalize(){let{h:t,pad:e}=this,o=new Uint16Array(10),n=t[1]>>>13;t[1]&=8191;for(let s=2;s<10;s++)t[s]+=n,n=t[s]>>>13,t[s]&=8191;t[0]+=n*5,n=t[0]>>>13,t[0]&=8191,t[1]+=n,n=t[1]>>>13,t[1]&=8191,t[2]+=n,o[0]=t[0]+5,n=o[0]>>>13,o[0]&=8191;for(let s=1;s<10;s++)o[s]=t[s]+n,n=o[s]>>>13,o[s]&=8191;o[9]-=8192;let r=(n^1)-1;for(let s=0;s<10;s++)o[s]&=r;r=~r;for(let s=0;s<10;s++)t[s]=t[s]&r|o[s];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let i=t[0]+e[0];t[0]=i&65535;for(let s=1;s<8;s++)i=(t[s]+e[s]|0)+(i>>>16)|0,t[s]=i&65535;D(o)}update(t){gt(this),P(t),t=ht(t);let{buffer:e,blockLen:o}=this,n=t.length;for(let r=0;r<n;){let i=Math.min(o-this.pos,n-r);if(i===o){for(;o<=n-r;r+=o)this.process(t,r);continue}if(e.set(t.subarray(r,r+i),this.pos),this.pos+=i,r+=i,this.pos===o)this.process(e,0,!1),this.pos=0}return this}destroy(){this.destroyed=!0,D(this.h,this.r,this.buffer,this.pad)}digestInto(t){gt(this),mt(t,this),this.finished=!0;let{buffer:e,h:o}=this,{pos:n}=this;if(n){e[n++]=1;for(;n<16;n++)e[n]=0;this.process(e,0,!0)}this.finalize();let r=0;for(let i=0;i<8;i++)t[r++]=o[i]>>>0,t[r++]=o[i]>>>8}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let o=t.slice(0,e);return this.destroy(),o}}var Rt=Et(32,(t)=>new At(t));function Vt(t,e,o,n,r,i=20){let s=t[0],a=t[1],f=t[2],h=t[3],l=e[0],y=e[1],b=e[2],g=e[3],w=e[4],m=e[5],E=e[6],U=e[7],z=r,tt=o[0],G=o[1],J=o[2],X=s,F=a,_=f,B=h,I=l,k=y,A=b,R=g,C=w,O=m,S=E,N=U,u=z,v=tt,K=G,H=J;for(let Y=0;Y<i;Y+=2)X=X+I|0,u=L(u^X,16),C=C+u|0,I=L(I^C,12),X=X+I|0,u=L(u^X,8),C=C+u|0,I=L(I^C,7),F=F+k|0,v=L(v^F,16),O=O+v|0,k=L(k^O,12),F=F+k|0,v=L(v^F,8),O=O+v|0,k=L(k^O,7),_=_+A|0,K=L(K^_,16),S=S+K|0,A=L(A^S,12),_=_+A|0,K=L(K^_,8),S=S+K|0,A=L(A^S,7),B=B+R|0,H=L(H^B,16),N=N+H|0,R=L(R^N,12),B=B+R|0,H=L(H^B,8),N=N+H|0,R=L(R^N,7),X=X+k|0,H=L(H^X,16),S=S+H|0,k=L(k^S,12),X=X+k|0,H=L(H^X,8),S=S+H|0,k=L(k^S,7),F=F+A|0,u=L(u^F,16),N=N+u|0,A=L(A^N,12),F=F+A|0,u=L(u^F,8),N=N+u|0,A=L(A^N,7),_=_+R|0,v=L(v^_,16),C=C+v|0,R=L(R^C,12),_=_+R|0,v=L(v^_,8),C=C+v|0,R=L(R^C,7),B=B+I|0,K=L(K^B,16),O=O+K|0,I=L(I^O,12),B=B+I|0,K=L(K^B,8),O=O+K|0,I=L(I^O,7);let M=0;n[M++]=s+X|0,n[M++]=a+F|0,n[M++]=f+_|0,n[M++]=h+B|0,n[M++]=l+I|0,n[M++]=y+k|0,n[M++]=b+A|0,n[M++]=g+R|0,n[M++]=w+C|0,n[M++]=m+O|0,n[M++]=E+S|0,n[M++]=U+N|0,n[M++]=z+u|0,n[M++]=tt+v|0,n[M++]=G+K|0,n[M++]=J+H|0}var Yt=kt(Vt,{counterRight:!1,counterLength:4,allowShortKeys:!1});var qt=new Uint8Array(16),Ct=(t,e)=>{t.update(e);let o=e.length%16;if(o)t.update(qt.subarray(o))},Zt=new Uint8Array(32);function Ot(t,e,o,n,r){if(r!==void 0)P(r,void 0,"AAD");let i=t(e,o,Zt),s=Bt(n.length,r?r.length:0,!0),a=Rt.create(i);if(r)Ct(a,r);Ct(a,n),a.update(s);let f=a.digest();return D(i,s),f}var Qt=(t)=>(e,o,n)=>({encrypt(i,s){let a=i.length;s=lt(a+16,s,!1),s.set(i);let f=s.subarray(0,-16);t(e,o,f,f,1);let h=Ot(t,e,o,f,n);return s.set(h,a),D(h),s},decrypt(i,s){s=lt(i.length-16,s,!1);let a=i.subarray(0,-16),f=i.subarray(-16),h=Ot(t,e,o,a,n);if(!Ut(f,h))throw D(h),Error("invalid tag");return s.set(i.subarray(0,-16)),t(e,o,s,s,1),D(h),s}}),pt=_t({blockSize:64,nonceLength:12,tagLength:16},Qt(Yt));var dt=Uint8Array.of(0),Jt=Uint8Array.of();function te(t,e,o,n=32,r){We(t),x(n,"length"),d(e,void 0,"prk");let i=t.outputLen;if(e.length<i)throw Error('"prk" must be at least HashLen octets');if(n>255*i)throw Error("Length must be <= 255*HashLen");let s=Math.ceil(n/i);if(o===void 0)o=Jt;else d(o,void 0,"info");if(!s){if(r)p(e);return new Uint8Array}let a=r&&s===1?e:new Uint8Array(s*i),{iHash:f,oHash:h}=Z.create(t,e),l=r?e:new Uint8Array(i),y=s>1?r?.iHash||t.create():void 0;for(let g=0;g<s-1;g++){dt[0]=g+1;let w=f._cloneInto(y);if(g)w.update(l);w.update(o).update(dt).digestInto(l),h._cloneInto(y).update(l).digestInto(l),a.set(l,i*g)}if(dt[0]=s,s>1)f.update(l);if(f.update(o).update(dt).digestInto(l),h.update(l).digestInto(l),a.set(l,i*(s-1)),f.destroy(),h.destroy(),y?.destroy(),l!==a)p(l);if(p(dt),n===a.length)return a;let b=a.slice(0,n);return p(a),b}var qe=(t,e,o,n,r)=>{if(We(t),o===void 0)o=new Uint8Array(t.outputLen);let i=Z.create(t,o).update(e);return te(t,i.digest(),n,r,i)};var Mn="age-encryption.org/v1",ot="-----BEGIN AGE ENCRYPTED FILE-----",En="-----END AGE ENCRYPTED FILE-----",St="age-encryption.org/v1/X25519",Nt="age",Mt="age-secret-key-",wt=65536,hr=128,bt=16,ee=new TextEncoder,vt=new TextDecoder,Q=(t)=>ee.encode(t);class c extends Error{code;constructor(t,e){super(e);this.code=t,this.name="AgeError"}}function $n(t){if(t.length!==32)throw new c("bad_key","an X25519 public key is 32 bytes");return T.encode(Nt,T.toWords(t),!1)}function gr(t){let e=t.trim(),o;try{o=T.decode(e,!1)}catch{throw new c("bad_key","not an age recipient (age1…)")}if(o.prefix!==Nt)throw new c("bad_key",`not an age recipient: prefix ${o.prefix}`);let n=T.fromWords(o.words);if(n.length!==32)throw new c("bad_key","an age recipient carries 32 bytes");return n}function Fn(t){if(t.length!==32)throw new c("bad_key","an X25519 secret is 32 bytes");return T.encode(Mt,T.toWords(t),!1).toUpperCase()}function Sr(t){let e=t.trim().toLowerCase(),o;try{o=T.decode(e,!1)}catch{throw new c("bad_key","not an age identity (AGE-SECRET-KEY-1…)")}if(o.prefix!==Mt)throw new c("bad_key",`not an age identity: prefix ${o.prefix}`);let n=T.fromWords(o.words);if(n.length!==32)throw new c("bad_key","an age identity carries 32 bytes");return n}function Ar(t){return $n(we.getPublicKey(t))}function ne(t,e){let o=we.utils.randomSecretKey(),n=null,r=null;try{let i=we.getPublicKey(o);try{n=we.getSharedSecret(o,e)}catch{throw new c("bad_key","low-order recipient point")}if(n.every((f)=>f===0))throw new c("bad_key","low-order recipient point");let s=new Uint8Array(64);s.set(i,0),s.set(e,32),r=qe(j,n,s,Q(St),32);let a=pt(r,new Uint8Array(12)).encrypt(t);return{share:i,body:a}}finally{o.fill(0),n?.fill(0),r?.fill(0)}}function Kt(t,e){let o=qe(j,t,new Uint8Array(0),Q("header"),32),n=Z(j,o,e);return o.fill(0),n}function Ht(t,e){let o=new Uint8Array(12),n=t;for(let r=10;r>=0&&n>0;r--)o[r]=n%256,n=Math.floor(n/256);return o[11]=e?1:0,o}function Pt(t){let e=new Uint8Array(t.reduce((n,r)=>n+r.length,0)),o=0;for(let n of t)e.set(n,o),o+=n.length;return e}function br(t,e){if(e.length===0)throw new c("bad_key","seal it for at least one recipient");let o=e.map(gr),n=crypto.getRandomValues(new Uint8Array(16));try{let r=[Mn];for(let b of o){let{share:g,body:w}=ne(n,b);r.push(`-> X25519 ${Ge.encode(g)}`,Ge.encode(w))}r.push("---");let i=Q(r.join(`
|
|
2
|
+
`)),s=Kt(n,i),a=Q(`${r.join(`
|
|
3
|
+
`)} ${Ge.encode(s)}
|
|
4
|
+
`),f=crypto.getRandomValues(new Uint8Array(16)),h=qe(j,n,f,Q("payload"),32),l=[a,f],y=Math.max(1,Math.ceil(t.length/wt));for(let b=0;b<y;b++){let g=t.subarray(b*wt,Math.min(t.length,(b+1)*wt));l.push(pt(h,Ht(b,b===y-1)).encrypt(g))}return h.fill(0),Pt(l)}finally{n.fill(0)}}var oe=1048576,re=/^[\x21-\x7e]+$/;function yr(t){let e=Math.min(t.length,oe),o=0,n=()=>{let f=o;while(f<e&&t[f]!==10){if(t[f]<32||t[f]>126)throw new c("malformed","header byte outside printable ASCII");f++}if(f>=e)throw new c("malformed","header runs off the end of the file");let h=vt.decode(t.subarray(o,f));return o=f+1,h};if(n()!==Mn)throw new c("malformed","not an age file: missing version line");let r=[],i=null,s=0;while(i===null){s=o;let f=n();if(f.startsWith("---")){i=f;break}if(!f.startsWith("-> "))throw new c("malformed","unexpected header line");let h=f.slice(3).split(" ");if(!h.every((w)=>re.test(w)))throw new c("malformed","stanza arguments must be non-empty visible ASCII");let[l,...y]=h,b=[];for(;;){let w=n();if(b.push(w),w.length<64)break;if(w.length>64)throw new c("malformed","stanza body line over 64 columns")}let g;try{g=Ge.decode(b.join(""))}catch{throw new c("malformed","stanza body is not base64")}if(r.push({type:l,args:y,body:g}),r.length>hr)throw new c("unsupported",`sealed for more than ${hr} readers`)}if(!i.startsWith("--- "))throw new c("malformed","header footer must be `--- ` and a MAC");let a;try{a=Ge.decode(i.slice(4))}catch{throw new c("malformed","header MAC is not base64")}if(a.length!==32)throw new c("malformed","header MAC is not 32 bytes");if(r.some((f)=>f.type==="scrypt")&&r.length!==1)throw new c("malformed","scrypt must be the only recipient");return{stanzas:r,mac:a,upToDashes:t.subarray(0,s+3),payload:t.subarray(o)}}function se(t,e){if(t.length!==e.length)return!1;let o=0;for(let n=0;n<t.length;n++)o|=t[n]^e[n];return o===0}function wr(t,e){if(e.length===0)throw new c("no_identity","no identity to open it with");let{stanzas:o,mac:n,upToDashes:r,payload:i}=yr(t),s=o.filter((h)=>h.type==="X25519");if(s.length===0){let h=[...new Set(o.map((l)=>l.type))].join(", ")||"none";throw new c("unsupported",`no X25519 recipient in this file (stanzas: ${h})`)}let a=null,f=e.map((h)=>we.getPublicKey(h));for(let h of s){if(h.args.length!==1||h.body.length!==32)throw new c("malformed","bad X25519 stanza");let l;try{l=Ge.decode(h.args[0])}catch{throw new c("malformed","X25519 share is not base64")}if(l.length!==32)throw new c("malformed","X25519 share is not 32 bytes");for(let y=0;y<e.length;y++){let b;try{b=we.getSharedSecret(e[y],l)}catch{throw new c("malformed","X25519 share is a low-order point")}if(b.every((m)=>m===0))throw new c("malformed","X25519 share is a low-order point");let g=new Uint8Array(64);g.set(l,0),g.set(f[y],32);let w=qe(j,b,g,Q(St),32);b.fill(0);try{a=pt(w,new Uint8Array(12)).decrypt(h.body)}catch{a=null}finally{w.fill(0)}if(a)break}if(a)break}if(!a)throw new c("no_identity","none of your keys opens this");try{if(!se(Kt(a,r),n))throw new c("tampered","header MAC does not match");if(i.length<16)throw new c("malformed","payload shorter than its nonce");let h=i.subarray(0,16),l=qe(j,a,h,Q("payload"),32);try{let y=i.subarray(16),b=wt+bt,g=[],w=0,m=0;for(;;){let E=y.length-m;if(E<bt)throw new c("malformed","payload chunk shorter than its tag");let U=E<=b,z=U?E:b;if(U&&z===bt&&w>0)throw new c("malformed","empty final chunk");try{g.push(pt(l,Ht(w,U)).decrypt(y.subarray(m,m+z)))}catch{throw new c("tampered",`payload chunk ${w} does not authenticate`)}if(m+=z,w++,U)break}return Pt(g)}finally{l.fill(0)}}finally{a.fill(0)}}function kr(t){let e=On.encode(t),o=[];for(let n=0;n<e.length;n+=64)o.push(e.slice(n,n+64));return[ot,...o,En].join(`
|
|
5
|
+
`)+`
|
|
6
|
+
`}function vr(t){let o=t.replace(/^[ \t\r\n]+|[ \t\r\n]+$/g,"").replace(/\r\n/g,`
|
|
7
|
+
`);if(o.includes("\r"))throw new c("malformed","armor: a bare carriage return");let n=o.split(`
|
|
8
|
+
`);if(n.length<3||n[0]!==ot||n[n.length-1]!==En)throw new c("malformed","no armored age block found");let r=n.slice(1,-1);for(let i=0;i<r.length;i++){let s=i===r.length-1;if(r[i].length>64||!s&&r[i].length!==64||r[i].length===0)throw new c("malformed","armor: lines must be 64 columns, the last 1-64");if(!/^[A-Za-z0-9+/=]+$/.test(r[i]))throw new c("malformed","armored body is not base64")}try{return On.decode(r.join(""))}catch{throw new c("malformed","armored body is not base64")}}function xr(t){let e=t.replace(/\r\n?/g,`
|
|
9
|
+
`),o=e.indexOf(ot),n=e.indexOf(En,o<0?0:o);if(o<0||n<0)throw new c("malformed","no armored age block found");let r=e.slice(o+ot.length,n).split(`
|
|
10
|
+
`).map((i)=>i.trim()).filter((i)=>i.length>0);if(r.length===0)throw new c("malformed","armored block is empty");return[ot,...r,En].join(`
|
|
11
|
+
`)}function Er(t){let e=t.trimStart();return e.startsWith(ot)||e.startsWith(Mn)}function $r(t,e){return kr(br(Q(t),e))}function _r(t,e){let o=t.includes(ot)?vr(xr(t)):Q(t);return wr(o,e)}function Tr(t,e){return vt.decode(_r(t,e))}
|
|
12
|
+
export{qe,Mn,ot,En,hr,c,$n,gr,Fn,Sr,Ar,br,yr,wr,kr,vr,xr,Er,$r,_r,Tr};
|