n.eql(x,n.ZERO);return v(h)&&v(w)?f.ZERO:new f(h,w,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(u){const h=n.invertBatch(u.map(w=>w.pz));return u.map((w,v)=>w.toAffine(h[v])).map(f.fromAffine)}static fromHex(u){const h=f.fromAffine(o(at("pointHex",u)));return h.assertValidity(),h}static fromPrivateKey(u){return f.BASE.multiply(c(u))}_setWindowSize(u){this._WINDOW_SIZE=u,l.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint)return;throw new Error("bad point: ZERO")}const{x:u,y:h}=this.toAffine();if(!n.isValid(u)||!n.isValid(h))throw new Error("bad point: x or y not FE");const w=n.sqr(h),v=i(u);if(!n.eql(w,v))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:u}=this.toAffine();if(n.isOdd)return!n.isOdd(u);throw new Error("Field doesn't support isOdd")}equals(u){d(u);const{px:h,py:w,pz:v}=this,{px:x,py:I,pz:B}=u,E=n.eql(n.mul(h,B),n.mul(x,v)),A=n.eql(n.mul(w,B),n.mul(I,v));return E&&A}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:u,b:h}=t,w=n.mul(h,jn),{px:v,py:x,pz:I}=this;let B=n.ZERO,E=n.ZERO,A=n.ZERO,S=n.mul(v,v),C=n.mul(x,x),U=n.mul(I,I),T=n.mul(v,x);return T=n.add(T,T),A=n.mul(v,I),A=n.add(A,A),B=n.mul(u,A),E=n.mul(w,U),E=n.add(B,E),B=n.sub(C,E),E=n.add(C,E),E=n.mul(B,E),B=n.mul(T,B),A=n.mul(w,A),U=n.mul(u,U),T=n.sub(S,U),T=n.mul(u,T),T=n.add(T,A),A=n.add(S,S),S=n.add(A,S),S=n.add(S,U),S=n.mul(S,T),E=n.add(E,S),U=n.mul(x,I),U=n.add(U,U),S=n.mul(U,T),B=n.sub(B,S),A=n.mul(U,C),A=n.add(A,A),A=n.add(A,A),new f(B,E,A)}add(u){d(u);const{px:h,py:w,pz:v}=this,{px:x,py:I,pz:B}=u;let E=n.ZERO,A=n.ZERO,S=n.ZERO;const C=t.a,U=n.mul(t.b,jn);let T=n.mul(h,x),K=n.mul(w,I),R=n.mul(v,B),z=n.add(h,w),p=n.add(x,I);z=n.mul(z,p),p=n.add(T,K),z=n.sub(z,p),p=n.add(h,v);let m=n.add(x,B);return p=n.mul(p,m),m=n.add(T,R),p=n.sub(p,m),m=n.add(w,v),E=n.add(I,B),m=n.mul(m,E),E=n.add(K,R),m=n.sub(m,E),S=n.mul(C,p),E=n.mul(U,R),S=n.add(E,S),E=n.sub(K,S),S=n.add(K,S),A=n.mul(E,S),K=n.add(T,T),K=n.add(K,T),R=n.mul(C,R),p=n.mul(U,p),K=n.add(K,R),R=n.sub(T,R),R=n.mul(C,R),p=n.add(p,R),T=n.mul(K,p),A=n.add(A,T),T=n.mul(m,p),E=n.mul(z,E),E=n.sub(E,T),T=n.mul(z,K),S=n.mul(m,S),S=n.add(S,T),new f(E,A,S)}subtract(u){return this.add(u.negate())}is0(){return this.equals(f.ZERO)}wNAF(u){return g.wNAFCached(this,l,u,h=>{const w=n.invertBatch(h.map(v=>v.pz));return h.map((v,x)=>v.toAffine(w[x])).map(f.fromAffine)})}multiplyUnsafe(u){const h=f.ZERO;if(u===wt)return h;if(a(u),u===ct)return this;const{endo:w}=t;if(!w)return g.unsafeLadder(this,u);let{k1neg:v,k1:x,k2neg:I,k2:B}=w.splitScalar(u),E=h,A=h,S=this;for(;x>wt||B>wt;)x&ct&&(E=E.add(S)),B&ct&&(A=A.add(S)),S=S.double(),x>>=ct,B>>=ct;return v&&(E=E.negate()),I&&(A=A.negate()),A=new f(n.mul(A.px,w.beta),A.py,A.pz),E.add(A)}multiply(u){a(u);let h=u,w,v;const{endo:x}=t;if(x){const{k1neg:I,k1:B,k2neg:E,k2:A}=x.splitScalar(h);let{p:S,f:C}=this.wNAF(B),{p:U,f:T}=this.wNAF(A);S=g.constTimeNegate(I,S),U=g.constTimeNegate(E,U),U=new f(n.mul(U.px,x.beta),U.py,U.pz),w=S.add(U),v=C.add(T)}else{const{p:I,f:B}=this.wNAF(h);w=I,v=B}return f.normalizeZ([w,v])[0]}multiplyAndAddUnsafe(u,h,w){const v=f.BASE,x=(B,E)=>E===wt||E===ct||!B.equals(v)?B.multiplyUnsafe(E):B.multiply(E),I=x(this,h).add(x(u,w));return I.is0()?void 0:I}toAffine(u){const{px:h,py:w,pz:v}=this,x=this.is0();u==null&&(u=x?n.ONE:n.inv(v));const I=n.mul(h,u),B=n.mul(w,u),E=n.mul(v,u);if(x)return{x:n.ZERO,y:n.ZERO};if(!n.eql(E,n.ONE))throw new Error("invZ was invalid");return{x:I,y:B}}isTorsionFree(){const{h:u,isTorsionFree:h}=t;if(u===ct)return!0;if(h)return h(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:u,clearCofactor:h}=t;return u===ct?this:h?h(f,this):this.multiplyUnsafe(t.h)}toRawBytes(u=!0){return this.assertValidity(),r(f,this,u)}toHex(u=!0){return Yt(this.toRawBytes(u))}}f.BASE=new f(t.Gx,t.Gy,n.ONE),f.ZERO=new f(n.ZERO,n.ONE,n.ZERO);const b=t.nBitLength,g=Ki(f,t.endo?Math.ceil(b/2):b);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:i,isWithinCurveOrder:s}}function ji(e){const t=pr(e);return le(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Vi(e){const t=ji(e),{Fp:n,n:r}=t,o=n.BYTES+1,i=2*n.BYTES+1;function s(p){return wtYt(Gt(p,t.nByteLength));function y(p){const m=r>>ct;return p>m}function u(p){return y(p)?a(-p):p}const h=(p,m,$)=>Dt(p.slice(m,$));class w{constructor(m,$,N){this.r=m,this.s=$,this.recovery=N,this.assertValidity()}static fromCompact(m){const $=t.nByteLength;return m=at("compactSignature",m,$*2),new w(h(m,0,$),h(m,$,2*$))}static fromDER(m){const{r:$,s:N}=Kt.toSig(at("DER",m));return new w($,N)}assertValidity(){if(!b(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!b(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(m){return new w(this.r,this.s,m)}recoverPublicKey(m){const{r:$,s:N,recovery:H}=this,k=A(at("msgHash",m));if(H==null||![0,1,2,3].includes(H))throw new Error("recovery id invalid");const q=H===2||H===3?$+t.n:$;if(q>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const D=H&1?"03":"02",Z=l.fromHex(D+g(q)),G=c(q),et=a(-k*G),ft=a(N*G),Y=l.BASE.multiplyAndAddUnsafe(Z,et,ft);if(!Y)throw new Error("point at infinify");return Y.assertValidity(),Y}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Wt(this.toDERHex())}toDERHex(){return Kt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Wt(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}const v={isValidPrivateKey(p){try{return d(p),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const p=t.randomBytes(n.BYTES+8),m=ki(p,r);return Gt(m,t.nByteLength)},precompute(p=8,m=l.BASE){return m._setWindowSize(p),m.multiply(BigInt(3)),m}};function x(p,m=!0){return l.fromPrivateKey(p).toRawBytes(m)}function I(p){const m=p instanceof Uint8Array,$=typeof p=="string",N=(m||$)&&p.length;return m?N===o||N===i:$?N===2*o||N===2*i:p instanceof l}function B(p,m,$=!0){if(I(p))throw new Error("first arg must be private key");if(!I(m))throw new Error("second arg must be public key");return l.fromHex(m).multiply(d(p)).toRawBytes($)}const E=t.bits2int||function(p){const m=Dt(p),$=p.length*8-t.nBitLength;return $>0?m>>BigInt($):m},A=t.bits2int_modN||function(p){return a(E(p))},S=yn(t.nBitLength);function C(p){if(typeof p!="bigint")throw new Error("bigint expected");if(!(wt<=p&&pX in $))throw new Error("sign() legacy options not supported");const{hash:N,randomBytes:H}=t;let{lowS:k,prehash:q,extraEntropy:D}=$;k==null&&(k=!0),p=at("msgHash",p),q&&(p=at("prehashed msgHash",N(p)));const Z=A(p),G=d(m),et=[C(G),C(Z)];if(D!=null){const X=D===!0?H(n.BYTES):D;et.push(at("extraEntropy",X,n.BYTES))}const ft=ae(...et),Y=Z;function Ut(X){const nt=E(X);if(!b(nt))return;const Qt=c(nt),rt=l.BASE.multiply(nt).toAffine(),j=a(rt.x);if(j===wt)return;const ot=a(Qt*a(Y+j*G));if(ot===wt)return;let te=(rt.x===j?0:2)|Number(rt.y&ct),ee=ot;return k&&y(ot)&&(ee=u(ot),te^=1),new w(j,ee,te)}return{seed:ft,k2sig:Ut}}const T={lowS:t.lowS,prehash:!1},K={lowS:t.lowS,prehash:!1};function R(p,m,$=T){const{seed:N,k2sig:H}=U(p,m,$),k=t;return hr(k.hash.outputLen,k.nByteLength,k.hmac)(N,H)}l.BASE._setWindowSize(8);function z(p,m,$,N=K){var rt;const H=p;if(m=at("msgHash",m),$=at("publicKey",$),"strict"in N)throw new Error("options.strict was renamed to lowS");const{lowS:k,prehash:q}=N;let D,Z;try{if(typeof H=="string"||H instanceof Uint8Array)try{D=w.fromDER(H)}catch(j){if(!(j instanceof Kt.Err))throw j;D=w.fromCompact(H)}else if(typeof H=="object"&&typeof H.r=="bigint"&&typeof H.s=="bigint"){const{r:j,s:ot}=H;D=new w(j,ot)}else throw new Error("PARSE");Z=l.fromHex($)}catch(j){if(j.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(k&&D.hasHighS())return!1;q&&(m=t.hash(m));const{r:G,s:et}=D,ft=A(m),Y=c(et),Ut=a(ft*Y),X=a(G*Y),nt=(rt=l.BASE.multiplyAndAddUnsafe(Z,Ut,X))==null?void 0:rt.toAffine();return nt?a(nt.x)===G:!1}return{CURVE:t,getPublicKey:x,getSharedSecret:B,sign:R,verify:z,ProjectivePoint:l,Signature:w,utils:v}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function _i(e){return{hash:e,hmac:(t,...n)=>se(e,t,oe(...n)),randomBytes:ao}}function zi(e,t){const n=r=>Vi({...e,..._i(r)});return Object.freeze({...n(t),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gr=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Vn=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Fi=BigInt(1),en=BigInt(2),_n=(e,t)=>(e+t/en)/t;function Mi(e){const t=gr,n=BigInt(3),r=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),l=e*e*e%t,d=l*l*e%t,f=it(d,n,t)*d%t,b=it(f,n,t)*d%t,g=it(b,en,t)*l%t,y=it(g,o,t)*g%t,u=it(y,i,t)*y%t,h=it(u,a,t)*u%t,w=it(h,c,t)*h%t,v=it(w,a,t)*u%t,x=it(v,n,t)*d%t,I=it(x,s,t)*y%t,B=it(I,r,t)*l%t,E=it(B,en,t);if(!nn.eql(nn.sqr(E),e))throw new Error("Cannot find square root");return E}const nn=Ci(gr,void 0,void 0,{sqrt:Mi}),pt=zi({a:BigInt(0),b:BigInt(7),Fp:nn,n:Vn,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Vn,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Fi*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,s=BigInt("0x100000000000000000000000000000000"),a=_n(i*e,t),c=_n(-r*e,t);let l=Q(e-a*n-c*o,t),d=Q(-a*r-c*i,t);const f=l>s,b=d>s;if(f&&(l=t-l),b&&(d=t-d),l>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:l,k2neg:b,k2:d}}}},Ae);BigInt(0);pt.ProjectivePoint;const we=pt.ProjectivePoint,De=ti(Ae);function zn(e){return BigInt(`0x${Zt(e)}`)}function Zi(e){return oo(e.toString(16).padStart(64,"0"))}const Gi=Qn("Bitcoin seed"),Pe={private:76066276,public:76067358},je=2147483648,Yi=e=>pi(Ae(e)),Wi=e=>qt(e).getUint32(0,!1),be=e=>{if(!Number.isSafeInteger(e)||e<0||e>2**32-1)throw new Error(`Invalid number=${e}. Should be from 0 to 2 ** 32 - 1`);const t=new Uint8Array(4);return qt(t).setUint32(0,e,!1),t};class kt{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return Wi(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const t=this.privateKey;if(!t)throw new Error("No private key");return De.encode(this.serialize(this.versions.private,oe(new Uint8Array([0]),t)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return De.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(t,n=Pe){if(Lt(t),8*t.length<128||8*t.length>512)throw new Error(`HDKey: wrong seed length=${t.length}. Should be between 128 and 512 bits; 256 bits is advised)`);const r=se(We,Gi,t);return new kt({versions:n,chainCode:r.slice(32),privateKey:r.slice(0,32)})}static fromExtendedKey(t,n=Pe){const r=De.decode(t),o=qt(r),i=o.getUint32(0,!1),s={versions:n,depth:r[4],parentFingerprint:o.getUint32(5,!1),index:o.getUint32(9,!1),chainCode:r.slice(13,45)},a=r.slice(45),c=a[0]===0;if(i!==n[c?"private":"public"])throw new Error("Version mismatch");return c?new kt({...s,privateKey:a.slice(1)}):new kt({...s,publicKey:a})}static fromJSON(t){return kt.fromExtendedKey(t.xpriv)}constructor(t){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!t||typeof t!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=t.versions||Pe,this.depth=t.depth||0,this.chainCode=t.chainCode,this.index=t.index||0,this.parentFingerprint=t.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(t.publicKey&&t.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(t.privateKey){if(!pt.utils.isValidPrivateKey(t.privateKey))throw new Error("Invalid private key");this.privKey=typeof t.privateKey=="bigint"?t.privateKey:zn(t.privateKey),this.privKeyBytes=Zi(this.privKey),this.pubKey=pt.getPublicKey(t.privateKey,!0)}else if(t.publicKey)this.pubKey=we.fromHex(t.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=Yi(this.pubKey)}derive(t){if(!/^[mM]'?/.test(t))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(t))return this;const n=t.replace(/^[mM]'?\//,"").split("/");let r=this;for(const o of n){const i=/^(\d+)('?)$/.exec(o);if(!i||i.length!==3)throw new Error(`Invalid child index: ${o}`);let s=+i[1];if(!Number.isSafeInteger(s)||s>=je)throw new Error("Invalid index");i[2]==="'"&&(s+=je),r=r.deriveChild(s)}return r}deriveChild(t){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let n=be(t);if(t>=je){const a=this.privateKey;if(!a)throw new Error("Could not derive hardened child key");n=oe(new Uint8Array([0]),a,n)}else n=oe(this.pubKey,n);const r=se(We,this.chainCode,n),o=zn(r.slice(0,32)),i=r.slice(32);if(!pt.utils.isValidPrivateKey(o))throw new Error("Tweak bigger than curve order");const s={versions:this.versions,chainCode:i,depth:this.depth+1,parentFingerprint:this.fingerprint,index:t};try{if(this.privateKey){const a=Q(this.privKey+o,pt.CURVE.n);if(!pt.utils.isValidPrivateKey(a))throw new Error("The tweak was out of range or the resulted private key is invalid");s.privateKey=a}else{const a=we.fromHex(this.pubKey).add(we.fromPrivateKey(o));if(a.equals(we.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");s.publicKey=a.toRawBytes(!0)}return new kt(s)}catch{return this.deriveChild(t+1)}}sign(t){if(!this.privateKey)throw new Error("No privateKey set!");return Lt(t,32),pt.sign(t,this.privKey).toCompactRawBytes()}verify(t,n){if(Lt(t,32),Lt(n,64),!this.publicKey)throw new Error("No publicKey set!");let r;try{r=pt.Signature.fromCompact(n)}catch{return!1}return pt.verify(r,t,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(t,n){if(!this.chainCode)throw new Error("No chainCode set");return Lt(n,33),oe(be(t),new Uint8Array([this.depth]),be(this.parentFingerprint),be(this.index),this.chainCode,n)}}var Ji="m/44'/1237'";function Fn(e,t,n=0){const o=kt.fromMasterSeed(si(e,t)).derive(`${Ji}/${n}'/0/0`),i=Zt(o.publicKey.slice(1)),s=o.privateKey;if(!s||!i)throw new Error("could not derive key pair");return{privateKey:s,publicKey:i}}function Mn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function wr(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function Xi(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Mn(e.outputLen),Mn(e.blockLen)}function xe(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Qi(e,t){wr(e);const n=t.outputLen;if(e.lengthe instanceof Uint8Array,_e=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),ht=(e,t)=>e<<32-t|e>>>t,ts=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!ts)throw new Error("Non little-endian hardware is not supported");function es(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function xn(e){if(typeof e=="string"&&(e=es(e)),!br(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function ns(...e){const t=new Uint8Array(e.reduce((r,o)=>r+o.length,0));let n=0;return e.forEach(r=>{if(!br(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}class yr{clone(){return this._cloneInto()}}function rs(e){const t=r=>e().update(xn(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function mr(e=32){if(Ve&&typeof Ve.getRandomValues=="function")return Ve.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function os(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),i=BigInt(4294967295),s=Number(n>>o&i),a=Number(n&i),c=r?4:0,l=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+l,a,r)}class is extends yr{constructor(t,n,r,o){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=_e(this.buffer)}update(t){xe(this);const{view:n,buffer:r,blockLen:o}=this;t=xn(t);const i=t.length;for(let s=0;so-s&&(this.process(r,0),s=0);for(let f=s;fd.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;fe&t^~e&n,as=(e,t,n)=>e&t^e&n^t&n,cs=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),St=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),It=new Uint32Array(64);class ls extends is{constructor(){super(64,32,8,!1),this.A=St[0]|0,this.B=St[1]|0,this.C=St[2]|0,this.D=St[3]|0,this.E=St[4]|0,this.F=St[5]|0,this.G=St[6]|0,this.H=St[7]|0}get(){const{A:t,B:n,C:r,D:o,E:i,F:s,G:a,H:c}=this;return[t,n,r,o,i,s,a,c]}set(t,n,r,o,i,s,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=i|0,this.F=s|0,this.G=a|0,this.H=c|0}process(t,n){for(let f=0;f<16;f++,n+=4)It[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const b=It[f-15],g=It[f-2],y=ht(b,7)^ht(b,18)^b>>>3,u=ht(g,17)^ht(g,19)^g>>>10;It[f]=u+It[f-7]+y+It[f-16]|0}let{A:r,B:o,C:i,D:s,E:a,F:c,G:l,H:d}=this;for(let f=0;f<64;f++){const b=ht(a,6)^ht(a,11)^ht(a,25),g=d+b+ss(a,c,l)+cs[f]+It[f]|0,u=(ht(r,2)^ht(r,13)^ht(r,22))+as(r,o,i)|0;d=l,l=c,c=a,a=s+g|0,s=i,i=o,o=r,r=g+u|0}r=r+this.A|0,o=o+this.B|0,i=i+this.C|0,s=s+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(r,o,i,s,a,c,l,d)}roundClean(){It.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const rn=rs(()=>new ls);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const xr=BigInt(0),Ue=BigInt(1),fs=BigInt(2),He=e=>e instanceof Uint8Array,us=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Jt(e){if(!He(e))throw new Error("Uint8Array expected");let t="";for(let n=0;nr+o.length,0));let n=0;return e.forEach(r=>{if(!He(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}function hs(e,t){if(e.length!==t.length)return!1;for(let n=0;nxr;e>>=Ue,t+=1);return t}function ws(e,t){return e>>BigInt(t)&Ue}const bs=(e,t,n)=>e|(n?Ue:xr)<(fs<new Uint8Array(e),Zn=e=>Uint8Array.from(e);function vr(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=ze(e),o=ze(e),i=0;const s=()=>{r.fill(1),o.fill(0),i=0},a=(...f)=>n(o,r,...f),c=(f=ze())=>{o=a(Zn([0]),f),r=a(),f.length!==0&&(o=a(Zn([1]),f),r=a())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const b=[];for(;f{s(),c(f);let g;for(;!(g=b(l()));)c();return s(),g}}const ys={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function fe(e,t,n={}){const r=(o,i,s)=>{const a=ys[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);const c=e[o];if(!(s&&c===void 0)&&!a(c,e))throw new Error(`Invalid param ${String(o)}=${c} (${typeof c}), expected ${i}`)};for(const[o,i]of Object.entries(t))r(o,i,!1);for(const[o,i]of Object.entries(n))r(o,i,!0);return e}const ms=Object.freeze(Object.defineProperty({__proto__:null,bitGet:ws,bitLen:gs,bitMask:An,bitSet:bs,bytesToHex:Jt,bytesToNumberBE:tt,bytesToNumberLE:vn,concatBytes:Pt,createHmacDrbg:vr,ensureBytes:J,equalBytes:hs,hexToBytes:Xt,hexToNumber:En,numberToBytesBE:$t,numberToBytesLE:Bn,numberToHexUnpadded:Er,numberToVarBytesBE:ds,utf8ToBytes:ps,validateObject:fe},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const M=BigInt(0),_=BigInt(1),Ot=BigInt(2),xs=BigInt(3),on=BigInt(4),Gn=BigInt(5),Yn=BigInt(8);BigInt(9);BigInt(16);function W(e,t){const n=e%t;return n>=M?n:t+n}function Es(e,t,n){if(n<=M||t 0");if(n===_)return M;let r=_;for(;t>M;)t&_&&(r=r*e%n),e=e*e%n,t>>=_;return r}function st(e,t,n){let r=e;for(;t-- >M;)r*=r,r%=n;return r}function sn(e,t){if(e===M||t<=M)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=W(e,t),r=t,o=M,i=_;for(;n!==M;){const a=r/n,c=r%n,l=o-i*a;r=n,n=c,o=i,i=l}if(r!==_)throw new Error("invert: does not exist");return W(o,t)}function vs(e){const t=(e-_)/Ot;let n,r,o;for(n=e-_,r=0;n%Ot===M;n/=Ot,r++);for(o=Ot;o(r[o]="function",r),t);return fe(e,n)}function Is(e,t,n){if(n 0");if(n===M)return e.ONE;if(n===_)return t;let r=e.ONE,o=t;for(;n>M;)n&_&&(r=e.mul(r,o)),o=e.sqr(o),n>>=_;return r}function $s(e,t){const n=new Array(t.length),r=t.reduce((i,s,a)=>e.is0(s)?i:(n[a]=i,e.mul(i,s)),e.ONE),o=e.inv(r);return t.reduceRight((i,s,a)=>e.is0(s)?i:(n[a]=e.mul(i,n[a]),e.mul(i,s)),o),n}function Br(e,t){const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Ts(e,t,n=!1,r={}){if(e<=M)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:o,nByteLength:i}=Br(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=Bs(e),a=Object.freeze({ORDER:e,BITS:o,BYTES:i,MASK:An(o),ZERO:M,ONE:_,create:c=>W(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return M<=c&&cc===M,isOdd:c=>(c&_)===_,neg:c=>W(-c,e),eql:(c,l)=>c===l,sqr:c=>W(c*c,e),add:(c,l)=>W(c+l,e),sub:(c,l)=>W(c-l,e),mul:(c,l)=>W(c*l,e),pow:(c,l)=>Is(a,c,l),div:(c,l)=>W(c*sn(l,e),e),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>sn(c,e),sqrt:r.sqrt||(c=>s(a,c)),invertBatch:c=>$s(a,c),cmov:(c,l,d)=>d?l:c,toBytes:c=>n?Bn(c,i):$t(c,i),fromBytes:c=>{if(c.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${c.length}`);return n?vn(c):tt(c)}});return Object.freeze(a)}function Ar(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function Sr(e){const t=Ar(e);return t+Math.ceil(t/2)}function Us(e,t,n=!1){const r=e.length,o=Ar(t),i=Sr(t);if(r<16||r1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);const s=n?tt(e):vn(e),a=W(s,t-_)+_;return n?Bn(a,o):$t(a,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Hs=BigInt(0),Fe=BigInt(1);function Ns(e,t){const n=(o,i)=>{const s=i.negate();return o?s:i},r=o=>{const i=Math.ceil(t/o)+1,s=2**(o-1);return{windows:i,windowSize:s}};return{constTimeNegate:n,unsafeLadder(o,i){let s=e.ZERO,a=o;for(;i>Hs;)i&Fe&&(s=s.add(a)),a=a.double(),i>>=Fe;return s},precomputeWindow(o,i){const{windows:s,windowSize:a}=r(i),c=[];let l=o,d=l;for(let f=0;f>=g,h>c&&(h-=b,s+=Fe);const w=u,v=u+Math.abs(h)-1,x=y%2!==0,I=h<0;h===0?d=d.add(n(x,i[w])):l=l.add(n(I,i[v]))}return{p:l,f:d}},wNAFCached(o,i,s,a){const c=o._WINDOW_SIZE||1;let l=i.get(o);return l||(l=this.precomputeWindow(o,c),c!==1&&i.set(o,a(l))),this.wNAF(c,l,s)}}}function Ir(e){return Ss(e.Fp),fe(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Br(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ls(e){const t=Ir(e);fe(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:o}=t;if(n){if(!r.eql(o,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:Cs,hexToBytes:ks}=ms,Rt={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(e){const{Err:t}=Rt;if(e.length<2||e[0]!==2)throw new t("Invalid signature integer tag");const n=e[1],r=e.subarray(2,n+2);if(!n||r.length!==n)throw new t("Invalid signature integer: wrong length");if(r[0]&128)throw new t("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Cs(r),l:e.subarray(n+2)}},toSig(e){const{Err:t}=Rt,n=typeof e=="string"?ks(e):e;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||n[0]!=48)throw new t("Invalid signature tag");if(n[1]!==r-2)throw new t("Invalid signature: incorrect length");const{d:o,l:i}=Rt._parseInt(n.subarray(2)),{d:s,l:a}=Rt._parseInt(i);if(a.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s}},hexFromSig(e){const t=l=>Number.parseInt(l[0],16)&8?"00"+l:l,n=l=>{const d=l.toString(16);return d.length&1?`0${d}`:d},r=t(n(e.s)),o=t(n(e.r)),i=r.length/2,s=o.length/2,a=n(i),c=n(s);return`30${n(s+i+4)}02${c}${o}02${a}${r}`}},bt=BigInt(0),lt=BigInt(1);BigInt(2);const Wn=BigInt(3);BigInt(4);function Os(e){const t=Ls(e),{Fp:n}=t,r=t.toBytes||((y,u,h)=>{const w=u.toAffine();return Pt(Uint8Array.from([4]),n.toBytes(w.x),n.toBytes(w.y))}),o=t.fromBytes||(y=>{const u=y.subarray(1),h=n.fromBytes(u.subarray(0,n.BYTES)),w=n.fromBytes(u.subarray(n.BYTES,2*n.BYTES));return{x:h,y:w}});function i(y){const{a:u,b:h}=t,w=n.sqr(y),v=n.mul(w,y);return n.add(n.add(v,n.mul(y,u)),h)}if(!n.eql(n.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function s(y){return typeof y=="bigint"&&btn.eql(x,n.ZERO);return v(h)&&v(w)?f.ZERO:new f(h,w,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(u){const h=n.invertBatch(u.map(w=>w.pz));return u.map((w,v)=>w.toAffine(h[v])).map(f.fromAffine)}static fromHex(u){const h=f.fromAffine(o(J("pointHex",u)));return h.assertValidity(),h}static fromPrivateKey(u){return f.BASE.multiply(c(u))}_setWindowSize(u){this._WINDOW_SIZE=u,l.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:u,y:h}=this.toAffine();if(!n.isValid(u)||!n.isValid(h))throw new Error("bad point: x or y not FE");const w=n.sqr(h),v=i(u);if(!n.eql(w,v))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:u}=this.toAffine();if(n.isOdd)return!n.isOdd(u);throw new Error("Field doesn't support isOdd")}equals(u){d(u);const{px:h,py:w,pz:v}=this,{px:x,py:I,pz:B}=u,E=n.eql(n.mul(h,B),n.mul(x,v)),A=n.eql(n.mul(w,B),n.mul(I,v));return E&&A}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:u,b:h}=t,w=n.mul(h,Wn),{px:v,py:x,pz:I}=this;let B=n.ZERO,E=n.ZERO,A=n.ZERO,S=n.mul(v,v),C=n.mul(x,x),U=n.mul(I,I),T=n.mul(v,x);return T=n.add(T,T),A=n.mul(v,I),A=n.add(A,A),B=n.mul(u,A),E=n.mul(w,U),E=n.add(B,E),B=n.sub(C,E),E=n.add(C,E),E=n.mul(B,E),B=n.mul(T,B),A=n.mul(w,A),U=n.mul(u,U),T=n.sub(S,U),T=n.mul(u,T),T=n.add(T,A),A=n.add(S,S),S=n.add(A,S),S=n.add(S,U),S=n.mul(S,T),E=n.add(E,S),U=n.mul(x,I),U=n.add(U,U),S=n.mul(U,T),B=n.sub(B,S),A=n.mul(U,C),A=n.add(A,A),A=n.add(A,A),new f(B,E,A)}add(u){d(u);const{px:h,py:w,pz:v}=this,{px:x,py:I,pz:B}=u;let E=n.ZERO,A=n.ZERO,S=n.ZERO;const C=t.a,U=n.mul(t.b,Wn);let T=n.mul(h,x),K=n.mul(w,I),R=n.mul(v,B),z=n.add(h,w),p=n.add(x,I);z=n.mul(z,p),p=n.add(T,K),z=n.sub(z,p),p=n.add(h,v);let m=n.add(x,B);return p=n.mul(p,m),m=n.add(T,R),p=n.sub(p,m),m=n.add(w,v),E=n.add(I,B),m=n.mul(m,E),E=n.add(K,R),m=n.sub(m,E),S=n.mul(C,p),E=n.mul(U,R),S=n.add(E,S),E=n.sub(K,S),S=n.add(K,S),A=n.mul(E,S),K=n.add(T,T),K=n.add(K,T),R=n.mul(C,R),p=n.mul(U,p),K=n.add(K,R),R=n.sub(T,R),R=n.mul(C,R),p=n.add(p,R),T=n.mul(K,p),A=n.add(A,T),T=n.mul(m,p),E=n.mul(z,E),E=n.sub(E,T),T=n.mul(z,K),S=n.mul(m,S),S=n.add(S,T),new f(E,A,S)}subtract(u){return this.add(u.negate())}is0(){return this.equals(f.ZERO)}wNAF(u){return g.wNAFCached(this,l,u,h=>{const w=n.invertBatch(h.map(v=>v.pz));return h.map((v,x)=>v.toAffine(w[x])).map(f.fromAffine)})}multiplyUnsafe(u){const h=f.ZERO;if(u===bt)return h;if(a(u),u===lt)return this;const{endo:w}=t;if(!w)return g.unsafeLadder(this,u);let{k1neg:v,k1:x,k2neg:I,k2:B}=w.splitScalar(u),E=h,A=h,S=this;for(;x>bt||B>bt;)x<&&(E=E.add(S)),B<&&(A=A.add(S)),S=S.double(),x>>=lt,B>>=lt;return v&&(E=E.negate()),I&&(A=A.negate()),A=new f(n.mul(A.px,w.beta),A.py,A.pz),E.add(A)}multiply(u){a(u);let h=u,w,v;const{endo:x}=t;if(x){const{k1neg:I,k1:B,k2neg:E,k2:A}=x.splitScalar(h);let{p:S,f:C}=this.wNAF(B),{p:U,f:T}=this.wNAF(A);S=g.constTimeNegate(I,S),U=g.constTimeNegate(E,U),U=new f(n.mul(U.px,x.beta),U.py,U.pz),w=S.add(U),v=C.add(T)}else{const{p:I,f:B}=this.wNAF(h);w=I,v=B}return f.normalizeZ([w,v])[0]}multiplyAndAddUnsafe(u,h,w){const v=f.BASE,x=(B,E)=>E===bt||E===lt||!B.equals(v)?B.multiplyUnsafe(E):B.multiply(E),I=x(this,h).add(x(u,w));return I.is0()?void 0:I}toAffine(u){const{px:h,py:w,pz:v}=this,x=this.is0();u==null&&(u=x?n.ONE:n.inv(v));const I=n.mul(h,u),B=n.mul(w,u),E=n.mul(v,u);if(x)return{x:n.ZERO,y:n.ZERO};if(!n.eql(E,n.ONE))throw new Error("invZ was invalid");return{x:I,y:B}}isTorsionFree(){const{h:u,isTorsionFree:h}=t;if(u===lt)return!0;if(h)return h(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:u,clearCofactor:h}=t;return u===lt?this:h?h(f,this):this.multiplyUnsafe(t.h)}toRawBytes(u=!0){return this.assertValidity(),r(f,this,u)}toHex(u=!0){return Jt(this.toRawBytes(u))}}f.BASE=new f(t.Gx,t.Gy,n.ONE),f.ZERO=new f(n.ZERO,n.ONE,n.ZERO);const b=t.nBitLength,g=Ns(f,t.endo?Math.ceil(b/2):b);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:i,isWithinCurveOrder:s}}function Ks(e){const t=Ir(e);return fe(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Rs(e){const t=Ks(e),{Fp:n,n:r}=t,o=n.BYTES+1,i=2*n.BYTES+1;function s(p){return btJt($t(p,t.nByteLength));function y(p){const m=r>>lt;return p>m}function u(p){return y(p)?a(-p):p}const h=(p,m,$)=>tt(p.slice(m,$));class w{constructor(m,$,N){this.r=m,this.s=$,this.recovery=N,this.assertValidity()}static fromCompact(m){const $=t.nByteLength;return m=J("compactSignature",m,$*2),new w(h(m,0,$),h(m,$,2*$))}static fromDER(m){const{r:$,s:N}=Rt.toSig(J("DER",m));return new w($,N)}assertValidity(){if(!b(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!b(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(m){return new w(this.r,this.s,m)}recoverPublicKey(m){const{r:$,s:N,recovery:H}=this,k=A(J("msgHash",m));if(H==null||![0,1,2,3].includes(H))throw new Error("recovery id invalid");const q=H===2||H===3?$+t.n:$;if(q>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const D=H&1?"03":"02",Z=l.fromHex(D+g(q)),G=c(q),et=a(-k*G),ft=a(N*G),Y=l.BASE.multiplyAndAddUnsafe(Z,et,ft);if(!Y)throw new Error("point at infinify");return Y.assertValidity(),Y}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Xt(this.toDERHex())}toDERHex(){return Rt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Xt(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}const v={isValidPrivateKey(p){try{return d(p),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const p=Sr(t.n);return Us(t.randomBytes(p),t.n)},precompute(p=8,m=l.BASE){return m._setWindowSize(p),m.multiply(BigInt(3)),m}};function x(p,m=!0){return l.fromPrivateKey(p).toRawBytes(m)}function I(p){const m=p instanceof Uint8Array,$=typeof p=="string",N=(m||$)&&p.length;return m?N===o||N===i:$?N===2*o||N===2*i:p instanceof l}function B(p,m,$=!0){if(I(p))throw new Error("first arg must be private key");if(!I(m))throw new Error("second arg must be public key");return l.fromHex(m).multiply(d(p)).toRawBytes($)}const E=t.bits2int||function(p){const m=tt(p),$=p.length*8-t.nBitLength;return $>0?m>>BigInt($):m},A=t.bits2int_modN||function(p){return a(E(p))},S=An(t.nBitLength);function C(p){if(typeof p!="bigint")throw new Error("bigint expected");if(!(bt<=p&&pX in $))throw new Error("sign() legacy options not supported");const{hash:N,randomBytes:H}=t;let{lowS:k,prehash:q,extraEntropy:D}=$;k==null&&(k=!0),p=J("msgHash",p),q&&(p=J("prehashed msgHash",N(p)));const Z=A(p),G=d(m),et=[C(G),C(Z)];if(D!=null){const X=D===!0?H(n.BYTES):D;et.push(J("extraEntropy",X))}const ft=Pt(...et),Y=Z;function Ut(X){const nt=E(X);if(!b(nt))return;const Qt=c(nt),rt=l.BASE.multiply(nt).toAffine(),j=a(rt.x);if(j===bt)return;const ot=a(Qt*a(Y+j*G));if(ot===bt)return;let te=(rt.x===j?0:2)|Number(rt.y<),ee=ot;return k&&y(ot)&&(ee=u(ot),te^=1),new w(j,ee,te)}return{seed:ft,k2sig:Ut}}const T={lowS:t.lowS,prehash:!1},K={lowS:t.lowS,prehash:!1};function R(p,m,$=T){const{seed:N,k2sig:H}=U(p,m,$),k=t;return vr(k.hash.outputLen,k.nByteLength,k.hmac)(N,H)}l.BASE._setWindowSize(8);function z(p,m,$,N=K){var rt;const H=p;if(m=J("msgHash",m),$=J("publicKey",$),"strict"in N)throw new Error("options.strict was renamed to lowS");const{lowS:k,prehash:q}=N;let D,Z;try{if(typeof H=="string"||H instanceof Uint8Array)try{D=w.fromDER(H)}catch(j){if(!(j instanceof Rt.Err))throw j;D=w.fromCompact(H)}else if(typeof H=="object"&&typeof H.r=="bigint"&&typeof H.s=="bigint"){const{r:j,s:ot}=H;D=new w(j,ot)}else throw new Error("PARSE");Z=l.fromHex($)}catch(j){if(j.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(k&&D.hasHighS())return!1;q&&(m=t.hash(m));const{r:G,s:et}=D,ft=A(m),Y=c(et),Ut=a(ft*Y),X=a(G*Y),nt=(rt=l.BASE.multiplyAndAddUnsafe(Z,Ut,X))==null?void 0:rt.toAffine();return nt?a(nt.x)===G:!1}return{CURVE:t,getPublicKey:x,getSharedSecret:B,sign:R,verify:z,ProjectivePoint:l,Signature:w,utils:v}}class $r extends yr{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Xi(t);const r=xn(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,i=new Uint8Array(o);i.set(r.length>o?t.create().update(r).digest():r);for(let s=0;snew $r(e,t).update(n).digest();Tr.create=(e,t)=>new $r(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function qs(e){return{hash:e,hmac:(t,...n)=>Tr(e,t,ns(...n)),randomBytes:mr}}function Ds(e,t){const n=r=>Rs({...e,...qs(r)});return Object.freeze({...n(t),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ne=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ee=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Ur=BigInt(1),ve=BigInt(2),Jn=(e,t)=>(e+t/ve)/t;function Hr(e){const t=Ne,n=BigInt(3),r=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),l=e*e*e%t,d=l*l*e%t,f=st(d,n,t)*d%t,b=st(f,n,t)*d%t,g=st(b,ve,t)*l%t,y=st(g,o,t)*g%t,u=st(y,i,t)*y%t,h=st(u,a,t)*u%t,w=st(h,c,t)*h%t,v=st(w,a,t)*u%t,x=st(v,n,t)*d%t,I=st(x,s,t)*y%t,B=st(I,r,t)*l%t,E=st(B,ve,t);if(!an.eql(an.sqr(E),e))throw new Error("Cannot find square root");return E}const an=Ts(Ne,void 0,void 0,{sqrt:Hr}),Sn=Ds({a:BigInt(0),b:BigInt(7),Fp:an,n:Ee,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Ee,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Ur*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,s=BigInt("0x100000000000000000000000000000000"),a=Jn(i*e,t),c=Jn(-r*e,t);let l=W(e-a*n-c*o,t),d=W(-a*r-c*i,t);const f=l>s,b=d>s;if(f&&(l=t-l),b&&(d=t-d),l>s||d>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:l,k2neg:b,k2:d}}}},rn),Le=BigInt(0),Nr=e=>typeof e=="bigint"&&Letypeof e=="bigint"&&Leo.charCodeAt(0)));n=Pt(r,r),Xn[e]=n}return rn(Pt(n,...t))}const In=e=>e.toRawBytes(!0).slice(1),cn=e=>$t(e,32),Me=e=>W(e,Ne),ce=e=>W(e,Ee),$n=Sn.ProjectivePoint,js=(e,t,n)=>$n.BASE.multiplyAndAddUnsafe(e,t,n);function ln(e){let t=Sn.utils.normPrivateKeyToScalar(e),n=$n.fromPrivateKey(t);return{scalar:n.hasEvenY()?t:ce(-t),bytes:In(n)}}function Lr(e){if(!Nr(e))throw new Error("bad x: need 0 < x < p");const t=Me(e*e),n=Me(t*e+BigInt(7));let r=Hr(n);r%ve!==Le&&(r=Me(-r));const o=new $n(e,r,Ur);return o.assertValidity(),o}function Cr(...e){return ce(tt(Be("BIP0340/challenge",...e)))}function Vs(e){return ln(e).bytes}function _s(e,t,n=mr(32)){const r=J("message",e),{bytes:o,scalar:i}=ln(t),s=J("auxRand",n,32),a=cn(i^tt(Be("BIP0340/aux",s))),c=Be("BIP0340/nonce",a,o,r),l=ce(tt(c));if(l===Le)throw new Error("sign failed: k is zero");const{bytes:d,scalar:f}=ln(l),b=Cr(d,o,r),g=new Uint8Array(64);if(g.set(d,0),g.set(cn(ce(f+b*i)),32),!kr(g,r,o))throw new Error("sign: Invalid signature produced");return g}function kr(e,t,n){const r=J("signature",e,64),o=J("message",t),i=J("publicKey",n,32);try{const s=Lr(tt(i)),a=tt(r.subarray(0,32));if(!Nr(a))return!1;const c=tt(r.subarray(32,64));if(!Ps(c))return!1;const l=Cr(cn(a),In(s),o),d=js(s,c,ce(-l));return!(!d||!d.hasEvenY()||d.toAffine().x!==a)}catch{return!1}}const re={getPublicKey:Vs,sign:_s,verify:kr,utils:{randomPrivateKey:Sn.utils.randomPrivateKey,lift_x:Lr,pointToBytes:In,numberToBytesBE:$t,bytesToNumberBE:tt,taggedHash:Be,mod:W}};var Mt=Symbol("verified"),zs=e=>e instanceof Object;function Fs(e){if(!zs(e)||typeof e.kind!="number"||typeof e.content!="string"||typeof e.created_at!="number"||typeof e.pubkey!="string"||!e.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(e.tags))return!1;for(let t=0;t{for(var o=r>1?void 0:r?Ws(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Ys(t,n,o),o};let fn=class extends _r{constructor(){super(...arguments);P(this,"$notify");P(this,"activeDid","");P(this,"agentDid","");P(this,"apiServer","");P(this,"errorMessage","");P(this,"fullClaim",{"@context":"https://schema.org","@type":"PlanAction",name:"",description:""});P(this,"imageUrl","");P(this,"includeLocation",!1);P(this,"isHiddenSave",!1);P(this,"isHiddenSpinner",!0);P(this,"lastClaimJwtId","");P(this,"latitude",0);P(this,"longitude",0);P(this,"numAccounts",0);P(this,"projectId","");P(this,"projectIssuerDid","");P(this,"sendToTrustroots",!1);P(this,"sendToTripHopping",!1);P(this,"showGeneralAdvanced",!1);P(this,"startDateInput");P(this,"startTimeInput");P(this,"zoneName",Tn.local().zoneName);P(this,"zoom",2)}errNote(n){this.$notify({group:"alert",type:"danger",title:"Error",text:n},5e3)}async mounted(){this.numAccounts=await qr();const n=await Un();this.activeDid=n.activeDid||"",this.apiServer=n.apiServer||"",this.showGeneralAdvanced=!!n.showGeneralAdvanced,this.projectId=this.$route.query.projectId||"",this.projectId&&(this.numAccounts===0?this.errNote("There was a problem loading your account info."):this.loadProject(this.activeDid))}async loadProject(n){var i,s,a;const r=this.apiServer+"/api/claim/byHandle/"+encodeURIComponent(this.projectId),o=await ue(n);try{const c=await this.axios.get(r,{headers:o});if(c.status===200&&(this.projectIssuerDid=c.data.issuer,this.fullClaim=c.data.claim,this.imageUrl=c.data.claim.image||"",this.lastClaimJwtId=c.data.id,(i=this.fullClaim)!=null&&i.location&&(this.includeLocation=!0,this.latitude=this.fullClaim.location.geo.latitude,this.longitude=this.fullClaim.location.geo.longitude),(a=(s=this.fullClaim)==null?void 0:s.agent)!=null&&a.identifier&&(this.agentDid=this.fullClaim.agent.identifier),this.fullClaim.startTime)){const l=Tn.fromISO(this.fullClaim.startTime).toLocal();this.startDateInput=l.toFormat("yyyy-MM-dd"),this.startTimeInput=l.toFormat("HH:mm")}}catch(c){console.error("Got error retrieving that project",c),this.errNote("There was an error retrieving that project.")}}openImageDialog(){this.$refs.imageDialog.open(n=>{this.imageUrl=n},"PlanAction")}confirmDeleteImage(){this.$notify({group:"modal",type:"confirm",title:"Are you sure you want to delete the image?",text:"",onYes:this.deleteImage},-1)}async deleteImage(){if(this.imageUrl)try{const n=await ue(this.activeDid),r=await this.axios.delete(zr+"/image/"+encodeURIComponent(this.imageUrl),{headers:n});if(r.status!==204){console.error("Problem deleting image:",r),this.$notify({group:"alert",type:"danger",title:"Error",text:"There was a problem deleting the image."},5e3);return}this.imageUrl=""}catch(n){console.error("Error deleting image:",n),n.response.status===404?(console.log("The image was already deleted:",n),this.imageUrl=""):this.$notify({group:"alert",type:"danger",title:"Error",text:"There was an error deleting the image."},5e3)}}async saveProject(){var a,c,l,d,f;const n=this.fullClaim;if(this.projectId&&(n.lastClaimId=this.lastClaimJwtId),this.agentDid?n.agent={identifier:this.agentDid}:delete n.agent,this.imageUrl?n.image=this.imageUrl:delete n.image,this.includeLocation?n.location={geo:{"@type":"GeoCoordinates",latitude:this.latitude,longitude:this.longitude}}:delete n.location,this.startDateInput)try{const b=this.startTimeInput||"00:00:00",g=this.startDateInput+" "+b;n.startTime=new Date(g).toISOString()}catch{delete n.startTime,this.$notify({group:"alert",type:"danger",title:"Error",text:"The date was invalid so it was not set."},5e3)}else delete n.startTime;const r=await Dr(this.activeDid,n),o=JSON.stringify({jwtEncoded:r}),i=this.apiServer+"/api/v2/claim",s=await ue(this.activeDid);try{const b=await this.axios.post(i,o,{headers:s});if((c=(a=b.data)==null?void 0:a.success)!=null&&c.handleId){this.errorMessage="";const g=encodeURIComponent(b.data.success.handleId);let y;this.sendToTrustroots&&(y=await this.signPayload(),this.sendToNostrPartner("NOSTR-EVENT-TRUSTROOTS","Trustroots",b.data.success.claimId,y)),this.sendToTripHopping&&(y||(y=await this.signPayload()),this.sendToNostrPartner("NOSTR-EVENT-TRIPHOPPING","TripHopping",b.data.success.claimId,y)),this.$router.push({path:"/project/"+g})}else console.error("Got unexpected 'data' inside response from server",b),this.$notify({group:"alert",type:"danger",title:"Error Saving Idea",text:"Server did not save the idea. Try again."},5e3)}catch(b){let g="There was an error saving the project.";const y=b;y?(console.error("Got error from server",y),Object.prototype.hasOwnProperty.call(y,"message")?(g=((f=(d=(l=y.response)==null?void 0:l.data)==null?void 0:d.error)==null?void 0:f.message)||g,this.$notify({group:"alert",type:"danger",title:"User Message",text:g},5e3)):this.$notify({group:"alert",type:"danger",title:"Server Message",text:JSON.stringify(y.toJSON())},5e3)):(console.error("Here's the full error trying to save the claim:",b),this.$notify({group:"alert",type:"danger",title:"Claim Error",text:b},5e3)),this.errorMessage=g}}async signPayload(){var d,f,b;const n=await Pr(this.activeDid),r=(b=(f=(d=n==null?void 0:n.derivationPath)==null?void 0:d.split)==null?void 0:f.call(d,"/"))==null?void 0:b.reverse()[0],o=r==null?void 0:r.replace(/'/g,""),i=Number(o||0),s=Fn(n==null?void 0:n.mnemonic,"",i),a=jr(s==null?void 0:s.privateKey);return Gs({kind:30402,tags:[[]],content:"",created_at:0},a)}async sendToNostrPartner(n,r,o,i){var I,B,E,A,S,C;const s=await Vr(this.activeDid),a=(E=(B=(I=s==null?void 0:s.derivationPath)==null?void 0:I.split)==null?void 0:B.call(I,"/"))==null?void 0:E.reverse()[0],c=a==null?void 0:a.replace(/'/g,""),l=Number(c||0),d=Fn(s==null?void 0:s.mnemonic,"",l),f=d==null?void 0:d.publicKey;let b=Mr;const g=await Un();g.partnerApiServer&&(b=g.partnerApiServer);const y=b+"/api/partner/link",u=window.location.origin+"/claim/"+o,h=this.fullClaim.name+" - see "+u,w=Or(i),v={jwtId:o,linkCode:n,inputJson:JSON.stringify(h),pubKeyHex:f,pubKeyImage:w,pubKeySigHex:i.sig},x=await ue(this.activeDid);try{const U=await this.axios.post(y,v,{headers:x});U.status===201?this.$notify({group:"alert",type:"success",title:`Sent to ${r}`,text:`The project info was sent to ${r}.`},5e3):this.$notify({group:"alert",type:"danger",title:`Failed Sending to ${r}`,text:JSON.stringify(U.data)},5e3)}catch(U){console.error(`Error sending to ${r}`,U);let T=`There was an error sending to ${r}.`;(C=(S=(A=U.response)==null?void 0:A.data)==null?void 0:S.error)!=null&&C.message&&(T=U.response.data.error.message),this.$notify({group:"alert",type:"danger",title:`Error Sending to ${r}`,text:T},7e3)}}async onSaveProjectClick(){this.isHiddenSave=!0,this.isHiddenSpinner=!1,this.numAccounts===0?console.error("Error: there is no account."):this.saveProject()}confirmEraseLatLong(){this.$notify({group:"modal",type:"confirm",title:"Erase Marker",text:"Are you sure you don't want to mark a location? This will erase the current location.",onYes:async()=>{this.eraseLatLong()}},-1)}eraseLatLong(){this.latitude=0,this.longitude=0,this.includeLocation=!1}onCancelClick(){this.$router.back()}};fn=Js([Fr({components:{ImageMethodDialog:to,LMap:Jr,LMarker:Xr,LTileLayer:Qr,QuickNav:eo}})],fn);const Xs={id:"Content",class:"p-6 pb-24 max-w-3xl mx-auto"},Qs={id:"ViewBreadcrumb",class:"mb-8"},ta={class:"text-lg text-center font-light relative px-7"},ea={class:"flex justify-center mt-4"},na={key:0,class:"flex justify-between"},ra=["href"],oa=["src"],ia={key:1},sa={class:"mb-4"},aa={key:0},ca={class:"text-xs text-slate-500 italic -mt-3 mb-4"},la={class:"flex mb-4 columns-3 w-full"},fa=["disabled"],ua={class:"col-span-1 w-full flex justify-center"},da={key:0,class:"mb-4 aspect-video"},ha={key:1,class:"items-center mb-4"},pa={class:"mt-8"},ga={class:"grid grid-cols-1 sm:grid-cols-2 gap-2"},wa=["disabled"];function ba(e,t,n,r,o,i){var b;const s=_t("QuickNav"),a=_t("fa"),c=_t("ImageMethodDialog"),l=_t("l-tile-layer"),d=_t("l-marker"),f=_t("l-map");return Nt(),zt(Yr,null,[Ht(s,{selected:"Projects"}),O("section",Xs,[O("div",Qs,[O("h1",ta,[O("button",{onClick:t[0]||(t[0]=g=>e.$router.go(-1)),class:"text-lg text-center px-2 py-1 absolute -left-2 -top-1"},[Ht(a,{icon:"chevron-left",class:"fa-fw"})]),t[17]||(t[17]=ke(" Edit Project Idea "))])]),O("div",null,Oe(e.errorMessage),1),xt(O("input",{type:"text",placeholder:"Idea Name",class:"block w-full rounded border border-slate-400 mb-4 px-3 py-2","onUpdate:modelValue":t[1]||(t[1]=g=>e.fullClaim.name=g)},null,512),[[Ft,e.fullClaim.name]]),O("div",ea,[e.imageUrl?(Nt(),zt("span",na,[O("a",{href:e.imageUrl,target:"_blank",class:"text-blue-500 ml-4"},[O("img",{src:e.imageUrl,class:"h-24 rounded-xl"},null,8,oa)],8,ra),Ht(a,{icon:"trash-can",onClick:e.confirmDeleteImage,class:"text-red-500 fa-fw ml-8 mt-10"},null,8,["onClick"])])):(Nt(),zt("span",ia,[Ht(a,{icon:"camera",class:"bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-2 rounded-md",onClick:e.openImageDialog},null,8,["onClick"])]))]),Ht(c,{ref:"imageDialog"},null,512),xt(O("input",{type:"text",placeholder:"Other Authorized Representative",class:"mt-4 block w-full rounded border border-slate-400 px-3 py-2","onUpdate:modelValue":t[2]||(t[2]=g=>e.agentDid=g)},null,512),[[Ft,e.agentDid]]),O("div",sa,[e.activeDid!=e.projectIssuerDid&&e.agentDid!=e.projectIssuerDid?(Nt(),zt("p",aa,[t[18]||(t[18]=O("span",{class:"text-red-500"},"Beware!",-1)),t[19]||(t[19]=ke(" If you save this, the original project owner will no longer be able to edit it. ")),O("button",{onClick:t[3]||(t[3]=g=>e.agentDid=e.projectIssuerDid),class:"text-blue-500"}," Click here to make the original owner an authorized representative. ")])):de("",!0)]),xt(O("textarea",{placeholder:"Description",class:"block w-full rounded border border-slate-400 mb-4 px-3 py-2",rows:"5","onUpdate:modelValue":t[4]||(t[4]=g=>e.fullClaim.description=g),maxlength:"5000"},null,512),[[Ft,e.fullClaim.description]]),t[24]||(t[24]=O("div",{class:"text-xs text-slate-500 italic -mt-3 mb-4"}," If you want to be contacted, be sure to include your contact information. ",-1)),O("div",ca,Oe((b=e.fullClaim.description)==null?void 0:b.length)+"/5000 max. characters ",1),xt(O("input",{"onUpdate:modelValue":t[5]||(t[5]=g=>e.fullClaim.url=g),placeholder:"Website",autocapitalize:"none",class:"block w-full rounded border border-slate-400 mb-4 px-3 py-2"},null,512),[[Ft,e.fullClaim.url]]),O("div",la,[xt(O("input",{"onUpdate:modelValue":t[6]||(t[6]=g=>e.startDateInput=g),placeholder:"Start Date",type:"date",class:"col-span-1 w-full rounded border border-slate-400 px-3 py-2"},null,512),[[Ft,e.startDateInput]]),xt(O("input",{disabled:!e.startDateInput,placeholder:"Start Time","onUpdate:modelValue":t[7]||(t[7]=g=>e.startTimeInput=g),type:"time",class:"col-span-1 w-full rounded border border-slate-400 ml-2 px-3 py-2"},null,8,fa),[[Ft,e.startTimeInput]]),O("span",ua,Oe(e.zoneName),1)]),O("div",{class:"flex items-center mb-4",onClick:t[9]||(t[9]=g=>e.includeLocation=!e.includeLocation)},[xt(O("input",{type:"checkbox",class:"mr-2","onUpdate:modelValue":t[8]||(t[8]=g=>e.includeLocation=g)},null,512),[[Hn,e.includeLocation]]),t[20]||(t[20]=O("label",{for:"includeLocation"},"Include Location",-1))]),e.includeLocation?(Nt(),zt("div",da,[t[21]||(t[21]=O("p",{class:"text-sm mb-2 text-slate-500"}," For your security, choose a location nearby but not exactly at the place. ",-1)),Ht(f,{ref:"map",zoom:e.zoom,"onUpdate:zoom":t[11]||(t[11]=g=>e.zoom=g),center:[0,0],class:"!z-40 rounded-md",onClick:t[12]||(t[12]=g=>{e.latitude=g.latlng.lat,e.longitude=g.latlng.lng})},{default:Gr(()=>[Ht(l,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png","layer-type":"base",name:"OpenStreetMap"}),e.latitude&&e.longitude?(Nt(),Wr(d,{key:0,"lat-lng":[e.latitude,e.longitude],onClick:t[10]||(t[10]=g=>e.confirmEraseLatLong())},null,8,["lat-lng"])):de("",!0)]),_:1},8,["zoom"])])):de("",!0),e.showGeneralAdvanced&&e.includeLocation?(Nt(),zt("div",ha,[O("div",{class:"flex",onClick:t[14]||(t[14]=g=>e.sendToTrustroots=!e.sendToTrustroots)},[xt(O("input",{type:"checkbox",class:"mr-2","onUpdate:modelValue":t[13]||(t[13]=g=>e.sendToTrustroots=g)},null,512),[[Hn,e.sendToTrustroots]]),t[22]||(t[22]=O("label",null,"Send to Trustroots",-1))])])):de("",!0),O("div",pa,[O("div",ga,[O("button",{disabled:e.isHiddenSave,class:"block w-full text-center text-lg font-bold uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md mb-2",onClick:t[15]||(t[15]=g=>e.onSaveProjectClick())},[O("span",{class:Nn({hidden:e.isHiddenSave})},"Save Project",2),O("span",{class:Nn({hidden:e.isHiddenSpinner})},t[23]||(t[23]=[O("i",{class:"fa-solid fa-spinner fa-spin-pulse"},null,-1),ke(" Saving...")]),2)],8,wa),O("button",{type:"button",class:"block w-full text-center text-md uppercase bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md",onClick:t[16]||(t[16]=g=>e.onCancelClick())}," Cancel ")])])])],64)}const Oa=Zr(fn,[["render",ba]]);export{Oa as default};
diff --git a/dist-electron/assets/NewIdentifierView-DKie1CXF.js b/dist-electron/assets/NewIdentifierView-DKie1CXF.js
new file mode 100644
index 0000000..1c5cc96
--- /dev/null
+++ b/dist-electron/assets/NewIdentifierView-DKie1CXF.js
@@ -0,0 +1 @@
+var v=Object.defineProperty;var x=(t,e,s)=>e in t?v(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var u=(t,e,s)=>x(t,typeof e!="symbol"?e+"":e,s);import"./dexie-export-import-B7Ze1sjn.js";import{V as g,C as _,_ as w,g as m,h as d,i as l,j as n,F as b,x as f}from"./index-BLqts8WY.js";import{ag as y}from"./index-MyY_xqVN.js";import{Q as C}from"./QuickNav-DgCyvgDx.js";import"./index-CsfPLOYu.js";var N=Object.defineProperty,V=Object.getOwnPropertyDescriptor,$=(t,e,s,i)=>{for(var o=i>1?void 0:i?V(e,s):e,r=t.length-1,a;r>=0;r--)(a=t[r])&&(o=(i?a(e,s,o):a(o))||o);return i&&o&&N(e,s,o),o};let c=class extends g{constructor(){super(...arguments);u(this,"loading",!0)}async mounted(){await y(),this.loading=!1,setTimeout(()=>{this.$router.push({name:"home"})},1e3)}};c=$([_({components:{QuickNav:C}})],c);const h={id:"Content",class:"p-6 pb-24 max-w-3xl mx-auto"},I={class:"mb-8"},j={class:"text-lg text-center font-light relative px-7"},k={class:"flex justify-center py-12"},O={key:0},P={key:1};function Q(t,e,s,i,o,r){const a=m("QuickNav"),p=m("fa");return f(),d(b,null,[l(a),n("section",h,[n("div",I,[n("div",j,[n("h1",{class:"text-lg text-center px-2 py-1 absolute -left-2 -top-1",onClick:e[0]||(e[0]=A=>t.$router.back())},[l(p,{icon:"chevron-left",class:"fa-fw"})])]),e[1]||(e[1]=n("h1",{id:"ViewHeading",class:"text-4xl text-center font-light pt-4 mb-8"}," Your Identity ",-1))]),n("div",k,[e[4]||(e[4]=n("div",null,null,-1)),t.loading?(f(),d("div",O,[e[2]||(e[2]=n("span",{class:"text-xl"},"Creating... ",-1)),l(p,{icon:"spinner",class:"fa-spin fa-spin-pulse",color:"green",size:"128"})])):(f(),d("div",P,[e[3]||(e[3]=n("span",{class:"text-xl"},"Created!",-1)),l(p,{icon:"burst",class:"fa-beat px-12",color:"green",style:{"--fa-animation-duration":"1s","--fa-animation-direction":"reverse","--fa-animation-iteration-count":"1","--fa-beat-scale":"6"}})])),e[5]||(e[5]=n("div",null,null,-1))])])],64)}const T=w(c,[["render",Q]]);export{T as default};
diff --git a/dist-electron/assets/OfferDetailsView-C1laA_fH.js b/dist-electron/assets/OfferDetailsView-C1laA_fH.js
new file mode 100644
index 0000000..2b9f5d5
--- /dev/null
+++ b/dist-electron/assets/OfferDetailsView-C1laA_fH.js
@@ -0,0 +1 @@
+var L=Object.defineProperty;var W=(e,t,r)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var n=(e,t,r)=>W(e,typeof t!="symbol"?t+"":t,r);import{V as K,f as z,e as X,C as Z,_,g as b,h as g,i as f,j as s,l as F,t as v,m,s as C,o as G,p as Y,w as ee,k as Q,F as te,x as h}from"./index-BLqts8WY.js";import{Q as re}from"./QuickNav-DgCyvgDx.js";import{T as ie}from"./TopMessage-BE0GBIgW.js";import{l as oe,e as se,h as ne,ap as ae,aK as de,aL as le,aM as pe,at as ue}from"./index-MyY_xqVN.js";import"./index-CsfPLOYu.js";var ce=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,he=(e,t,r,i)=>{for(var a=i>1?void 0:i?fe(t,r):t,l=e.length-1,d;l>=0;l--)(d=e[l])&&(a=(i?d(t,r,a):d(a))||a);return i&&a&&ce(t,r,a),a};let T=class extends K{constructor(){super(...arguments);n(this,"$notify");n(this,"activeDid","");n(this,"apiServer","");n(this,"amountInput","0");n(this,"descriptionOfCondition","");n(this,"descriptionOfItem","");n(this,"destinationPathAfter","");n(this,"hideBackButton",!1);n(this,"message","");n(this,"offeredToProject",!1);n(this,"offeredToRecipient",!1);n(this,"offererDid");n(this,"offerId","");n(this,"prevCredToEdit");n(this,"projectId","");n(this,"projectName","a project");n(this,"recipientDid","");n(this,"recipientName","");n(this,"showGeneralAdvanced",!1);n(this,"unitCode","HUR");n(this,"validThroughDateInput","");n(this,"libsUtil",oe)}async mounted(){var a,l,d,p,c,y,o,I,w,O,x,D,$,j,E,k,N,P,S,A,U,q,R,V,M,B;try{this.prevCredToEdit=this.$route.query.prevCredToEdit?JSON.parse(this.$route.query.prevCredToEdit):void 0}catch{this.$notify({group:"alert",type:"danger",title:"Retrieval Error",text:"The previous record isn't available for editing. If you submit, you'll create a new record."},6e3)}const r=(d=(l=(a=this.prevCredToEdit)==null?void 0:a.claim)==null?void 0:l.includesObject)==null?void 0:d.amountOfThisGood;this.amountInput=this.$route.query.amountInput||(r?String(r):"")||this.amountInput,this.unitCode=this.$route.query.unitCode||((y=(c=(p=this.prevCredToEdit)==null?void 0:p.claim)==null?void 0:c.includesObject)==null?void 0:y.unitCode)||this.unitCode,this.descriptionOfCondition=((I=(o=this.prevCredToEdit)==null?void 0:o.claim)==null?void 0:I.description)||this.descriptionOfCondition,this.descriptionOfItem=this.$route.query.description||((x=(O=(w=this.prevCredToEdit)==null?void 0:w.claim)==null?void 0:O.itemOffered)==null?void 0:x.description)||this.descriptionOfItem,this.destinationPathAfter=this.$route.query.destinationPathAfter,this.offererDid=this.$route.query.offererDid||((j=($=(D=this.prevCredToEdit)==null?void 0:D.claim)==null?void 0:$.agent)==null?void 0:j.identifier)||this.offererDid,this.hideBackButton=this.$route.query.hideBackButton==="true",this.message=this.$route.query.message||"";let i;((P=(N=(k=(E=this.prevCredToEdit)==null?void 0:E.claim)==null?void 0:k.itemOffered)==null?void 0:N.isPartOf)==null?void 0:P["@type"])==="PlanAction"&&(i=(U=(A=(S=this.prevCredToEdit)==null?void 0:S.claim)==null?void 0:A.itemOffered)==null?void 0:U.isPartOf),this.projectId=this.$route.query.projectId||(i==null?void 0:i.identifier)||this.projectId,this.projectName=this.$route.query.projectName||(i==null?void 0:i.name)||this.projectName,this.recipientDid=this.$route.query.recipientDid||((V=(R=(q=this.prevCredToEdit)==null?void 0:q.claim)==null?void 0:R.recipient)==null?void 0:V.identifier),this.recipientName=this.$route.query.recipientName||"",this.validThroughDateInput=((B=(M=this.prevCredToEdit)==null?void 0:M.claim)==null?void 0:B.validThrough)||this.validThroughDateInput;try{const u=await z();if(this.apiServer=u.apiServer??"",this.activeDid=u.activeDid??"",this.showGeneralAdvanced=u.showGeneralAdvanced??!1,this.recipientDid&&!this.recipientName){const H=await X.contacts.toArray(),J=await se();this.recipientName=ne(this.recipientDid,this.activeDid,J,H)}this.offeredToProject=!!this.projectId,this.offeredToRecipient=!this.offeredToProject&&!!this.recipientDid}catch(u){console.error("Error retrieving settings from database:",u),this.$notify({group:"alert",type:"danger",title:"Error",text:u.message||"There was an error retrieving your settings."},-1)}if(this.projectId&&!this.projectName){const u=await ae(this.projectId,this.axios,this.apiServer,this.activeDid);this.projectName=u!=null&&u.name?"the project: "+u.name:"a project"}}changeUnitCode(){const r=Object.keys(this.libsUtil.UNIT_SHORT),i=r.indexOf(this.unitCode);this.unitCode=r[(i+1)%r.length]}increment(){this.amountInput=`${(parseFloat(this.amountInput)||0)+1}`}decrement(){this.amountInput=`${Math.max(0,(parseFloat(this.amountInput)||1)-1)}`}cancel(){this.destinationPathAfter?this.$router.push({path:this.destinationPathAfter}):this.$router.back()}cancelBack(){this.$router.back()}async confirm(){if(!this.activeDid){this.$notify({group:"alert",type:"danger",title:"Error",text:"You must select an identifier before you can record a offer."},2e3);return}if(parseFloat(this.amountInput)<0){this.$notify({group:"alert",type:"danger",text:"You may not send a negative number.",title:""},2e3);return}if(!this.descriptionOfItem&&!parseFloat(this.amountInput)){this.$notify({group:"alert",type:"danger",title:"Error",text:`You must enter a description or some number of ${this.libsUtil.UNIT_LONG[this.unitCode]}.`},2e3);return}this.$notify({group:"alert",type:"toast",text:"Recording the offer...",title:""},1e3),await this.recordOffer()}notifyUserOfProject(){this.projectId?this.$notify({group:"alert",type:"warning",title:"Error",text:"You cannot assign both to a project and to a recipient."},3e3):this.$notify({group:"alert",type:"warning",title:"Error",text:"To assign to a project, you must open this page through a project."},3e3)}notifyUserOfRecipient(){this.recipientDid?this.$notify({group:"alert",type:"warning",title:"Error",text:"You cannot assign both to a recipient and to a project."},3e3):this.$notify({group:"alert",type:"warning",title:"Error",text:"To assign to a recipient, you must open this page from a contact."},3e3)}async recordOffer(){var r,i,a;try{const l=this.offeredToRecipient?this.recipientDid:void 0,d=this.offeredToProject?this.projectId:void 0;let p;if(this.prevCredToEdit?p=await de(this.axios,this.apiServer,this.prevCredToEdit,this.activeDid,this.descriptionOfItem,parseFloat(this.amountInput),this.unitCode,this.descriptionOfCondition,this.validThroughDateInput,l,d):p=await le(this.axios,this.apiServer,this.activeDid,this.descriptionOfItem,parseFloat(this.amountInput),this.unitCode,this.descriptionOfCondition,this.validThroughDateInput,l,d),p.type==="error"||this.isCreationError(p.response)){const c=this.getCreationErrorMessage(p);console.error("Error with offer creation result:",p),this.$notify({group:"alert",type:"danger",title:"Error",text:c||"There was an error creating the offer."},-1)}else this.$notify({group:"alert",type:"success",title:"Success",text:"That offer was recorded."},5e3),localStorage.removeItem("imageUrl"),this.destinationPathAfter?this.$router.push({path:this.destinationPathAfter}):this.$router.back()}catch(l){console.error("Error with offer recordation caught:",l);const d=l.userMessage||((a=(i=(r=l.response)==null?void 0:r.data)==null?void 0:i.error)==null?void 0:a.message)||"There was an error recording the offer.";this.$notify({group:"alert",type:"danger",title:"Error",text:d},-1)}}constructOfferParam(){var d,p;const r=this.offeredToRecipient?this.recipientDid:void 0,i=this.offeredToProject?this.projectId:void 0,a=pe((d=this.prevCredToEdit)==null?void 0:d.claim,this.activeDid,r,this.descriptionOfItem,parseFloat(this.amountInput),this.unitCode,this.descriptionOfCondition,i,this.validThroughDateInput,(p=this.prevCredToEdit)==null?void 0:p.id);return JSON.stringify(a)}isCreationError(r){var i;return r.status!==201||((i=r.data)==null?void 0:i.error)}getCreationErrorMessage(r){var i,a,l,d,p;return((i=r.error)==null?void 0:i.userMessage)||((a=r.error)==null?void 0:a.error)||((p=(d=(l=r.response)==null?void 0:l.data)==null?void 0:d.error)==null?void 0:p.message)}explainData(){this.$notify({group:"alert",type:"success",title:"Data Sharing",text:ue},-1)}};T=he([Z({components:{QuickNav:re,TopMessage:ie}})],T);const me={id:"Content",class:"p-6 pb-24 max-w-3xl mx-auto"},ge={key:0,class:"text-lg text-center font-light relative px-7"},ve={class:"text-xl font-bold text-center mb-4"},ye={class:"flex flex-row justify-center"},be={class:"flex flex-row mt-2"},Ce={class:"flex flex-row mt-2"},Te={class:"rounded-l border border-r-0 border-slate-400 bg-slate-200 text-center px-2 py-2"},Ie={class:"h-7 mt-4 flex"},we={class:"text-sm mt-1"},Oe={class:"h-7 mt-4 flex"},xe={class:"text-sm mt-1"},De={key:1,class:"mt-4 flex"},$e={class:"text-center mb-2 mt-6 italic"},je={class:"grid grid-cols-1 sm:grid-cols-2 gap-2"};function Ee(e,t,r,i,a,l){const d=b("QuickNav"),p=b("TopMessage"),c=b("fa"),y=b("router-link");return h(),g(te,null,[f(d),f(p),s("section",me,[e.hideBackButton?F("",!0):(h(),g("div",ge,[s("h1",{class:"text-lg text-center px-2 py-1 absolute -left-2 -top-1",onClick:t[0]||(t[0]=o=>e.cancelBack())},[f(c,{icon:"chevron-left",class:"fa-fw"})])])),t[18]||(t[18]=s("h1",{class:"text-4xl text-center font-light px-4 mb-4"},"What Is Offered",-1)),s("h1",ve,[s("span",null," Offer to "+v(e.offeredToProject?e.projectName:e.offeredToRecipient?e.recipientName:"someone not named"),1)]),m(s("textarea",{class:"block w-full rounded border border-slate-400 mb-2 px-3 py-2",placeholder:"What is offered","onUpdate:modelValue":t[1]||(t[1]=o=>e.descriptionOfItem=o),"data-testId":"itemDescription"},null,512),[[C,e.descriptionOfItem]]),s("div",ye,[s("span",{class:"rounded-l border border-r-0 border-slate-400 bg-slate-200 text-center text-blue-500 px-2 py-2 w-20",onClick:t[2]||(t[2]=o=>e.changeUnitCode())},v(e.libsUtil.UNIT_SHORT[e.unitCode]||e.unitCode),1),s("div",{class:"border border-r-0 border-slate-400 bg-slate-200 px-4 py-2",onClick:t[3]||(t[3]=o=>e.amountInput==="0"?null:e.decrement())},[f(c,{icon:"chevron-left"})]),m(s("input",{type:"number",class:"border border-r-0 border-slate-400 px-2 py-2 text-center w-20","onUpdate:modelValue":t[4]||(t[4]=o=>e.amountInput=o),"data-testId":"inputOfferAmount"},null,512),[[C,e.amountInput]]),s("div",{class:"rounded-r border border-slate-400 bg-slate-200 px-4 py-2",onClick:t[5]||(t[5]=o=>e.increment())},[f(c,{icon:"chevron-right"})])]),s("div",be,[t[15]||(t[15]=s("span",{class:"rounded-l border border-r-0 border-slate-400 bg-slate-200 text-center px-2 py-2"}," Conditions ",-1)),m(s("textarea",{class:"w-full border border-slate-400 px-3 py-2 rounded-r",placeholder:"Prerequisites, other people to include, etc.","onUpdate:modelValue":t[6]||(t[6]=o=>e.descriptionOfCondition=o)},null,512),[[C,e.descriptionOfCondition]])]),s("div",Ce,[s("span",Te,v(e.validThroughDateInput?"":"No")+" Expiration ",1),m(s("input",{"onUpdate:modelValue":t[7]||(t[7]=o=>e.validThroughDateInput=o),type:"date",class:"w-full rounded border border-slate-400 px-3 py-2 rounded-r"},null,512),[[C,e.validThroughDateInput]])]),s("div",Ie,[e.projectId&&!e.offeredToRecipient?m((h(),g("input",{key:0,type:"checkbox",class:"h-6 w-6 mr-2","onUpdate:modelValue":t[8]||(t[8]=o=>e.offeredToProject=o)},null,512)),[[G,e.offeredToProject]]):(h(),Y(c,{key:1,icon:"square",class:"bg-slate-500 text-slate-500 h-5 w-5 px-0.5 py-0.5 mr-2 rounded",onClick:t[9]||(t[9]=o=>e.notifyUserOfProject())})),s("label",we,v(e.projectId?"This is offered to "+e.projectName:"No project was chosen"),1)]),s("div",Oe,[e.recipientDid&&!e.offeredToProject?m((h(),g("input",{key:0,type:"checkbox",class:"h-6 w-6 mr-2","onUpdate:modelValue":t[10]||(t[10]=o=>e.offeredToRecipient=o)},null,512)),[[G,e.offeredToRecipient]]):(h(),Y(c,{key:1,icon:"square",class:"bg-slate-500 text-slate-500 h-5 w-5 px-0.5 py-0.5 mr-2 rounded",onClick:t[11]||(t[11]=o=>e.notifyUserOfRecipient())})),s("label",xe,v(e.recipientDid?"This is offered to "+e.recipientName:"No recipient was chosen."),1)]),e.showGeneralAdvanced?(h(),g("div",De,[f(y,{to:{name:"claim-add-raw",query:{claim:e.constructOfferParam()}},class:"text-blue-500"},{default:ee(()=>t[16]||(t[16]=[Q(" Edit & Submit Raw ")])),_:1},8,["to"])])):F("",!0),s("p",$e,[t[17]||(t[17]=Q(" Sign & Send to publish to the world ")),f(c,{icon:"circle-info",class:"pl-2 text-blue-500 cursor-pointer",onClick:t[12]||(t[12]=o=>e.explainData())})]),s("div",je,[s("button",{class:"block w-full text-center text-lg font-bold uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md",onClick:t[13]||(t[13]=(...o)=>e.confirm&&e.confirm(...o))}," Sign & Send "),s("button",{class:"block w-full text-center text-md uppercase bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md",onClick:t[14]||(t[14]=(...o)=>e.cancel&&e.cancel(...o))}," Cancel ")])])],64)}const Re=_(T,[["render",Ee]]);export{Re as default};
diff --git a/dist-electron/assets/OfferDialog-BFpCo0de.js b/dist-electron/assets/OfferDialog-BFpCo0de.js
new file mode 100644
index 0000000..caf830e
--- /dev/null
+++ b/dist-electron/assets/OfferDialog-BFpCo0de.js
@@ -0,0 +1 @@
+var I=Object.defineProperty;var D=(t,e,r)=>e in t?I(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var s=(t,e,r)=>D(t,typeof e!="symbol"?e+"":e,r);import{aa as x,C as O,V as U,f as $,_ as N,g,x as b,h as y,j as a,m as v,s as C,t as j,i as m,l as w,w as S,k as E}from"./index-BLqts8WY.js";import{l as k,aL as T}from"./index-MyY_xqVN.js";var V=Object.defineProperty,M=Object.getOwnPropertyDescriptor,h=(t,e,r,i)=>{for(var o=i>1?void 0:i?M(e,r):e,d=t.length-1,l;d>=0;d--)(l=t[d])&&(o=(i?l(e,r,o):l(o))||o);return i&&o&&V(e,r,o),o};let c=class extends U{constructor(){super(...arguments);s(this,"$notify");s(this,"projectId");s(this,"projectName");s(this,"activeDid","");s(this,"apiServer","");s(this,"amountInput","0");s(this,"amountUnitCode","HUR");s(this,"description","");s(this,"expirationDateInput","");s(this,"recipientDid","");s(this,"recipientName","");s(this,"visible",!1);s(this,"libsUtil",k)}async open(r,i){try{this.recipientDid=r,this.recipientName=i;const o=await $();this.apiServer=o.apiServer||"",this.activeDid=o.activeDid||""}catch(o){console.error("Error retrieving settings from database:",o),this.$notify({group:"alert",type:"danger",title:"Error",text:o.message||"There was an error retrieving your settings."},-1)}this.visible=!0}close(){this.visible=!1}changeUnitCode(){const r=Object.keys(this.libsUtil.UNIT_SHORT),i=r.indexOf(this.amountUnitCode);this.amountUnitCode=r[(i+1)%r.length]}increment(){this.amountInput=`${(parseFloat(this.amountInput)||0)+1}`}decrement(){this.amountInput=`${Math.max(0,(parseFloat(this.amountInput)||1)-1)}`}cancel(){this.close(),this.eraseValues()}eraseValues(){this.description="",this.amountInput="0",this.amountUnitCode="HUR"}async confirm(){this.close(),this.$notify({group:"alert",type:"toast",text:"Recording the offer...",title:""},1e3),this.recordOffer(this.description,parseFloat(this.amountInput),this.amountUnitCode,this.expirationDateInput).then(()=>{this.description="",this.amountInput="0"})}async recordOffer(r,i,o="HUR",d){var l,u,n;if(!this.activeDid){this.$notify({group:"alert",type:"danger",title:"Error",text:"You must select an identity before you can record an offer."},7e3);return}if(!r&&!i){this.$notify({group:"alert",type:"danger",title:"Error",text:`You must enter a description or some number of ${this.libsUtil.UNIT_LONG[o]}.`},-1);return}try{const p=await T(this.axios,this.apiServer,this.activeDid,r,i,o,"",d,this.recipientDid,this.projectId);if(p.type==="error"||this.isOfferCreationError(p.response)){const f=this.getOfferCreationErrorMessage(p);console.error("Error with offer creation result:",p),this.$notify({group:"alert",type:"danger",title:"Error",text:f||"There was an error creating the offer."},-1)}else this.$notify({group:"alert",type:"success",title:"Success",text:"That offer was recorded."},5e3)}catch(p){console.error("Error with offer recordation caught:",p);const f=p.userMessage||((n=(u=(l=p.response)==null?void 0:l.data)==null?void 0:u.error)==null?void 0:n.message)||"There was an error recording the offer.";this.$notify({group:"alert",type:"danger",title:"Error",text:f},-1)}}isOfferCreationError(r){var i;return r.status!==201||((i=r.data)==null?void 0:i.error)}getOfferCreationErrorMessage(r){var i,o,d,l,u;return((i=r.error)==null?void 0:i.userMessage)||((o=r.error)==null?void 0:o.error)||((u=(l=(d=r.response)==null?void 0:d.data)==null?void 0:l.error)==null?void 0:u.message)}};h([x],c.prototype,"projectId",2);h([x],c.prototype,"projectName",2);c=h([O],c);const H={key:0,class:"dialog-overlay"},R={class:"dialog"},A={class:"flex flex-row mt-2"},F={class:"mt-4 flex justify-center"},P={class:"grid grid-cols-1 sm:grid-cols-2 gap-2"};function B(t,e,r,i,o,d){const l=g("fa"),u=g("router-link");return t.visible?(b(),y("div",H,[a("div",R,[e[8]||(e[8]=a("h1",{class:"text-xl font-bold text-center mb-4"},"Offer Help",-1)),v(a("input",{type:"text","data-testId":"inputDescription",class:"block w-full rounded border border-slate-400 mb-2 px-3 py-2",placeholder:"Description of what is offered","onUpdate:modelValue":e[0]||(e[0]=n=>t.description=n)},null,512),[[C,t.description]]),a("div",A,[a("span",{class:"rounded-l border border-r-0 border-slate-400 bg-slate-200 w-1/3 text-center text-blue-500 px-2 py-2",onClick:e[1]||(e[1]=n=>t.changeUnitCode())},j(t.libsUtil.UNIT_SHORT[t.amountUnitCode]),1),t.amountInput!=="0"?(b(),y("div",{key:0,class:"border border-r-0 border-slate-400 bg-slate-200 px-4 py-2",onClick:e[2]||(e[2]=n=>t.decrement())},[m(l,{icon:"chevron-left"})])):w("",!0),v(a("input",{"data-testId":"inputOfferAmount",type:"number",class:"w-full border border-r-0 border-slate-400 px-2 py-2 text-center","onUpdate:modelValue":e[3]||(e[3]=n=>t.amountInput=n)},null,512),[[C,t.amountInput]]),a("div",{class:"rounded-r border border-slate-400 bg-slate-200 px-4 py-2",onClick:e[4]||(e[4]=n=>t.increment())},[m(l,{icon:"chevron-right"})])]),a("div",F,[a("span",null,[m(u,{to:{name:"offer-details",query:{amountInput:t.amountInput,description:t.description,offererDid:t.activeDid,projectId:t.projectId,projectName:t.projectName,recipientDid:t.recipientDid,recipientName:t.recipientName,unitCode:t.amountUnitCode}},class:"text-blue-500"},{default:S(()=>e[7]||(e[7]=[E(" Conditions & more options... ")])),_:1},8,["to"])])]),e[9]||(e[9]=a("p",{class:"text-center mt-6 mb-2 italic"}," Sign & Send to publish to the world ",-1)),a("div",P,[a("button",{class:"block w-full text-center text-lg font-bold uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md",onClick:e[5]||(e[5]=(...n)=>t.confirm&&t.confirm(...n))}," Sign & Send "),a("button",{class:"block w-full text-center text-md uppercase bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md",onClick:e[6]||(e[6]=(...n)=>t.cancel&&t.cancel(...n))}," Cancel ")])])])):w("",!0)}const z=N(c,[["render",B]]);export{z as O};
diff --git a/dist-electron/assets/OnboardingDialog-CiAZLb6o.js b/dist-electron/assets/OnboardingDialog-CiAZLb6o.js
new file mode 100644
index 0000000..f3b8bc6
--- /dev/null
+++ b/dist-electron/assets/OnboardingDialog-CiAZLb6o.js
@@ -0,0 +1 @@
+var w=Object.defineProperty;var c=(o,t,n)=>t in o?w(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n;var a=(o,t,n)=>c(o,typeof t!="symbol"?t+"":t,n);import{C as v,V as x,f as k,e as C,u as y,_ as O,g as $,x as g,h as p,j as e,k as s,i as d,t as D,l as m}from"./index-BLqts8WY.js";import{ao as h}from"./index-MyY_xqVN.js";var N=Object.defineProperty,P=Object.getOwnPropertyDescriptor,T=(o,t,n,l)=>{for(var r=l>1?void 0:l?P(t,n):t,b=o.length-1,i;b>=0;b--)(i=o[b])&&(r=(l?i(t,n,r):i(r))||r);return l&&r&&N(t,n,r),r};let f=class extends x{constructor(){super(...arguments);a(this,"$notify");a(this,"activeDid","");a(this,"firstContactName",null);a(this,"givenName","");a(this,"isRegistered",!1);a(this,"numContacts",0);a(this,"page",h.Home);a(this,"visible",!1)}async open(n){this.page=n;const l=await k();this.activeDid=l.activeDid||"",this.isRegistered=!!l.isRegistered;const r=await C.contacts.toArray();this.numContacts=r.length,this.numContacts>0&&(this.firstContactName=r[0].name),this.visible=!0,this.page===h.Create&&await y(this.activeDid,{finishedOnboarding:!0})}async onClickClose(n,l){this.visible=!1,n&&(await y(this.activeDid,{finishedOnboarding:!0}),l&&this.$router.push({name:"home"}))}};f=T([v({computed:{OnboardPage(){return h}},components:{OnboardPage:h}})],f);const S={key:0,class:"dialog-overlay"},j={key:0,class:"dialog"},A={class:"text-xl font-bold text-center mb-4 relative"},I={key:0,class:"mt-4"},_={key:0},V={class:"bg-green-600 text-white rounded-full"},F={key:1,class:"mt-4"},B={class:"mt-4 flex items-center"},H={class:"mt-8"},R={class:"grid grid-cols-1 sm:grid-cols-2 gap-2"},Y={key:1,class:"dialog"},E={class:"text-xl font-bold text-center mb-4 relative"},W={class:"mt-4 flex items-center"},z={class:"mt-8"},G={class:"grid grid-cols-1 sm:grid-cols-2 gap-2"},L={key:2,class:"dialog"},M={class:"text-xl font-bold text-center mb-4 relative"},q={class:"relative"},J={class:"bg-green-600 text-white rounded-full"},K={class:"mt-4 flex items-center"},Q={class:"mt-4"},U={class:"mt-8"},X={class:"grid grid-cols-1 sm:grid-cols-2 gap-2"};function Z(o,t,n,l,r,b){const i=$("fa");return o.visible?(g(),p("div",S,[o.page===o.OnboardPage.Home?(g(),p("div",j,[e("h1",A,[t[9]||(t[9]=s(" Welcome to Time Safari ")),t[10]||(t[10]=e("br",null,null,-1)),t[11]||(t[11]=s(" - Showcasing Gratitude & Magnifing Time ")),e("div",{class:"text-lg text-center leading-none absolute right-0 -top-1",onClick:t[0]||(t[0]=u=>o.onClickClose(!0))},[d(i,{icon:"xmark",class:"w-[1em]"})])]),o.isRegistered?(g(),p("p",I,[t[12]||(t[12]=s(" You can now log things that you've seen: ")),o.numContacts>0?(g(),p("span",_," click on any name (like "+D(o.firstContactName)+") or ",1)):m("",!0),t[13]||(t[13]=s(" click on the ")),e("span",V,[d(i,{icon:"plus",class:"fa-fw"})]),t[14]||(t[14]=s(" button to express your appreciation for... whatever -- maybe thanks for showing you all these fascinating stories of ")),t[15]||(t[15]=e("em",null,"gratitude",-1)),t[16]||(t[16]=s(". "))])):(g(),p("p",F," The feed underneath this pop-up shows the latest gifts that others have recognized. Once someone registers you, you can log your appreciation, too. ")),t[19]||(t[19]=e("p",{class:"mt-4"}," The more you illuminate cool things people are doing, the more you attract people to work with you. ",-1)),e("p",B,[t[17]||(t[17]=s(" The ")),d(i,{icon:"house-chimney",class:"ml-1 mr-1 text-lg text-white bg-slate-400 px-2 py-2 rounded"}),t[18]||(t[18]=s(" button below brings you back to this feed screen. "))]),e("div",H,[e("div",R,[e("button",{type:"button","data-testId":"closeOnboardingAndFinish",class:"block w-full text-center text-md bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md mb-2",onClick:t[1]||(t[1]=u=>o.onClickClose(!0))}," That's enough help, thanks. "),e("button",{type:"button",class:"block w-full text-center text-md bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md mb-2",onClick:t[2]||(t[2]=u=>o.$router.push({name:"discover"}))}," Show me more! ")])]),t[20]||(t[20]=e("p",{class:"mt-4 flex items-center"},[s(" To see these instructions and more, click above on "),e("span",{class:"ml-1 mr-1 text-xs uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-1 rounded-md"}," Help ")],-1))])):m("",!0),o.page===o.OnboardPage.Discover?(g(),p("div",Y,[e("h1",E,[t[21]||(t[21]=s(" Offer to Interesting Events & People ")),e("div",{class:"text-lg text-center leading-none absolute right-0 -top-1",onClick:t[3]||(t[3]=u=>o.onClickClose(!0))},[d(i,{icon:"xmark",class:"w-[1em]"})])]),t[24]||(t[24]=e("p",null," Once you've seen things that others have given or done, you may find ways you want to contribute, too. It turns out others have proposed activities together, and this page is where you find projects. ",-1)),t[25]||(t[25]=e("p",{class:"mt-4"},' Search for a topic, or search around your neighborhod under "Nearby". ',-1)),t[26]||(t[26]=e("p",{class:"mt-4"}," When you find some that seem interesting, you can offer your help. You are welcome to make your offer conditional, for example if they get 2 other people to help besides you. ",-1)),e("p",W,[t[22]||(t[22]=s(" The ")),d(i,{icon:"magnifying-glass",class:"ml-1 mr-1 text-lg text-white bg-slate-400 px-2 py-2 rounded"}),t[23]||(t[23]=s(" button below brings you to this discovery screen. "))]),e("div",z,[e("div",G,[e("button",{type:"button","data-testId":"closeOnboardingAndFinish",class:"block w-full text-center text-md bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md mb-2",onClick:t[4]||(t[4]=u=>o.onClickClose(!0))}," No more help, thanks. "),e("button",{type:"button",class:"block w-full text-center text-md bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md mb-2",onClick:t[5]||(t[5]=u=>o.$router.push({name:"projects"}))}," Show me even more. ")])])])):m("",!0),o.page===o.OnboardPage.Create?(g(),p("div",L,[e("h1",M,[t[27]||(t[27]=s(" Fish for Others with Your Projects ")),e("div",{class:"text-lg text-center leading-none absolute right-0 -top-1",onClick:t[6]||(t[6]=u=>o.onClickClose(!0))},[d(i,{icon:"xmark",class:"w-[1em]"})])]),e("p",q,[t[28]||(t[28]=s(" Now you can take a turn: click on the ")),e("span",J,[d(i,{icon:"plus",class:"fa-fw"})]),t[29]||(t[29]=s(" button to throw out projects of your own... anything you'd like to see happen. If your first idea doesn't catch anyone, try, try again... and let others know that this is a good place to find help. "))]),e("p",K,[t[30]||(t[30]=s(" The ")),d(i,{icon:"hand",class:"ml-1 mr-1 text-lg text-white bg-slate-400 px-2 py-2 rounded"}),t[31]||(t[31]=s(" button below brings you here to see your ideas. "))]),e("p",Q,[t[32]||(t[32]=s(" By the way, one good way to get to know your neighbors and their interests is to offer time directly to them. You can do this on the contacts screen ")),d(i,{icon:"users",class:"text-slate-500"}),t[33]||(t[33]=s(" which is a great way to get to know a neighbor's interests. "))]),e("div",U,[e("div",X,[e("button",{type:"button","data-testId":"closeOnboardingAndFinish",class:"block w-full text-center text-md bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md mb-2",onClick:t[7]||(t[7]=u=>o.onClickClose(!0,!0))},t[34]||(t[34]=[s(" Let's go! "),e("br",null,null,-1),s(" See & record gratitude. ")])),e("button",{type:"button",class:"block w-full text-center text-md bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md mb-2",onClick:t[8]||(t[8]=u=>o.$router.push({name:"help"}))}," I want to read more Help. ")])])])):m("",!0)])):m("",!0)}const nt=O(f,[["render",Z]]);export{nt as O};
diff --git a/dist-electron/assets/OnboardingDialog-DBDPRnmU.css b/dist-electron/assets/OnboardingDialog-DBDPRnmU.css
new file mode 100644
index 0000000..fff4c2b
--- /dev/null
+++ b/dist-electron/assets/OnboardingDialog-DBDPRnmU.css
@@ -0,0 +1 @@
+.dialog-overlay{z-index:40;position:fixed;top:0;left:0;right:0;bottom:0;background-color:#00000080;display:flex;justify-content:center;align-items:center;padding:1.5rem}.dialog{background-color:#fff;padding:1rem;border-radius:.5rem;width:100%;max-width:500px}
diff --git a/dist-electron/assets/PhotoDialog-Dn3GjI9b.js b/dist-electron/assets/PhotoDialog-Dn3GjI9b.js
new file mode 100644
index 0000000..ad5d1bf
--- /dev/null
+++ b/dist-electron/assets/PhotoDialog-Dn3GjI9b.js
@@ -0,0 +1,20 @@
+var Ni=Object.defineProperty;var Li=(t,a,i)=>a in t?Ni(t,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[a]=i;var A=(t,a,i)=>Li(t,typeof a!="symbol"?a+"":a,i);import{U as Ri,r as $t,W as qi,al as Wi,i as P,E as Hi,C as Si,V as _i,f as Ii,a as Pi,b as Xi,am as Yi,_ as Ui,g as yt,x as R,h as q,j as B,l as kt,w as $i}from"./index-BLqts8WY.js";import{aP as Vi}from"./index-MyY_xqVN.js";/*!
+ * Cropper.js v1.6.1
+ * https://fengyuanchen.github.io/cropperjs
+ *
+ * Copyright 2015-present Chen Fengyuan
+ * Released under the MIT license
+ *
+ * Date: 2023-09-17T03:44:19.860Z
+ */function Vt(t,a){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);a&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function mi(t){for(var a=1;at.length)&&(a=t.length);for(var i=0,n=new Array(a);i
',da=Number.isNaN||_.isNaN;function v(t){return typeof t=="number"&&!da(t)}var pi=function(t){return t>0&&t<1/0};function jt(t){return typeof t>"u"}function tt(t){return Mt(t)==="object"&&t!==null}var ma=Object.prototype.hasOwnProperty;function at(t){if(!tt(t))return!1;try{var a=t.constructor,i=a.prototype;return a&&i&&ma.call(i,"isPrototypeOf")}catch{return!1}}function T(t){return typeof t=="function"}var ha=Array.prototype.slice;function ki(t){return Array.from?Array.from(t):ha.call(t)}function z(t,a){return t&&T(a)&&(Array.isArray(t)||v(t.length)?ki(t).forEach(function(i,n){a.call(t,i,n,t)}):tt(t)&&Object.keys(t).forEach(function(i){a.call(t,t[i],i,t)})),t}var w=Object.assign||function(t){for(var a=arguments.length,i=new Array(a>1?a-1:0),n=1;n0&&i.forEach(function(e){tt(e)&&Object.keys(e).forEach(function(o){t[o]=e[o]})}),t},ua=/\.\d*(?:0|9){12}\d*$/;function nt(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return ua.test(t)?Math.round(t*a)/a:t}var va=/^width|height|left|top|marginLeft|marginTop$/;function V(t,a){var i=t.style;z(a,function(n,e){va.test(e)&&v(n)&&(n="".concat(n,"px")),i[e]=n})}function fa(t,a){return t.classList?t.classList.contains(a):t.className.indexOf(a)>-1}function M(t,a){if(a){if(v(t.length)){z(t,function(n){M(n,a)});return}if(t.classList){t.classList.add(a);return}var i=t.className.trim();i?i.indexOf(a)<0&&(t.className="".concat(i," ").concat(a)):t.className=a}}function S(t,a){if(a){if(v(t.length)){z(t,function(i){S(i,a)});return}if(t.classList){t.classList.remove(a);return}t.className.indexOf(a)>=0&&(t.className=t.className.replace(a,""))}}function et(t,a,i){if(a){if(v(t.length)){z(t,function(n){et(n,a,i)});return}i?M(t,a):S(t,a)}}var ga=/([a-z\d])([A-Z])/g;function _t(t){return t.replace(ga,"$1-$2").toLowerCase()}function Lt(t,a){return tt(t[a])?t[a]:t.dataset?t.dataset[a]:t.getAttribute("data-".concat(_t(a)))}function mt(t,a,i){tt(i)?t[a]=i:t.dataset?t.dataset[a]=i:t.setAttribute("data-".concat(_t(a)),i)}function xa(t,a){if(tt(t[a]))try{delete t[a]}catch{t[a]=void 0}else if(t.dataset)try{delete t.dataset[a]}catch{t.dataset[a]=void 0}else t.removeAttribute("data-".concat(_t(a)))}var ji=/\s\s*/,zi=function(){var t=!1;if(gt){var a=!1,i=function(){},n=Object.defineProperty({},"once",{get:function(){return t=!0,a},set:function(e){a=e}});_.addEventListener("test",i,n),_.removeEventListener("test",i,n)}return t}();function W(t,a,i){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},e=i;a.trim().split(ji).forEach(function(o){if(!zi){var p=t.listeners;p&&p[o]&&p[o][i]&&(e=p[o][i],delete p[o][i],Object.keys(p[o]).length===0&&delete p[o],Object.keys(p).length===0&&delete t.listeners)}t.removeEventListener(o,e,n)})}function L(t,a,i){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},e=i;a.trim().split(ji).forEach(function(o){if(n.once&&!zi){var p=t.listeners,l=p===void 0?{}:p;e=function(){delete l[o][i],t.removeEventListener(o,e,n);for(var c=arguments.length,s=new Array(c),r=0;rMath.abs(i)&&(i=u)})}),i}function vt(t,a){var i=t.pageX,n=t.pageY,e={endX:i,endY:n};return a?e:mi({startX:i,startY:n},e)}function ya(t){var a=0,i=0,n=0;return z(t,function(e){var o=e.startX,p=e.startY;a+=o,i+=p,n+=1}),a/=n,i/=n,{pageX:a,pageY:i}}function F(t){var a=t.aspectRatio,i=t.height,n=t.width,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",o=pi(n),p=pi(i);if(o&&p){var l=i*a;e==="contain"&&l>n||e==="cover"&&l90?{width:c,height:l}:{width:l,height:c}}function ja(t,a,i,n){var e=a.aspectRatio,o=a.naturalWidth,p=a.naturalHeight,l=a.rotate,c=l===void 0?0:l,s=a.scaleX,r=s===void 0?1:s,d=a.scaleY,u=d===void 0?1:d,h=i.aspectRatio,x=i.naturalWidth,g=i.naturalHeight,k=n.fillColor,C=k===void 0?"transparent":k,y=n.imageSmoothingEnabled,X=y===void 0?!0:y,O=n.imageSmoothingQuality,m=O===void 0?"low":O,f=n.maxWidth,j=f===void 0?1/0:f,H=n.maxHeight,I=H===void 0?1/0:H,Q=n.minWidth,G=Q===void 0?0:Q,Y=n.minHeight,U=Y===void 0?0:Y,Z=document.createElement("canvas"),D=Z.getContext("2d"),ht=F({aspectRatio:h,width:j,height:I}),It=F({aspectRatio:h,width:G,height:U},"cover"),bt=Math.min(ht.width,Math.max(It.width,x)),wt=Math.min(ht.height,Math.max(It.height,g)),Pt=F({aspectRatio:e,width:j,height:I}),Xt=F({aspectRatio:e,width:G,height:U},"cover"),Yt=Math.min(Pt.width,Math.max(Xt.width,o)),Ut=Math.min(Pt.height,Math.max(Xt.height,p)),Oi=[-Yt/2,-Ut/2,Yt,Ut];return Z.width=nt(bt),Z.height=nt(wt),D.fillStyle=C,D.fillRect(0,0,bt,wt),D.save(),D.translate(bt/2,wt/2),D.rotate(c*Math.PI/180),D.scale(r,u),D.imageSmoothingEnabled=X,D.imageSmoothingQuality=m,D.drawImage.apply(D,[t].concat(hi(Oi.map(function(Ti){return Math.floor(nt(Ti))})))),D.restore(),Z}var Ci=String.fromCharCode;function za(t,a,i){var n="";i+=a;for(var e=a;e0;)i.push(Ci.apply(null,ki(e.subarray(0,n)))),e=e.subarray(n);return"data:".concat(a,";base64,").concat(btoa(i.join("")))}function Ba(t){var a=new DataView(t),i;try{var n,e,o;if(a.getUint8(0)===255&&a.getUint8(1)===216)for(var p=a.byteLength,l=2;l+1=8&&(o=s+d)}}}if(o){var u=a.getUint16(o,n),h,x;for(x=0;x=0?e:wi),height:Math.max(i.offsetHeight,o>=0?o:yi)};this.containerData=p,V(n,{width:p.width,height:p.height}),M(t,N),S(n,N)},initCanvas:function(){var t=this.containerData,a=this.imageData,i=this.options.viewMode,n=Math.abs(a.rotate)%180===90,e=n?a.naturalHeight:a.naturalWidth,o=n?a.naturalWidth:a.naturalHeight,p=e/o,l=t.width,c=t.height;t.height*p>t.width?i===3?l=t.height*p:c=t.width/p:i===3?c=t.width/p:l=t.height*p;var s={aspectRatio:p,naturalWidth:e,naturalHeight:o,width:l,height:c};this.canvasData=s,this.limited=i===1||i===2,this.limitCanvas(!0,!0),s.width=Math.min(Math.max(s.width,s.minWidth),s.maxWidth),s.height=Math.min(Math.max(s.height,s.minHeight),s.maxHeight),s.left=(t.width-s.width)/2,s.top=(t.height-s.height)/2,s.oldLeft=s.left,s.oldTop=s.top,this.initialCanvasData=w({},s)},limitCanvas:function(t,a){var i=this.options,n=this.containerData,e=this.canvasData,o=this.cropBoxData,p=i.viewMode,l=e.aspectRatio,c=this.cropped&&o;if(t){var s=Number(i.minCanvasWidth)||0,r=Number(i.minCanvasHeight)||0;p>1?(s=Math.max(s,n.width),r=Math.max(r,n.height),p===3&&(r*l>s?s=r*l:r=s/l)):p>0&&(s?s=Math.max(s,c?o.width:0):r?r=Math.max(r,c?o.height:0):c&&(s=o.width,r=o.height,r*l>s?s=r*l:r=s/l));var d=F({aspectRatio:l,width:s,height:r});s=d.width,r=d.height,e.minWidth=s,e.minHeight=r,e.maxWidth=1/0,e.maxHeight=1/0}if(a)if(p>(c?0:1)){var u=n.width-e.width,h=n.height-e.height;e.minLeft=Math.min(0,u),e.minTop=Math.min(0,h),e.maxLeft=Math.max(0,u),e.maxTop=Math.max(0,h),c&&this.limited&&(e.minLeft=Math.min(o.left,o.left+(o.width-e.width)),e.minTop=Math.min(o.top,o.top+(o.height-e.height)),e.maxLeft=o.left,e.maxTop=o.top,p===2&&(e.width>=n.width&&(e.minLeft=Math.min(0,u),e.maxLeft=Math.max(0,u)),e.height>=n.height&&(e.minTop=Math.min(0,h),e.maxTop=Math.max(0,h))))}else e.minLeft=-e.width,e.minTop=-e.height,e.maxLeft=n.width,e.maxTop=n.height},renderCanvas:function(t,a){var i=this.canvasData,n=this.imageData;if(a){var e=ka({width:n.naturalWidth*Math.abs(n.scaleX||1),height:n.naturalHeight*Math.abs(n.scaleY||1),degree:n.rotate||0}),o=e.width,p=e.height,l=i.width*(o/i.naturalWidth),c=i.height*(p/i.naturalHeight);i.left-=(l-i.width)/2,i.top-=(c-i.height)/2,i.width=l,i.height=c,i.aspectRatio=o/p,i.naturalWidth=o,i.naturalHeight=p,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.widthi.maxHeight||i.heighta.width?e.height=e.width/i:e.width=e.height*i),this.cropBoxData=e,this.limitCropBox(!0,!0),e.width=Math.min(Math.max(e.width,e.minWidth),e.maxWidth),e.height=Math.min(Math.max(e.height,e.minHeight),e.maxHeight),e.width=Math.max(e.minWidth,e.width*n),e.height=Math.max(e.minHeight,e.height*n),e.left=a.left+(a.width-e.width)/2,e.top=a.top+(a.height-e.height)/2,e.oldLeft=e.left,e.oldTop=e.top,this.initialCropBoxData=w({},e)},limitCropBox:function(t,a){var i=this.options,n=this.containerData,e=this.canvasData,o=this.cropBoxData,p=this.limited,l=i.aspectRatio;if(t){var c=Number(i.minCropBoxWidth)||0,s=Number(i.minCropBoxHeight)||0,r=p?Math.min(n.width,e.width,e.width+e.left,n.width-e.left):n.width,d=p?Math.min(n.height,e.height,e.height+e.top,n.height-e.top):n.height;c=Math.min(c,n.width),s=Math.min(s,n.height),l&&(c&&s?s*l>c?s=c/l:c=s*l:c?s=c/l:s&&(c=s*l),d*l>r?d=r/l:r=d*l),o.minWidth=Math.min(c,r),o.minHeight=Math.min(s,d),o.maxWidth=r,o.maxHeight=d}a&&(p?(o.minLeft=Math.max(0,e.left),o.minTop=Math.max(0,e.top),o.maxLeft=Math.min(n.width,e.left+e.width)-o.width,o.maxTop=Math.min(n.height,e.top+e.height)-o.height):(o.minLeft=0,o.minTop=0,o.maxLeft=n.width-o.width,o.maxTop=n.height-o.height))},renderCropBox:function(){var t=this.options,a=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.widthi.maxHeight||i.height=a.width&&i.height>=a.height?fi:Ht),V(this.cropBox,w({width:i.width,height:i.height},ct({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),ot(this.element,At,this.getData())}},Oa={initPreview:function(){var t=this.element,a=this.crossOrigin,i=this.options.preview,n=a?this.crossOriginUrl:this.url,e=t.alt||"The image to preview",o=document.createElement("img");if(a&&(o.crossOrigin=a),o.src=n,o.alt=e,this.viewBox.appendChild(o),this.viewBoxImage=o,!!i){var p=i;typeof i=="string"?p=t.ownerDocument.querySelectorAll(i):i.querySelector&&(p=[i]),this.previews=p,z(p,function(l){var c=document.createElement("img");mt(l,ut,{width:l.offsetWidth,height:l.offsetHeight,html:l.innerHTML}),a&&(c.crossOrigin=a),c.src=n,c.alt=e,c.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',l.innerHTML="",l.appendChild(c)})}},resetPreview:function(){z(this.previews,function(t){var a=Lt(t,ut);V(t,{width:a.width,height:a.height}),t.innerHTML=a.html,xa(t,ut)})},preview:function(){var t=this.imageData,a=this.canvasData,i=this.cropBoxData,n=i.width,e=i.height,o=t.width,p=t.height,l=i.left-a.left-t.left,c=i.top-a.top-t.top;!this.cropped||this.disabled||(V(this.viewBoxImage,w({width:o,height:p},ct(w({translateX:-l,translateY:-c},t)))),z(this.previews,function(s){var r=Lt(s,ut),d=r.width,u=r.height,h=d,x=u,g=1;n&&(g=d/n,x=e*g),e&&x>u&&(g=u/e,h=n*g,x=u),V(s,{width:h,height:x}),V(s.getElementsByTagName("img")[0],w({width:o*g,height:p*g},ct(w({translateX:-l*g,translateY:-c*g},t))))}))}},Ta={bind:function(){var t=this.element,a=this.options,i=this.cropper;T(a.cropstart)&&L(t,Tt,a.cropstart),T(a.cropmove)&&L(t,Ot,a.cropmove),T(a.cropend)&&L(t,Et,a.cropend),T(a.crop)&&L(t,At,a.crop),T(a.zoom)&&L(t,Nt,a.zoom),L(i,Kt,this.onCropStart=this.cropStart.bind(this)),a.zoomable&&a.zoomOnWheel&&L(i,ei,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),a.toggleDragModeOnDblclick&&L(i,Zt,this.onDblclick=this.dblclick.bind(this)),L(t.ownerDocument,Jt,this.onCropMove=this.cropMove.bind(this)),L(t.ownerDocument,ti,this.onCropEnd=this.cropEnd.bind(this)),a.responsive&&L(window,ai,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,a=this.options,i=this.cropper;T(a.cropstart)&&W(t,Tt,a.cropstart),T(a.cropmove)&&W(t,Ot,a.cropmove),T(a.cropend)&&W(t,Et,a.cropend),T(a.crop)&&W(t,At,a.crop),T(a.zoom)&&W(t,Nt,a.zoom),W(i,Kt,this.onCropStart),a.zoomable&&a.zoomOnWheel&&W(i,ei,this.onWheel,{passive:!1,capture:!0}),a.toggleDragModeOnDblclick&&W(i,Zt,this.onDblclick),W(t.ownerDocument,Jt,this.onCropMove),W(t.ownerDocument,ti,this.onCropEnd),a.responsive&&W(window,ai,this.onResize)}},Na={resize:function(){if(!this.disabled){var t=this.options,a=this.container,i=this.containerData,n=a.offsetWidth/i.width,e=a.offsetHeight/i.height,o=Math.abs(n-1)>Math.abs(e-1)?n:e;if(o!==1){var p,l;t.restore&&(p=this.getCanvasData(),l=this.getCropBoxData()),this.render(),t.restore&&(this.setCanvasData(z(p,function(c,s){p[s]=c*o})),this.setCropBoxData(z(l,function(c,s){l[s]=c*o})))}}},dblclick:function(){this.disabled||this.options.dragMode===bi||this.setDragMode(fa(this.dragBox,Dt)?xi:St)},wheel:function(t){var a=this,i=Number(this.options.wheelZoomRatio)||.1,n=1;this.disabled||(t.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){a.wheeling=!1},50),t.deltaY?n=t.deltaY>0?1:-1:t.wheelDelta?n=-t.wheelDelta/120:t.detail&&(n=t.detail>0?1:-1),this.zoom(-n*i,t)))},cropStart:function(t){var a=t.buttons,i=t.button;if(!(this.disabled||(t.type==="mousedown"||t.type==="pointerdown"&&t.pointerType==="mouse")&&(v(a)&&a!==1||v(i)&&i!==0||t.ctrlKey))){var n=this.options,e=this.pointers,o;t.changedTouches?z(t.changedTouches,function(p){e[p.identifier]=vt(p)}):e[t.pointerId||0]=vt(t),Object.keys(e).length>1&&n.zoomable&&n.zoomOnTouch?o=gi:o=Lt(t.target,dt),pa.test(o)&&ot(this.element,Tt,{originalEvent:t,action:o})!==!1&&(t.preventDefault(),this.action=o,this.cropping=!1,o===vi&&(this.cropping=!0,M(this.dragBox,ft)))}},cropMove:function(t){var a=this.action;if(!(this.disabled||!a)){var i=this.pointers;t.preventDefault(),ot(this.element,Ot,{originalEvent:t,action:a})!==!1&&(t.changedTouches?z(t.changedTouches,function(n){w(i[n.identifier]||{},vt(n,!0))}):w(i[t.pointerId||0]||{},vt(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var a=this.action,i=this.pointers;t.changedTouches?z(t.changedTouches,function(n){delete i[n.identifier]}):delete i[t.pointerId||0],a&&(t.preventDefault(),Object.keys(i).length||(this.action=""),this.cropping&&(this.cropping=!1,et(this.dragBox,ft,this.cropped&&this.options.modal)),ot(this.element,Et,{originalEvent:t,action:a}))}}},La={change:function(t){var a=this.options,i=this.canvasData,n=this.containerData,e=this.cropBoxData,o=this.pointers,p=this.action,l=a.aspectRatio,c=e.left,s=e.top,r=e.width,d=e.height,u=c+r,h=s+d,x=0,g=0,k=n.width,C=n.height,y=!0,X;!l&&t.shiftKey&&(l=r&&d?r/d:1),this.limited&&(x=e.minLeft,g=e.minTop,k=x+Math.min(n.width,i.width,i.left+i.width),C=g+Math.min(n.height,i.height,i.top+i.height));var O=o[Object.keys(o)[0]],m={x:O.endX-O.startX,y:O.endY-O.startY},f=function(j){switch(j){case K:u+m.x>k&&(m.x=k-u);break;case J:c+m.xC&&(m.y=C-h);break}};switch(p){case Ht:c+=m.x,s+=m.y;break;case K:if(m.x>=0&&(u>=k||l&&(s<=g||h>=C))){y=!1;break}f(K),r+=m.x,r<0&&(p=J,r=-r,c-=r),l&&(d=r/l,s+=(e.height-d)/2);break;case $:if(m.y<=0&&(s<=g||l&&(c<=x||u>=k))){y=!1;break}f($),d-=m.y,s+=m.y,d<0&&(p=it,d=-d,s-=d),l&&(r=d*l,c+=(e.width-r)/2);break;case J:if(m.x<=0&&(c<=x||l&&(s<=g||h>=C))){y=!1;break}f(J),r-=m.x,c+=m.x,r<0&&(p=K,r=-r,c-=r),l&&(d=r/l,s+=(e.height-d)/2);break;case it:if(m.y>=0&&(h>=C||l&&(c<=x||u>=k))){y=!1;break}f(it),d+=m.y,d<0&&(p=$,d=-d,s-=d),l&&(r=d*l,c+=(e.width-r)/2);break;case pt:if(l){if(m.y<=0&&(s<=g||u>=k)){y=!1;break}f($),d-=m.y,s+=m.y,r=d*l}else f($),f(K),m.x>=0?ug&&(d-=m.y,s+=m.y):(d-=m.y,s+=m.y);r<0&&d<0?(p=lt,d=-d,r=-r,s-=d,c-=r):r<0?(p=st,r=-r,c-=r):d<0&&(p=rt,d=-d,s-=d);break;case st:if(l){if(m.y<=0&&(s<=g||c<=x)){y=!1;break}f($),d-=m.y,s+=m.y,r=d*l,c+=e.width-r}else f($),f(J),m.x<=0?c>x?(r-=m.x,c+=m.x):m.y<=0&&s<=g&&(y=!1):(r-=m.x,c+=m.x),m.y<=0?s>g&&(d-=m.y,s+=m.y):(d-=m.y,s+=m.y);r<0&&d<0?(p=rt,d=-d,r=-r,s-=d,c-=r):r<0?(p=pt,r=-r,c-=r):d<0&&(p=lt,d=-d,s-=d);break;case lt:if(l){if(m.x<=0&&(c<=x||h>=C)){y=!1;break}f(J),r-=m.x,c+=m.x,d=r/l}else f(it),f(J),m.x<=0?c>x?(r-=m.x,c+=m.x):m.y>=0&&h>=C&&(y=!1):(r-=m.x,c+=m.x),m.y>=0?h=0&&(u>=k||h>=C)){y=!1;break}f(K),r+=m.x,d=r/l}else f(it),f(K),m.x>=0?u=0&&h>=C&&(y=!1):r+=m.x,m.y>=0?h0?p=m.y>0?rt:pt:m.x<0&&(c-=r,p=m.y>0?lt:st),m.y<0&&(s-=d),this.cropped||(S(this.cropBox,N),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}y&&(e.width=r,e.height=d,e.left=c,e.top=s,this.action=p,this.renderCropBox()),z(o,function(j){j.startX=j.endX,j.startY=j.endY})}},Ra={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&M(this.dragBox,ft),S(this.cropBox,N),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=w({},this.initialImageData),this.canvasData=w({},this.initialCanvasData),this.cropBoxData=w({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(w(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),S(this.dragBox,ft),M(this.cropBox,N)),this},replace:function(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&t&&(this.isImg&&(this.element.src=t),a?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,z(this.previews,function(i){i.getElementsByTagName("img")[0].src=t}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,S(this.cropper,Qt)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,M(this.cropper,Qt)),this},destroy:function(){var t=this.element;return t[b]?(t[b]=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=this.canvasData,n=i.left,e=i.top;return this.moveTo(jt(t)?t:n+Number(t),jt(a)?a:e+Number(a))},moveTo:function(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=this.canvasData,n=!1;return t=Number(t),a=Number(a),this.ready&&!this.disabled&&this.options.movable&&(v(t)&&(i.left=t,n=!0),v(a)&&(i.top=a,n=!0),n&&this.renderCanvas(!0)),this},zoom:function(t,a){var i=this.canvasData;return t=Number(t),t<0?t=1/(1-t):t=1+t,this.zoomTo(i.width*t/i.naturalWidth,null,a)},zoomTo:function(t,a,i){var n=this.options,e=this.canvasData,o=e.width,p=e.height,l=e.naturalWidth,c=e.naturalHeight;if(t=Number(t),t>=0&&this.ready&&!this.disabled&&n.zoomable){var s=l*t,r=c*t;if(ot(this.element,Nt,{ratio:t,oldRatio:o/l,originalEvent:i})===!1)return this;if(i){var d=this.pointers,u=Mi(this.cropper),h=d&&Object.keys(d).length?ya(d):{pageX:i.pageX,pageY:i.pageY};e.left-=(s-o)*((h.pageX-u.left-e.left)/o),e.top-=(r-p)*((h.pageY-u.top-e.top)/p)}else at(a)&&v(a.x)&&v(a.y)?(e.left-=(s-o)*((a.x-e.left)/o),e.top-=(r-p)*((a.y-e.top)/p)):(e.left-=(s-o)/2,e.top-=(r-p)/2);e.width=s,e.height=r,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return t=Number(t),v(t)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var a=this.imageData.scaleY;return this.scale(t,v(a)?a:1)},scaleY:function(t){var a=this.imageData.scaleX;return this.scale(v(a)?a:1,t)},scale:function(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=this.imageData,n=!1;return t=Number(t),a=Number(a),this.ready&&!this.disabled&&this.options.scalable&&(v(t)&&(i.scaleX=t,n=!0),v(a)&&(i.scaleY=a,n=!0),n&&this.renderCanvas(!0,!0)),this},getData:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.options,i=this.imageData,n=this.canvasData,e=this.cropBoxData,o;if(this.ready&&this.cropped){o={x:e.left-n.left,y:e.top-n.top,width:e.width,height:e.height};var p=i.width/i.naturalWidth;if(z(o,function(s,r){o[r]=s/p}),t){var l=Math.round(o.y+o.height),c=Math.round(o.x+o.width);o.x=Math.round(o.x),o.y=Math.round(o.y),o.width=c-o.x,o.height=l-o.y}}else o={x:0,y:0,width:0,height:0};return a.rotatable&&(o.rotate=i.rotate||0),a.scalable&&(o.scaleX=i.scaleX||1,o.scaleY=i.scaleY||1),o},setData:function(t){var a=this.options,i=this.imageData,n=this.canvasData,e={};if(this.ready&&!this.disabled&&at(t)){var o=!1;a.rotatable&&v(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,o=!0),a.scalable&&(v(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,o=!0),v(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,o=!0)),o&&this.renderCanvas(!0,!0);var p=i.width/i.naturalWidth;v(t.x)&&(e.left=t.x*p+n.left),v(t.y)&&(e.top=t.y*p+n.top),v(t.width)&&(e.width=t.width*p),v(t.height)&&(e.height=t.height*p),this.setCropBoxData(e)}return this},getContainerData:function(){return this.ready?w({},this.containerData):{}},getImageData:function(){return this.sized?w({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,a={};return this.ready&&z(["left","top","width","height","naturalWidth","naturalHeight"],function(i){a[i]=t[i]}),a},setCanvasData:function(t){var a=this.canvasData,i=a.aspectRatio;return this.ready&&!this.disabled&&at(t)&&(v(t.left)&&(a.left=t.left),v(t.top)&&(a.top=t.top),v(t.width)?(a.width=t.width,a.height=t.width/i):v(t.height)&&(a.height=t.height,a.width=t.height*i),this.renderCanvas(!0)),this},getCropBoxData:function(){var t=this.cropBoxData,a;return this.ready&&this.cropped&&(a={left:t.left,top:t.top,width:t.width,height:t.height}),a||{}},setCropBoxData:function(t){var a=this.cropBoxData,i=this.options.aspectRatio,n,e;return this.ready&&this.cropped&&!this.disabled&&at(t)&&(v(t.left)&&(a.left=t.left),v(t.top)&&(a.top=t.top),v(t.width)&&t.width!==a.width&&(n=!0,a.width=t.width),v(t.height)&&t.height!==a.height&&(e=!0,a.height=t.height),i&&(n?a.height=a.width/i:e&&(a.width=a.height*i)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var a=this.canvasData,i=ja(this.image,this.imageData,a,t);if(!this.cropped)return i;var n=this.getData(t.rounded),e=n.x,o=n.y,p=n.width,l=n.height,c=i.width/Math.floor(a.naturalWidth);c!==1&&(e*=c,o*=c,p*=c,l*=c);var s=p/l,r=F({aspectRatio:s,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),d=F({aspectRatio:s,width:t.minWidth||0,height:t.minHeight||0},"cover"),u=F({aspectRatio:s,width:t.width||(c!==1?i.width:p),height:t.height||(c!==1?i.height:l)}),h=u.width,x=u.height;h=Math.min(r.width,Math.max(d.width,h)),x=Math.min(r.height,Math.max(d.height,x));var g=document.createElement("canvas"),k=g.getContext("2d");g.width=nt(h),g.height=nt(x),k.fillStyle=t.fillColor||"transparent",k.fillRect(0,0,h,x);var C=t.imageSmoothingEnabled,y=C===void 0?!0:C,X=t.imageSmoothingQuality;k.imageSmoothingEnabled=y,X&&(k.imageSmoothingQuality=X);var O=i.width,m=i.height,f=e,j=o,H,I,Q,G,Y,U;f<=-p||f>O?(f=0,H=0,Q=0,Y=0):f<=0?(Q=-f,f=0,H=Math.min(O,p+f),Y=H):f<=O&&(Q=0,H=Math.min(p,O-f),Y=H),H<=0||j<=-l||j>m?(j=0,I=0,G=0,U=0):j<=0?(G=-j,j=0,I=Math.min(m,l+j),U=I):j<=m&&(G=0,I=Math.min(l,m-j),U=I);var Z=[f,j,H,I];if(Y>0&&U>0){var D=h/p;Z.push(Q*D,G*D,Y*D,U*D)}return k.drawImage.apply(k,[i].concat(hi(Z.map(function(ht){return Math.floor(nt(ht))})))),g},setAspectRatio:function(t){var a=this.options;return!this.disabled&&!jt(t)&&(a.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var a=this.options,i=this.dragBox,n=this.face;if(this.ready&&!this.disabled){var e=t===St,o=a.movable&&t===xi;t=e||o?t:bi,a.dragMode=t,mt(i,dt,t),et(i,Dt,e),et(i,Bt,o),a.cropBoxMovable||(mt(n,dt,t),et(n,Dt,e),et(n,Bt,o))}return this}},qa=_.Cropper,Di=function(){function t(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Fi(this,t),!a||!la.test(a.tagName))throw new Error("The first argument is required and must be an or