From d874ff6c30ba4ba0de3a201e911acc55ee22a42f Mon Sep 17 00:00:00 2001 From: miladsoft Date: Tue, 15 Oct 2024 03:54:18 +0000 Subject: [PATCH] Auto-generated commit Triggered by commit: https://github.com/block-core/angor-hub/commit/8df68fc98ffec726c96418435efe35573c00f869 --- 404.html | 2 +- 73.755a3e942e4826f1.js => 73.d601847698554c7d.js | 2 +- index.html | 2 +- ngsw.json | 2 +- runtime.756c77d0646da9da.js => runtime.553adc18dfa73941.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename 73.755a3e942e4826f1.js => 73.d601847698554c7d.js (56%) rename runtime.756c77d0646da9da.js => runtime.553adc18dfa73941.js (97%) diff --git a/404.html b/404.html index 880338f..73343ac 100644 --- a/404.html +++ b/404.html @@ -41,5 +41,5 @@ - + diff --git a/73.755a3e942e4826f1.js b/73.d601847698554c7d.js similarity index 56% rename from 73.755a3e942e4826f1.js rename to 73.d601847698554c7d.js index 336bb5b..773b862 100644 --- a/73.755a3e942e4826f1.js +++ b/73.d601847698554c7d.js @@ -1 +1 @@ -(self.webpackChunkangor=self.webpackChunkangor||[]).push([[73],{1146:bt=>{"use strict";for(var N="qpzry9x8gf2tvdw0s3jn54khce6mua7l",M={},E=0;E<32;E++){var y=N.charAt(E);if(void 0!==M[y])throw new TypeError(y+" is ambiguous");M[y]=E}function _(L){var O=L>>25;return(33554431&L)<<5^996825010&-(1&O)^642813549&-(O>>1&1)^513874426&-(O>>2&1)^1027748829&-(O>>3&1)^705979059&-(O>>4&1)}function A(L){for(var O=1,dt=0;dt126)return"Invalid prefix ("+L+")";O=_(O)^G>>5}for(O=_(O),dt=0;dt(O=O||90))return"Exceeds length limit";var dt=L.toLowerCase(),G=L.toUpperCase();if(L!==dt&&L!==G)return"Mixed-case string "+L;var V=(L=dt).lastIndexOf("1");if(-1===V)return"No separator character for "+L;if(0===V)return"Missing prefix for "+L;var i=L.slice(0,V),ut=L.slice(V+1);if(ut.length<6)return"Data too short";var kt=A(i);if("string"==typeof kt)return kt;for(var Pt=[],ot=0;ot=ut.length)&&Pt.push(lt)}return 1!==kt?"Invalid checksum for "+L:{prefix:i,words:Pt}}function j(L,O,dt,G){for(var V=0,i=0,ut=(1<=dt;)kt.push(V>>(i-=dt)&ut);if(G)i>0&&kt.push(V<=O)return"Excess padding";if(V<(dt=dt||90))throw new TypeError("Exceeds length limit");var G=A(L=L.toLowerCase());if("string"==typeof G)throw new Error(G);for(var V=L+"1",i=0;i>5)throw new Error("Non 5-bit word");G=_(G)^ut,V+=N.charAt(ut)}for(i=0;i<6;++i)G=_(G);for(G^=1,i=0;i<6;++i)V+=N.charAt(G>>5*(5-i)&31);return V},toWordsUnsafe:function tt(L){var O=j(L,8,5,!0);if(Array.isArray(O))return O},toWords:function at(L){var O=j(L,8,5,!0);if(Array.isArray(O))return O;throw new Error(O)},fromWordsUnsafe:function K(L){var O=j(L,5,8,!1);if(Array.isArray(O))return O},fromWords:function nt(L){var O=j(L,5,8,!1);if(Array.isArray(O))return O;throw new Error(O)}}},2862:bt=>{"use strict";var N=Object.prototype.hasOwnProperty,M="~";function E(){}function y(C,R,B){this.fn=C,this.context=R,this.once=B||!1}function _(C,R,B,j,tt){if("function"!=typeof B)throw new TypeError("The listener must be a function");var at=new y(B,j||C,tt),K=M?M+R:R;return C._events[K]?C._events[K].fn?C._events[K]=[C._events[K],at]:C._events[K].push(at):(C._events[K]=at,C._eventsCount++),C}function A(C,R){0==--C._eventsCount?C._events=new E:delete C._events[R]}function m(){this._events=new E,this._eventsCount=0}Object.create&&(E.prototype=Object.create(null),(new E).__proto__||(M=!1)),m.prototype.eventNames=function(){var B,j,R=[];if(0===this._eventsCount)return R;for(j in B=this._events)N.call(B,j)&&R.push(M?j.slice(1):j);return Object.getOwnPropertySymbols?R.concat(Object.getOwnPropertySymbols(B)):R},m.prototype.listeners=function(R){var j=this._events[M?M+R:R];if(!j)return[];if(j.fn)return[j.fn];for(var tt=0,at=j.length,K=new Array(at);tt{"use strict";M.r(N),M.d(N,{default:()=>mu});var E={};M.r(E),M.d(E,{OG:()=>Nr,My:()=>vn,Ph:()=>Te,lX:()=>Br,Id:()=>cn,fg:()=>$i,qj:()=>Ee,aT:()=>yn,lq:()=>Xe,z:()=>Oi,Q5:()=>Dn});var y=M(467),_=M(5167),A=M(7403),m=M(177),C=M(9417),R=M(8834),B=M(1997),j=M(2102),tt=M(9213),at=M(9042),K=M(9115),nt=M(9183),L=M(450),O=M(4823),dt=M(9192),G=M(8865),V=M(3813),i=M(4438),ut=M(2577),kt=M(345);const Pt=["qrcElement"];let ot=(()=>{class e{constructor(t,r){this.renderer=t,this.sanitizer=r,this.allowEmptyString=!1,this.colorDark="#000000ff",this.colorLight="#ffffffff",this.cssClass="qrcode",this.elementType="canvas",this.errorCorrectionLevel="M",this.margin=4,this.qrdata="",this.scale=4,this.width=10,this.qrCodeURL=new i.bkB,this.context=null}ngOnChanges(){var t=this;return(0,y.A)(function*(){yield t.createQRCode()})()}isValidQrCodeText(t){return!1===this.allowEmptyString?!(typeof t>"u"||""===t||"null"===t||null===t):!(typeof t>"u")}toDataURL(t){return new Promise((r,o)=>{(0,ut.dY)(this.qrdata,t,(a,u)=>{a?o(a):r(u)})})}toCanvas(t,r){return new Promise((o,a)=>{(0,ut.mo)(t,this.qrdata,r,u=>{u?a(u):o("success")})})}toSVG(t){return new Promise((r,o)=>{(0,ut.toString)(this.qrdata,t,(a,u)=>{a?o(a):r(u)})})}renderElement(t){for(const r of this.qrcElement.nativeElement.childNodes)this.renderer.removeChild(this.qrcElement.nativeElement,r);this.renderer.appendChild(this.qrcElement.nativeElement,t)}createQRCode(){var t=this;return(0,y.A)(function*(){t.version&&t.version>40?(console.warn("[angularx-qrcode] max value for `version` is 40"),t.version=40):t.version&&t.version<1?(console.warn("[angularx-qrcode]`min value for `version` is 1"),t.version=1):void 0!==t.version&&isNaN(t.version)&&(console.warn("[angularx-qrcode] version should be a number, defaulting to auto."),t.version=void 0);try{if(!t.isValidQrCodeText(t.qrdata))throw new Error("[angularx-qrcode] Field `qrdata` is empty, set 'allowEmptyString=\"true\"' to overwrite this behaviour.");t.isValidQrCodeText(t.qrdata)&&""===t.qrdata&&(t.qrdata=" ");const r={color:{dark:t.colorDark,light:t.colorLight},errorCorrectionLevel:t.errorCorrectionLevel,margin:t.margin,scale:t.scale,version:t.version,width:t.width},o=t.imageSrc,a=t.imageHeight||40,u=t.imageWidth||40;switch(t.elementType){case"canvas":{const f=t.renderer.createElement("canvas");t.context=f.getContext("2d"),t.toCanvas(f,r).then(()=>{if(t.ariaLabel&&t.renderer.setAttribute(f,"aria-label",`${t.ariaLabel}`),t.title&&t.renderer.setAttribute(f,"title",`${t.title}`),o&&t.context){t.centerImage=new Image(u,a),o!==t.centerImage.src&&(t.centerImage.crossOrigin="anonymous",t.centerImage.src=o),a!==t.centerImage.height&&(t.centerImage.height=a),u!==t.centerImage.width&&(t.centerImage.width=u);const p=t.centerImage;p&&(p.onload=()=>{t.context?.drawImage(p,f.width/2-u/2,f.height/2-a/2,u,a)})}t.renderElement(f),t.emitQRCodeURL(f)}).catch(p=>{console.error("[angularx-qrcode] canvas error:",p)});break}case"svg":{const f=t.renderer.createElement("div");t.toSVG(r).then(p=>{t.renderer.setProperty(f,"innerHTML",p);const b=f.firstChild;t.renderer.setAttribute(b,"height",`${t.width}`),t.renderer.setAttribute(b,"width",`${t.width}`),t.renderElement(b),t.emitQRCodeURL(b)}).catch(p=>{console.error("[angularx-qrcode] svg error:",p)});break}default:{const f=t.renderer.createElement("img");t.toDataURL(r).then(p=>{t.alt&&f.setAttribute("alt",t.alt),t.ariaLabel&&f.setAttribute("aria-label",t.ariaLabel),f.setAttribute("src",p),t.title&&f.setAttribute("title",t.title),t.renderElement(f),t.emitQRCodeURL(f)}).catch(p=>{console.error("[angularx-qrcode] img/url error:",p)})}}}catch(r){console.error("[angularx-qrcode] Error generating QR Code:",r.message)}})()}convertBase64ImageUrlToBlob(t){const r=t.split(";base64,"),o=r[0].split(":")[1],a=atob(r[1]),u=new Uint8Array(a.length);for(let f=0;f{class e{static#t=this.\u0275fac=function(r){return new(r||e)};static#e=this.\u0275mod=i.$C({type:e});static#n=this.\u0275inj=i.G2t({})}return e})();var lt=M(7374),ht=M.n(lt),g=M(5164),s=M.n(g);ht().extend(s());class v{constructor(n=0,t=0,r=15){this.until=0,this.since=0,this.until=n,this.setDefaultUntil(),this.baseTimeDiff=r,this.originalBaseTimeDiff=this.baseTimeDiff,0===t?this.setDefaultSince():this.setDefaultSince(t),this.previousSince=t,this.previousUntil=n}incrementUserTimes(n){const t=n.at(-1);t?(this.revertBackToOriginalBaseTimeDiff(),this.setUntil(t.createdAt),this.setSince(t.createdAt)):(this.updateBaseTimeToFindPosts(),this.setDefaultUntil(),this.setDefaultSince())}resetFilterTimes(n=0){this.setDefaultSince(),this.setDefaultUntil(),0!==n&&(this.baseTimeDiff=n)}updateBaseTimeToFindPosts(){this.baseTimeDiff=10*this.baseTimeDiff}revertBackToOriginalBaseTimeDiff(){this.baseTimeDiff=this.originalBaseTimeDiff}getSinceAsDate(){return new Date(1e3*this.since)}getUntilAsDate(){return new Date(1e3*this.until)}getSinceFromNow(){const n=this.getSinceAsDate();return ht()(n).fromNow()}getUntilFromNow(){const n=this.getSinceAsDate();return ht()(n).fromNow()}printTimes(){const n=this.getUntilAsDate().getTime()-this.getSinceAsDate().getTime();console.log(`Until: ${this.getUntilFromNow()} | Since: ${this.getSinceFromNow()}`),console.log(`Diff: ${n}`)}printVars(){console.log(`Until: ${this.until}`),console.log(`Since: ${this.since}`),console.log(`baseTimeDiff: ${this.baseTimeDiff}`)}setDefaultSince(n=0){let t=new Date;const r=Math.floor(t.setMinutes(t.getMinutes()-this.baseTimeDiff-n)/1e3);this.since=r}setDefaultUntil(){this.until=Math.floor(Date.now()/1e3)}getNewSince(n,t=0){const r=new Date(1e3*n);return Math.floor(r.setMinutes(r.getMinutes()-this.baseTimeDiff-t)/1e3)}setUntil(n){this.previousUntil=this.until-2e3,this.until=n}setSince(n,t=0){this.previousSince=this.since,this.since=this.getNewSince(n,t)}}var k=M(7673),I=M(3726),w=M(1397),c=M(6354),x=M(8141),ft=M(5964),mt=M(3386);function pt(e,n,t,r){const o=window&&!!window.document&&window.document.documentElement;let a=o&&n?window:t;if(e&&(a=e&&o&&"string"==typeof e?function xt(e,n,t){return(t?window.document:n).querySelector(e)}(e,t.nativeElement,r):e,!a))throw new Error("ngx-infinite-scroll {resolveContainerElement()}: selector for");return a}function Mt(e){return e&&!e.firstChange}const Ut={clientHeight:"clientHeight",offsetHeight:"offsetHeight",scrollHeight:"scrollHeight",pageYOffset:"pageYOffset",offsetTop:"offsetTop",scrollTop:"scrollTop",top:"top"},Ct={clientHeight:"clientWidth",offsetHeight:"offsetWidth",scrollHeight:"scrollWidth",pageYOffset:"pageXOffset",offsetTop:"offsetLeft",scrollTop:"scrollLeft",top:"left"};class Tt{constructor(n=!0){this.vertical=n,this.propsMap=n?Ut:Ct}clientHeightKey(){return this.propsMap.clientHeight}offsetHeightKey(){return this.propsMap.offsetHeight}scrollHeightKey(){return this.propsMap.scrollHeight}pageYOffsetKey(){return this.propsMap.pageYOffset}offsetTopKey(){return this.propsMap.offsetTop}scrollTopKey(){return this.propsMap.scrollTop}topKey(){return this.propsMap.top}}function Yn(e){return["Window","global"].some(t=>Object.prototype.toString.call(e).includes(t))}function Ft(e,n){return e?n.document.documentElement:null}function zt(e,n){const t=function Zn({container:e,isWindow:n,axis:t}){const{offsetHeightKey:r,clientHeightKey:o}=qt(t);return Ht(e,n,r,o)}(n);return n.isWindow?function Kn(e,n,t){const{axis:r,container:o,isWindow:a}=t,{offsetHeightKey:u,clientHeightKey:f}=qt(r),p=e+Sn(Ft(a,o),r,a),b=Ht(n.nativeElement,a,u,f),S=function Xt(e,n,t){const r=n.topKey();if(e.getBoundingClientRect)return e.getBoundingClientRect()[r]+Sn(e,n,t)}(n.nativeElement,r,a)+b;return{height:e,scrolled:p,totalToScroll:S,isWindow:a}}(t,e,n):function Zt(e,n,t){const{axis:r,container:o}=t;return{height:e,scrolled:o[r.scrollTopKey()],totalToScroll:o[r.scrollHeightKey()],isWindow:!1}}(t,0,n)}function qt(e){return{offsetHeightKey:e.offsetHeightKey(),clientHeightKey:e.clientHeightKey()}}function Ht(e,n,t,r){if(isNaN(e[t])){const o=Ft(n,e);return o?o[r]:0}return e[t]}function Sn(e,n,t){const r=n.pageYOffsetKey(),o=n.scrollTopKey(),a=n.offsetTopKey();return isNaN(window.pageYOffset)?Ft(t,e)[o]:e.ownerDocument?e.ownerDocument.defaultView[r]:e[a]}function Jt(e,n={down:0,up:0},t){let r,o;if(e.totalToScroll<=0)return!1;const a=e.isWindow?e.scrolled:e.height+e.scrolled;return t?(r=(e.totalToScroll-a)/e.totalToScroll,o=(n?.down?n.down:0)/10):(r=e.scrolled/(e.scrolled+(e.totalToScroll-a)),o=(n?.up?n.up:0)/10),r<=o}class ne{constructor(n){this.lastScrollPosition=0,this.lastTotalToScroll=0,this.totalToScroll=0,this.triggered={down:0,up:0},Object.assign(this,n)}updateScrollPosition(n){return this.lastScrollPosition=n}updateTotalToScroll(n){this.lastTotalToScroll!==n&&(this.lastTotalToScroll=this.totalToScroll,this.totalToScroll=n)}updateScroll(n,t){this.updateScrollPosition(n),this.updateTotalToScroll(t)}updateTriggeredFlag(n,t){t?this.triggered.down=n:this.triggered.up=n}isTriggeredScroll(n,t){return t?this.triggered.down===n:this.triggered.up===n}}const $t={DOWN:"[NGX_ISE] DOWN",UP:"[NGX_ISE] UP"};function Qn(e){const{scrollDown:n,stats:{scrolled:t}}=e;return{type:n?$t.DOWN:$t.UP,payload:{currentScrollPosition:t}}}let oe=(()=>{class e{constructor(t,r){this.element=t,this.zone=r,this.scrolled=new i.bkB,this.scrolledUp=new i.bkB,this.infiniteScrollDistance=2,this.infiniteScrollUpDistance=1.5,this.infiniteScrollThrottle=150,this.infiniteScrollDisabled=!1,this.infiniteScrollContainer=null,this.scrollWindow=!0,this.immediateCheck=!1,this.horizontal=!1,this.alwaysCallback=!1,this.fromRoot=!1}ngAfterViewInit(){this.infiniteScrollDisabled||this.setup()}ngOnChanges({infiniteScrollContainer:t,infiniteScrollDisabled:r,infiniteScrollDistance:o}){const a=Mt(t),u=Mt(r),f=Mt(o),p=!u&&!this.infiniteScrollDisabled||u&&!r.currentValue||f;(a||u||f)&&(this.destroyScroller(),p&&this.setup())}ngOnDestroy(){this.destroyScroller()}setup(){(function St(){return typeof window<"u"})()&&this.zone.runOutsideAngular(()=>{this.disposeScroller=function re(e){const{scrollContainer:n,scrollWindow:t,element:r,fromRoot:o}=e,a=function Yt({windowElement:e,axis:n}){return function Kt(e,n){const t=e.isWindow||n&&!n.nativeElement?n:n.nativeElement;return{...e,container:t}}({axis:n,isWindow:Yn(e)},e)}({axis:new Tt(!e.horizontal),windowElement:pt(n,t,r,o)}),u=new ne({totalToScroll:zt(r,a).totalToScroll}),p={up:e.upDistance,down:e.downDistance};return function Jn(e){let n=(0,I.R)(e.container,"scroll");return e.throttle&&(n=n.pipe((0,mt.c)(e.throttle,void 0,{leading:!0,trailing:!0}))),n}({container:a.container,throttle:e.throttle}).pipe((0,w.Z)(()=>(0,k.of)(zt(r,a))),(0,c.T)(b=>function ie(e,n,t){const{scrollDown:r,fire:o}=function Xn(e,n,t){const r=function Qt(e,n){return eu.updateScroll(b.scrolled,b.totalToScroll)),(0,ft.p)(({fire:b,scrollDown:S,stats:{totalToScroll:T}})=>function Ye(e,n,t){return!!(e&&n||!t&&n)}(e.alwaysCallback,b,u.isTriggeredScroll(T,S))),(0,x.M)(({scrollDown:b,stats:{totalToScroll:S}})=>{u.updateTriggeredFlag(S,b)}),(0,c.T)(Qn))}({fromRoot:this.fromRoot,alwaysCallback:this.alwaysCallback,disable:this.infiniteScrollDisabled,downDistance:this.infiniteScrollDistance,element:this.element,horizontal:this.horizontal,scrollContainer:this.infiniteScrollContainer,scrollWindow:this.scrollWindow,throttle:this.infiniteScrollThrottle,upDistance:this.infiniteScrollUpDistance}).subscribe(t=>this.handleOnScroll(t))})}handleOnScroll({type:t,payload:r}){const o=t===$t.DOWN?this.scrolled:this.scrolledUp;(function se(e){return e.observed??e.observers.length>0})(o)&&this.zone.run(()=>o.emit(r))}destroyScroller(){this.disposeScroller&&this.disposeScroller.unsubscribe()}static#t=this.\u0275fac=function(r){return new(r||e)(i.rXU(i.aKT),i.rXU(i.SKi))};static#e=this.\u0275dir=i.FsC({type:e,selectors:[["","infiniteScroll",""],["","infinite-scroll",""],["","data-infinite-scroll",""]],inputs:{infiniteScrollDistance:"infiniteScrollDistance",infiniteScrollUpDistance:"infiniteScrollUpDistance",infiniteScrollThrottle:"infiniteScrollThrottle",infiniteScrollDisabled:"infiniteScrollDisabled",infiniteScrollContainer:"infiniteScrollContainer",scrollWindow:"scrollWindow",immediateCheck:"immediateCheck",horizontal:"horizontal",alwaysCallback:"alwaysCallback",fromRoot:"fromRoot"},outputs:{scrolled:"scrolled",scrolledUp:"scrolledUp"},standalone:!0,features:[i.OA$]})}return e})(),Cn=(()=>{class e{static#t=this.\u0275fac=function(r){return new(r||e)};static#e=this.\u0275mod=i.$C({type:e});static#n=this.\u0275inj=i.G2t({})}return e})();var Lt=M(1413),jt=M(6977),rn=M(2953);class ae{constructor(n,t,r,o,a,u,f=[]){this.username="",this.picture="/images/avatars/avatar-placeholder.png",this.replyCount=0,this.likeCount=0,this.zapCount=0,this.repostCount=0,this.likedByMe=!1,this.replies=[],this.likers=[],this.reposters=[],this.zappers=[],this.relatedEventIds=[],this.rootEventId="",this.replyToEventId="",this.mentions=[],this.hashtags=[],this.repostedByMe=!1,this.tags=[],this.isAReply=!1,this.kind=t,this.pubkey=r,this.content=o,this.noteId=a,this.createdAt=u,this.date=new Date(1e3*this.createdAt),this.fromNow=this.calculateTimeFromNow(this.date),this.tags=f,this.id=n}calculateTimeFromNow(n){const r=Math.floor(((new Date).getTime()-n.getTime())/1e3);return r<60?`${r} seconds ago`:r<3600?`${Math.floor(r/60)} minutes ago`:r<86400?`${Math.floor(r/3600)} hours ago`:r<2592e3?`${Math.floor(r/86400)} days ago`:r<31536e3?`${Math.floor(r/2592e3)} months ago`:`${Math.floor(r/31536e3)} years ago`}}var Dt=M(7442),hn=M(4412),Vt=M(6231),Gt=M(4930),An=M(2827);let Wt=(()=>{class e{constructor(t,r,o){this.relayService=t,this.signerService=r,this.metadataService=o,this.eventsSubject=new hn.t([]),this.isLoading=new hn.t(!1),this.lastLoadedEventTime=null,this.pageSize=10,this.noMoreEvents=new hn.t(!1),this.seenEventIds=new Set,this.likesMap=new Map,this.repliesMap=new Map,this.zapsMap=new Map,this.repostsMap=new Map,this.hasLikedMap=new Map,this.hasRepostedMap=new Map,this.jobQueue=[],this.isProcessingQueue=!1,this.myLikedNoteIds=[],this.clearEvents(),this.getMyLikes().then(()=>{}).catch(a=>{console.error("Failed to load user likes:",a)})}subscribeToEvents(t){var r=this;return(0,y.A)(function*(){yield r.relayService.ensureConnectedRelays();const o=r.relayService.getConnectedRelays().slice(0,3);if(!o||0===o.length)return void console.error("No connected relays available.");const a=[{kinds:[1],authors:t,limit:r.pageSize},{"#p":t,limit:1}];r.relayService.getPool().subscribeMany(o,a,{onevent:u=>{r.isReply(u)||r.handleNewOrUpdatedEvent(u);const f=r.getParentEventId(u);switch(f&&r.enqueueJob(f,"replies"),u.kind){case 7:r.enqueueJob(f,"likes");break;case 9735:r.enqueueJob(f,"zaps");break;case 6:r.enqueueJob(f,"reposts")}},oneose:()=>{}})})()}getParentEventId(t){const r=t.tags.find(o=>"e"===o[0]);return r?r[1]:null}handleNewOrUpdatedEvent(t){var r=this;return(0,y.A)(function*(){switch(t.kind){case 1:if(!r.seenEventIds.has(t.id)){r.seenEventIds.add(t.id);const o=yield r.createNewEvent(t),a=r.eventsSubject.getValue();r.eventsSubject.next([o,...a].sort((u,f)=>f.createdAt-u.createdAt)),r.updateEventInSubject(t.id)}break;case 7:r.handleLikeEvent(t);break;case 9735:r.handleZapEvent(t);break;case 6:r.handleRepostEvent(t);break;case 4:r.handleReplyEvent(t)}})()}handleLikeEvent(t){const r=t.tags.find(o=>"e"===o[0])?.[1];if(r){const a=this.eventsSubject.getValue().map(u=>(u.id===r&&(u.likeCount+=1,u.likers=[...u.likers||[],t.pubkey]),u));this.eventsSubject.next(a)}}handleZapEvent(t){const r=t.tags.find(o=>"e"===o[0])?.[1];if(r){const a=this.eventsSubject.getValue().map(u=>(u.id===r&&(u.zapCount+=1,u.zappers=[...u.zappers||[],t.pubkey]),u));this.eventsSubject.next(a)}}handleRepostEvent(t){const r=t.tags.find(o=>"e"===o[0])?.[1];if(r){const a=this.eventsSubject.getValue().map(u=>(u.id===r&&(u.repostCount+=1,u.reposters=[...u.reposters||[],t.pubkey]),u));this.eventsSubject.next(a)}}handleReplyEvent(t){var r=this;return(0,y.A)(function*(){const o=t.tags.find(a=>"e"===a[0])?.[1];if(o){const a=yield r.createNewEvent(t),f=r.eventsSubject.getValue().map(p=>(p.id===o&&(p.replyCount+=1,p.replies=[...p.replies||[],a]),p));r.eventsSubject.next(f)}})()}isReply(t){return t.tags.filter(o=>"e"===o[0]||"p"===o[0]).length>0}getMyLikes(){var t=this;return(0,y.A)(function*(){const r={kinds:[7],authors:[t.signerService.getPublicKey()]};try{return(yield t.fetchFilteredEvents(r)).forEach(a=>{const u=a.tags.find(f=>"e"===f[0]);u&&t.myLikedNoteIds.push(u[1])}),t.myLikedNoteIds}catch(o){return console.error("Failed to get user likes:",o),[]}})()}loadMoreEvents(t){var r=this;return(0,y.A)(function*(){if(r.isLoading.value||r.noMoreEvents.value)return;r.isLoading.next(!0);const o={authors:t,kinds:[1],until:r.lastLoadedEventTime||Math.floor(Date.now()/1e3),limit:r.pageSize};try{const a=yield r.fetchFilteredEvents(o);if(a.length0){r.lastLoadedEventTime=a[a.length-1].created_at;const u=a.filter(p=>!r.seenEventIds.has(p.id)&&!r.isReply(p));u.forEach(p=>r.seenEventIds.add(p.id));const f=yield Promise.all(u.map(p=>r.createNewEvent(p)));r.eventsSubject.next([...r.eventsSubject.getValue(),...f].sort((p,b)=>b.createdAt-p.createdAt))}else r.noMoreEvents.next(!0)}catch(a){console.error("Error loading more events:",a)}finally{r.isLoading.next(!1)}})()}fetchFilteredEvents(t){var r=this;return(0,y.A)(function*(){yield r.relayService.ensureConnectedRelays();const o=r.relayService.getConnectedRelays(),a=new Map,u=r.relayService.getPool();return yield Promise.all(o.map(function(){var f=(0,y.A)(function*(p){(yield u.querySync([p],t)).forEach(S=>{a.has(S.id)||a.set(S.id,S)})});return function(p){return f.apply(this,arguments)}}())),Array.from(a.values())})()}createNewEvent(t){var r=this;return(0,y.A)(function*(){const o=new ae(t.id,t.kind,t.pubkey,t.content,t.id,t.created_at,t.tags);r.enqueueJob(t.id,"replies"),r.enqueueJob(t.id,"likes"),r.enqueueJob(t.id,"reposts"),r.enqueueJob(t.id,"zaps"),yield r.processJobQueue(),o.likedByMe=r.myLikedNoteIds.includes(t.id);const a=yield r.metadataService.fetchMetadataWithCache(t.pubkey);return a&&(o.username=a.name||o.npub,o.picture=a.picture||"/images/avatars/avatar-placeholder.png"),o})()}enqueueJob(t,r){this.jobQueue.some(o=>o.eventId===t&&o.jobType===r)||(this.jobQueue.push({eventId:t,jobType:r}),this.isProcessingQueue||this.processJobQueue())}processJobQueue(){var t=this;return(0,y.A)(function*(){if(t.isProcessingQueue)return;t.isProcessingQueue=!0;const r=[];for(;t.jobQueue.length>0||r.length>0;){for(;t.jobQueue.length>0&&r.length<10;){const o=t.jobQueue.shift();if(!o)break;const a=t.processJob(o);r.push(a),a.then(()=>{r.splice(r.indexOf(a),1)}).catch(u=>{console.error("Error processing job:",u),r.splice(r.indexOf(a),1)})}yield Promise.race(r)}t.isProcessingQueue=!1})()}processJob(t){var r=this;return(0,y.A)(function*(){switch(t.jobType){case"replies":const o=yield r.fetchReplies(t.eventId);r.repliesMap.set(t.eventId,o);break;case"likes":const a=yield r.getLikers(t.eventId);r.likesMap.set(t.eventId,a);break;case"zaps":const u=yield r.getZappers(t.eventId);r.zapsMap.set(t.eventId,u);break;case"reposts":const f=yield r.getReposters(t.eventId);r.repostsMap.set(t.eventId,f)}r.updateEventInSubject(t.eventId)})()}updateEventInSubject(t){const o=this.eventsSubject.getValue().map(a=>(a.id===t&&(a.replyCount=this.getRepliesCount(t),a.replies=this.repliesMap.get(t)||[],a.likeCount=this.getLikesCount(t),a.likers=this.likesMap.get(t)||[],a.zapCount=this.getZapsCount(t),a.zappers=this.zapsMap.get(t)||[],a.repostCount=this.getRepostsCount(t),a.reposters=this.repostsMap.get(t)||[]),a));this.eventsSubject.next(o)}fetchReplies(t){var r=this;return(0,y.A)(function*(){const o={"#e":[t],kinds:[1]},a=yield r.fetchFilteredEvents(o),u=new Map;return a.forEach(f=>{u.has(f.id)||u.set(f.id,f)}),Promise.all(Array.from(u.values()).map(f=>r.createNewEvent(f)))})()}getLikers(t){var r=this;return(0,y.A)(function*(){const o={"#e":[t],kinds:[7]};return(yield r.fetchFilteredEvents(o)).map(u=>u.pubkey)})()}getZappers(t){var r=this;return(0,y.A)(function*(){const o={"#e":[t],kinds:[9735]};return(yield r.fetchFilteredEvents(o)).map(u=>u.pubkey)})()}getReposters(t){var r=this;return(0,y.A)(function*(){const o={"#e":[t],kinds:[6]};return(yield r.fetchFilteredEvents(o)).map(u=>u.pubkey)})()}getRepliesCount(t){return(this.repliesMap.get(t)||[]).length}getLikesCount(t){return(this.likesMap.get(t)||[]).length}getZapsCount(t){return(this.zapsMap.get(t)||[]).length}getRepostsCount(t){return(this.repostsMap.get(t)||[]).length}hasUserLiked(t){return this.hasLikedMap.get(t)||!1}hasUserReposted(t){return this.hasRepostedMap.get(t)||!1}getEventStream(){return this.eventsSubject.asObservable().pipe((0,mt.c)(1e3))}hasMoreEvents(){return this.noMoreEvents.asObservable()}sendTextEvent(t){var r=this;return(0,y.A)(function*(){if(t)try{const a=r.signerService.getUnsignedEvent(1,[],t);let u;if(r.signerService.isUsingSecretKey()){const f=yield r.signerService.getDecryptedSecretKey(),p=(0,rn.aT)(f);u=(0,Dt.pC)(a,p)}else u=yield r.signerService.signEventWithExtension(a);yield r.relayService.publishEventToWriteRelays(u)}catch(o){console.error("Failed to send text event:",o)}})()}sendLikeEvent(t){var r=this;return(0,y.A)(function*(){if(t)try{const u=r.signerService.getUnsignedEvent(7,[["e",t.id],["p",t.pubkey]],"+");let f;if(r.signerService.isUsingSecretKey()){const p=yield r.signerService.getDecryptedSecretKey(),b=(0,rn.aT)(p);f=(0,Dt.pC)(u,b)}else f=yield r.signerService.signEventWithExtension(u);yield r.relayService.publishEventToWriteRelays(f),r.likesMap.set(t.id,[...r.likesMap.get(t.id)||[],r.signerService.getPublicKey()]),r.hasLikedMap.set(t.id,!0)}catch(o){console.error("Failed to send like event:",o)}})()}sendZapEvent(t,r){var o=this;return(0,y.A)(function*(){if(t&&!(r<=0))try{const a=[["e",t.id],["p",t.pubkey],["amount",r.toString()]],f=o.signerService.getUnsignedEvent(9735,a,`Zapped with ${r} sats`);let p;if(o.signerService.isUsingSecretKey()){const b=yield o.signerService.getDecryptedSecretKey(),S=(0,rn.aT)(b);p=(0,Dt.pC)(f,S)}else p=yield o.signerService.signEventWithExtension(f);yield o.relayService.publishEventToWriteRelays(p)}catch(a){console.error("Failed to send zap event:",a)}})()}sendReplyEvent(t,r){var o=this;return(0,y.A)(function*(){if(t)try{const u=o.signerService.getUnsignedEvent(1,[["e",t.id],["p",t.pubkey]],r);let f;if(o.signerService.isUsingSecretKey()){const p=yield o.signerService.getDecryptedSecretKey(),b=(0,rn.aT)(p);f=(0,Dt.pC)(u,b)}else f=yield o.signerService.signEventWithExtension(u);yield o.relayService.publishEventToWriteRelays(f)}catch(a){console.error("Failed to send reply event:",a)}})()}clearEvents(){this.eventsSubject.next([]),this.seenEventIds.clear(),this.lastLoadedEventTime=null,this.noMoreEvents.next(!1)}static#t=this.\u0275fac=function(r){return new(r||e)(i.KVO(Vt.b),i.KVO(Gt.A),i.KVO(An.T))};static#e=this.\u0275prov=i.jDH({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var le=M(413);const tr=e=>({"heart-beat":e}),ce=e=>({"rotate-180":e});function ue(e,n){if(1&e){const t=i.RV6();i.j41(0,"div",53)(1,"emoji-mart",54),i.bIt("emojiClick",function(o){i.eBV(t);const a=i.XpG().index,u=i.XpG();return i.Njj(u.addEmojiToComment(o,a))}),i.k0s()()}if(2&e){const t=i.XpG(2);i.R7$(),i.Y8G("darkMode",t.darkMode)}}function er(e,n){if(1&e&&(i.j41(0,"div",55),i.nrm(1,"img",56),i.j41(2,"div",57)(3,"span")(4,"b"),i.EFF(5),i.k0s(),i.EFF(6),i.k0s(),i.j41(7,"div",58)(8,"span",59),i.EFF(9,"Like"),i.k0s(),i.j41(10,"span",59),i.EFF(11,"Reply"),i.k0s(),i.j41(12,"span",59),i.EFF(13,"Hide replies"),i.k0s(),i.j41(14,"span",60),i.EFF(15,"\u2022"),i.k0s(),i.j41(16,"span"),i.EFF(17),i.k0s()()()()),2&e){const t=n.$implicit,r=i.XpG(2);i.R7$(),i.FS9("alt",t.username),i.Y8G("src",t.picture||"images/avatars/avatar-placeholder.png",i.B4B),i.R7$(4),i.SpI("",t.username,": "),i.R7$(),i.SpI(" ",t.content," "),i.R7$(11),i.JRh(r.getTimeFromNow(t))}}function fe(e,n){if(1&e){const t=i.RV6();i.j41(0,"angor-card",7,0)(2,"div",8),i.nrm(3,"img",9),i.j41(4,"div",10)(5,"span",11),i.EFF(6),i.k0s(),i.j41(7,"span",12),i.EFF(8),i.k0s()(),i.j41(9,"button",13),i.nrm(10,"mat-icon",14),i.k0s(),i.j41(11,"mat-menu",null,1)(13,"button",15)(14,"span",16),i.nrm(15,"mat-icon",17),i.j41(16,"span"),i.EFF(17,"Save post"),i.k0s()()(),i.j41(18,"button",15)(19,"span",16),i.nrm(20,"mat-icon",17),i.j41(21,"span"),i.EFF(22,"Hide post"),i.k0s()()(),i.j41(23,"button",15)(24,"span",16),i.nrm(25,"mat-icon",17),i.j41(26,"span"),i.EFF(27,"Snooze for 30 days"),i.k0s()()(),i.j41(28,"button",15)(29,"span",16),i.nrm(30,"mat-icon",17),i.j41(31,"span"),i.EFF(32,"Hide all"),i.k0s()()(),i.nrm(33,"mat-divider",18),i.j41(34,"button",15)(35,"span",16),i.nrm(36,"mat-icon",17),i.j41(37,"span"),i.EFF(38,"Report post"),i.k0s()()(),i.j41(39,"button",15)(40,"span",16),i.nrm(41,"mat-icon",17),i.j41(42,"span"),i.EFF(43,"Turn on notifications for this post"),i.k0s()()()()(),i.nrm(44,"div",19)(45,"div",20),i.j41(46,"div",21)(47,"button",22),i.bIt("click",function(){const o=i.eBV(t).$implicit,a=i.XpG();return i.Njj(a.toggleLike(o))}),i.nrm(48,"mat-icon",23),i.j41(49,"span",24),i.EFF(50),i.k0s()(),i.j41(51,"button",22),i.bIt("click",function(){i.eBV(t);const o=i.sdS(1);return i.Njj(o.expanded=!o.expanded)}),i.nrm(52,"mat-icon",14),i.j41(53,"span",24),i.EFF(54,"Comment"),i.k0s()(),i.j41(55,"button",25),i.nrm(56,"mat-icon",14),i.j41(57,"span",24),i.EFF(58,"Share"),i.k0s()()(),i.nrm(59,"hr",26),i.j41(60,"div",27)(61,"div",16),i.nrm(62,"img",28)(63,"img",29)(64,"img",29)(65,"img",29),i.j41(66,"div",30),i.EFF(67),i.k0s()(),i.nrm(68,"div",31),i.j41(69,"div",32)(70,"button",33),i.EFF(71),i.k0s(),i.j41(72,"button",34),i.bIt("click",function(){i.eBV(t);const o=i.sdS(1);return i.Njj(o.expanded=!o.expanded)}),i.j41(73,"span",35),i.EFF(74),i.k0s(),i.nrm(75,"mat-icon",36),i.k0s()()(),i.qex(76,37),i.nrm(77,"hr",38),i.j41(78,"div",39)(79,"div",40),i.nrm(80,"img",41),i.j41(81,"mat-form-field",42)(82,"textarea",43),i.bIt("ngModelChange",function(o){const a=i.eBV(t).index,u=i.XpG();return i.Njj(u.setComment(a,o))}),i.EFF(83," "),i.k0s()()(),i.j41(84,"div",44)(85,"div",16)(86,"button",45),i.bIt("click",function(){const o=i.eBV(t).index,a=i.XpG();return i.Njj(a.toggleCommentEmojiPicker(o))}),i.nrm(87,"mat-icon",14),i.k0s(),i.DNE(88,ue,2,1,"div",46),i.j41(89,"button",47),i.nrm(90,"mat-icon",14),i.k0s(),i.j41(91,"button",47),i.nrm(92,"mat-icon",14),i.k0s()(),i.j41(93,"button",48),i.bIt("click",function(){const o=i.eBV(t),a=o.$implicit,u=o.index,f=i.XpG();return i.Njj(f.sendComment(a,u))}),i.nrm(94,"mat-icon",49),i.j41(95,"span"),i.EFF(96,"Send"),i.k0s()()()(),i.j41(97,"div",50)(98,"div",51),i.DNE(99,er,18,5,"div",52),i.k0s()(),i.bVm(),i.k0s()}if(2&e){const t=n.$implicit,r=n.index,o=i.sdS(1),a=i.sdS(12),u=i.XpG();i.R7$(3),i.FS9("alt",t.username),i.Y8G("src",t.picture||"images/avatars/avatar-placeholder.png",i.B4B),i.R7$(3),i.JRh(t.username),i.R7$(2),i.JRh(u.getTimeFromNow(t)),i.R7$(),i.Y8G("matMenuTriggerFor",a),i.R7$(),i.Y8G("svgIcon","heroicons_solid:ellipsis-vertical"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:arrow-up-tray"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:eye-slash"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:clock"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:minus-circle"),i.R7$(6),i.Y8G("svgIcon","heroicons_solid:exclamation-triangle"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:bell"),i.R7$(3),i.Y8G("innerHTML",u.parseContent.parseContent(t.content),i.npT),i.R7$(4),i.Y8G("ngClass",i.eq3(33,tr,t.likedByMe))("svgIcon",t.likedByMe?"heroicons_solid:heart":"heroicons_outline:heart"),i.R7$(2),i.SpI("",t.likeCount," Like"),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:chat-bubble-left-ellipsis"),i.R7$(4),i.Y8G("svgIcon","heroicons_solid:share"),i.R7$(11),i.SpI(" \u26a1 ",t.zapCount," zap "),i.R7$(4),i.SpI(" ",t.repostCount," shares "),i.R7$(3),i.SpI("",t.replyCount," Comments"),i.R7$(),i.Y8G("ngClass",i.eq3(35,ce,o.expanded))("svgIcon","heroicons_mini:chevron-down"),i.R7$(5),i.FS9("alt",(null==u.currentUserMetadata?null:u.currentUserMetadata.display_name)||(null==u.currentUserMetadata?null:u.currentUserMetadata.name)||"Avatar"),i.Y8G("src",(null==u.currentUserMetadata?null:u.currentUserMetadata.picture)||"images/avatars/avatar-placeholder.png",i.B4B),i.R7$(),i.Y8G("subscriptSizing","dynamic"),i.R7$(),i.Y8G("ngModel",u.getComment(r)),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:face-smile"),i.R7$(),i.Y8G("ngIf",null==u.eventStates[r]?null:u.eventStates[r].showEmojiPicker),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:photo"),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:sparkles"),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:paper-airplane"),i.R7$(5),i.Y8G("ngForOf",t.replies)}}function he(e,n){1&e&&(i.j41(0,"div",61),i.nrm(1,"div",62),i.EFF(2," Loading events...\n"),i.k0s())}function nr(e,n){if(1&e){const t=i.RV6();i.j41(0,"button",63),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.loadMoreEvents())}),i.EFF(1," Load More Events "),i.k0s()}}function de(e,n){1&e&&(i.j41(0,"div",64),i.EFF(1,"No more events to load."),i.k0s())}let me=(()=>{class e{constructor(t,r,o,a){this.paginatedEventService=t,this.changeDetectorRef=r,this.sanitizer=o,this.parseContent=a,this.pubkeys=[],this.eventStates=[],this.subscriptions=[],this.isLoading=!1,this.noMoreEvents=!1,this.events$=this.paginatedEventService.getEventStream()}ngOnInit(){this.resetAll()}subscribeToEvents(){if(this.unsubscribeAll(),!this.pubkeys||0===this.pubkeys.length)return void console.warn("No public keys provided");this.paginatedEventService.subscribeToEvents(this.pubkeys).then(()=>{console.log("Subscribed to events for the new user.")}).catch(r=>{console.error("Error subscribing to events:",r)});const t=this.events$.subscribe(r=>{const o=r.filter(a=>this.pubkeys.includes(a.pubkey));this.eventStates=o.map(()=>({showEmojiPicker:!1,comment:""})),this.changeDetectorRef.markForCheck()});this.subscriptions.push(t)}resetAll(){this.unsubscribeAll(),this.clearComponentState(),this.paginatedEventService.clearEvents(),this.subscribeToEvents(),this.loadInitialEvents()}unsubscribeAll(){this.subscriptions.forEach(t=>t.unsubscribe()),this.subscriptions=[]}clearComponentState(){this.eventStates=[],this.isLoading=!1,this.noMoreEvents=!1,this.changeDetectorRef.markForCheck()}loadInitialEvents(){0!==this.pubkeys.length?(this.isLoading=!0,this.paginatedEventService.loadMoreEvents(this.pubkeys).finally(()=>{this.isLoading=!1,this.changeDetectorRef.markForCheck()})):console.warn("No pubkeys provided")}loadMoreEvents(){!this.isLoading&&!this.noMoreEvents&&(this.isLoading=!0,this.paginatedEventService.loadMoreEvents(this.pubkeys).finally(()=>{this.isLoading=!1,this.changeDetectorRef.markForCheck()}))}getComment(t){return this.eventStates[t]?.comment||""}setComment(t,r){this.eventStates[t]&&(this.eventStates[t].comment=r)}getSanitizedContent(t){return this.sanitizer.bypassSecurityTrustHtml(t)}sendLike(t){t.likedByMe||this.paginatedEventService.sendLikeEvent(t).then(()=>{t.likedByMe=!0,t.likeCount++,this.changeDetectorRef.markForCheck()}).catch(r=>console.error("Failed to send like:",r))}toggleLike(t){this.sendLike(t)}toggleCommentEmojiPicker(t){this.eventStates[t].showEmojiPicker=!this.eventStates[t].showEmojiPicker}addEmojiToComment(t,r){this.eventStates[r].comment+=t.emoji.native,this.eventStates[r].showEmojiPicker=!1}sendComment(t,r){const o=this.eventStates[r].comment;""!==o.trim()&&this.paginatedEventService.sendReplyEvent(t,o).then(()=>{this.eventStates[r].comment="",this.changeDetectorRef.markForCheck()})}trackById(t,r){return r.id}ngOnDestroy(){this.unsubscribeAll()}getTimeFromNow(t){return t.fromNow}static#t=this.\u0275fac=function(r){return new(r||e)(i.rXU(Wt),i.rXU(i.gRc),i.rXU(kt.up),i.rXU(le.m))};static#e=this.\u0275cmp=i.VBU({type:e,selectors:[["app-event-list"]],inputs:{pubkeys:"pubkeys",currentUserMetadata:"currentUserMetadata"},standalone:!0,features:[i.aNF],decls:6,vars:9,consts:[["expandableComments","angorCard"],["postCardMenu02","matMenu"],["infiniteScroll","",1,"",3,"scrolled","infiniteScrollDistance","infiniteScrollThrottle","scrollWindow"],["class","mb-8 flex w-full flex-col",4,"ngFor","ngForOf"],["class","loading-spinner",4,"ngIf"],["class","load-more-btn",3,"click",4,"ngIf"],["class","no-more-events",4,"ngIf"],[1,"mb-8","flex","w-full","flex-col"],[1,"mx-6","mb-4","mt-6","flex","items-center","sm:mx-8"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"mr-4","h-10","w-10","rounded-full",3,"src","alt"],[1,"flex","flex-col"],[1,"font-semibold","leading-none"],[1,"text-secondary","mt-1","text-sm","leading-none"],["mat-icon-button","",1,"-mr-4","ml-auto",3,"matMenuTriggerFor"],[1,"icon-size-5",3,"svgIcon"],["mat-menu-item",""],[1,"flex","items-center"],[1,"mr-3","icon-size-5",3,"svgIcon"],[1,"my-2"],[1,"mx-6","mb-6","mt-2","sm:mx-8",3,"innerHTML"],[1,"relative","mb-4"],[1,"mx-3","flex","items-center","sm:mx-5"],["mat-button","",1,"mr-1","px-3",3,"click"],[1,"text-red-500","icon-size-5",3,"ngClass","svgIcon"],[1,"ml-2"],["mat-button","",1,"mr-1","px-3"],[1,"mx-6","mb-6","mt-4","border-b","sm:mx-8"],[1,"mx-6","mb-4","flex","flex-col","sm:mx-8","sm:mb-6","sm:flex-row","sm:items-center"],["src","images/avatars/avatar-placeholder.png","alt","Card cover image",1,"text-card","m-0.5","h-6","w-6","rounded-full","ring-2","ring-white"],["src","images/avatars/avatar-placeholder.png","alt","Card cover image",1,"text-card","m-0.5","-ml-3","h-6","w-6","rounded-full","ring-2","ring-white"],[1,"ml-3","text-md","tracking-tight"],[1,"hidden","flex-auto","sm:flex"],[1,"mt-4","flex","items-center","sm:mt-0"],["mat-button","",1,"-ml-2","mr-1","px-3","sm:ml-0"],["mat-button","",1,"px-3","sm:-mr-4",3,"click"],[1,"mr-1"],[1,"rotate-0","transition-transform","duration-150","ease-in-out","icon-size-5",3,"ngClass","svgIcon"],["angorCardExpansion",""],[1,"m-0","border-b"],[1,"mx-4","mb-3","mt-6","flex","flex-col","sm:mx-8"],[1,"flex","items-start"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"mr-5","h-12","w-12","rounded-full","object-cover",3,"src","alt"],[1,"w-full",3,"subscriptSizing"],["placeholder","Write a comment...","matInput","",3,"ngModelChange","ngModel"],[1,"mt-3","flex","items-center","justify-between"],["mat-icon-button","",3,"click"],["class","emoji-picker-container-global",4,"ngIf"],["mat-icon-button",""],["mat-button","",3,"click"],[3,"svgIcon"],[1,"max-h-120","overflow-y-auto"],[1,"relative","mx-4","my-6","flex","flex-col","sm:mx-8"],["class","flex items-start mb-4",4,"ngFor","ngForOf"],[1,"emoji-picker-container-global"],[3,"emojiClick","darkMode"],[1,"flex","items-start","mb-4"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"mr-4","h-8","w-8","rounded-full",3,"src","alt"],[1,"mt-0.5","flex","flex-col"],[1,"text-secondary","mt-2","flex","items-center","text-sm"],[1,"mr-2","cursor-pointer","hover:underline"],[1,"mr-2"],[1,"loading-spinner"],[1,"spinner"],[1,"load-more-btn",3,"click"],[1,"no-more-events"]],template:function(r,o){1&r&&(i.j41(0,"div",2),i.bIt("scrolled",function(){return o.loadMoreEvents()}),i.DNE(1,fe,100,37,"angor-card",3),i.nI1(2,"async"),i.DNE(3,he,3,0,"div",4)(4,nr,2,0,"button",5),i.k0s(),i.DNE(5,de,2,0,"div",6)),2&r&&(i.Y8G("infiniteScrollDistance",2)("infiniteScrollThrottle",500)("scrollWindow",!0),i.R7$(),i.Y8G("ngForOf",i.bMT(2,7,o.events$)),i.R7$(2),i.Y8G("ngIf",o.isLoading),i.R7$(),i.Y8G("ngIf",!o.noMoreEvents&&!o.isLoading),i.R7$(),i.Y8G("ngIf",o.noMoreEvents))},dependencies:[_.n,tt.m_,tt.An,R.Hl,R.$z,R.iY,K.Cn,K.kk,K.fb,K.Cp,j.RG,j.rl,at.fS,at.fg,A.EE,B.w,B.q,O.uc,m.YU,m.MD,m.Sq,m.bT,m.Jj,C.YN,C.me,C.BC,C.vS,it,G.Ic,nt.D6,Cn,oe],styles:[":host{display:block;max-width:600px;margin:0 auto;font-family:Arial,sans-serif}.loading-spinner{display:flex;justify-content:center;align-items:center;margin:20px 0}.loading-spinner .spinner{border:4px solid rgba(0,0,0,.1);border-left-color:#009fb5;border-radius:50%;width:30px;height:30px;animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.event-list{list-style:none;padding:0;margin:20px 0}.event-list .event-item{background-color:#fff;border-radius:10px;padding:15px;margin-bottom:10px;box-shadow:0 2px 8px #0000001a;transition:box-shadow .3s ease}.event-list .event-item:hover{box-shadow:0 4px 16px #0003}.event-list .event-item .event-header{display:flex;align-items:center}.event-list .event-item .event-header .profile-picture{width:40px;height:40px;border-radius:50%;margin-right:10px;border:2px solid #009fb5}.event-list .event-item .event-header .event-info .username{font-weight:700;color:#333}.event-list .event-item .event-header .event-info .timestamp{font-size:.9em;color:#888}.event-list .event-item .event-content{margin:10px 0;font-size:1.1em;color:#555}.event-list .event-item .event-actions{display:flex;gap:10px;margin-top:10px}.event-list .event-item .event-actions button{background-color:transparent;border:none;cursor:pointer;color:#009fb5;font-size:1.1em;transition:color .2s ease}.event-list .event-item .event-actions button:hover{color:#007f91}.event-list .event-item .event-actions button:disabled{color:#999;cursor:not-allowed}.event-list .event-item .event-replies{margin-top:15px;border-top:1px solid #e0e0e0;padding-top:10px}.event-list .event-item .event-replies ul{list-style:none;padding:0}.event-list .event-item .event-replies ul .reply-item{margin:5px 0;font-size:.9em}.event-list .event-item .event-replies ul .reply-item .reply-username{font-weight:700;color:#009fb5}.event-list .event-item .event-replies ul .reply-item .reply-content{color:#555}.no-more-events{text-align:center;color:#555;margin:20px 0;font-size:1.1em}.load-more-btn{display:block;width:100%;padding:10px;font-size:1.1em;background-color:#009fb5;color:#fff;border:none;border-radius:5px;cursor:pointer;transition:background-color .3s ease}.load-more-btn:hover{background-color:#007f91}.load-more-btn:focus{outline:none}\n"],encapsulation:2,changeDetection:0})}return e})();var Ce=M(5351),dn=M(2798),mn=M(882);function pn(e,n){this.v=e,this.k=n}function Rn(e){return new pn(e,0)}function qe(e){var n,t;function r(a,u){try{var f=e[a](u),p=f.value,b=p instanceof pn;Promise.resolve(b?p.v:p).then(function(S){if(b){var T="return"===a?"return":"next";if(!p.k||S.done)return r(T,S);S=e[T](S).value}o(f.done?"return":"normal",S)},function(S){r("throw",S)})}catch(S){o("throw",S)}}function o(a,u){switch(a){case"return":n.resolve({value:u,done:!0});break;case"throw":n.reject(u);break;default:n.resolve({value:u,done:!1})}(n=n.next)?r(n.key,n.arg):t=null}this._invoke=function(a,u){return new Promise(function(f,p){var b={key:a,arg:u,resolve:f,reject:p,next:null};t?t=t.next=b:(n=t=b,r(a,u))})},"function"!=typeof e.return&&(this.return=void 0)}function on(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function gn(e,...n){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(n.length>0&&!n.includes(e.length))throw new Error(`Expected Uint8Array of length ${n}, not of length=${e.length}`)}M(2862),qe.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},qe.prototype.next=function(e){return this._invoke("next",e)},qe.prototype.throw=function(e){return this._invoke("throw",e)},qe.prototype.return=function(e){return this._invoke("return",e)};const Ae={number:on,bool:function Nn(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)},bytes:gn,hash:function Pn(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");on(e.outputLen),on(e.blockLen)},exists:function Ln(e,n=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(n&&e.finished)throw new Error("Hash#digest() has already been called")},output:function Un(e,n){gn(e);const t=n.outputLen;if(e.lengthe instanceof Uint8Array,Ir=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),De=(e,n)=>e<<32-n|e>>>n;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");const hs=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function Re(e){if(!an(e))throw new Error("Uint8Array expected");let n="";for(let t=0;tr+o.length,0));let t=0;return e.forEach(r=>{if(!an(r))throw new Error("Uint8Array expected");n.set(r,t),t+=r.length}),n}class Pi{clone(){return this._cloneInto()}}function Li(e){const n=r=>e().update(ln(r)).digest(),t=e();return n.outputLen=t.outputLen,n.blockLen=t.blockLen,n.create=()=>e(),n}function or(e=32){if(sn&&"function"==typeof sn.getRandomValues)return sn.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}class vs extends Pi{constructor(n,t,r,o){super(),this.blockLen=n,this.outputLen=t,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(n),this.view=Ir(this.buffer)}update(n){Ae.exists(this);const{view:t,buffer:r,blockLen:o}=this,a=(n=ln(n)).length;for(let u=0;uo-u&&(this.process(r,0),u=0);for(let T=u;T>o&a),f=Number(t&a),b=r?0:4;e.setUint32(n+(r?4:0),u,r),e.setUint32(n+b,f,r)})(r,o-8,BigInt(8*this.length),a),this.process(r,0);const f=Ir(n),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const b=p/4,S=this.get();if(b>S.length)throw new Error("_sha2: outputLen bigger than state");for(let T=0;Te&n^~e&t,ws=(e,n,t)=>e&n^e&t^n&t,bs=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]),Ke=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ze=new Uint32Array(64);class Ui extends vs{constructor(){super(64,32,8,!1),this.A=0|Ke[0],this.B=0|Ke[1],this.C=0|Ke[2],this.D=0|Ke[3],this.E=0|Ke[4],this.F=0|Ke[5],this.G=0|Ke[6],this.H=0|Ke[7]}get(){const{A:n,B:t,C:r,D:o,E:a,F:u,G:f,H:p}=this;return[n,t,r,o,a,u,f,p]}set(n,t,r,o,a,u,f,p){this.A=0|n,this.B=0|t,this.C=0|r,this.D=0|o,this.E=0|a,this.F=0|u,this.G=0|f,this.H=0|p}process(n,t){for(let T=0;T<16;T++,t+=4)Ze[T]=n.getUint32(t,!1);for(let T=16;T<64;T++){const $=Ze[T-15],D=Ze[T-2],U=De($,7)^De($,18)^$>>>3,P=De(D,17)^De(D,19)^D>>>10;Ze[T]=P+Ze[T-7]+U+Ze[T-16]|0}let{A:r,B:o,C:a,D:u,E:f,F:p,G:b,H:S}=this;for(let T=0;T<64;T++){const D=S+(De(f,6)^De(f,11)^De(f,25))+ys(f,p,b)+bs[T]+Ze[T]|0,P=(De(r,2)^De(r,13)^De(r,22))+ws(r,o,a)|0;S=b,b=p,p=f,f=u+D|0,u=a,a=o,o=r,r=D+P|0}r=r+this.A|0,o=o+this.B|0,a=a+this.C|0,u=u+this.D|0,f=f+this.E|0,p=p+this.F|0,b=b+this.G|0,S=S+this.H|0,this.set(r,o,a,u,f,p,b,S)}roundClean(){Ze.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class _s extends Ui{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const He=Li(()=>new Ui),sr=(Li(()=>new _s),BigInt(0),BigInt(1)),xs=BigInt(2),ar=e=>e instanceof Uint8Array,Es=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function vn(e){if(!ar(e))throw new Error("Uint8Array expected");let n="";for(let t=0;tr+o.length,0));let t=0;return e.forEach(r=>{if(!ar(r))throw new Error("Uint8Array expected");n.set(r,t),t+=r.length}),n}const Nr=e=>(xs<new Uint8Array(e),Fi=e=>Uint8Array.from(e);function $i(e,n,t){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof n||n<2)throw new Error("qByteLen must be a number");if("function"!=typeof t)throw new Error("hmacFn must be a function");let r=Pr(e),o=Pr(e),a=0;const u=()=>{r.fill(1),o.fill(0),a=0},f=(...T)=>t(o,r,...T),p=(T=Pr())=>{o=f(Fi([0]),T),r=f(),0!==T.length&&(o=f(Fi([1]),T),r=f())},b=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let T=0;const $=[];for(;T{let D;for(u(),p(T);!(D=$(b()));)p();return u(),D}}const Ms={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,n)=>n.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function Dn(e,n,t={}){const r=(o,a,u)=>{const f=Ms[a];if("function"!=typeof f)throw new Error(`Invalid validator "${a}", expected function`);const p=e[o];if(!(u&&void 0===p||f(p,e)))throw new Error(`Invalid param ${String(o)}=${p} (${typeof p}), expected ${a}`)};for(const[o,a]of Object.entries(n))r(o,a,!1);for(const[o,a]of Object.entries(t))r(o,a,!0);return e}const be=BigInt(0),Ot=BigInt(1),Je=BigInt(2),Ss=BigInt(3),Lr=BigInt(4),Gi=BigInt(5),zi=BigInt(8);function _e(e,n){const t=e%n;return t>=be?t:n+t}function Ts(e,n,t){if(t<=be||n 0");if(t===Ot)return be;let r=Ot;for(;n>be;)n&Ot&&(r=r*e%t),e=e*e%t,n>>=Ot;return r}function Pe(e,n,t){let r=e;for(;n-- >be;)r*=r,r%=t;return r}function lr(e,n){if(e===be||n<=be)throw new Error(`invert: expected positive integers, got n=${e} mod=${n}`);let t=_e(e,n),r=n,o=be,a=Ot,u=Ot,f=be;for(;t!==be;){const b=r/t,S=r%t,T=o-u*b,$=a-f*b;r=t,t=S,o=u,a=f,u=T,f=$}if(r!==Ot)throw new Error("invert: does not exist");return _e(o,n)}BigInt(9),BigInt(16);const Bs=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ur(e,n){const t=void 0!==n?n:e.toString(2).length;return{nBitLength:t,nByteLength:Math.ceil(t/8)}}const Ds=BigInt(0),jr=BigInt(1);function qi(e){return function Ns(e){Dn(e,Bs.reduce((r,o)=>(r[o]="function",r),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"}))}(e.Fp),Dn(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ur(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}const{Ph:$s,aT:Gs}=E,un={Err:class extends Error{constructor(n=""){super(n)}},_parseInt(e){const{Err:n}=un;if(e.length<2||2!==e[0])throw new n("Invalid signature integer tag");const t=e[1],r=e.subarray(2,t+2);if(!t||r.length!==t)throw new n("Invalid signature integer: wrong length");if(128&r[0])throw new n("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new n("Invalid signature integer: unnecessary leading zero");return{d:$s(r),l:e.subarray(t+2)}},toSig(e){const{Err:n}=un,t="string"==typeof e?Gs(e):e;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let r=t.length;if(r<2||48!=t[0])throw new n("Invalid signature tag");if(t[1]!==r-2)throw new n("Invalid signature: incorrect length");const{d:o,l:a}=un._parseInt(t.subarray(2)),{d:u,l:f}=un._parseInt(a);if(f.length)throw new n("Invalid signature: left bytes after parsing");return{r:o,s:u}},hexFromSig(e){const n=b=>8&Number.parseInt(b[0],16)?"00"+b:b,t=b=>{const S=b.toString(16);return 1&S.length?`0${S}`:S},r=n(t(e.s)),o=n(t(e.r)),a=r.length/2,u=o.length/2,f=t(a),p=t(u);return`30${t(u+a+4)}02${p}${o}02${f}${r}`}},je=BigInt(0),pe=BigInt(1),cr=(BigInt(2),BigInt(3));function Hs(e){const n=function qs(e){const n=qi(e);return Dn(n,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...n})}(e),{Fp:t,n:r}=n,o=t.BYTES+1,a=2*t.BYTES+1;function f(H){return _e(H,r)}function p(H){return lr(H,r)}const{ProjectivePoint:b,normPrivateKeyToScalar:S,weierstrassEquation:T,isWithinCurveOrder:$}=function zs(e){const n=function Fs(e){const n=qi(e);Dn(n,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:r,a:o}=n;if(t){if(!r.eql(o,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof t||"bigint"!=typeof t.beta||"function"!=typeof t.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...n})}(e),{Fp:t}=n,r=n.toBytes||((U,P,F)=>{const z=P.toAffine();return cn(Uint8Array.from([4]),t.toBytes(z.x),t.toBytes(z.y))}),o=n.fromBytes||(U=>{const P=U.subarray(1);return{x:t.fromBytes(P.subarray(0,t.BYTES)),y:t.fromBytes(P.subarray(t.BYTES,2*t.BYTES))}});function a(U){const{a:P,b:F}=n,z=t.sqr(U),W=t.mul(z,U);return t.add(t.add(W,t.mul(U,P)),F)}if(!t.eql(t.sqr(n.Gy),a(n.Gx)))throw new Error("bad generator point: equation left != right");function u(U){return"bigint"==typeof U&&jet.eql(J,t.ZERO);return W(F)&&W(z)?T.ZERO:new T(F,z,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(P){const F=t.invertBatch(P.map(z=>z.pz));return P.map((z,W)=>z.toAffine(F[W])).map(T.fromAffine)}static fromHex(P){const F=T.fromAffine(o(Ee("pointHex",P)));return F.assertValidity(),F}static fromPrivateKey(P){return T.BASE.multiply(p(P))}_setWindowSize(P){this._WINDOW_SIZE=P,b.delete(this)}assertValidity(){if(this.is0()){if(n.allowInfinityPoint)return;throw new Error("bad point: ZERO")}const{x:P,y:F}=this.toAffine();if(!t.isValid(P)||!t.isValid(F))throw new Error("bad point: x or y not FE");const z=t.sqr(F),W=a(P);if(!t.eql(z,W))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:P}=this.toAffine();if(t.isOdd)return!t.isOdd(P);throw new Error("Field doesn't support isOdd")}equals(P){S(P);const{px:F,py:z,pz:W}=this,{px:J,py:Y,pz:rt}=P,q=t.eql(t.mul(F,rt),t.mul(J,W)),Z=t.eql(t.mul(z,rt),t.mul(Y,W));return q&&Z}negate(){return new T(this.px,t.neg(this.py),this.pz)}double(){const{a:P,b:F}=n,z=t.mul(F,cr),{px:W,py:J,pz:Y}=this;let rt=t.ZERO,q=t.ZERO,Z=t.ZERO,et=t.mul(W,W),Q=t.mul(J,J),yt=t.mul(Y,Y),ct=t.mul(W,J);return ct=t.add(ct,ct),Z=t.mul(W,Y),Z=t.add(Z,Z),rt=t.mul(P,Z),q=t.mul(z,yt),q=t.add(rt,q),rt=t.sub(Q,q),q=t.add(Q,q),q=t.mul(rt,q),rt=t.mul(ct,rt),Z=t.mul(z,Z),yt=t.mul(P,yt),ct=t.sub(et,yt),ct=t.mul(P,ct),ct=t.add(ct,Z),Z=t.add(et,et),et=t.add(Z,et),et=t.add(et,yt),et=t.mul(et,ct),q=t.add(q,et),yt=t.mul(J,Y),yt=t.add(yt,yt),et=t.mul(yt,ct),rt=t.sub(rt,et),Z=t.mul(yt,Q),Z=t.add(Z,Z),Z=t.add(Z,Z),new T(rt,q,Z)}add(P){S(P);const{px:F,py:z,pz:W}=this,{px:J,py:Y,pz:rt}=P;let q=t.ZERO,Z=t.ZERO,et=t.ZERO;const Q=n.a,yt=t.mul(n.b,cr);let ct=t.mul(F,J),wt=t.mul(z,Y),Et=t.mul(W,rt),It=t.add(F,z),H=t.add(J,Y);It=t.mul(It,H),H=t.add(ct,wt),It=t.sub(It,H),H=t.add(F,W);let X=t.add(J,rt);return H=t.mul(H,X),X=t.add(ct,Et),H=t.sub(H,X),X=t.add(z,W),q=t.add(Y,rt),X=t.mul(X,q),q=t.add(wt,Et),X=t.sub(X,q),et=t.mul(Q,H),q=t.mul(yt,Et),et=t.add(q,et),q=t.sub(wt,et),et=t.add(wt,et),Z=t.mul(q,et),wt=t.add(ct,ct),wt=t.add(wt,ct),Et=t.mul(Q,Et),H=t.mul(yt,H),wt=t.add(wt,Et),Et=t.sub(ct,Et),Et=t.mul(Q,Et),H=t.add(H,Et),ct=t.mul(wt,H),Z=t.add(Z,ct),ct=t.mul(X,H),q=t.mul(It,q),q=t.sub(q,ct),ct=t.mul(It,wt),et=t.mul(X,et),et=t.add(et,ct),new T(q,Z,et)}subtract(P){return this.add(P.negate())}is0(){return this.equals(T.ZERO)}wNAF(P){return D.wNAFCached(this,b,P,F=>{const z=t.invertBatch(F.map(W=>W.pz));return F.map((W,J)=>W.toAffine(z[J])).map(T.fromAffine)})}multiplyUnsafe(P){const F=T.ZERO;if(P===je)return F;if(f(P),P===pe)return this;const{endo:z}=n;if(!z)return D.unsafeLadder(this,P);let{k1neg:W,k1:J,k2neg:Y,k2:rt}=z.splitScalar(P),q=F,Z=F,et=this;for(;J>je||rt>je;)J&pe&&(q=q.add(et)),rt&pe&&(Z=Z.add(et)),et=et.double(),J>>=pe,rt>>=pe;return W&&(q=q.negate()),Y&&(Z=Z.negate()),Z=new T(t.mul(Z.px,z.beta),Z.py,Z.pz),q.add(Z)}multiply(P){f(P);let z,W,F=P;const{endo:J}=n;if(J){const{k1neg:Y,k1:rt,k2neg:q,k2:Z}=J.splitScalar(F);let{p:et,f:Q}=this.wNAF(rt),{p:yt,f:ct}=this.wNAF(Z);et=D.constTimeNegate(Y,et),yt=D.constTimeNegate(q,yt),yt=new T(t.mul(yt.px,J.beta),yt.py,yt.pz),z=et.add(yt),W=Q.add(ct)}else{const{p:Y,f:rt}=this.wNAF(F);z=Y,W=rt}return T.normalizeZ([z,W])[0]}multiplyAndAddUnsafe(P,F,z){const W=T.BASE,J=(rt,q)=>q!==je&&q!==pe&&rt.equals(W)?rt.multiply(q):rt.multiplyUnsafe(q),Y=J(this,F).add(J(P,z));return Y.is0()?void 0:Y}toAffine(P){const{px:F,py:z,pz:W}=this,J=this.is0();null==P&&(P=J?t.ONE:t.inv(W));const Y=t.mul(F,P),rt=t.mul(z,P),q=t.mul(W,P);if(J)return{x:t.ZERO,y:t.ZERO};if(!t.eql(q,t.ONE))throw new Error("invZ was invalid");return{x:Y,y:rt}}isTorsionFree(){const{h:P,isTorsionFree:F}=n;if(P===pe)return!0;if(F)return F(T,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:P,clearCofactor:F}=n;return P===pe?this:F?F(T,this):this.multiplyUnsafe(n.h)}toRawBytes(P=!0){return this.assertValidity(),r(T,this,P)}toHex(P=!0){return vn(this.toRawBytes(P))}}T.BASE=new T(n.Gx,n.Gy,t.ONE),T.ZERO=new T(t.ZERO,t.ONE,t.ZERO);const $=n.nBitLength,D=function Os(e,n){const t=(o,a)=>{const u=a.negate();return o?u:a},r=o=>({windows:Math.ceil(n/o)+1,windowSize:2**(o-1)});return{constTimeNegate:t,unsafeLadder(o,a){let u=e.ZERO,f=o;for(;a>Ds;)a&jr&&(u=u.add(f)),f=f.double(),a>>=jr;return u},precomputeWindow(o,a){const{windows:u,windowSize:f}=r(a),p=[];let b=o,S=b;for(let T=0;T>=D,F>p&&(F-=$,u+=jr);const z=P,W=P+Math.abs(F)-1,Y=F<0;0===F?S=S.add(t(U%2!=0,a[z])):b=b.add(t(Y,a[W]))}return{p:b,f:S}},wNAFCached(o,a,u,f){const p=o._WINDOW_SIZE||1;let b=a.get(o);return b||(b=this.precomputeWindow(o,p),1!==p&&a.set(o,f(b))),this.wNAF(p,b,u)}}}(T,n.endo?Math.ceil($/2):$);return{CURVE:n,ProjectivePoint:T,normPrivateKeyToScalar:p,weierstrassEquation:a,isWithinCurveOrder:u}}({...n,toBytes(H,X,gt){const _t=X.toAffine(),st=t.toBytes(_t.x),At=cn;return gt?At(Uint8Array.from([X.hasEvenY()?2:3]),st):At(Uint8Array.from([4]),st,t.toBytes(_t.y))},fromBytes(H){const X=H.length,gt=H[0],_t=H.subarray(1);if(X!==o||2!==gt&&3!==gt){if(X===a&&4===gt)return{x:t.fromBytes(_t.subarray(0,t.BYTES)),y:t.fromBytes(_t.subarray(t.BYTES,2*t.BYTES))};throw new Error(`Point of length ${X} was invalid. Expected ${o} compressed bytes or ${a} uncompressed bytes`)}{const st=Te(_t);if(!function u(H){return jevn(Xe(H,n.nByteLength));function U(H){return H>r>>pe}const F=(H,X,gt)=>Te(H.slice(X,gt));class z{constructor(X,gt,_t){this.r=X,this.s=gt,this.recovery=_t,this.assertValidity()}static fromCompact(X){const gt=n.nByteLength;return X=Ee("compactSignature",X,2*gt),new z(F(X,0,gt),F(X,gt,2*gt))}static fromDER(X){const{r:gt,s:_t}=un.toSig(Ee("DER",X));return new z(gt,_t)}assertValidity(){if(!$(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!$(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(X){return new z(this.r,this.s,X)}recoverPublicKey(X){const{r:gt,s:_t,recovery:st}=this,At=Z(Ee("msgHash",X));if(null==st||![0,1,2,3].includes(st))throw new Error("recovery id invalid");const Nt=2===st||3===st?gt+n.n:gt;if(Nt>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const xe=b.fromHex((1&st?"03":"02")+D(Nt)),Me=p(Nt),Ne=f(-At*Me),Ue=f(_t*Me),Se=b.BASE.multiplyAndAddUnsafe(xe,Ne,Ue);if(!Se)throw new Error("point at infinify");return Se.assertValidity(),Se}hasHighS(){return U(this.s)}normalizeS(){return this.hasHighS()?new z(this.r,f(-this.s),this.recovery):this}toDERRawBytes(){return yn(this.toDERHex())}toDERHex(){return un.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return yn(this.toCompactHex())}toCompactHex(){return D(this.r)+D(this.s)}}const W={isValidPrivateKey(H){try{return S(H),!0}catch{return!1}},normPrivateKeyToScalar:S,randomPrivateKey:()=>{const X=function js(e,n,t=!1){const r=(e=Ee("privateHash",e)).length,o=Ur(n).nByteLength+8;if(o<24||r1024)throw new Error(`hashToPrivateScalar: expected ${o}-1024 bytes of input, got ${r}`);return _e(t?Br(e):Te(e),n-Ot)+Ot}(n.randomBytes(t.BYTES+8),r);return Xe(X,n.nByteLength)},precompute:(H=8,X=b.BASE)=>(X._setWindowSize(H),X.multiply(BigInt(3)),X)};function Y(H){const X=H instanceof Uint8Array,gt="string"==typeof H,_t=(X||gt)&&H.length;return X?_t===o||_t===a:gt?_t===2*o||_t===2*a:H instanceof b}const q=n.bits2int||function(H){const X=Te(H),gt=8*H.length-n.nBitLength;return gt>0?X>>BigInt(gt):X},Z=n.bits2int_modN||function(H){return f(q(H))},et=Nr(n.nBitLength);function Q(H){if("bigint"!=typeof H)throw new Error("bigint expected");if(!(je<=H&&HIe in gt))throw new Error("sign() legacy options not supported");const{hash:_t,randomBytes:st}=n;let{lowS:At,prehash:Nt,extraEntropy:Bt}=gt;null==At&&(At=!0),H=Ee("msgHash",H),Nt&&(H=Ee("prehashed msgHash",_t(H)));const xe=Z(H),Me=S(X),Ne=[Q(Me),Q(xe)];if(null!=Bt){const Ie=!0===Bt?st(t.BYTES):Bt;Ne.push(Ee("extraEntropy",Ie,t.BYTES))}const Ue=cn(...Ne),Se=xe;return{seed:Ue,k2sig:function Ge(Ie){const kn=q(Ie);if(!$(kn))return;const cs=p(kn),ze=b.BASE.multiply(kn).toAffine(),Mn=f(ze.x);if(Mn===je)return;const Cr=f(cs*f(Se+Mn*Me));if(Cr===je)return;let us=(ze.x===Mn?0:2)|Number(ze.y&pe),fs=Cr;return At&&U(Cr)&&(fs=function P(H){return U(H)?f(-H):H}(Cr),us^=1),new z(Mn,fs,us)}}}(H,X,gt);return $i(n.hash.outputLen,n.nByteLength,n.hmac)(_t,st)},verify:function It(H,X,gt,_t=wt){const st=H;if(X=Ee("msgHash",X),gt=Ee("publicKey",gt),"strict"in _t)throw new Error("options.strict was renamed to lowS");const{lowS:At,prehash:Nt}=_t;let Bt,xe;try{if("string"==typeof st||st instanceof Uint8Array)try{Bt=z.fromDER(st)}catch(ze){if(!(ze instanceof un.Err))throw ze;Bt=z.fromCompact(st)}else{if("object"!=typeof st||"bigint"!=typeof st.r||"bigint"!=typeof st.s)throw new Error("PARSE");{const{r:ze,s:Mn}=st;Bt=new z(ze,Mn)}}xe=b.fromHex(gt)}catch(ze){if("PARSE"===ze.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(At&&Bt.hasHighS())return!1;Nt&&(X=n.hash(X));const{r:Me,s:Ne}=Bt,Ue=Z(X),Se=p(Ne),Ge=f(Ue*Se),Ie=f(Me*Se),kn=b.BASE.multiplyAndAddUnsafe(xe,Ge,Ie)?.toAffine();return!!kn&&f(kn.x)===Me},ProjectivePoint:b,Signature:z,utils:W}}BigInt(4);class Wi extends Pi{constructor(n,t){super(),this.finished=!1,this.destroyed=!1,Ae.hash(n);const r=ln(t);if(this.iHash=n.create(),"function"!=typeof this.iHash.update)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,a=new Uint8Array(o);a.set(r.length>o?n.create().update(r).digest():r);for(let u=0;unew Wi(e,n).update(t).digest();function Js(e){return{hash:e,hmac:(n,...t)=>wn(e,n,ir(...t)),randomBytes:or}}wn.create=(e,n)=>new Wi(e,n);const ur=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),fr=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Yi=BigInt(1),hr=BigInt(2),Ki=(e,n)=>(e+n/hr)/n;function Zi(e){const n=ur,t=BigInt(3),r=BigInt(6),o=BigInt(11),a=BigInt(22),u=BigInt(23),f=BigInt(44),p=BigInt(88),b=e*e*e%n,S=b*b*e%n,T=Pe(S,t,n)*S%n,$=Pe(T,t,n)*S%n,D=Pe($,hr,n)*b%n,U=Pe(D,o,n)*D%n,P=Pe(U,a,n)*U%n,F=Pe(P,f,n)*P%n,z=Pe(F,p,n)*F%n,W=Pe(z,f,n)*P%n,J=Pe(W,t,n)*S%n,Y=Pe(J,u,n)*U%n,rt=Pe(Y,r,n)*b%n,q=Pe(rt,hr,n);if(!Or.eql(Or.sqr(q),e))throw new Error("Cannot find square root");return q}const Or=function Us(e,n,t=!1,r={}){if(e<=be)throw new Error(`Expected Fp ORDER > 0, got ${e}`);const{nBitLength:o,nByteLength:a}=Ur(e,n);if(a>2048)throw new Error("Field lengths over 2048 bytes are not supported");const u=function Rs(e){if(e%Lr===Ss){const n=(e+Ot)/Lr;return function(r,o){const a=r.pow(o,n);if(!r.eql(r.sqr(a),o))throw new Error("Cannot find square root");return a}}if(e%zi===Gi){const n=(e-Gi)/zi;return function(r,o){const a=r.mul(o,Je),u=r.pow(a,n),f=r.mul(o,u),p=r.mul(r.mul(f,Je),u),b=r.mul(f,r.sub(p,r.ONE));if(!r.eql(r.sqr(b),o))throw new Error("Cannot find square root");return b}}return function Is(e){const n=(e-Ot)/Je;let t,r,o;for(t=e-Ot,r=0;t%Je===be;t/=Je,r++);for(o=Je;o_e(p,e),isValid:p=>{if("bigint"!=typeof p)throw new Error("Invalid field element: expected bigint, got "+typeof p);return be<=p&&pp===be,isOdd:p=>(p&Ot)===Ot,neg:p=>_e(-p,e),eql:(p,b)=>p===b,sqr:p=>_e(p*p,e),add:(p,b)=>_e(p+b,e),sub:(p,b)=>_e(p-b,e),mul:(p,b)=>_e(p*b,e),pow:(p,b)=>function Ps(e,n,t){if(t 0");if(t===be)return e.ONE;if(t===Ot)return n;let r=e.ONE,o=n;for(;t>be;)t&Ot&&(r=e.mul(r,o)),o=e.sqr(o),t>>=Ot;return r}(f,p,b),div:(p,b)=>_e(p*lr(b,e),e),sqrN:p=>p*p,addN:(p,b)=>p+b,subN:(p,b)=>p-b,mulN:(p,b)=>p*b,inv:p=>lr(p,e),sqrt:r.sqrt||(p=>u(f,p)),invertBatch:p=>function Ls(e,n){const t=new Array(n.length),r=n.reduce((a,u,f)=>e.is0(u)?a:(t[f]=a,e.mul(a,u)),e.ONE),o=e.inv(r);return n.reduceRight((a,u,f)=>e.is0(u)?a:(t[f]=e.mul(a,t[f]),e.mul(a,u)),o),t}(f,p),cmov:(p,b,S)=>S?b:p,toBytes:p=>t?Oi(p,a):Xe(p,a),fromBytes:p=>{if(p.length!==a)throw new Error(`Fp.fromBytes: expected ${a}, got ${p.length}`);return t?Br(p):Te(p)}});return Object.freeze(f)}(ur,void 0,void 0,{sqrt:Zi}),bn=function Qs(e,n){const t=r=>Hs({...e,...Js(r)});return Object.freeze({...t(n),create:t})}({a:BigInt(0),b:BigInt(7),Fp:Or,n:fr,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const n=fr,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Yi*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=t,u=BigInt("0x100000000000000000000000000000000"),f=Ki(a*e,n),p=Ki(-r*e,n);let b=_e(e-f*t-p*o,n),S=_e(-f*r-p*a,n);const T=b>u,$=S>u;if(T&&(b=n-b),$&&(S=n-S),b>u||S>u)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:T,k1:b,k2neg:$,k2:S}}}},He),dr=BigInt(0),Xi=e=>"bigint"==typeof e&&dro.charCodeAt(0)));t=cn(r,r),Ji[e]=t}return He(cn(t,...n))}const Fr=e=>e.toRawBytes(!0).slice(1),$r=e=>Xe(e,32),Gr=e=>_e(e,ur),Fn=e=>_e(e,fr),zr=bn.ProjectivePoint;function qr(e){let n=bn.utils.normPrivateKeyToScalar(e),t=zr.fromPrivateKey(n);return{scalar:t.hasEvenY()?n:Fn(-n),bytes:Fr(t)}}function Qi(e){if(!Xi(e))throw new Error("bad x: need 0 < x < p");const n=Gr(e*e);let r=Zi(Gr(n*e+BigInt(7)));r%hr!==dr&&(r=Gr(-r));const o=new zr(e,r,Yi);return o.assertValidity(),o}function to(...e){return Fn(Te(mr("BIP0340/challenge",...e)))}function eo(e,n,t){const r=Ee("signature",e,64),o=Ee("message",n),a=Ee("publicKey",t,32);try{const u=Qi(Te(a)),f=Te(r.subarray(0,32));if(!Xi(f))return!1;const p=Te(r.subarray(32,64));if(!(e=>"bigint"==typeof e&&drzr.BASE.multiplyAndAddUnsafe(e,n,t))(u,p,Fn(-b));return!(!S||!S.hasEvenY()||S.toAffine().x!==f)}catch{return!1}}const _n={getPublicKey:function na(e){return qr(e).bytes},sign:function ra(e,n,t=or(32)){const r=Ee("message",e),{bytes:o,scalar:a}=qr(n),u=Ee("auxRand",t,32),f=$r(a^Te(mr("BIP0340/aux",u))),p=mr("BIP0340/nonce",f,o,r),b=Fn(Te(p));if(b===dr)throw new Error("sign failed: k is zero");const{bytes:S,scalar:T}=qr(b),$=to(S,o,r),D=new Uint8Array(64);if(D.set(S,0),D.set($r(Fn(T+$*a)),32),!eo(D,r,o))throw new Error("sign: Invalid signature produced");return D},verify:eo,utils:{randomPrivateKey:bn.utils.randomPrivateKey,lift_x:Qi,pointToBytes:Fr,numberToBytesBE:Xe,bytesToNumberBE:Te,taggedHash:mr,mod:_e}};var no=M(5693),Hr=M(9673),ia=M(9608);const Oe=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function Yr(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function Kr(e){if("string"==typeof e&&(e=Yr(e)),!(e=>e instanceof Uint8Array)(e))throw new Error("expected Uint8Array, got "+typeof e);return e}function Zr(e,n){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");if("number"==typeof n&&e.length!==n)throw new Error(`Uint8Array length ${n} expected`)}function Xr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function ro(e,...n){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(n.length>0&&!n.includes(e.length))throw new Error(`Expected Uint8Array of length ${n}, not of length=${e.length}`)}const Be={number:Xr,bool:function ua(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)},bytes:ro,hash:function fa(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("hash must be wrapped by utils.wrapConstructor");Xr(e.outputLen),Xr(e.blockLen)},exists:function ha(e,n=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(n&&e.finished)throw new Error("Hash#digest() has already been called")},output:function da(e,n){ro(e);const t=n.outputLen;if(e.length255&e[n++]|(255&e[n++])<<8;class ma{constructor(n){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,Zr(n=Kr(n),32);const t=ke(n,0),r=ke(n,2),o=ke(n,4),a=ke(n,6),u=ke(n,8),f=ke(n,10),p=ke(n,12),b=ke(n,14);this.r[0]=8191&t,this.r[1]=8191&(t>>>13|r<<3),this.r[2]=7939&(r>>>10|o<<6),this.r[3]=8191&(o>>>7|a<<9),this.r[4]=255&(a>>>4|u<<12),this.r[5]=u>>>1&8190,this.r[6]=8191&(u>>>14|f<<2),this.r[7]=8065&(f>>>11|p<<5),this.r[8]=8191&(p>>>8|b<<8),this.r[9]=b>>>5&127;for(let S=0;S<8;S++)this.pad[S]=ke(n,16+2*S)}process(n,t,r=!1){const o=r?0:2048,{h:a,r:u}=this,f=u[0],p=u[1],b=u[2],S=u[3],T=u[4],$=u[5],D=u[6],U=u[7],P=u[8],F=u[9],z=ke(n,t+0),W=ke(n,t+2),J=ke(n,t+4),Y=ke(n,t+6),rt=ke(n,t+8),q=ke(n,t+10),Z=ke(n,t+12),et=ke(n,t+14);let Q=a[0]+(8191&z),yt=a[1]+(8191&(z>>>13|W<<3)),ct=a[2]+(8191&(W>>>10|J<<6)),wt=a[3]+(8191&(J>>>7|Y<<9)),Et=a[4]+(8191&(Y>>>4|rt<<12)),It=a[5]+(rt>>>1&8191),H=a[6]+(8191&(rt>>>14|q<<2)),X=a[7]+(8191&(q>>>11|Z<<5)),gt=a[8]+(8191&(Z>>>8|et<<8)),_t=a[9]+(et>>>5|o),st=0,At=st+Q*f+yt*(5*F)+ct*(5*P)+wt*(5*U)+Et*(5*D);st=At>>>13,At&=8191,At+=It*(5*$)+H*(5*T)+X*(5*S)+gt*(5*b)+_t*(5*p),st+=At>>>13,At&=8191;let Nt=st+Q*p+yt*f+ct*(5*F)+wt*(5*P)+Et*(5*U);st=Nt>>>13,Nt&=8191,Nt+=It*(5*D)+H*(5*$)+X*(5*T)+gt*(5*S)+_t*(5*b),st+=Nt>>>13,Nt&=8191;let Bt=st+Q*b+yt*p+ct*f+wt*(5*F)+Et*(5*P);st=Bt>>>13,Bt&=8191,Bt+=It*(5*U)+H*(5*D)+X*(5*$)+gt*(5*T)+_t*(5*S),st+=Bt>>>13,Bt&=8191;let xe=st+Q*S+yt*b+ct*p+wt*f+Et*(5*F);st=xe>>>13,xe&=8191,xe+=It*(5*P)+H*(5*U)+X*(5*D)+gt*(5*$)+_t*(5*T),st+=xe>>>13,xe&=8191;let Me=st+Q*T+yt*S+ct*b+wt*p+Et*f;st=Me>>>13,Me&=8191,Me+=It*(5*F)+H*(5*P)+X*(5*U)+gt*(5*D)+_t*(5*$),st+=Me>>>13,Me&=8191;let Ne=st+Q*$+yt*T+ct*S+wt*b+Et*p;st=Ne>>>13,Ne&=8191,Ne+=It*f+H*(5*F)+X*(5*P)+gt*(5*U)+_t*(5*D),st+=Ne>>>13,Ne&=8191;let Ue=st+Q*D+yt*$+ct*T+wt*S+Et*b;st=Ue>>>13,Ue&=8191,Ue+=It*p+H*f+X*(5*F)+gt*(5*P)+_t*(5*U),st+=Ue>>>13,Ue&=8191;let Se=st+Q*U+yt*D+ct*$+wt*T+Et*S;st=Se>>>13,Se&=8191,Se+=It*b+H*p+X*f+gt*(5*F)+_t*(5*P),st+=Se>>>13,Se&=8191;let Ge=st+Q*P+yt*U+ct*D+wt*$+Et*T;st=Ge>>>13,Ge&=8191,Ge+=It*S+H*b+X*p+gt*f+_t*(5*F),st+=Ge>>>13,Ge&=8191;let Ie=st+Q*F+yt*P+ct*U+wt*D+Et*$;st=Ie>>>13,Ie&=8191,Ie+=It*T+H*S+X*b+gt*p+_t*f,st+=Ie>>>13,Ie&=8191,st=(st<<2)+st|0,st=st+At|0,At=8191&st,st>>>=13,Nt+=st,a[0]=At,a[1]=Nt,a[2]=Bt,a[3]=xe,a[4]=Me,a[5]=Ne,a[6]=Ue,a[7]=Se,a[8]=Ge,a[9]=Ie}finalize(){const{h:n,pad:t}=this,r=new Uint16Array(10);let o=n[1]>>>13;n[1]&=8191;for(let f=2;f<10;f++)n[f]+=o,o=n[f]>>>13,n[f]&=8191;n[0]+=5*o,o=n[0]>>>13,n[0]&=8191,n[1]+=o,o=n[1]>>>13,n[1]&=8191,n[2]+=o,r[0]=n[0]+5,o=r[0]>>>13,r[0]&=8191;for(let f=1;f<10;f++)r[f]=n[f]+o,o=r[f]>>>13,r[f]&=8191;r[9]-=8192;let a=(1^o)-1;for(let f=0;f<10;f++)r[f]&=a;a=~a;for(let f=0;f<10;f++)n[f]=n[f]&a|r[f];n[0]=65535&(n[0]|n[1]<<13),n[1]=65535&(n[1]>>>3|n[2]<<10),n[2]=65535&(n[2]>>>6|n[3]<<7),n[3]=65535&(n[3]>>>9|n[4]<<4),n[4]=65535&(n[4]>>>12|n[5]<<1|n[6]<<14),n[5]=65535&(n[6]>>>2|n[7]<<11),n[6]=65535&(n[7]>>>5|n[8]<<8),n[7]=65535&(n[8]>>>8|n[9]<<5);let u=n[0]+t[0];n[0]=65535&u;for(let f=1;f<8;f++)u=(n[f]+t[f]|0)+(u>>>16)|0,n[f]=65535&u}update(n){Be.exists(this);const{buffer:t,blockLen:r}=this,o=(n=Kr(n)).length;for(let a=0;a>>0,n[a++]=r[u]>>>8;return n}digest(){const{buffer:n,outputLen:t}=this;this.digestInto(n);const r=n.slice(0,t);return this.destroy(),r}}!function pa(e){const n=(r,o)=>e(o).update(Kr(r)).digest(),t=e(new Uint8Array(32));n.outputLen=t.outputLen,n.blockLen=t.blockLen,n.create=r=>e(r)}(e=>new ma(e));const ga=Yr("expand 16-byte k"),va=Yr("expand 32-byte k"),ya=Oe(ga),wa=Oe(va),io=e=>!(e.byteOffset%4),vt=(e,n)=>e<>>32-n;const oo=(e=>{const{core:n,rounds:t,counterRight:r,counterLen:o,allow128bitKeys:a,extendNonceFn:u,blockLen:f}=function la(e,n){if(void 0!==n&&("object"!=typeof n||!(e=>"[object Object]"===Object.prototype.toString.call(e)&&e.constructor===Object)(n)))throw new Error("options must be object or undefined");return Object.assign(e,n)}({rounds:20,counterRight:!1,counterLen:8,allow128bitKeys:!0,blockLen:64},e);Be.number(o),Be.number(t),Be.number(f),Be.bool(r),Be.bool(a);const p=f/4;if(f%4!=0)throw new Error("Salsa/ChaCha: blockLen must be aligned to 4 bytes");return(b,S,T,$,D=0)=>{if(Be.bytes(b),Be.bytes(S),Be.bytes(T),$||($=new Uint8Array(T.length)),Be.bytes($),Be.number(D),D<0||D>=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");if($.length=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");const ct=Math.min(f,et-Q);if(ct===f&&Z&&q){const wt=Q/4;if(Q%4!=0)throw new Error("Salsa/ChaCha: invalid block position");for(let Et=0;Et{for(var t in n)Ma(e,t,{get:n[t],enumerable:!0})};function co(){return Re(_n.utils.randomPrivateKey())}function Qr(e){return Re(_n.getPublicKey(e))}ye({},{MessageNode:()=>uo,MessageQueue:()=>fo,insertEventIntoAscendingList:()=>Aa,insertEventIntoDescendingList:()=>Ca,normalizeURL:()=>ti,utf8Decoder:()=>Fe,utf8Encoder:()=>Le});var Fe=new TextDecoder("utf-8"),Le=new TextEncoder;function ti(e){let n=new URL(e);return n.pathname=n.pathname.replace(/\/+/g,"/"),n.pathname.endsWith("/")&&(n.pathname=n.pathname.slice(0,-1)),("80"===n.port&&"ws:"===n.protocol||"443"===n.port&&"wss:"===n.protocol)&&(n.port=""),n.searchParams.sort(),n.hash="",n.toString()}function Ca(e,n){let o,t=0,r=e.length-1,a=t;if(r<0)a=0;else if(n.created_at=e[t].created_at)a=t;else for(;;){if(r<=t+1){a=r;break}if(o=Math.floor(t+(r-t)/2),e[o].created_at>n.created_at)t=o;else{if(!(e[o].created_ate[r].created_at)a=r+1;else if(n.created_at<=e[t].created_at)a=t;else for(;;){if(r<=t+1){a=r;break}if(o=Math.floor(t+(r-t)/2),e[o].created_atn.created_at)){a=o;break}r=o}}return e[a]?.id!==n.id?[...e.slice(0,a),n,...e.slice(a)]:e}var uo=class{_value;_next;get value(){return this._value}set value(e){this._value=e}get next(){return this._next}set next(e){this._next=e}constructor(e){this._value=e,this._next=null}},fo=class{_first;_last;get first(){return this._first}set first(e){this._first=e}get last(){return this._last}set last(e){this._last=e}_size;get size(){return this._size}set size(e){this._size=e}constructor(){this._first=null,this._last=null,this._size=0}enqueue(e){const n=new uo(e);return 0!==this._size&&this._last?(this._last.next=n,this._last=n):(this._first=n,this._last=n),this._size++,!0}dequeue(){if(0===this._size||!this._first)return null;let e=this._first;return this._first=e.next,e.next=null,this._size--,e.value}},xn=Symbol("verified");function Ve(e,n){const t=e;return t.pubkey=Qr(n),t.id=zn(t),t.sig=function ho(e,n){return Re(_n.sign(zn(e),n))}(t,n),t[xn]=!0,t}function zn(e){let n=He(Le.encode(function Ra(e){if(!ei(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}(e)));return Re(n)}var Ba=e=>e instanceof Object;function ei(e){if(!Ba(e)||"number"!=typeof e.kind||"string"!=typeof e.content||"number"!=typeof e.created_at||"string"!=typeof e.pubkey||!e.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(e.tags))return!1;for(let n=0;nn.id.startsWith(t))||e.kinds&&-1===e.kinds.indexOf(n.kind)||e.authors&&-1===e.authors.indexOf(n.pubkey)&&!e.authors.some(t=>n.pubkey.startsWith(t)))return!1;for(let t in e)if("#"===t[0]){let o=e[`#${t.slice(1)}`];if(o&&!n.tags.find(([a,u])=>a===t.slice(1)&&-1!==o.indexOf(u)))return!1}return!(e.since&&n.created_ate.until)}function gr(e,n){let t=n.length+3,r=e.indexOf(`"${n}":`)+t,o=e.slice(r).indexOf('"')+r+1;return e.slice(o,o+64)}function po(e,n){let t=n.length,r=e.indexOf(`"${n}":`)+t+3,o=e.slice(r),a=Math.min(o.indexOf(","),o.indexOf("}"));return parseInt(o.slice(0,a),10)}function go(e){let n=e.slice(0,22).indexOf('"EVENT"');if(-1===n)return null;let t=e.slice(n+7+1).indexOf('"');if(-1===t)return null;let r=n+7+1+t,o=e.slice(r+1,80).indexOf('"');return-1===o?null:e.slice(r+1,r+1+o)}function Ua(e,n){return n===gr(e,"id")}function ja(e,n){return n===gr(e,"pubkey")}function Da(e,n){return n===po(e,"kind")}function yo(e,n={}){let{listTimeout:t=3e3,getTimeout:r=3e3,countTimeout:o=3e3}=n;var a,S,u={},f={connect:[],disconnect:[],error:[],notice:[],auth:[]},p={},b={};function $(){return($=(0,y.A)(function*(){return S||(S=new Promise((Y,rt)=>{try{a=new WebSocket(e)}catch(Q){rt(Q)}a.onopen=()=>{f.connect.forEach(Q=>Q()),Y()},a.onerror=()=>{S=void 0,f.error.forEach(Q=>Q()),rt()},a.onclose=(0,y.A)(function*(){S=void 0,f.disconnect.forEach(Q=>Q())});let Z,q=new fo;function et(){if(0===q.size)return clearInterval(Z),void(Z=null);var Q=q.dequeue();if(!Q)return;let yt=go(Q);if(yt){let ct=u[yt];if(ct&&ct.alreadyHaveEvent&&ct.alreadyHaveEvent(gr(Q,"id"),e))return}try{let ct=JSON.parse(Q);switch(ct[0]){case"EVENT":{let H=ct[1],X=ct[2];return void(ei(X)&&u[H]&&(u[H].skipVerification||pr(X))&&function mo(e,n){for(let t=0;tgt(X)))}case"COUNT":let wt=ct[1],Et=ct[2];return void(u[wt]&&(p[wt]?.count||[]).forEach(H=>H(Et)));case"EOSE":{let H=ct[1];return void(H in p&&(p[H].eose.forEach(X=>X()),p[H].eose=[]))}case"OK":{let H=ct[1],X=ct[2],gt=ct[3]||"";if(H in b){let{resolve:_t,reject:st}=b[H];X?_t(null):st(new Error(gt))}return}case"NOTICE":let It=ct[1];return void f.notice.forEach(H=>H(It));case"AUTH":{let H=ct[1];return void f.auth?.forEach(X=>X(H))}}}catch{return}}a.onmessage=Q=>{q.enqueue(Q.data),Z||(Z=setInterval(et,0))}}))})).apply(this,arguments)}function D(){return 1===a?.readyState}function P(){return P=(0,y.A)(function*(){D()||(yield function T(){return $.apply(this,arguments)}())}),P.apply(this,arguments)}function F(Y){return z.apply(this,arguments)}function z(){return(z=(0,y.A)(function*(Y){let rt=JSON.stringify(Y);if(D()||(yield new Promise(q=>setTimeout(q,1e3)),D()))try{a.send(rt)}catch(q){console.log(q)}})).apply(this,arguments)}const W=(Y,{verb:rt="REQ",skipVerification:q=!1,alreadyHaveEvent:Z=null,id:et=Math.random().toString().slice(2)}={})=>{let Q=et;u[Q]={id:Q,filters:Y,skipVerification:q,alreadyHaveEvent:Z},F([rt,Q,...Y]);let yt={sub:(ct,wt={})=>W(ct||Y,{skipVerification:wt.skipVerification||q,alreadyHaveEvent:wt.alreadyHaveEvent||Z,id:Q}),unsub:()=>{delete u[Q],delete p[Q],F(["CLOSE",Q])},on:(ct,wt)=>{p[Q]=p[Q]||{event:[],count:[],eose:[]},p[Q][ct].push(wt)},off:(ct,wt)=>{let Et=p[Q],It=Et[ct].indexOf(wt);It>=0&&Et[ct].splice(It,1)},get events(){return function wo(e){return ni.apply(this,arguments)}(yt)}};return yt};function J(Y,rt){return new Promise((q,Z)=>{if(!Y.id)return void Z(new Error(`event ${Y} has no id`));let et=Y.id;F([rt,Y]),b[et]={resolve:q,reject:Z}})}return{url:e,sub:W,on:(Y,rt)=>{f[Y].push(rt),"connect"===Y&&1===a?.readyState&&rt()},off:(Y,rt)=>{let q=f[Y].indexOf(rt);-1!==q&&f[Y].splice(q,1)},list:(Y,rt)=>new Promise(q=>{let Z=W(Y,rt),et=[],Q=setTimeout(()=>{Z.unsub(),q(et)},t);Z.on("eose",()=>{Z.unsub(),clearTimeout(Q),q(et)}),Z.on("event",yt=>{et.push(yt)})}),get:(Y,rt)=>new Promise(q=>{let Z=W([Y],rt),et=setTimeout(()=>{Z.unsub(),q(null)},r);Z.on("event",Q=>{Z.unsub(),clearTimeout(et),q(Q)})}),count:Y=>new Promise(rt=>{let q=W(Y,{...W,verb:"COUNT"}),Z=setTimeout(()=>{q.unsub(),rt(null)},o);q.on("count",et=>{q.unsub(),clearTimeout(Z),rt(et)})}),publish:Y=>(0,y.A)(function*(){yield J(Y,"EVENT")})(),auth:Y=>(0,y.A)(function*(){yield J(Y,"AUTH")})(),connect:function U(){return P.apply(this,arguments)},close(){f={connect:[],disconnect:[],error:[],notice:[],auth:[]},p={},b={},a?.readyState===WebSocket.OPEN&&a.close()},get status(){return a?.readyState??3}}}function ni(){return ni=function Bn(e){return function(){return new qe(e.apply(this,arguments))}}(function*(e){let n;const t=[],r=o=>{n?(n(o),n=void 0):t.push(o)};e.on("event",r);try{for(;;)t.length>0?yield t.shift():yield yield Rn(new Promise(a=>{n=a}))}finally{e.off("event",r)}}),ni.apply(this,arguments)}ye({},{getHex64:()=>gr,getInt:()=>po,getSubscriptionId:()=>go,matchEventId:()=>Ua,matchEventKind:()=>Da,matchEventPubkey:()=>ja});var ri={};ye(ri,{BECH32_REGEX:()=>_o,decode:()=>qn,naddrEncode:()=>Ha,neventEncode:()=>qa,noteEncode:()=>Ga,nprofileEncode:()=>za,npubEncode:()=>$a,nrelayEncode:()=>Va,nsecEncode:()=>Fa});var bo=5e3,_o=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function qn(e){let{prefix:n,words:t}=V.I.decode(e,bo),r=new Uint8Array(V.I.fromWords(t));switch(n){case"nprofile":{let o=vr(r);if(!o[0]?.[0])throw new Error("missing TLV 0 for nprofile");if(32!==o[0][0].length)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:Re(o[0][0]),relays:o[1]?o[1].map(a=>Fe.decode(a)):[]}}}case"nevent":{let o=vr(r);if(!o[0]?.[0])throw new Error("missing TLV 0 for nevent");if(32!==o[0][0].length)throw new Error("TLV 0 should be 32 bytes");if(o[2]&&32!==o[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(o[3]&&4!==o[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:Re(o[0][0]),relays:o[1]?o[1].map(a=>Fe.decode(a)):[],author:o[2]?.[0]?Re(o[2][0]):void 0,kind:o[3]?.[0]?parseInt(Re(o[3][0]),16):void 0}}}case"naddr":{let o=vr(r);if(!o[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!o[2]?.[0])throw new Error("missing TLV 2 for naddr");if(32!==o[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(!o[3]?.[0])throw new Error("missing TLV 3 for naddr");if(4!==o[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:Fe.decode(o[0][0]),pubkey:Re(o[2][0]),kind:parseInt(Re(o[3][0]),16),relays:o[1]?o[1].map(a=>Fe.decode(a)):[]}}}case"nrelay":{let o=vr(r);if(!o[0]?.[0])throw new Error("missing TLV 0 for nrelay");return{type:"nrelay",data:Fe.decode(o[0][0])}}case"nsec":case"npub":case"note":return{type:n,data:Re(r)};default:throw new Error(`unknown prefix ${n}`)}}function vr(e){let n={},t=e;for(;t.length>0;){let r=t[0],o=t[1];if(!o)throw new Error(`malformed TLV ${r}`);let a=t.slice(2,2+o);if(t=t.slice(2+o),a.lengthLe.encode(t))}))}function qa(e){let n;return null!=e.kind&&(n=function Oa(e){const n=new Uint8Array(4);return n[0]=e>>24&255,n[1]=e>>16&255,n[2]=e>>8&255,n[3]=255&e,n}(e.kind)),Hn("nevent",yr({0:[jn(e.id)],1:(e.relays||[]).map(r=>Le.encode(r)),2:e.author?[jn(e.author)]:[],3:n?[new Uint8Array(n)]:[]}))}function Ha(e){let n=new ArrayBuffer(4);return new DataView(n).setUint32(0,e.kind,!1),Hn("naddr",yr({0:[Le.encode(e.identifier)],1:(e.relays||[]).map(r=>Le.encode(r)),2:[jn(e.pubkey)],3:[new Uint8Array(n)]}))}function Va(e){return Hn("nrelay",yr({0:[Le.encode(e)]}))}function yr(e){let n=[];return Object.entries(e).forEach(([t,r])=>{r.forEach(o=>{let a=new Uint8Array(o.length+2);a.set([parseInt(t)],0),a.set([o.length],1),a.set(o,2),n.push(a)})}),ir(...n)}var oi={};function xo(e,n,t){return si.apply(this,arguments)}function si(){return(si=(0,y.A)(function*(e,n,t){const o=Eo(bn.getSharedSecret(e,"02"+n));let a=Uint8Array.from(or(16)),u=Le.encode(t),f=yield crypto.subtle.importKey("raw",o,{name:"AES-CBC"},!1,["encrypt"]),p=yield crypto.subtle.encrypt({name:"AES-CBC",iv:a},f,u);return`${V.K3.encode(new Uint8Array(p))}?iv=${V.K3.encode(new Uint8Array(a.buffer))}`})).apply(this,arguments)}function Ya(e,n,t){return ai.apply(this,arguments)}function ai(){return(ai=(0,y.A)(function*(e,n,t){let[r,o]=t.split("?iv="),u=Eo(bn.getSharedSecret(e,"02"+n)),f=yield crypto.subtle.importKey("raw",u,{name:"AES-CBC"},!1,["decrypt"]),p=V.K3.decode(r),b=V.K3.decode(o),S=yield crypto.subtle.decrypt({name:"AES-CBC",iv:b},f,p);return Fe.decode(S)})).apply(this,arguments)}function Eo(e){return e.slice(1,33)}ye(oi,{decrypt:()=>Ya,encrypt:()=>xo}),typeof crypto<"u"&&!crypto.subtle&&crypto.webcrypto&&(crypto.subtle=crypto.webcrypto.subtle),ye({},{NIP05_REGEX:()=>ko,queryProfile:()=>Ja,searchDomain:()=>Xa,useFetchImplementation:()=>Za});var wr,ko=/^(?:([\w.+-]+)@)?([\w.-]+)$/;try{wr=fetch}catch{}function Za(e){wr=e}function Xa(e){return li.apply(this,arguments)}function li(){return(li=(0,y.A)(function*(e,n=""){try{return(yield(yield wr(`https://${e}/.well-known/nostr.json?name=${n}`)).json()).names}catch{return{}}})).apply(this,arguments)}function Ja(e){return ci.apply(this,arguments)}function ci(){return(ci=(0,y.A)(function*(e){const n=e.match(ko);if(!n)return null;const[t,r="_",o]=n;try{const a=yield wr(`https://${o}/.well-known/nostr.json?name=${r}`),{names:u,relays:f}=function Qa(e){const n={names:{}};for(const[t,r]of Object.entries(e.names))"string"==typeof t&&"string"==typeof r&&(n.names[t]=r);if(e.relays){n.relays={};for(const[t,r]of Object.entries(e.relays))"string"==typeof t&&Array.isArray(r)&&(n.relays[t]=r.filter(o=>"string"==typeof o))}return n}(yield a.json()),p=u[r];return p?{pubkey:p,relays:f?.[p]}:null}catch{return null}})).apply(this,arguments)}function el(e,n){let r=ia.c.fromMasterSeed((0,Hr.kw)(e,n)).derive("m/44'/1237'/0'/0/0").privateKey;if(!r)throw new Error("could not derive private key");return Re(r)}function nl(){return(0,Hr.we)(no.p)}function rl(e){return(0,Hr.JB)(e,no.p)}function ol(e){const n={reply:void 0,root:void 0,mentions:[],profiles:[]},t=[];for(const r of e.tags)"e"===r[0]&&r[1]&&t.push(r),"p"===r[0]&&r[1]&&n.profiles.push({pubkey:r[1],relays:r[2]?[r[2]]:[]});for(let r=0;r=n)break}return r}function cl(e,n,t,r){return Ve({kind:6,tags:[...e.tags??[],["e",n.id,t],["p",n.pubkey]],content:""===e.content?"":JSON.stringify(n),created_at:e.created_at},r)}function So(e){if(6!==e.kind)return;let n,t;for(let r=e.tags.length-1;r>=0&&(void 0===n||void 0===t);r--){const o=e.tags[r];o.length>=2&&("e"===o[0]&&void 0===n?n=o:"p"===o[0]&&void 0===t&&(t=o))}return void 0!==n?{id:n[1],relays:[n[2],t?.[2]].filter(r=>"string"==typeof r),author:t?.[1]}:void 0}function ul(e,{skipVerification:n}={}){const t=So(e);if(void 0===t||""===e.content)return;let r;try{r=JSON.parse(e.content)}catch{return}return r.id===t.id&&(n||pr(r))?r:void 0}ye({},{generateSeedWords:()=>nl,privateKeyFromSeedWords:()=>el,validateWords:()=>rl}),ye({},{parse:()=>ol}),ye({},{getPow:()=>Mo,minePow:()=>al}),ye({},{finishRepostEvent:()=>cl,getRepostedEvent:()=>ul,getRepostedEventPointer:()=>So}),ye({},{NOSTR_URI_REGEX:()=>br,parse:()=>dl,test:()=>hl});var br=new RegExp(`nostr:(${_o.source})`);function hl(e){return"string"==typeof e&&new RegExp(`^${br.source}$`).test(e)}function dl(e){const n=e.match(new RegExp(`^${br.source}$`));if(!n)throw new Error(`Invalid Nostr URI: ${e}`);return{uri:n[0],value:n[1],decoded:qn(n[1])}}function pl(e,n,t){const r=n.tags.filter(o=>o.length>=2&&("e"===o[0]||"p"===o[0]));return Ve({...e,kind:7,tags:[...e.tags??[],...r,["e",n.id],["p",n.pubkey]],content:e.content??"+"},t)}function gl(e){if(7!==e.kind)return;let n,t;for(let r=e.tags.length-1;r>=0&&(void 0===n||void 0===t);r--){const o=e.tags[r];o.length>=2&&("e"===o[0]&&void 0===n?n=o:"p"===o[0]&&void 0===t&&(t=o))}return void 0!==n&&void 0!==t?{id:n[1],relays:[n[2],t[2]].filter(r=>void 0!==r),author:t[1]}:void 0}function yl(e,n){let t=[];(n.kind||-1)>=0&&t.push(`kind=${n.kind}`),n.until&&t.push(`created_at<${n.until}`),n.since&&t.push(`created_at>${n.since}`);let r=t.join("&");if(""===r)throw new Error("refusing to create a delegation without any conditions");let o=He(Le.encode(`nostr:delegation:${n.pubkey}:${r}`)),a=Re(_n.sign(o,e));return{from:Qr(e),to:n.pubkey,cond:r,sig:a}}function wl(e){let n=e.tags.find(f=>"delegation"===f[0]&&f.length>=4);if(!n)return null;let t=n[1],r=n[2],o=n[3],a=r.split("&");for(let f=0;f"===b&&e.created_at>parseInt(S))continue;return null}}let u=He(Le.encode(`nostr:delegation:${e.pubkey}:${r}`));return _n.verify(o,u,t)?t:null}ye({},{finishReactionEvent:()=>pl,getReactedEventPointer:()=>gl}),ye({},{createDelegation:()=>yl,getDelegator:()=>wl}),ye({},{matchAll:()=>_l,regex:()=>ui,replaceAll:()=>xl});var ui=()=>new RegExp(`\\b${br.source}\\b`,"g");function*_l(e){const n=e.matchAll(ui());for(const t of n)try{const[r,o]=t;yield{uri:r,value:o,decoded:qn(o),start:t.index,end:t.index+r.length}}catch{}}function xl(e,n){return e.replaceAll(ui(),(t,r)=>n({uri:t,value:r,decoded:qn(r)}))}ye({},{channelCreateEvent:()=>kl,channelHideMessageEvent:()=>Cl,channelMessageEvent:()=>Sl,channelMetadataEvent:()=>Ml,channelMuteUserEvent:()=>Al});var fi,kl=(e,n)=>{let t;if("object"==typeof e.content)t=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;t=e.content}return Ve({kind:40,tags:[...e.tags??[]],content:t,created_at:e.created_at},n)},Ml=(e,n)=>{let t;if("object"==typeof e.content)t=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;t=e.content}return Ve({kind:41,tags:[["e",e.channel_create_event_id],...e.tags??[]],content:t,created_at:e.created_at},n)},Sl=(e,n)=>{const t=[["e",e.channel_create_event_id,e.relay_url,"root"]];return e.reply_to_channel_message_event_id&&t.push(["e",e.reply_to_channel_message_event_id,e.relay_url,"reply"]),Ve({kind:42,tags:[...t,...e.tags??[]],content:e.content,created_at:e.created_at},n)},Cl=(e,n)=>{let t;if("object"==typeof e.content)t=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;t=e.content}return Ve({kind:43,tags:[["e",e.channel_message_event_id],...e.tags??[]],content:t,created_at:e.created_at},n)},Al=(e,n)=>{let t;if("object"==typeof e.content)t=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;t=e.content}return Ve({kind:44,tags:[["p",e.pubkey_to_mute],...e.tags??[]],content:t,created_at:e.created_at},n)};ye({},{useFetchImplementation:()=>Il,validateGithub:()=>Rl});try{fi=fetch}catch{}function Il(e){fi=e}function Rl(e,n,t){return hi.apply(this,arguments)}function hi(){return(hi=(0,y.A)(function*(e,n,t){try{return(yield(yield fi(`https://gist.github.com/${n}/${t}/raw`)).text())===`Verifying that I control the following Nostr public key: ${e}`}catch{return!1}})).apply(this,arguments)}ye({},{authenticate:()=>Nl});var Nl=function(){var e=(0,y.A)(function*({challenge:n,relay:t,sign:r}){const o={kind:22242,created_at:Math.floor(Date.now()/1e3),tags:[["relay",t.url],["challenge",n]],content:""};return t.auth(yield r(o))});return function(t){return e.apply(this,arguments)}}();ye({},{decrypt:()=>Ul,encrypt:()=>Ll,utils:()=>fn});var mi,fn={v2:{maxPlaintextSize:65408,minCiphertextSize:100,maxCiphertextSize:102400,getConversationKey:(e,n)=>bn.getSharedSecret(e,"02"+n).subarray(1,33),getMessageKeys(e,n){const t=((e,n,t,r,o)=>function Ea(e,n,t,r=32){if(Ae.hash(e),Ae.number(r),r>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const o=Math.ceil(r/e.outputLen);void 0===t&&(t=lo);const a=new Uint8Array(o*e.outputLen),u=wn.create(e,n),f=u._cloneInto(),p=new Uint8Array(u.outputLen);for(let b=0;b=fn.v2.maxPlaintextSize)throw new Error("invalid plaintext length: must be between 1b and 64KB");const r=fn.v2.calcPadding(t),o=new Uint8Array(r-t),a=new Uint8Array(2);return new DataView(a.buffer).setUint16(0,t),ir(a,n,o)},unpad(e){const n=new DataView(e.buffer).getUint16(0),t=e.subarray(2,2+n);if(0===n||t.length!==n||e.length!==2+fn.v2.calcPadding(n))throw new Error("invalid padding");return Fe.decode(t)}}};function Ll(e,n,t={}){const r=t.version??2;if(2!==r)throw new Error("unknown encryption version "+r);const o=t.salt??or(32);Zr(o,32);const a=fn.v2.getMessageKeys(e,o),u=fn.v2.pad(n),f=oo(a.encryption,a.nonce,u),p=wn(He,a.auth,f);return V.K3.encode(ir(new Uint8Array([r]),o,f,p))}function Ul(e,n){const t=fn.v2;Zr(e,32);const r=n.length;if(r=t.maxCiphertextSize)throw new Error("invalid ciphertext length: "+r);if("#"===n[0])throw new Error("unknown encryption version");let o;try{o=V.K3.decode(n)}catch($){throw new Error("invalid base64: "+$.message)}const a=o.subarray(0,1)[0];if(2!==a)throw new Error("unknown encryption version "+a);const u=o.subarray(1,33),f=o.subarray(33,-32),p=o.subarray(-32),b=t.getMessageKeys(e,u);if(!function ca(e,n){if(e.length!==n.length)throw new Error("equalBytes: Different size of Uint8Arrays");let t=!0;for(let r=0;rOl,parseConnectionString:()=>Dl}),ye({},{getZapEndpoint:()=>Gl,makeZapReceipt:()=>Hl,makeZapRequest:()=>zl,useFetchImplementation:()=>$l,validateZapRequest:()=>ql});try{mi=fetch}catch{}function $l(e){mi=e}function Gl(e){return pi.apply(this,arguments)}function pi(){return(pi=(0,y.A)(function*(e){try{let n="",{lud06:t,lud16:r}=JSON.parse(e.content);if(t){let{words:u}=V.I.decode(t,1e3),f=V.I.fromWords(u);n=Fe.decode(f)}else{if(!r)return null;{let[u,f]=r.split("@");n=`https://${f}/.well-known/lnurlp/${u}`}}let a=yield(yield mi(n)).json();if(a.allowsNostr&&a.nostrPubkey)return a.callback}catch{}return null})).apply(this,arguments)}function zl({profile:e,event:n,amount:t,relays:r,comment:o=""}){if(!t)throw new Error("amount not given");if(!e)throw new Error("profile not given");let a={kind:9734,created_at:Math.round(Date.now()/1e3),content:o,tags:[["p",e],["amount",t.toString()],["relays",...r]]};return n&&a.tags.push(["e",n]),a}function ql(e){let n;try{n=JSON.parse(e)}catch{return"Invalid zap request JSON."}if(!ei(n))return"Zap request is not a valid Nostr event.";if(!pr(n))return"Invalid signature on zap request.";let t=n.tags.find(([a,u])=>"p"===a&&u);if(!t)return"Zap request doesn't have a 'p' tag.";if(!t[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let r=n.tags.find(([a,u])=>"e"===a&&u);return r&&!r[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":n.tags.find(([a,u])=>"relays"===a&&u)?null:"Zap request doesn't have a 'relays' tag."}function Hl({zapRequest:e,preimage:n,bolt11:t,paidAt:r}){let a=JSON.parse(e).tags.filter(([f])=>"e"===f||"p"===f||"a"===f),u={kind:9735,created_at:Math.round(r.getTime()/1e3),content:"",tags:[...a,["bolt11",t],["description",e]]};return n&&u.tags.push(["preimage",n]),u}ye({},{getToken:()=>Wl,unpackEventFromToken:()=>Ao,validateEvent:()=>To,validateToken:()=>Yl});var Co="Nostr ";function Wl(e,n,t){return gi.apply(this,arguments)}function gi(){return(gi=(0,y.A)(function*(e,n,t,r=!1){if(!e||!n)throw new Error("Missing loginUrl or httpMethod");const o=function Ia(e=255){return{kind:e,content:"",tags:[],created_at:0}}(27235);o.tags=[["u",e],["method",n]],o.created_at=Math.round((new Date).getTime()/1e3);const a=yield t(o);return(r?Co:"")+V.K3.encode(Le.encode(JSON.stringify(a)))})).apply(this,arguments)}function Yl(e,n,t){return vi.apply(this,arguments)}function vi(){return(vi=(0,y.A)(function*(e,n,t){const r=yield Ao(e).catch(a=>{throw a});return yield To(r,n,t).catch(a=>{throw a})})).apply(this,arguments)}function Ao(e){return yi.apply(this,arguments)}function yi(){return(yi=(0,y.A)(function*(e){if(!e)throw new Error("Missing token");e=e.replace(Co,"");const n=Fe.decode(V.K3.decode(e));if(!n||0===n.length||!n.startsWith("{"))throw new Error("Invalid token");return JSON.parse(n)})).apply(this,arguments)}function To(e,n,t){return wi.apply(this,arguments)}function wi(){return(wi=(0,y.A)(function*(e,n,t){if(!e)throw new Error("Invalid nostr event");if(!pr(e))throw new Error("Invalid nostr event, signature invalid");if(27235!==e.kind)throw new Error("Invalid nostr event, kind invalid");if(!e.created_at)throw new Error("Invalid nostr event, created_at invalid");if(Math.round((new Date).getTime()/1e3)-e.created_at>60)throw new Error("Invalid nostr event, expired");const r=e.tags.find(a=>"u"===a[0]);if(1!==r?.length&&r?.[1]!==n)throw new Error("Invalid nostr event, url tag invalid");const o=e.tags.find(a=>"method"===a[0]);if(1!==o?.length&&o?.[1].toLowerCase()!==t.toLowerCase())throw new Error("Invalid nostr event, method tag invalid");return!0})).apply(this,arguments)}function Rt(){return Rt=Object.assign?Object.assign.bind():function(e){for(var n=1;ne.reduce((n,t)=>n+t.toString(16).padStart(2,"0"),"");class No extends Error{constructor(n,t,r,o){let a=n.toString();t&&(a+=` ${t}`),a+=": ",a+=o.message?o.message:JSON.stringify(o),super(a),this.status=void 0,this.statusText=void 0,this.headers=void 0,this.error=void 0,this.status=n,this.statusText=t,this.headers=r,this.error=o}}const Kl=["auth","endpoint","params","request_body","method","max_retries","base_url","user_agent","headers"],Zl="https://api.getalby.com";function Po(e,n){return _i.apply(this,arguments)}function _i(){return(_i=(0,y.A)(function*(e,n,t=0){const r=yield fetch(e,n);if(429===r.status&&t>0){const o=Number(r.headers.get("x-rate-limit-reset")),a=Number(r.headers.get("x-rate-limit-remaining")),u=1e3*o-Date.now();let f=1e3;return 0===a&&(f=u),yield new Promise(p=>setTimeout(p,f)),Po(e,n,t-1)}return r})).apply(this,arguments)}function xi(){return(xi=(0,y.A)(function*(e){let{auth:n,endpoint:t,params:r={},request_body:o,method:a,max_retries:u,base_url:f=Zl,user_agent:p,headers:b}=e,S=function bi(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r=0||(o[t]=e[t]);return o}(e,Kl);const T=new URL(f+t);T.search=function Io(e){return Object.entries(e).map(([n,t])=>n&&t?`${n}=${t}`:"").filter(n=>n).join("&")}(r);const $="POST"===a&&!!o,D=n?yield n.getAuthHeader(T.href,a):void 0,U=yield Po(T.toString(),Rt({headers:Rt({},$?{"Content-Type":"application/json; charset=utf-8"}:void 0,D,b,{"User-Agent":p??"@getalby/sdk","X-User-Agent":p??"@getalby/sdk"}),method:a,body:$?JSON.stringify(o):void 0},S),u);if(!U.ok){const P=yield U.json();throw new No(U.status,U.statusText,U.headers,P)}return U})).apply(this,arguments)}function we(e){return Ei.apply(this,arguments)}function Ei(){return Ei=(0,y.A)(function*(e){return(yield function Xl(e){return xi.apply(this,arguments)}(e)).json()}),Ei.apply(this,arguments)}class Uo{constructor(n){this.bearer_token=void 0,this.bearer_token=n}getAuthHeader(){return{Authorization:`Bearer ${this.bearer_token}`}}}class en extends Error{constructor(n,t){super(n),this.error=void 0,this.code=void 0,this.error=n,this.code=t}}class jo extends en{}class ki extends en{}class Mi extends ki{}class Si extends ki{}class Ci extends en{}class Ai extends en{}class _r extends en{}class Do extends en{}class Oo extends en{}const Fo={alby:{authorizationUrl:"https://nwc.getalby.com/apps/new",relayUrl:"wss://relay.getalby.com/v1",walletPubkey:"69effe7b49a6dd5cf525bd0905917a5005ffe480b58eeb8e861418cf3ae760d9"}};class Vn{static parseWalletConnectUrl(n){n=n.replace("nostrwalletconnect://","http://").replace("nostr+walletconnect://","http://").replace("nostrwalletconnect:","http://").replace("nostr+walletconnect:","http://");const t=new URL(n),r=t.searchParams.get("relay");if(!r)throw new Error("No relay URL found in connection string");const o={walletPubkey:t.host,relayUrl:r},a=t.searchParams.get("secret");a&&(o.secret=a);const u=t.searchParams.get("lud16");return u&&(o.lud16=u),o}static withNewSecret(n){return(n=n||{}).secret=co(),new Vn(n)}constructor(n){var t;this.relay=void 0,this.relayUrl=void 0,this.secret=void 0,this.lud16=void 0,this.walletPubkey=void 0,this.options=void 0,n&&n.nostrWalletConnectUrl&&(n=Rt({},Vn.parseWalletConnectUrl(n.nostrWalletConnectUrl),n));const r=Fo[(null==(t=n)?void 0:t.providerName)||"alby"];this.options=Rt({},r,n||{}),this.relayUrl=this.options.relayUrl,this.relay=yo(this.relayUrl),this.options.secret&&(this.secret=this.options.secret.toLowerCase().startsWith("nsec")?ri.decode(this.options.secret).data:this.options.secret),this.lud16=this.options.lud16,this.walletPubkey=this.options.walletPubkey.toLowerCase().startsWith("npub")?ri.decode(this.options.walletPubkey).data:this.options.walletPubkey,void 0===globalThis.WebSocket&&console.error("WebSocket is undefined. Make sure to `import websocket-polyfill` for nodejs environments")}get nostrWalletConnectUrl(){return this.getNostrWalletConnectUrl()}getNostrWalletConnectUrl(n=!0){let t=`nostr+walletconnect://${this.walletPubkey}?relay=${this.relayUrl}&pubkey=${this.publicKey}`;return n&&(t=`${t}&secret=${this.secret}`),t}get connected(){return 1===this.relay.status}get publicKey(){if(!this.secret)throw new Error("Missing secret key");return Qr(this.secret)}getPublicKey(){return Promise.resolve(this.publicKey)}signEvent(n){if(!this.secret)throw new Error("Missing secret key");return Promise.resolve(Ve(n,this.secret))}getEventHash(n){return zn(n)}close(){return this.relay.close()}encrypt(n,t){var r=this;return(0,y.A)(function*(){if(!r.secret)throw new Error("Missing secret");return yield oi.encrypt(r.secret,n,t)})()}decrypt(n,t){var r=this;return(0,y.A)(function*(){if(!r.secret)throw new Error("Missing secret");return yield oi.decrypt(r.secret,n,t)})()}getAuthorizationUrl(n){if(!this.options.authorizationUrl)throw new Error("Missing authorizationUrl option");const t=new URL(this.options.authorizationUrl);return null!=n&&n.name&&t.searchParams.set("name",n?.name),t.searchParams.set("pubkey",this.publicKey),null!=n&&n.returnTo&&t.searchParams.set("return_to",n.returnTo),null!=n&&n.budgetRenewal&&t.searchParams.set("budget_renewal",n.budgetRenewal),null!=n&&n.expiresAt&&t.searchParams.set("expires_at",Math.floor(n.expiresAt.getTime()/1e3).toString()),null!=n&&n.maxAmount&&t.searchParams.set("max_amount",n.maxAmount.toString()),void 0!==n?.editable&&t.searchParams.set("editable",n.editable.toString()),null!=n&&n.requestMethods&&t.searchParams.set("request_methods",n.requestMethods.join(" ")),t}initNWC(n={}){n.name||(n.name=document.location.host);const t=this.getAuthorizationUrl(n),r=window.outerHeight/2+window.screenY-300,o=window.outerWidth/2+window.screenX-200;return new Promise((a,u)=>{const f=window.open(t.toString(),`${document.title} - Wallet Connect`,`height=600,width=400,top=${r},left=${o}`);if(!f)return void u(new Error("failed to execute window.open"));const p=S=>{const T=S.data;T&&"nwc:success"===T.type&&S.origin===`${t.protocol}//${t.host}`&&(a(T),clearInterval(b),window.removeEventListener("message",p),f&&f.close())},b=setInterval(()=>{f&&f.closed&&(clearInterval(b),window.removeEventListener("message",p),u(new Error("Popup closed")))},500);window.addEventListener("message",p)})}getWalletServiceSupportedMethods(){var n=this;return(0,y.A)(function*(){return console.warn("getWalletServiceSupportedMethods is deprecated. Please use getWalletServiceInfo instead."),(yield n.getWalletServiceInfo()).capabilities})()}getWalletServiceInfo(){var n=this;return(0,y.A)(function*(){var t;yield n._checkConnected();const r=yield n.relay.list([{kinds:[13194],limit:1,authors:[n.walletPubkey]}],{eoseSubTimeout:1e4});if(!r.length)throw new Error("no info event (kind 13194) returned from relay");const o=r[0].content,a=r[0].tags.find(u=>"notifications"===u[0]);return{capabilities:o.split(/[ |,]/g),notifications:(null==a||null==(t=a[1])?void 0:t.split(" "))||[]}})()}getInfo(){var n=this;return(0,y.A)(function*(){try{return yield n.executeNip47Request("get_info",{},t=>!!t.methods)}catch(t){throw console.error("Failed to request get_info",t),t}})()}getBalance(){var n=this;return(0,y.A)(function*(){try{return yield n.executeNip47Request("get_balance",{},t=>void 0!==t.balance)}catch(t){throw console.error("Failed to request get_balance",t),t}})()}payInvoice(n){var t=this;return(0,y.A)(function*(){try{return yield t.executeNip47Request("pay_invoice",n,r=>!!r.preimage)}catch(r){throw console.error("Failed to request pay_invoice",r),r}})()}payKeysend(n){var t=this;return(0,y.A)(function*(){try{return yield t.executeNip47Request("pay_keysend",n,r=>!!r.preimage)}catch(r){throw console.error("Failed to request pay_keysend",r),r}})()}signMessage(n){var t=this;return(0,y.A)(function*(){try{return yield t.executeNip47Request("sign_message",n,r=>r.message===n.message&&!!r.signature)}catch(r){throw console.error("Failed to request sign_message",r),r}})()}multiPayInvoice(n){var t=this;return(0,y.A)(function*(){try{return{invoices:yield t.executeMultiNip47Request("multi_pay_invoice",n,n.invoices.length,r=>!!r.preimage),errors:[]}}catch(r){throw console.error("Failed to request multi_pay_invoice",r),r}})()}multiPayKeysend(n){var t=this;return(0,y.A)(function*(){try{return{keysends:yield t.executeMultiNip47Request("multi_pay_keysend",n,n.keysends.length,r=>!!r.preimage),errors:[]}}catch(r){throw console.error("Failed to request multi_pay_keysend",r),r}})()}makeInvoice(n){var t=this;return(0,y.A)(function*(){try{if(!n.amount)throw new Error("No amount specified");return yield t.executeNip47Request("make_invoice",n,r=>!!r.invoice)}catch(r){throw console.error("Failed to request make_invoice",r),r}})()}lookupInvoice(n){var t=this;return(0,y.A)(function*(){try{return yield t.executeNip47Request("lookup_invoice",n,r=>!!r.invoice)}catch(r){throw console.error("Failed to request lookup_invoice",r),r}})()}listTransactions(n){var t=this;return(0,y.A)(function*(){try{return yield t.executeNip47Request("list_transactions",n,r=>!!r.transactions)}catch(r){throw console.error("Failed to request list_transactions",r),r}})()}subscribeNotifications(n,t){var r=this;return(0,y.A)(function*(){var o=r;let a,u,f,p=!0;return(0,y.A)(function*(){for(;p;){try{yield o._checkConnected(),f=o.relay.sub([{kinds:[23196],authors:[o.walletPubkey],"#p":[o.publicKey]}]),console.info("subscribed to relay"),f.on("event",function(){var b=(0,y.A)(function*(S){const T=yield o.decrypt(o.walletPubkey,S.content);let $;try{$=JSON.parse(T)}catch(D){return void console.error("Failed to parse decrypted event content",D)}$.notification?(!t||t.indexOf($.notification_type)>-1)&&n($):console.error("No notification in response",$)});return function(S){return b.apply(this,arguments)}}()),yield new Promise(b=>{a=()=>{b()},u=()=>{console.info("relay disconnected"),a?.()},o.relay.on("disconnect",u)}),void 0!==u&&o.relay.off("disconnect",u)}catch(b){console.error("error subscribing to notifications",b||"unknown relay error")}p&&(yield new Promise(b=>setTimeout(b,1e3)))}})(),()=>{var b;p=!1,a?.(),null==(b=f)||b.unsub()}})()}executeNip47Request(n,t,r){var o=this;return(0,y.A)(function*(){var a=o;return yield o._checkConnected(),new Promise((u,f)=>{(0,y.A)(function*(){const p={method:n,params:t},b=yield a.encrypt(a.walletPubkey,JSON.stringify(p)),S={kind:23194,created_at:Math.floor(Date.now()/1e3),tags:[["p",a.walletPubkey]],content:b,pubkey:a.publicKey},T=yield a.signEvent(S),$=a.relay.sub([{kinds:[23195],authors:[a.walletPubkey],"#e":[T.id]}]),D=setTimeout(function(){$.unsub(),f(new Si(`reply timeout: event ${T.id}`,"INTERNAL"))},6e4);$.on("event",function(){var P=(0,y.A)(function*(F){clearTimeout(D),$.unsub();const z=yield a.decrypt(a.walletPubkey,F.content);let W;try{W=JSON.parse(z)}catch{return clearTimeout(D),$.unsub(),void f(new Ai("failed to deserialize response","INTERNAL"))}var J,Y;W.result?r(W.result)?u(W.result):(clearTimeout(D),$.unsub(),f(new _r("response from NWC failed validation: "+JSON.stringify(W.result),"INTERNAL"))):(clearTimeout(D),$.unsub(),f(new jo((null==(J=W.error)?void 0:J.message)||"unknown Error",(null==(Y=W.error)?void 0:Y.code)||"INTERNAL")))});return function(F){return P.apply(this,arguments)}}());const U=setTimeout(function(){$.unsub(),f(new Mi(`publish timeout: ${T.id}`,"INTERNAL"))},5e3);try{yield a.relay.publish(T),clearTimeout(U)}catch(P){clearTimeout(U),f(new Ci(`failed to publish: ${P}`,"INTERNAL"))}})()})})()}executeMultiNip47Request(n,t,r,o){var a=this;return(0,y.A)(function*(){var u=a;yield a._checkConnected();const f=[];return new Promise((p,b)=>{(0,y.A)(function*(){const S={method:n,params:t},T=yield u.encrypt(u.walletPubkey,JSON.stringify(S)),$={kind:23194,created_at:Math.floor(Date.now()/1e3),tags:[["p",u.walletPubkey]],content:T,pubkey:u.publicKey},D=yield u.signEvent($),U=u.relay.sub([{kinds:[23195],authors:[u.walletPubkey],"#e":[D.id]}]),P=setTimeout(function(){U.unsub(),b(new Si(`reply timeout: event ${D.id}`,"INTERNAL"))},6e4);U.on("event",function(){var z=(0,y.A)(function*(W){const J=yield u.decrypt(u.walletPubkey,W.content);let Y;try{Y=JSON.parse(J)}catch{clearTimeout(P),U.unsub(),b(new Ai("failed to deserialize response","INTERNAL"))}if(Y.result){var rt;if(!o(Y.result))return clearTimeout(P),U.unsub(),void b(new _r("Response from NWC failed validation: "+JSON.stringify(Y.result),"INTERNAL"));const et=null==(rt=W.tags.find(Q=>"d"===Q[0]))?void 0:rt[1];if(void 0===et)return clearTimeout(P),U.unsub(),void b(new _r("No d tag found in response event","INTERNAL"));f.push(Rt({},Y.result,{dTag:et})),f.length===r&&(clearTimeout(P),U.unsub(),p(f))}else{var q,Z;clearTimeout(P),U.unsub(),b(new Do(null==(q=Y.error)?void 0:q.message,null==(Z=Y.error)?void 0:Z.code))}});return function(W){return z.apply(this,arguments)}}());const F=setTimeout(function(){U.unsub(),b(new Mi(`Publish timeout: ${D.id}`,"INTERNAL"))},5e3);try{yield u.relay.publish(D),clearTimeout(F)}catch(z){clearTimeout(F),b(new Ci(`Failed to publish: ${z}`,"INTERNAL"))}})()})})()}_checkConnected(){var n=this;return(0,y.A)(function*(){if(!n.secret)throw new Error("Missing secret key");try{yield n.relay.connect()}catch{throw console.error("failed to connect to relay",n.relayUrl),new Oo("Failed to connect to "+n.relayUrl,"OTHER")}})()}}const tc={get_info:"getInfo",get_balance:"getBalance",make_invoice:"makeInvoice",pay_invoice:"sendPayment",pay_keysend:"payKeysend",lookup_invoice:"lookupInvoice",list_transactions:"listTransactions",multi_pay_invoice:"sendMultiPayment",multi_pay_keysend:"multiKeysend",sign_message:"signMessage"};class xr{get relay(){return console.warn("relay is deprecated. Please use client.relay instead."),this.client.relay}get relayUrl(){return console.warn("relayUrl is deprecated. Please use client.relayUrl instead."),this.client.relayUrl}get walletPubkey(){return console.warn("walletPubkey is deprecated. Please use client.walletPubkey instead."),this.client.walletPubkey}get options(){return this.client.options}get secret(){return console.warn("secret is deprecated. Please use client.secret instead."),this.client.secret}static withNewSecret(n){return(n=n||{}).secret=co(),new xr(n)}constructor(n){this._enabled=!1,this.client=void 0,this.subscribers=void 0,this.client=new Vn(n),this.subscribers={}}on(n,t){this.subscribers[n]=t}notify(n,t){const r=this.subscribers[n];r&&r(t)}getNostrWalletConnectUrl(n=!0){return console.warn("getNostrWalletConnectUrl is deprecated. Please use client.getNostrWalletConnectUrl instead."),this.client.getNostrWalletConnectUrl(n)}get nostrWalletConnectUrl(){return console.warn("nostrWalletConnectUrl is deprecated. Please use client.nostrWalletConnectUrl instead."),this.client.nostrWalletConnectUrl}get connected(){return console.warn("connected is deprecated. Please use client.connected instead."),this.client.connected}get publicKey(){return console.warn("publicKey is deprecated. Please use client.publicKey instead."),this.client.publicKey}getPublicKey(){return this.client.getPublicKey()}signEvent(n){return this.client.signEvent(n)}getEventHash(n){return console.warn("getEventHash is deprecated. Please use client.getEventHash instead."),this.client.getEventHash(n)}enable(){var n=this;return(0,y.A)(function*(){n._enabled=!0})()}close(){return this.client.close()}encrypt(n,t){var r=this;return(0,y.A)(function*(){return console.warn("encrypt is deprecated. Please use client.encrypt instead."),r.client.encrypt(n,t)})()}decrypt(n,t){var r=this;return(0,y.A)(function*(){return console.warn("decrypt is deprecated. Please use client.decrypt instead."),r.client.decrypt(n,t)})()}getAuthorizationUrl(n){return console.warn("getAuthorizationUrl is deprecated. Please use client.getAuthorizationUrl instead."),this.client.getAuthorizationUrl(n)}initNWC(n={}){return console.warn("initNWC is deprecated. Please use client.initNWC instead."),this.client.initNWC(n)}getInfo(){var n=this;return(0,y.A)(function*(){yield n.checkEnabled();const t=["lightning","nostr"],r="Alby JS SDK";try{const o=yield n.client.getInfo(),a={methods:o.methods.map(u=>tc[u]),node:{alias:o.alias,pubkey:o.pubkey,color:o.color},supports:t,version:r};return n.notify("getInfo",a),a}catch(o){return console.error("Using minimal getInfo",o),{methods:["sendPayment"],node:{},supports:t,version:r}}})()}getBalance(){var n=this;return(0,y.A)(function*(){yield n.checkEnabled();const t=yield n.client.getBalance(),r={balance:Math.floor(t.balance/1e3),currency:"sats"};return n.notify("getBalance",r),r})()}sendPayment(n){var t=this;return(0,y.A)(function*(){yield t.checkEnabled();const r={preimage:(yield t.client.payInvoice({invoice:n})).preimage};return t.notify("sendPayment",r),r})()}sendPaymentAsync(n){var t=this;return(0,y.A)(function*(){return yield t.checkEnabled(),t.client.payInvoice({invoice:n}),t.notify("sendPaymentAsync",{}),{}})()}keysend(n){var t=this;return(0,y.A)(function*(){yield t.checkEnabled();const r={preimage:(yield t.client.payKeysend($o(n))).preimage};return t.notify("keysend",r),r})()}signMessage(n){var t=this;return(0,y.A)(function*(){yield t.checkEnabled();const r=yield t.client.signMessage({message:n}),o={message:r.message,signature:r.signature};return t.notify("keysend",o),o})()}makeInvoice(n){var t=this;return(0,y.A)(function*(){var r;yield t.checkEnabled();const o="object"==typeof n?n:void 0,a=+(null!=(r=o?.amount)?r:n);if(!a)throw new Error("No amount specified");const u={paymentRequest:(yield t.client.makeInvoice({amount:1e3*a,description:o?.defaultMemo})).invoice};return t.notify("makeInvoice",u),u})()}lookupInvoice(n){var t=this;return(0,y.A)(function*(){yield t.checkEnabled();const r=yield t.client.lookupInvoice({invoice:n.paymentRequest,payment_hash:n.paymentHash}),o={preimage:r.preimage,paymentRequest:r.invoice,paid:!!r.settled_at};return t.notify("lookupInvoice",o),o})()}listTransactions(n){var t=this;return(0,y.A)(function*(){yield t.checkEnabled();const r={transactions:(yield t.client.listTransactions(n)).transactions.map(ec)};return t.notify("listTransactions",r),r})()}sendMultiPayment(n){var t=this;return(0,y.A)(function*(){yield t.checkEnabled();const o={payments:(yield t.client.multiPayInvoice({invoices:n.map((a,u)=>({invoice:a,id:u.toString()}))})).invoices.map(a=>{const u=n[parseInt(a.dTag)];if(!u)throw new Error("Could not find paymentRequest matching response d tag");return{paymentRequest:u,preimage:a.preimage}}),errors:[]};return t.notify("sendMultiPayment",o),o})()}multiKeysend(n){var t=this;return(0,y.A)(function*(){yield t.checkEnabled();const o={keysends:(yield t.client.multiPayKeysend({keysends:n.map((a,u)=>Rt({},$o(a),{id:u.toString()}))})).keysends.map(a=>{const u=n[parseInt(a.dTag)];if(!u)throw new Error("Could not find keysend matching response d tag");return{keysend:u,preimage:a.preimage}}),errors:[]};return t.notify("multiKeysend",o),o})()}lnurl(n){throw new Error("Method not implemented.")}request(n,t){throw new Error("Method not implemented.")}verifyMessage(n,t){throw new Error("Method not implemented.")}checkEnabled(){var n=this;return(0,y.A)(function*(){if(!n._enabled)throw new Error("please call enable() and await the promise before calling this function")})()}}function ec(e){return Rt({},e,{amount:Math.floor(e.amount/1e3),fees_paid:e.fees_paid?Math.floor(e.fees_paid/1e3):0})}function $o(e){return{amount:1e3*+e.amount,pubkey:e.destination,tlv_records:e.customRecords?Object.entries(e.customRecords).map(n=>({type:parseInt(n[0]),value:Bo((new TextEncoder).encode(n[1]))})):[]}}const nc=xr;function Go(e){const n={};return e.recipient.customKey&&e.recipient.customValue&&(n[e.recipient.customKey]=e.recipient.customValue),n[7629169]=JSON.stringify(e.boostagram),{destination:e.recipient.address,amount:e.amount,custom_records:n}}class zo{constructor(n,t){this.auth=void 0,this.defaultRequestOptions=void 0,this.auth="string"==typeof n?new Uo(n):n,this.defaultRequestOptions=Rt({},t,{user_agent:t?.user_agent})}accountBalance(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/balance",params:n,method:"GET"}))}accountSummary(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/user/summary",params:n,method:"GET"}))}accountInformation(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/user/me",params:n,method:"GET"}))}accountValue4Value(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/user/value4value",params:n,method:"GET"}))}incomingInvoices(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/invoices/incoming",params:n,method:"GET"}))}outgoingInvoices(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/invoices/outgoing",params:n,method:"GET"}))}invoices(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/invoices",params:n,method:"GET"}))}getInvoice(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:`/invoices/${n}`,method:"GET"}))}decodeInvoice(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:`/decode/bolt11/${n}`,method:"GET"}))}createInvoice(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/invoices",request_body:n,method:"POST"}))}keysend(n,t){let r,o;return Array.isArray(n)?(r="/payments/keysend/multi",o={keysends:n.map(a=>Rt({},a,{custom_records:a.customRecords}))}):(r="/payments/keysend",o=Rt({},n,{custom_records:n.customRecords})),we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:r,request_body:o,method:"POST"}))}sendPayment(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/payments/bolt11",request_body:n,method:"POST"}))}sendBoostagram(n,t){let r,o;return Array.isArray(n)?(r="/payments/keysend/multi",o={keysends:n.map(a=>Go(a))}):(r="/payments/keysend",o=Go(n)),we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:r,request_body:o,method:"POST"}))}sendToAlbyAccount(n,t){return console.warn("sendToAlbyAccount is deprecated. Please use sendBoostagramToAlbyAccount instead."),this.sendBoostagramToAlbyAccount(n,t)}sendBoostagramToAlbyAccount(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/payments/keysend",request_body:{destination:"030a58b8653d32b99200a2334cfe913e51dc7d155aa0116c176657a4f1722677a3",custom_records:{696969:n.account},amount:n.amount,memo:n.memo},method:"POST"}))}createWebhookEndpoint(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/webhook_endpoints",request_body:n,method:"POST"}))}deleteWebhookEndpoint(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:`/webhook_endpoints/${n}`,method:"DELETE"}))}getSwapInfo(n){return we(Rt({auth:this.auth},this.defaultRequestOptions,n,{endpoint:"/swaps/info",method:"GET"}))}createSwap(n,t){return we(Rt({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/swaps",method:"POST",request_body:n}))}}var Er={__proto__:null,NostrWebLNProvider:xr,NWC:nc,OauthWeblnProvider:class{constructor(e){this.client=void 0,this.auth=void 0,this.oauth=void 0,this.subscribers=void 0,this.isExecuting=void 0,this.auth=e.auth,this.client=new zo(e.auth),this.oauth=!0,this.subscribers={},this.isExecuting=!1}on(e,n){this.subscribers[e]=n}notify(e,n){const t=this.subscribers[e];t&&t(n)}enable(){var e=this;return(0,y.A)(function*(){var n;if(!e.isExecuting){if(null!=(n=e.auth.token)&&n.access_token)return{enabled:!0};if(typeof window>"u"||void 0===window.document)throw new Error("Missing access token");try{e.isExecuting=!0,yield e.openAuthorization()}finally{e.isExecuting=!1}}})()}sendPayment(e){var n=this;return(0,y.A)(function*(){if(!n.isExecuting)try{n.isExecuting=!0;const t=yield n.client.sendPayment({invoice:e});return n.notify("sendPayment",t),{preimage:t.payment_preimage}}catch(t){let r="Unknown Error";throw t instanceof Error&&(r=t.message),new Error(r)}finally{n.isExecuting=!1}})()}keysend(e){var n=this;return(0,y.A)(function*(){if(!n.isExecuting)try{n.isExecuting=!0;const t=yield n.client.keysend(e);return n.notify("keysend",t),{preimage:t.payment_preimage}}catch(t){let r="Unknown Error";throw t instanceof Error&&(r=t.message),new Error(r)}finally{n.isExecuting=!1}})()}getInfo(){return(0,y.A)(function*(){return{alias:"Alby"}})()}makeInvoice(e){var n=this;return(0,y.A)(function*(){if(!n.isExecuting)try{n.isExecuting=!0;const t=yield n.client.createInvoice({amount:parseInt(e.amount.toString()),description:e.defaultMemo});return n.notify("makeInvoice",t),{paymentRequest:t.payment_request}}catch(t){let r="Unknown Error";throw t instanceof Error&&(r=t.message),new Error(r)}finally{n.isExecuting=!1}})()}openAuthorization(){var e=this;return(0,y.A)(function*(){var n=e;const t=window.outerHeight/2+window.screenY-350,r=window.outerWidth/2+window.screenX-300,o=yield e.auth.generateAuthURL({code_challenge_method:"S256"});return new Promise((a,u)=>{const f=window.open(o,`${document.title} - WebLN enable`,`height=700,width=600,top=${t},left=${r}`);let p=!1;window.addEventListener("message",function(){var b=(0,y.A)(function*(S){const T=S.data;if(T&&"alby:oauth:success"===T.type&&S.origin===`${document.location.protocol}//${document.location.host}`&&!p){p=!0,console.info("Processing OAuth code response");const $=T.payload.code;try{yield n.auth.requestAccessToken($),n.client=new zo(n.auth),f&&f.close(),n.notify("enable"),a({enabled:!0})}catch(D){console.error(D),u({enabled:!1})}}});return function(S){return b.apply(this,arguments)}}())})})()}}},$e=M(9969),En=M(6939),rc=M(6860),ic=M(9888),qo=M(9327),Ho=M(7987);function oc(e,n){if(1&e){const t=i.RV6();i.j41(0,"div",1)(1,"button",2),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.action())}),i.EFF(2),i.k0s()()}if(2&e){const t=i.XpG();i.R7$(2),i.SpI(" ",t.data.action," ")}}const sc=["label"];function ac(e,n){}const lc=Math.pow(2,31)-1;class Ti{constructor(n,t){this._overlayRef=t,this._afterDismissed=new Lt.B,this._afterOpened=new Lt.B,this._onAction=new Lt.B,this._dismissedByAction=!1,this.containerInstance=n,n._onExit.subscribe(()=>this._finishDismiss())}dismiss(){this._afterDismissed.closed||this.containerInstance.exit(),clearTimeout(this._durationTimeoutId)}dismissWithAction(){this._onAction.closed||(this._dismissedByAction=!0,this._onAction.next(),this._onAction.complete(),this.dismiss()),clearTimeout(this._durationTimeoutId)}closeWithAction(){this.dismissWithAction()}_dismissAfter(n){this._durationTimeoutId=setTimeout(()=>this.dismiss(),Math.min(n,lc))}_open(){this._afterOpened.closed||(this._afterOpened.next(),this._afterOpened.complete())}_finishDismiss(){this._overlayRef.dispose(),this._onAction.closed||this._onAction.complete(),this._afterDismissed.next({dismissedByAction:this._dismissedByAction}),this._afterDismissed.complete(),this._dismissedByAction=!1}afterDismissed(){return this._afterDismissed}afterOpened(){return this.containerInstance._onEnter}onAction(){return this._onAction}}const Vo=new i.nKC("MatSnackBarData");class kr{constructor(){this.politeness="assertive",this.announcementMessage="",this.duration=0,this.data=null,this.horizontalPosition="center",this.verticalPosition="bottom"}}let Wo=(()=>{class e{static#t=this.\u0275fac=function(r){return new(r||e)};static#e=this.\u0275dir=i.FsC({type:e,selectors:[["","matSnackBarLabel",""]],hostAttrs:[1,"mat-mdc-snack-bar-label","mdc-snackbar__label"],standalone:!0})}return e})(),Yo=(()=>{class e{static#t=this.\u0275fac=function(r){return new(r||e)};static#e=this.\u0275dir=i.FsC({type:e,selectors:[["","matSnackBarActions",""]],hostAttrs:[1,"mat-mdc-snack-bar-actions","mdc-snackbar__actions"],standalone:!0})}return e})(),Ko=(()=>{class e{static#t=this.\u0275fac=function(r){return new(r||e)};static#e=this.\u0275dir=i.FsC({type:e,selectors:[["","matSnackBarAction",""]],hostAttrs:[1,"mat-mdc-snack-bar-action","mdc-snackbar__action"],standalone:!0})}return e})(),cc=(()=>{class e{constructor(t,r){this.snackBarRef=t,this.data=r}action(){this.snackBarRef.dismissWithAction()}get hasAction(){return!!this.data.action}static#t=this.\u0275fac=function(r){return new(r||e)(i.rXU(Ti),i.rXU(Vo))};static#e=this.\u0275cmp=i.VBU({type:e,selectors:[["simple-snack-bar"]],hostAttrs:[1,"mat-mdc-simple-snack-bar"],exportAs:["matSnackBar"],standalone:!0,features:[i.aNF],decls:3,vars:2,consts:[["matSnackBarLabel",""],["matSnackBarActions",""],["mat-button","","matSnackBarAction","",3,"click"]],template:function(r,o){1&r&&(i.j41(0,"div",0),i.EFF(1),i.k0s(),i.DNE(2,oc,3,1,"div",1)),2&r&&(i.R7$(),i.SpI(" ",o.data.message,"\n"),i.R7$(),i.vxM(o.hasAction?2:-1))},dependencies:[R.$z,Wo,Yo,Ko],styles:[".mat-mdc-simple-snack-bar{display:flex}"],encapsulation:2,changeDetection:0})}return e})();const uc={snackBarState:(0,$e.hZ)("state",[(0,$e.wk)("void, hidden",(0,$e.iF)({transform:"scale(0.8)",opacity:0})),(0,$e.wk)("visible",(0,$e.iF)({transform:"scale(1)",opacity:1})),(0,$e.kY)("* => visible",(0,$e.i0)("150ms cubic-bezier(0, 0, 0.2, 1)")),(0,$e.kY)("* => void, * => hidden",(0,$e.i0)("75ms cubic-bezier(0.4, 0.0, 1, 1)",(0,$e.iF)({opacity:0})))])};let fc=0,Zo=(()=>{class e extends En.lb{constructor(t,r,o,a,u){super(),this._ngZone=t,this._elementRef=r,this._changeDetectorRef=o,this._platform=a,this.snackBarConfig=u,this._document=(0,i.WQX)(m.qQ),this._trackedModals=new Set,this._announceDelay=150,this._destroyed=!1,this._onAnnounce=new Lt.B,this._onExit=new Lt.B,this._onEnter=new Lt.B,this._animationState="void",this._liveElementId="mat-snack-bar-container-live-"+fc++,this.attachDomPortal=f=>{this._assertNotAttached();const p=this._portalOutlet.attachDomPortal(f);return this._afterPortalAttached(),p},this._live="assertive"!==u.politeness||u.announcementMessage?"off"===u.politeness?"off":"polite":"assertive",this._platform.FIREFOX&&("polite"===this._live&&(this._role="status"),"assertive"===this._live&&(this._role="alert"))}attachComponentPortal(t){this._assertNotAttached();const r=this._portalOutlet.attachComponentPortal(t);return this._afterPortalAttached(),r}attachTemplatePortal(t){this._assertNotAttached();const r=this._portalOutlet.attachTemplatePortal(t);return this._afterPortalAttached(),r}onAnimationEnd(t){const{fromState:r,toState:o}=t;if(("void"===o&&"void"!==r||"hidden"===o)&&this._completeExit(),"visible"===o){const a=this._onEnter;this._ngZone.run(()=>{a.next(),a.complete()})}}enter(){this._destroyed||(this._animationState="visible",this._changeDetectorRef.markForCheck(),this._changeDetectorRef.detectChanges(),this._screenReaderAnnounce())}exit(){return this._ngZone.run(()=>{this._animationState="hidden",this._changeDetectorRef.markForCheck(),this._elementRef.nativeElement.setAttribute("mat-exit",""),clearTimeout(this._announceTimeoutId)}),this._onExit}ngOnDestroy(){this._destroyed=!0,this._clearFromModals(),this._completeExit()}_completeExit(){queueMicrotask(()=>{this._onExit.next(),this._onExit.complete()})}_afterPortalAttached(){const t=this._elementRef.nativeElement,r=this.snackBarConfig.panelClass;r&&(Array.isArray(r)?r.forEach(u=>t.classList.add(u)):t.classList.add(r)),this._exposeToModals();const o=this._label.nativeElement,a="mdc-snackbar__label";o.classList.toggle(a,!o.querySelector(`.${a}`))}_exposeToModals(){const t=this._liveElementId,r=this._document.querySelectorAll('body > .cdk-overlay-container [aria-modal="true"]');for(let o=0;o{const r=t.getAttribute("aria-owns");if(r){const o=r.replace(this._liveElementId,"").trim();o.length>0?t.setAttribute("aria-owns",o):t.removeAttribute("aria-owns")}}),this._trackedModals.clear()}_assertNotAttached(){this._portalOutlet.hasAttached()}_screenReaderAnnounce(){this._announceTimeoutId||this._ngZone.runOutsideAngular(()=>{this._announceTimeoutId=setTimeout(()=>{const t=this._elementRef.nativeElement.querySelector("[aria-hidden]"),r=this._elementRef.nativeElement.querySelector("[aria-live]");if(t&&r){let o=null;this._platform.isBrowser&&document.activeElement instanceof HTMLElement&&t.contains(document.activeElement)&&(o=document.activeElement),t.removeAttribute("aria-hidden"),r.appendChild(t),o?.focus(),this._onAnnounce.next(),this._onAnnounce.complete()}},this._announceDelay)})}static#t=this.\u0275fac=function(r){return new(r||e)(i.rXU(i.SKi),i.rXU(i.aKT),i.rXU(i.gRc),i.rXU(rc.OD),i.rXU(kr))};static#e=this.\u0275cmp=i.VBU({type:e,selectors:[["mat-snack-bar-container"]],viewQuery:function(r,o){if(1&r&&(i.GBs(En.I3,7),i.GBs(sc,7)),2&r){let a;i.mGM(a=i.lsd())&&(o._portalOutlet=a.first),i.mGM(a=i.lsd())&&(o._label=a.first)}},hostAttrs:[1,"mdc-snackbar","mat-mdc-snack-bar-container"],hostVars:1,hostBindings:function(r,o){1&r&&i.Kam("@state.done",function(u){return o.onAnimationEnd(u)}),2&r&&i.zvX("@state",o._animationState)},standalone:!0,features:[i.Vt3,i.aNF],decls:6,vars:3,consts:[["label",""],[1,"mdc-snackbar__surface","mat-mdc-snackbar-surface"],[1,"mat-mdc-snack-bar-label"],["aria-hidden","true"],["cdkPortalOutlet",""]],template:function(r,o){1&r&&(i.j41(0,"div",1)(1,"div",2,0)(3,"div",3),i.DNE(4,ac,0,0,"ng-template",4),i.k0s(),i.nrm(5,"div"),i.k0s()()),2&r&&(i.R7$(5),i.BMQ("aria-live",o._live)("role",o._role)("id",o._liveElementId))},dependencies:[En.I3],styles:[".mat-mdc-snack-bar-container{display:flex;align-items:center;justify-content:center;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0);margin:8px}.mat-mdc-snack-bar-handset .mat-mdc-snack-bar-container{width:100vw}.mat-mdc-snackbar-surface{box-shadow:0px 3px 5px -1px rgba(0, 0, 0, 0.2), 0px 6px 10px 0px rgba(0, 0, 0, 0.14), 0px 1px 18px 0px rgba(0, 0, 0, 0.12);display:flex;align-items:center;justify-content:flex-start;box-sizing:border-box;padding-left:0;padding-right:8px}[dir=rtl] .mat-mdc-snackbar-surface{padding-right:0;padding-left:8px}.mat-mdc-snack-bar-container .mat-mdc-snackbar-surface{min-width:344px;max-width:672px}.mat-mdc-snack-bar-handset .mat-mdc-snackbar-surface{width:100%;min-width:0}.cdk-high-contrast-active .mat-mdc-snackbar-surface{outline:solid 1px}.mat-mdc-snack-bar-container .mat-mdc-snackbar-surface{color:var(--mdc-snackbar-supporting-text-color, var(--mat-app-inverse-on-surface));border-radius:var(--mdc-snackbar-container-shape, var(--mat-app-corner-extra-small));background-color:var(--mdc-snackbar-container-color, var(--mat-app-inverse-surface))}.mdc-snackbar__label{width:100%;flex-grow:1;box-sizing:border-box;margin:0;padding:14px 8px 14px 16px}[dir=rtl] .mdc-snackbar__label{padding-left:8px;padding-right:16px}.mat-mdc-snack-bar-container .mdc-snackbar__label{font-family:var(--mdc-snackbar-supporting-text-font, var(--mat-app-body-medium-font));font-size:var(--mdc-snackbar-supporting-text-size, var(--mat-app-body-medium-size));font-weight:var(--mdc-snackbar-supporting-text-weight, var(--mat-app-body-medium-weight));line-height:var(--mdc-snackbar-supporting-text-line-height, var(--mat-app-body-medium-line-height))}.mat-mdc-snack-bar-actions{display:flex;flex-shrink:0;align-items:center;box-sizing:border-box}.mat-mdc-snack-bar-handset,.mat-mdc-snack-bar-container,.mat-mdc-snack-bar-label{flex:1 1 auto}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled){color:var(--mat-snack-bar-button-color, var(--mat-app-inverse-primary));--mat-text-button-state-layer-color:currentColor;--mat-text-button-ripple-color:currentColor}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled) .mat-ripple-element{opacity:.1}"],encapsulation:2,data:{animation:[uc.snackBarState]}})}return e})();const dc=new i.nKC("mat-snack-bar-default-options",{providedIn:"root",factory:function hc(){return new kr}});let Ii=(()=>{class e{get _openedSnackBarRef(){const t=this._parentSnackBar;return t?t._openedSnackBarRef:this._snackBarRefAtThisLevel}set _openedSnackBarRef(t){this._parentSnackBar?this._parentSnackBar._openedSnackBarRef=t:this._snackBarRefAtThisLevel=t}constructor(t,r,o,a,u,f){this._overlay=t,this._live=r,this._injector=o,this._breakpointObserver=a,this._parentSnackBar=u,this._defaultConfig=f,this._snackBarRefAtThisLevel=null,this.simpleSnackBarComponent=cc,this.snackBarContainerComponent=Zo,this.handsetCssClass="mat-mdc-snack-bar-handset"}openFromComponent(t,r){return this._attach(t,r)}openFromTemplate(t,r){return this._attach(t,r)}open(t,r="",o){const a={...this._defaultConfig,...o};return a.data={message:t,action:r},a.announcementMessage===t&&(a.announcementMessage=void 0),this.openFromComponent(this.simpleSnackBarComponent,a)}dismiss(){this._openedSnackBarRef&&this._openedSnackBarRef.dismiss()}ngOnDestroy(){this._snackBarRefAtThisLevel&&this._snackBarRefAtThisLevel.dismiss()}_attachSnackBarContainer(t,r){const a=i.zZn.create({parent:r&&r.viewContainerRef&&r.viewContainerRef.injector||this._injector,providers:[{provide:kr,useValue:r}]}),u=new En.A8(this.snackBarContainerComponent,r.viewContainerRef,a),f=t.attach(u);return f.instance.snackBarConfig=r,f.instance}_attach(t,r){const o={...new kr,...this._defaultConfig,...r},a=this._createOverlay(o),u=this._attachSnackBarContainer(a,o),f=new Ti(u,a);if(t instanceof i.C4Q){const p=new En.VA(t,null,{$implicit:o.data,snackBarRef:f});f.instance=u.attachTemplatePortal(p)}else{const p=this._createInjector(o,f),b=new En.A8(t,void 0,p),S=u.attachComponentPortal(b);f.instance=S.instance}return this._breakpointObserver.observe(qo.Rp.HandsetPortrait).pipe((0,jt.Q)(a.detachments())).subscribe(p=>{a.overlayElement.classList.toggle(this.handsetCssClass,p.matches)}),o.announcementMessage&&u._onAnnounce.subscribe(()=>{this._live.announce(o.announcementMessage,o.politeness)}),this._animateSnackBar(f,o),this._openedSnackBarRef=f,this._openedSnackBarRef}_animateSnackBar(t,r){t.afterDismissed().subscribe(()=>{this._openedSnackBarRef==t&&(this._openedSnackBarRef=null),r.announcementMessage&&this._live.clear()}),this._openedSnackBarRef?(this._openedSnackBarRef.afterDismissed().subscribe(()=>{t.containerInstance.enter()}),this._openedSnackBarRef.dismiss()):t.containerInstance.enter(),r.duration&&r.duration>0&&t.afterOpened().subscribe(()=>t._dismissAfter(r.duration))}_createOverlay(t){const r=new Ho.rR;r.direction=t.direction;let o=this._overlay.position().global();const a="rtl"===t.direction,u="left"===t.horizontalPosition||"start"===t.horizontalPosition&&!a||"end"===t.horizontalPosition&&a,f=!u&&"center"!==t.horizontalPosition;return u?o.left("0"):f?o.right("0"):o.centerHorizontally(),"top"===t.verticalPosition?o.top("0"):o.bottom("0"),r.positionStrategy=o,this._overlay.create(r)}_createInjector(t,r){return i.zZn.create({parent:t&&t.viewContainerRef&&t.viewContainerRef.injector||this._injector,providers:[{provide:Ti,useValue:r},{provide:Vo,useValue:t.data}]})}static#t=this.\u0275fac=function(r){return new(r||e)(i.KVO(Ho.hJ),i.KVO(ic.Ai),i.KVO(i.zZn),i.KVO(qo.QP),i.KVO(e,12),i.KVO(dc))};static#e=this.\u0275prov=i.jDH({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();class mc{constructor(n,t){this._document=t;const r=this._textarea=this._document.createElement("textarea"),o=r.style;o.position="fixed",o.top=o.opacity="0",o.left="-999em",r.setAttribute("aria-hidden","true"),r.value=n,r.readOnly=!0,(this._document.fullscreenElement||this._document.body).appendChild(r)}copy(){const n=this._textarea;let t=!1;try{if(n){const r=this._document.activeElement;n.select(),n.setSelectionRange(0,n.value.length),t=this._document.execCommand("copy"),r&&r.focus()}}catch{}return t}destroy(){const n=this._textarea;n&&(n.remove(),this._textarea=void 0)}}let Xo=(()=>{class e{constructor(t){this._document=t}copy(t){const r=this.beginCopy(t),o=r.copy();return r.destroy(),o}beginCopy(t){return new mc(t,this._document)}static#t=this.\u0275fac=function(r){return new(r||e)(i.KVO(m.qQ))};static#e=this.\u0275prov=i.jDH({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function pc(e,n){if(1&e){const t=i.RV6();i.j41(0,"button",10),i.bIt("click",function(){const o=i.eBV(t).$implicit,a=i.XpG(2);return i.Njj(a.invoiceAmount=o.value)}),i.j41(1,"mat-icon"),i.EFF(2),i.k0s(),i.j41(3,"span"),i.EFF(4),i.k0s()()}if(2&e){const t=n.$implicit;i.R7$(2),i.JRh(t.icon),i.R7$(2),i.JRh(t.label)}}function gc(e,n){if(1&e){const t=i.RV6();i.j41(0,"mat-dialog-content")(1,"div",4),i.DNE(2,pc,5,2,"button",5),i.k0s(),i.nrm(3,"mat-divider"),i.j41(4,"mat-form-field",6)(5,"mat-label"),i.EFF(6,"Zap Amount"),i.k0s(),i.j41(7,"input",7),i.mxI("ngModelChange",function(o){i.eBV(t);const a=i.XpG();return i.DH7(a.invoiceAmount,o)||(a.invoiceAmount=o),i.Njj(o)}),i.k0s()(),i.j41(8,"mat-dialog-actions",8)(9,"button",9),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.generateInvoice())}),i.EFF(10," Generate Invoice "),i.k0s()()()}if(2&e){const t=i.XpG();i.R7$(2),i.Y8G("ngForOf",t.zapButtons),i.R7$(5),i.R50("ngModel",t.invoiceAmount)}}function vc(e,n){if(1&e){const t=i.RV6();i.j41(0,"div",12)(1,"span"),i.EFF(2),i.k0s(),i.nrm(3,"mat-divider")(4,"qrcode",13),i.j41(5,"mat-dialog-actions",14)(6,"button",15),i.bIt("click",function(){i.eBV(t);const o=i.XpG(2);return i.Njj(o.copyInvoice())}),i.nrm(7,"mat-icon",16),i.k0s()()()}if(2&e){const t=i.XpG(2);i.R7$(2),i.SpI("Scan with phone to pay (",t.invoiceAmount," sats)"),i.R7$(2),i.Y8G("qrdata",t.lightningInvoice)("matTooltip","Lightning Invoice")("errorCorrectionLevel","M"),i.R7$(2),i.Y8G("matTooltip","Copy Invoice"),i.R7$(),i.Y8G("svgIcon","heroicons_outline:clipboard-document")}}function yc(e,n){if(1&e&&(i.j41(0,"mat-dialog-content"),i.DNE(1,vc,8,6,"div",11),i.k0s()),2&e){const t=i.XpG();i.R7$(),i.Y8G("ngIf",t.displayQRCode)}}let wc=(()=>{class e{constructor(t,r,o){this.dialogRef=t,this.snackBar=r,this.clipboard=o,this.invoiceAmount="",this.lightningInvoice="",this.displayQRCode=!1,this.zapButtons=[{icon:"thumb_up",label:"50",value:50},{icon:"favorite",label:"100",value:100},{icon:"emoji_emotions",label:"500",value:500},{icon:"star",label:"1k",value:1e3},{icon:"celebration",label:"5k",value:5e3},{icon:"rocket",label:"10k",value:1e4},{icon:"local_fire_department",label:"100k",value:1e5},{icon:"flash_on",label:"500k",value:5e5},{icon:"diamond",label:"1M",value:1e6}]}generateInvoice(){var t=this;return(0,y.A)(function*(){if(!t.invoiceAmount||Number(t.invoiceAmount)<=0)t.openSnackBar("Please enter a valid amount","dismiss");else try{t.nwc=new Er.NostrWebLNProvider({nostrWalletConnectUrl:yield t.loadNWCUrl()}),yield t.nwc.enable();const r=yield t.nwc.makeInvoice({amount:Number(t.invoiceAmount)});t.lightningInvoice=r.paymentRequest,t.showQRCode()}catch(r){console.error("Error generating invoice:",r),t.openSnackBar("Failed to generate invoice","dismiss")}})()}loadNWCUrl(){return(0,y.A)(function*(){try{const t=Er.NostrWebLNProvider.withNewSecret();return yield t.initNWC({name:"Angor Hub"}),t.getNostrWalletConnectUrl()}catch(t){throw console.error("Error initializing NWC:",t),new Error("Failed to initialize NWC provider")}})()}showQRCode(){this.displayQRCode=!this.displayQRCode}copyInvoice(){this.lightningInvoice?(this.clipboard.copy(this.lightningInvoice),this.openSnackBar("Invoice copied","dismiss")):this.openSnackBar("No invoice available to copy","dismiss")}openSnackBar(t,r){this.snackBar.open(t,r,{duration:1300})}closeDialog(){this.dialogRef.close()}static#t=this.\u0275fac=function(r){return new(r||e)(i.rXU(Ce.CP),i.rXU(Ii),i.rXU(Xo))};static#e=this.\u0275cmp=i.VBU({type:e,selectors:[["app-receive-dialog"]],standalone:!0,features:[i.aNF],decls:7,vars:4,consts:[[1,"absolute","right-0","top-0","pr-4","pt-4"],["mat-icon-button","",3,"matDialogClose"],[1,"text-secondary",3,"svgIcon"],[4,"ngIf"],[1,"preset-buttons"],["mat-mini-fab","","color","primary",3,"click",4,"ngFor","ngForOf"],["appearance","outline",1,"sats-input"],["matInput","","placeholder","e.g., 100","type","number",3,"ngModelChange","ngModel"],["align","end"],["mat-raised-button","","color","primary",3,"click"],["mat-mini-fab","","color","primary",3,"click"],["class","qrcode",4,"ngIf"],[1,"qrcode"],[1,"qrcode-image",3,"qrdata","matTooltip","errorCorrectionLevel"],["align","center"],["mat-icon-button","",3,"click","matTooltip"],[3,"svgIcon"]],template:function(r,o){1&r&&(i.j41(0,"div",0)(1,"button",1),i.nrm(2,"mat-icon",2),i.k0s()(),i.j41(3,"h2"),i.EFF(4,"\u26a1 Receive Zap"),i.k0s(),i.DNE(5,gc,11,2,"mat-dialog-content",3)(6,yc,2,1,"mat-dialog-content",3)),2&r&&(i.R7$(),i.Y8G("matDialogClose",void 0),i.R7$(),i.Y8G("svgIcon","heroicons_outline:x-mark"),i.R7$(3),i.Y8G("ngIf",!o.displayQRCode),i.R7$(),i.Y8G("ngIf",o.displayQRCode))},dependencies:[mn.vg,R.Hl,R.$z,R.iY,R.$0,tt.m_,tt.An,C.YN,C.me,C.Q0,C.BC,C.vS,j.nJ,j.rl,C.X1,m.MD,m.Sq,m.bT,dn.Ve,j.RG,at.fS,at.fg,Ce.Yi,Ce.E7,it,ot,B.q,O.oV,Ce.tx],styles:[".preset-buttons[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,1fr);gap:15px;justify-items:center;margin-bottom:20px}.preset-buttons[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{font-size:14px;font-weight:700;width:70px;height:60px;display:flex;flex-direction:column;align-items:center;justify-content:center;max-height:60px!important}.sats-input[_ngcontent-%COMP%]{margin-top:20px;width:100%}.lightning-buttons[_ngcontent-%COMP%]{display:flex;justify-content:space-evenly;margin:10px 0}.qrcode[_ngcontent-%COMP%]{text-align:center}.qrcode-image[_ngcontent-%COMP%]{width:100%!important}"]})}return e})();for(var Jo=M(1146),bc=M(3838),We=M(917),Qo={bech32:"bc",pubKeyHash:0,scriptHash:5,validWitnessVersions:[0]},ts={bech32:"tb",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},es={bech32:"tbs",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},ns={bech32:"bcrt",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},rs={bech32:"sb",pubKeyHash:63,scriptHash:123,validWitnessVersions:[0]},Wn=["option_data_loss_protect","initial_routing_sync","option_upfront_shutdown_script","gossip_queries","var_onion_optin","gossip_queries_ex","option_static_remotekey","payment_secret","basic_mpp","option_support_large_channel"],_c={m:new We.BN(1e3,10),u:new We.BN(1e6,10),n:new We.BN(1e9,10),p:new We.BN(1e12,10)},xc=new We.BN("2100000000000000000",10),is=new We.BN(1e11,10),Ri={payment_hash:1,payment_secret:16,description:13,payee:19,description_hash:23,expiry:6,min_final_cltv_expiry:24,fallback_address:9,route_hint:3,feature_bits:5,metadata:27},os={},Mr=0,Bi=Object.keys(Ri);Mr0;)t=f.slice(0,33).toString("hex"),r=f.slice(33,41).toString("hex"),o=parseInt(f.slice(41,45).toString("hex"),16),a=parseInt(f.slice(45,49).toString("hex"),16),u=parseInt(f.slice(49,51).toString("hex"),16),f=f.slice(51),n.push({pubkey:t,short_channel_id:r,fee_base_msat:o,fee_proportional_millionths:a,cltv_expiry_delta:u});return n},5:function Tc(e){for(var n=e.slice().reverse().map(function(o){return[!!(1&o),!!(2&o),!!(4&o),!!(8&o),!!(16&o)]}).reduce(function(o,a){return o.concat(a)},[]);n.length<2*Wn.length;)n.push(!1);var t={extra_bits:{}};if(Wn.forEach(function(o,a){var u;n[2*a]?u="required":n[2*a+1]&&(u="supported"),t[o]=u}),n.length>2*Wn.length){var r=n.slice(2*Wn.length);t.extra_bits={start_bit:2*Wn.length,bits:r,required:r.reduce(function(o,a,u){return u%2!=0?o||!1:o||a},!1)}}return t}};function Sc(e){return function(n){return{tagCode:parseInt(e),words:Jo.encode("unknown",n,Number.MAX_SAFE_INTEGER)}}}function Sr(e){return e.reverse().reduce(function(n,t,r){return n+t*Math.pow(32,r)},0)}function nn(e,n){var t=bc.hp.from(function Cc(e,n,t){for(var r=0,o=0,a=(1<=t;)u.push(r>>(o-=t)&a);return o>0&&u.push(r<{class e{constructor(t){this.http=t}getLightning(t){return this.http.get(t).pipe((0,Ni.W)(r=>(console.error("Failed to fetch Lightning response:",r),(0,k.of)({status:"Failed"}))))}getLightningInvoice(t,r){return this.http.get(`${t}?amount=${r}`).pipe((0,Ni.W)(a=>(console.error("Failed to fetch Lightning invoice:",a),(0,k.of)({pr:"",status:"Failed"}))))}getLightningAddress(t){try{const[r,o]=t.split("@");return`https://${o}/.well-known/lnurlp/${r}`}catch{return console.error("Invalid Lightning address format:",t),""}}sendZapRequest(t,r,o,a){const u=encodeURIComponent(JSON.stringify(r));return this.http.get(`${t}?amount=${o}&nostr=${u}&lnurl=${a}`).pipe((0,Ni.W)(p=>(console.error("Failed to send zap request:",p),(0,k.of)({pr:"",status:"Failed"}))))}login(){return(0,y.A)(function*(){try{return window.webln&&!window.webln.isEnabled()&&(yield window.webln.enable()),!0}catch(t){return console.error("WebLN login failed:",t),!1}})()}hasWebln(){return!!window.webln}sendPayment(t){var r=this;return(0,y.A)(function*(){try{return r.hasWebln()?yield window.webln.sendPayment(t):(console.error("WebLN is not available"),null)}catch(o){throw console.error("Payment failed:",o),o}})()}payInvoice(t){var r=this;return(0,y.A)(function*(){if((yield r.login())&&r.hasWebln())try{return!!(yield r.sendPayment(t))}catch(a){return console.error("Failed to pay invoice:",a),!1}return console.error("WebLN not available or login failed"),!1})()}static#t=this.\u0275fac=function(r){return new(r||e)(i.KVO(Bc.Qq))};static#e=this.\u0275prov=i.jDH({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function Nc(e,n){if(1&e){const t=i.RV6();i.j41(0,"button",10),i.bIt("click",function(){const o=i.eBV(t).$implicit,a=i.XpG(2);return i.Njj(a.sats=o.value)}),i.j41(1,"mat-icon"),i.EFF(2),i.k0s(),i.j41(3,"span"),i.EFF(4),i.k0s()()}if(2&e){const t=n.$implicit;i.R7$(2),i.JRh(t.icon),i.R7$(2),i.JRh(t.label)}}function Pc(e,n){if(1&e){const t=i.RV6();i.j41(0,"mat-dialog-content")(1,"div",4),i.DNE(2,Nc,5,2,"button",5),i.k0s(),i.nrm(3,"mat-divider"),i.j41(4,"mat-form-field",6)(5,"mat-label"),i.EFF(6,"Zap Amount"),i.k0s(),i.j41(7,"input",7),i.mxI("ngModelChange",function(o){i.eBV(t);const a=i.XpG();return i.DH7(a.sats,o)||(a.sats=o),i.Njj(o)}),i.k0s()(),i.j41(8,"mat-dialog-actions",8)(9,"button",9),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.sendZap())}),i.EFF(10," Create invoice "),i.k0s()()()}if(2&e){const t=i.XpG();i.R7$(2),i.Y8G("ngForOf",t.zapButtons),i.R7$(5),i.R50("ngModel",t.sats)}}function Lc(e,n){if(1&e&&(i.j41(0,"div",16)(1,"span"),i.EFF(2),i.k0s(),i.nrm(3,"mat-divider")(4,"qrcode",17),i.k0s()),2&e){const t=i.XpG(2);i.R7$(2),i.SpI("Scan with phone to pay (",t.invoiceAmount," sats)"),i.R7$(2),i.Y8G("qrdata",t.lightningInvoice)("matTooltip","Lightning Invoice")("errorCorrectionLevel","M")}}function Uc(e,n){if(1&e){const t=i.RV6();i.j41(0,"mat-dialog-content"),i.DNE(1,Lc,5,4,"div",11),i.j41(2,"mat-dialog-actions",12)(3,"button",13),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.copyInvoice())}),i.nrm(4,"mat-icon",14),i.k0s(),i.j41(5,"button",13),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.payInvoice())}),i.nrm(6,"mat-icon",15),i.k0s()()()}if(2&e){const t=i.XpG();i.R7$(),i.Y8G("ngIf",t.displayQRCode),i.R7$(2),i.Y8G("matTooltip","Copy Invoice"),i.R7$(),i.Y8G("svgIcon","heroicons_outline:clipboard-document"),i.R7$(),i.Y8G("matTooltip","Pay Invoice"),i.R7$(),i.Y8G("svgIcon","feather:zap")}}let jc=(()=>{class e{constructor(t,r,o,a,u){this.dialogRef=t,this.metadata=r,this.lightning=o,this.snackBar=a,this.clipboard=u,this.lightningInvoice="",this.showInvoiceSection=!1,this.displayQRCode=!1,this.invoiceAmount="?",this.zapButtons=[{icon:"thumb_up",label:"50",value:50},{icon:"favorite",label:"100",value:100},{icon:"emoji_emotions",label:"500",value:500},{icon:"star",label:"1k",value:1e3},{icon:"celebration",label:"5k",value:5e3},{icon:"rocket",label:"10k",value:1e4},{icon:"local_fire_department",label:"100k",value:1e5},{icon:"flash_on",label:"500k",value:5e5},{icon:"diamond",label:"1M",value:1e6}],this.getLightningInfo()}getLightningInfo(){let t="";if(this.metadata?.lud06){const{words:r}=V.I.decode(this.metadata.lud06,5e3),o=new Uint8Array(V.I.fromWords(r));t=(new TextDecoder).decode(Uint8Array.from(o))}else if(this.metadata?.lud16?.toLowerCase().startsWith("lnurl")){const{words:r}=V.I.decode(this.metadata.lud16,5e3),o=new Uint8Array(V.I.fromWords(r));t=(new TextDecoder).decode(Uint8Array.from(o))}else this.metadata?.lud16&&(t=this.lightning.getLightningAddress(this.metadata.lud16));""!==t?this.lightning.getLightning(t).subscribe(r=>{this.lightningResponse=r,"Failed"===this.lightningResponse.status?this.openSnackBar("Failed to lookup lightning address","dismiss"):this.lightningResponse.callback?this.showInvoiceSection=!0:this.openSnackBar("Couldn't find user's lightning address","dismiss")}):this.openSnackBar("No lightning address found","dismiss")}getLightningInvoice(t){var r=this;this.lightningResponse&&this.lightningResponse.callback&&this.lightning.getLightningInvoice(this.lightningResponse.callback,t).subscribe(function(){var o=(0,y.A)(function*(a){r.lightningInvoice=a.pr,r.setInvoiceAmount(r.lightningInvoice),r.showInvoiceSection=!0,r.showQRCode()});return function(a){return o.apply(this,arguments)}}())}setInvoiceAmount(t){if(t){const o=function Rc(e,n){if("string"!=typeof e)throw new Error("Lightning Payment Request must be string");if("ln"!==e.slice(0,2).toLowerCase())throw new Error("Not a proper lightning payment request");var t=[],r=Jo.decode(e,Number.MAX_SAFE_INTEGER);e=e.toLowerCase();var o=r.prefix,a=r.words,u=e.slice(o.length+1),f=a.slice(-104);a=a.slice(0,-104);var p=o.match(/^ln(\S+?)(\d*)([a-zA-Z]?)$/);if(p&&!p[2]&&(p=o.match(/^ln(\S+)$/)),!p)throw new Error("Not a proper lightning payment request");t.push({name:"lightning_network",letters:"ln"});var S,b=p[1];if(n){if(void 0===n.bech32||void 0===n.pubKeyHash||void 0===n.scriptHash||!Array.isArray(n.validWitnessVersions))throw new Error("Invalid network");S=n}else switch(b){case Qo.bech32:S=Qo;break;case ts.bech32:S=ts;break;case es.bech32:S=es;break;case ns.bech32:S=ns;break;case rs.bech32:S=rs}if(!S||S.bech32!==b)throw new Error("Unknown coin bech32 prefix");t.push({name:"coin_network",letters:b,value:S});var $,T=p[2];T?($=function Ic(e,n){var t,r;if(e.slice(-1).match(/^[munp]$/))t=e.slice(-1),r=e.slice(0,-1);else{if(e.slice(-1).match(/^[^munp0-9]$/))throw new Error("Not a valid multiplier for the amount");r=e}if(!r.match(/^\d+$/))throw new Error("Not a valid human readable amount");var o=new We.BN(r,10),a=t?o.mul(is).div(_c[t]):o.mul(is);if("p"===t&&!o.mod(new We.BN(10,10)).eq(new We.BN(0,10))||a.gt(xc))throw new Error("Amount is outside of valid range");return n?a.toString():a}(T+p[3],!0),t.push({name:"amount",letters:p[2]+p[3],value:$})):$=null,t.push({name:"separator",letters:"1"});var P,F,z,W,U=Sr(a.slice(0,7));for(a=a.slice(7),t.push({name:"timestamp",letters:u.slice(0,7),value:U}),u=u.slice(7);a.length>0;){var J=a[0].toString();P=os[J]||"unknown_tag",F=Mc[J]||Sc(J),z=Sr((a=a.slice(1)).slice(0,2)),W=(a=a.slice(2)).slice(0,z),a=a.slice(z),t.push({name:P,tag:u[0],letters:u.slice(0,3+z),value:F(W)}),u=u.slice(3+z)}t.push({name:"signature",letters:u.slice(0,104),value:nn(f,!0)}),u=u.slice(104),t.push({name:"checksum",letters:u});var Y={paymentRequest:e,sections:t,get expiry(){var et=t.find(function(Q){return"expiry"===Q.name});if(et)return Z("timestamp")+et.value},get route_hints(){return t.filter(function(et){return"route_hint"===et.name}).map(function(et){return et.value})}},rt=function(et){if("route_hint"===et)return"continue";Object.defineProperty(Y,et,{get:function(){return Z(et)}})};for(var q in Ri)rt(q);return Y;function Z(et){var Q=t.find(function(yt){return yt.name===et});return Q?Q.value:void 0}}(t).sections.find(a=>"amount"===a.name);o&&(this.invoiceAmount=String(Number(o.value)/1e3))}}showQRCode(){this.displayQRCode=!this.displayQRCode}sendZap(){this.getLightningInvoice(String(1e3*Number(this.sats)))}payInvoice(){var t=this;return(0,y.A)(function*(){if(!t.lightningInvoice)return void console.error("Lightning invoice is not set");const r=new Er.NostrWebLNProvider({nostrWalletConnectUrl:yield t.loadNWCUrl()});r.enable().then(()=>r.sendPayment(t.lightningInvoice)).then(o=>{o&&o.preimage?(console.log(`Payment successful, preimage: ${o.preimage}`),t.openSnackBar("Zapped!","dismiss"),t.dialogRef.close()):t.listenForPaymentStatus(r)}).catch(o=>{console.error("Payment failed:",o),t.openSnackBar("Failed to pay invoice","dismiss"),t.listenForPaymentStatus(r)})})()}loadNWCUrl(){const t=Er.NostrWebLNProvider.withNewSecret();return t.initNWC({name:"Angor Hub"}).then(()=>t.getNostrWalletConnectUrl()).catch(r=>{throw console.error("Error initializing NWC:",r),r})}listenForPaymentStatus(t){const r=()=>{t.sendPayment(this.lightningInvoice).then(o=>{o&&o.preimage?(console.log("Payment confirmed, preimage:",o.preimage),this.openSnackBar("Payment confirmed!","dismiss"),this.dialogRef.close()):setTimeout(r,5e3)}).catch(o=>{console.error("Error checking payment status:",o),setTimeout(r,5e3)})};r()}copyInvoice(){this.lightningInvoice?(this.clipboard.copy(this.lightningInvoice),this.openSnackBar("Invoice copied","dismiss")):this.openSnackBar("No invoice available to copy","dismiss")}openSnackBar(t,r){this.snackBar.open(t,r,{duration:1300})}closeDialog(){this.dialogRef.close()}static#t=this.\u0275fac=function(r){return new(r||e)(i.rXU(Ce.CP),i.rXU(Ce.Vh),i.rXU(ss),i.rXU(Ii),i.rXU(Xo))};static#e=this.\u0275cmp=i.VBU({type:e,selectors:[["app-send-dialog"]],standalone:!0,features:[i.aNF],decls:7,vars:4,consts:[[1,"absolute","right-0","top-0","pr-4","pt-4"],["mat-icon-button","",3,"matDialogClose"],[1,"text-secondary",3,"svgIcon"],[4,"ngIf"],[1,"preset-buttons"],["mat-mini-fab","","color","primary",3,"click",4,"ngFor","ngForOf"],["appearance","outline",1,"sats-input"],["matInput","","placeholder","e.g., 100","type","number",3,"ngModelChange","ngModel"],["align","end"],["mat-raised-button","","color","primary",3,"click"],["mat-mini-fab","","color","primary",3,"click"],["class","qrcode",4,"ngIf"],["align","center"],["mat-icon-button","",3,"click","matTooltip"],[3,"svgIcon"],["color","#f79318",3,"svgIcon"],[1,"qrcode"],[1,"qrcode-image",3,"qrdata","matTooltip","errorCorrectionLevel"]],template:function(r,o){1&r&&(i.j41(0,"div",0)(1,"button",1),i.nrm(2,"mat-icon",2),i.k0s()(),i.j41(3,"h1"),i.EFF(4,"\u26a1 Send Zap"),i.k0s(),i.DNE(5,Pc,11,2,"mat-dialog-content",3)(6,Uc,7,5,"mat-dialog-content",3)),2&r&&(i.R7$(),i.Y8G("matDialogClose",void 0),i.R7$(),i.Y8G("svgIcon","heroicons_outline:x-mark"),i.R7$(3),i.Y8G("ngIf",!o.showInvoiceSection||!o.lightningInvoice),i.R7$(),i.Y8G("ngIf",o.showInvoiceSection&&o.lightningInvoice))},dependencies:[mn.vg,R.Hl,R.$z,R.iY,R.$0,tt.m_,tt.An,C.YN,C.me,C.Q0,C.BC,C.vS,j.nJ,j.rl,C.X1,m.MD,m.Sq,m.bT,dn.Ve,j.RG,at.fS,at.fg,Ce.Yi,Ce.E7,it,ot,B.q,O.oV,Ce.tx],styles:[".preset-buttons[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,1fr);gap:15px;justify-items:center;margin-bottom:20px}.preset-buttons[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{font-size:14px;font-weight:700;width:70px;height:60px;display:flex;flex-direction:column;align-items:center;justify-content:center;max-height:60px!important}.sats-input[_ngcontent-%COMP%]{margin-top:20px;width:100%}.lightning-buttons[_ngcontent-%COMP%]{display:flex;justify-content:space-evenly;margin:10px 0}.qrcode[_ngcontent-%COMP%]{text-align:center}.qrcode-image[_ngcontent-%COMP%]{width:100%!important}"]})}return e})();var Dc=M(4224);let Oc=(()=>{class e{constructor(t,r){this.relayService=t,this.signerService=r,this.followersSubject=new Lt.B,this.followingSubject=new Lt.B}getFollowersObservable(){return this.followersSubject.asObservable()}getFollowingObservable(){return this.followingSubject.asObservable()}getFollowers(t){var r=this;return(0,y.A)(function*(){yield r.relayService.ensureConnectedRelays();const o=r.relayService.getPool(),a=r.relayService.getConnectedRelays();if(0===a.length)throw new Error("No connected relays");const u=[{kinds:[3],"#p":[t]}],f=[];return new Promise(p=>{const b=o.subscribeMany(a,u,{onevent:S=>{f.push(S),r.followersSubject.next(S)},oneose(){b.close(),p(f)}})})})()}getFollowing(t){var r=this;return(0,y.A)(function*(){yield r.relayService.ensureConnectedRelays();const o=r.relayService.getPool(),a=r.relayService.getConnectedRelays();if(0===a.length)throw new Error("No connected relays");const u=[{kinds:[3],authors:[t]}],f=[];return new Promise(p=>{const b=o.subscribeMany(a,u,{onevent:S=>{S.tags.filter($=>"p"===$[0]).forEach($=>{f.push($[1]),r.followingSubject.next(S)})},oneose(){b.close(),p(f)}})})})()}follow(t){var r=this;return(0,y.A)(function*(){yield r.relayService.ensureConnectedRelays(),r.relayService.getPool();const a=r.getFollowingList();if(a.includes(t))return void console.log(`Already following ${t}`);const u=[...a,t];r.setFollowingList(u);const f=r.signerService.getUnsignedEvent(3,u.map(S=>["p",S]),"");let b;if(yield r.signerService.isUsingExtension())b=yield r.signerService.signEventWithExtension(f);else{const S=yield r.signerService.getDecryptedSecretKey();if(!S)throw new Error("Secret key is missing. Unable to follow.");b=r.signerService.getSignedEvent(f,S)}r.relayService.publishEventToRelays(b),console.log(`Now following ${t}`)})()}unfollow(t){var r=this;return(0,y.A)(function*(){yield r.relayService.ensureConnectedRelays();const o=r.getFollowingList();if(!o.includes(t))return void console.log(`Not following ${t}`);const a=o.filter(b=>b!==t);r.setFollowingList(a);const u=r.signerService.getUnsignedEvent(3,a.map(b=>["p",b]),"");let p;if(yield r.signerService.isUsingExtension())p=yield r.signerService.signEventWithExtension(u);else{const b=yield r.signerService.getDecryptedSecretKey();if(!b)throw new Error("Secret key is missing. Unable to unfollow.");p=r.signerService.getSignedEvent(u,b)}r.relayService.publishEventToRelays(p),console.log(`Unfollowed ${t}`)})()}getFollowingListAsTags(){const t=this.getFollowingList(),r=[],o=this.relayService.getConnectedRelays();return t.forEach(a=>{o.forEach(u=>{r.push(["p",a,u,localStorage.getItem(`${a}`)||""])})}),r}setFollowingListFromTags(t){const r=[];t.forEach(o=>{r.push(o[1])}),this.setFollowingList(r)}setFollowingList(t){const o=Array.from(new Set(t)).filter(a=>a).join(",");localStorage.setItem("following",o)}getFollowingList(){const t=localStorage.getItem("following");return null===t||""===t?[]:t.split(",").filter(o=>/[a-f0-9]{64}/.test(o))}static#t=this.\u0275fac=function(r){return new(r||e)(i.KVO(Vt.b),i.KVO(Gt.A))};static#e=this.\u0275prov=i.jDH({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var Fc=M(881),$c=M(9979);const Gc=["eventInput"],zc=["commentInput"],as=()=>["/explore"],qc=e=>[e],Hc=()=>["./"],Vc=e=>({"mt-8":e}),ls=()=>[0,1,2,3],Wc=e=>["/profile",e],Yc=e=>({"heart-beat":e}),Kc=e=>({"rotate-180":e});function Zc(e,n){if(1&e&&(i.qex(0),i.nrm(1,"img",53),i.bVm()),2&e){const t=i.XpG();i.R7$(),i.FS9("alt",(null==t.metadata?null:t.metadata.display_name)||(null==t.metadata?null:t.metadata.name)||""),i.Y8G("src",t.getSafeUrl(null==t.metadata?null:t.metadata.picture),i.B4B)}}function Xc(e,n){if(1&e&&i.nrm(0,"img",54),2&e){const t=i.XpG();i.FS9("alt",(null==t.metadata?null:t.metadata.display_name)||(null==t.metadata?null:t.metadata.name)||"")}}function Jc(e,n){if(1&e){const t=i.RV6();i.j41(0,"div")(1,"button",55),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.toggleFollow())}),i.nrm(2,"mat-icon",56),i.k0s()()}if(2&e){const t=i.XpG();i.R7$(),i.Y8G("matTooltip",t.isFollowing?"Unfollow":"Follow"),i.R7$(),i.Y8G("svgIcon",t.isFollowing?"heroicons_outline:user-minus":"heroicons_outline:user-plus")}}function Qc(e,n){if(1&e){const t=i.RV6();i.j41(0,"button",57),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.zap())}),i.j41(1,"span",41),i.nrm(2,"mat-icon",58),i.j41(3,"span"),i.EFF(4,"Send Zap"),i.k0s()()()}2&e&&(i.R7$(2),i.Y8G("svgIcon","feather:zap"))}function tu(e,n){if(1&e){const t=i.RV6();i.j41(0,"button",57),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.openReceiveZapDialog())}),i.j41(1,"span",41),i.nrm(2,"mat-icon",58),i.j41(3,"span"),i.EFF(4,"Receive Zap"),i.k0s()()()}2&e&&(i.R7$(2),i.Y8G("svgIcon","heroicons_outline:qr-code"))}function eu(e,n){1&e&&(i.j41(0,"button",59)(1,"span",41),i.nrm(2,"mat-icon",58),i.j41(3,"span"),i.EFF(4,"Edit your profile"),i.k0s()()()),2&e&&(i.Y8G("routerLink","/settings/profile"),i.R7$(2),i.Y8G("svgIcon","heroicons_outline:pencil-square"))}function nu(e,n){1&e&&(i.j41(0,"button",39)(1,"span",41),i.nrm(2,"mat-icon",58),i.j41(3,"span"),i.EFF(4,"Report"),i.k0s()()()),2&e&&(i.R7$(2),i.Y8G("svgIcon","heroicons_solid:exclamation-triangle"))}function ru(e,n){1&e&&(i.j41(0,"button",39)(1,"span",41),i.nrm(2,"mat-icon",58),i.j41(3,"span"),i.EFF(4,"Turn on notifications"),i.k0s()()()),2&e&&(i.R7$(2),i.Y8G("svgIcon","heroicons_solid:bell"))}function iu(e,n){if(1&e&&(i.j41(0,"angor-card",60)(1,"div",37),i.EFF(2,"About"),i.k0s(),i.j41(3,"div",61),i.EFF(4),i.k0s(),i.j41(5,"a",62),i.EFF(6," See complete about "),i.k0s()()),2&e){const t=i.XpG();i.R7$(4),i.SpI(" ",(null==t.metadata?null:t.metadata.about)||""," "),i.R7$(),i.Y8G("color","primary")("routerLink",i.lJ4(3,Hc))}}function ou(e,n){if(1&e&&i.nrm(0,"img",69),2&e){const t=n.$implicit,r=i.XpG(2).$implicit,o=i.XpG(3);i.Y8G("src",null!=o.suggestions[4*r+t]&&null!=o.suggestions[4*r+t].metadata&&o.suggestions[4*r+t].metadata.picture?o.suggestions[4*r+t].metadata.picture:"images/avatars/avatar-placeholder.png",i.B4B)("alt",null!=o.suggestions[4*r+t]&&null!=o.suggestions[4*r+t].metadata&&o.suggestions[4*r+t].metadata.name?o.suggestions[4*r+t].metadata.name:"image")("matTooltip",null!=o.suggestions[4*r+t]&&null!=o.suggestions[4*r+t].metadata&&o.suggestions[4*r+t].metadata.name?o.suggestions[4*r+t].metadata.name:"")("routerLink",i.eq3(4,Wc,o.suggestions[4*r+t].pubkey))}}function su(e,n){1&e&&(i.qex(0),i.DNE(1,ou,1,6,"img",68),i.bVm()),2&e&&(i.R7$(),i.Y8G("ngForOf",i.lJ4(1,ls)))}function au(e,n){if(1&e&&(i.j41(0,"div",67),i.DNE(1,su,2,2,"ng-container",24),i.k0s()),2&e){const t=n.$implicit,r=i.XpG(3);i.R7$(),i.Y8G("ngIf",r.suggestions.length>4*t)}}function lu(e,n){1&e&&(i.j41(0,"div",65),i.DNE(1,au,2,1,"div",66),i.k0s()),2&e&&(i.R7$(),i.Y8G("ngForOf",i.lJ4(1,ls)))}function cu(e,n){if(1&e&&(i.j41(0,"angor-card",63)(1,"div",36)(2,"div",37),i.EFF(3," Suggestion "),i.k0s(),i.j41(4,"div",38)(5,"button",25),i.nrm(6,"mat-icon",26),i.k0s(),i.j41(7,"mat-menu",null,3)(9,"button",59),i.EFF(10," Explore project "),i.k0s()()()(),i.DNE(11,lu,2,2,"div",64),i.k0s()),2&e){const t=i.sdS(8),r=i.XpG();i.Y8G("ngClass",i.eq3(5,Vc,null==r.metadata?null:r.metadata.about)),i.R7$(5),i.Y8G("matMenuTriggerFor",t),i.R7$(),i.Y8G("svgIcon","heroicons_solid:ellipsis-vertical"),i.R7$(3),i.Y8G("routerLink",i.lJ4(7,as)),i.R7$(2),i.Y8G("ngIf",r.suggestions&&r.suggestions.length>0)}}function uu(e,n){if(1&e){const t=i.RV6();i.j41(0,"div",88)(1,"emoji-mart",89),i.bIt("emojiClick",function(o){i.eBV(t);const a=i.XpG(2);return i.Njj(a.addEmoji(o))}),i.k0s()()}if(2&e){const t=i.XpG(2);i.R7$(),i.Y8G("darkMode",t.darkMode)}}function fu(e,n){if(1&e){const t=i.RV6();i.j41(0,"angor-card",70)(1,"div",71)(2,"div",72),i.EFF(3,"Create Post"),i.k0s(),i.j41(4,"mat-slide-toggle",73),i.bIt("change",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.togglePreview())}),i.EFF(5," Preview "),i.k0s()(),i.j41(6,"div",74)(7,"div",75),i.nrm(8,"img",76),i.j41(9,"div",77),i.EFF(10),i.k0s()(),i.j41(11,"mat-form-field",78),i.nrm(12,"textarea",79,4),i.k0s()(),i.j41(14,"div",80)(15,"div",41)(16,"button",81),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.toggleEmojiPicker())}),i.nrm(17,"mat-icon",26),i.j41(18,"span",82),i.EFF(19,"Feeling"),i.k0s()(),i.DNE(20,uu,2,1,"div",83),i.j41(21,"button",84),i.nrm(22,"mat-icon",26),i.j41(23,"span",82),i.EFF(24,"Media"),i.k0s()(),i.j41(25,"button",84),i.nrm(26,"mat-icon",26),i.j41(27,"span",82),i.EFF(28,"Tag"),i.k0s()(),i.j41(29,"button",85),i.nrm(30,"mat-icon",26),i.k0s(),i.j41(31,"mat-menu",null,5)(33,"button",86)(34,"span",41),i.nrm(35,"mat-icon",58),i.j41(36,"span"),i.EFF(37,"Tag"),i.k0s()()(),i.j41(38,"button",86)(39,"span",41),i.nrm(40,"mat-icon",58),i.j41(41,"span"),i.EFF(42,"Feeling"),i.k0s()()(),i.j41(43,"button",39)(44,"span",41),i.nrm(45,"mat-icon",58),i.j41(46,"span"),i.EFF(47,"Live"),i.k0s()()(),i.j41(48,"button",39)(49,"span",41),i.nrm(50,"mat-icon",58),i.j41(51,"span"),i.EFF(52,"Gif"),i.k0s()()(),i.j41(53,"button",39)(54,"span",41),i.nrm(55,"mat-icon",58),i.j41(56,"span"),i.EFF(57,"Check in"),i.k0s()()()()(),i.j41(58,"button",87),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.sendEvent())}),i.nrm(59,"mat-icon",26),i.j41(60,"span",82),i.EFF(61,"Send"),i.k0s()()()()}if(2&e){const t=i.sdS(32),r=i.XpG();i.R7$(4),i.Y8G("color","primary"),i.R7$(4),i.FS9("alt",(null==r.currentUserMetadata?null:r.currentUserMetadata.display_name)||(null==r.currentUserMetadata?null:r.currentUserMetadata.name)||"Avatar"),i.Y8G("src",(null==r.currentUserMetadata?null:r.currentUserMetadata.picture)||"images/avatars/avatar-placeholder.png",i.B4B),i.R7$(2),i.SpI(" ",(null==r.currentUserMetadata?null:r.currentUserMetadata.name)||"Unknown User"," "),i.R7$(),i.Y8G("subscriptSizing","dynamic"),i.R7$(),i.Y8G("placeholder","What's on your mind?")("rows",3),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:face-smile"),i.R7$(3),i.Y8G("ngIf",r.showEmojiPicker),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:photo"),i.R7$(4),i.Y8G("svgIcon","heroicons_solid:user-circle"),i.R7$(3),i.Y8G("matMenuTriggerFor",t),i.R7$(),i.Y8G("svgIcon","heroicons_solid:ellipsis-horizontal"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:user-circle"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:face-smile"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:play"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:sparkles"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:map-pin"),i.R7$(4),i.Y8G("svgIcon","heroicons_solid:paper-airplane")}}function hu(e,n){if(1&e){const t=i.RV6();i.j41(0,"div",88)(1,"emoji-mart",89),i.bIt("emojiClick",function(o){i.eBV(t);const a=i.XpG(2);return i.Njj(a.addEmojiTocomment(o))}),i.k0s()()}if(2&e){const t=i.XpG(2);i.R7$(),i.Y8G("darkMode",t.darkMode)}}function du(e,n){if(1&e){const t=i.RV6();i.j41(0,"angor-card",90,6)(2,"div",91),i.nrm(3,"img",92),i.j41(4,"div",65)(5,"span",93),i.EFF(6),i.k0s(),i.j41(7,"span",94),i.EFF(8,"1 minutes ago"),i.k0s()(),i.j41(9,"button",95),i.nrm(10,"mat-icon",26),i.k0s(),i.j41(11,"mat-menu",null,7)(13,"button",39)(14,"span",41),i.nrm(15,"mat-icon",58),i.j41(16,"span"),i.EFF(17,"Save post"),i.k0s()()(),i.j41(18,"button",39)(19,"span",41),i.nrm(20,"mat-icon",58),i.j41(21,"span"),i.EFF(22,"Hide post"),i.k0s()()(),i.j41(23,"button",39)(24,"span",41),i.nrm(25,"mat-icon",58),i.j41(26,"span"),i.EFF(27,"Snooze for 30 days"),i.k0s()()(),i.j41(28,"button",39)(29,"span",41),i.nrm(30,"mat-icon",58),i.j41(31,"span"),i.EFF(32,"Hide all"),i.k0s()()(),i.nrm(33,"mat-divider",28),i.j41(34,"button",39)(35,"span",41),i.nrm(36,"mat-icon",58),i.j41(37,"span"),i.EFF(38,"Report post"),i.k0s()()(),i.j41(39,"button",39)(40,"span",41),i.nrm(41,"mat-icon",58),i.j41(42,"span"),i.EFF(43,"Turn on notifications for this post"),i.k0s()()()()(),i.j41(44,"div",96),i.EFF(45),i.k0s(),i.nrm(46,"div",97),i.j41(47,"div",98)(48,"button",81),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.toggleLike())}),i.nrm(49,"mat-icon",99),i.j41(50,"span",82),i.EFF(51),i.k0s()(),i.j41(52,"button",81),i.bIt("click",function(){i.eBV(t);const o=i.sdS(1);return i.Njj(o.expanded=!o.expanded)}),i.nrm(53,"mat-icon",26),i.j41(54,"span",82),i.EFF(55,"Comment"),i.k0s()(),i.j41(56,"button",100),i.nrm(57,"mat-icon",26),i.j41(58,"span",82),i.EFF(59,"Share"),i.k0s()()(),i.nrm(60,"hr",101),i.j41(61,"div",102)(62,"div",41),i.nrm(63,"img",103)(64,"img",104)(65,"img",104)(66,"img",104),i.j41(67,"div",105),i.EFF(68," You and 4 more liked this "),i.k0s()(),i.nrm(69,"div",106),i.j41(70,"div",107)(71,"button",108),i.EFF(72," 0 shares "),i.k0s(),i.j41(73,"button",109),i.bIt("click",function(){i.eBV(t);const o=i.sdS(1);return i.Njj(o.expanded=!o.expanded)}),i.j41(74,"span",110),i.EFF(75,"0 Comments"),i.k0s(),i.nrm(76,"mat-icon",111),i.k0s()()(),i.qex(77,112),i.nrm(78,"hr",113),i.j41(79,"div",114)(80,"div",115),i.nrm(81,"img",116),i.j41(82,"mat-form-field",78),i.nrm(83,"textarea",79,8),i.k0s()(),i.j41(85,"div",117)(86,"div",41)(87,"button",118),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.toggleCommentEmojiPicker())}),i.nrm(88,"mat-icon",26),i.k0s(),i.DNE(89,hu,2,1,"div",83),i.j41(90,"button",119),i.nrm(91,"mat-icon",26),i.k0s(),i.j41(92,"button",119),i.nrm(93,"mat-icon",26),i.k0s()(),i.j41(94,"button",120),i.nrm(95,"mat-icon",26),i.j41(96,"span",82),i.EFF(97,"Send"),i.k0s()()()(),i.bVm(),i.k0s()}if(2&e){const t=i.sdS(1),r=i.sdS(12),o=i.XpG();i.R7$(3),i.FS9("alt",(null==o.currentUserMetadata?null:o.currentUserMetadata.display_name)||(null==o.currentUserMetadata?null:o.currentUserMetadata.name)||"Avatar"),i.Y8G("src",(null==o.currentUserMetadata?null:o.currentUserMetadata.picture)||"images/avatars/avatar-placeholder.png",i.B4B),i.R7$(3),i.JRh((null==o.currentUserMetadata?null:o.currentUserMetadata.display_name)||(null==o.currentUserMetadata?null:o.currentUserMetadata.name)),i.R7$(3),i.Y8G("matMenuTriggerFor",r),i.R7$(),i.Y8G("svgIcon","heroicons_solid:ellipsis-vertical"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:arrow-up-tray"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:eye-slash"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:clock"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:minus-circle"),i.R7$(6),i.Y8G("svgIcon","heroicons_solid:exclamation-triangle"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:bell"),i.R7$(4),i.SpI(" ",o.eventInput.nativeElement.value," "),i.R7$(4),i.Y8G("ngClass",i.eq3(29,Yc,o.isLiked))("svgIcon",o.isLiked?"heroicons_solid:heart":"heroicons_outline:heart"),i.R7$(2),i.JRh(o.isLiked?"Unlike":"Like"),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:chat-bubble-left-ellipsis"),i.R7$(4),i.Y8G("svgIcon","heroicons_solid:share"),i.R7$(19),i.Y8G("ngClass",i.eq3(31,Kc,t.expanded))("svgIcon","heroicons_mini:chevron-down"),i.R7$(5),i.FS9("alt",(null==o.currentUserMetadata?null:o.currentUserMetadata.display_name)||(null==o.currentUserMetadata?null:o.currentUserMetadata.name)||"Avatar"),i.Y8G("src",(null==o.currentUserMetadata?null:o.currentUserMetadata.picture)||"images/avatars/avatar-placeholder.png",i.B4B),i.R7$(),i.Y8G("subscriptSizing","dynamic"),i.R7$(),i.Y8G("placeholder","Write a comment...")("rows",3),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:face-smile"),i.R7$(),i.Y8G("ngIf",o.showCommentEmojiPicker),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:photo"),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:sparkles"),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:paper-airplane")}}const mu=[{path:"",component:(()=>{class e{constructor(t,r,o,a,u,f,p,b,S,T,$,D,U){this._changeDetectorRef=t,this._metadataService=r,this._signerService=o,this._indexedDBService=a,this._sanitizer=u,this._route=f,this._socialService=p,this.snackBar=b,this.lightning=S,this._dialog=T,this._angorConfigService=$,this._angorConfirmationService=D,this.eventService=U,this.darkMode=!1,this.isLoading=!0,this.errorMessage=null,this._unsubscribeAll=new Lt.B,this.followers=[],this.following=[],this.allPublicKeys=[],this.suggestions=[],this.isCurrentUserProfile=!1,this.isFollowing=!1,this.showEmojiPicker=!1,this.showCommentEmojiPicker=!1,this.lightningResponse=null,this.lightningInvoice=null,this.paymentInvoice="",this.invoiceAmount="?",this.isLiked=!1,this.isPreview=!1,this.posts=[],this.likes=[],this.myLikes=[],this.myLikedNoteIds=[],this.isLoadingPosts=!0,this.noEventsMessage="";this.paginator=new v(0,0,12e3)}ngOnInit(){this._angorConfigService.config$.subscribe(t=>{"auto"===t.scheme?this.detectSystemTheme():this.darkMode="dark"===t.scheme}),this._route.paramMap.subscribe(t=>{const r=t.get("pubkey");this.routePubKey=r;const o=this._signerService.getPublicKey();this.currentUserPubKey=o,(r||o)&&(this.isCurrentUserProfile=r===o),this.routePubKey=r||o,this.loadProfile(this.routePubKey),r||(this.isCurrentUserProfile=!0),this.loadCurrentUserProfile()}),this._indexedDBService.getMetadataStream().pipe((0,jt.Q)(this._unsubscribeAll)).subscribe(t=>{t&&t.pubkey===this.currentUserPubKey&&(this.currentUserMetadata=t.metadata,this._changeDetectorRef.detectChanges())}),this.routePubKey&&this._indexedDBService.getMetadataStream().pipe((0,jt.Q)(this._unsubscribeAll)).subscribe(t=>{t&&t.pubkey===this.routePubKey&&(this.metadata=t.metadata,this._changeDetectorRef.detectChanges())}),this._socialService.getFollowersObservable().pipe((0,jt.Q)(this._unsubscribeAll)).subscribe(t=>{this.followers.push(t.pubkey),this._changeDetectorRef.detectChanges()}),this._socialService.getFollowingObservable().pipe((0,jt.Q)(this._unsubscribeAll)).subscribe(t=>{t.tags.filter(o=>"p"===o[0]).forEach(o=>{this.following.push({nostrPubKey:o[1]})}),this._changeDetectorRef.detectChanges()})}ngOnDestroy(){this._unsubscribeAll.next(null),this._unsubscribeAll.complete()}loadProfile(t){var r=this;return(0,y.A)(function*(){if(r.isLoading=!0,r.errorMessage=null,r.metadata=null,r.followers=[],r.following=[],r._changeDetectorRef.detectChanges(),!t)return r.errorMessage="No public key found. Please log in again.",r.isLoading=!1,void r._changeDetectorRef.detectChanges();try{const o=yield r._metadataService.fetchMetadataWithCache(t);o&&(r.metadata=o,r._changeDetectorRef.detectChanges()),r.followers=yield r._socialService.getFollowers(t);const a=r._signerService.getPublicKey();r.isFollowing=r.followers.includes(a),r.following=yield r._socialService.getFollowing(t),r._changeDetectorRef.detectChanges()}catch(o){console.error("Failed to load profile data:",o),r.errorMessage="Failed to load profile data. Please try again later.",r._changeDetectorRef.detectChanges()}finally{r.isLoading=!1,r._changeDetectorRef.detectChanges()}})()}loadCurrentUserProfile(){var t=this;return(0,y.A)(function*(){try{t.currentUserMetadata=null,t.currentUserPubKey=t._signerService.getPublicKey();const r=yield t._metadataService.fetchMetadataWithCache(t.currentUserPubKey);r&&(t.currentUserMetadata=r),t._changeDetectorRef.detectChanges()}catch(r){console.error("Failed to load profile data:",r),t.errorMessage="Failed to load profile data. Please try again later.",t._changeDetectorRef.detectChanges()}finally{t._changeDetectorRef.detectChanges()}})()}getSafeUrl(t){return this._sanitizer.bypassSecurityTrustUrl(t)}toggleFollow(){var t=this;return(0,y.A)(function*(){try{const r=t._signerService.getPublicKey(),o=t.routePubKey||t.currentUserPubKey;if(!o||!r)return void console.error("Public key missing. Unable to toggle follow.");t.isFollowing?(yield t._socialService.unfollow(o),console.log(`Unfollowed ${o}`),t.followers=t.followers.filter(a=>a!==r)):(yield t._socialService.follow(o),console.log(`Followed ${o}`),t.followers.push(r)),t.isFollowing=!t.isFollowing,t._changeDetectorRef.detectChanges()}catch(r){console.error("Failed to toggle follow:",r)}})()}openSnackBar(t,r){this.snackBar.open(t,r,{duration:1300})}getLightningInfo(){let t="";if(this.metadata?.lud06){const{words:r}=V.I.decode(this.metadata.lud06,5e3),o=new Uint8Array(V.I.fromWords(r));t=(new TextDecoder).decode(Uint8Array.from(o))}else if(this.metadata?.lud16?.toLowerCase().startsWith("lnurl")){const{words:r}=V.I.decode(this.metadata.lud16,5e3),o=new Uint8Array(V.I.fromWords(r));t=(new TextDecoder).decode(Uint8Array.from(o))}else this.metadata?.lud16&&(t=this.lightning.getLightningAddress(this.metadata.lud16));""!==t?this.lightning.getLightning(t).subscribe(r=>{this.lightningResponse=r,"Failed"===this.lightningResponse.status?this.openSnackBar("Failed to lookup lightning address","dismiss"):this.lightningResponse.callback?this.openZapDialog():this.openSnackBar("couldn't find user's lightning address","dismiss")}):this.openSnackBar("No lightning address found","dismiss")}zap(){var t=this;return(0,y.A)(function*(){t.metadata&&(t.metadata.lud06||t.metadata.lud16)?t.getLightningInfo():t.openSnackBar("user can't receive zaps","dismiss")})()}openZapDialog(){this._dialog.open(jc,{width:"405px",maxHeight:"90vh",data:this.metadata})}openReceiveZapDialog(){this._dialog.open(wc,{width:"405px",maxHeight:"90vh",data:this.metadata})}toggleLike(){this.isLiked=!this.isLiked,this.isLiked&&setTimeout(()=>{this.isLiked=!1,this.isLiked=!0},300)}addEmoji(t){this.eventInput.nativeElement.value+=t.emoji.native,this.showEmojiPicker=!1}toggleEmojiPicker(){this.showCommentEmojiPicker=!1,this.showEmojiPicker=!this.showEmojiPicker}addEmojiTocomment(t){this.commentInput.nativeElement.value+=t.emoji.native,this.showCommentEmojiPicker=!1}toggleCommentEmojiPicker(){this.showEmojiPicker=!1,this.showCommentEmojiPicker=!this.showCommentEmojiPicker}detectSystemTheme(){const t=window.matchMedia("(prefers-color-scheme: dark)");this.darkMode=t.matches,t.addEventListener("change",r=>{this.darkMode=r.matches})}openConfirmationDialog(){this._angorConfirmationService.open({title:"Share Event",message:'Are you sure you want to share this event on your profile? This action is permanent and cannot be undone.',icon:{show:!0,name:"heroicons_solid:share",color:"primary"},actions:{confirm:{show:!0,label:"Yes, Share",color:"primary"},cancel:{show:!0,label:"Cancel"}},dismissible:!0}).afterClosed().subscribe(r=>{console.log(r)})}togglePreview(){this.isPreview=!this.isPreview}sendEvent(){""!=this.eventInput.nativeElement.value&&this.eventService.sendTextEvent(this.eventInput.nativeElement.value).then(()=>{this._changeDetectorRef.markForCheck()}).catch(t=>{console.error("Failed to send Event:",t)})}static#t=this.\u0275fac=function(r){return new(r||e)(i.rXU(i.gRc),i.rXU(An.T),i.rXU(Gt.A),i.rXU(Dc.n),i.rXU(kt.up),i.rXU(dt.nX),i.rXU(Oc),i.rXU(Ii),i.rXU(ss),i.rXU(Ce.bZ),i.rXU(Fc.P),i.rXU($c.m),i.rXU(Wt))};static#e=this.\u0275cmp=i.VBU({type:e,selectors:[["profile"]],viewQuery:function(r,o){if(1&r&&(i.GBs(Gc,5),i.GBs(zc,5)),2&r){let a;i.mGM(a=i.lsd())&&(o.eventInput=a.first),i.mGM(a=i.lsd())&&(o.commentInput=a.first)}},standalone:!0,features:[i.aNF],decls:72,vars:28,consts:[["defaultAvatar",""],["profileMenu","matMenu"],["listEventMenu","matMenu"],["listCard08Menu","matMenu"],["eventInput",""],["postCardMenu01","matMenu"],["expandableComments","angorCard"],["postCardMenu02","matMenu"],["commentInput",""],[1,"flex","min-w-0","flex-auto","flex-col"],[1,"bg-card","flex","flex-col","shadow"],["onerror","this.onerror=null; this.src='/images/pages/profile/cover.jpg';",1,"h-40","object-cover","lg:h-80",3,"src","alt"],[1,"bg-card","mx-auto","flex","w-full","max-w-5xl","flex-0","flex-col","items-center","px-8","lg:h-18","lg:flex-row"],[1,"-mt-26","flex-shrink-0","rounded-full","lg:-mt-22"],[4,"ngIf","ngIfElse"],[1,"mt-4","flex","flex-grow","flex-col","items-center","lg:ml-8","lg:mt-0","lg:items-start"],[1,"max-w-full","truncate","text-lg","font-bold","leading-tight","lg:max-w-[25rem]",2,"white-space","nowrap","overflow","hidden","text-overflow","ellipsis"],[1,"text-secondary","max-w-full","truncate","leading-tight","lg:max-w-[25rem]",2,"white-space","nowrap","overflow","hidden","text-overflow","ellipsis"],[1,"mx-8","hidden","h-8","flex-shrink-0","border-l-2","lg:flex"],[1,"mt-6","flex","flex-shrink-0","items-center","space-x-6","lg:mt-0"],[1,"flex","flex-col","items-center"],[1,"font-bold"],[1,"text-secondary","text-sm","font-medium"],[1,"mb-4","mt-8","flex","flex-shrink-0","items-center","space-x-6","lg:m-0","lg:ml-auto"],[4,"ngIf"],["mat-icon-button","",3,"matMenuTriggerFor"],[1,"icon-size-5",3,"svgIcon"],["mat-menu-item","",3,"click",4,"ngIf"],[1,"my-2"],["mat-menu-item","",3,"routerLink",4,"ngIf"],["mat-menu-item","",4,"ngIf"],[1,"mx-auto","flex","w-full","max-w-5xl","flex-auto","justify-center","p-6","sm:p-8"],[1,"mr-8","hidden","flex-col","items-start","lg:flex"],["class","flex w-full max-w-80 flex-col p-8",4,"ngIf"],["class","flex w-full max-w-80 flex-col px-8 pb-4 pt-6",3,"ngClass",4,"ngIf"],[1,"mt-8","flex","w-full","max-w-80","flex-col","px-8","pb-4","pt-6"],[1,"flex","items-center","justify-between"],[1,"text-2xl","font-semibold","leading-tight"],[1,"-mr-3"],["mat-menu-item",""],[1,"mt-5","flex","flex-col"],[1,"flex","items-center"],["src","images/cards/coffee-shop-01-320x200.jpg","alt","Card cover image",1,"mr-4","h-14","w-14","rounded","object-cover"],[1,"flex","min-w-0","flex-col"],[1,"font-medium","leading-none"],[1,"mt-1","truncate","text-md","leading-none"],[1,"text-secondary","mt-2","text-md","leading-none"],[1,"-mx-3","mt-6","flex","items-center"],["mat-button","",1,"px-3",3,"color","routerLink"],[1,"flex","w-full","flex-col","items-start"],["class","mb-8 flex w-full flex-col p-6 pb-6 sm:p-8",4,"ngIf"],["class","mb-8 flex w-full flex-col bg-primary-50 dark:bg-primary-800",4,"ngIf"],[1,"mb-8","w-full",3,"pubkeys"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"ring-bg-card","h-32","min-h-32","w-32","min-w-32","max-w-fit","rounded-full","object-cover","ring-4",3,"src","alt"],["src","/images/avatars/avatar-placeholder.png","onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"ring-bg-card","h-32","min-h-32","w-32","min-w-32","rounded-full","object-cover","ring-4",3,"alt"],["mat-icon-button","",3,"click","matTooltip"],[3,"svgIcon"],["mat-menu-item","",3,"click"],[1,"mr-3","icon-size-5",3,"svgIcon"],["mat-menu-item","",3,"routerLink"],[1,"flex","w-full","max-w-80","flex-col","p-8"],[1,"mt-4"],["mat-flat-button","",1,"mt-8","px-6",3,"color","routerLink"],[1,"flex","w-full","max-w-80","flex-col","px-8","pb-4","pt-6",3,"ngClass"],["class","flex flex-col",4,"ngIf"],[1,"flex","flex-col"],["class","mt-6 flex justify-between",4,"ngFor","ngForOf"],[1,"mt-6","flex","justify-between"],["class","h-14 w-14 rounded-full object-cover","onerror","this.onerror=null; this.src='/images/pages/profile/cover.jpg';","role","button",3,"src","alt","matTooltip","routerLink",4,"ngFor","ngForOf"],["onerror","this.onerror=null; this.src='/images/pages/profile/cover.jpg';","role","button",1,"h-14","w-14","rounded-full","object-cover",3,"src","alt","matTooltip","routerLink"],[1,"mb-8","flex","w-full","flex-col","p-6","pb-6","sm:p-8"],[1,"flex","justify-between"],[1,"text-xl","font-semibold"],[1,"-mr-4","ml-auto",3,"change","color"],[1,"mt-8","flex","flex-col","items-start","sm:flex-row"],[1,"mb-6","flex","items-center","sm:mb-0"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"mr-4","h-12","w-12","min-w-12","rounded-full","object-cover",3,"src","alt"],[1,"sm:hidden"],[1,"w-full",3,"subscriptSizing"],["matInput","","cdkTextareaAutosize","",3,"placeholder","rows"],[1,"-mx-3","mt-6","flex","items-center","justify-between","sm:mt-8"],["mat-button","",1,"mr-1","px-3",3,"click"],[1,"ml-2"],["class","emoji-picker-container-global",4,"ngIf"],["mat-button","",1,"mr-1","hidden","px-3","sm:inline-flex"],["mat-button","",1,"px-3",3,"matMenuTriggerFor"],["mat-menu-item","",1,"sm:hidden"],["mat-button","",1,"mr-1","flex","px-3",3,"click"],[1,"emoji-picker-container-global"],[3,"emojiClick","darkMode"],[1,"mb-8","flex","w-full","flex-col","bg-primary-50","dark:bg-primary-800"],[1,"mx-6","mb-4","mt-6","flex","items-center","sm:mx-8"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"mr-4","h-10","w-10","rounded-full",3,"src","alt"],[1,"font-semibold","leading-none"],[1,"text-secondary","mt-1","text-sm","leading-none"],["mat-icon-button","",1,"-mr-4","ml-auto",3,"matMenuTriggerFor"],[1,"mx-6","mb-6","mt-2","sm:mx-8"],[1,"relative","mb-4"],[1,"mx-3","flex","items-center","sm:mx-5"],[1,"text-red-500","icon-size-5",3,"ngClass","svgIcon"],["mat-button","",1,"mr-1","px-3"],[1,"mx-6","mb-6","mt-4","border-b","sm:mx-8"],[1,"mx-6","mb-4","flex","flex-col","sm:mx-8","sm:mb-6","sm:flex-row","sm:items-center"],["src","images/avatars/avatar-placeholder.png","alt","Card cover image",1,"text-card","m-0.5","h-6","w-6","rounded-full","ring-2","ring-white"],["src","images/avatars/avatar-placeholder.png","alt","Card cover image",1,"text-card","m-0.5","-ml-3","h-6","w-6","rounded-full","ring-2","ring-white"],[1,"ml-3","text-md","tracking-tight"],[1,"hidden","flex-auto","sm:flex"],[1,"mt-4","flex","items-center","sm:mt-0"],["mat-button","",1,"-ml-2","mr-1","px-3","sm:ml-0"],["mat-button","",1,"px-3","sm:-mr-4",3,"click"],[1,"mr-1"],[1,"rotate-0","transition-transform","duration-150","ease-in-out","icon-size-5",3,"ngClass","svgIcon"],["angorCardExpansion",""],[1,"m-0","border-b"],[1,"mx-4","mb-3","mt-6","flex","flex-col","sm:mx-8"],[1,"flex","items-start"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"mr-5","h-12","w-12","rounded-full","object-cover",3,"src","alt"],[1,"mt-3","flex","items-center","justify-between"],["mat-icon-button","",3,"click"],["mat-icon-button",""],["mat-button","",1,"mr-1","flex","px-3"]],template:function(r,o){if(1&r&&(i.j41(0,"div",9)(1,"div",10)(2,"div"),i.nrm(3,"img",11),i.k0s(),i.j41(4,"div",12)(5,"div",13),i.DNE(6,Zc,2,2,"ng-container",14)(7,Xc,1,1,"ng-template",null,0,i.C5r),i.k0s(),i.j41(9,"div",15)(10,"div",16),i.EFF(11),i.k0s(),i.j41(12,"div",17),i.EFF(13),i.k0s()(),i.nrm(14,"div",18),i.j41(15,"div",19)(16,"div",20)(17,"span",21),i.EFF(18),i.k0s(),i.j41(19,"span",22),i.EFF(20,"FOLLOWERS"),i.k0s()(),i.j41(21,"div",20)(22,"span",21),i.EFF(23),i.k0s(),i.j41(24,"span",22),i.EFF(25,"FOLLOWING"),i.k0s()()(),i.nrm(26,"div",18),i.j41(27,"div",23),i.DNE(28,Jc,3,2,"div",24),i.j41(29,"div")(30,"button",25),i.nrm(31,"mat-icon",26),i.k0s(),i.j41(32,"mat-menu",null,1),i.DNE(34,Qc,5,1,"button",27)(35,tu,5,1,"button",27),i.nrm(36,"mat-divider",28),i.DNE(37,eu,5,2,"button",29)(38,nu,5,1,"button",30)(39,ru,5,1,"button",30),i.k0s()()()()(),i.j41(40,"div",31)(41,"div",32),i.DNE(42,iu,7,4,"angor-card",33)(43,cu,12,8,"angor-card",34),i.j41(44,"angor-card",35)(45,"div",36)(46,"div",37),i.EFF(47," Last projects "),i.k0s(),i.j41(48,"div",38)(49,"button",25),i.nrm(50,"mat-icon",26),i.k0s(),i.j41(51,"mat-menu",null,2)(53,"button",39),i.EFF(54,"Search for groups"),i.k0s()()()(),i.j41(55,"div",40)(56,"div",41),i.nrm(57,"img",42),i.j41(58,"div",43)(59,"div",44),i.EFF(60," The Port Cafe "),i.k0s(),i.j41(61,"div",45),i.EFF(62," Best cafe of the downtown New York "),i.k0s(),i.j41(63,"div",46),i.EFF(64," 1.2k followers "),i.k0s()()()(),i.j41(65,"div",47)(66,"a",48),i.EFF(67," See all Project "),i.k0s()()()(),i.j41(68,"div",49),i.DNE(69,fu,62,19,"angor-card",50)(70,du,98,33,"angor-card",51),i.nrm(71,"app-event-list",52),i.k0s()()()),2&r){const a=i.sdS(8),u=i.sdS(33),f=i.sdS(52);i.R7$(3),i.FS9("alt",(null==o.metadata?null:o.metadata.display_name)||(null==o.metadata?null:o.metadata.name)||"Banner"),i.Y8G("src",(null==o.metadata?null:o.metadata.banner)||"/images/pages/profile/cover.jpg",i.B4B),i.R7$(3),i.Y8G("ngIf",null==o.metadata?null:o.metadata.picture)("ngIfElse",a),i.R7$(5),i.SpI(" ",(null==o.metadata?null:o.metadata.display_name)||(null==o.metadata?null:o.metadata.name)||"Unknown User"," "),i.R7$(2),i.SpI(" ",(null==o.metadata?null:o.metadata.username)||(null==o.metadata?null:o.metadata.name)," "),i.R7$(5),i.JRh(o.followers.length),i.R7$(5),i.JRh(o.following.length),i.R7$(5),i.Y8G("ngIf",!o.isCurrentUserProfile),i.R7$(2),i.Y8G("matMenuTriggerFor",u),i.R7$(),i.Y8G("svgIcon","heroicons_solid:ellipsis-vertical"),i.R7$(3),i.Y8G("ngIf",!o.isCurrentUserProfile),i.R7$(),i.Y8G("ngIf",o.isCurrentUserProfile),i.R7$(2),i.Y8G("ngIf",o.isCurrentUserProfile),i.R7$(),i.Y8G("ngIf",!o.isCurrentUserProfile),i.R7$(),i.Y8G("ngIf",!o.isCurrentUserProfile),i.R7$(3),i.Y8G("ngIf",(null==o.metadata?null:o.metadata.about)&&""!==o.metadata.about.trim()),i.R7$(),i.Y8G("ngIf",o.suggestions.length>0),i.R7$(6),i.Y8G("matMenuTriggerFor",f),i.R7$(),i.Y8G("svgIcon","heroicons_solid:ellipsis-vertical"),i.R7$(16),i.Y8G("color","primary")("routerLink",i.lJ4(25,as)),i.R7$(3),i.Y8G("ngIf",o.isCurrentUserProfile),i.R7$(),i.Y8G("ngIf",o.isPreview),i.R7$(),i.Y8G("pubkeys",i.eq3(26,qc,o.routePubKey))}},dependencies:[dt.Wk,_.n,tt.m_,tt.An,R.Hl,R.It,R.$z,R.iY,K.Cn,K.kk,K.fb,K.Cp,j.RG,j.rl,at.fS,at.fg,A.xb,A.EE,B.w,B.q,O.uc,O.oV,m.YU,m.MD,m.Sq,m.bT,C.YN,it,G.Ic,L.sG,nt.D6,Cn,me],styles:[".emoji-picker-container-global{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:9999;width:350px;max-width:100%}.heart-beat{animation:heartBeatAnimation .3s ease-in-out}@keyframes heartBeatAnimation{0%{transform:scale(1)}30%{transform:scale(2)}60%{transform:scale(1)}to{transform:scale(1)}}.loading-spinner{display:flex;justify-content:center;align-items:center;margin:20px 0}.loading-spinner .spinner{border:4px solid rgba(0,0,0,.1);border-left-color:#009fb5;border-radius:50%;width:30px;height:30px;animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"],encapsulation:2,changeDetection:0})}return e})()}]},2577:(bt,N,M)=>{const y=M(531),_=M(8715),A=M(465),m=M(5510);function C(R,B,j,tt,at){const K=[].slice.call(arguments,1),nt=K.length,L="function"==typeof K[nt-1];if(!L&&!y())throw new Error("Callback required as last argument");if(!L){if(nt<1)throw new Error("Too few arguments provided");return 1===nt?(j=B,B=tt=void 0):2===nt&&!B.getContext&&(tt=j,j=B,B=void 0),new Promise(function(O,dt){try{const G=_.create(j,tt);O(R(G,B,tt))}catch(G){dt(G)}})}if(nt<2)throw new Error("Too few arguments provided");2===nt?(at=j,j=B,B=tt=void 0):3===nt&&(B.getContext&&typeof at>"u"?(at=tt,tt=void 0):(at=tt,tt=j,j=B,B=void 0));try{const O=_.create(j,tt);at(null,R(O,B,tt))}catch(O){at(O)}}N.mo=C.bind(null,A.render),N.dY=C.bind(null,A.renderToDataURL),N.toString=C.bind(null,function(R,B,j){return m.render(R,j)})},531:bt=>{bt.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},919:(bt,N,M)=>{const E=M(2656).getSymbolSize;N.getRowColCoords=function(_){if(1===_)return[];const A=Math.floor(_/7)+2,m=E(_),C=145===m?26:2*Math.ceil((m-13)/(2*A-2)),R=[m-7];for(let B=1;B{const E=M(838),y=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function _(A){this.mode=E.ALPHANUMERIC,this.data=A}_.getBitsLength=function(m){return 11*Math.floor(m/2)+m%2*6},_.prototype.getLength=function(){return this.data.length},_.prototype.getBitsLength=function(){return _.getBitsLength(this.data.length)},_.prototype.write=function(m){let C;for(C=0;C+2<=this.data.length;C+=2){let R=45*y.indexOf(this.data[C]);R+=y.indexOf(this.data[C+1]),m.put(R,11)}this.data.length%2&&m.put(y.indexOf(this.data[C]),6)},bt.exports=_},4481:bt=>{function N(){this.buffer=[],this.length=0}N.prototype={get:function(M){const E=Math.floor(M/8);return 1==(this.buffer[E]>>>7-M%8&1)},put:function(M,E){for(let y=0;y>>E-y-1&1))},getLengthInBits:function(){return this.length},putBit:function(M){const E=Math.floor(this.length/8);this.buffer.length<=E&&this.buffer.push(0),M&&(this.buffer[E]|=128>>>this.length%8),this.length++}},bt.exports=N},8038:bt=>{function N(M){if(!M||M<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=M,this.data=new Uint8Array(M*M),this.reservedBit=new Uint8Array(M*M)}N.prototype.set=function(M,E,y,_){const A=M*this.size+E;this.data[A]=y,_&&(this.reservedBit[A]=!0)},N.prototype.get=function(M,E){return this.data[M*this.size+E]},N.prototype.xor=function(M,E,y){this.data[M*this.size+E]^=y},N.prototype.isReserved=function(M,E){return this.reservedBit[M*this.size+E]},bt.exports=N},1736:(bt,N,M)=>{const E=M(3174),y=M(838);function _(A){this.mode=y.BYTE,"string"==typeof A&&(A=E(A)),this.data=new Uint8Array(A)}_.getBitsLength=function(m){return 8*m},_.prototype.getLength=function(){return this.data.length},_.prototype.getBitsLength=function(){return _.getBitsLength(this.data.length)},_.prototype.write=function(A){for(let m=0,C=this.data.length;m{const E=M(139),y=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],_=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];N.getBlocksCount=function(m,C){switch(C){case E.L:return y[4*(m-1)+0];case E.M:return y[4*(m-1)+1];case E.Q:return y[4*(m-1)+2];case E.H:return y[4*(m-1)+3];default:return}},N.getTotalCodewordsCount=function(m,C){switch(C){case E.L:return _[4*(m-1)+0];case E.M:return _[4*(m-1)+1];case E.Q:return _[4*(m-1)+2];case E.H:return _[4*(m-1)+3];default:return}}},139:(bt,N)=>{N.L={bit:1},N.M={bit:0},N.Q={bit:3},N.H={bit:2},N.isValid=function(y){return y&&typeof y.bit<"u"&&y.bit>=0&&y.bit<4},N.from=function(y,_){if(N.isValid(y))return y;try{return function M(E){if("string"!=typeof E)throw new Error("Param is not a string");switch(E.toLowerCase()){case"l":case"low":return N.L;case"m":case"medium":return N.M;case"q":case"quartile":return N.Q;case"h":case"high":return N.H;default:throw new Error("Unknown EC Level: "+E)}}(y)}catch{return _}}},9202:(bt,N,M)=>{const E=M(2656).getSymbolSize;N.getPositions=function(A){const m=E(A);return[[0,0],[m-7,0],[0,m-7]]}},9211:(bt,N,M)=>{const E=M(2656),A=E.getBCHDigit(1335);N.getEncodedBits=function(C,R){const B=C.bit<<3|R;let j=B<<10;for(;E.getBCHDigit(j)-A>=0;)j^=1335<{const M=new Uint8Array(512),E=new Uint8Array(256);(function(){let _=1;for(let A=0;A<255;A++)M[A]=_,E[_]=A,_<<=1,256&_&&(_^=285);for(let A=255;A<512;A++)M[A]=M[A-255]})(),N.log=function(_){if(_<1)throw new Error("log("+_+")");return E[_]},N.exp=function(_){return M[_]},N.mul=function(_,A){return 0===_||0===A?0:M[E[_]+E[A]]}},1971:(bt,N,M)=>{const E=M(838),y=M(2656);function _(A){this.mode=E.KANJI,this.data=A}_.getBitsLength=function(m){return 13*m},_.prototype.getLength=function(){return this.data.length},_.prototype.getBitsLength=function(){return _.getBitsLength(this.data.length)},_.prototype.write=function(A){let m;for(m=0;m=33088&&C<=40956)C-=33088;else{if(!(C>=57408&&C<=60351))throw new Error("Invalid SJIS character: "+this.data[m]+"\nMake sure your charset is UTF-8");C-=49472}C=192*(C>>>8&255)+(255&C),A.put(C,13)}},bt.exports=_},9366:(bt,N)=>{N.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};function E(y,_,A){switch(y){case N.Patterns.PATTERN000:return(_+A)%2==0;case N.Patterns.PATTERN001:return _%2==0;case N.Patterns.PATTERN010:return A%3==0;case N.Patterns.PATTERN011:return(_+A)%3==0;case N.Patterns.PATTERN100:return(Math.floor(_/2)+Math.floor(A/3))%2==0;case N.Patterns.PATTERN101:return _*A%2+_*A%3==0;case N.Patterns.PATTERN110:return(_*A%2+_*A%3)%2==0;case N.Patterns.PATTERN111:return(_*A%3+(_+A)%2)%2==0;default:throw new Error("bad maskPattern:"+y)}}N.isValid=function(_){return null!=_&&""!==_&&!isNaN(_)&&_>=0&&_<=7},N.from=function(_){return N.isValid(_)?parseInt(_,10):void 0},N.getPenaltyN1=function(_){const A=_.size;let m=0,C=0,R=0,B=null,j=null;for(let tt=0;tt=5&&(m+=C-5+3),B=K,C=1),K=_.get(at,tt),K===j?R++:(R>=5&&(m+=R-5+3),j=K,R=1)}C>=5&&(m+=C-5+3),R>=5&&(m+=R-5+3)}return m},N.getPenaltyN2=function(_){const A=_.size;let m=0;for(let C=0;C=10&&(1488===C||93===C)&&m++,R=R<<1&2047|_.get(j,B),j>=10&&(1488===R||93===R)&&m++}return 40*m},N.getPenaltyN4=function(_){let A=0;const m=_.data.length;for(let R=0;R{const E=M(1604),y=M(6082);N.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},N.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},N.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},N.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},N.MIXED={bit:-1},N.getCharCountIndicator=function(m,C){if(!m.ccBits)throw new Error("Invalid mode: "+m);if(!E.isValid(C))throw new Error("Invalid version: "+C);return C>=1&&C<10?m.ccBits[0]:C<27?m.ccBits[1]:m.ccBits[2]},N.getBestModeForData=function(m){return y.testNumeric(m)?N.NUMERIC:y.testAlphanumeric(m)?N.ALPHANUMERIC:y.testKanji(m)?N.KANJI:N.BYTE},N.toString=function(m){if(m&&m.id)return m.id;throw new Error("Invalid mode")},N.isValid=function(m){return m&&m.bit&&m.ccBits},N.from=function(m,C){if(N.isValid(m))return m;try{return function _(A){if("string"!=typeof A)throw new Error("Param is not a string");switch(A.toLowerCase()){case"numeric":return N.NUMERIC;case"alphanumeric":return N.ALPHANUMERIC;case"kanji":return N.KANJI;case"byte":return N.BYTE;default:throw new Error("Unknown mode: "+A)}}(m)}catch{return C}}},7035:(bt,N,M)=>{const E=M(838);function y(_){this.mode=E.NUMERIC,this.data=_.toString()}y.getBitsLength=function(A){return 10*Math.floor(A/3)+(A%3?A%3*3+1:0)},y.prototype.getLength=function(){return this.data.length},y.prototype.getBitsLength=function(){return y.getBitsLength(this.data.length)},y.prototype.write=function(A){let m,C,R;for(m=0;m+3<=this.data.length;m+=3)C=this.data.substr(m,3),R=parseInt(C,10),A.put(R,10);const B=this.data.length-m;B>0&&(C=this.data.substr(m),R=parseInt(C,10),A.put(R,3*B+1))},bt.exports=y},7767:(bt,N,M)=>{const E=M(6965);N.mul=function(_,A){const m=new Uint8Array(_.length+A.length-1);for(let C=0;C<_.length;C++)for(let R=0;R=0;){const C=m[0];for(let B=0;B{const E=M(2656),y=M(139),_=M(4481),A=M(8038),m=M(919),C=M(9202),R=M(9366),B=M(2296),j=M(6758),tt=M(8925),at=M(9211),K=M(838),nt=M(7939);function V(ot,it,lt){const ht=ot.size,g=at.getEncodedBits(it,lt);let s,l;for(s=0;s<15;s++)l=1==(g>>s&1),ot.set(s<6?s:s<8?s+1:ht-15+s,8,l,!0),ot.set(8,s<8?ht-s-1:s<9?15-s-1+1:15-s-1,l,!0);ot.set(ht-8,8,1,!0)}function Pt(ot,it,lt,ht){let g;if(Array.isArray(ot))g=nt.fromArray(ot);else{if("string"!=typeof ot)throw new Error("Invalid data");{let v=it;if(!v){const k=nt.rawSplit(ot);v=tt.getBestVersionForData(k,lt)}g=nt.fromString(ot,v||40)}}const s=tt.getBestVersionForData(g,lt);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(it){if(it=0&&h<=6&&(0===d||6===d)||d>=0&&d<=6&&(0===h||6===h)||h>=2&&h<=4&&d>=2&&d<=4,!0)}}(d,it),function O(ot){const it=ot.size;for(let lt=8;lt=7&&function G(ot,it){const lt=ot.size,ht=tt.getEncodedBits(it);let g,s,l;for(let h=0;h<18;h++)g=Math.floor(h/3),s=h%3+lt-8-3,l=1==(ht>>h&1),ot.set(g,s,l,!0),ot.set(s,g,l,!0)}(d,it),function i(ot,it){const lt=ot.size;let ht=-1,g=lt-1,s=7,l=0;for(let h=lt-1;h>0;h-=2)for(6===h&&h--;;){for(let d=0;d<2;d++)if(!ot.isReserved(g,h-d)){let v=!1;l>>s&1)),ot.set(g,h-d,v),s--,-1===s&&(l++,s=7)}if(g+=ht,g<0||lt<=g){g-=ht,ht=-ht;break}}}(d,l),isNaN(ht)&&(ht=R.getBestMask(d,V.bind(null,d,lt))),R.applyMask(ht,d),V(d,lt,ht),{modules:d,version:it,errorCorrectionLevel:lt,maskPattern:ht,segments:g}}N.create=function(it,lt){if(typeof it>"u"||""===it)throw new Error("No input text");let g,s,ht=y.M;return typeof lt<"u"&&(ht=y.from(lt.errorCorrectionLevel,y.M),g=tt.from(lt.version),s=R.from(lt.maskPattern),lt.toSJISFunc&&E.setToSJISFunction(lt.toSJISFunc)),Pt(it,g,ht,s)}},6758:(bt,N,M)=>{const E=M(7767);function y(_){this.genPoly=void 0,this.degree=_,this.degree&&this.initialize(this.degree)}y.prototype.initialize=function(A){this.degree=A,this.genPoly=E.generateECPolynomial(this.degree)},y.prototype.encode=function(A){if(!this.genPoly)throw new Error("Encoder not initialized");const m=new Uint8Array(A.length+this.degree);m.set(A);const C=E.mod(m,this.genPoly),R=this.degree-C.length;if(R>0){const B=new Uint8Array(this.degree);return B.set(C,R),B}return C},bt.exports=y},6082:(bt,N)=>{const M="[0-9]+";let y="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";y=y.replace(/u/g,"\\u");const _="(?:(?![A-Z0-9 $%*+\\-./:]|"+y+")(?:.|[\r\n]))+";N.KANJI=new RegExp(y,"g"),N.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),N.BYTE=new RegExp(_,"g"),N.NUMERIC=new RegExp(M,"g"),N.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const A=new RegExp("^"+y+"$"),m=new RegExp("^"+M+"$"),C=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");N.testKanji=function(B){return A.test(B)},N.testNumeric=function(B){return m.test(B)},N.testAlphanumeric=function(B){return C.test(B)}},7939:(bt,N,M)=>{const E=M(838),y=M(7035),_=M(387),A=M(1736),m=M(1971),C=M(6082),R=M(2656),B=M(243);function j(G){return unescape(encodeURIComponent(G)).length}function tt(G,V,i){const ut=[];let kt;for(;null!==(kt=G.exec(i));)ut.push({data:kt[0],index:kt.index,mode:V,length:kt[0].length});return ut}function at(G){const V=tt(C.NUMERIC,E.NUMERIC,G),i=tt(C.ALPHANUMERIC,E.ALPHANUMERIC,G);let ut,kt;return R.isKanjiModeEnabled()?(ut=tt(C.BYTE,E.BYTE,G),kt=tt(C.KANJI,E.KANJI,G)):(ut=tt(C.BYTE_KANJI,E.BYTE,G),kt=[]),V.concat(i,ut,kt).sort(function(ot,it){return ot.index-it.index}).map(function(ot){return{data:ot.data,mode:ot.mode,length:ot.length}})}function K(G,V){switch(V){case E.NUMERIC:return y.getBitsLength(G);case E.ALPHANUMERIC:return _.getBitsLength(G);case E.KANJI:return m.getBitsLength(G);case E.BYTE:return A.getBitsLength(G)}}function dt(G,V){let i;const ut=E.getBestModeForData(G);if(i=E.from(V,ut),i!==E.BYTE&&i.bit=0?V[V.length-1]:null;return ut&&ut.mode===i.mode?(V[V.length-1].data+=i.data,V):(V.push(i),V)},[])}(it))},N.rawSplit=function(V){return N.fromArray(at(V,R.isKanjiModeEnabled()))}},2656:(bt,N)=>{let M;const E=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];N.getSymbolSize=function(_){if(!_)throw new Error('"version" cannot be null or undefined');if(_<1||_>40)throw new Error('"version" should be in range from 1 to 40');return 4*_+17},N.getSymbolTotalCodewords=function(_){return E[_]},N.getBCHDigit=function(y){let _=0;for(;0!==y;)_++,y>>>=1;return _},N.setToSJISFunction=function(_){if("function"!=typeof _)throw new Error('"toSJISFunc" is not a valid function.');M=_},N.isKanjiModeEnabled=function(){return typeof M<"u"},N.toSJIS=function(_){return M(_)}},1604:(bt,N)=>{N.isValid=function(E){return!isNaN(E)&&E>=1&&E<=40}},8925:(bt,N,M)=>{const E=M(2656),y=M(2296),_=M(139),A=M(838),m=M(1604),R=E.getBCHDigit(7973);function j(K,nt){return A.getCharCountIndicator(K,nt)+4}function tt(K,nt){let L=0;return K.forEach(function(O){const dt=j(O.mode,nt);L+=dt+O.getBitsLength()}),L}N.from=function(nt,L){return m.isValid(nt)?parseInt(nt,10):L},N.getCapacity=function(nt,L,O){if(!m.isValid(nt))throw new Error("Invalid QR Code version");typeof O>"u"&&(O=A.BYTE);const V=8*(E.getSymbolTotalCodewords(nt)-y.getTotalCodewordsCount(nt,L));if(O===A.MIXED)return V;const i=V-j(O,nt);switch(O){case A.NUMERIC:return Math.floor(i/10*3);case A.ALPHANUMERIC:return Math.floor(i/11*2);case A.KANJI:return Math.floor(i/13);default:return Math.floor(i/8)}},N.getBestVersionForData=function(nt,L){let O;const dt=_.from(L,_.M);if(Array.isArray(nt)){if(nt.length>1)return function at(K,nt){for(let L=1;L<=40;L++)if(tt(K,L)<=N.getCapacity(L,nt,A.MIXED))return L}(nt,dt);if(0===nt.length)return 1;O=nt[0]}else O=nt;return function B(K,nt,L){for(let O=1;O<=40;O++)if(nt<=N.getCapacity(O,L,K))return O}(O.mode,O.getLength(),dt)},N.getEncodedBits=function(nt){if(!m.isValid(nt)||nt<7)throw new Error("Invalid QR Code version");let L=nt<<12;for(;E.getBCHDigit(L)-R>=0;)L^=7973<{const E=M(8428);N.render=function(m,C,R){let B=R,j=C;typeof B>"u"&&(!C||!C.getContext)&&(B=C,C=void 0),C||(j=function _(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}()),B=E.getOptions(B);const tt=E.getImageWidth(m.modules.size,B),at=j.getContext("2d"),K=at.createImageData(tt,tt);return E.qrToImageData(K.data,m,B),function y(A,m,C){A.clearRect(0,0,m.width,m.height),m.style||(m.style={}),m.height=C,m.width=C,m.style.height=C+"px",m.style.width=C+"px"}(at,j,tt),at.putImageData(K,0,0),j},N.renderToDataURL=function(m,C,R){let B=R;return typeof B>"u"&&(!C||!C.getContext)&&(B=C,C=void 0),B||(B={}),N.render(m,C,B).toDataURL(B.type||"image/png",(B.rendererOpts||{}).quality)}},5510:(bt,N,M)=>{const E=M(8428);function y(m,C){const R=m.a/255,B=C+'="'+m.hex+'"';return R<1?B+" "+C+'-opacity="'+R.toFixed(2).slice(1)+'"':B}function _(m,C,R){let B=m+C;return typeof R<"u"&&(B+=" "+R),B}N.render=function(C,R,B){const j=E.getOptions(R),tt=C.modules.size,at=C.modules.data,K=tt+2*j.margin,nt=j.color.light.a?"':"",L="0&&nt>0&&m[K-1]||(B+=tt?_("M",nt+R,.5+L+R):_("m",j,0),j=0,tt=!1),nt+1',G=''+nt+L+"\n";return"function"==typeof B&&B(null,G),G}},8428:(bt,N)=>{function M(E){if("number"==typeof E&&(E=E.toString()),"string"!=typeof E)throw new Error("Color should be defined as hex string");let y=E.slice().replace("#","").split("");if(y.length<3||5===y.length||y.length>8)throw new Error("Invalid hex color: "+E);(3===y.length||4===y.length)&&(y=Array.prototype.concat.apply([],y.map(function(A){return[A,A]}))),6===y.length&&y.push("F","F");const _=parseInt(y.join(""),16);return{r:_>>24&255,g:_>>16&255,b:_>>8&255,a:255&_,hex:"#"+y.slice(0,6).join("")}}N.getOptions=function(y){y||(y={}),y.color||(y.color={});const A=y.width&&y.width>=21?y.width:void 0;return{width:A,scale:A?4:y.scale||4,margin:typeof y.margin>"u"||null===y.margin||y.margin<0?4:y.margin,color:{dark:M(y.color.dark||"#000000ff"),light:M(y.color.light||"#ffffffff")},type:y.type,rendererOpts:y.rendererOpts||{}}},N.getScale=function(y,_){return _.width&&_.width>=y+2*_.margin?_.width/(y+2*_.margin):_.scale},N.getImageWidth=function(y,_){const A=N.getScale(y,_);return Math.floor((y+2*_.margin)*A)},N.qrToImageData=function(y,_,A){const m=_.modules.size,C=_.modules.data,R=N.getScale(m,A),B=Math.floor((m+2*A.margin)*R),j=A.margin*R,tt=[A.color.light,A.color.dark];for(let at=0;at=j&&K>=j&&at=65&&l<=70?l-55:l>=97&&l<=102?l-87:l-48&15}function B(g,s,l){var h=R(g,l);return l-1>=s&&(h|=R(g,l-1)<<4),h}function j(g,s,l,h){for(var d=0,v=Math.min(g.length,l),k=s;k=49?I-49+10:I>=17?I-17+10:I}return d}m.isBN=function(s){return s instanceof m||null!==s&&"object"==typeof s&&s.constructor.wordSize===m.wordSize&&Array.isArray(s.words)},m.max=function(s,l){return s.cmp(l)>0?s:l},m.min=function(s,l){return s.cmp(l)<0?s:l},m.prototype._init=function(s,l,h){if("number"==typeof s)return this._initNumber(s,l,h);if("object"==typeof s)return this._initArray(s,l,h);"hex"===l&&(l=16),_(l===(0|l)&&l>=2&&l<=36);var d=0;"-"===(s=s.toString().replace(/\s+/g,""))[0]&&(d++,this.negative=1),d=0;d-=3)this.words[v]|=(k=s[d]|s[d-1]<<8|s[d-2]<<16)<>>26-I&67108863,(I+=24)>=26&&(I-=26,v++);else if("le"===h)for(d=0,v=0;d>>26-I&67108863,(I+=24)>=26&&(I-=26,v++);return this.strip()},m.prototype._parseHex=function(s,l,h){this.length=Math.ceil((s.length-l)/6),this.words=new Array(this.length);for(var d=0;d=l;d-=2)I=B(s,l,d)<=18?(v-=18,this.words[k+=1]|=I>>>26):v+=8;else for(d=(s.length-l)%2==0?l+1:l;d=18?(v-=18,this.words[k+=1]|=I>>>26):v+=8;this.strip()},m.prototype._parseBase=function(s,l,h){this.words=[0],this.length=1;for(var d=0,v=1;v<=67108863;v*=l)d++;d--,v=v/l|0;for(var k=s.length-h,I=k%d,w=Math.min(k,k-I)+h,c=0,x=h;x1&&0===this.words[this.length-1];)this.length--;return this._normSign()},m.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},m.prototype.inspect=function(){return(this.red?""};var tt=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],at=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],K=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function L(g,s,l){l.negative=s.negative^g.negative;var h=g.length+s.length|0;l.length=h,h=h-1|0;var d=0|g.words[0],v=0|s.words[0],k=d*v,w=k/67108864|0;l.words[0]=67108863&k;for(var c=1;c>>26,ft=67108863&w,mt=Math.min(c,s.length-1),pt=Math.max(0,c-g.length+1);pt<=mt;pt++)x+=(k=(d=0|g.words[c-pt|0])*(v=0|s.words[pt])+ft)/67108864|0,ft=67108863&k;l.words[c]=0|ft,w=0|x}return 0!==w?l.words[c]=0|w:l.length--,l.strip()}m.prototype.toString=function(s,l){var h;if(l=0|l||1,16===(s=s||10)||"hex"===s){h="";for(var d=0,v=0,k=0;k>>24-d&16777215)||k!==this.length-1?tt[6-w.length]+w+h:w+h,(d+=2)>=26&&(d-=26,k--)}for(0!==v&&(h=v.toString(16)+h);h.length%l!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}if(s===(0|s)&&s>=2&&s<=36){var c=at[s],x=K[s];h="";var ft=this.clone();for(ft.negative=0;!ft.isZero();){var mt=ft.modn(x).toString(s);h=(ft=ft.idivn(x)).isZero()?mt+h:tt[c-mt.length]+mt+h}for(this.isZero()&&(h="0"+h);h.length%l!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}_(!1,"Base should be between 2 and 36")},m.prototype.toNumber=function(){var s=this.words[0];return 2===this.length?s+=67108864*this.words[1]:3===this.length&&1===this.words[2]?s+=4503599627370496+67108864*this.words[1]:this.length>2&&_(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-s:s},m.prototype.toJSON=function(){return this.toString(16)},m.prototype.toBuffer=function(s,l){return _(typeof C<"u"),this.toArrayLike(C,s,l)},m.prototype.toArray=function(s,l){return this.toArrayLike(Array,s,l)},m.prototype.toArrayLike=function(s,l,h){var d=this.byteLength(),v=h||Math.max(1,d);_(d<=v,"byte array longer than desired length"),_(v>0,"Requested array length <= 0"),this.strip();var w,c,k="le"===l,I=new s(v),x=this.clone();if(k){for(c=0;!x.isZero();c++)w=x.andln(255),x.iushrn(8),I[c]=w;for(;c=4096&&(h+=13,l>>>=13),l>=64&&(h+=7,l>>>=7),l>=8&&(h+=4,l>>>=4),l>=2&&(h+=2,l>>>=2),h+l},m.prototype._zeroBits=function(s){if(0===s)return 26;var l=s,h=0;return 8191&l||(h+=13,l>>>=13),127&l||(h+=7,l>>>=7),15&l||(h+=4,l>>>=4),3&l||(h+=2,l>>>=2),1&l||h++,h},m.prototype.bitLength=function(){var l=this._countBits(this.words[this.length-1]);return 26*(this.length-1)+l},m.prototype.zeroBits=function(){if(this.isZero())return 0;for(var s=0,l=0;ls.length?this.clone().ior(s):s.clone().ior(this)},m.prototype.uor=function(s){return this.length>s.length?this.clone().iuor(s):s.clone().iuor(this)},m.prototype.iuand=function(s){var l;l=this.length>s.length?s:this;for(var h=0;hs.length?this.clone().iand(s):s.clone().iand(this)},m.prototype.uand=function(s){return this.length>s.length?this.clone().iuand(s):s.clone().iuand(this)},m.prototype.iuxor=function(s){var l,h;this.length>s.length?(l=this,h=s):(l=s,h=this);for(var d=0;ds.length?this.clone().ixor(s):s.clone().ixor(this)},m.prototype.uxor=function(s){return this.length>s.length?this.clone().iuxor(s):s.clone().iuxor(this)},m.prototype.inotn=function(s){_("number"==typeof s&&s>=0);var l=0|Math.ceil(s/26),h=s%26;this._expand(l),h>0&&l--;for(var d=0;d0&&(this.words[d]=~this.words[d]&67108863>>26-h),this.strip()},m.prototype.notn=function(s){return this.clone().inotn(s)},m.prototype.setn=function(s,l){_("number"==typeof s&&s>=0);var h=s/26|0,d=s%26;return this._expand(h+1),this.words[h]=l?this.words[h]|1<s.length?(h=this,d=s):(h=s,d=this);for(var v=0,k=0;k>>26;for(;0!==v&&k>>26;if(this.length=h.length,0!==v)this.words[this.length]=v,this.length++;else if(h!==this)for(;ks.length?this.clone().iadd(s):s.clone().iadd(this)},m.prototype.isub=function(s){if(0!==s.negative){s.negative=0;var l=this.iadd(s);return s.negative=1,l._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(s),this.negative=1,this._normSign();var d,v,h=this.cmp(s);if(0===h)return this.negative=0,this.length=1,this.words[0]=0,this;h>0?(d=this,v=s):(d=s,v=this);for(var k=0,I=0;I>26,this.words[I]=67108863&l;for(;0!==k&&I>26,this.words[I]=67108863&l;if(0===k&&I>>13,xt=0|d[1],Mt=8191&xt,St=xt>>>13,Ut=0|d[2],Ct=8191&Ut,Tt=Ut>>>13,Ye=0|d[3],Yt=8191&Ye,Kt=Ye>>>13,Yn=0|d[4],Ft=8191&Yn,zt=Yn>>>13,Kn=0|d[5],Zt=8191&Kn,qt=Kn>>>13,Zn=0|d[6],Ht=8191&Zn,Xt=Zn>>>13,Sn=0|d[7],Jt=8191&Sn,Qt=Sn>>>13,Xn=0|d[8],te=8191&Xn,ee=Xn>>>13,Ar=0|d[9],ge=8191&Ar,ve=Ar>>>13,Tr=0|v[0],ne=8191&Tr,re=Tr>>>13,Jn=0|v[1],ie=8191&Jn,$t=Jn>>>13,Qn=0|v[2],oe=8191&Qn,se=Qn>>>13,Cn=0|v[3],Lt=8191&Cn,jt=Cn>>>13,rn=0|v[4],ae=8191&rn,Dt=rn>>>13,hn=0|v[5],Vt=8191&hn,Gt=hn>>>13,An=0|v[6],Wt=8191&An,le=An>>>13,tr=0|v[7],ce=8191&tr,ue=tr>>>13,er=0|v[8],fe=8191&er,he=er>>>13,nr=0|v[9],de=8191&nr,me=nr>>>13;h.negative=s.negative^l.negative,h.length=19;var Ce=(I+(w=Math.imul(mt,ne))|0)+((8191&(c=(c=Math.imul(mt,re))+Math.imul(pt,ne)|0))<<13)|0;I=((x=Math.imul(pt,re))+(c>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,w=Math.imul(Mt,ne),c=(c=Math.imul(Mt,re))+Math.imul(St,ne)|0,x=Math.imul(St,re);var dn=(I+(w=w+Math.imul(mt,ie)|0)|0)+((8191&(c=(c=c+Math.imul(mt,$t)|0)+Math.imul(pt,ie)|0))<<13)|0;I=((x=x+Math.imul(pt,$t)|0)+(c>>>13)|0)+(dn>>>26)|0,dn&=67108863,w=Math.imul(Ct,ne),c=(c=Math.imul(Ct,re))+Math.imul(Tt,ne)|0,x=Math.imul(Tt,re),w=w+Math.imul(Mt,ie)|0,c=(c=c+Math.imul(Mt,$t)|0)+Math.imul(St,ie)|0,x=x+Math.imul(St,$t)|0;var mn=(I+(w=w+Math.imul(mt,oe)|0)|0)+((8191&(c=(c=c+Math.imul(mt,se)|0)+Math.imul(pt,oe)|0))<<13)|0;I=((x=x+Math.imul(pt,se)|0)+(c>>>13)|0)+(mn>>>26)|0,mn&=67108863,w=Math.imul(Yt,ne),c=(c=Math.imul(Yt,re))+Math.imul(Kt,ne)|0,x=Math.imul(Kt,re),w=w+Math.imul(Ct,ie)|0,c=(c=c+Math.imul(Ct,$t)|0)+Math.imul(Tt,ie)|0,x=x+Math.imul(Tt,$t)|0,w=w+Math.imul(Mt,oe)|0,c=(c=c+Math.imul(Mt,se)|0)+Math.imul(St,oe)|0,x=x+Math.imul(St,se)|0;var Tn=(I+(w=w+Math.imul(mt,Lt)|0)|0)+((8191&(c=(c=c+Math.imul(mt,jt)|0)+Math.imul(pt,Lt)|0))<<13)|0;I=((x=x+Math.imul(pt,jt)|0)+(c>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,w=Math.imul(Ft,ne),c=(c=Math.imul(Ft,re))+Math.imul(zt,ne)|0,x=Math.imul(zt,re),w=w+Math.imul(Yt,ie)|0,c=(c=c+Math.imul(Yt,$t)|0)+Math.imul(Kt,ie)|0,x=x+Math.imul(Kt,$t)|0,w=w+Math.imul(Ct,oe)|0,c=(c=c+Math.imul(Ct,se)|0)+Math.imul(Tt,oe)|0,x=x+Math.imul(Tt,se)|0,w=w+Math.imul(Mt,Lt)|0,c=(c=c+Math.imul(Mt,jt)|0)+Math.imul(St,Lt)|0,x=x+Math.imul(St,jt)|0;var In=(I+(w=w+Math.imul(mt,ae)|0)|0)+((8191&(c=(c=c+Math.imul(mt,Dt)|0)+Math.imul(pt,ae)|0))<<13)|0;I=((x=x+Math.imul(pt,Dt)|0)+(c>>>13)|0)+(In>>>26)|0,In&=67108863,w=Math.imul(Zt,ne),c=(c=Math.imul(Zt,re))+Math.imul(qt,ne)|0,x=Math.imul(qt,re),w=w+Math.imul(Ft,ie)|0,c=(c=c+Math.imul(Ft,$t)|0)+Math.imul(zt,ie)|0,x=x+Math.imul(zt,$t)|0,w=w+Math.imul(Yt,oe)|0,c=(c=c+Math.imul(Yt,se)|0)+Math.imul(Kt,oe)|0,x=x+Math.imul(Kt,se)|0,w=w+Math.imul(Ct,Lt)|0,c=(c=c+Math.imul(Ct,jt)|0)+Math.imul(Tt,Lt)|0,x=x+Math.imul(Tt,jt)|0,w=w+Math.imul(Mt,ae)|0,c=(c=c+Math.imul(Mt,Dt)|0)+Math.imul(St,ae)|0,x=x+Math.imul(St,Dt)|0;var pn=(I+(w=w+Math.imul(mt,Vt)|0)|0)+((8191&(c=(c=c+Math.imul(mt,Gt)|0)+Math.imul(pt,Vt)|0))<<13)|0;I=((x=x+Math.imul(pt,Gt)|0)+(c>>>13)|0)+(pn>>>26)|0,pn&=67108863,w=Math.imul(Ht,ne),c=(c=Math.imul(Ht,re))+Math.imul(Xt,ne)|0,x=Math.imul(Xt,re),w=w+Math.imul(Zt,ie)|0,c=(c=c+Math.imul(Zt,$t)|0)+Math.imul(qt,ie)|0,x=x+Math.imul(qt,$t)|0,w=w+Math.imul(Ft,oe)|0,c=(c=c+Math.imul(Ft,se)|0)+Math.imul(zt,oe)|0,x=x+Math.imul(zt,se)|0,w=w+Math.imul(Yt,Lt)|0,c=(c=c+Math.imul(Yt,jt)|0)+Math.imul(Kt,Lt)|0,x=x+Math.imul(Kt,jt)|0,w=w+Math.imul(Ct,ae)|0,c=(c=c+Math.imul(Ct,Dt)|0)+Math.imul(Tt,ae)|0,x=x+Math.imul(Tt,Dt)|0,w=w+Math.imul(Mt,Vt)|0,c=(c=c+Math.imul(Mt,Gt)|0)+Math.imul(St,Vt)|0,x=x+Math.imul(St,Gt)|0;var Rn=(I+(w=w+Math.imul(mt,Wt)|0)|0)+((8191&(c=(c=c+Math.imul(mt,le)|0)+Math.imul(pt,Wt)|0))<<13)|0;I=((x=x+Math.imul(pt,le)|0)+(c>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,w=Math.imul(Jt,ne),c=(c=Math.imul(Jt,re))+Math.imul(Qt,ne)|0,x=Math.imul(Qt,re),w=w+Math.imul(Ht,ie)|0,c=(c=c+Math.imul(Ht,$t)|0)+Math.imul(Xt,ie)|0,x=x+Math.imul(Xt,$t)|0,w=w+Math.imul(Zt,oe)|0,c=(c=c+Math.imul(Zt,se)|0)+Math.imul(qt,oe)|0,x=x+Math.imul(qt,se)|0,w=w+Math.imul(Ft,Lt)|0,c=(c=c+Math.imul(Ft,jt)|0)+Math.imul(zt,Lt)|0,x=x+Math.imul(zt,jt)|0,w=w+Math.imul(Yt,ae)|0,c=(c=c+Math.imul(Yt,Dt)|0)+Math.imul(Kt,ae)|0,x=x+Math.imul(Kt,Dt)|0,w=w+Math.imul(Ct,Vt)|0,c=(c=c+Math.imul(Ct,Gt)|0)+Math.imul(Tt,Vt)|0,x=x+Math.imul(Tt,Gt)|0,w=w+Math.imul(Mt,Wt)|0,c=(c=c+Math.imul(Mt,le)|0)+Math.imul(St,Wt)|0,x=x+Math.imul(St,le)|0;var Bn=(I+(w=w+Math.imul(mt,ce)|0)|0)+((8191&(c=(c=c+Math.imul(mt,ue)|0)+Math.imul(pt,ce)|0))<<13)|0;I=((x=x+Math.imul(pt,ue)|0)+(c>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,w=Math.imul(te,ne),c=(c=Math.imul(te,re))+Math.imul(ee,ne)|0,x=Math.imul(ee,re),w=w+Math.imul(Jt,ie)|0,c=(c=c+Math.imul(Jt,$t)|0)+Math.imul(Qt,ie)|0,x=x+Math.imul(Qt,$t)|0,w=w+Math.imul(Ht,oe)|0,c=(c=c+Math.imul(Ht,se)|0)+Math.imul(Xt,oe)|0,x=x+Math.imul(Xt,se)|0,w=w+Math.imul(Zt,Lt)|0,c=(c=c+Math.imul(Zt,jt)|0)+Math.imul(qt,Lt)|0,x=x+Math.imul(qt,jt)|0,w=w+Math.imul(Ft,ae)|0,c=(c=c+Math.imul(Ft,Dt)|0)+Math.imul(zt,ae)|0,x=x+Math.imul(zt,Dt)|0,w=w+Math.imul(Yt,Vt)|0,c=(c=c+Math.imul(Yt,Gt)|0)+Math.imul(Kt,Vt)|0,x=x+Math.imul(Kt,Gt)|0,w=w+Math.imul(Ct,Wt)|0,c=(c=c+Math.imul(Ct,le)|0)+Math.imul(Tt,Wt)|0,x=x+Math.imul(Tt,le)|0,w=w+Math.imul(Mt,ce)|0,c=(c=c+Math.imul(Mt,ue)|0)+Math.imul(St,ce)|0,x=x+Math.imul(St,ue)|0;var qe=(I+(w=w+Math.imul(mt,fe)|0)|0)+((8191&(c=(c=c+Math.imul(mt,he)|0)+Math.imul(pt,fe)|0))<<13)|0;I=((x=x+Math.imul(pt,he)|0)+(c>>>13)|0)+(qe>>>26)|0,qe&=67108863,w=Math.imul(ge,ne),c=(c=Math.imul(ge,re))+Math.imul(ve,ne)|0,x=Math.imul(ve,re),w=w+Math.imul(te,ie)|0,c=(c=c+Math.imul(te,$t)|0)+Math.imul(ee,ie)|0,x=x+Math.imul(ee,$t)|0,w=w+Math.imul(Jt,oe)|0,c=(c=c+Math.imul(Jt,se)|0)+Math.imul(Qt,oe)|0,x=x+Math.imul(Qt,se)|0,w=w+Math.imul(Ht,Lt)|0,c=(c=c+Math.imul(Ht,jt)|0)+Math.imul(Xt,Lt)|0,x=x+Math.imul(Xt,jt)|0,w=w+Math.imul(Zt,ae)|0,c=(c=c+Math.imul(Zt,Dt)|0)+Math.imul(qt,ae)|0,x=x+Math.imul(qt,Dt)|0,w=w+Math.imul(Ft,Vt)|0,c=(c=c+Math.imul(Ft,Gt)|0)+Math.imul(zt,Vt)|0,x=x+Math.imul(zt,Gt)|0,w=w+Math.imul(Yt,Wt)|0,c=(c=c+Math.imul(Yt,le)|0)+Math.imul(Kt,Wt)|0,x=x+Math.imul(Kt,le)|0,w=w+Math.imul(Ct,ce)|0,c=(c=c+Math.imul(Ct,ue)|0)+Math.imul(Tt,ce)|0,x=x+Math.imul(Tt,ue)|0,w=w+Math.imul(Mt,fe)|0,c=(c=c+Math.imul(Mt,he)|0)+Math.imul(St,fe)|0,x=x+Math.imul(St,he)|0;var on=(I+(w=w+Math.imul(mt,de)|0)|0)+((8191&(c=(c=c+Math.imul(mt,me)|0)+Math.imul(pt,de)|0))<<13)|0;I=((x=x+Math.imul(pt,me)|0)+(c>>>13)|0)+(on>>>26)|0,on&=67108863,w=Math.imul(ge,ie),c=(c=Math.imul(ge,$t))+Math.imul(ve,ie)|0,x=Math.imul(ve,$t),w=w+Math.imul(te,oe)|0,c=(c=c+Math.imul(te,se)|0)+Math.imul(ee,oe)|0,x=x+Math.imul(ee,se)|0,w=w+Math.imul(Jt,Lt)|0,c=(c=c+Math.imul(Jt,jt)|0)+Math.imul(Qt,Lt)|0,x=x+Math.imul(Qt,jt)|0,w=w+Math.imul(Ht,ae)|0,c=(c=c+Math.imul(Ht,Dt)|0)+Math.imul(Xt,ae)|0,x=x+Math.imul(Xt,Dt)|0,w=w+Math.imul(Zt,Vt)|0,c=(c=c+Math.imul(Zt,Gt)|0)+Math.imul(qt,Vt)|0,x=x+Math.imul(qt,Gt)|0,w=w+Math.imul(Ft,Wt)|0,c=(c=c+Math.imul(Ft,le)|0)+Math.imul(zt,Wt)|0,x=x+Math.imul(zt,le)|0,w=w+Math.imul(Yt,ce)|0,c=(c=c+Math.imul(Yt,ue)|0)+Math.imul(Kt,ce)|0,x=x+Math.imul(Kt,ue)|0,w=w+Math.imul(Ct,fe)|0,c=(c=c+Math.imul(Ct,he)|0)+Math.imul(Tt,fe)|0,x=x+Math.imul(Tt,he)|0;var Nn=(I+(w=w+Math.imul(Mt,de)|0)|0)+((8191&(c=(c=c+Math.imul(Mt,me)|0)+Math.imul(St,de)|0))<<13)|0;I=((x=x+Math.imul(St,me)|0)+(c>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,w=Math.imul(ge,oe),c=(c=Math.imul(ge,se))+Math.imul(ve,oe)|0,x=Math.imul(ve,se),w=w+Math.imul(te,Lt)|0,c=(c=c+Math.imul(te,jt)|0)+Math.imul(ee,Lt)|0,x=x+Math.imul(ee,jt)|0,w=w+Math.imul(Jt,ae)|0,c=(c=c+Math.imul(Jt,Dt)|0)+Math.imul(Qt,ae)|0,x=x+Math.imul(Qt,Dt)|0,w=w+Math.imul(Ht,Vt)|0,c=(c=c+Math.imul(Ht,Gt)|0)+Math.imul(Xt,Vt)|0,x=x+Math.imul(Xt,Gt)|0,w=w+Math.imul(Zt,Wt)|0,c=(c=c+Math.imul(Zt,le)|0)+Math.imul(qt,Wt)|0,x=x+Math.imul(qt,le)|0,w=w+Math.imul(Ft,ce)|0,c=(c=c+Math.imul(Ft,ue)|0)+Math.imul(zt,ce)|0,x=x+Math.imul(zt,ue)|0,w=w+Math.imul(Yt,fe)|0,c=(c=c+Math.imul(Yt,he)|0)+Math.imul(Kt,fe)|0,x=x+Math.imul(Kt,he)|0;var gn=(I+(w=w+Math.imul(Ct,de)|0)|0)+((8191&(c=(c=c+Math.imul(Ct,me)|0)+Math.imul(Tt,de)|0))<<13)|0;I=((x=x+Math.imul(Tt,me)|0)+(c>>>13)|0)+(gn>>>26)|0,gn&=67108863,w=Math.imul(ge,Lt),c=(c=Math.imul(ge,jt))+Math.imul(ve,Lt)|0,x=Math.imul(ve,jt),w=w+Math.imul(te,ae)|0,c=(c=c+Math.imul(te,Dt)|0)+Math.imul(ee,ae)|0,x=x+Math.imul(ee,Dt)|0,w=w+Math.imul(Jt,Vt)|0,c=(c=c+Math.imul(Jt,Gt)|0)+Math.imul(Qt,Vt)|0,x=x+Math.imul(Qt,Gt)|0,w=w+Math.imul(Ht,Wt)|0,c=(c=c+Math.imul(Ht,le)|0)+Math.imul(Xt,Wt)|0,x=x+Math.imul(Xt,le)|0,w=w+Math.imul(Zt,ce)|0,c=(c=c+Math.imul(Zt,ue)|0)+Math.imul(qt,ce)|0,x=x+Math.imul(qt,ue)|0,w=w+Math.imul(Ft,fe)|0,c=(c=c+Math.imul(Ft,he)|0)+Math.imul(zt,fe)|0,x=x+Math.imul(zt,he)|0;var Pn=(I+(w=w+Math.imul(Yt,de)|0)|0)+((8191&(c=(c=c+Math.imul(Yt,me)|0)+Math.imul(Kt,de)|0))<<13)|0;I=((x=x+Math.imul(Kt,me)|0)+(c>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,w=Math.imul(ge,ae),c=(c=Math.imul(ge,Dt))+Math.imul(ve,ae)|0,x=Math.imul(ve,Dt),w=w+Math.imul(te,Vt)|0,c=(c=c+Math.imul(te,Gt)|0)+Math.imul(ee,Vt)|0,x=x+Math.imul(ee,Gt)|0,w=w+Math.imul(Jt,Wt)|0,c=(c=c+Math.imul(Jt,le)|0)+Math.imul(Qt,Wt)|0,x=x+Math.imul(Qt,le)|0,w=w+Math.imul(Ht,ce)|0,c=(c=c+Math.imul(Ht,ue)|0)+Math.imul(Xt,ce)|0,x=x+Math.imul(Xt,ue)|0,w=w+Math.imul(Zt,fe)|0,c=(c=c+Math.imul(Zt,he)|0)+Math.imul(qt,fe)|0,x=x+Math.imul(qt,he)|0;var Ln=(I+(w=w+Math.imul(Ft,de)|0)|0)+((8191&(c=(c=c+Math.imul(Ft,me)|0)+Math.imul(zt,de)|0))<<13)|0;I=((x=x+Math.imul(zt,me)|0)+(c>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,w=Math.imul(ge,Vt),c=(c=Math.imul(ge,Gt))+Math.imul(ve,Vt)|0,x=Math.imul(ve,Gt),w=w+Math.imul(te,Wt)|0,c=(c=c+Math.imul(te,le)|0)+Math.imul(ee,Wt)|0,x=x+Math.imul(ee,le)|0,w=w+Math.imul(Jt,ce)|0,c=(c=c+Math.imul(Jt,ue)|0)+Math.imul(Qt,ce)|0,x=x+Math.imul(Qt,ue)|0,w=w+Math.imul(Ht,fe)|0,c=(c=c+Math.imul(Ht,he)|0)+Math.imul(Xt,fe)|0,x=x+Math.imul(Xt,he)|0;var Un=(I+(w=w+Math.imul(Zt,de)|0)|0)+((8191&(c=(c=c+Math.imul(Zt,me)|0)+Math.imul(qt,de)|0))<<13)|0;I=((x=x+Math.imul(qt,me)|0)+(c>>>13)|0)+(Un>>>26)|0,Un&=67108863,w=Math.imul(ge,Wt),c=(c=Math.imul(ge,le))+Math.imul(ve,Wt)|0,x=Math.imul(ve,le),w=w+Math.imul(te,ce)|0,c=(c=c+Math.imul(te,ue)|0)+Math.imul(ee,ce)|0,x=x+Math.imul(ee,ue)|0,w=w+Math.imul(Jt,fe)|0,c=(c=c+Math.imul(Jt,he)|0)+Math.imul(Qt,fe)|0,x=x+Math.imul(Qt,he)|0;var rr=(I+(w=w+Math.imul(Ht,de)|0)|0)+((8191&(c=(c=c+Math.imul(Ht,me)|0)+Math.imul(Xt,de)|0))<<13)|0;I=((x=x+Math.imul(Xt,me)|0)+(c>>>13)|0)+(rr>>>26)|0,rr&=67108863,w=Math.imul(ge,ce),c=(c=Math.imul(ge,ue))+Math.imul(ve,ce)|0,x=Math.imul(ve,ue),w=w+Math.imul(te,fe)|0,c=(c=c+Math.imul(te,he)|0)+Math.imul(ee,fe)|0,x=x+Math.imul(ee,he)|0;var Ae=(I+(w=w+Math.imul(Jt,de)|0)|0)+((8191&(c=(c=c+Math.imul(Jt,me)|0)+Math.imul(Qt,de)|0))<<13)|0;I=((x=x+Math.imul(Qt,me)|0)+(c>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,w=Math.imul(ge,fe),c=(c=Math.imul(ge,he))+Math.imul(ve,fe)|0,x=Math.imul(ve,he);var sn=(I+(w=w+Math.imul(te,de)|0)|0)+((8191&(c=(c=c+Math.imul(te,me)|0)+Math.imul(ee,de)|0))<<13)|0;I=((x=x+Math.imul(ee,me)|0)+(c>>>13)|0)+(sn>>>26)|0,sn&=67108863;var an=(I+(w=Math.imul(ge,de))|0)+((8191&(c=(c=Math.imul(ge,me))+Math.imul(ve,de)|0))<<13)|0;return I=((x=Math.imul(ve,me))+(c>>>13)|0)+(an>>>26)|0,an&=67108863,k[0]=Ce,k[1]=dn,k[2]=mn,k[3]=Tn,k[4]=In,k[5]=pn,k[6]=Rn,k[7]=Bn,k[8]=qe,k[9]=on,k[10]=Nn,k[11]=gn,k[12]=Pn,k[13]=Ln,k[14]=Un,k[15]=rr,k[16]=Ae,k[17]=sn,k[18]=an,0!==I&&(k[19]=I,h.length++),h};function G(g,s,l){return(new V).mulp(g,s,l)}function V(g,s){this.x=g,this.y=s}Math.imul||(O=L),m.prototype.mulTo=function(s,l){var h,d=this.length+s.length;return h=10===this.length&&10===s.length?O(this,s,l):d<63?L(this,s,l):d<1024?function dt(g,s,l){l.negative=s.negative^g.negative,l.length=g.length+s.length;for(var h=0,d=0,v=0;v>>26)|0)>>>26,k&=67108863}l.words[v]=I,h=k,k=d}return 0!==h?l.words[v]=h:l.length--,l.strip()}(this,s,l):G(this,s,l),h},V.prototype.makeRBT=function(s){for(var l=new Array(s),h=m.prototype._countBits(s)-1,d=0;d>=1;return d},V.prototype.permute=function(s,l,h,d,v,k){for(var I=0;I>>=1)v++;return 1<>>=13),v>>>=13;for(k=2*l;k>=26,l+=d/67108864|0,l+=v>>>26,this.words[h]=67108863&v}return 0!==l&&(this.words[h]=l,this.length++),this},m.prototype.muln=function(s){return this.clone().imuln(s)},m.prototype.sqr=function(){return this.mul(this)},m.prototype.isqr=function(){return this.imul(this.clone())},m.prototype.pow=function(s){var l=function nt(g){for(var s=new Array(g.bitLength()),l=0;l>>d}return s}(s);if(0===l.length)return new m(1);for(var h=this,d=0;d=0);var v,l=s%26,h=(s-l)/26,d=67108863>>>26-l<<26-l;if(0!==l){var k=0;for(v=0;v>>26-l}k&&(this.words[v]=k,this.length++)}if(0!==h){for(v=this.length-1;v>=0;v--)this.words[v+h]=this.words[v];for(v=0;v=0),d=l?(l-l%26)/26:0;var v=s%26,k=Math.min((s-v)/26,this.length),I=67108863^67108863>>>v<k)for(this.length-=k,c=0;c=0&&(0!==x||c>=d);c--){var ft=0|this.words[c];this.words[c]=x<<26-v|ft>>>v,x=ft&I}return w&&0!==x&&(w.words[w.length++]=x),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},m.prototype.ishrn=function(s,l,h){return _(0===this.negative),this.iushrn(s,l,h)},m.prototype.shln=function(s){return this.clone().ishln(s)},m.prototype.ushln=function(s){return this.clone().iushln(s)},m.prototype.shrn=function(s){return this.clone().ishrn(s)},m.prototype.ushrn=function(s){return this.clone().iushrn(s)},m.prototype.testn=function(s){_("number"==typeof s&&s>=0);var l=s%26,h=(s-l)/26;return!(this.length<=h||!(this.words[h]&1<=0);var l=s%26,h=(s-l)/26;return _(0===this.negative,"imaskn works only with positive numbers"),this.length<=h?this:(0!==l&&h++,this.length=Math.min(h,this.length),0!==l&&(this.words[this.length-1]&=67108863^67108863>>>l<=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},m.prototype.isubn=function(s){if(_("number"==typeof s),_(s<67108864),s<0)return this.iaddn(-s);if(0!==this.negative)return this.negative=0,this.iaddn(s),this.negative=1,this;if(this.words[0]-=s,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l>26)-(w/67108864|0),this.words[v+h]=67108863&k}for(;v>26,this.words[v+h]=67108863&k;if(0===I)return this.strip();for(_(-1===I),I=0,v=0;v>26,this.words[v]=67108863&k;return this.negative=1,this.strip()},m.prototype._wordDiv=function(s,l){var h,d=this.clone(),v=s,k=0|v.words[v.length-1];0!=(h=26-this._countBits(k))&&(v=v.ushln(h),d.iushln(h),k=0|v.words[v.length-1]);var c,w=d.length-v.length;if("mod"!==l){(c=new m(null)).length=w+1,c.words=new Array(c.length);for(var x=0;x=0;mt--){var pt=67108864*(0|d.words[v.length+mt])+(0|d.words[v.length+mt-1]);for(pt=Math.min(pt/k|0,67108863),d._ishlnsubmul(v,pt,mt);0!==d.negative;)pt--,d.negative=0,d._ishlnsubmul(v,1,mt),d.isZero()||(d.negative^=1);c&&(c.words[mt]=pt)}return c&&c.strip(),d.strip(),"div"!==l&&0!==h&&d.iushrn(h),{div:c||null,mod:d}},m.prototype.divmod=function(s,l,h){return _(!s.isZero()),this.isZero()?{div:new m(0),mod:new m(0)}:0!==this.negative&&0===s.negative?(k=this.neg().divmod(s,l),"mod"!==l&&(d=k.div.neg()),"div"!==l&&(v=k.mod.neg(),h&&0!==v.negative&&v.iadd(s)),{div:d,mod:v}):0===this.negative&&0!==s.negative?(k=this.divmod(s.neg(),l),"mod"!==l&&(d=k.div.neg()),{div:d,mod:k.mod}):this.negative&s.negative?(k=this.neg().divmod(s.neg(),l),"div"!==l&&(v=k.mod.neg(),h&&0!==v.negative&&v.isub(s)),{div:k.div,mod:v}):s.length>this.length||this.cmp(s)<0?{div:new m(0),mod:this}:1===s.length?"div"===l?{div:this.divn(s.words[0]),mod:null}:"mod"===l?{div:null,mod:new m(this.modn(s.words[0]))}:{div:this.divn(s.words[0]),mod:new m(this.modn(s.words[0]))}:this._wordDiv(s,l);var d,v,k},m.prototype.div=function(s){return this.divmod(s,"div",!1).div},m.prototype.mod=function(s){return this.divmod(s,"mod",!1).mod},m.prototype.umod=function(s){return this.divmod(s,"mod",!0).mod},m.prototype.divRound=function(s){var l=this.divmod(s);if(l.mod.isZero())return l.div;var h=0!==l.div.negative?l.mod.isub(s):l.mod,d=s.ushrn(1),v=s.andln(1),k=h.cmp(d);return k<0||1===v&&0===k?l.div:0!==l.div.negative?l.div.isubn(1):l.div.iaddn(1)},m.prototype.modn=function(s){_(s<=67108863);for(var l=(1<<26)%s,h=0,d=this.length-1;d>=0;d--)h=(l*h+(0|this.words[d]))%s;return h},m.prototype.idivn=function(s){_(s<=67108863);for(var l=0,h=this.length-1;h>=0;h--){var d=(0|this.words[h])+67108864*l;this.words[h]=d/s|0,l=d%s}return this.strip()},m.prototype.divn=function(s){return this.clone().idivn(s)},m.prototype.egcd=function(s){_(0===s.negative),_(!s.isZero());var l=this,h=s.clone();l=0!==l.negative?l.umod(s):l.clone();for(var d=new m(1),v=new m(0),k=new m(0),I=new m(1),w=0;l.isEven()&&h.isEven();)l.iushrn(1),h.iushrn(1),++w;for(var c=h.clone(),x=l.clone();!l.isZero();){for(var ft=0,mt=1;!(l.words[0]&mt)&&ft<26;++ft,mt<<=1);if(ft>0)for(l.iushrn(ft);ft-- >0;)(d.isOdd()||v.isOdd())&&(d.iadd(c),v.isub(x)),d.iushrn(1),v.iushrn(1);for(var pt=0,xt=1;!(h.words[0]&xt)&&pt<26;++pt,xt<<=1);if(pt>0)for(h.iushrn(pt);pt-- >0;)(k.isOdd()||I.isOdd())&&(k.iadd(c),I.isub(x)),k.iushrn(1),I.iushrn(1);l.cmp(h)>=0?(l.isub(h),d.isub(k),v.isub(I)):(h.isub(l),k.isub(d),I.isub(v))}return{a:k,b:I,gcd:h.iushln(w)}},m.prototype._invmp=function(s){_(0===s.negative),_(!s.isZero());var ft,l=this,h=s.clone();l=0!==l.negative?l.umod(s):l.clone();for(var d=new m(1),v=new m(0),k=h.clone();l.cmpn(1)>0&&h.cmpn(1)>0;){for(var I=0,w=1;!(l.words[0]&w)&&I<26;++I,w<<=1);if(I>0)for(l.iushrn(I);I-- >0;)d.isOdd()&&d.iadd(k),d.iushrn(1);for(var c=0,x=1;!(h.words[0]&x)&&c<26;++c,x<<=1);if(c>0)for(h.iushrn(c);c-- >0;)v.isOdd()&&v.iadd(k),v.iushrn(1);l.cmp(h)>=0?(l.isub(h),d.isub(v)):(h.isub(l),v.isub(d))}return(ft=0===l.cmpn(1)?d:v).cmpn(0)<0&&ft.iadd(s),ft},m.prototype.gcd=function(s){if(this.isZero())return s.abs();if(s.isZero())return this.abs();var l=this.clone(),h=s.clone();l.negative=0,h.negative=0;for(var d=0;l.isEven()&&h.isEven();d++)l.iushrn(1),h.iushrn(1);for(;;){for(;l.isEven();)l.iushrn(1);for(;h.isEven();)h.iushrn(1);var v=l.cmp(h);if(v<0){var k=l;l=h,h=k}else if(0===v||0===h.cmpn(1))break;l.isub(h)}return h.iushln(d)},m.prototype.invm=function(s){return this.egcd(s).a.umod(s)},m.prototype.isEven=function(){return!(1&this.words[0])},m.prototype.isOdd=function(){return!(1&~this.words[0])},m.prototype.andln=function(s){return this.words[0]&s},m.prototype.bincn=function(s){_("number"==typeof s);var l=s%26,h=(s-l)/26,d=1<>>26,this.words[k]=I&=67108863}return 0!==v&&(this.words[k]=v,this.length++),this},m.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},m.prototype.cmpn=function(s){var h,l=s<0;if(0!==this.negative&&!l)return-1;if(0===this.negative&&l)return 1;if(this.strip(),this.length>1)h=1;else{l&&(s=-s),_(s<=67108863,"Number is too big");var d=0|this.words[0];h=d===s?0:ds.length)return 1;if(this.length=0;h--){var d=0|this.words[h],v=0|s.words[h];if(d!==v){dv&&(l=1);break}}return l},m.prototype.gtn=function(s){return 1===this.cmpn(s)},m.prototype.gt=function(s){return 1===this.cmp(s)},m.prototype.gten=function(s){return this.cmpn(s)>=0},m.prototype.gte=function(s){return this.cmp(s)>=0},m.prototype.ltn=function(s){return-1===this.cmpn(s)},m.prototype.lt=function(s){return-1===this.cmp(s)},m.prototype.lten=function(s){return this.cmpn(s)<=0},m.prototype.lte=function(s){return this.cmp(s)<=0},m.prototype.eqn=function(s){return 0===this.cmpn(s)},m.prototype.eq=function(s){return 0===this.cmp(s)},m.red=function(s){return new lt(s)},m.prototype.toRed=function(s){return _(!this.red,"Already a number in reduction context"),_(0===this.negative,"red works only with positives"),s.convertTo(this)._forceRed(s)},m.prototype.fromRed=function(){return _(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},m.prototype._forceRed=function(s){return this.red=s,this},m.prototype.forceRed=function(s){return _(!this.red,"Already a number in reduction context"),this._forceRed(s)},m.prototype.redAdd=function(s){return _(this.red,"redAdd works only with red numbers"),this.red.add(this,s)},m.prototype.redIAdd=function(s){return _(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,s)},m.prototype.redSub=function(s){return _(this.red,"redSub works only with red numbers"),this.red.sub(this,s)},m.prototype.redISub=function(s){return _(this.red,"redISub works only with red numbers"),this.red.isub(this,s)},m.prototype.redShl=function(s){return _(this.red,"redShl works only with red numbers"),this.red.shl(this,s)},m.prototype.redMul=function(s){return _(this.red,"redMul works only with red numbers"),this.red._verify2(this,s),this.red.mul(this,s)},m.prototype.redIMul=function(s){return _(this.red,"redMul works only with red numbers"),this.red._verify2(this,s),this.red.imul(this,s)},m.prototype.redSqr=function(){return _(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},m.prototype.redISqr=function(){return _(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},m.prototype.redSqrt=function(){return _(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},m.prototype.redInvm=function(){return _(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},m.prototype.redNeg=function(){return _(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},m.prototype.redPow=function(s){return _(this.red&&!s.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,s)};var i={k256:null,p224:null,p192:null,p25519:null};function ut(g,s){this.name=g,this.p=new m(s,16),this.n=this.p.bitLength(),this.k=new m(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function kt(){ut.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function Pt(){ut.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function ot(){ut.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function it(){ut.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function lt(g){if("string"==typeof g){var s=m._prime(g);this.m=s.p,this.prime=s}else _(g.gtn(1),"modulus must be greater than 1"),this.m=g,this.prime=null}function ht(g){lt.call(this,g),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new m(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}ut.prototype._tmp=function(){var s=new m(null);return s.words=new Array(Math.ceil(this.n/13)),s},ut.prototype.ireduce=function(s){var h,l=s;do{this.split(l,this.tmp),h=(l=(l=this.imulK(l)).iadd(this.tmp)).bitLength()}while(h>this.n);var d=h0?l.isub(this.p):void 0!==l.strip?l.strip():l._strip(),l},ut.prototype.split=function(s,l){s.iushrn(this.n,0,l)},ut.prototype.imulK=function(s){return s.imul(this.k)},A(kt,ut),kt.prototype.split=function(s,l){for(var h=4194303,d=Math.min(s.length,9),v=0;v>>22,k=I}s.words[v-10]=k>>>=22,s.length-=0===k&&s.length>10?10:9},kt.prototype.imulK=function(s){s.words[s.length]=0,s.words[s.length+1]=0,s.length+=2;for(var l=0,h=0;h>>=26,s.words[h]=v,l=d}return 0!==l&&(s.words[s.length++]=l),s},m._prime=function(s){if(i[s])return i[s];var l;if("k256"===s)l=new kt;else if("p224"===s)l=new Pt;else if("p192"===s)l=new ot;else{if("p25519"!==s)throw new Error("Unknown prime "+s);l=new it}return i[s]=l,l},lt.prototype._verify1=function(s){_(0===s.negative,"red works only with positives"),_(s.red,"red works only with red numbers")},lt.prototype._verify2=function(s,l){_(!(s.negative|l.negative),"red works only with positives"),_(s.red&&s.red===l.red,"red works only with red numbers")},lt.prototype.imod=function(s){return this.prime?this.prime.ireduce(s)._forceRed(this):s.umod(this.m)._forceRed(this)},lt.prototype.neg=function(s){return s.isZero()?s.clone():this.m.sub(s)._forceRed(this)},lt.prototype.add=function(s,l){this._verify2(s,l);var h=s.add(l);return h.cmp(this.m)>=0&&h.isub(this.m),h._forceRed(this)},lt.prototype.iadd=function(s,l){this._verify2(s,l);var h=s.iadd(l);return h.cmp(this.m)>=0&&h.isub(this.m),h},lt.prototype.sub=function(s,l){this._verify2(s,l);var h=s.sub(l);return h.cmpn(0)<0&&h.iadd(this.m),h._forceRed(this)},lt.prototype.isub=function(s,l){this._verify2(s,l);var h=s.isub(l);return h.cmpn(0)<0&&h.iadd(this.m),h},lt.prototype.shl=function(s,l){return this._verify1(s),this.imod(s.ushln(l))},lt.prototype.imul=function(s,l){return this._verify2(s,l),this.imod(s.imul(l))},lt.prototype.mul=function(s,l){return this._verify2(s,l),this.imod(s.mul(l))},lt.prototype.isqr=function(s){return this.imul(s,s.clone())},lt.prototype.sqr=function(s){return this.mul(s,s)},lt.prototype.sqrt=function(s){if(s.isZero())return s.clone();var l=this.m.andln(3);if(_(l%2==1),3===l){var h=this.m.add(new m(1)).iushrn(2);return this.pow(s,h)}for(var d=this.m.subn(1),v=0;!d.isZero()&&0===d.andln(1);)v++,d.iushrn(1);_(!d.isZero());var k=new m(1).toRed(this),I=k.redNeg(),w=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new m(2*c*c).toRed(this);0!==this.pow(c,w).cmp(I);)c.redIAdd(I);for(var x=this.pow(c,d),ft=this.pow(s,d.addn(1).iushrn(1)),mt=this.pow(s,d),pt=v;0!==mt.cmp(k);){for(var xt=mt,Mt=0;0!==xt.cmp(k);Mt++)xt=xt.redSqr();_(Mt=0;v--){for(var x=l.words[v],ft=c-1;ft>=0;ft--){var mt=x>>ft&1;k!==d[0]&&(k=this.sqr(k)),0!==mt||0!==I?(I<<=1,I|=mt,(4==++w||0===v&&0===ft)&&(k=this.mul(k,d[I]),w=0,I=0)):w=0}c=26}return k},lt.prototype.convertTo=function(s){var l=s.umod(this.m);return l===s?l.clone():l},lt.prototype.convertFrom=function(s){var l=s.clone();return l.red=null,l},m.mont=function(s){return new ht(s)},A(ht,lt),ht.prototype.convertTo=function(s){return this.imod(s.ushln(this.shift))},ht.prototype.convertFrom=function(s){var l=this.imod(s.mul(this.rinv));return l.red=null,l},ht.prototype.imul=function(s,l){if(s.isZero()||l.isZero())return s.words[0]=0,s.length=1,s;var h=s.imul(l),d=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=h.isub(d).iushrn(this.shift),k=v;return v.cmp(this.m)>=0?k=v.isub(this.m):v.cmpn(0)<0&&(k=v.iadd(this.m)),k._forceRed(this)},ht.prototype.mul=function(s,l){if(s.isZero()||l.isZero())return new m(0)._forceRed(this);var h=s.mul(l),d=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=h.isub(d).iushrn(this.shift),k=v;return v.cmp(this.m)>=0?k=v.isub(this.m):v.cmpn(0)<0&&(k=v.iadd(this.m)),k._forceRed(this)},ht.prototype.invm=function(s){return this.imod(s._invmp(this.m).mul(this.r2))._forceRed(this)}}(bt=M.nmd(bt),this)},7374:function(bt){bt.exports=function(){"use strict";var M=6e4,E=36e5,y="millisecond",_="second",A="minute",m="hour",C="day",R="week",B="month",j="quarter",tt="year",at="date",K="Invalid Date",nt=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,L=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,O={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(g){var s=["th","st","nd","rd"],l=g%100;return"["+g+(s[(l-20)%10]||s[l]||s[0])+"]"}},dt=function(g,s,l){var h=String(g);return!h||h.length>=s?g:""+Array(s+1-h.length).join(l)+g},G={s:dt,z:function(g){var s=-g.utcOffset(),l=Math.abs(s),h=Math.floor(l/60),d=l%60;return(s<=0?"+":"-")+dt(h,2,"0")+":"+dt(d,2,"0")},m:function g(s,l){if(s.date()1)return g(k[0])}else{var I=s.name;i[I]=s,d=I}return!h&&d&&(V=d),d||!h&&V},ot=function(g,s){if(kt(g))return g.clone();var l="object"==typeof s?s:{};return l.date=g,l.args=arguments,new lt(l)},it=G;it.l=Pt,it.i=kt,it.w=function(g,s){return ot(g,{locale:s.$L,utc:s.$u,x:s.$x,$offset:s.$offset})};var lt=function(){function g(l){this.$L=Pt(l.locale,null,!0),this.parse(l),this.$x=this.$x||l.x||{},this[ut]=!0}var s=g.prototype;return s.parse=function(l){this.$d=function(h){var d=h.date,v=h.utc;if(null===d)return new Date(NaN);if(it.u(d))return new Date;if(d instanceof Date)return new Date(d);if("string"==typeof d&&!/Z$/i.test(d)){var k=d.match(nt);if(k){var I=k[2]-1||0,w=(k[7]||"0").substring(0,3);return v?new Date(Date.UTC(k[1],I,k[3]||1,k[4]||0,k[5]||0,k[6]||0,w)):new Date(k[1],I,k[3]||1,k[4]||0,k[5]||0,k[6]||0,w)}}return new Date(d)}(l),this.init()},s.init=function(){var l=this.$d;this.$y=l.getFullYear(),this.$M=l.getMonth(),this.$D=l.getDate(),this.$W=l.getDay(),this.$H=l.getHours(),this.$m=l.getMinutes(),this.$s=l.getSeconds(),this.$ms=l.getMilliseconds()},s.$utils=function(){return it},s.isValid=function(){return this.$d.toString()!==K},s.isSame=function(l,h){var d=ot(l);return this.startOf(h)<=d&&d<=this.endOf(h)},s.isAfter=function(l,h){return ot(l)0,i<=V.r||!V.r){i<=1&&G>0&&(V=O[G-1]);var ut=L[V.l];tt&&(i=tt(""+i)),K="string"==typeof ut?ut.replace("%d",i):ut(i,R,V.l,nt);break}}if(R)return K;var kt=nt?L.future:L.past;return"function"==typeof kt?kt(K):kt.replace("%s",K)},y.to=function(C,R){return A(C,R,this,!0)},y.from=function(C,R){return A(C,R,this)};var m=function(C){return C.$u?E.utc():E()};y.toNow=function(C){return this.to(m(this),C)},y.fromNow=function(C){return this.from(m(this),C)}}}()},243:bt=>{"use strict";var N={single_source_shortest_paths:function(M,E,y){var _={},A={};A[E]=0;var C,R,B,j,tt,K,m=N.PriorityQueue.make();for(m.push(E,0);!m.empty();)for(B in j=(C=m.pop()).cost,tt=M[R=C.value]||{})tt.hasOwnProperty(B)&&(K=j+tt[B],(typeof A[B]>"u"||A[B]>K)&&(A[B]=K,m.push(B,K),_[B]=R));if(typeof y<"u"&&typeof A[y]>"u"){var O=["Could not find a path from ",E," to ",y,"."].join("");throw new Error(O)}return _},extract_shortest_path_from_predecessor_list:function(M,E){for(var y=[],_=E;_;)y.push(_),_=M[_];return y.reverse(),y},find_path:function(M,E,y){var _=N.single_source_shortest_paths(M,E,y);return N.extract_shortest_path_from_predecessor_list(_,y)},PriorityQueue:{make:function(M){var _,E=N.PriorityQueue,y={};for(_ in M=M||{},E)E.hasOwnProperty(_)&&(y[_]=E[_]);return y.queue=[],y.sorter=M.sorter||E.default_sorter,y},default_sorter:function(M,E){return M.cost-E.cost},push:function(M,E){this.queue.push({value:M,cost:E}),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};bt.exports=N},3174:bt=>{"use strict";bt.exports=function(M){for(var E=[],y=M.length,_=0;_=55296&&A<=56319&&y>_+1){var m=M.charCodeAt(_+1);m>=56320&&m<=57343&&(A=1024*(A-55296)+m-56320+65536,_+=1)}A<128?E.push(A):A<2048?(E.push(A>>6|192),E.push(63&A|128)):A<55296||A>=57344&&A<65536?(E.push(A>>12|224),E.push(A>>6&63|128),E.push(63&A|128)):A>=65536&&A<=1114111?(E.push(A>>18|240),E.push(A>>12&63|128),E.push(A>>6&63|128),E.push(63&A|128)):E.push(239,191,189)}return new Uint8Array(E).buffer}},7790:()=>{},9183:(bt,N,M)=>{"use strict";M.d(N,{D6:()=>K,LG:()=>tt});var E=M(4438),y=M(177),_=M(6600);const A=["determinateSpinner"];function m(nt,L){if(1&nt&&(E.qSk(),E.j41(0,"svg",11),E.nrm(1,"circle",12),E.k0s()),2&nt){const O=E.XpG();E.BMQ("viewBox",O._viewBox()),E.R7$(),E.xc7("stroke-dasharray",O._strokeCircumference(),"px")("stroke-dashoffset",O._strokeCircumference()/2,"px")("stroke-width",O._circleStrokeWidth(),"%"),E.BMQ("r",O._circleRadius())}}const C=new E.nKC("mat-progress-spinner-default-options",{providedIn:"root",factory:function R(){return{diameter:B}}}),B=100;let tt=(()=>{class nt{get color(){return this._color||this._defaultColor}set color(O){this._color=O}constructor(O,dt,G){this._elementRef=O,this._defaultColor="primary",this._value=0,this._diameter=B,this._noopAnimations="NoopAnimations"===dt&&!!G&&!G._forceAnimations,this.mode="mat-spinner"===O.nativeElement.nodeName.toLowerCase()?"indeterminate":"determinate",G&&(G.color&&(this.color=this._defaultColor=G.color),G.diameter&&(this.diameter=G.diameter),G.strokeWidth&&(this.strokeWidth=G.strokeWidth))}get value(){return"determinate"===this.mode?this._value:0}set value(O){this._value=Math.max(0,Math.min(100,O||0))}get diameter(){return this._diameter}set diameter(O){this._diameter=O||0}get strokeWidth(){return this._strokeWidth??this.diameter/10}set strokeWidth(O){this._strokeWidth=O||0}_circleRadius(){return(this.diameter-10)/2}_viewBox(){const O=2*this._circleRadius()+this.strokeWidth;return`0 0 ${O} ${O}`}_strokeCircumference(){return 2*Math.PI*this._circleRadius()}_strokeDashOffset(){return"determinate"===this.mode?this._strokeCircumference()*(100-this._value)/100:null}_circleStrokeWidth(){return this.strokeWidth/this.diameter*100}static#t=this.\u0275fac=function(dt){return new(dt||nt)(E.rXU(E.aKT),E.rXU(E.bc$,8),E.rXU(C))};static#e=this.\u0275cmp=E.VBU({type:nt,selectors:[["mat-progress-spinner"],["mat-spinner"]],viewQuery:function(dt,G){if(1&dt&&E.GBs(A,5),2&dt){let V;E.mGM(V=E.lsd())&&(G._determinateCircle=V.first)}},hostAttrs:["role","progressbar","tabindex","-1",1,"mat-mdc-progress-spinner","mdc-circular-progress"],hostVars:18,hostBindings:function(dt,G){2&dt&&(E.BMQ("aria-valuemin",0)("aria-valuemax",100)("aria-valuenow","determinate"===G.mode?G.value:null)("mode",G.mode),E.HbH("mat-"+G.color),E.xc7("width",G.diameter,"px")("height",G.diameter,"px")("--mdc-circular-progress-size",G.diameter+"px")("--mdc-circular-progress-active-indicator-width",G.diameter+"px"),E.AVh("_mat-animation-noopable",G._noopAnimations)("mdc-circular-progress--indeterminate","indeterminate"===G.mode))},inputs:{color:"color",mode:"mode",value:[2,"value","value",E.Udg],diameter:[2,"diameter","diameter",E.Udg],strokeWidth:[2,"strokeWidth","strokeWidth",E.Udg]},exportAs:["matProgressSpinner"],standalone:!0,features:[E.GFd,E.aNF],decls:14,vars:11,consts:[["circle",""],["determinateSpinner",""],["aria-hidden","true",1,"mdc-circular-progress__determinate-container"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__determinate-circle-graphic"],["cx","50%","cy","50%",1,"mdc-circular-progress__determinate-circle"],["aria-hidden","true",1,"mdc-circular-progress__indeterminate-container"],[1,"mdc-circular-progress__spinner-layer"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-left"],[3,"ngTemplateOutlet"],[1,"mdc-circular-progress__gap-patch"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-right"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__indeterminate-circle-graphic"],["cx","50%","cy","50%"]],template:function(dt,G){if(1&dt&&(E.DNE(0,m,2,8,"ng-template",null,0,E.C5r),E.j41(2,"div",2,1),E.qSk(),E.j41(4,"svg",3),E.nrm(5,"circle",4),E.k0s()(),E.joV(),E.j41(6,"div",5)(7,"div",6)(8,"div",7),E.eu8(9,8),E.k0s(),E.j41(10,"div",9),E.eu8(11,8),E.k0s(),E.j41(12,"div",10),E.eu8(13,8),E.k0s()()()),2&dt){const V=E.sdS(1);E.R7$(4),E.BMQ("viewBox",G._viewBox()),E.R7$(),E.xc7("stroke-dasharray",G._strokeCircumference(),"px")("stroke-dashoffset",G._strokeDashOffset(),"px")("stroke-width",G._circleStrokeWidth(),"%"),E.BMQ("r",G._circleRadius()),E.R7$(4),E.Y8G("ngTemplateOutlet",V),E.R7$(2),E.Y8G("ngTemplateOutlet",V),E.R7$(2),E.Y8G("ngTemplateOutlet",V)}},dependencies:[y.T3],styles:[".mat-mdc-progress-spinner{display:block;overflow:hidden;line-height:0;position:relative;direction:ltr;transition:opacity 250ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-progress-spinner circle{stroke-width:var(--mdc-circular-progress-active-indicator-width)}.mat-mdc-progress-spinner._mat-animation-noopable,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__determinate-circle{transition:none !important}.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-circle-graphic,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__spinner-layer,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container{animation:none !important}.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container circle{stroke-dasharray:0 !important}.cdk-high-contrast-active .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic,.cdk-high-contrast-active .mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle{stroke:currentColor;stroke:CanvasText}.mdc-circular-progress__determinate-container,.mdc-circular-progress__indeterminate-circle-graphic,.mdc-circular-progress__indeterminate-container,.mdc-circular-progress__spinner-layer{position:absolute;width:100%;height:100%}.mdc-circular-progress__determinate-container{transform:rotate(-90deg)}.mdc-circular-progress--indeterminate .mdc-circular-progress__determinate-container{opacity:0}.mdc-circular-progress__indeterminate-container{font-size:0;letter-spacing:0;white-space:nowrap;opacity:0}.mdc-circular-progress--indeterminate .mdc-circular-progress__indeterminate-container{opacity:1;animation:mdc-circular-progress-container-rotate 1568.2352941176ms linear infinite}.mdc-circular-progress__determinate-circle-graphic,.mdc-circular-progress__indeterminate-circle-graphic{fill:rgba(0,0,0,0)}.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:var(--mdc-circular-progress-active-indicator-color, var(--mat-app-primary))}.cdk-high-contrast-active .mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,.cdk-high-contrast-active .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:CanvasText}.mdc-circular-progress__determinate-circle{transition:stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1)}.mdc-circular-progress__gap-patch{position:absolute;top:0;left:47.5%;box-sizing:border-box;width:5%;height:100%;overflow:hidden}.mdc-circular-progress__gap-patch .mdc-circular-progress__indeterminate-circle-graphic{left:-900%;width:2000%;transform:rotate(180deg)}.mdc-circular-progress__circle-clipper .mdc-circular-progress__indeterminate-circle-graphic{width:200%}.mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{left:-100%}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-left .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-left-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-right-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress__circle-clipper{display:inline-flex;position:relative;width:50%;height:100%;overflow:hidden}.mdc-circular-progress--indeterminate .mdc-circular-progress__spinner-layer{animation:mdc-circular-progress-spinner-layer-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}@keyframes mdc-circular-progress-container-rotate{to{transform:rotate(360deg)}}@keyframes mdc-circular-progress-spinner-layer-rotate{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes mdc-circular-progress-left-spin{from{transform:rotate(265deg)}50%{transform:rotate(130deg)}to{transform:rotate(265deg)}}@keyframes mdc-circular-progress-right-spin{from{transform:rotate(-265deg)}50%{transform:rotate(-130deg)}to{transform:rotate(-265deg)}}"],encapsulation:2,changeDetection:0})}return nt})(),K=(()=>{class nt{static#t=this.\u0275fac=function(dt){return new(dt||nt)};static#e=this.\u0275mod=E.$C({type:nt});static#n=this.\u0275inj=E.G2t({imports:[y.MD,_.yE]})}return nt})()}}]); \ No newline at end of file +(self.webpackChunkangor=self.webpackChunkangor||[]).push([[73],{1146:bt=>{"use strict";for(var N="qpzry9x8gf2tvdw0s3jn54khce6mua7l",M={},E=0;E<32;E++){var y=N.charAt(E);if(void 0!==M[y])throw new TypeError(y+" is ambiguous");M[y]=E}function _(L){var O=L>>25;return(33554431&L)<<5^996825010&-(1&O)^642813549&-(O>>1&1)^513874426&-(O>>2&1)^1027748829&-(O>>3&1)^705979059&-(O>>4&1)}function A(L){for(var O=1,dt=0;dt126)return"Invalid prefix ("+L+")";O=_(O)^G>>5}for(O=_(O),dt=0;dt(O=O||90))return"Exceeds length limit";var dt=L.toLowerCase(),G=L.toUpperCase();if(L!==dt&&L!==G)return"Mixed-case string "+L;var V=(L=dt).lastIndexOf("1");if(-1===V)return"No separator character for "+L;if(0===V)return"Missing prefix for "+L;var i=L.slice(0,V),ut=L.slice(V+1);if(ut.length<6)return"Data too short";var kt=A(i);if("string"==typeof kt)return kt;for(var Pt=[],ot=0;ot=ut.length)&&Pt.push(lt)}return 1!==kt?"Invalid checksum for "+L:{prefix:i,words:Pt}}function j(L,O,dt,G){for(var V=0,i=0,ut=(1<=dt;)kt.push(V>>(i-=dt)&ut);if(G)i>0&&kt.push(V<=O)return"Excess padding";if(V<(dt=dt||90))throw new TypeError("Exceeds length limit");var G=A(L=L.toLowerCase());if("string"==typeof G)throw new Error(G);for(var V=L+"1",i=0;i>5)throw new Error("Non 5-bit word");G=_(G)^ut,V+=N.charAt(ut)}for(i=0;i<6;++i)G=_(G);for(G^=1,i=0;i<6;++i)V+=N.charAt(G>>5*(5-i)&31);return V},toWordsUnsafe:function tt(L){var O=j(L,8,5,!0);if(Array.isArray(O))return O},toWords:function at(L){var O=j(L,8,5,!0);if(Array.isArray(O))return O;throw new Error(O)},fromWordsUnsafe:function K(L){var O=j(L,5,8,!1);if(Array.isArray(O))return O},fromWords:function nt(L){var O=j(L,5,8,!1);if(Array.isArray(O))return O;throw new Error(O)}}},2862:bt=>{"use strict";var N=Object.prototype.hasOwnProperty,M="~";function E(){}function y(C,I,B){this.fn=C,this.context=I,this.once=B||!1}function _(C,I,B,j,tt){if("function"!=typeof B)throw new TypeError("The listener must be a function");var at=new y(B,j||C,tt),K=M?M+I:I;return C._events[K]?C._events[K].fn?C._events[K]=[C._events[K],at]:C._events[K].push(at):(C._events[K]=at,C._eventsCount++),C}function A(C,I){0==--C._eventsCount?C._events=new E:delete C._events[I]}function m(){this._events=new E,this._eventsCount=0}Object.create&&(E.prototype=Object.create(null),(new E).__proto__||(M=!1)),m.prototype.eventNames=function(){var B,j,I=[];if(0===this._eventsCount)return I;for(j in B=this._events)N.call(B,j)&&I.push(M?j.slice(1):j);return Object.getOwnPropertySymbols?I.concat(Object.getOwnPropertySymbols(B)):I},m.prototype.listeners=function(I){var j=this._events[M?M+I:I];if(!j)return[];if(j.fn)return[j.fn];for(var tt=0,at=j.length,K=new Array(at);tt{"use strict";M.r(N),M.d(N,{default:()=>mu});var E={};M.r(E),M.d(E,{OG:()=>Nr,My:()=>vn,Ph:()=>Te,lX:()=>Br,Id:()=>cn,fg:()=>$i,qj:()=>Ee,aT:()=>yn,lq:()=>Xe,z:()=>Oi,Q5:()=>Dn});var y=M(467),_=M(5167),A=M(7403),m=M(177),C=M(9417),I=M(8834),B=M(1997),j=M(2102),tt=M(9213),at=M(9042),K=M(9115),nt=M(9183),L=M(450),O=M(4823),dt=M(9192),G=M(8865),V=M(3813),i=M(4438),ut=M(2577),kt=M(345);const Pt=["qrcElement"];let ot=(()=>{class e{constructor(t,r){this.renderer=t,this.sanitizer=r,this.allowEmptyString=!1,this.colorDark="#000000ff",this.colorLight="#ffffffff",this.cssClass="qrcode",this.elementType="canvas",this.errorCorrectionLevel="M",this.margin=4,this.qrdata="",this.scale=4,this.width=10,this.qrCodeURL=new i.bkB,this.context=null}ngOnChanges(){var t=this;return(0,y.A)(function*(){yield t.createQRCode()})()}isValidQrCodeText(t){return!1===this.allowEmptyString?!(typeof t>"u"||""===t||"null"===t||null===t):!(typeof t>"u")}toDataURL(t){return new Promise((r,o)=>{(0,ut.dY)(this.qrdata,t,(a,u)=>{a?o(a):r(u)})})}toCanvas(t,r){return new Promise((o,a)=>{(0,ut.mo)(t,this.qrdata,r,u=>{u?a(u):o("success")})})}toSVG(t){return new Promise((r,o)=>{(0,ut.toString)(this.qrdata,t,(a,u)=>{a?o(a):r(u)})})}renderElement(t){for(const r of this.qrcElement.nativeElement.childNodes)this.renderer.removeChild(this.qrcElement.nativeElement,r);this.renderer.appendChild(this.qrcElement.nativeElement,t)}createQRCode(){var t=this;return(0,y.A)(function*(){t.version&&t.version>40?(console.warn("[angularx-qrcode] max value for `version` is 40"),t.version=40):t.version&&t.version<1?(console.warn("[angularx-qrcode]`min value for `version` is 1"),t.version=1):void 0!==t.version&&isNaN(t.version)&&(console.warn("[angularx-qrcode] version should be a number, defaulting to auto."),t.version=void 0);try{if(!t.isValidQrCodeText(t.qrdata))throw new Error("[angularx-qrcode] Field `qrdata` is empty, set 'allowEmptyString=\"true\"' to overwrite this behaviour.");t.isValidQrCodeText(t.qrdata)&&""===t.qrdata&&(t.qrdata=" ");const r={color:{dark:t.colorDark,light:t.colorLight},errorCorrectionLevel:t.errorCorrectionLevel,margin:t.margin,scale:t.scale,version:t.version,width:t.width},o=t.imageSrc,a=t.imageHeight||40,u=t.imageWidth||40;switch(t.elementType){case"canvas":{const f=t.renderer.createElement("canvas");t.context=f.getContext("2d"),t.toCanvas(f,r).then(()=>{if(t.ariaLabel&&t.renderer.setAttribute(f,"aria-label",`${t.ariaLabel}`),t.title&&t.renderer.setAttribute(f,"title",`${t.title}`),o&&t.context){t.centerImage=new Image(u,a),o!==t.centerImage.src&&(t.centerImage.crossOrigin="anonymous",t.centerImage.src=o),a!==t.centerImage.height&&(t.centerImage.height=a),u!==t.centerImage.width&&(t.centerImage.width=u);const g=t.centerImage;g&&(g.onload=()=>{t.context?.drawImage(g,f.width/2-u/2,f.height/2-a/2,u,a)})}t.renderElement(f),t.emitQRCodeURL(f)}).catch(g=>{console.error("[angularx-qrcode] canvas error:",g)});break}case"svg":{const f=t.renderer.createElement("div");t.toSVG(r).then(g=>{t.renderer.setProperty(f,"innerHTML",g);const b=f.firstChild;t.renderer.setAttribute(b,"height",`${t.width}`),t.renderer.setAttribute(b,"width",`${t.width}`),t.renderElement(b),t.emitQRCodeURL(b)}).catch(g=>{console.error("[angularx-qrcode] svg error:",g)});break}default:{const f=t.renderer.createElement("img");t.toDataURL(r).then(g=>{t.alt&&f.setAttribute("alt",t.alt),t.ariaLabel&&f.setAttribute("aria-label",t.ariaLabel),f.setAttribute("src",g),t.title&&f.setAttribute("title",t.title),t.renderElement(f),t.emitQRCodeURL(f)}).catch(g=>{console.error("[angularx-qrcode] img/url error:",g)})}}}catch(r){console.error("[angularx-qrcode] Error generating QR Code:",r.message)}})()}convertBase64ImageUrlToBlob(t){const r=t.split(";base64,"),o=r[0].split(":")[1],a=atob(r[1]),u=new Uint8Array(a.length);for(let f=0;f{class e{static#t=this.\u0275fac=function(r){return new(r||e)};static#e=this.\u0275mod=i.$C({type:e});static#n=this.\u0275inj=i.G2t({})}return e})();var lt=M(7374),ht=M.n(lt),p=M(5164),s=M.n(p);ht().extend(s());class v{constructor(n=0,t=0,r=15){this.until=0,this.since=0,this.until=n,this.setDefaultUntil(),this.baseTimeDiff=r,this.originalBaseTimeDiff=this.baseTimeDiff,0===t?this.setDefaultSince():this.setDefaultSince(t),this.previousSince=t,this.previousUntil=n}incrementUserTimes(n){const t=n.at(-1);t?(this.revertBackToOriginalBaseTimeDiff(),this.setUntil(t.createdAt),this.setSince(t.createdAt)):(this.updateBaseTimeToFindPosts(),this.setDefaultUntil(),this.setDefaultSince())}resetFilterTimes(n=0){this.setDefaultSince(),this.setDefaultUntil(),0!==n&&(this.baseTimeDiff=n)}updateBaseTimeToFindPosts(){this.baseTimeDiff=10*this.baseTimeDiff}revertBackToOriginalBaseTimeDiff(){this.baseTimeDiff=this.originalBaseTimeDiff}getSinceAsDate(){return new Date(1e3*this.since)}getUntilAsDate(){return new Date(1e3*this.until)}getSinceFromNow(){const n=this.getSinceAsDate();return ht()(n).fromNow()}getUntilFromNow(){const n=this.getSinceAsDate();return ht()(n).fromNow()}printTimes(){const n=this.getUntilAsDate().getTime()-this.getSinceAsDate().getTime();console.log(`Until: ${this.getUntilFromNow()} | Since: ${this.getSinceFromNow()}`),console.log(`Diff: ${n}`)}printVars(){console.log(`Until: ${this.until}`),console.log(`Since: ${this.since}`),console.log(`baseTimeDiff: ${this.baseTimeDiff}`)}setDefaultSince(n=0){let t=new Date;const r=Math.floor(t.setMinutes(t.getMinutes()-this.baseTimeDiff-n)/1e3);this.since=r}setDefaultUntil(){this.until=Math.floor(Date.now()/1e3)}getNewSince(n,t=0){const r=new Date(1e3*n);return Math.floor(r.setMinutes(r.getMinutes()-this.baseTimeDiff-t)/1e3)}setUntil(n){this.previousUntil=this.until-2e3,this.until=n}setSince(n,t=0){this.previousSince=this.since,this.since=this.getNewSince(n,t)}}var k=M(7673),R=M(3726),w=M(1397),c=M(6354),x=M(8141),ft=M(5964),mt=M(3386);function gt(e,n,t,r){const o=window&&!!window.document&&window.document.documentElement;let a=o&&n?window:t;if(e&&(a=e&&o&&"string"==typeof e?function xt(e,n,t){return(t?window.document:n).querySelector(e)}(e,t.nativeElement,r):e,!a))throw new Error("ngx-infinite-scroll {resolveContainerElement()}: selector for");return a}function Mt(e){return e&&!e.firstChange}const Ut={clientHeight:"clientHeight",offsetHeight:"offsetHeight",scrollHeight:"scrollHeight",pageYOffset:"pageYOffset",offsetTop:"offsetTop",scrollTop:"scrollTop",top:"top"},Ct={clientHeight:"clientWidth",offsetHeight:"offsetWidth",scrollHeight:"scrollWidth",pageYOffset:"pageXOffset",offsetTop:"offsetLeft",scrollTop:"scrollLeft",top:"left"};class Tt{constructor(n=!0){this.vertical=n,this.propsMap=n?Ut:Ct}clientHeightKey(){return this.propsMap.clientHeight}offsetHeightKey(){return this.propsMap.offsetHeight}scrollHeightKey(){return this.propsMap.scrollHeight}pageYOffsetKey(){return this.propsMap.pageYOffset}offsetTopKey(){return this.propsMap.offsetTop}scrollTopKey(){return this.propsMap.scrollTop}topKey(){return this.propsMap.top}}function Yn(e){return["Window","global"].some(t=>Object.prototype.toString.call(e).includes(t))}function Ft(e,n){return e?n.document.documentElement:null}function zt(e,n){const t=function Zn({container:e,isWindow:n,axis:t}){const{offsetHeightKey:r,clientHeightKey:o}=qt(t);return Ht(e,n,r,o)}(n);return n.isWindow?function Kn(e,n,t){const{axis:r,container:o,isWindow:a}=t,{offsetHeightKey:u,clientHeightKey:f}=qt(r),g=e+Sn(Ft(a,o),r,a),b=Ht(n.nativeElement,a,u,f),S=function Xt(e,n,t){const r=n.topKey();if(e.getBoundingClientRect)return e.getBoundingClientRect()[r]+Sn(e,n,t)}(n.nativeElement,r,a)+b;return{height:e,scrolled:g,totalToScroll:S,isWindow:a}}(t,e,n):function Zt(e,n,t){const{axis:r,container:o}=t;return{height:e,scrolled:o[r.scrollTopKey()],totalToScroll:o[r.scrollHeightKey()],isWindow:!1}}(t,0,n)}function qt(e){return{offsetHeightKey:e.offsetHeightKey(),clientHeightKey:e.clientHeightKey()}}function Ht(e,n,t,r){if(isNaN(e[t])){const o=Ft(n,e);return o?o[r]:0}return e[t]}function Sn(e,n,t){const r=n.pageYOffsetKey(),o=n.scrollTopKey(),a=n.offsetTopKey();return isNaN(window.pageYOffset)?Ft(t,e)[o]:e.ownerDocument?e.ownerDocument.defaultView[r]:e[a]}function Jt(e,n={down:0,up:0},t){let r,o;if(e.totalToScroll<=0)return!1;const a=e.isWindow?e.scrolled:e.height+e.scrolled;return t?(r=(e.totalToScroll-a)/e.totalToScroll,o=(n?.down?n.down:0)/10):(r=e.scrolled/(e.scrolled+(e.totalToScroll-a)),o=(n?.up?n.up:0)/10),r<=o}class ne{constructor(n){this.lastScrollPosition=0,this.lastTotalToScroll=0,this.totalToScroll=0,this.triggered={down:0,up:0},Object.assign(this,n)}updateScrollPosition(n){return this.lastScrollPosition=n}updateTotalToScroll(n){this.lastTotalToScroll!==n&&(this.lastTotalToScroll=this.totalToScroll,this.totalToScroll=n)}updateScroll(n,t){this.updateScrollPosition(n),this.updateTotalToScroll(t)}updateTriggeredFlag(n,t){t?this.triggered.down=n:this.triggered.up=n}isTriggeredScroll(n,t){return t?this.triggered.down===n:this.triggered.up===n}}const $t={DOWN:"[NGX_ISE] DOWN",UP:"[NGX_ISE] UP"};function Qn(e){const{scrollDown:n,stats:{scrolled:t}}=e;return{type:n?$t.DOWN:$t.UP,payload:{currentScrollPosition:t}}}let oe=(()=>{class e{constructor(t,r){this.element=t,this.zone=r,this.scrolled=new i.bkB,this.scrolledUp=new i.bkB,this.infiniteScrollDistance=2,this.infiniteScrollUpDistance=1.5,this.infiniteScrollThrottle=150,this.infiniteScrollDisabled=!1,this.infiniteScrollContainer=null,this.scrollWindow=!0,this.immediateCheck=!1,this.horizontal=!1,this.alwaysCallback=!1,this.fromRoot=!1}ngAfterViewInit(){this.infiniteScrollDisabled||this.setup()}ngOnChanges({infiniteScrollContainer:t,infiniteScrollDisabled:r,infiniteScrollDistance:o}){const a=Mt(t),u=Mt(r),f=Mt(o),g=!u&&!this.infiniteScrollDisabled||u&&!r.currentValue||f;(a||u||f)&&(this.destroyScroller(),g&&this.setup())}ngOnDestroy(){this.destroyScroller()}setup(){(function St(){return typeof window<"u"})()&&this.zone.runOutsideAngular(()=>{this.disposeScroller=function re(e){const{scrollContainer:n,scrollWindow:t,element:r,fromRoot:o}=e,a=function Yt({windowElement:e,axis:n}){return function Kt(e,n){const t=e.isWindow||n&&!n.nativeElement?n:n.nativeElement;return{...e,container:t}}({axis:n,isWindow:Yn(e)},e)}({axis:new Tt(!e.horizontal),windowElement:gt(n,t,r,o)}),u=new ne({totalToScroll:zt(r,a).totalToScroll}),g={up:e.upDistance,down:e.downDistance};return function Jn(e){let n=(0,R.R)(e.container,"scroll");return e.throttle&&(n=n.pipe((0,mt.c)(e.throttle,void 0,{leading:!0,trailing:!0}))),n}({container:a.container,throttle:e.throttle}).pipe((0,w.Z)(()=>(0,k.of)(zt(r,a))),(0,c.T)(b=>function ie(e,n,t){const{scrollDown:r,fire:o}=function Xn(e,n,t){const r=function Qt(e,n){return eu.updateScroll(b.scrolled,b.totalToScroll)),(0,ft.p)(({fire:b,scrollDown:S,stats:{totalToScroll:T}})=>function Ye(e,n,t){return!!(e&&n||!t&&n)}(e.alwaysCallback,b,u.isTriggeredScroll(T,S))),(0,x.M)(({scrollDown:b,stats:{totalToScroll:S}})=>{u.updateTriggeredFlag(S,b)}),(0,c.T)(Qn))}({fromRoot:this.fromRoot,alwaysCallback:this.alwaysCallback,disable:this.infiniteScrollDisabled,downDistance:this.infiniteScrollDistance,element:this.element,horizontal:this.horizontal,scrollContainer:this.infiniteScrollContainer,scrollWindow:this.scrollWindow,throttle:this.infiniteScrollThrottle,upDistance:this.infiniteScrollUpDistance}).subscribe(t=>this.handleOnScroll(t))})}handleOnScroll({type:t,payload:r}){const o=t===$t.DOWN?this.scrolled:this.scrolledUp;(function se(e){return e.observed??e.observers.length>0})(o)&&this.zone.run(()=>o.emit(r))}destroyScroller(){this.disposeScroller&&this.disposeScroller.unsubscribe()}static#t=this.\u0275fac=function(r){return new(r||e)(i.rXU(i.aKT),i.rXU(i.SKi))};static#e=this.\u0275dir=i.FsC({type:e,selectors:[["","infiniteScroll",""],["","infinite-scroll",""],["","data-infinite-scroll",""]],inputs:{infiniteScrollDistance:"infiniteScrollDistance",infiniteScrollUpDistance:"infiniteScrollUpDistance",infiniteScrollThrottle:"infiniteScrollThrottle",infiniteScrollDisabled:"infiniteScrollDisabled",infiniteScrollContainer:"infiniteScrollContainer",scrollWindow:"scrollWindow",immediateCheck:"immediateCheck",horizontal:"horizontal",alwaysCallback:"alwaysCallback",fromRoot:"fromRoot"},outputs:{scrolled:"scrolled",scrolledUp:"scrolledUp"},standalone:!0,features:[i.OA$]})}return e})(),Cn=(()=>{class e{static#t=this.\u0275fac=function(r){return new(r||e)};static#e=this.\u0275mod=i.$C({type:e});static#n=this.\u0275inj=i.G2t({})}return e})();var Lt=M(1413),jt=M(6977),rn=M(2953);class ae{constructor(n,t,r,o,a,u,f=[]){this.username="",this.picture="/images/avatars/avatar-placeholder.png",this.replyCount=0,this.likeCount=0,this.zapCount=0,this.repostCount=0,this.likedByMe=!1,this.replies=[],this.likers=[],this.reposters=[],this.zappers=[],this.relatedEventIds=[],this.rootEventId="",this.replyToEventId="",this.mentions=[],this.hashtags=[],this.repostedByMe=!1,this.tags=[],this.isAReply=!1,this.kind=t,this.pubkey=r,this.content=o,this.noteId=a,this.createdAt=u,this.date=new Date(1e3*this.createdAt),this.fromNow=this.calculateTimeFromNow(this.date),this.tags=f,this.id=n}calculateTimeFromNow(n){const r=Math.floor(((new Date).getTime()-n.getTime())/1e3);return r<60?`${r} seconds ago`:r<3600?`${Math.floor(r/60)} minutes ago`:r<86400?`${Math.floor(r/3600)} hours ago`:r<2592e3?`${Math.floor(r/86400)} days ago`:r<31536e3?`${Math.floor(r/2592e3)} months ago`:`${Math.floor(r/31536e3)} years ago`}}var Dt=M(7442),hn=M(4412),Vt=M(6231),Gt=M(4930),An=M(2827);let Wt=(()=>{class e{constructor(t,r,o){this.relayService=t,this.signerService=r,this.metadataService=o,this.eventsSubject=new hn.t([]),this.isLoading=new hn.t(!1),this.lastLoadedEventTime=null,this.pageSize=10,this.noMoreEvents=new hn.t(!1),this.seenEventIds=new Set,this.likesMap=new Map,this.repliesMap=new Map,this.zapsMap=new Map,this.repostsMap=new Map,this.hasLikedMap=new Map,this.hasRepostedMap=new Map,this.jobQueue=[],this.isProcessingQueue=!1,this.myLikedNoteIds=[],this.clearEvents(),this.getMyLikes().then(()=>{}).catch(a=>{console.error("Failed to load user likes:",a)})}subscribeToEvents(t){var r=this;return(0,y.A)(function*(){yield r.relayService.ensureConnectedRelays();const o=r.relayService.getConnectedRelays().slice(0,3);if(!o||0===o.length)return void console.error("No connected relays available.");const a=[{kinds:[1],authors:t,limit:r.pageSize},{"#p":t,limit:1}];r.relayService.getPool().subscribeMany(o,a,{onevent:u=>{r.isReply(u)||r.handleNewOrUpdatedEvent(u);const f=r.getParentEventId(u);switch(f&&r.enqueueJob(f,"replies"),u.kind){case 7:r.enqueueJob(f,"likes");break;case 9735:r.enqueueJob(f,"zaps");break;case 6:r.enqueueJob(f,"reposts")}},oneose:()=>{}})})()}getParentEventId(t){const r=t.tags.find(o=>"e"===o[0]);return r?r[1]:null}handleNewOrUpdatedEvent(t){var r=this;return(0,y.A)(function*(){switch(t.kind){case 1:if(!r.seenEventIds.has(t.id)){r.seenEventIds.add(t.id);const o=yield r.createNewEvent(t),a=r.eventsSubject.getValue();r.eventsSubject.next([o,...a].sort((u,f)=>f.createdAt-u.createdAt)),r.updateEventInSubject(t.id)}break;case 7:r.handleLikeEvent(t);break;case 9735:r.handleZapEvent(t);break;case 6:r.handleRepostEvent(t);break;case 4:r.handleReplyEvent(t)}})()}handleLikeEvent(t){const r=t.tags.find(o=>"e"===o[0])?.[1];if(r){const a=this.eventsSubject.getValue().map(u=>(u.id===r&&(u.likeCount+=1,u.likers=[...u.likers||[],t.pubkey]),u));this.eventsSubject.next(a)}}handleZapEvent(t){const r=t.tags.find(o=>"e"===o[0])?.[1];if(r){const a=this.eventsSubject.getValue().map(u=>(u.id===r&&(u.zapCount+=1,u.zappers=[...u.zappers||[],t.pubkey]),u));this.eventsSubject.next(a)}}handleRepostEvent(t){const r=t.tags.find(o=>"e"===o[0])?.[1];if(r){const a=this.eventsSubject.getValue().map(u=>(u.id===r&&(u.repostCount+=1,u.reposters=[...u.reposters||[],t.pubkey]),u));this.eventsSubject.next(a)}}handleReplyEvent(t){var r=this;return(0,y.A)(function*(){const o=t.tags.find(a=>"e"===a[0])?.[1];if(o){const a=yield r.createNewEvent(t),f=r.eventsSubject.getValue().map(g=>(g.id===o&&(g.replyCount+=1,g.replies=[...g.replies||[],a]),g));r.eventsSubject.next(f)}})()}isReply(t){return t.tags.filter(o=>"e"===o[0]||"p"===o[0]).length>0}getMyLikes(){var t=this;return(0,y.A)(function*(){const r={kinds:[7],authors:[t.signerService.getPublicKey()]};try{return(yield t.fetchFilteredEvents(r)).forEach(a=>{const u=a.tags.find(f=>"e"===f[0]);u&&t.myLikedNoteIds.push(u[1])}),t.myLikedNoteIds}catch(o){return console.error("Failed to get user likes:",o),[]}})()}loadMoreEvents(t){var r=this;return(0,y.A)(function*(){if(r.isLoading.value||r.noMoreEvents.value)return;r.isLoading.next(!0);const o={authors:t,kinds:[1],until:r.lastLoadedEventTime||Math.floor(Date.now()/1e3),limit:r.pageSize};try{const a=yield r.fetchFilteredEvents(o);if(a.length0){r.lastLoadedEventTime=a[a.length-1].created_at;const u=a.filter(g=>!r.seenEventIds.has(g.id)&&!r.isReply(g));u.forEach(g=>r.seenEventIds.add(g.id));const f=yield Promise.all(u.map(g=>r.createNewEvent(g)));r.eventsSubject.next([...r.eventsSubject.getValue(),...f].sort((g,b)=>b.createdAt-g.createdAt))}else r.noMoreEvents.next(!0)}catch(a){console.error("Error loading more events:",a)}finally{r.isLoading.next(!1)}})()}fetchFilteredEvents(t){var r=this;return(0,y.A)(function*(){yield r.relayService.ensureConnectedRelays();const o=r.relayService.getConnectedRelays(),a=new Map,u=r.relayService.getPool();return yield Promise.all(o.map(function(){var f=(0,y.A)(function*(g){(yield u.querySync([g],t)).forEach(S=>{a.has(S.id)||a.set(S.id,S)})});return function(g){return f.apply(this,arguments)}}())),Array.from(a.values())})()}createNewEvent(t){var r=this;return(0,y.A)(function*(){const o=new ae(t.id,t.kind,t.pubkey,t.content,t.id,t.created_at,t.tags);r.enqueueJob(t.id,"replies"),r.enqueueJob(t.id,"likes"),r.enqueueJob(t.id,"reposts"),r.enqueueJob(t.id,"zaps"),yield r.processJobQueue(),o.likedByMe=r.myLikedNoteIds.includes(t.id);const a=yield r.metadataService.fetchMetadataWithCache(t.pubkey);return a&&(o.username=a.name||o.npub,o.picture=a.picture||"/images/avatars/avatar-placeholder.png"),o})()}enqueueJob(t,r){this.jobQueue.some(o=>o.eventId===t&&o.jobType===r)||(this.jobQueue.push({eventId:t,jobType:r}),this.isProcessingQueue||this.processJobQueue())}processJobQueue(){var t=this;return(0,y.A)(function*(){if(t.isProcessingQueue)return;t.isProcessingQueue=!0;const r=[];for(;t.jobQueue.length>0||r.length>0;){for(;t.jobQueue.length>0&&r.length<10;){const o=t.jobQueue.shift();if(!o)break;const a=t.processJob(o);r.push(a),a.then(()=>{r.splice(r.indexOf(a),1)}).catch(u=>{console.error("Error processing job:",u),r.splice(r.indexOf(a),1)})}yield Promise.race(r)}t.isProcessingQueue=!1})()}processJob(t){var r=this;return(0,y.A)(function*(){switch(t.jobType){case"replies":const o=yield r.fetchReplies(t.eventId);r.repliesMap.set(t.eventId,o);break;case"likes":const a=yield r.getLikers(t.eventId);r.likesMap.set(t.eventId,a);break;case"zaps":const u=yield r.getZappers(t.eventId);r.zapsMap.set(t.eventId,u);break;case"reposts":const f=yield r.getReposters(t.eventId);r.repostsMap.set(t.eventId,f)}r.updateEventInSubject(t.eventId)})()}updateEventInSubject(t){const o=this.eventsSubject.getValue().map(a=>(a.id===t&&(a.replyCount=this.getRepliesCount(t),a.replies=this.repliesMap.get(t)||[],a.likeCount=this.getLikesCount(t),a.likers=this.likesMap.get(t)||[],a.zapCount=this.getZapsCount(t),a.zappers=this.zapsMap.get(t)||[],a.repostCount=this.getRepostsCount(t),a.reposters=this.repostsMap.get(t)||[]),a));this.eventsSubject.next(o)}fetchReplies(t){var r=this;return(0,y.A)(function*(){const o={"#e":[t],kinds:[1]},a=yield r.fetchFilteredEvents(o),u=new Map;return a.forEach(f=>{u.has(f.id)||u.set(f.id,f)}),Promise.all(Array.from(u.values()).map(f=>r.createNewEvent(f)))})()}getLikers(t){var r=this;return(0,y.A)(function*(){const o={"#e":[t],kinds:[7]};return(yield r.fetchFilteredEvents(o)).map(u=>u.pubkey)})()}getZappers(t){var r=this;return(0,y.A)(function*(){const o={"#e":[t],kinds:[9735]};return(yield r.fetchFilteredEvents(o)).map(u=>u.pubkey)})()}getReposters(t){var r=this;return(0,y.A)(function*(){const o={"#e":[t],kinds:[6]};return(yield r.fetchFilteredEvents(o)).map(u=>u.pubkey)})()}getRepliesCount(t){return(this.repliesMap.get(t)||[]).length}getLikesCount(t){return(this.likesMap.get(t)||[]).length}getZapsCount(t){return(this.zapsMap.get(t)||[]).length}getRepostsCount(t){return(this.repostsMap.get(t)||[]).length}hasUserLiked(t){return this.hasLikedMap.get(t)||!1}hasUserReposted(t){return this.hasRepostedMap.get(t)||!1}getEventStream(){return this.eventsSubject.asObservable().pipe((0,mt.c)(1e3))}hasMoreEvents(){return this.noMoreEvents.asObservable()}sendTextEvent(t){var r=this;return(0,y.A)(function*(){if(t)try{const a=r.signerService.getUnsignedEvent(1,[],t);let u;if(r.signerService.isUsingSecretKey()){const f=yield r.signerService.getDecryptedSecretKey(),g=(0,rn.aT)(f);u=(0,Dt.pC)(a,g)}else u=yield r.signerService.signEventWithExtension(a);yield r.relayService.publishEventToWriteRelays(u)}catch(o){console.error("Failed to send text event:",o)}})()}sendLikeEvent(t){var r=this;return(0,y.A)(function*(){if(t)try{const u=r.signerService.getUnsignedEvent(7,[["e",t.id],["p",t.pubkey]],"+");let f;if(r.signerService.isUsingSecretKey()){const g=yield r.signerService.getDecryptedSecretKey(),b=(0,rn.aT)(g);f=(0,Dt.pC)(u,b)}else f=yield r.signerService.signEventWithExtension(u);yield r.relayService.publishEventToWriteRelays(f),r.likesMap.set(t.id,[...r.likesMap.get(t.id)||[],r.signerService.getPublicKey()]),r.hasLikedMap.set(t.id,!0)}catch(o){console.error("Failed to send like event:",o)}})()}sendZapEvent(t,r){var o=this;return(0,y.A)(function*(){if(t&&!(r<=0))try{const a=[["e",t.id],["p",t.pubkey],["amount",r.toString()]],f=o.signerService.getUnsignedEvent(9735,a,`Zapped with ${r} sats`);let g;if(o.signerService.isUsingSecretKey()){const b=yield o.signerService.getDecryptedSecretKey(),S=(0,rn.aT)(b);g=(0,Dt.pC)(f,S)}else g=yield o.signerService.signEventWithExtension(f);yield o.relayService.publishEventToWriteRelays(g)}catch(a){console.error("Failed to send zap event:",a)}})()}sendReplyEvent(t,r){var o=this;return(0,y.A)(function*(){if(t)try{const u=o.signerService.getUnsignedEvent(1,[["e",t.id],["p",t.pubkey]],r);let f;if(o.signerService.isUsingSecretKey()){const g=yield o.signerService.getDecryptedSecretKey(),b=(0,rn.aT)(g);f=(0,Dt.pC)(u,b)}else f=yield o.signerService.signEventWithExtension(u);yield o.relayService.publishEventToWriteRelays(f)}catch(a){console.error("Failed to send reply event:",a)}})()}clearEvents(){this.eventsSubject.next([]),this.seenEventIds.clear(),this.lastLoadedEventTime=null,this.noMoreEvents.next(!1)}static#t=this.\u0275fac=function(r){return new(r||e)(i.KVO(Vt.b),i.KVO(Gt.A),i.KVO(An.T))};static#e=this.\u0275prov=i.jDH({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var le=M(413);const tr=e=>({"heart-beat":e}),ce=e=>({"rotate-180":e});function ue(e,n){if(1&e){const t=i.RV6();i.j41(0,"div",53)(1,"emoji-mart",54),i.bIt("emojiClick",function(o){i.eBV(t);const a=i.XpG().index,u=i.XpG();return i.Njj(u.addEmojiToComment(o,a))}),i.k0s()()}if(2&e){const t=i.XpG(2);i.R7$(),i.Y8G("darkMode",t.darkMode)}}function er(e,n){if(1&e&&(i.j41(0,"div",55),i.nrm(1,"img",56),i.j41(2,"div",57)(3,"span")(4,"b"),i.EFF(5),i.k0s(),i.EFF(6),i.k0s(),i.j41(7,"div",58)(8,"span",59),i.EFF(9,"Like"),i.k0s(),i.j41(10,"span",59),i.EFF(11,"Reply"),i.k0s(),i.j41(12,"span",59),i.EFF(13,"Hide replies"),i.k0s(),i.j41(14,"span",60),i.EFF(15,"\u2022"),i.k0s(),i.j41(16,"span"),i.EFF(17),i.k0s()()()()),2&e){const t=n.$implicit,r=i.XpG(2);i.R7$(),i.FS9("alt",t.username),i.Y8G("src",t.picture||"images/avatars/avatar-placeholder.png",i.B4B),i.R7$(4),i.SpI("",t.username,": "),i.R7$(),i.SpI(" ",t.content," "),i.R7$(11),i.JRh(r.getTimeFromNow(t))}}function fe(e,n){if(1&e){const t=i.RV6();i.j41(0,"angor-card",7,0)(2,"div",8),i.nrm(3,"img",9),i.j41(4,"div",10)(5,"span",11),i.EFF(6),i.k0s(),i.j41(7,"span",12),i.EFF(8),i.k0s()(),i.j41(9,"button",13),i.nrm(10,"mat-icon",14),i.k0s(),i.j41(11,"mat-menu",null,1)(13,"button",15)(14,"span",16),i.nrm(15,"mat-icon",17),i.j41(16,"span"),i.EFF(17,"Save post"),i.k0s()()(),i.j41(18,"button",15)(19,"span",16),i.nrm(20,"mat-icon",17),i.j41(21,"span"),i.EFF(22,"Hide post"),i.k0s()()(),i.j41(23,"button",15)(24,"span",16),i.nrm(25,"mat-icon",17),i.j41(26,"span"),i.EFF(27,"Snooze for 30 days"),i.k0s()()(),i.j41(28,"button",15)(29,"span",16),i.nrm(30,"mat-icon",17),i.j41(31,"span"),i.EFF(32,"Hide all"),i.k0s()()(),i.nrm(33,"mat-divider",18),i.j41(34,"button",15)(35,"span",16),i.nrm(36,"mat-icon",17),i.j41(37,"span"),i.EFF(38,"Report post"),i.k0s()()(),i.j41(39,"button",15)(40,"span",16),i.nrm(41,"mat-icon",17),i.j41(42,"span"),i.EFF(43,"Turn on notifications for this post"),i.k0s()()()()(),i.nrm(44,"div",19)(45,"div",20),i.j41(46,"div",21)(47,"button",22),i.bIt("click",function(){const o=i.eBV(t).$implicit,a=i.XpG();return i.Njj(a.toggleLike(o))}),i.nrm(48,"mat-icon",23),i.j41(49,"span",24),i.EFF(50),i.k0s()(),i.j41(51,"button",22),i.bIt("click",function(){i.eBV(t);const o=i.sdS(1);return i.Njj(o.expanded=!o.expanded)}),i.nrm(52,"mat-icon",14),i.j41(53,"span",24),i.EFF(54,"Comment"),i.k0s()(),i.j41(55,"button",25),i.nrm(56,"mat-icon",14),i.j41(57,"span",24),i.EFF(58,"Share"),i.k0s()()(),i.nrm(59,"hr",26),i.j41(60,"div",27)(61,"div",16),i.nrm(62,"img",28)(63,"img",29)(64,"img",29)(65,"img",29),i.j41(66,"div",30),i.EFF(67),i.k0s()(),i.nrm(68,"div",31),i.j41(69,"div",32)(70,"button",33),i.EFF(71),i.k0s(),i.j41(72,"button",34),i.bIt("click",function(){i.eBV(t);const o=i.sdS(1);return i.Njj(o.expanded=!o.expanded)}),i.j41(73,"span",35),i.EFF(74),i.k0s(),i.nrm(75,"mat-icon",36),i.k0s()()(),i.qex(76,37),i.nrm(77,"hr",38),i.j41(78,"div",39)(79,"div",40),i.nrm(80,"img",41),i.j41(81,"mat-form-field",42)(82,"textarea",43),i.bIt("ngModelChange",function(o){const a=i.eBV(t).index,u=i.XpG();return i.Njj(u.setComment(a,o))}),i.EFF(83," "),i.k0s()()(),i.j41(84,"div",44)(85,"div",16)(86,"button",45),i.bIt("click",function(){const o=i.eBV(t).index,a=i.XpG();return i.Njj(a.toggleCommentEmojiPicker(o))}),i.nrm(87,"mat-icon",14),i.k0s(),i.DNE(88,ue,2,1,"div",46),i.j41(89,"button",47),i.nrm(90,"mat-icon",14),i.k0s(),i.j41(91,"button",47),i.nrm(92,"mat-icon",14),i.k0s()(),i.j41(93,"button",48),i.bIt("click",function(){const o=i.eBV(t),a=o.$implicit,u=o.index,f=i.XpG();return i.Njj(f.sendComment(a,u))}),i.nrm(94,"mat-icon",49),i.j41(95,"span"),i.EFF(96,"Send"),i.k0s()()()(),i.j41(97,"div",50)(98,"div",51),i.DNE(99,er,18,5,"div",52),i.k0s()(),i.bVm(),i.k0s()}if(2&e){const t=n.$implicit,r=n.index,o=i.sdS(1),a=i.sdS(12),u=i.XpG();i.R7$(3),i.FS9("alt",t.username),i.Y8G("src",t.picture||"images/avatars/avatar-placeholder.png",i.B4B),i.R7$(3),i.JRh(t.username),i.R7$(2),i.JRh(u.getTimeFromNow(t)),i.R7$(),i.Y8G("matMenuTriggerFor",a),i.R7$(),i.Y8G("svgIcon","heroicons_solid:ellipsis-vertical"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:arrow-up-tray"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:eye-slash"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:clock"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:minus-circle"),i.R7$(6),i.Y8G("svgIcon","heroicons_solid:exclamation-triangle"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:bell"),i.R7$(3),i.Y8G("innerHTML",u.parseContent.parseContent(t.content),i.npT),i.R7$(4),i.Y8G("ngClass",i.eq3(33,tr,t.likedByMe))("svgIcon",t.likedByMe?"heroicons_solid:heart":"heroicons_outline:heart"),i.R7$(2),i.SpI("",t.likeCount," Like"),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:chat-bubble-left-ellipsis"),i.R7$(4),i.Y8G("svgIcon","heroicons_solid:share"),i.R7$(11),i.SpI(" \u26a1 ",t.zapCount," zap "),i.R7$(4),i.SpI(" ",t.repostCount," shares "),i.R7$(3),i.SpI("",t.replyCount," Comments"),i.R7$(),i.Y8G("ngClass",i.eq3(35,ce,o.expanded))("svgIcon","heroicons_mini:chevron-down"),i.R7$(5),i.FS9("alt",(null==u.currentUserMetadata?null:u.currentUserMetadata.display_name)||(null==u.currentUserMetadata?null:u.currentUserMetadata.name)||"Avatar"),i.Y8G("src",(null==u.currentUserMetadata?null:u.currentUserMetadata.picture)||"images/avatars/avatar-placeholder.png",i.B4B),i.R7$(),i.Y8G("subscriptSizing","dynamic"),i.R7$(),i.Y8G("ngModel",u.getComment(r)),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:face-smile"),i.R7$(),i.Y8G("ngIf",null==u.eventStates[r]?null:u.eventStates[r].showEmojiPicker),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:photo"),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:sparkles"),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:paper-airplane"),i.R7$(5),i.Y8G("ngForOf",t.replies)}}function he(e,n){1&e&&(i.j41(0,"div",61),i.nrm(1,"div",62),i.EFF(2," Loading events...\n"),i.k0s())}function nr(e,n){if(1&e){const t=i.RV6();i.j41(0,"button",63),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.loadMoreEvents())}),i.EFF(1," Load More Events "),i.k0s()}}function de(e,n){1&e&&(i.j41(0,"div",64),i.EFF(1,"No more events to load."),i.k0s())}let me=(()=>{class e{constructor(t,r,o,a){this.paginatedEventService=t,this.changeDetectorRef=r,this.sanitizer=o,this.parseContent=a,this.pubkeys=[],this.eventStates=[],this.subscriptions=[],this.isLoading=!1,this.noMoreEvents=!1,this.events$=this.paginatedEventService.getEventStream()}ngOnInit(){this.resetAll()}subscribeToEvents(){if(this.unsubscribeAll(),!this.pubkeys||0===this.pubkeys.length)return void console.warn("No public keys provided");this.paginatedEventService.subscribeToEvents(this.pubkeys).then(()=>{console.log("Subscribed to events for the new user.")}).catch(r=>{console.error("Error subscribing to events:",r)});const t=this.events$.subscribe(r=>{const o=r.filter(a=>this.pubkeys.includes(a.pubkey));this.eventStates=o.map(()=>({showEmojiPicker:!1,comment:""})),this.changeDetectorRef.markForCheck()});this.subscriptions.push(t)}resetAll(){this.unsubscribeAll(),this.clearComponentState(),this.paginatedEventService.clearEvents(),this.subscribeToEvents(),this.loadInitialEvents()}unsubscribeAll(){this.subscriptions.forEach(t=>t.unsubscribe()),this.subscriptions=[]}clearComponentState(){this.eventStates=[],this.isLoading=!1,this.noMoreEvents=!1,this.changeDetectorRef.markForCheck()}loadInitialEvents(){0!==this.pubkeys.length?(this.isLoading=!0,this.paginatedEventService.loadMoreEvents(this.pubkeys).finally(()=>{this.isLoading=!1,this.changeDetectorRef.markForCheck()})):console.warn("No pubkeys provided")}loadMoreEvents(){!this.isLoading&&!this.noMoreEvents&&(this.isLoading=!0,this.paginatedEventService.loadMoreEvents(this.pubkeys).finally(()=>{this.isLoading=!1,this.changeDetectorRef.markForCheck()}))}getComment(t){return this.eventStates[t]?.comment||""}setComment(t,r){this.eventStates[t]&&(this.eventStates[t].comment=r)}getSanitizedContent(t){return this.sanitizer.bypassSecurityTrustHtml(t)}sendLike(t){t.likedByMe||this.paginatedEventService.sendLikeEvent(t).then(()=>{t.likedByMe=!0,t.likeCount++,this.changeDetectorRef.markForCheck()}).catch(r=>console.error("Failed to send like:",r))}toggleLike(t){this.sendLike(t)}toggleCommentEmojiPicker(t){this.eventStates[t].showEmojiPicker=!this.eventStates[t].showEmojiPicker}addEmojiToComment(t,r){this.eventStates[r].comment+=t.emoji.native,this.eventStates[r].showEmojiPicker=!1}sendComment(t,r){const o=this.eventStates[r].comment;""!==o.trim()&&this.paginatedEventService.sendReplyEvent(t,o).then(()=>{this.eventStates[r].comment="",this.changeDetectorRef.markForCheck()})}trackById(t,r){return r.id}ngOnDestroy(){this.unsubscribeAll()}getTimeFromNow(t){return t.fromNow}static#t=this.\u0275fac=function(r){return new(r||e)(i.rXU(Wt),i.rXU(i.gRc),i.rXU(kt.up),i.rXU(le.m))};static#e=this.\u0275cmp=i.VBU({type:e,selectors:[["app-event-list"]],inputs:{pubkeys:"pubkeys",currentUserMetadata:"currentUserMetadata"},standalone:!0,features:[i.aNF],decls:6,vars:9,consts:[["expandableComments","angorCard"],["postCardMenu02","matMenu"],["infiniteScroll","",1,"",3,"scrolled","infiniteScrollDistance","infiniteScrollThrottle","scrollWindow"],["class","mb-8 flex w-full flex-col",4,"ngFor","ngForOf"],["class","loading-spinner",4,"ngIf"],["class","load-more-btn",3,"click",4,"ngIf"],["class","no-more-events",4,"ngIf"],[1,"mb-8","flex","w-full","flex-col"],[1,"mx-6","mb-4","mt-6","flex","items-center","sm:mx-8"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"mr-4","h-10","w-10","rounded-full",3,"src","alt"],[1,"flex","flex-col"],[1,"font-semibold","leading-none"],[1,"text-secondary","mt-1","text-sm","leading-none"],["mat-icon-button","",1,"-mr-4","ml-auto",3,"matMenuTriggerFor"],[1,"icon-size-5",3,"svgIcon"],["mat-menu-item",""],[1,"flex","items-center"],[1,"mr-3","icon-size-5",3,"svgIcon"],[1,"my-2"],[1,"mx-6","mb-6","mt-2","sm:mx-8",3,"innerHTML"],[1,"relative","mb-4"],[1,"mx-3","flex","items-center","sm:mx-5"],["mat-button","",1,"mr-1","px-3",3,"click"],[1,"text-red-500","icon-size-5",3,"ngClass","svgIcon"],[1,"ml-2"],["mat-button","",1,"mr-1","px-3"],[1,"mx-6","mb-6","mt-4","border-b","sm:mx-8"],[1,"mx-6","mb-4","flex","flex-col","sm:mx-8","sm:mb-6","sm:flex-row","sm:items-center"],["src","images/avatars/avatar-placeholder.png","alt","Card cover image",1,"text-card","m-0.5","h-6","w-6","rounded-full","ring-2","ring-white"],["src","images/avatars/avatar-placeholder.png","alt","Card cover image",1,"text-card","m-0.5","-ml-3","h-6","w-6","rounded-full","ring-2","ring-white"],[1,"ml-3","text-md","tracking-tight"],[1,"hidden","flex-auto","sm:flex"],[1,"mt-4","flex","items-center","sm:mt-0"],["mat-button","",1,"-ml-2","mr-1","px-3","sm:ml-0"],["mat-button","",1,"px-3","sm:-mr-4",3,"click"],[1,"mr-1"],[1,"rotate-0","transition-transform","duration-150","ease-in-out","icon-size-5",3,"ngClass","svgIcon"],["angorCardExpansion",""],[1,"m-0","border-b"],[1,"mx-4","mb-3","mt-6","flex","flex-col","sm:mx-8"],[1,"flex","items-start"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"mr-5","h-12","w-12","rounded-full","object-cover",3,"src","alt"],[1,"w-full",3,"subscriptSizing"],["placeholder","Write a comment...","matInput","",3,"ngModelChange","ngModel"],[1,"mt-3","flex","items-center","justify-between"],["mat-icon-button","",3,"click"],["class","emoji-picker-container-global",4,"ngIf"],["mat-icon-button",""],["mat-button","",3,"click"],[3,"svgIcon"],[1,"max-h-120","overflow-y-auto"],[1,"relative","mx-4","my-6","flex","flex-col","sm:mx-8"],["class","flex items-start mb-4",4,"ngFor","ngForOf"],[1,"emoji-picker-container-global"],[3,"emojiClick","darkMode"],[1,"flex","items-start","mb-4"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"mr-4","h-8","w-8","rounded-full",3,"src","alt"],[1,"mt-0.5","flex","flex-col"],[1,"text-secondary","mt-2","flex","items-center","text-sm"],[1,"mr-2","cursor-pointer","hover:underline"],[1,"mr-2"],[1,"loading-spinner"],[1,"spinner"],[1,"load-more-btn",3,"click"],[1,"no-more-events"]],template:function(r,o){1&r&&(i.j41(0,"div",2),i.bIt("scrolled",function(){return o.loadMoreEvents()}),i.DNE(1,fe,100,37,"angor-card",3),i.nI1(2,"async"),i.DNE(3,he,3,0,"div",4)(4,nr,2,0,"button",5),i.k0s(),i.DNE(5,de,2,0,"div",6)),2&r&&(i.Y8G("infiniteScrollDistance",2)("infiniteScrollThrottle",500)("scrollWindow",!0),i.R7$(),i.Y8G("ngForOf",i.bMT(2,7,o.events$)),i.R7$(2),i.Y8G("ngIf",o.isLoading),i.R7$(),i.Y8G("ngIf",!o.noMoreEvents&&!o.isLoading),i.R7$(),i.Y8G("ngIf",o.noMoreEvents))},dependencies:[_.n,tt.m_,tt.An,I.Hl,I.$z,I.iY,K.Cn,K.kk,K.fb,K.Cp,j.RG,j.rl,at.fS,at.fg,A.EE,B.w,B.q,O.uc,m.YU,m.MD,m.Sq,m.bT,m.Jj,C.YN,C.me,C.BC,C.vS,it,G.Ic,nt.D6,Cn,oe],styles:[":host{display:block;max-width:600px;margin:0 auto;font-family:Arial,sans-serif}.loading-spinner{display:flex;justify-content:center;align-items:center;margin:20px 0}.loading-spinner .spinner{border:4px solid rgba(0,0,0,.1);border-left-color:#009fb5;border-radius:50%;width:30px;height:30px;animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.event-list{list-style:none;padding:0;margin:20px 0}.event-list .event-item{background-color:#fff;border-radius:10px;padding:15px;margin-bottom:10px;box-shadow:0 2px 8px #0000001a;transition:box-shadow .3s ease}.event-list .event-item:hover{box-shadow:0 4px 16px #0003}.event-list .event-item .event-header{display:flex;align-items:center}.event-list .event-item .event-header .profile-picture{width:40px;height:40px;border-radius:50%;margin-right:10px;border:2px solid #009fb5}.event-list .event-item .event-header .event-info .username{font-weight:700;color:#333}.event-list .event-item .event-header .event-info .timestamp{font-size:.9em;color:#888}.event-list .event-item .event-content{margin:10px 0;font-size:1.1em;color:#555}.event-list .event-item .event-actions{display:flex;gap:10px;margin-top:10px}.event-list .event-item .event-actions button{background-color:transparent;border:none;cursor:pointer;color:#009fb5;font-size:1.1em;transition:color .2s ease}.event-list .event-item .event-actions button:hover{color:#007f91}.event-list .event-item .event-actions button:disabled{color:#999;cursor:not-allowed}.event-list .event-item .event-replies{margin-top:15px;border-top:1px solid #e0e0e0;padding-top:10px}.event-list .event-item .event-replies ul{list-style:none;padding:0}.event-list .event-item .event-replies ul .reply-item{margin:5px 0;font-size:.9em}.event-list .event-item .event-replies ul .reply-item .reply-username{font-weight:700;color:#009fb5}.event-list .event-item .event-replies ul .reply-item .reply-content{color:#555}.no-more-events{text-align:center;color:#555;margin:20px 0;font-size:1.1em}.load-more-btn{display:block;width:100%;padding:10px;font-size:1.1em;background-color:#009fb5;color:#fff;border:none;border-radius:5px;cursor:pointer;transition:background-color .3s ease}.load-more-btn:hover{background-color:#007f91}.load-more-btn:focus{outline:none}\n"],encapsulation:2,changeDetection:0})}return e})();var Ce=M(5351),dn=M(2798),mn=M(882);function gn(e,n){this.v=e,this.k=n}function In(e){return new gn(e,0)}function qe(e){var n,t;function r(a,u){try{var f=e[a](u),g=f.value,b=g instanceof gn;Promise.resolve(b?g.v:g).then(function(S){if(b){var T="return"===a?"return":"next";if(!g.k||S.done)return r(T,S);S=e[T](S).value}o(f.done?"return":"normal",S)},function(S){r("throw",S)})}catch(S){o("throw",S)}}function o(a,u){switch(a){case"return":n.resolve({value:u,done:!0});break;case"throw":n.reject(u);break;default:n.resolve({value:u,done:!1})}(n=n.next)?r(n.key,n.arg):t=null}this._invoke=function(a,u){return new Promise(function(f,g){var b={key:a,arg:u,resolve:f,reject:g,next:null};t?t=t.next=b:(n=t=b,r(a,u))})},"function"!=typeof e.return&&(this.return=void 0)}function on(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function pn(e,...n){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(n.length>0&&!n.includes(e.length))throw new Error(`Expected Uint8Array of length ${n}, not of length=${e.length}`)}M(2862),qe.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},qe.prototype.next=function(e){return this._invoke("next",e)},qe.prototype.throw=function(e){return this._invoke("throw",e)},qe.prototype.return=function(e){return this._invoke("return",e)};const Ae={number:on,bool:function Nn(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)},bytes:pn,hash:function Pn(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");on(e.outputLen),on(e.blockLen)},exists:function Ln(e,n=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(n&&e.finished)throw new Error("Hash#digest() has already been called")},output:function Un(e,n){pn(e);const t=n.outputLen;if(e.lengthe instanceof Uint8Array,Rr=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),De=(e,n)=>e<<32-n|e>>>n;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");const hs=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function Ie(e){if(!an(e))throw new Error("Uint8Array expected");let n="";for(let t=0;tr+o.length,0));let t=0;return e.forEach(r=>{if(!an(r))throw new Error("Uint8Array expected");n.set(r,t),t+=r.length}),n}class Pi{clone(){return this._cloneInto()}}function Li(e){const n=r=>e().update(ln(r)).digest(),t=e();return n.outputLen=t.outputLen,n.blockLen=t.blockLen,n.create=()=>e(),n}function or(e=32){if(sn&&"function"==typeof sn.getRandomValues)return sn.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}class vs extends Pi{constructor(n,t,r,o){super(),this.blockLen=n,this.outputLen=t,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(n),this.view=Rr(this.buffer)}update(n){Ae.exists(this);const{view:t,buffer:r,blockLen:o}=this,a=(n=ln(n)).length;for(let u=0;uo-u&&(this.process(r,0),u=0);for(let T=u;T>o&a),f=Number(t&a),b=r?0:4;e.setUint32(n+(r?4:0),u,r),e.setUint32(n+b,f,r)})(r,o-8,BigInt(8*this.length),a),this.process(r,0);const f=Rr(n),g=this.outputLen;if(g%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const b=g/4,S=this.get();if(b>S.length)throw new Error("_sha2: outputLen bigger than state");for(let T=0;Te&n^~e&t,ws=(e,n,t)=>e&n^e&t^n&t,bs=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]),Ke=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ze=new Uint32Array(64);class Ui extends vs{constructor(){super(64,32,8,!1),this.A=0|Ke[0],this.B=0|Ke[1],this.C=0|Ke[2],this.D=0|Ke[3],this.E=0|Ke[4],this.F=0|Ke[5],this.G=0|Ke[6],this.H=0|Ke[7]}get(){const{A:n,B:t,C:r,D:o,E:a,F:u,G:f,H:g}=this;return[n,t,r,o,a,u,f,g]}set(n,t,r,o,a,u,f,g){this.A=0|n,this.B=0|t,this.C=0|r,this.D=0|o,this.E=0|a,this.F=0|u,this.G=0|f,this.H=0|g}process(n,t){for(let T=0;T<16;T++,t+=4)Ze[T]=n.getUint32(t,!1);for(let T=16;T<64;T++){const $=Ze[T-15],D=Ze[T-2],U=De($,7)^De($,18)^$>>>3,P=De(D,17)^De(D,19)^D>>>10;Ze[T]=P+Ze[T-7]+U+Ze[T-16]|0}let{A:r,B:o,C:a,D:u,E:f,F:g,G:b,H:S}=this;for(let T=0;T<64;T++){const D=S+(De(f,6)^De(f,11)^De(f,25))+ys(f,g,b)+bs[T]+Ze[T]|0,P=(De(r,2)^De(r,13)^De(r,22))+ws(r,o,a)|0;S=b,b=g,g=f,f=u+D|0,u=a,a=o,o=r,r=D+P|0}r=r+this.A|0,o=o+this.B|0,a=a+this.C|0,u=u+this.D|0,f=f+this.E|0,g=g+this.F|0,b=b+this.G|0,S=S+this.H|0,this.set(r,o,a,u,f,g,b,S)}roundClean(){Ze.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class _s extends Ui{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const He=Li(()=>new Ui),sr=(Li(()=>new _s),BigInt(0),BigInt(1)),xs=BigInt(2),ar=e=>e instanceof Uint8Array,Es=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function vn(e){if(!ar(e))throw new Error("Uint8Array expected");let n="";for(let t=0;tr+o.length,0));let t=0;return e.forEach(r=>{if(!ar(r))throw new Error("Uint8Array expected");n.set(r,t),t+=r.length}),n}const Nr=e=>(xs<new Uint8Array(e),Fi=e=>Uint8Array.from(e);function $i(e,n,t){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof n||n<2)throw new Error("qByteLen must be a number");if("function"!=typeof t)throw new Error("hmacFn must be a function");let r=Pr(e),o=Pr(e),a=0;const u=()=>{r.fill(1),o.fill(0),a=0},f=(...T)=>t(o,r,...T),g=(T=Pr())=>{o=f(Fi([0]),T),r=f(),0!==T.length&&(o=f(Fi([1]),T),r=f())},b=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let T=0;const $=[];for(;T{let D;for(u(),g(T);!(D=$(b()));)g();return u(),D}}const Ms={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,n)=>n.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function Dn(e,n,t={}){const r=(o,a,u)=>{const f=Ms[a];if("function"!=typeof f)throw new Error(`Invalid validator "${a}", expected function`);const g=e[o];if(!(u&&void 0===g||f(g,e)))throw new Error(`Invalid param ${String(o)}=${g} (${typeof g}), expected ${a}`)};for(const[o,a]of Object.entries(n))r(o,a,!1);for(const[o,a]of Object.entries(t))r(o,a,!0);return e}const be=BigInt(0),Ot=BigInt(1),Je=BigInt(2),Ss=BigInt(3),Lr=BigInt(4),Gi=BigInt(5),zi=BigInt(8);function _e(e,n){const t=e%n;return t>=be?t:n+t}function Ts(e,n,t){if(t<=be||n 0");if(t===Ot)return be;let r=Ot;for(;n>be;)n&Ot&&(r=r*e%t),e=e*e%t,n>>=Ot;return r}function Pe(e,n,t){let r=e;for(;n-- >be;)r*=r,r%=t;return r}function lr(e,n){if(e===be||n<=be)throw new Error(`invert: expected positive integers, got n=${e} mod=${n}`);let t=_e(e,n),r=n,o=be,a=Ot,u=Ot,f=be;for(;t!==be;){const b=r/t,S=r%t,T=o-u*b,$=a-f*b;r=t,t=S,o=u,a=f,u=T,f=$}if(r!==Ot)throw new Error("invert: does not exist");return _e(o,n)}BigInt(9),BigInt(16);const Bs=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ur(e,n){const t=void 0!==n?n:e.toString(2).length;return{nBitLength:t,nByteLength:Math.ceil(t/8)}}const Ds=BigInt(0),jr=BigInt(1);function qi(e){return function Ns(e){Dn(e,Bs.reduce((r,o)=>(r[o]="function",r),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"}))}(e.Fp),Dn(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ur(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}const{Ph:$s,aT:Gs}=E,un={Err:class extends Error{constructor(n=""){super(n)}},_parseInt(e){const{Err:n}=un;if(e.length<2||2!==e[0])throw new n("Invalid signature integer tag");const t=e[1],r=e.subarray(2,t+2);if(!t||r.length!==t)throw new n("Invalid signature integer: wrong length");if(128&r[0])throw new n("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new n("Invalid signature integer: unnecessary leading zero");return{d:$s(r),l:e.subarray(t+2)}},toSig(e){const{Err:n}=un,t="string"==typeof e?Gs(e):e;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let r=t.length;if(r<2||48!=t[0])throw new n("Invalid signature tag");if(t[1]!==r-2)throw new n("Invalid signature: incorrect length");const{d:o,l:a}=un._parseInt(t.subarray(2)),{d:u,l:f}=un._parseInt(a);if(f.length)throw new n("Invalid signature: left bytes after parsing");return{r:o,s:u}},hexFromSig(e){const n=b=>8&Number.parseInt(b[0],16)?"00"+b:b,t=b=>{const S=b.toString(16);return 1&S.length?`0${S}`:S},r=n(t(e.s)),o=n(t(e.r)),a=r.length/2,u=o.length/2,f=t(a),g=t(u);return`30${t(u+a+4)}02${g}${o}02${f}${r}`}},je=BigInt(0),ge=BigInt(1),cr=(BigInt(2),BigInt(3));function Hs(e){const n=function qs(e){const n=qi(e);return Dn(n,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...n})}(e),{Fp:t,n:r}=n,o=t.BYTES+1,a=2*t.BYTES+1;function f(H){return _e(H,r)}function g(H){return lr(H,r)}const{ProjectivePoint:b,normPrivateKeyToScalar:S,weierstrassEquation:T,isWithinCurveOrder:$}=function zs(e){const n=function Fs(e){const n=qi(e);Dn(n,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:r,a:o}=n;if(t){if(!r.eql(o,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof t||"bigint"!=typeof t.beta||"function"!=typeof t.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...n})}(e),{Fp:t}=n,r=n.toBytes||((U,P,F)=>{const z=P.toAffine();return cn(Uint8Array.from([4]),t.toBytes(z.x),t.toBytes(z.y))}),o=n.fromBytes||(U=>{const P=U.subarray(1);return{x:t.fromBytes(P.subarray(0,t.BYTES)),y:t.fromBytes(P.subarray(t.BYTES,2*t.BYTES))}});function a(U){const{a:P,b:F}=n,z=t.sqr(U),W=t.mul(z,U);return t.add(t.add(W,t.mul(U,P)),F)}if(!t.eql(t.sqr(n.Gy),a(n.Gx)))throw new Error("bad generator point: equation left != right");function u(U){return"bigint"==typeof U&&jet.eql(J,t.ZERO);return W(F)&&W(z)?T.ZERO:new T(F,z,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(P){const F=t.invertBatch(P.map(z=>z.pz));return P.map((z,W)=>z.toAffine(F[W])).map(T.fromAffine)}static fromHex(P){const F=T.fromAffine(o(Ee("pointHex",P)));return F.assertValidity(),F}static fromPrivateKey(P){return T.BASE.multiply(g(P))}_setWindowSize(P){this._WINDOW_SIZE=P,b.delete(this)}assertValidity(){if(this.is0()){if(n.allowInfinityPoint)return;throw new Error("bad point: ZERO")}const{x:P,y:F}=this.toAffine();if(!t.isValid(P)||!t.isValid(F))throw new Error("bad point: x or y not FE");const z=t.sqr(F),W=a(P);if(!t.eql(z,W))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:P}=this.toAffine();if(t.isOdd)return!t.isOdd(P);throw new Error("Field doesn't support isOdd")}equals(P){S(P);const{px:F,py:z,pz:W}=this,{px:J,py:Y,pz:rt}=P,q=t.eql(t.mul(F,rt),t.mul(J,W)),Z=t.eql(t.mul(z,rt),t.mul(Y,W));return q&&Z}negate(){return new T(this.px,t.neg(this.py),this.pz)}double(){const{a:P,b:F}=n,z=t.mul(F,cr),{px:W,py:J,pz:Y}=this;let rt=t.ZERO,q=t.ZERO,Z=t.ZERO,et=t.mul(W,W),Q=t.mul(J,J),yt=t.mul(Y,Y),ct=t.mul(W,J);return ct=t.add(ct,ct),Z=t.mul(W,Y),Z=t.add(Z,Z),rt=t.mul(P,Z),q=t.mul(z,yt),q=t.add(rt,q),rt=t.sub(Q,q),q=t.add(Q,q),q=t.mul(rt,q),rt=t.mul(ct,rt),Z=t.mul(z,Z),yt=t.mul(P,yt),ct=t.sub(et,yt),ct=t.mul(P,ct),ct=t.add(ct,Z),Z=t.add(et,et),et=t.add(Z,et),et=t.add(et,yt),et=t.mul(et,ct),q=t.add(q,et),yt=t.mul(J,Y),yt=t.add(yt,yt),et=t.mul(yt,ct),rt=t.sub(rt,et),Z=t.mul(yt,Q),Z=t.add(Z,Z),Z=t.add(Z,Z),new T(rt,q,Z)}add(P){S(P);const{px:F,py:z,pz:W}=this,{px:J,py:Y,pz:rt}=P;let q=t.ZERO,Z=t.ZERO,et=t.ZERO;const Q=n.a,yt=t.mul(n.b,cr);let ct=t.mul(F,J),wt=t.mul(z,Y),Et=t.mul(W,rt),Rt=t.add(F,z),H=t.add(J,Y);Rt=t.mul(Rt,H),H=t.add(ct,wt),Rt=t.sub(Rt,H),H=t.add(F,W);let X=t.add(J,rt);return H=t.mul(H,X),X=t.add(ct,Et),H=t.sub(H,X),X=t.add(z,W),q=t.add(Y,rt),X=t.mul(X,q),q=t.add(wt,Et),X=t.sub(X,q),et=t.mul(Q,H),q=t.mul(yt,Et),et=t.add(q,et),q=t.sub(wt,et),et=t.add(wt,et),Z=t.mul(q,et),wt=t.add(ct,ct),wt=t.add(wt,ct),Et=t.mul(Q,Et),H=t.mul(yt,H),wt=t.add(wt,Et),Et=t.sub(ct,Et),Et=t.mul(Q,Et),H=t.add(H,Et),ct=t.mul(wt,H),Z=t.add(Z,ct),ct=t.mul(X,H),q=t.mul(Rt,q),q=t.sub(q,ct),ct=t.mul(Rt,wt),et=t.mul(X,et),et=t.add(et,ct),new T(q,Z,et)}subtract(P){return this.add(P.negate())}is0(){return this.equals(T.ZERO)}wNAF(P){return D.wNAFCached(this,b,P,F=>{const z=t.invertBatch(F.map(W=>W.pz));return F.map((W,J)=>W.toAffine(z[J])).map(T.fromAffine)})}multiplyUnsafe(P){const F=T.ZERO;if(P===je)return F;if(f(P),P===ge)return this;const{endo:z}=n;if(!z)return D.unsafeLadder(this,P);let{k1neg:W,k1:J,k2neg:Y,k2:rt}=z.splitScalar(P),q=F,Z=F,et=this;for(;J>je||rt>je;)J&ge&&(q=q.add(et)),rt&ge&&(Z=Z.add(et)),et=et.double(),J>>=ge,rt>>=ge;return W&&(q=q.negate()),Y&&(Z=Z.negate()),Z=new T(t.mul(Z.px,z.beta),Z.py,Z.pz),q.add(Z)}multiply(P){f(P);let z,W,F=P;const{endo:J}=n;if(J){const{k1neg:Y,k1:rt,k2neg:q,k2:Z}=J.splitScalar(F);let{p:et,f:Q}=this.wNAF(rt),{p:yt,f:ct}=this.wNAF(Z);et=D.constTimeNegate(Y,et),yt=D.constTimeNegate(q,yt),yt=new T(t.mul(yt.px,J.beta),yt.py,yt.pz),z=et.add(yt),W=Q.add(ct)}else{const{p:Y,f:rt}=this.wNAF(F);z=Y,W=rt}return T.normalizeZ([z,W])[0]}multiplyAndAddUnsafe(P,F,z){const W=T.BASE,J=(rt,q)=>q!==je&&q!==ge&&rt.equals(W)?rt.multiply(q):rt.multiplyUnsafe(q),Y=J(this,F).add(J(P,z));return Y.is0()?void 0:Y}toAffine(P){const{px:F,py:z,pz:W}=this,J=this.is0();null==P&&(P=J?t.ONE:t.inv(W));const Y=t.mul(F,P),rt=t.mul(z,P),q=t.mul(W,P);if(J)return{x:t.ZERO,y:t.ZERO};if(!t.eql(q,t.ONE))throw new Error("invZ was invalid");return{x:Y,y:rt}}isTorsionFree(){const{h:P,isTorsionFree:F}=n;if(P===ge)return!0;if(F)return F(T,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:P,clearCofactor:F}=n;return P===ge?this:F?F(T,this):this.multiplyUnsafe(n.h)}toRawBytes(P=!0){return this.assertValidity(),r(T,this,P)}toHex(P=!0){return vn(this.toRawBytes(P))}}T.BASE=new T(n.Gx,n.Gy,t.ONE),T.ZERO=new T(t.ZERO,t.ONE,t.ZERO);const $=n.nBitLength,D=function Os(e,n){const t=(o,a)=>{const u=a.negate();return o?u:a},r=o=>({windows:Math.ceil(n/o)+1,windowSize:2**(o-1)});return{constTimeNegate:t,unsafeLadder(o,a){let u=e.ZERO,f=o;for(;a>Ds;)a&jr&&(u=u.add(f)),f=f.double(),a>>=jr;return u},precomputeWindow(o,a){const{windows:u,windowSize:f}=r(a),g=[];let b=o,S=b;for(let T=0;T>=D,F>g&&(F-=$,u+=jr);const z=P,W=P+Math.abs(F)-1,Y=F<0;0===F?S=S.add(t(U%2!=0,a[z])):b=b.add(t(Y,a[W]))}return{p:b,f:S}},wNAFCached(o,a,u,f){const g=o._WINDOW_SIZE||1;let b=a.get(o);return b||(b=this.precomputeWindow(o,g),1!==g&&a.set(o,f(b))),this.wNAF(g,b,u)}}}(T,n.endo?Math.ceil($/2):$);return{CURVE:n,ProjectivePoint:T,normPrivateKeyToScalar:g,weierstrassEquation:a,isWithinCurveOrder:u}}({...n,toBytes(H,X,pt){const _t=X.toAffine(),st=t.toBytes(_t.x),At=cn;return pt?At(Uint8Array.from([X.hasEvenY()?2:3]),st):At(Uint8Array.from([4]),st,t.toBytes(_t.y))},fromBytes(H){const X=H.length,pt=H[0],_t=H.subarray(1);if(X!==o||2!==pt&&3!==pt){if(X===a&&4===pt)return{x:t.fromBytes(_t.subarray(0,t.BYTES)),y:t.fromBytes(_t.subarray(t.BYTES,2*t.BYTES))};throw new Error(`Point of length ${X} was invalid. Expected ${o} compressed bytes or ${a} uncompressed bytes`)}{const st=Te(_t);if(!function u(H){return jevn(Xe(H,n.nByteLength));function U(H){return H>r>>ge}const F=(H,X,pt)=>Te(H.slice(X,pt));class z{constructor(X,pt,_t){this.r=X,this.s=pt,this.recovery=_t,this.assertValidity()}static fromCompact(X){const pt=n.nByteLength;return X=Ee("compactSignature",X,2*pt),new z(F(X,0,pt),F(X,pt,2*pt))}static fromDER(X){const{r:pt,s:_t}=un.toSig(Ee("DER",X));return new z(pt,_t)}assertValidity(){if(!$(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!$(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(X){return new z(this.r,this.s,X)}recoverPublicKey(X){const{r:pt,s:_t,recovery:st}=this,At=Z(Ee("msgHash",X));if(null==st||![0,1,2,3].includes(st))throw new Error("recovery id invalid");const Nt=2===st||3===st?pt+n.n:pt;if(Nt>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const xe=b.fromHex((1&st?"03":"02")+D(Nt)),Me=g(Nt),Ne=f(-At*Me),Ue=f(_t*Me),Se=b.BASE.multiplyAndAddUnsafe(xe,Ne,Ue);if(!Se)throw new Error("point at infinify");return Se.assertValidity(),Se}hasHighS(){return U(this.s)}normalizeS(){return this.hasHighS()?new z(this.r,f(-this.s),this.recovery):this}toDERRawBytes(){return yn(this.toDERHex())}toDERHex(){return un.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return yn(this.toCompactHex())}toCompactHex(){return D(this.r)+D(this.s)}}const W={isValidPrivateKey(H){try{return S(H),!0}catch{return!1}},normPrivateKeyToScalar:S,randomPrivateKey:()=>{const X=function js(e,n,t=!1){const r=(e=Ee("privateHash",e)).length,o=Ur(n).nByteLength+8;if(o<24||r1024)throw new Error(`hashToPrivateScalar: expected ${o}-1024 bytes of input, got ${r}`);return _e(t?Br(e):Te(e),n-Ot)+Ot}(n.randomBytes(t.BYTES+8),r);return Xe(X,n.nByteLength)},precompute:(H=8,X=b.BASE)=>(X._setWindowSize(H),X.multiply(BigInt(3)),X)};function Y(H){const X=H instanceof Uint8Array,pt="string"==typeof H,_t=(X||pt)&&H.length;return X?_t===o||_t===a:pt?_t===2*o||_t===2*a:H instanceof b}const q=n.bits2int||function(H){const X=Te(H),pt=8*H.length-n.nBitLength;return pt>0?X>>BigInt(pt):X},Z=n.bits2int_modN||function(H){return f(q(H))},et=Nr(n.nBitLength);function Q(H){if("bigint"!=typeof H)throw new Error("bigint expected");if(!(je<=H&&HRe in pt))throw new Error("sign() legacy options not supported");const{hash:_t,randomBytes:st}=n;let{lowS:At,prehash:Nt,extraEntropy:Bt}=pt;null==At&&(At=!0),H=Ee("msgHash",H),Nt&&(H=Ee("prehashed msgHash",_t(H)));const xe=Z(H),Me=S(X),Ne=[Q(Me),Q(xe)];if(null!=Bt){const Re=!0===Bt?st(t.BYTES):Bt;Ne.push(Ee("extraEntropy",Re,t.BYTES))}const Ue=cn(...Ne),Se=xe;return{seed:Ue,k2sig:function Ge(Re){const kn=q(Re);if(!$(kn))return;const cs=g(kn),ze=b.BASE.multiply(kn).toAffine(),Mn=f(ze.x);if(Mn===je)return;const Cr=f(cs*f(Se+Mn*Me));if(Cr===je)return;let us=(ze.x===Mn?0:2)|Number(ze.y&ge),fs=Cr;return At&&U(Cr)&&(fs=function P(H){return U(H)?f(-H):H}(Cr),us^=1),new z(Mn,fs,us)}}}(H,X,pt);return $i(n.hash.outputLen,n.nByteLength,n.hmac)(_t,st)},verify:function Rt(H,X,pt,_t=wt){const st=H;if(X=Ee("msgHash",X),pt=Ee("publicKey",pt),"strict"in _t)throw new Error("options.strict was renamed to lowS");const{lowS:At,prehash:Nt}=_t;let Bt,xe;try{if("string"==typeof st||st instanceof Uint8Array)try{Bt=z.fromDER(st)}catch(ze){if(!(ze instanceof un.Err))throw ze;Bt=z.fromCompact(st)}else{if("object"!=typeof st||"bigint"!=typeof st.r||"bigint"!=typeof st.s)throw new Error("PARSE");{const{r:ze,s:Mn}=st;Bt=new z(ze,Mn)}}xe=b.fromHex(pt)}catch(ze){if("PARSE"===ze.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(At&&Bt.hasHighS())return!1;Nt&&(X=n.hash(X));const{r:Me,s:Ne}=Bt,Ue=Z(X),Se=g(Ne),Ge=f(Ue*Se),Re=f(Me*Se),kn=b.BASE.multiplyAndAddUnsafe(xe,Ge,Re)?.toAffine();return!!kn&&f(kn.x)===Me},ProjectivePoint:b,Signature:z,utils:W}}BigInt(4);class Wi extends Pi{constructor(n,t){super(),this.finished=!1,this.destroyed=!1,Ae.hash(n);const r=ln(t);if(this.iHash=n.create(),"function"!=typeof this.iHash.update)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,a=new Uint8Array(o);a.set(r.length>o?n.create().update(r).digest():r);for(let u=0;unew Wi(e,n).update(t).digest();function Js(e){return{hash:e,hmac:(n,...t)=>wn(e,n,ir(...t)),randomBytes:or}}wn.create=(e,n)=>new Wi(e,n);const ur=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),fr=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Yi=BigInt(1),hr=BigInt(2),Ki=(e,n)=>(e+n/hr)/n;function Zi(e){const n=ur,t=BigInt(3),r=BigInt(6),o=BigInt(11),a=BigInt(22),u=BigInt(23),f=BigInt(44),g=BigInt(88),b=e*e*e%n,S=b*b*e%n,T=Pe(S,t,n)*S%n,$=Pe(T,t,n)*S%n,D=Pe($,hr,n)*b%n,U=Pe(D,o,n)*D%n,P=Pe(U,a,n)*U%n,F=Pe(P,f,n)*P%n,z=Pe(F,g,n)*F%n,W=Pe(z,f,n)*P%n,J=Pe(W,t,n)*S%n,Y=Pe(J,u,n)*U%n,rt=Pe(Y,r,n)*b%n,q=Pe(rt,hr,n);if(!Or.eql(Or.sqr(q),e))throw new Error("Cannot find square root");return q}const Or=function Us(e,n,t=!1,r={}){if(e<=be)throw new Error(`Expected Fp ORDER > 0, got ${e}`);const{nBitLength:o,nByteLength:a}=Ur(e,n);if(a>2048)throw new Error("Field lengths over 2048 bytes are not supported");const u=function Is(e){if(e%Lr===Ss){const n=(e+Ot)/Lr;return function(r,o){const a=r.pow(o,n);if(!r.eql(r.sqr(a),o))throw new Error("Cannot find square root");return a}}if(e%zi===Gi){const n=(e-Gi)/zi;return function(r,o){const a=r.mul(o,Je),u=r.pow(a,n),f=r.mul(o,u),g=r.mul(r.mul(f,Je),u),b=r.mul(f,r.sub(g,r.ONE));if(!r.eql(r.sqr(b),o))throw new Error("Cannot find square root");return b}}return function Rs(e){const n=(e-Ot)/Je;let t,r,o;for(t=e-Ot,r=0;t%Je===be;t/=Je,r++);for(o=Je;o_e(g,e),isValid:g=>{if("bigint"!=typeof g)throw new Error("Invalid field element: expected bigint, got "+typeof g);return be<=g&&gg===be,isOdd:g=>(g&Ot)===Ot,neg:g=>_e(-g,e),eql:(g,b)=>g===b,sqr:g=>_e(g*g,e),add:(g,b)=>_e(g+b,e),sub:(g,b)=>_e(g-b,e),mul:(g,b)=>_e(g*b,e),pow:(g,b)=>function Ps(e,n,t){if(t 0");if(t===be)return e.ONE;if(t===Ot)return n;let r=e.ONE,o=n;for(;t>be;)t&Ot&&(r=e.mul(r,o)),o=e.sqr(o),t>>=Ot;return r}(f,g,b),div:(g,b)=>_e(g*lr(b,e),e),sqrN:g=>g*g,addN:(g,b)=>g+b,subN:(g,b)=>g-b,mulN:(g,b)=>g*b,inv:g=>lr(g,e),sqrt:r.sqrt||(g=>u(f,g)),invertBatch:g=>function Ls(e,n){const t=new Array(n.length),r=n.reduce((a,u,f)=>e.is0(u)?a:(t[f]=a,e.mul(a,u)),e.ONE),o=e.inv(r);return n.reduceRight((a,u,f)=>e.is0(u)?a:(t[f]=e.mul(a,t[f]),e.mul(a,u)),o),t}(f,g),cmov:(g,b,S)=>S?b:g,toBytes:g=>t?Oi(g,a):Xe(g,a),fromBytes:g=>{if(g.length!==a)throw new Error(`Fp.fromBytes: expected ${a}, got ${g.length}`);return t?Br(g):Te(g)}});return Object.freeze(f)}(ur,void 0,void 0,{sqrt:Zi}),bn=function Qs(e,n){const t=r=>Hs({...e,...Js(r)});return Object.freeze({...t(n),create:t})}({a:BigInt(0),b:BigInt(7),Fp:Or,n:fr,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const n=fr,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Yi*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=t,u=BigInt("0x100000000000000000000000000000000"),f=Ki(a*e,n),g=Ki(-r*e,n);let b=_e(e-f*t-g*o,n),S=_e(-f*r-g*a,n);const T=b>u,$=S>u;if(T&&(b=n-b),$&&(S=n-S),b>u||S>u)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:T,k1:b,k2neg:$,k2:S}}}},He),dr=BigInt(0),Xi=e=>"bigint"==typeof e&&dro.charCodeAt(0)));t=cn(r,r),Ji[e]=t}return He(cn(t,...n))}const Fr=e=>e.toRawBytes(!0).slice(1),$r=e=>Xe(e,32),Gr=e=>_e(e,ur),Fn=e=>_e(e,fr),zr=bn.ProjectivePoint;function qr(e){let n=bn.utils.normPrivateKeyToScalar(e),t=zr.fromPrivateKey(n);return{scalar:t.hasEvenY()?n:Fn(-n),bytes:Fr(t)}}function Qi(e){if(!Xi(e))throw new Error("bad x: need 0 < x < p");const n=Gr(e*e);let r=Zi(Gr(n*e+BigInt(7)));r%hr!==dr&&(r=Gr(-r));const o=new zr(e,r,Yi);return o.assertValidity(),o}function to(...e){return Fn(Te(mr("BIP0340/challenge",...e)))}function eo(e,n,t){const r=Ee("signature",e,64),o=Ee("message",n),a=Ee("publicKey",t,32);try{const u=Qi(Te(a)),f=Te(r.subarray(0,32));if(!Xi(f))return!1;const g=Te(r.subarray(32,64));if(!(e=>"bigint"==typeof e&&drzr.BASE.multiplyAndAddUnsafe(e,n,t))(u,g,Fn(-b));return!(!S||!S.hasEvenY()||S.toAffine().x!==f)}catch{return!1}}const _n={getPublicKey:function na(e){return qr(e).bytes},sign:function ra(e,n,t=or(32)){const r=Ee("message",e),{bytes:o,scalar:a}=qr(n),u=Ee("auxRand",t,32),f=$r(a^Te(mr("BIP0340/aux",u))),g=mr("BIP0340/nonce",f,o,r),b=Fn(Te(g));if(b===dr)throw new Error("sign failed: k is zero");const{bytes:S,scalar:T}=qr(b),$=to(S,o,r),D=new Uint8Array(64);if(D.set(S,0),D.set($r(Fn(T+$*a)),32),!eo(D,r,o))throw new Error("sign: Invalid signature produced");return D},verify:eo,utils:{randomPrivateKey:bn.utils.randomPrivateKey,lift_x:Qi,pointToBytes:Fr,numberToBytesBE:Xe,bytesToNumberBE:Te,taggedHash:mr,mod:_e}};var no=M(5693),Hr=M(9673),ia=M(9608);const Oe=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function Yr(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function Kr(e){if("string"==typeof e&&(e=Yr(e)),!(e=>e instanceof Uint8Array)(e))throw new Error("expected Uint8Array, got "+typeof e);return e}function Zr(e,n){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");if("number"==typeof n&&e.length!==n)throw new Error(`Uint8Array length ${n} expected`)}function Xr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function ro(e,...n){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(n.length>0&&!n.includes(e.length))throw new Error(`Expected Uint8Array of length ${n}, not of length=${e.length}`)}const Be={number:Xr,bool:function ua(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)},bytes:ro,hash:function fa(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("hash must be wrapped by utils.wrapConstructor");Xr(e.outputLen),Xr(e.blockLen)},exists:function ha(e,n=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(n&&e.finished)throw new Error("Hash#digest() has already been called")},output:function da(e,n){ro(e);const t=n.outputLen;if(e.length255&e[n++]|(255&e[n++])<<8;class ma{constructor(n){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,Zr(n=Kr(n),32);const t=ke(n,0),r=ke(n,2),o=ke(n,4),a=ke(n,6),u=ke(n,8),f=ke(n,10),g=ke(n,12),b=ke(n,14);this.r[0]=8191&t,this.r[1]=8191&(t>>>13|r<<3),this.r[2]=7939&(r>>>10|o<<6),this.r[3]=8191&(o>>>7|a<<9),this.r[4]=255&(a>>>4|u<<12),this.r[5]=u>>>1&8190,this.r[6]=8191&(u>>>14|f<<2),this.r[7]=8065&(f>>>11|g<<5),this.r[8]=8191&(g>>>8|b<<8),this.r[9]=b>>>5&127;for(let S=0;S<8;S++)this.pad[S]=ke(n,16+2*S)}process(n,t,r=!1){const o=r?0:2048,{h:a,r:u}=this,f=u[0],g=u[1],b=u[2],S=u[3],T=u[4],$=u[5],D=u[6],U=u[7],P=u[8],F=u[9],z=ke(n,t+0),W=ke(n,t+2),J=ke(n,t+4),Y=ke(n,t+6),rt=ke(n,t+8),q=ke(n,t+10),Z=ke(n,t+12),et=ke(n,t+14);let Q=a[0]+(8191&z),yt=a[1]+(8191&(z>>>13|W<<3)),ct=a[2]+(8191&(W>>>10|J<<6)),wt=a[3]+(8191&(J>>>7|Y<<9)),Et=a[4]+(8191&(Y>>>4|rt<<12)),Rt=a[5]+(rt>>>1&8191),H=a[6]+(8191&(rt>>>14|q<<2)),X=a[7]+(8191&(q>>>11|Z<<5)),pt=a[8]+(8191&(Z>>>8|et<<8)),_t=a[9]+(et>>>5|o),st=0,At=st+Q*f+yt*(5*F)+ct*(5*P)+wt*(5*U)+Et*(5*D);st=At>>>13,At&=8191,At+=Rt*(5*$)+H*(5*T)+X*(5*S)+pt*(5*b)+_t*(5*g),st+=At>>>13,At&=8191;let Nt=st+Q*g+yt*f+ct*(5*F)+wt*(5*P)+Et*(5*U);st=Nt>>>13,Nt&=8191,Nt+=Rt*(5*D)+H*(5*$)+X*(5*T)+pt*(5*S)+_t*(5*b),st+=Nt>>>13,Nt&=8191;let Bt=st+Q*b+yt*g+ct*f+wt*(5*F)+Et*(5*P);st=Bt>>>13,Bt&=8191,Bt+=Rt*(5*U)+H*(5*D)+X*(5*$)+pt*(5*T)+_t*(5*S),st+=Bt>>>13,Bt&=8191;let xe=st+Q*S+yt*b+ct*g+wt*f+Et*(5*F);st=xe>>>13,xe&=8191,xe+=Rt*(5*P)+H*(5*U)+X*(5*D)+pt*(5*$)+_t*(5*T),st+=xe>>>13,xe&=8191;let Me=st+Q*T+yt*S+ct*b+wt*g+Et*f;st=Me>>>13,Me&=8191,Me+=Rt*(5*F)+H*(5*P)+X*(5*U)+pt*(5*D)+_t*(5*$),st+=Me>>>13,Me&=8191;let Ne=st+Q*$+yt*T+ct*S+wt*b+Et*g;st=Ne>>>13,Ne&=8191,Ne+=Rt*f+H*(5*F)+X*(5*P)+pt*(5*U)+_t*(5*D),st+=Ne>>>13,Ne&=8191;let Ue=st+Q*D+yt*$+ct*T+wt*S+Et*b;st=Ue>>>13,Ue&=8191,Ue+=Rt*g+H*f+X*(5*F)+pt*(5*P)+_t*(5*U),st+=Ue>>>13,Ue&=8191;let Se=st+Q*U+yt*D+ct*$+wt*T+Et*S;st=Se>>>13,Se&=8191,Se+=Rt*b+H*g+X*f+pt*(5*F)+_t*(5*P),st+=Se>>>13,Se&=8191;let Ge=st+Q*P+yt*U+ct*D+wt*$+Et*T;st=Ge>>>13,Ge&=8191,Ge+=Rt*S+H*b+X*g+pt*f+_t*(5*F),st+=Ge>>>13,Ge&=8191;let Re=st+Q*F+yt*P+ct*U+wt*D+Et*$;st=Re>>>13,Re&=8191,Re+=Rt*T+H*S+X*b+pt*g+_t*f,st+=Re>>>13,Re&=8191,st=(st<<2)+st|0,st=st+At|0,At=8191&st,st>>>=13,Nt+=st,a[0]=At,a[1]=Nt,a[2]=Bt,a[3]=xe,a[4]=Me,a[5]=Ne,a[6]=Ue,a[7]=Se,a[8]=Ge,a[9]=Re}finalize(){const{h:n,pad:t}=this,r=new Uint16Array(10);let o=n[1]>>>13;n[1]&=8191;for(let f=2;f<10;f++)n[f]+=o,o=n[f]>>>13,n[f]&=8191;n[0]+=5*o,o=n[0]>>>13,n[0]&=8191,n[1]+=o,o=n[1]>>>13,n[1]&=8191,n[2]+=o,r[0]=n[0]+5,o=r[0]>>>13,r[0]&=8191;for(let f=1;f<10;f++)r[f]=n[f]+o,o=r[f]>>>13,r[f]&=8191;r[9]-=8192;let a=(1^o)-1;for(let f=0;f<10;f++)r[f]&=a;a=~a;for(let f=0;f<10;f++)n[f]=n[f]&a|r[f];n[0]=65535&(n[0]|n[1]<<13),n[1]=65535&(n[1]>>>3|n[2]<<10),n[2]=65535&(n[2]>>>6|n[3]<<7),n[3]=65535&(n[3]>>>9|n[4]<<4),n[4]=65535&(n[4]>>>12|n[5]<<1|n[6]<<14),n[5]=65535&(n[6]>>>2|n[7]<<11),n[6]=65535&(n[7]>>>5|n[8]<<8),n[7]=65535&(n[8]>>>8|n[9]<<5);let u=n[0]+t[0];n[0]=65535&u;for(let f=1;f<8;f++)u=(n[f]+t[f]|0)+(u>>>16)|0,n[f]=65535&u}update(n){Be.exists(this);const{buffer:t,blockLen:r}=this,o=(n=Kr(n)).length;for(let a=0;a>>0,n[a++]=r[u]>>>8;return n}digest(){const{buffer:n,outputLen:t}=this;this.digestInto(n);const r=n.slice(0,t);return this.destroy(),r}}!function ga(e){const n=(r,o)=>e(o).update(Kr(r)).digest(),t=e(new Uint8Array(32));n.outputLen=t.outputLen,n.blockLen=t.blockLen,n.create=r=>e(r)}(e=>new ma(e));const pa=Yr("expand 16-byte k"),va=Yr("expand 32-byte k"),ya=Oe(pa),wa=Oe(va),io=e=>!(e.byteOffset%4),vt=(e,n)=>e<>>32-n;const oo=(e=>{const{core:n,rounds:t,counterRight:r,counterLen:o,allow128bitKeys:a,extendNonceFn:u,blockLen:f}=function la(e,n){if(void 0!==n&&("object"!=typeof n||!(e=>"[object Object]"===Object.prototype.toString.call(e)&&e.constructor===Object)(n)))throw new Error("options must be object or undefined");return Object.assign(e,n)}({rounds:20,counterRight:!1,counterLen:8,allow128bitKeys:!0,blockLen:64},e);Be.number(o),Be.number(t),Be.number(f),Be.bool(r),Be.bool(a);const g=f/4;if(f%4!=0)throw new Error("Salsa/ChaCha: blockLen must be aligned to 4 bytes");return(b,S,T,$,D=0)=>{if(Be.bytes(b),Be.bytes(S),Be.bytes(T),$||($=new Uint8Array(T.length)),Be.bytes($),Be.number(D),D<0||D>=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");if($.length=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");const ct=Math.min(f,et-Q);if(ct===f&&Z&&q){const wt=Q/4;if(Q%4!=0)throw new Error("Salsa/ChaCha: invalid block position");for(let Et=0;Et{for(var t in n)Ma(e,t,{get:n[t],enumerable:!0})};function co(){return Ie(_n.utils.randomPrivateKey())}function Qr(e){return Ie(_n.getPublicKey(e))}ye({},{MessageNode:()=>uo,MessageQueue:()=>fo,insertEventIntoAscendingList:()=>Aa,insertEventIntoDescendingList:()=>Ca,normalizeURL:()=>ti,utf8Decoder:()=>Fe,utf8Encoder:()=>Le});var Fe=new TextDecoder("utf-8"),Le=new TextEncoder;function ti(e){let n=new URL(e);return n.pathname=n.pathname.replace(/\/+/g,"/"),n.pathname.endsWith("/")&&(n.pathname=n.pathname.slice(0,-1)),("80"===n.port&&"ws:"===n.protocol||"443"===n.port&&"wss:"===n.protocol)&&(n.port=""),n.searchParams.sort(),n.hash="",n.toString()}function Ca(e,n){let o,t=0,r=e.length-1,a=t;if(r<0)a=0;else if(n.created_at=e[t].created_at)a=t;else for(;;){if(r<=t+1){a=r;break}if(o=Math.floor(t+(r-t)/2),e[o].created_at>n.created_at)t=o;else{if(!(e[o].created_ate[r].created_at)a=r+1;else if(n.created_at<=e[t].created_at)a=t;else for(;;){if(r<=t+1){a=r;break}if(o=Math.floor(t+(r-t)/2),e[o].created_atn.created_at)){a=o;break}r=o}}return e[a]?.id!==n.id?[...e.slice(0,a),n,...e.slice(a)]:e}var uo=class{_value;_next;get value(){return this._value}set value(e){this._value=e}get next(){return this._next}set next(e){this._next=e}constructor(e){this._value=e,this._next=null}},fo=class{_first;_last;get first(){return this._first}set first(e){this._first=e}get last(){return this._last}set last(e){this._last=e}_size;get size(){return this._size}set size(e){this._size=e}constructor(){this._first=null,this._last=null,this._size=0}enqueue(e){const n=new uo(e);return 0!==this._size&&this._last?(this._last.next=n,this._last=n):(this._first=n,this._last=n),this._size++,!0}dequeue(){if(0===this._size||!this._first)return null;let e=this._first;return this._first=e.next,e.next=null,this._size--,e.value}},xn=Symbol("verified");function Ve(e,n){const t=e;return t.pubkey=Qr(n),t.id=zn(t),t.sig=function ho(e,n){return Ie(_n.sign(zn(e),n))}(t,n),t[xn]=!0,t}function zn(e){let n=He(Le.encode(function Ia(e){if(!ei(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}(e)));return Ie(n)}var Ba=e=>e instanceof Object;function ei(e){if(!Ba(e)||"number"!=typeof e.kind||"string"!=typeof e.content||"number"!=typeof e.created_at||"string"!=typeof e.pubkey||!e.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(e.tags))return!1;for(let n=0;nn.id.startsWith(t))||e.kinds&&-1===e.kinds.indexOf(n.kind)||e.authors&&-1===e.authors.indexOf(n.pubkey)&&!e.authors.some(t=>n.pubkey.startsWith(t)))return!1;for(let t in e)if("#"===t[0]){let o=e[`#${t.slice(1)}`];if(o&&!n.tags.find(([a,u])=>a===t.slice(1)&&-1!==o.indexOf(u)))return!1}return!(e.since&&n.created_ate.until)}function pr(e,n){let t=n.length+3,r=e.indexOf(`"${n}":`)+t,o=e.slice(r).indexOf('"')+r+1;return e.slice(o,o+64)}function go(e,n){let t=n.length,r=e.indexOf(`"${n}":`)+t+3,o=e.slice(r),a=Math.min(o.indexOf(","),o.indexOf("}"));return parseInt(o.slice(0,a),10)}function po(e){let n=e.slice(0,22).indexOf('"EVENT"');if(-1===n)return null;let t=e.slice(n+7+1).indexOf('"');if(-1===t)return null;let r=n+7+1+t,o=e.slice(r+1,80).indexOf('"');return-1===o?null:e.slice(r+1,r+1+o)}function Ua(e,n){return n===pr(e,"id")}function ja(e,n){return n===pr(e,"pubkey")}function Da(e,n){return n===go(e,"kind")}function yo(e,n={}){let{listTimeout:t=3e3,getTimeout:r=3e3,countTimeout:o=3e3}=n;var a,S,u={},f={connect:[],disconnect:[],error:[],notice:[],auth:[]},g={},b={};function $(){return($=(0,y.A)(function*(){return S||(S=new Promise((Y,rt)=>{try{a=new WebSocket(e)}catch(Q){rt(Q)}a.onopen=()=>{f.connect.forEach(Q=>Q()),Y()},a.onerror=()=>{S=void 0,f.error.forEach(Q=>Q()),rt()},a.onclose=(0,y.A)(function*(){S=void 0,f.disconnect.forEach(Q=>Q())});let Z,q=new fo;function et(){if(0===q.size)return clearInterval(Z),void(Z=null);var Q=q.dequeue();if(!Q)return;let yt=po(Q);if(yt){let ct=u[yt];if(ct&&ct.alreadyHaveEvent&&ct.alreadyHaveEvent(pr(Q,"id"),e))return}try{let ct=JSON.parse(Q);switch(ct[0]){case"EVENT":{let H=ct[1],X=ct[2];return void(ei(X)&&u[H]&&(u[H].skipVerification||gr(X))&&function mo(e,n){for(let t=0;tpt(X)))}case"COUNT":let wt=ct[1],Et=ct[2];return void(u[wt]&&(g[wt]?.count||[]).forEach(H=>H(Et)));case"EOSE":{let H=ct[1];return void(H in g&&(g[H].eose.forEach(X=>X()),g[H].eose=[]))}case"OK":{let H=ct[1],X=ct[2],pt=ct[3]||"";if(H in b){let{resolve:_t,reject:st}=b[H];X?_t(null):st(new Error(pt))}return}case"NOTICE":let Rt=ct[1];return void f.notice.forEach(H=>H(Rt));case"AUTH":{let H=ct[1];return void f.auth?.forEach(X=>X(H))}}}catch{return}}a.onmessage=Q=>{q.enqueue(Q.data),Z||(Z=setInterval(et,0))}}))})).apply(this,arguments)}function D(){return 1===a?.readyState}function P(){return P=(0,y.A)(function*(){D()||(yield function T(){return $.apply(this,arguments)}())}),P.apply(this,arguments)}function F(Y){return z.apply(this,arguments)}function z(){return(z=(0,y.A)(function*(Y){let rt=JSON.stringify(Y);if(D()||(yield new Promise(q=>setTimeout(q,1e3)),D()))try{a.send(rt)}catch(q){console.log(q)}})).apply(this,arguments)}const W=(Y,{verb:rt="REQ",skipVerification:q=!1,alreadyHaveEvent:Z=null,id:et=Math.random().toString().slice(2)}={})=>{let Q=et;u[Q]={id:Q,filters:Y,skipVerification:q,alreadyHaveEvent:Z},F([rt,Q,...Y]);let yt={sub:(ct,wt={})=>W(ct||Y,{skipVerification:wt.skipVerification||q,alreadyHaveEvent:wt.alreadyHaveEvent||Z,id:Q}),unsub:()=>{delete u[Q],delete g[Q],F(["CLOSE",Q])},on:(ct,wt)=>{g[Q]=g[Q]||{event:[],count:[],eose:[]},g[Q][ct].push(wt)},off:(ct,wt)=>{let Et=g[Q],Rt=Et[ct].indexOf(wt);Rt>=0&&Et[ct].splice(Rt,1)},get events(){return function wo(e){return ni.apply(this,arguments)}(yt)}};return yt};function J(Y,rt){return new Promise((q,Z)=>{if(!Y.id)return void Z(new Error(`event ${Y} has no id`));let et=Y.id;F([rt,Y]),b[et]={resolve:q,reject:Z}})}return{url:e,sub:W,on:(Y,rt)=>{f[Y].push(rt),"connect"===Y&&1===a?.readyState&&rt()},off:(Y,rt)=>{let q=f[Y].indexOf(rt);-1!==q&&f[Y].splice(q,1)},list:(Y,rt)=>new Promise(q=>{let Z=W(Y,rt),et=[],Q=setTimeout(()=>{Z.unsub(),q(et)},t);Z.on("eose",()=>{Z.unsub(),clearTimeout(Q),q(et)}),Z.on("event",yt=>{et.push(yt)})}),get:(Y,rt)=>new Promise(q=>{let Z=W([Y],rt),et=setTimeout(()=>{Z.unsub(),q(null)},r);Z.on("event",Q=>{Z.unsub(),clearTimeout(et),q(Q)})}),count:Y=>new Promise(rt=>{let q=W(Y,{...W,verb:"COUNT"}),Z=setTimeout(()=>{q.unsub(),rt(null)},o);q.on("count",et=>{q.unsub(),clearTimeout(Z),rt(et)})}),publish:Y=>(0,y.A)(function*(){yield J(Y,"EVENT")})(),auth:Y=>(0,y.A)(function*(){yield J(Y,"AUTH")})(),connect:function U(){return P.apply(this,arguments)},close(){f={connect:[],disconnect:[],error:[],notice:[],auth:[]},g={},b={},a?.readyState===WebSocket.OPEN&&a.close()},get status(){return a?.readyState??3}}}function ni(){return ni=function Bn(e){return function(){return new qe(e.apply(this,arguments))}}(function*(e){let n;const t=[],r=o=>{n?(n(o),n=void 0):t.push(o)};e.on("event",r);try{for(;;)t.length>0?yield t.shift():yield yield In(new Promise(a=>{n=a}))}finally{e.off("event",r)}}),ni.apply(this,arguments)}ye({},{getHex64:()=>pr,getInt:()=>go,getSubscriptionId:()=>po,matchEventId:()=>Ua,matchEventKind:()=>Da,matchEventPubkey:()=>ja});var ri={};ye(ri,{BECH32_REGEX:()=>_o,decode:()=>qn,naddrEncode:()=>Ha,neventEncode:()=>qa,noteEncode:()=>Ga,nprofileEncode:()=>za,npubEncode:()=>$a,nrelayEncode:()=>Va,nsecEncode:()=>Fa});var bo=5e3,_o=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function qn(e){let{prefix:n,words:t}=V.I.decode(e,bo),r=new Uint8Array(V.I.fromWords(t));switch(n){case"nprofile":{let o=vr(r);if(!o[0]?.[0])throw new Error("missing TLV 0 for nprofile");if(32!==o[0][0].length)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:Ie(o[0][0]),relays:o[1]?o[1].map(a=>Fe.decode(a)):[]}}}case"nevent":{let o=vr(r);if(!o[0]?.[0])throw new Error("missing TLV 0 for nevent");if(32!==o[0][0].length)throw new Error("TLV 0 should be 32 bytes");if(o[2]&&32!==o[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(o[3]&&4!==o[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:Ie(o[0][0]),relays:o[1]?o[1].map(a=>Fe.decode(a)):[],author:o[2]?.[0]?Ie(o[2][0]):void 0,kind:o[3]?.[0]?parseInt(Ie(o[3][0]),16):void 0}}}case"naddr":{let o=vr(r);if(!o[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!o[2]?.[0])throw new Error("missing TLV 2 for naddr");if(32!==o[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(!o[3]?.[0])throw new Error("missing TLV 3 for naddr");if(4!==o[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:Fe.decode(o[0][0]),pubkey:Ie(o[2][0]),kind:parseInt(Ie(o[3][0]),16),relays:o[1]?o[1].map(a=>Fe.decode(a)):[]}}}case"nrelay":{let o=vr(r);if(!o[0]?.[0])throw new Error("missing TLV 0 for nrelay");return{type:"nrelay",data:Fe.decode(o[0][0])}}case"nsec":case"npub":case"note":return{type:n,data:Ie(r)};default:throw new Error(`unknown prefix ${n}`)}}function vr(e){let n={},t=e;for(;t.length>0;){let r=t[0],o=t[1];if(!o)throw new Error(`malformed TLV ${r}`);let a=t.slice(2,2+o);if(t=t.slice(2+o),a.lengthLe.encode(t))}))}function qa(e){let n;return null!=e.kind&&(n=function Oa(e){const n=new Uint8Array(4);return n[0]=e>>24&255,n[1]=e>>16&255,n[2]=e>>8&255,n[3]=255&e,n}(e.kind)),Hn("nevent",yr({0:[jn(e.id)],1:(e.relays||[]).map(r=>Le.encode(r)),2:e.author?[jn(e.author)]:[],3:n?[new Uint8Array(n)]:[]}))}function Ha(e){let n=new ArrayBuffer(4);return new DataView(n).setUint32(0,e.kind,!1),Hn("naddr",yr({0:[Le.encode(e.identifier)],1:(e.relays||[]).map(r=>Le.encode(r)),2:[jn(e.pubkey)],3:[new Uint8Array(n)]}))}function Va(e){return Hn("nrelay",yr({0:[Le.encode(e)]}))}function yr(e){let n=[];return Object.entries(e).forEach(([t,r])=>{r.forEach(o=>{let a=new Uint8Array(o.length+2);a.set([parseInt(t)],0),a.set([o.length],1),a.set(o,2),n.push(a)})}),ir(...n)}var oi={};function xo(e,n,t){return si.apply(this,arguments)}function si(){return(si=(0,y.A)(function*(e,n,t){const o=Eo(bn.getSharedSecret(e,"02"+n));let a=Uint8Array.from(or(16)),u=Le.encode(t),f=yield crypto.subtle.importKey("raw",o,{name:"AES-CBC"},!1,["encrypt"]),g=yield crypto.subtle.encrypt({name:"AES-CBC",iv:a},f,u);return`${V.K3.encode(new Uint8Array(g))}?iv=${V.K3.encode(new Uint8Array(a.buffer))}`})).apply(this,arguments)}function Ya(e,n,t){return ai.apply(this,arguments)}function ai(){return(ai=(0,y.A)(function*(e,n,t){let[r,o]=t.split("?iv="),u=Eo(bn.getSharedSecret(e,"02"+n)),f=yield crypto.subtle.importKey("raw",u,{name:"AES-CBC"},!1,["decrypt"]),g=V.K3.decode(r),b=V.K3.decode(o),S=yield crypto.subtle.decrypt({name:"AES-CBC",iv:b},f,g);return Fe.decode(S)})).apply(this,arguments)}function Eo(e){return e.slice(1,33)}ye(oi,{decrypt:()=>Ya,encrypt:()=>xo}),typeof crypto<"u"&&!crypto.subtle&&crypto.webcrypto&&(crypto.subtle=crypto.webcrypto.subtle),ye({},{NIP05_REGEX:()=>ko,queryProfile:()=>Ja,searchDomain:()=>Xa,useFetchImplementation:()=>Za});var wr,ko=/^(?:([\w.+-]+)@)?([\w.-]+)$/;try{wr=fetch}catch{}function Za(e){wr=e}function Xa(e){return li.apply(this,arguments)}function li(){return(li=(0,y.A)(function*(e,n=""){try{return(yield(yield wr(`https://${e}/.well-known/nostr.json?name=${n}`)).json()).names}catch{return{}}})).apply(this,arguments)}function Ja(e){return ci.apply(this,arguments)}function ci(){return(ci=(0,y.A)(function*(e){const n=e.match(ko);if(!n)return null;const[t,r="_",o]=n;try{const a=yield wr(`https://${o}/.well-known/nostr.json?name=${r}`),{names:u,relays:f}=function Qa(e){const n={names:{}};for(const[t,r]of Object.entries(e.names))"string"==typeof t&&"string"==typeof r&&(n.names[t]=r);if(e.relays){n.relays={};for(const[t,r]of Object.entries(e.relays))"string"==typeof t&&Array.isArray(r)&&(n.relays[t]=r.filter(o=>"string"==typeof o))}return n}(yield a.json()),g=u[r];return g?{pubkey:g,relays:f?.[g]}:null}catch{return null}})).apply(this,arguments)}function el(e,n){let r=ia.c.fromMasterSeed((0,Hr.kw)(e,n)).derive("m/44'/1237'/0'/0/0").privateKey;if(!r)throw new Error("could not derive private key");return Ie(r)}function nl(){return(0,Hr.we)(no.p)}function rl(e){return(0,Hr.JB)(e,no.p)}function ol(e){const n={reply:void 0,root:void 0,mentions:[],profiles:[]},t=[];for(const r of e.tags)"e"===r[0]&&r[1]&&t.push(r),"p"===r[0]&&r[1]&&n.profiles.push({pubkey:r[1],relays:r[2]?[r[2]]:[]});for(let r=0;r=n)break}return r}function cl(e,n,t,r){return Ve({kind:6,tags:[...e.tags??[],["e",n.id,t],["p",n.pubkey]],content:""===e.content?"":JSON.stringify(n),created_at:e.created_at},r)}function So(e){if(6!==e.kind)return;let n,t;for(let r=e.tags.length-1;r>=0&&(void 0===n||void 0===t);r--){const o=e.tags[r];o.length>=2&&("e"===o[0]&&void 0===n?n=o:"p"===o[0]&&void 0===t&&(t=o))}return void 0!==n?{id:n[1],relays:[n[2],t?.[2]].filter(r=>"string"==typeof r),author:t?.[1]}:void 0}function ul(e,{skipVerification:n}={}){const t=So(e);if(void 0===t||""===e.content)return;let r;try{r=JSON.parse(e.content)}catch{return}return r.id===t.id&&(n||gr(r))?r:void 0}ye({},{generateSeedWords:()=>nl,privateKeyFromSeedWords:()=>el,validateWords:()=>rl}),ye({},{parse:()=>ol}),ye({},{getPow:()=>Mo,minePow:()=>al}),ye({},{finishRepostEvent:()=>cl,getRepostedEvent:()=>ul,getRepostedEventPointer:()=>So}),ye({},{NOSTR_URI_REGEX:()=>br,parse:()=>dl,test:()=>hl});var br=new RegExp(`nostr:(${_o.source})`);function hl(e){return"string"==typeof e&&new RegExp(`^${br.source}$`).test(e)}function dl(e){const n=e.match(new RegExp(`^${br.source}$`));if(!n)throw new Error(`Invalid Nostr URI: ${e}`);return{uri:n[0],value:n[1],decoded:qn(n[1])}}function gl(e,n,t){const r=n.tags.filter(o=>o.length>=2&&("e"===o[0]||"p"===o[0]));return Ve({...e,kind:7,tags:[...e.tags??[],...r,["e",n.id],["p",n.pubkey]],content:e.content??"+"},t)}function pl(e){if(7!==e.kind)return;let n,t;for(let r=e.tags.length-1;r>=0&&(void 0===n||void 0===t);r--){const o=e.tags[r];o.length>=2&&("e"===o[0]&&void 0===n?n=o:"p"===o[0]&&void 0===t&&(t=o))}return void 0!==n&&void 0!==t?{id:n[1],relays:[n[2],t[2]].filter(r=>void 0!==r),author:t[1]}:void 0}function yl(e,n){let t=[];(n.kind||-1)>=0&&t.push(`kind=${n.kind}`),n.until&&t.push(`created_at<${n.until}`),n.since&&t.push(`created_at>${n.since}`);let r=t.join("&");if(""===r)throw new Error("refusing to create a delegation without any conditions");let o=He(Le.encode(`nostr:delegation:${n.pubkey}:${r}`)),a=Ie(_n.sign(o,e));return{from:Qr(e),to:n.pubkey,cond:r,sig:a}}function wl(e){let n=e.tags.find(f=>"delegation"===f[0]&&f.length>=4);if(!n)return null;let t=n[1],r=n[2],o=n[3],a=r.split("&");for(let f=0;f"===b&&e.created_at>parseInt(S))continue;return null}}let u=He(Le.encode(`nostr:delegation:${e.pubkey}:${r}`));return _n.verify(o,u,t)?t:null}ye({},{finishReactionEvent:()=>gl,getReactedEventPointer:()=>pl}),ye({},{createDelegation:()=>yl,getDelegator:()=>wl}),ye({},{matchAll:()=>_l,regex:()=>ui,replaceAll:()=>xl});var ui=()=>new RegExp(`\\b${br.source}\\b`,"g");function*_l(e){const n=e.matchAll(ui());for(const t of n)try{const[r,o]=t;yield{uri:r,value:o,decoded:qn(o),start:t.index,end:t.index+r.length}}catch{}}function xl(e,n){return e.replaceAll(ui(),(t,r)=>n({uri:t,value:r,decoded:qn(r)}))}ye({},{channelCreateEvent:()=>kl,channelHideMessageEvent:()=>Cl,channelMessageEvent:()=>Sl,channelMetadataEvent:()=>Ml,channelMuteUserEvent:()=>Al});var fi,kl=(e,n)=>{let t;if("object"==typeof e.content)t=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;t=e.content}return Ve({kind:40,tags:[...e.tags??[]],content:t,created_at:e.created_at},n)},Ml=(e,n)=>{let t;if("object"==typeof e.content)t=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;t=e.content}return Ve({kind:41,tags:[["e",e.channel_create_event_id],...e.tags??[]],content:t,created_at:e.created_at},n)},Sl=(e,n)=>{const t=[["e",e.channel_create_event_id,e.relay_url,"root"]];return e.reply_to_channel_message_event_id&&t.push(["e",e.reply_to_channel_message_event_id,e.relay_url,"reply"]),Ve({kind:42,tags:[...t,...e.tags??[]],content:e.content,created_at:e.created_at},n)},Cl=(e,n)=>{let t;if("object"==typeof e.content)t=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;t=e.content}return Ve({kind:43,tags:[["e",e.channel_message_event_id],...e.tags??[]],content:t,created_at:e.created_at},n)},Al=(e,n)=>{let t;if("object"==typeof e.content)t=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;t=e.content}return Ve({kind:44,tags:[["p",e.pubkey_to_mute],...e.tags??[]],content:t,created_at:e.created_at},n)};ye({},{useFetchImplementation:()=>Rl,validateGithub:()=>Il});try{fi=fetch}catch{}function Rl(e){fi=e}function Il(e,n,t){return hi.apply(this,arguments)}function hi(){return(hi=(0,y.A)(function*(e,n,t){try{return(yield(yield fi(`https://gist.github.com/${n}/${t}/raw`)).text())===`Verifying that I control the following Nostr public key: ${e}`}catch{return!1}})).apply(this,arguments)}ye({},{authenticate:()=>Nl});var Nl=function(){var e=(0,y.A)(function*({challenge:n,relay:t,sign:r}){const o={kind:22242,created_at:Math.floor(Date.now()/1e3),tags:[["relay",t.url],["challenge",n]],content:""};return t.auth(yield r(o))});return function(t){return e.apply(this,arguments)}}();ye({},{decrypt:()=>Ul,encrypt:()=>Ll,utils:()=>fn});var mi,fn={v2:{maxPlaintextSize:65408,minCiphertextSize:100,maxCiphertextSize:102400,getConversationKey:(e,n)=>bn.getSharedSecret(e,"02"+n).subarray(1,33),getMessageKeys(e,n){const t=((e,n,t,r,o)=>function Ea(e,n,t,r=32){if(Ae.hash(e),Ae.number(r),r>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const o=Math.ceil(r/e.outputLen);void 0===t&&(t=lo);const a=new Uint8Array(o*e.outputLen),u=wn.create(e,n),f=u._cloneInto(),g=new Uint8Array(u.outputLen);for(let b=0;b=fn.v2.maxPlaintextSize)throw new Error("invalid plaintext length: must be between 1b and 64KB");const r=fn.v2.calcPadding(t),o=new Uint8Array(r-t),a=new Uint8Array(2);return new DataView(a.buffer).setUint16(0,t),ir(a,n,o)},unpad(e){const n=new DataView(e.buffer).getUint16(0),t=e.subarray(2,2+n);if(0===n||t.length!==n||e.length!==2+fn.v2.calcPadding(n))throw new Error("invalid padding");return Fe.decode(t)}}};function Ll(e,n,t={}){const r=t.version??2;if(2!==r)throw new Error("unknown encryption version "+r);const o=t.salt??or(32);Zr(o,32);const a=fn.v2.getMessageKeys(e,o),u=fn.v2.pad(n),f=oo(a.encryption,a.nonce,u),g=wn(He,a.auth,f);return V.K3.encode(ir(new Uint8Array([r]),o,f,g))}function Ul(e,n){const t=fn.v2;Zr(e,32);const r=n.length;if(r=t.maxCiphertextSize)throw new Error("invalid ciphertext length: "+r);if("#"===n[0])throw new Error("unknown encryption version");let o;try{o=V.K3.decode(n)}catch($){throw new Error("invalid base64: "+$.message)}const a=o.subarray(0,1)[0];if(2!==a)throw new Error("unknown encryption version "+a);const u=o.subarray(1,33),f=o.subarray(33,-32),g=o.subarray(-32),b=t.getMessageKeys(e,u);if(!function ca(e,n){if(e.length!==n.length)throw new Error("equalBytes: Different size of Uint8Arrays");let t=!0;for(let r=0;rOl,parseConnectionString:()=>Dl}),ye({},{getZapEndpoint:()=>Gl,makeZapReceipt:()=>Hl,makeZapRequest:()=>zl,useFetchImplementation:()=>$l,validateZapRequest:()=>ql});try{mi=fetch}catch{}function $l(e){mi=e}function Gl(e){return gi.apply(this,arguments)}function gi(){return(gi=(0,y.A)(function*(e){try{let n="",{lud06:t,lud16:r}=JSON.parse(e.content);if(t){let{words:u}=V.I.decode(t,1e3),f=V.I.fromWords(u);n=Fe.decode(f)}else{if(!r)return null;{let[u,f]=r.split("@");n=`https://${f}/.well-known/lnurlp/${u}`}}let a=yield(yield mi(n)).json();if(a.allowsNostr&&a.nostrPubkey)return a.callback}catch{}return null})).apply(this,arguments)}function zl({profile:e,event:n,amount:t,relays:r,comment:o=""}){if(!t)throw new Error("amount not given");if(!e)throw new Error("profile not given");let a={kind:9734,created_at:Math.round(Date.now()/1e3),content:o,tags:[["p",e],["amount",t.toString()],["relays",...r]]};return n&&a.tags.push(["e",n]),a}function ql(e){let n;try{n=JSON.parse(e)}catch{return"Invalid zap request JSON."}if(!ei(n))return"Zap request is not a valid Nostr event.";if(!gr(n))return"Invalid signature on zap request.";let t=n.tags.find(([a,u])=>"p"===a&&u);if(!t)return"Zap request doesn't have a 'p' tag.";if(!t[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let r=n.tags.find(([a,u])=>"e"===a&&u);return r&&!r[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":n.tags.find(([a,u])=>"relays"===a&&u)?null:"Zap request doesn't have a 'relays' tag."}function Hl({zapRequest:e,preimage:n,bolt11:t,paidAt:r}){let a=JSON.parse(e).tags.filter(([f])=>"e"===f||"p"===f||"a"===f),u={kind:9735,created_at:Math.round(r.getTime()/1e3),content:"",tags:[...a,["bolt11",t],["description",e]]};return n&&u.tags.push(["preimage",n]),u}ye({},{getToken:()=>Wl,unpackEventFromToken:()=>Ao,validateEvent:()=>To,validateToken:()=>Yl});var Co="Nostr ";function Wl(e,n,t){return pi.apply(this,arguments)}function pi(){return(pi=(0,y.A)(function*(e,n,t,r=!1){if(!e||!n)throw new Error("Missing loginUrl or httpMethod");const o=function Ra(e=255){return{kind:e,content:"",tags:[],created_at:0}}(27235);o.tags=[["u",e],["method",n]],o.created_at=Math.round((new Date).getTime()/1e3);const a=yield t(o);return(r?Co:"")+V.K3.encode(Le.encode(JSON.stringify(a)))})).apply(this,arguments)}function Yl(e,n,t){return vi.apply(this,arguments)}function vi(){return(vi=(0,y.A)(function*(e,n,t){const r=yield Ao(e).catch(a=>{throw a});return yield To(r,n,t).catch(a=>{throw a})})).apply(this,arguments)}function Ao(e){return yi.apply(this,arguments)}function yi(){return(yi=(0,y.A)(function*(e){if(!e)throw new Error("Missing token");e=e.replace(Co,"");const n=Fe.decode(V.K3.decode(e));if(!n||0===n.length||!n.startsWith("{"))throw new Error("Invalid token");return JSON.parse(n)})).apply(this,arguments)}function To(e,n,t){return wi.apply(this,arguments)}function wi(){return(wi=(0,y.A)(function*(e,n,t){if(!e)throw new Error("Invalid nostr event");if(!gr(e))throw new Error("Invalid nostr event, signature invalid");if(27235!==e.kind)throw new Error("Invalid nostr event, kind invalid");if(!e.created_at)throw new Error("Invalid nostr event, created_at invalid");if(Math.round((new Date).getTime()/1e3)-e.created_at>60)throw new Error("Invalid nostr event, expired");const r=e.tags.find(a=>"u"===a[0]);if(1!==r?.length&&r?.[1]!==n)throw new Error("Invalid nostr event, url tag invalid");const o=e.tags.find(a=>"method"===a[0]);if(1!==o?.length&&o?.[1].toLowerCase()!==t.toLowerCase())throw new Error("Invalid nostr event, method tag invalid");return!0})).apply(this,arguments)}function It(){return It=Object.assign?Object.assign.bind():function(e){for(var n=1;ne.reduce((n,t)=>n+t.toString(16).padStart(2,"0"),"");class No extends Error{constructor(n,t,r,o){let a=n.toString();t&&(a+=` ${t}`),a+=": ",a+=o.message?o.message:JSON.stringify(o),super(a),this.status=void 0,this.statusText=void 0,this.headers=void 0,this.error=void 0,this.status=n,this.statusText=t,this.headers=r,this.error=o}}const Kl=["auth","endpoint","params","request_body","method","max_retries","base_url","user_agent","headers"],Zl="https://api.getalby.com";function Po(e,n){return _i.apply(this,arguments)}function _i(){return(_i=(0,y.A)(function*(e,n,t=0){const r=yield fetch(e,n);if(429===r.status&&t>0){const o=Number(r.headers.get("x-rate-limit-reset")),a=Number(r.headers.get("x-rate-limit-remaining")),u=1e3*o-Date.now();let f=1e3;return 0===a&&(f=u),yield new Promise(g=>setTimeout(g,f)),Po(e,n,t-1)}return r})).apply(this,arguments)}function xi(){return(xi=(0,y.A)(function*(e){let{auth:n,endpoint:t,params:r={},request_body:o,method:a,max_retries:u,base_url:f=Zl,user_agent:g,headers:b}=e,S=function bi(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r=0||(o[t]=e[t]);return o}(e,Kl);const T=new URL(f+t);T.search=function Ro(e){return Object.entries(e).map(([n,t])=>n&&t?`${n}=${t}`:"").filter(n=>n).join("&")}(r);const $="POST"===a&&!!o,D=n?yield n.getAuthHeader(T.href,a):void 0,U=yield Po(T.toString(),It({headers:It({},$?{"Content-Type":"application/json; charset=utf-8"}:void 0,D,b,{"User-Agent":g??"@getalby/sdk","X-User-Agent":g??"@getalby/sdk"}),method:a,body:$?JSON.stringify(o):void 0},S),u);if(!U.ok){const P=yield U.json();throw new No(U.status,U.statusText,U.headers,P)}return U})).apply(this,arguments)}function we(e){return Ei.apply(this,arguments)}function Ei(){return Ei=(0,y.A)(function*(e){return(yield function Xl(e){return xi.apply(this,arguments)}(e)).json()}),Ei.apply(this,arguments)}class Uo{constructor(n){this.bearer_token=void 0,this.bearer_token=n}getAuthHeader(){return{Authorization:`Bearer ${this.bearer_token}`}}}class en extends Error{constructor(n,t){super(n),this.error=void 0,this.code=void 0,this.error=n,this.code=t}}class jo extends en{}class ki extends en{}class Mi extends ki{}class Si extends ki{}class Ci extends en{}class Ai extends en{}class _r extends en{}class Do extends en{}class Oo extends en{}const Fo={alby:{authorizationUrl:"https://nwc.getalby.com/apps/new",relayUrl:"wss://relay.getalby.com/v1",walletPubkey:"69effe7b49a6dd5cf525bd0905917a5005ffe480b58eeb8e861418cf3ae760d9"}};class Vn{static parseWalletConnectUrl(n){n=n.replace("nostrwalletconnect://","http://").replace("nostr+walletconnect://","http://").replace("nostrwalletconnect:","http://").replace("nostr+walletconnect:","http://");const t=new URL(n),r=t.searchParams.get("relay");if(!r)throw new Error("No relay URL found in connection string");const o={walletPubkey:t.host,relayUrl:r},a=t.searchParams.get("secret");a&&(o.secret=a);const u=t.searchParams.get("lud16");return u&&(o.lud16=u),o}static withNewSecret(n){return(n=n||{}).secret=co(),new Vn(n)}constructor(n){var t;this.relay=void 0,this.relayUrl=void 0,this.secret=void 0,this.lud16=void 0,this.walletPubkey=void 0,this.options=void 0,n&&n.nostrWalletConnectUrl&&(n=It({},Vn.parseWalletConnectUrl(n.nostrWalletConnectUrl),n));const r=Fo[(null==(t=n)?void 0:t.providerName)||"alby"];this.options=It({},r,n||{}),this.relayUrl=this.options.relayUrl,this.relay=yo(this.relayUrl),this.options.secret&&(this.secret=this.options.secret.toLowerCase().startsWith("nsec")?ri.decode(this.options.secret).data:this.options.secret),this.lud16=this.options.lud16,this.walletPubkey=this.options.walletPubkey.toLowerCase().startsWith("npub")?ri.decode(this.options.walletPubkey).data:this.options.walletPubkey,void 0===globalThis.WebSocket&&console.error("WebSocket is undefined. Make sure to `import websocket-polyfill` for nodejs environments")}get nostrWalletConnectUrl(){return this.getNostrWalletConnectUrl()}getNostrWalletConnectUrl(n=!0){let t=`nostr+walletconnect://${this.walletPubkey}?relay=${this.relayUrl}&pubkey=${this.publicKey}`;return n&&(t=`${t}&secret=${this.secret}`),t}get connected(){return 1===this.relay.status}get publicKey(){if(!this.secret)throw new Error("Missing secret key");return Qr(this.secret)}getPublicKey(){return Promise.resolve(this.publicKey)}signEvent(n){if(!this.secret)throw new Error("Missing secret key");return Promise.resolve(Ve(n,this.secret))}getEventHash(n){return zn(n)}close(){return this.relay.close()}encrypt(n,t){var r=this;return(0,y.A)(function*(){if(!r.secret)throw new Error("Missing secret");return yield oi.encrypt(r.secret,n,t)})()}decrypt(n,t){var r=this;return(0,y.A)(function*(){if(!r.secret)throw new Error("Missing secret");return yield oi.decrypt(r.secret,n,t)})()}getAuthorizationUrl(n){if(!this.options.authorizationUrl)throw new Error("Missing authorizationUrl option");const t=new URL(this.options.authorizationUrl);return null!=n&&n.name&&t.searchParams.set("name",n?.name),t.searchParams.set("pubkey",this.publicKey),null!=n&&n.returnTo&&t.searchParams.set("return_to",n.returnTo),null!=n&&n.budgetRenewal&&t.searchParams.set("budget_renewal",n.budgetRenewal),null!=n&&n.expiresAt&&t.searchParams.set("expires_at",Math.floor(n.expiresAt.getTime()/1e3).toString()),null!=n&&n.maxAmount&&t.searchParams.set("max_amount",n.maxAmount.toString()),void 0!==n?.editable&&t.searchParams.set("editable",n.editable.toString()),null!=n&&n.requestMethods&&t.searchParams.set("request_methods",n.requestMethods.join(" ")),t}initNWC(n={}){n.name||(n.name=document.location.host);const t=this.getAuthorizationUrl(n),r=window.outerHeight/2+window.screenY-300,o=window.outerWidth/2+window.screenX-200;return new Promise((a,u)=>{const f=window.open(t.toString(),`${document.title} - Wallet Connect`,`height=600,width=400,top=${r},left=${o}`);if(!f)return void u(new Error("failed to execute window.open"));const g=S=>{const T=S.data;T&&"nwc:success"===T.type&&S.origin===`${t.protocol}//${t.host}`&&(a(T),clearInterval(b),window.removeEventListener("message",g),f&&f.close())},b=setInterval(()=>{f&&f.closed&&(clearInterval(b),window.removeEventListener("message",g),u(new Error("Popup closed")))},500);window.addEventListener("message",g)})}getWalletServiceSupportedMethods(){var n=this;return(0,y.A)(function*(){return console.warn("getWalletServiceSupportedMethods is deprecated. Please use getWalletServiceInfo instead."),(yield n.getWalletServiceInfo()).capabilities})()}getWalletServiceInfo(){var n=this;return(0,y.A)(function*(){var t;yield n._checkConnected();const r=yield n.relay.list([{kinds:[13194],limit:1,authors:[n.walletPubkey]}],{eoseSubTimeout:1e4});if(!r.length)throw new Error("no info event (kind 13194) returned from relay");const o=r[0].content,a=r[0].tags.find(u=>"notifications"===u[0]);return{capabilities:o.split(/[ |,]/g),notifications:(null==a||null==(t=a[1])?void 0:t.split(" "))||[]}})()}getInfo(){var n=this;return(0,y.A)(function*(){try{return yield n.executeNip47Request("get_info",{},t=>!!t.methods)}catch(t){throw console.error("Failed to request get_info",t),t}})()}getBalance(){var n=this;return(0,y.A)(function*(){try{return yield n.executeNip47Request("get_balance",{},t=>void 0!==t.balance)}catch(t){throw console.error("Failed to request get_balance",t),t}})()}payInvoice(n){var t=this;return(0,y.A)(function*(){try{return yield t.executeNip47Request("pay_invoice",n,r=>!!r.preimage)}catch(r){throw console.error("Failed to request pay_invoice",r),r}})()}payKeysend(n){var t=this;return(0,y.A)(function*(){try{return yield t.executeNip47Request("pay_keysend",n,r=>!!r.preimage)}catch(r){throw console.error("Failed to request pay_keysend",r),r}})()}signMessage(n){var t=this;return(0,y.A)(function*(){try{return yield t.executeNip47Request("sign_message",n,r=>r.message===n.message&&!!r.signature)}catch(r){throw console.error("Failed to request sign_message",r),r}})()}multiPayInvoice(n){var t=this;return(0,y.A)(function*(){try{return{invoices:yield t.executeMultiNip47Request("multi_pay_invoice",n,n.invoices.length,r=>!!r.preimage),errors:[]}}catch(r){throw console.error("Failed to request multi_pay_invoice",r),r}})()}multiPayKeysend(n){var t=this;return(0,y.A)(function*(){try{return{keysends:yield t.executeMultiNip47Request("multi_pay_keysend",n,n.keysends.length,r=>!!r.preimage),errors:[]}}catch(r){throw console.error("Failed to request multi_pay_keysend",r),r}})()}makeInvoice(n){var t=this;return(0,y.A)(function*(){try{if(!n.amount)throw new Error("No amount specified");return yield t.executeNip47Request("make_invoice",n,r=>!!r.invoice)}catch(r){throw console.error("Failed to request make_invoice",r),r}})()}lookupInvoice(n){var t=this;return(0,y.A)(function*(){try{return yield t.executeNip47Request("lookup_invoice",n,r=>!!r.invoice)}catch(r){throw console.error("Failed to request lookup_invoice",r),r}})()}listTransactions(n){var t=this;return(0,y.A)(function*(){try{return yield t.executeNip47Request("list_transactions",n,r=>!!r.transactions)}catch(r){throw console.error("Failed to request list_transactions",r),r}})()}subscribeNotifications(n,t){var r=this;return(0,y.A)(function*(){var o=r;let a,u,f,g=!0;return(0,y.A)(function*(){for(;g;){try{yield o._checkConnected(),f=o.relay.sub([{kinds:[23196],authors:[o.walletPubkey],"#p":[o.publicKey]}]),console.info("subscribed to relay"),f.on("event",function(){var b=(0,y.A)(function*(S){const T=yield o.decrypt(o.walletPubkey,S.content);let $;try{$=JSON.parse(T)}catch(D){return void console.error("Failed to parse decrypted event content",D)}$.notification?(!t||t.indexOf($.notification_type)>-1)&&n($):console.error("No notification in response",$)});return function(S){return b.apply(this,arguments)}}()),yield new Promise(b=>{a=()=>{b()},u=()=>{console.info("relay disconnected"),a?.()},o.relay.on("disconnect",u)}),void 0!==u&&o.relay.off("disconnect",u)}catch(b){console.error("error subscribing to notifications",b||"unknown relay error")}g&&(yield new Promise(b=>setTimeout(b,1e3)))}})(),()=>{var b;g=!1,a?.(),null==(b=f)||b.unsub()}})()}executeNip47Request(n,t,r){var o=this;return(0,y.A)(function*(){var a=o;return yield o._checkConnected(),new Promise((u,f)=>{(0,y.A)(function*(){const g={method:n,params:t},b=yield a.encrypt(a.walletPubkey,JSON.stringify(g)),S={kind:23194,created_at:Math.floor(Date.now()/1e3),tags:[["p",a.walletPubkey]],content:b,pubkey:a.publicKey},T=yield a.signEvent(S),$=a.relay.sub([{kinds:[23195],authors:[a.walletPubkey],"#e":[T.id]}]),D=setTimeout(function(){$.unsub(),f(new Si(`reply timeout: event ${T.id}`,"INTERNAL"))},6e4);$.on("event",function(){var P=(0,y.A)(function*(F){clearTimeout(D),$.unsub();const z=yield a.decrypt(a.walletPubkey,F.content);let W;try{W=JSON.parse(z)}catch{return clearTimeout(D),$.unsub(),void f(new Ai("failed to deserialize response","INTERNAL"))}var J,Y;W.result?r(W.result)?u(W.result):(clearTimeout(D),$.unsub(),f(new _r("response from NWC failed validation: "+JSON.stringify(W.result),"INTERNAL"))):(clearTimeout(D),$.unsub(),f(new jo((null==(J=W.error)?void 0:J.message)||"unknown Error",(null==(Y=W.error)?void 0:Y.code)||"INTERNAL")))});return function(F){return P.apply(this,arguments)}}());const U=setTimeout(function(){$.unsub(),f(new Mi(`publish timeout: ${T.id}`,"INTERNAL"))},5e3);try{yield a.relay.publish(T),clearTimeout(U)}catch(P){clearTimeout(U),f(new Ci(`failed to publish: ${P}`,"INTERNAL"))}})()})})()}executeMultiNip47Request(n,t,r,o){var a=this;return(0,y.A)(function*(){var u=a;yield a._checkConnected();const f=[];return new Promise((g,b)=>{(0,y.A)(function*(){const S={method:n,params:t},T=yield u.encrypt(u.walletPubkey,JSON.stringify(S)),$={kind:23194,created_at:Math.floor(Date.now()/1e3),tags:[["p",u.walletPubkey]],content:T,pubkey:u.publicKey},D=yield u.signEvent($),U=u.relay.sub([{kinds:[23195],authors:[u.walletPubkey],"#e":[D.id]}]),P=setTimeout(function(){U.unsub(),b(new Si(`reply timeout: event ${D.id}`,"INTERNAL"))},6e4);U.on("event",function(){var z=(0,y.A)(function*(W){const J=yield u.decrypt(u.walletPubkey,W.content);let Y;try{Y=JSON.parse(J)}catch{clearTimeout(P),U.unsub(),b(new Ai("failed to deserialize response","INTERNAL"))}if(Y.result){var rt;if(!o(Y.result))return clearTimeout(P),U.unsub(),void b(new _r("Response from NWC failed validation: "+JSON.stringify(Y.result),"INTERNAL"));const et=null==(rt=W.tags.find(Q=>"d"===Q[0]))?void 0:rt[1];if(void 0===et)return clearTimeout(P),U.unsub(),void b(new _r("No d tag found in response event","INTERNAL"));f.push(It({},Y.result,{dTag:et})),f.length===r&&(clearTimeout(P),U.unsub(),g(f))}else{var q,Z;clearTimeout(P),U.unsub(),b(new Do(null==(q=Y.error)?void 0:q.message,null==(Z=Y.error)?void 0:Z.code))}});return function(W){return z.apply(this,arguments)}}());const F=setTimeout(function(){U.unsub(),b(new Mi(`Publish timeout: ${D.id}`,"INTERNAL"))},5e3);try{yield u.relay.publish(D),clearTimeout(F)}catch(z){clearTimeout(F),b(new Ci(`Failed to publish: ${z}`,"INTERNAL"))}})()})})()}_checkConnected(){var n=this;return(0,y.A)(function*(){if(!n.secret)throw new Error("Missing secret key");try{yield n.relay.connect()}catch{throw console.error("failed to connect to relay",n.relayUrl),new Oo("Failed to connect to "+n.relayUrl,"OTHER")}})()}}const tc={get_info:"getInfo",get_balance:"getBalance",make_invoice:"makeInvoice",pay_invoice:"sendPayment",pay_keysend:"payKeysend",lookup_invoice:"lookupInvoice",list_transactions:"listTransactions",multi_pay_invoice:"sendMultiPayment",multi_pay_keysend:"multiKeysend",sign_message:"signMessage"};class xr{get relay(){return console.warn("relay is deprecated. Please use client.relay instead."),this.client.relay}get relayUrl(){return console.warn("relayUrl is deprecated. Please use client.relayUrl instead."),this.client.relayUrl}get walletPubkey(){return console.warn("walletPubkey is deprecated. Please use client.walletPubkey instead."),this.client.walletPubkey}get options(){return this.client.options}get secret(){return console.warn("secret is deprecated. Please use client.secret instead."),this.client.secret}static withNewSecret(n){return(n=n||{}).secret=co(),new xr(n)}constructor(n){this._enabled=!1,this.client=void 0,this.subscribers=void 0,this.client=new Vn(n),this.subscribers={}}on(n,t){this.subscribers[n]=t}notify(n,t){const r=this.subscribers[n];r&&r(t)}getNostrWalletConnectUrl(n=!0){return console.warn("getNostrWalletConnectUrl is deprecated. Please use client.getNostrWalletConnectUrl instead."),this.client.getNostrWalletConnectUrl(n)}get nostrWalletConnectUrl(){return console.warn("nostrWalletConnectUrl is deprecated. Please use client.nostrWalletConnectUrl instead."),this.client.nostrWalletConnectUrl}get connected(){return console.warn("connected is deprecated. Please use client.connected instead."),this.client.connected}get publicKey(){return console.warn("publicKey is deprecated. Please use client.publicKey instead."),this.client.publicKey}getPublicKey(){return this.client.getPublicKey()}signEvent(n){return this.client.signEvent(n)}getEventHash(n){return console.warn("getEventHash is deprecated. Please use client.getEventHash instead."),this.client.getEventHash(n)}enable(){var n=this;return(0,y.A)(function*(){n._enabled=!0})()}close(){return this.client.close()}encrypt(n,t){var r=this;return(0,y.A)(function*(){return console.warn("encrypt is deprecated. Please use client.encrypt instead."),r.client.encrypt(n,t)})()}decrypt(n,t){var r=this;return(0,y.A)(function*(){return console.warn("decrypt is deprecated. Please use client.decrypt instead."),r.client.decrypt(n,t)})()}getAuthorizationUrl(n){return console.warn("getAuthorizationUrl is deprecated. Please use client.getAuthorizationUrl instead."),this.client.getAuthorizationUrl(n)}initNWC(n={}){return console.warn("initNWC is deprecated. Please use client.initNWC instead."),this.client.initNWC(n)}getInfo(){var n=this;return(0,y.A)(function*(){yield n.checkEnabled();const t=["lightning","nostr"],r="Alby JS SDK";try{const o=yield n.client.getInfo(),a={methods:o.methods.map(u=>tc[u]),node:{alias:o.alias,pubkey:o.pubkey,color:o.color},supports:t,version:r};return n.notify("getInfo",a),a}catch(o){return console.error("Using minimal getInfo",o),{methods:["sendPayment"],node:{},supports:t,version:r}}})()}getBalance(){var n=this;return(0,y.A)(function*(){yield n.checkEnabled();const t=yield n.client.getBalance(),r={balance:Math.floor(t.balance/1e3),currency:"sats"};return n.notify("getBalance",r),r})()}sendPayment(n){var t=this;return(0,y.A)(function*(){yield t.checkEnabled();const r={preimage:(yield t.client.payInvoice({invoice:n})).preimage};return t.notify("sendPayment",r),r})()}sendPaymentAsync(n){var t=this;return(0,y.A)(function*(){return yield t.checkEnabled(),t.client.payInvoice({invoice:n}),t.notify("sendPaymentAsync",{}),{}})()}keysend(n){var t=this;return(0,y.A)(function*(){yield t.checkEnabled();const r={preimage:(yield t.client.payKeysend($o(n))).preimage};return t.notify("keysend",r),r})()}signMessage(n){var t=this;return(0,y.A)(function*(){yield t.checkEnabled();const r=yield t.client.signMessage({message:n}),o={message:r.message,signature:r.signature};return t.notify("keysend",o),o})()}makeInvoice(n){var t=this;return(0,y.A)(function*(){var r;yield t.checkEnabled();const o="object"==typeof n?n:void 0,a=+(null!=(r=o?.amount)?r:n);if(!a)throw new Error("No amount specified");const u={paymentRequest:(yield t.client.makeInvoice({amount:1e3*a,description:o?.defaultMemo})).invoice};return t.notify("makeInvoice",u),u})()}lookupInvoice(n){var t=this;return(0,y.A)(function*(){yield t.checkEnabled();const r=yield t.client.lookupInvoice({invoice:n.paymentRequest,payment_hash:n.paymentHash}),o={preimage:r.preimage,paymentRequest:r.invoice,paid:!!r.settled_at};return t.notify("lookupInvoice",o),o})()}listTransactions(n){var t=this;return(0,y.A)(function*(){yield t.checkEnabled();const r={transactions:(yield t.client.listTransactions(n)).transactions.map(ec)};return t.notify("listTransactions",r),r})()}sendMultiPayment(n){var t=this;return(0,y.A)(function*(){yield t.checkEnabled();const o={payments:(yield t.client.multiPayInvoice({invoices:n.map((a,u)=>({invoice:a,id:u.toString()}))})).invoices.map(a=>{const u=n[parseInt(a.dTag)];if(!u)throw new Error("Could not find paymentRequest matching response d tag");return{paymentRequest:u,preimage:a.preimage}}),errors:[]};return t.notify("sendMultiPayment",o),o})()}multiKeysend(n){var t=this;return(0,y.A)(function*(){yield t.checkEnabled();const o={keysends:(yield t.client.multiPayKeysend({keysends:n.map((a,u)=>It({},$o(a),{id:u.toString()}))})).keysends.map(a=>{const u=n[parseInt(a.dTag)];if(!u)throw new Error("Could not find keysend matching response d tag");return{keysend:u,preimage:a.preimage}}),errors:[]};return t.notify("multiKeysend",o),o})()}lnurl(n){throw new Error("Method not implemented.")}request(n,t){throw new Error("Method not implemented.")}verifyMessage(n,t){throw new Error("Method not implemented.")}checkEnabled(){var n=this;return(0,y.A)(function*(){if(!n._enabled)throw new Error("please call enable() and await the promise before calling this function")})()}}function ec(e){return It({},e,{amount:Math.floor(e.amount/1e3),fees_paid:e.fees_paid?Math.floor(e.fees_paid/1e3):0})}function $o(e){return{amount:1e3*+e.amount,pubkey:e.destination,tlv_records:e.customRecords?Object.entries(e.customRecords).map(n=>({type:parseInt(n[0]),value:Bo((new TextEncoder).encode(n[1]))})):[]}}const nc=xr;function Go(e){const n={};return e.recipient.customKey&&e.recipient.customValue&&(n[e.recipient.customKey]=e.recipient.customValue),n[7629169]=JSON.stringify(e.boostagram),{destination:e.recipient.address,amount:e.amount,custom_records:n}}class zo{constructor(n,t){this.auth=void 0,this.defaultRequestOptions=void 0,this.auth="string"==typeof n?new Uo(n):n,this.defaultRequestOptions=It({},t,{user_agent:t?.user_agent})}accountBalance(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/balance",params:n,method:"GET"}))}accountSummary(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/user/summary",params:n,method:"GET"}))}accountInformation(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/user/me",params:n,method:"GET"}))}accountValue4Value(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/user/value4value",params:n,method:"GET"}))}incomingInvoices(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/invoices/incoming",params:n,method:"GET"}))}outgoingInvoices(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/invoices/outgoing",params:n,method:"GET"}))}invoices(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/invoices",params:n,method:"GET"}))}getInvoice(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:`/invoices/${n}`,method:"GET"}))}decodeInvoice(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:`/decode/bolt11/${n}`,method:"GET"}))}createInvoice(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/invoices",request_body:n,method:"POST"}))}keysend(n,t){let r,o;return Array.isArray(n)?(r="/payments/keysend/multi",o={keysends:n.map(a=>It({},a,{custom_records:a.customRecords}))}):(r="/payments/keysend",o=It({},n,{custom_records:n.customRecords})),we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:r,request_body:o,method:"POST"}))}sendPayment(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/payments/bolt11",request_body:n,method:"POST"}))}sendBoostagram(n,t){let r,o;return Array.isArray(n)?(r="/payments/keysend/multi",o={keysends:n.map(a=>Go(a))}):(r="/payments/keysend",o=Go(n)),we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:r,request_body:o,method:"POST"}))}sendToAlbyAccount(n,t){return console.warn("sendToAlbyAccount is deprecated. Please use sendBoostagramToAlbyAccount instead."),this.sendBoostagramToAlbyAccount(n,t)}sendBoostagramToAlbyAccount(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/payments/keysend",request_body:{destination:"030a58b8653d32b99200a2334cfe913e51dc7d155aa0116c176657a4f1722677a3",custom_records:{696969:n.account},amount:n.amount,memo:n.memo},method:"POST"}))}createWebhookEndpoint(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/webhook_endpoints",request_body:n,method:"POST"}))}deleteWebhookEndpoint(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:`/webhook_endpoints/${n}`,method:"DELETE"}))}getSwapInfo(n){return we(It({auth:this.auth},this.defaultRequestOptions,n,{endpoint:"/swaps/info",method:"GET"}))}createSwap(n,t){return we(It({auth:this.auth},this.defaultRequestOptions,t,{endpoint:"/swaps",method:"POST",request_body:n}))}}var Er={__proto__:null,NostrWebLNProvider:xr,NWC:nc,OauthWeblnProvider:class{constructor(e){this.client=void 0,this.auth=void 0,this.oauth=void 0,this.subscribers=void 0,this.isExecuting=void 0,this.auth=e.auth,this.client=new zo(e.auth),this.oauth=!0,this.subscribers={},this.isExecuting=!1}on(e,n){this.subscribers[e]=n}notify(e,n){const t=this.subscribers[e];t&&t(n)}enable(){var e=this;return(0,y.A)(function*(){var n;if(!e.isExecuting){if(null!=(n=e.auth.token)&&n.access_token)return{enabled:!0};if(typeof window>"u"||void 0===window.document)throw new Error("Missing access token");try{e.isExecuting=!0,yield e.openAuthorization()}finally{e.isExecuting=!1}}})()}sendPayment(e){var n=this;return(0,y.A)(function*(){if(!n.isExecuting)try{n.isExecuting=!0;const t=yield n.client.sendPayment({invoice:e});return n.notify("sendPayment",t),{preimage:t.payment_preimage}}catch(t){let r="Unknown Error";throw t instanceof Error&&(r=t.message),new Error(r)}finally{n.isExecuting=!1}})()}keysend(e){var n=this;return(0,y.A)(function*(){if(!n.isExecuting)try{n.isExecuting=!0;const t=yield n.client.keysend(e);return n.notify("keysend",t),{preimage:t.payment_preimage}}catch(t){let r="Unknown Error";throw t instanceof Error&&(r=t.message),new Error(r)}finally{n.isExecuting=!1}})()}getInfo(){return(0,y.A)(function*(){return{alias:"Alby"}})()}makeInvoice(e){var n=this;return(0,y.A)(function*(){if(!n.isExecuting)try{n.isExecuting=!0;const t=yield n.client.createInvoice({amount:parseInt(e.amount.toString()),description:e.defaultMemo});return n.notify("makeInvoice",t),{paymentRequest:t.payment_request}}catch(t){let r="Unknown Error";throw t instanceof Error&&(r=t.message),new Error(r)}finally{n.isExecuting=!1}})()}openAuthorization(){var e=this;return(0,y.A)(function*(){var n=e;const t=window.outerHeight/2+window.screenY-350,r=window.outerWidth/2+window.screenX-300,o=yield e.auth.generateAuthURL({code_challenge_method:"S256"});return new Promise((a,u)=>{const f=window.open(o,`${document.title} - WebLN enable`,`height=700,width=600,top=${t},left=${r}`);let g=!1;window.addEventListener("message",function(){var b=(0,y.A)(function*(S){const T=S.data;if(T&&"alby:oauth:success"===T.type&&S.origin===`${document.location.protocol}//${document.location.host}`&&!g){g=!0,console.info("Processing OAuth code response");const $=T.payload.code;try{yield n.auth.requestAccessToken($),n.client=new zo(n.auth),f&&f.close(),n.notify("enable"),a({enabled:!0})}catch(D){console.error(D),u({enabled:!1})}}});return function(S){return b.apply(this,arguments)}}())})})()}}},$e=M(9969),En=M(6939),rc=M(6860),ic=M(9888),qo=M(9327),Ho=M(7987);function oc(e,n){if(1&e){const t=i.RV6();i.j41(0,"div",1)(1,"button",2),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.action())}),i.EFF(2),i.k0s()()}if(2&e){const t=i.XpG();i.R7$(2),i.SpI(" ",t.data.action," ")}}const sc=["label"];function ac(e,n){}const lc=Math.pow(2,31)-1;class Ti{constructor(n,t){this._overlayRef=t,this._afterDismissed=new Lt.B,this._afterOpened=new Lt.B,this._onAction=new Lt.B,this._dismissedByAction=!1,this.containerInstance=n,n._onExit.subscribe(()=>this._finishDismiss())}dismiss(){this._afterDismissed.closed||this.containerInstance.exit(),clearTimeout(this._durationTimeoutId)}dismissWithAction(){this._onAction.closed||(this._dismissedByAction=!0,this._onAction.next(),this._onAction.complete(),this.dismiss()),clearTimeout(this._durationTimeoutId)}closeWithAction(){this.dismissWithAction()}_dismissAfter(n){this._durationTimeoutId=setTimeout(()=>this.dismiss(),Math.min(n,lc))}_open(){this._afterOpened.closed||(this._afterOpened.next(),this._afterOpened.complete())}_finishDismiss(){this._overlayRef.dispose(),this._onAction.closed||this._onAction.complete(),this._afterDismissed.next({dismissedByAction:this._dismissedByAction}),this._afterDismissed.complete(),this._dismissedByAction=!1}afterDismissed(){return this._afterDismissed}afterOpened(){return this.containerInstance._onEnter}onAction(){return this._onAction}}const Vo=new i.nKC("MatSnackBarData");class kr{constructor(){this.politeness="assertive",this.announcementMessage="",this.duration=0,this.data=null,this.horizontalPosition="center",this.verticalPosition="bottom"}}let Wo=(()=>{class e{static#t=this.\u0275fac=function(r){return new(r||e)};static#e=this.\u0275dir=i.FsC({type:e,selectors:[["","matSnackBarLabel",""]],hostAttrs:[1,"mat-mdc-snack-bar-label","mdc-snackbar__label"],standalone:!0})}return e})(),Yo=(()=>{class e{static#t=this.\u0275fac=function(r){return new(r||e)};static#e=this.\u0275dir=i.FsC({type:e,selectors:[["","matSnackBarActions",""]],hostAttrs:[1,"mat-mdc-snack-bar-actions","mdc-snackbar__actions"],standalone:!0})}return e})(),Ko=(()=>{class e{static#t=this.\u0275fac=function(r){return new(r||e)};static#e=this.\u0275dir=i.FsC({type:e,selectors:[["","matSnackBarAction",""]],hostAttrs:[1,"mat-mdc-snack-bar-action","mdc-snackbar__action"],standalone:!0})}return e})(),cc=(()=>{class e{constructor(t,r){this.snackBarRef=t,this.data=r}action(){this.snackBarRef.dismissWithAction()}get hasAction(){return!!this.data.action}static#t=this.\u0275fac=function(r){return new(r||e)(i.rXU(Ti),i.rXU(Vo))};static#e=this.\u0275cmp=i.VBU({type:e,selectors:[["simple-snack-bar"]],hostAttrs:[1,"mat-mdc-simple-snack-bar"],exportAs:["matSnackBar"],standalone:!0,features:[i.aNF],decls:3,vars:2,consts:[["matSnackBarLabel",""],["matSnackBarActions",""],["mat-button","","matSnackBarAction","",3,"click"]],template:function(r,o){1&r&&(i.j41(0,"div",0),i.EFF(1),i.k0s(),i.DNE(2,oc,3,1,"div",1)),2&r&&(i.R7$(),i.SpI(" ",o.data.message,"\n"),i.R7$(),i.vxM(o.hasAction?2:-1))},dependencies:[I.$z,Wo,Yo,Ko],styles:[".mat-mdc-simple-snack-bar{display:flex}"],encapsulation:2,changeDetection:0})}return e})();const uc={snackBarState:(0,$e.hZ)("state",[(0,$e.wk)("void, hidden",(0,$e.iF)({transform:"scale(0.8)",opacity:0})),(0,$e.wk)("visible",(0,$e.iF)({transform:"scale(1)",opacity:1})),(0,$e.kY)("* => visible",(0,$e.i0)("150ms cubic-bezier(0, 0, 0.2, 1)")),(0,$e.kY)("* => void, * => hidden",(0,$e.i0)("75ms cubic-bezier(0.4, 0.0, 1, 1)",(0,$e.iF)({opacity:0})))])};let fc=0,Zo=(()=>{class e extends En.lb{constructor(t,r,o,a,u){super(),this._ngZone=t,this._elementRef=r,this._changeDetectorRef=o,this._platform=a,this.snackBarConfig=u,this._document=(0,i.WQX)(m.qQ),this._trackedModals=new Set,this._announceDelay=150,this._destroyed=!1,this._onAnnounce=new Lt.B,this._onExit=new Lt.B,this._onEnter=new Lt.B,this._animationState="void",this._liveElementId="mat-snack-bar-container-live-"+fc++,this.attachDomPortal=f=>{this._assertNotAttached();const g=this._portalOutlet.attachDomPortal(f);return this._afterPortalAttached(),g},this._live="assertive"!==u.politeness||u.announcementMessage?"off"===u.politeness?"off":"polite":"assertive",this._platform.FIREFOX&&("polite"===this._live&&(this._role="status"),"assertive"===this._live&&(this._role="alert"))}attachComponentPortal(t){this._assertNotAttached();const r=this._portalOutlet.attachComponentPortal(t);return this._afterPortalAttached(),r}attachTemplatePortal(t){this._assertNotAttached();const r=this._portalOutlet.attachTemplatePortal(t);return this._afterPortalAttached(),r}onAnimationEnd(t){const{fromState:r,toState:o}=t;if(("void"===o&&"void"!==r||"hidden"===o)&&this._completeExit(),"visible"===o){const a=this._onEnter;this._ngZone.run(()=>{a.next(),a.complete()})}}enter(){this._destroyed||(this._animationState="visible",this._changeDetectorRef.markForCheck(),this._changeDetectorRef.detectChanges(),this._screenReaderAnnounce())}exit(){return this._ngZone.run(()=>{this._animationState="hidden",this._changeDetectorRef.markForCheck(),this._elementRef.nativeElement.setAttribute("mat-exit",""),clearTimeout(this._announceTimeoutId)}),this._onExit}ngOnDestroy(){this._destroyed=!0,this._clearFromModals(),this._completeExit()}_completeExit(){queueMicrotask(()=>{this._onExit.next(),this._onExit.complete()})}_afterPortalAttached(){const t=this._elementRef.nativeElement,r=this.snackBarConfig.panelClass;r&&(Array.isArray(r)?r.forEach(u=>t.classList.add(u)):t.classList.add(r)),this._exposeToModals();const o=this._label.nativeElement,a="mdc-snackbar__label";o.classList.toggle(a,!o.querySelector(`.${a}`))}_exposeToModals(){const t=this._liveElementId,r=this._document.querySelectorAll('body > .cdk-overlay-container [aria-modal="true"]');for(let o=0;o{const r=t.getAttribute("aria-owns");if(r){const o=r.replace(this._liveElementId,"").trim();o.length>0?t.setAttribute("aria-owns",o):t.removeAttribute("aria-owns")}}),this._trackedModals.clear()}_assertNotAttached(){this._portalOutlet.hasAttached()}_screenReaderAnnounce(){this._announceTimeoutId||this._ngZone.runOutsideAngular(()=>{this._announceTimeoutId=setTimeout(()=>{const t=this._elementRef.nativeElement.querySelector("[aria-hidden]"),r=this._elementRef.nativeElement.querySelector("[aria-live]");if(t&&r){let o=null;this._platform.isBrowser&&document.activeElement instanceof HTMLElement&&t.contains(document.activeElement)&&(o=document.activeElement),t.removeAttribute("aria-hidden"),r.appendChild(t),o?.focus(),this._onAnnounce.next(),this._onAnnounce.complete()}},this._announceDelay)})}static#t=this.\u0275fac=function(r){return new(r||e)(i.rXU(i.SKi),i.rXU(i.aKT),i.rXU(i.gRc),i.rXU(rc.OD),i.rXU(kr))};static#e=this.\u0275cmp=i.VBU({type:e,selectors:[["mat-snack-bar-container"]],viewQuery:function(r,o){if(1&r&&(i.GBs(En.I3,7),i.GBs(sc,7)),2&r){let a;i.mGM(a=i.lsd())&&(o._portalOutlet=a.first),i.mGM(a=i.lsd())&&(o._label=a.first)}},hostAttrs:[1,"mdc-snackbar","mat-mdc-snack-bar-container"],hostVars:1,hostBindings:function(r,o){1&r&&i.Kam("@state.done",function(u){return o.onAnimationEnd(u)}),2&r&&i.zvX("@state",o._animationState)},standalone:!0,features:[i.Vt3,i.aNF],decls:6,vars:3,consts:[["label",""],[1,"mdc-snackbar__surface","mat-mdc-snackbar-surface"],[1,"mat-mdc-snack-bar-label"],["aria-hidden","true"],["cdkPortalOutlet",""]],template:function(r,o){1&r&&(i.j41(0,"div",1)(1,"div",2,0)(3,"div",3),i.DNE(4,ac,0,0,"ng-template",4),i.k0s(),i.nrm(5,"div"),i.k0s()()),2&r&&(i.R7$(5),i.BMQ("aria-live",o._live)("role",o._role)("id",o._liveElementId))},dependencies:[En.I3],styles:[".mat-mdc-snack-bar-container{display:flex;align-items:center;justify-content:center;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0);margin:8px}.mat-mdc-snack-bar-handset .mat-mdc-snack-bar-container{width:100vw}.mat-mdc-snackbar-surface{box-shadow:0px 3px 5px -1px rgba(0, 0, 0, 0.2), 0px 6px 10px 0px rgba(0, 0, 0, 0.14), 0px 1px 18px 0px rgba(0, 0, 0, 0.12);display:flex;align-items:center;justify-content:flex-start;box-sizing:border-box;padding-left:0;padding-right:8px}[dir=rtl] .mat-mdc-snackbar-surface{padding-right:0;padding-left:8px}.mat-mdc-snack-bar-container .mat-mdc-snackbar-surface{min-width:344px;max-width:672px}.mat-mdc-snack-bar-handset .mat-mdc-snackbar-surface{width:100%;min-width:0}.cdk-high-contrast-active .mat-mdc-snackbar-surface{outline:solid 1px}.mat-mdc-snack-bar-container .mat-mdc-snackbar-surface{color:var(--mdc-snackbar-supporting-text-color, var(--mat-app-inverse-on-surface));border-radius:var(--mdc-snackbar-container-shape, var(--mat-app-corner-extra-small));background-color:var(--mdc-snackbar-container-color, var(--mat-app-inverse-surface))}.mdc-snackbar__label{width:100%;flex-grow:1;box-sizing:border-box;margin:0;padding:14px 8px 14px 16px}[dir=rtl] .mdc-snackbar__label{padding-left:8px;padding-right:16px}.mat-mdc-snack-bar-container .mdc-snackbar__label{font-family:var(--mdc-snackbar-supporting-text-font, var(--mat-app-body-medium-font));font-size:var(--mdc-snackbar-supporting-text-size, var(--mat-app-body-medium-size));font-weight:var(--mdc-snackbar-supporting-text-weight, var(--mat-app-body-medium-weight));line-height:var(--mdc-snackbar-supporting-text-line-height, var(--mat-app-body-medium-line-height))}.mat-mdc-snack-bar-actions{display:flex;flex-shrink:0;align-items:center;box-sizing:border-box}.mat-mdc-snack-bar-handset,.mat-mdc-snack-bar-container,.mat-mdc-snack-bar-label{flex:1 1 auto}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled){color:var(--mat-snack-bar-button-color, var(--mat-app-inverse-primary));--mat-text-button-state-layer-color:currentColor;--mat-text-button-ripple-color:currentColor}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled) .mat-ripple-element{opacity:.1}"],encapsulation:2,data:{animation:[uc.snackBarState]}})}return e})();const dc=new i.nKC("mat-snack-bar-default-options",{providedIn:"root",factory:function hc(){return new kr}});let Ri=(()=>{class e{get _openedSnackBarRef(){const t=this._parentSnackBar;return t?t._openedSnackBarRef:this._snackBarRefAtThisLevel}set _openedSnackBarRef(t){this._parentSnackBar?this._parentSnackBar._openedSnackBarRef=t:this._snackBarRefAtThisLevel=t}constructor(t,r,o,a,u,f){this._overlay=t,this._live=r,this._injector=o,this._breakpointObserver=a,this._parentSnackBar=u,this._defaultConfig=f,this._snackBarRefAtThisLevel=null,this.simpleSnackBarComponent=cc,this.snackBarContainerComponent=Zo,this.handsetCssClass="mat-mdc-snack-bar-handset"}openFromComponent(t,r){return this._attach(t,r)}openFromTemplate(t,r){return this._attach(t,r)}open(t,r="",o){const a={...this._defaultConfig,...o};return a.data={message:t,action:r},a.announcementMessage===t&&(a.announcementMessage=void 0),this.openFromComponent(this.simpleSnackBarComponent,a)}dismiss(){this._openedSnackBarRef&&this._openedSnackBarRef.dismiss()}ngOnDestroy(){this._snackBarRefAtThisLevel&&this._snackBarRefAtThisLevel.dismiss()}_attachSnackBarContainer(t,r){const a=i.zZn.create({parent:r&&r.viewContainerRef&&r.viewContainerRef.injector||this._injector,providers:[{provide:kr,useValue:r}]}),u=new En.A8(this.snackBarContainerComponent,r.viewContainerRef,a),f=t.attach(u);return f.instance.snackBarConfig=r,f.instance}_attach(t,r){const o={...new kr,...this._defaultConfig,...r},a=this._createOverlay(o),u=this._attachSnackBarContainer(a,o),f=new Ti(u,a);if(t instanceof i.C4Q){const g=new En.VA(t,null,{$implicit:o.data,snackBarRef:f});f.instance=u.attachTemplatePortal(g)}else{const g=this._createInjector(o,f),b=new En.A8(t,void 0,g),S=u.attachComponentPortal(b);f.instance=S.instance}return this._breakpointObserver.observe(qo.Rp.HandsetPortrait).pipe((0,jt.Q)(a.detachments())).subscribe(g=>{a.overlayElement.classList.toggle(this.handsetCssClass,g.matches)}),o.announcementMessage&&u._onAnnounce.subscribe(()=>{this._live.announce(o.announcementMessage,o.politeness)}),this._animateSnackBar(f,o),this._openedSnackBarRef=f,this._openedSnackBarRef}_animateSnackBar(t,r){t.afterDismissed().subscribe(()=>{this._openedSnackBarRef==t&&(this._openedSnackBarRef=null),r.announcementMessage&&this._live.clear()}),this._openedSnackBarRef?(this._openedSnackBarRef.afterDismissed().subscribe(()=>{t.containerInstance.enter()}),this._openedSnackBarRef.dismiss()):t.containerInstance.enter(),r.duration&&r.duration>0&&t.afterOpened().subscribe(()=>t._dismissAfter(r.duration))}_createOverlay(t){const r=new Ho.rR;r.direction=t.direction;let o=this._overlay.position().global();const a="rtl"===t.direction,u="left"===t.horizontalPosition||"start"===t.horizontalPosition&&!a||"end"===t.horizontalPosition&&a,f=!u&&"center"!==t.horizontalPosition;return u?o.left("0"):f?o.right("0"):o.centerHorizontally(),"top"===t.verticalPosition?o.top("0"):o.bottom("0"),r.positionStrategy=o,this._overlay.create(r)}_createInjector(t,r){return i.zZn.create({parent:t&&t.viewContainerRef&&t.viewContainerRef.injector||this._injector,providers:[{provide:Ti,useValue:r},{provide:Vo,useValue:t.data}]})}static#t=this.\u0275fac=function(r){return new(r||e)(i.KVO(Ho.hJ),i.KVO(ic.Ai),i.KVO(i.zZn),i.KVO(qo.QP),i.KVO(e,12),i.KVO(dc))};static#e=this.\u0275prov=i.jDH({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();class mc{constructor(n,t){this._document=t;const r=this._textarea=this._document.createElement("textarea"),o=r.style;o.position="fixed",o.top=o.opacity="0",o.left="-999em",r.setAttribute("aria-hidden","true"),r.value=n,r.readOnly=!0,(this._document.fullscreenElement||this._document.body).appendChild(r)}copy(){const n=this._textarea;let t=!1;try{if(n){const r=this._document.activeElement;n.select(),n.setSelectionRange(0,n.value.length),t=this._document.execCommand("copy"),r&&r.focus()}}catch{}return t}destroy(){const n=this._textarea;n&&(n.remove(),this._textarea=void 0)}}let Xo=(()=>{class e{constructor(t){this._document=t}copy(t){const r=this.beginCopy(t),o=r.copy();return r.destroy(),o}beginCopy(t){return new mc(t,this._document)}static#t=this.\u0275fac=function(r){return new(r||e)(i.KVO(m.qQ))};static#e=this.\u0275prov=i.jDH({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function gc(e,n){if(1&e){const t=i.RV6();i.j41(0,"button",10),i.bIt("click",function(){const o=i.eBV(t).$implicit,a=i.XpG(2);return i.Njj(a.invoiceAmount=o.value)}),i.j41(1,"mat-icon"),i.EFF(2),i.k0s(),i.j41(3,"span"),i.EFF(4),i.k0s()()}if(2&e){const t=n.$implicit;i.R7$(2),i.JRh(t.icon),i.R7$(2),i.JRh(t.label)}}function pc(e,n){if(1&e){const t=i.RV6();i.j41(0,"mat-dialog-content")(1,"div",4),i.DNE(2,gc,5,2,"button",5),i.k0s(),i.nrm(3,"mat-divider"),i.j41(4,"mat-form-field",6)(5,"mat-label"),i.EFF(6,"Zap Amount"),i.k0s(),i.j41(7,"input",7),i.mxI("ngModelChange",function(o){i.eBV(t);const a=i.XpG();return i.DH7(a.invoiceAmount,o)||(a.invoiceAmount=o),i.Njj(o)}),i.k0s()(),i.j41(8,"mat-dialog-actions",8)(9,"button",9),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.generateInvoice())}),i.EFF(10," Generate Invoice "),i.k0s()()()}if(2&e){const t=i.XpG();i.R7$(2),i.Y8G("ngForOf",t.zapButtons),i.R7$(5),i.R50("ngModel",t.invoiceAmount)}}function vc(e,n){if(1&e){const t=i.RV6();i.j41(0,"div",12)(1,"span"),i.EFF(2),i.k0s(),i.nrm(3,"mat-divider")(4,"qrcode",13),i.j41(5,"mat-dialog-actions",14)(6,"button",15),i.bIt("click",function(){i.eBV(t);const o=i.XpG(2);return i.Njj(o.copyInvoice())}),i.nrm(7,"mat-icon",16),i.k0s()()()}if(2&e){const t=i.XpG(2);i.R7$(2),i.SpI("Scan with phone to pay (",t.invoiceAmount," sats)"),i.R7$(2),i.Y8G("qrdata",t.lightningInvoice)("matTooltip","Lightning Invoice")("errorCorrectionLevel","M"),i.R7$(2),i.Y8G("matTooltip","Copy Invoice"),i.R7$(),i.Y8G("svgIcon","heroicons_outline:clipboard-document")}}function yc(e,n){if(1&e&&(i.j41(0,"mat-dialog-content"),i.DNE(1,vc,8,6,"div",11),i.k0s()),2&e){const t=i.XpG();i.R7$(),i.Y8G("ngIf",t.displayQRCode)}}let wc=(()=>{class e{constructor(t,r,o){this.dialogRef=t,this.snackBar=r,this.clipboard=o,this.invoiceAmount="",this.lightningInvoice="",this.displayQRCode=!1,this.zapButtons=[{icon:"thumb_up",label:"50",value:50},{icon:"favorite",label:"100",value:100},{icon:"emoji_emotions",label:"500",value:500},{icon:"star",label:"1k",value:1e3},{icon:"celebration",label:"5k",value:5e3},{icon:"rocket",label:"10k",value:1e4},{icon:"local_fire_department",label:"100k",value:1e5},{icon:"flash_on",label:"500k",value:5e5},{icon:"diamond",label:"1M",value:1e6}]}generateInvoice(){var t=this;return(0,y.A)(function*(){if(!t.invoiceAmount||Number(t.invoiceAmount)<=0)t.openSnackBar("Please enter a valid amount","dismiss");else try{t.nwc=new Er.NostrWebLNProvider({nostrWalletConnectUrl:yield t.loadNWCUrl()}),yield t.nwc.enable();const r=yield t.nwc.makeInvoice({amount:Number(t.invoiceAmount)});t.lightningInvoice=r.paymentRequest,t.showQRCode()}catch(r){console.error("Error generating invoice:",r),t.openSnackBar("Failed to generate invoice","dismiss")}})()}loadNWCUrl(){return(0,y.A)(function*(){try{const t=Er.NostrWebLNProvider.withNewSecret();return yield t.initNWC({name:"Angor Hub"}),t.getNostrWalletConnectUrl()}catch(t){throw console.error("Error initializing NWC:",t),new Error("Failed to initialize NWC provider")}})()}showQRCode(){this.displayQRCode=!this.displayQRCode}copyInvoice(){this.lightningInvoice?(this.clipboard.copy(this.lightningInvoice),this.openSnackBar("Invoice copied","dismiss")):this.openSnackBar("No invoice available to copy","dismiss")}openSnackBar(t,r){this.snackBar.open(t,r,{duration:1300})}closeDialog(){this.dialogRef.close()}static#t=this.\u0275fac=function(r){return new(r||e)(i.rXU(Ce.CP),i.rXU(Ri),i.rXU(Xo))};static#e=this.\u0275cmp=i.VBU({type:e,selectors:[["app-receive-dialog"]],standalone:!0,features:[i.aNF],decls:7,vars:4,consts:[[1,"absolute","right-0","top-0","pr-4","pt-4"],["mat-icon-button","",3,"matDialogClose"],[1,"text-secondary",3,"svgIcon"],[4,"ngIf"],[1,"preset-buttons"],["mat-mini-fab","","color","primary",3,"click",4,"ngFor","ngForOf"],["appearance","outline",1,"sats-input"],["matInput","","placeholder","e.g., 100","type","number",3,"ngModelChange","ngModel"],["align","end"],["mat-raised-button","","color","primary",3,"click"],["mat-mini-fab","","color","primary",3,"click"],["class","qrcode",4,"ngIf"],[1,"qrcode"],[1,"qrcode-image",3,"qrdata","matTooltip","errorCorrectionLevel"],["align","center"],["mat-icon-button","",3,"click","matTooltip"],[3,"svgIcon"]],template:function(r,o){1&r&&(i.j41(0,"div",0)(1,"button",1),i.nrm(2,"mat-icon",2),i.k0s()(),i.j41(3,"h2"),i.EFF(4,"\u26a1 Receive Zap"),i.k0s(),i.DNE(5,pc,11,2,"mat-dialog-content",3)(6,yc,2,1,"mat-dialog-content",3)),2&r&&(i.R7$(),i.Y8G("matDialogClose",void 0),i.R7$(),i.Y8G("svgIcon","heroicons_outline:x-mark"),i.R7$(3),i.Y8G("ngIf",!o.displayQRCode),i.R7$(),i.Y8G("ngIf",o.displayQRCode))},dependencies:[mn.vg,I.Hl,I.$z,I.iY,I.$0,tt.m_,tt.An,C.YN,C.me,C.Q0,C.BC,C.vS,j.nJ,j.rl,C.X1,m.MD,m.Sq,m.bT,dn.Ve,j.RG,at.fS,at.fg,Ce.Yi,Ce.E7,it,ot,B.q,O.oV,Ce.tx],styles:[".preset-buttons[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,1fr);gap:15px;justify-items:center;margin-bottom:20px}.preset-buttons[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{font-size:14px;font-weight:700;width:70px;height:60px;display:flex;flex-direction:column;align-items:center;justify-content:center;max-height:60px!important}.sats-input[_ngcontent-%COMP%]{margin-top:20px;width:100%}.lightning-buttons[_ngcontent-%COMP%]{display:flex;justify-content:space-evenly;margin:10px 0}.qrcode[_ngcontent-%COMP%]{text-align:center}.qrcode-image[_ngcontent-%COMP%]{width:100%!important}"]})}return e})();for(var Jo=M(1146),bc=M(3838),We=M(917),Qo={bech32:"bc",pubKeyHash:0,scriptHash:5,validWitnessVersions:[0]},ts={bech32:"tb",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},es={bech32:"tbs",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},ns={bech32:"bcrt",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},rs={bech32:"sb",pubKeyHash:63,scriptHash:123,validWitnessVersions:[0]},Wn=["option_data_loss_protect","initial_routing_sync","option_upfront_shutdown_script","gossip_queries","var_onion_optin","gossip_queries_ex","option_static_remotekey","payment_secret","basic_mpp","option_support_large_channel"],_c={m:new We.BN(1e3,10),u:new We.BN(1e6,10),n:new We.BN(1e9,10),p:new We.BN(1e12,10)},xc=new We.BN("2100000000000000000",10),is=new We.BN(1e11,10),Ii={payment_hash:1,payment_secret:16,description:13,payee:19,description_hash:23,expiry:6,min_final_cltv_expiry:24,fallback_address:9,route_hint:3,feature_bits:5,metadata:27},os={},Mr=0,Bi=Object.keys(Ii);Mr0;)t=f.slice(0,33).toString("hex"),r=f.slice(33,41).toString("hex"),o=parseInt(f.slice(41,45).toString("hex"),16),a=parseInt(f.slice(45,49).toString("hex"),16),u=parseInt(f.slice(49,51).toString("hex"),16),f=f.slice(51),n.push({pubkey:t,short_channel_id:r,fee_base_msat:o,fee_proportional_millionths:a,cltv_expiry_delta:u});return n},5:function Tc(e){for(var n=e.slice().reverse().map(function(o){return[!!(1&o),!!(2&o),!!(4&o),!!(8&o),!!(16&o)]}).reduce(function(o,a){return o.concat(a)},[]);n.length<2*Wn.length;)n.push(!1);var t={extra_bits:{}};if(Wn.forEach(function(o,a){var u;n[2*a]?u="required":n[2*a+1]&&(u="supported"),t[o]=u}),n.length>2*Wn.length){var r=n.slice(2*Wn.length);t.extra_bits={start_bit:2*Wn.length,bits:r,required:r.reduce(function(o,a,u){return u%2!=0?o||!1:o||a},!1)}}return t}};function Sc(e){return function(n){return{tagCode:parseInt(e),words:Jo.encode("unknown",n,Number.MAX_SAFE_INTEGER)}}}function Sr(e){return e.reverse().reduce(function(n,t,r){return n+t*Math.pow(32,r)},0)}function nn(e,n){var t=bc.hp.from(function Cc(e,n,t){for(var r=0,o=0,a=(1<=t;)u.push(r>>(o-=t)&a);return o>0&&u.push(r<{class e{constructor(t){this.http=t}getLightning(t){return this.http.get(t).pipe((0,Ni.W)(r=>(console.error("Failed to fetch Lightning response:",r),(0,k.of)({status:"Failed"}))))}getLightningInvoice(t,r){return this.http.get(`${t}?amount=${r}`).pipe((0,Ni.W)(a=>(console.error("Failed to fetch Lightning invoice:",a),(0,k.of)({pr:"",status:"Failed"}))))}getLightningAddress(t){try{const[r,o]=t.split("@");return`https://${o}/.well-known/lnurlp/${r}`}catch{return console.error("Invalid Lightning address format:",t),""}}sendZapRequest(t,r,o,a){const u=encodeURIComponent(JSON.stringify(r));return this.http.get(`${t}?amount=${o}&nostr=${u}&lnurl=${a}`).pipe((0,Ni.W)(g=>(console.error("Failed to send zap request:",g),(0,k.of)({pr:"",status:"Failed"}))))}login(){return(0,y.A)(function*(){try{return window.webln&&!window.webln.isEnabled()&&(yield window.webln.enable()),!0}catch(t){return console.error("WebLN login failed:",t),!1}})()}hasWebln(){return!!window.webln}sendPayment(t){var r=this;return(0,y.A)(function*(){try{return r.hasWebln()?yield window.webln.sendPayment(t):(console.error("WebLN is not available"),null)}catch(o){throw console.error("Payment failed:",o),o}})()}payInvoice(t){var r=this;return(0,y.A)(function*(){if((yield r.login())&&r.hasWebln())try{return!!(yield r.sendPayment(t))}catch(a){return console.error("Failed to pay invoice:",a),!1}return console.error("WebLN not available or login failed"),!1})()}static#t=this.\u0275fac=function(r){return new(r||e)(i.KVO(Bc.Qq))};static#e=this.\u0275prov=i.jDH({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function Nc(e,n){if(1&e){const t=i.RV6();i.j41(0,"button",10),i.bIt("click",function(){const o=i.eBV(t).$implicit,a=i.XpG(2);return i.Njj(a.sats=o.value)}),i.j41(1,"mat-icon"),i.EFF(2),i.k0s(),i.j41(3,"span"),i.EFF(4),i.k0s()()}if(2&e){const t=n.$implicit;i.R7$(2),i.JRh(t.icon),i.R7$(2),i.JRh(t.label)}}function Pc(e,n){if(1&e){const t=i.RV6();i.j41(0,"mat-dialog-content")(1,"div",4),i.DNE(2,Nc,5,2,"button",5),i.k0s(),i.nrm(3,"mat-divider"),i.j41(4,"mat-form-field",6)(5,"mat-label"),i.EFF(6,"Zap Amount"),i.k0s(),i.j41(7,"input",7),i.mxI("ngModelChange",function(o){i.eBV(t);const a=i.XpG();return i.DH7(a.sats,o)||(a.sats=o),i.Njj(o)}),i.k0s()(),i.j41(8,"mat-dialog-actions",8)(9,"button",9),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.sendZap())}),i.EFF(10," Create invoice "),i.k0s()()()}if(2&e){const t=i.XpG();i.R7$(2),i.Y8G("ngForOf",t.zapButtons),i.R7$(5),i.R50("ngModel",t.sats)}}function Lc(e,n){if(1&e&&(i.j41(0,"div",16)(1,"span"),i.EFF(2),i.k0s(),i.nrm(3,"mat-divider")(4,"qrcode",17),i.k0s()),2&e){const t=i.XpG(2);i.R7$(2),i.SpI("Scan with phone to pay (",t.invoiceAmount," sats)"),i.R7$(2),i.Y8G("qrdata",t.lightningInvoice)("matTooltip","Lightning Invoice")("errorCorrectionLevel","M")}}function Uc(e,n){if(1&e){const t=i.RV6();i.j41(0,"mat-dialog-content"),i.DNE(1,Lc,5,4,"div",11),i.j41(2,"mat-dialog-actions",12)(3,"button",13),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.copyInvoice())}),i.nrm(4,"mat-icon",14),i.k0s(),i.j41(5,"button",13),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.payInvoice())}),i.nrm(6,"mat-icon",15),i.k0s()()()}if(2&e){const t=i.XpG();i.R7$(),i.Y8G("ngIf",t.displayQRCode),i.R7$(2),i.Y8G("matTooltip","Copy Invoice"),i.R7$(),i.Y8G("svgIcon","heroicons_outline:clipboard-document"),i.R7$(),i.Y8G("matTooltip","Pay Invoice"),i.R7$(),i.Y8G("svgIcon","feather:zap")}}let jc=(()=>{class e{constructor(t,r,o,a,u){this.dialogRef=t,this.metadata=r,this.lightning=o,this.snackBar=a,this.clipboard=u,this.lightningInvoice="",this.showInvoiceSection=!1,this.displayQRCode=!1,this.invoiceAmount="?",this.zapButtons=[{icon:"thumb_up",label:"50",value:50},{icon:"favorite",label:"100",value:100},{icon:"emoji_emotions",label:"500",value:500},{icon:"star",label:"1k",value:1e3},{icon:"celebration",label:"5k",value:5e3},{icon:"rocket",label:"10k",value:1e4},{icon:"local_fire_department",label:"100k",value:1e5},{icon:"flash_on",label:"500k",value:5e5},{icon:"diamond",label:"1M",value:1e6}],this.getLightningInfo()}getLightningInfo(){let t="";if(this.metadata?.lud06){const{words:r}=V.I.decode(this.metadata.lud06,5e3),o=new Uint8Array(V.I.fromWords(r));t=(new TextDecoder).decode(Uint8Array.from(o))}else if(this.metadata?.lud16?.toLowerCase().startsWith("lnurl")){const{words:r}=V.I.decode(this.metadata.lud16,5e3),o=new Uint8Array(V.I.fromWords(r));t=(new TextDecoder).decode(Uint8Array.from(o))}else this.metadata?.lud16&&(t=this.lightning.getLightningAddress(this.metadata.lud16));""!==t?this.lightning.getLightning(t).subscribe(r=>{this.lightningResponse=r,"Failed"===this.lightningResponse.status?this.openSnackBar("Failed to lookup lightning address","dismiss"):this.lightningResponse.callback?this.showInvoiceSection=!0:this.openSnackBar("Couldn't find user's lightning address","dismiss")}):this.openSnackBar("No lightning address found","dismiss")}getLightningInvoice(t){var r=this;this.lightningResponse&&this.lightningResponse.callback&&this.lightning.getLightningInvoice(this.lightningResponse.callback,t).subscribe(function(){var o=(0,y.A)(function*(a){r.lightningInvoice=a.pr,r.setInvoiceAmount(r.lightningInvoice),r.showInvoiceSection=!0,r.showQRCode()});return function(a){return o.apply(this,arguments)}}())}setInvoiceAmount(t){if(t){const o=function Ic(e,n){if("string"!=typeof e)throw new Error("Lightning Payment Request must be string");if("ln"!==e.slice(0,2).toLowerCase())throw new Error("Not a proper lightning payment request");var t=[],r=Jo.decode(e,Number.MAX_SAFE_INTEGER);e=e.toLowerCase();var o=r.prefix,a=r.words,u=e.slice(o.length+1),f=a.slice(-104);a=a.slice(0,-104);var g=o.match(/^ln(\S+?)(\d*)([a-zA-Z]?)$/);if(g&&!g[2]&&(g=o.match(/^ln(\S+)$/)),!g)throw new Error("Not a proper lightning payment request");t.push({name:"lightning_network",letters:"ln"});var S,b=g[1];if(n){if(void 0===n.bech32||void 0===n.pubKeyHash||void 0===n.scriptHash||!Array.isArray(n.validWitnessVersions))throw new Error("Invalid network");S=n}else switch(b){case Qo.bech32:S=Qo;break;case ts.bech32:S=ts;break;case es.bech32:S=es;break;case ns.bech32:S=ns;break;case rs.bech32:S=rs}if(!S||S.bech32!==b)throw new Error("Unknown coin bech32 prefix");t.push({name:"coin_network",letters:b,value:S});var $,T=g[2];T?($=function Rc(e,n){var t,r;if(e.slice(-1).match(/^[munp]$/))t=e.slice(-1),r=e.slice(0,-1);else{if(e.slice(-1).match(/^[^munp0-9]$/))throw new Error("Not a valid multiplier for the amount");r=e}if(!r.match(/^\d+$/))throw new Error("Not a valid human readable amount");var o=new We.BN(r,10),a=t?o.mul(is).div(_c[t]):o.mul(is);if("p"===t&&!o.mod(new We.BN(10,10)).eq(new We.BN(0,10))||a.gt(xc))throw new Error("Amount is outside of valid range");return n?a.toString():a}(T+g[3],!0),t.push({name:"amount",letters:g[2]+g[3],value:$})):$=null,t.push({name:"separator",letters:"1"});var P,F,z,W,U=Sr(a.slice(0,7));for(a=a.slice(7),t.push({name:"timestamp",letters:u.slice(0,7),value:U}),u=u.slice(7);a.length>0;){var J=a[0].toString();P=os[J]||"unknown_tag",F=Mc[J]||Sc(J),z=Sr((a=a.slice(1)).slice(0,2)),W=(a=a.slice(2)).slice(0,z),a=a.slice(z),t.push({name:P,tag:u[0],letters:u.slice(0,3+z),value:F(W)}),u=u.slice(3+z)}t.push({name:"signature",letters:u.slice(0,104),value:nn(f,!0)}),u=u.slice(104),t.push({name:"checksum",letters:u});var Y={paymentRequest:e,sections:t,get expiry(){var et=t.find(function(Q){return"expiry"===Q.name});if(et)return Z("timestamp")+et.value},get route_hints(){return t.filter(function(et){return"route_hint"===et.name}).map(function(et){return et.value})}},rt=function(et){if("route_hint"===et)return"continue";Object.defineProperty(Y,et,{get:function(){return Z(et)}})};for(var q in Ii)rt(q);return Y;function Z(et){var Q=t.find(function(yt){return yt.name===et});return Q?Q.value:void 0}}(t).sections.find(a=>"amount"===a.name);o&&(this.invoiceAmount=String(Number(o.value)/1e3))}}showQRCode(){this.displayQRCode=!this.displayQRCode}sendZap(){this.getLightningInvoice(String(1e3*Number(this.sats)))}payInvoice(){var t=this;return(0,y.A)(function*(){if(!t.lightningInvoice)return void console.error("Lightning invoice is not set");const r=new Er.NostrWebLNProvider({nostrWalletConnectUrl:yield t.loadNWCUrl()});r.enable().then(()=>r.sendPayment(t.lightningInvoice)).then(o=>{o&&o.preimage?(console.log(`Payment successful, preimage: ${o.preimage}`),t.openSnackBar("Zapped!","dismiss"),t.dialogRef.close()):t.listenForPaymentStatus(r)}).catch(o=>{console.error("Payment failed:",o),t.openSnackBar("Failed to pay invoice","dismiss"),t.listenForPaymentStatus(r)})})()}loadNWCUrl(){const t=Er.NostrWebLNProvider.withNewSecret();return t.initNWC({name:"Angor Hub"}).then(()=>t.getNostrWalletConnectUrl()).catch(r=>{throw console.error("Error initializing NWC:",r),r})}listenForPaymentStatus(t){const r=()=>{t.sendPayment(this.lightningInvoice).then(o=>{o&&o.preimage?(console.log("Payment confirmed, preimage:",o.preimage),this.openSnackBar("Payment confirmed!","dismiss"),this.dialogRef.close()):setTimeout(r,5e3)}).catch(o=>{console.error("Error checking payment status:",o),setTimeout(r,5e3)})};r()}copyInvoice(){this.lightningInvoice?(this.clipboard.copy(this.lightningInvoice),this.openSnackBar("Invoice copied","dismiss")):this.openSnackBar("No invoice available to copy","dismiss")}openSnackBar(t,r){this.snackBar.open(t,r,{duration:1300})}closeDialog(){this.dialogRef.close()}static#t=this.\u0275fac=function(r){return new(r||e)(i.rXU(Ce.CP),i.rXU(Ce.Vh),i.rXU(ss),i.rXU(Ri),i.rXU(Xo))};static#e=this.\u0275cmp=i.VBU({type:e,selectors:[["app-send-dialog"]],standalone:!0,features:[i.aNF],decls:7,vars:4,consts:[[1,"absolute","right-0","top-0","pr-4","pt-4"],["mat-icon-button","",3,"matDialogClose"],[1,"text-secondary",3,"svgIcon"],[4,"ngIf"],[1,"preset-buttons"],["mat-mini-fab","","color","primary",3,"click",4,"ngFor","ngForOf"],["appearance","outline",1,"sats-input"],["matInput","","placeholder","e.g., 100","type","number",3,"ngModelChange","ngModel"],["align","end"],["mat-raised-button","","color","primary",3,"click"],["mat-mini-fab","","color","primary",3,"click"],["class","qrcode",4,"ngIf"],["align","center"],["mat-icon-button","",3,"click","matTooltip"],[3,"svgIcon"],["color","#f79318",3,"svgIcon"],[1,"qrcode"],[1,"qrcode-image",3,"qrdata","matTooltip","errorCorrectionLevel"]],template:function(r,o){1&r&&(i.j41(0,"div",0)(1,"button",1),i.nrm(2,"mat-icon",2),i.k0s()(),i.j41(3,"h1"),i.EFF(4,"\u26a1 Send Zap"),i.k0s(),i.DNE(5,Pc,11,2,"mat-dialog-content",3)(6,Uc,7,5,"mat-dialog-content",3)),2&r&&(i.R7$(),i.Y8G("matDialogClose",void 0),i.R7$(),i.Y8G("svgIcon","heroicons_outline:x-mark"),i.R7$(3),i.Y8G("ngIf",!o.showInvoiceSection||!o.lightningInvoice),i.R7$(),i.Y8G("ngIf",o.showInvoiceSection&&o.lightningInvoice))},dependencies:[mn.vg,I.Hl,I.$z,I.iY,I.$0,tt.m_,tt.An,C.YN,C.me,C.Q0,C.BC,C.vS,j.nJ,j.rl,C.X1,m.MD,m.Sq,m.bT,dn.Ve,j.RG,at.fS,at.fg,Ce.Yi,Ce.E7,it,ot,B.q,O.oV,Ce.tx],styles:[".preset-buttons[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,1fr);gap:15px;justify-items:center;margin-bottom:20px}.preset-buttons[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{font-size:14px;font-weight:700;width:70px;height:60px;display:flex;flex-direction:column;align-items:center;justify-content:center;max-height:60px!important}.sats-input[_ngcontent-%COMP%]{margin-top:20px;width:100%}.lightning-buttons[_ngcontent-%COMP%]{display:flex;justify-content:space-evenly;margin:10px 0}.qrcode[_ngcontent-%COMP%]{text-align:center}.qrcode-image[_ngcontent-%COMP%]{width:100%!important}"]})}return e})();var Dc=M(4224);let Oc=(()=>{class e{constructor(t,r){this.relayService=t,this.signerService=r,this.followersSubject=new Lt.B,this.followingSubject=new Lt.B}getFollowersObservable(){return this.followersSubject.asObservable()}getFollowingObservable(){return this.followingSubject.asObservable()}getFollowers(t){var r=this;return(0,y.A)(function*(){yield r.relayService.ensureConnectedRelays();const o=r.relayService.getPool(),a=r.relayService.getConnectedRelays();if(0===a.length)throw new Error("No connected relays");const u=[{kinds:[3],"#p":[t]}],f=[];return new Promise(g=>{const b=o.subscribeMany(a,u,{onevent:S=>{f.push(S),r.followersSubject.next(S)},oneose(){b.close(),g(f)}})})})()}getFollowing(t){var r=this;return(0,y.A)(function*(){yield r.relayService.ensureConnectedRelays();const o=r.relayService.getPool(),a=r.relayService.getConnectedRelays();if(0===a.length)throw new Error("No connected relays");const u=[{kinds:[3],authors:[t]}],f=[];return new Promise(g=>{const b=o.subscribeMany(a,u,{onevent:S=>{S.tags.filter($=>"p"===$[0]).forEach($=>{f.push($[1]),r.followingSubject.next(S)})},oneose(){b.close(),g(f)}})})})()}follow(t){var r=this;return(0,y.A)(function*(){yield r.relayService.ensureConnectedRelays(),r.relayService.getPool();const a=r.getFollowingList();if(a.includes(t))return void console.log(`Already following ${t}`);const u=[...a,t];r.setFollowingList(u);const f=r.signerService.getUnsignedEvent(3,u.map(S=>["p",S]),"");let b;if(yield r.signerService.isUsingExtension())b=yield r.signerService.signEventWithExtension(f);else{const S=yield r.signerService.getDecryptedSecretKey();if(!S)throw new Error("Secret key is missing. Unable to follow.");b=r.signerService.getSignedEvent(f,S)}r.relayService.publishEventToRelays(b),console.log(`Now following ${t}`)})()}unfollow(t){var r=this;return(0,y.A)(function*(){yield r.relayService.ensureConnectedRelays();const o=r.getFollowingList();if(!o.includes(t))return void console.log(`Not following ${t}`);const a=o.filter(b=>b!==t);r.setFollowingList(a);const u=r.signerService.getUnsignedEvent(3,a.map(b=>["p",b]),"");let g;if(yield r.signerService.isUsingExtension())g=yield r.signerService.signEventWithExtension(u);else{const b=yield r.signerService.getDecryptedSecretKey();if(!b)throw new Error("Secret key is missing. Unable to unfollow.");g=r.signerService.getSignedEvent(u,b)}r.relayService.publishEventToRelays(g),console.log(`Unfollowed ${t}`)})()}getFollowingListAsTags(){const t=this.getFollowingList(),r=[],o=this.relayService.getConnectedRelays();return t.forEach(a=>{o.forEach(u=>{r.push(["p",a,u,localStorage.getItem(`${a}`)||""])})}),r}setFollowingListFromTags(t){const r=[];t.forEach(o=>{r.push(o[1])}),this.setFollowingList(r)}setFollowingList(t){const o=Array.from(new Set(t)).filter(a=>a).join(",");localStorage.setItem("following",o)}getFollowingList(){const t=localStorage.getItem("following");return null===t||""===t?[]:t.split(",").filter(o=>/[a-f0-9]{64}/.test(o))}static#t=this.\u0275fac=function(r){return new(r||e)(i.KVO(Vt.b),i.KVO(Gt.A))};static#e=this.\u0275prov=i.jDH({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var Fc=M(881),$c=M(9979);const Gc=["eventInput"],zc=["commentInput"],as=()=>["/explore"],qc=e=>[e],Hc=()=>["./"],Vc=e=>({"mt-8":e}),ls=()=>[0,1,2,3],Wc=e=>["/profile",e],Yc=e=>({"heart-beat":e}),Kc=e=>({"rotate-180":e});function Zc(e,n){if(1&e&&(i.qex(0),i.nrm(1,"img",53),i.bVm()),2&e){const t=i.XpG();i.R7$(),i.FS9("alt",(null==t.metadata?null:t.metadata.display_name)||(null==t.metadata?null:t.metadata.name)||""),i.Y8G("src",t.getSafeUrl(null==t.metadata?null:t.metadata.picture),i.B4B)}}function Xc(e,n){if(1&e&&i.nrm(0,"img",54),2&e){const t=i.XpG();i.FS9("alt",(null==t.metadata?null:t.metadata.display_name)||(null==t.metadata?null:t.metadata.name)||"")}}function Jc(e,n){if(1&e){const t=i.RV6();i.j41(0,"div")(1,"button",55),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.toggleFollow())}),i.nrm(2,"mat-icon",56),i.k0s()()}if(2&e){const t=i.XpG();i.R7$(),i.Y8G("matTooltip",t.isFollowing?"Unfollow":"Follow"),i.R7$(),i.Y8G("svgIcon",t.isFollowing?"heroicons_outline:user-minus":"heroicons_outline:user-plus")}}function Qc(e,n){if(1&e){const t=i.RV6();i.j41(0,"button",57),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.zap())}),i.j41(1,"span",41),i.nrm(2,"mat-icon",58),i.j41(3,"span"),i.EFF(4,"Send Zap"),i.k0s()()()}2&e&&(i.R7$(2),i.Y8G("svgIcon","feather:zap"))}function tu(e,n){if(1&e){const t=i.RV6();i.j41(0,"button",57),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.openReceiveZapDialog())}),i.j41(1,"span",41),i.nrm(2,"mat-icon",58),i.j41(3,"span"),i.EFF(4,"Receive Zap"),i.k0s()()()}2&e&&(i.R7$(2),i.Y8G("svgIcon","heroicons_outline:qr-code"))}function eu(e,n){1&e&&(i.j41(0,"button",59)(1,"span",41),i.nrm(2,"mat-icon",58),i.j41(3,"span"),i.EFF(4,"Edit your profile"),i.k0s()()()),2&e&&(i.Y8G("routerLink","/settings/profile"),i.R7$(2),i.Y8G("svgIcon","heroicons_outline:pencil-square"))}function nu(e,n){1&e&&(i.j41(0,"button",39)(1,"span",41),i.nrm(2,"mat-icon",58),i.j41(3,"span"),i.EFF(4,"Report"),i.k0s()()()),2&e&&(i.R7$(2),i.Y8G("svgIcon","heroicons_solid:exclamation-triangle"))}function ru(e,n){1&e&&(i.j41(0,"button",39)(1,"span",41),i.nrm(2,"mat-icon",58),i.j41(3,"span"),i.EFF(4,"Turn on notifications"),i.k0s()()()),2&e&&(i.R7$(2),i.Y8G("svgIcon","heroicons_solid:bell"))}function iu(e,n){if(1&e&&(i.j41(0,"angor-card",60)(1,"div",37),i.EFF(2,"About"),i.k0s(),i.j41(3,"div",61),i.EFF(4),i.k0s(),i.j41(5,"a",62),i.EFF(6," See complete about "),i.k0s()()),2&e){const t=i.XpG();i.R7$(4),i.SpI(" ",(null==t.metadata?null:t.metadata.about)||""," "),i.R7$(),i.Y8G("color","primary")("routerLink",i.lJ4(3,Hc))}}function ou(e,n){if(1&e&&i.nrm(0,"img",69),2&e){const t=n.$implicit,r=i.XpG(2).$implicit,o=i.XpG(3);i.Y8G("src",null!=o.suggestions[4*r+t]&&null!=o.suggestions[4*r+t].metadata&&o.suggestions[4*r+t].metadata.picture?o.suggestions[4*r+t].metadata.picture:"images/avatars/avatar-placeholder.png",i.B4B)("alt",null!=o.suggestions[4*r+t]&&null!=o.suggestions[4*r+t].metadata&&o.suggestions[4*r+t].metadata.name?o.suggestions[4*r+t].metadata.name:"image")("matTooltip",null!=o.suggestions[4*r+t]&&null!=o.suggestions[4*r+t].metadata&&o.suggestions[4*r+t].metadata.name?o.suggestions[4*r+t].metadata.name:"")("routerLink",i.eq3(4,Wc,o.suggestions[4*r+t].pubkey))}}function su(e,n){1&e&&(i.qex(0),i.DNE(1,ou,1,6,"img",68),i.bVm()),2&e&&(i.R7$(),i.Y8G("ngForOf",i.lJ4(1,ls)))}function au(e,n){if(1&e&&(i.j41(0,"div",67),i.DNE(1,su,2,2,"ng-container",24),i.k0s()),2&e){const t=n.$implicit,r=i.XpG(3);i.R7$(),i.Y8G("ngIf",r.suggestions.length>4*t)}}function lu(e,n){1&e&&(i.j41(0,"div",65),i.DNE(1,au,2,1,"div",66),i.k0s()),2&e&&(i.R7$(),i.Y8G("ngForOf",i.lJ4(1,ls)))}function cu(e,n){if(1&e&&(i.j41(0,"angor-card",63)(1,"div",36)(2,"div",37),i.EFF(3," Suggestion "),i.k0s(),i.j41(4,"div",38)(5,"button",25),i.nrm(6,"mat-icon",26),i.k0s(),i.j41(7,"mat-menu",null,3)(9,"button",59),i.EFF(10," Explore project "),i.k0s()()()(),i.DNE(11,lu,2,2,"div",64),i.k0s()),2&e){const t=i.sdS(8),r=i.XpG();i.Y8G("ngClass",i.eq3(5,Vc,null==r.metadata?null:r.metadata.about)),i.R7$(5),i.Y8G("matMenuTriggerFor",t),i.R7$(),i.Y8G("svgIcon","heroicons_solid:ellipsis-vertical"),i.R7$(3),i.Y8G("routerLink",i.lJ4(7,as)),i.R7$(2),i.Y8G("ngIf",r.suggestions&&r.suggestions.length>0)}}function uu(e,n){if(1&e){const t=i.RV6();i.j41(0,"div",88)(1,"emoji-mart",89),i.bIt("emojiClick",function(o){i.eBV(t);const a=i.XpG(2);return i.Njj(a.addEmoji(o))}),i.k0s()()}if(2&e){const t=i.XpG(2);i.R7$(),i.Y8G("darkMode",t.darkMode)}}function fu(e,n){if(1&e){const t=i.RV6();i.j41(0,"angor-card",70)(1,"div",71)(2,"div",72),i.EFF(3,"Create Post"),i.k0s(),i.j41(4,"mat-slide-toggle",73),i.bIt("change",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.togglePreview())}),i.EFF(5," Preview "),i.k0s()(),i.j41(6,"div",74)(7,"div",75),i.nrm(8,"img",76),i.j41(9,"div",77),i.EFF(10),i.k0s()(),i.j41(11,"mat-form-field",78),i.nrm(12,"textarea",79,4),i.k0s()(),i.j41(14,"div",80)(15,"div",41)(16,"button",81),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.toggleEmojiPicker())}),i.nrm(17,"mat-icon",26),i.j41(18,"span",82),i.EFF(19,"Feeling"),i.k0s()(),i.DNE(20,uu,2,1,"div",83),i.j41(21,"button",84),i.nrm(22,"mat-icon",26),i.j41(23,"span",82),i.EFF(24,"Media"),i.k0s()(),i.j41(25,"button",84),i.nrm(26,"mat-icon",26),i.j41(27,"span",82),i.EFF(28,"Tag"),i.k0s()(),i.j41(29,"button",85),i.nrm(30,"mat-icon",26),i.k0s(),i.j41(31,"mat-menu",null,5)(33,"button",86)(34,"span",41),i.nrm(35,"mat-icon",58),i.j41(36,"span"),i.EFF(37,"Tag"),i.k0s()()(),i.j41(38,"button",86)(39,"span",41),i.nrm(40,"mat-icon",58),i.j41(41,"span"),i.EFF(42,"Feeling"),i.k0s()()(),i.j41(43,"button",39)(44,"span",41),i.nrm(45,"mat-icon",58),i.j41(46,"span"),i.EFF(47,"Live"),i.k0s()()(),i.j41(48,"button",39)(49,"span",41),i.nrm(50,"mat-icon",58),i.j41(51,"span"),i.EFF(52,"Gif"),i.k0s()()(),i.j41(53,"button",39)(54,"span",41),i.nrm(55,"mat-icon",58),i.j41(56,"span"),i.EFF(57,"Check in"),i.k0s()()()()(),i.j41(58,"button",87),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.sendEvent())}),i.nrm(59,"mat-icon",26),i.j41(60,"span",82),i.EFF(61,"Send"),i.k0s()()()()}if(2&e){const t=i.sdS(32),r=i.XpG();i.R7$(4),i.Y8G("color","primary"),i.R7$(4),i.FS9("alt",(null==r.currentUserMetadata?null:r.currentUserMetadata.display_name)||(null==r.currentUserMetadata?null:r.currentUserMetadata.name)||"Avatar"),i.Y8G("src",(null==r.currentUserMetadata?null:r.currentUserMetadata.picture)||"images/avatars/avatar-placeholder.png",i.B4B),i.R7$(2),i.SpI(" ",(null==r.currentUserMetadata?null:r.currentUserMetadata.name)||"Unknown User"," "),i.R7$(),i.Y8G("subscriptSizing","dynamic"),i.R7$(),i.Y8G("placeholder","What's on your mind?")("rows",3),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:face-smile"),i.R7$(3),i.Y8G("ngIf",r.showEmojiPicker),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:photo"),i.R7$(4),i.Y8G("svgIcon","heroicons_solid:user-circle"),i.R7$(3),i.Y8G("matMenuTriggerFor",t),i.R7$(),i.Y8G("svgIcon","heroicons_solid:ellipsis-horizontal"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:user-circle"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:face-smile"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:play"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:sparkles"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:map-pin"),i.R7$(4),i.Y8G("svgIcon","heroicons_solid:paper-airplane")}}function hu(e,n){if(1&e){const t=i.RV6();i.j41(0,"div",88)(1,"emoji-mart",89),i.bIt("emojiClick",function(o){i.eBV(t);const a=i.XpG(2);return i.Njj(a.addEmojiTocomment(o))}),i.k0s()()}if(2&e){const t=i.XpG(2);i.R7$(),i.Y8G("darkMode",t.darkMode)}}function du(e,n){if(1&e){const t=i.RV6();i.j41(0,"angor-card",90,6)(2,"div",91),i.nrm(3,"img",92),i.j41(4,"div",65)(5,"span",93),i.EFF(6),i.k0s(),i.j41(7,"span",94),i.EFF(8,"1 minutes ago"),i.k0s()(),i.j41(9,"button",95),i.nrm(10,"mat-icon",26),i.k0s(),i.j41(11,"mat-menu",null,7)(13,"button",39)(14,"span",41),i.nrm(15,"mat-icon",58),i.j41(16,"span"),i.EFF(17,"Save post"),i.k0s()()(),i.j41(18,"button",39)(19,"span",41),i.nrm(20,"mat-icon",58),i.j41(21,"span"),i.EFF(22,"Hide post"),i.k0s()()(),i.j41(23,"button",39)(24,"span",41),i.nrm(25,"mat-icon",58),i.j41(26,"span"),i.EFF(27,"Snooze for 30 days"),i.k0s()()(),i.j41(28,"button",39)(29,"span",41),i.nrm(30,"mat-icon",58),i.j41(31,"span"),i.EFF(32,"Hide all"),i.k0s()()(),i.nrm(33,"mat-divider",28),i.j41(34,"button",39)(35,"span",41),i.nrm(36,"mat-icon",58),i.j41(37,"span"),i.EFF(38,"Report post"),i.k0s()()(),i.j41(39,"button",39)(40,"span",41),i.nrm(41,"mat-icon",58),i.j41(42,"span"),i.EFF(43,"Turn on notifications for this post"),i.k0s()()()()(),i.j41(44,"div",96),i.EFF(45),i.k0s(),i.nrm(46,"div",97),i.j41(47,"div",98)(48,"button",81),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.toggleLike())}),i.nrm(49,"mat-icon",99),i.j41(50,"span",82),i.EFF(51),i.k0s()(),i.j41(52,"button",81),i.bIt("click",function(){i.eBV(t);const o=i.sdS(1);return i.Njj(o.expanded=!o.expanded)}),i.nrm(53,"mat-icon",26),i.j41(54,"span",82),i.EFF(55,"Comment"),i.k0s()(),i.j41(56,"button",100),i.nrm(57,"mat-icon",26),i.j41(58,"span",82),i.EFF(59,"Share"),i.k0s()()(),i.nrm(60,"hr",101),i.j41(61,"div",102)(62,"div",41),i.nrm(63,"img",103)(64,"img",104)(65,"img",104)(66,"img",104),i.j41(67,"div",105),i.EFF(68," You and 4 more liked this "),i.k0s()(),i.nrm(69,"div",106),i.j41(70,"div",107)(71,"button",108),i.EFF(72," 0 shares "),i.k0s(),i.j41(73,"button",109),i.bIt("click",function(){i.eBV(t);const o=i.sdS(1);return i.Njj(o.expanded=!o.expanded)}),i.j41(74,"span",110),i.EFF(75,"0 Comments"),i.k0s(),i.nrm(76,"mat-icon",111),i.k0s()()(),i.qex(77,112),i.nrm(78,"hr",113),i.j41(79,"div",114)(80,"div",115),i.nrm(81,"img",116),i.j41(82,"mat-form-field",78),i.nrm(83,"textarea",79,8),i.k0s()(),i.j41(85,"div",117)(86,"div",41)(87,"button",118),i.bIt("click",function(){i.eBV(t);const o=i.XpG();return i.Njj(o.toggleCommentEmojiPicker())}),i.nrm(88,"mat-icon",26),i.k0s(),i.DNE(89,hu,2,1,"div",83),i.j41(90,"button",119),i.nrm(91,"mat-icon",26),i.k0s(),i.j41(92,"button",119),i.nrm(93,"mat-icon",26),i.k0s()(),i.j41(94,"button",120),i.nrm(95,"mat-icon",26),i.j41(96,"span",82),i.EFF(97,"Send"),i.k0s()()()(),i.bVm(),i.k0s()}if(2&e){const t=i.sdS(1),r=i.sdS(12),o=i.XpG();i.R7$(3),i.FS9("alt",(null==o.currentUserMetadata?null:o.currentUserMetadata.display_name)||(null==o.currentUserMetadata?null:o.currentUserMetadata.name)||"Avatar"),i.Y8G("src",(null==o.currentUserMetadata?null:o.currentUserMetadata.picture)||"images/avatars/avatar-placeholder.png",i.B4B),i.R7$(3),i.JRh((null==o.currentUserMetadata?null:o.currentUserMetadata.display_name)||(null==o.currentUserMetadata?null:o.currentUserMetadata.name)),i.R7$(3),i.Y8G("matMenuTriggerFor",r),i.R7$(),i.Y8G("svgIcon","heroicons_solid:ellipsis-vertical"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:arrow-up-tray"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:eye-slash"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:clock"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:minus-circle"),i.R7$(6),i.Y8G("svgIcon","heroicons_solid:exclamation-triangle"),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:bell"),i.R7$(4),i.SpI(" ",o.eventInput.nativeElement.value," "),i.R7$(4),i.Y8G("ngClass",i.eq3(29,Yc,o.isLiked))("svgIcon",o.isLiked?"heroicons_solid:heart":"heroicons_outline:heart"),i.R7$(2),i.JRh(o.isLiked?"Unlike":"Like"),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:chat-bubble-left-ellipsis"),i.R7$(4),i.Y8G("svgIcon","heroicons_solid:share"),i.R7$(19),i.Y8G("ngClass",i.eq3(31,Kc,t.expanded))("svgIcon","heroicons_mini:chevron-down"),i.R7$(5),i.FS9("alt",(null==o.currentUserMetadata?null:o.currentUserMetadata.display_name)||(null==o.currentUserMetadata?null:o.currentUserMetadata.name)||"Avatar"),i.Y8G("src",(null==o.currentUserMetadata?null:o.currentUserMetadata.picture)||"images/avatars/avatar-placeholder.png",i.B4B),i.R7$(),i.Y8G("subscriptSizing","dynamic"),i.R7$(),i.Y8G("placeholder","Write a comment...")("rows",3),i.R7$(5),i.Y8G("svgIcon","heroicons_solid:face-smile"),i.R7$(),i.Y8G("ngIf",o.showCommentEmojiPicker),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:photo"),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:sparkles"),i.R7$(2),i.Y8G("svgIcon","heroicons_solid:paper-airplane")}}const mu=[{path:"",component:(()=>{class e{constructor(t,r,o,a,u,f,g,b,S,T,$,D,U){this._changeDetectorRef=t,this._metadataService=r,this._signerService=o,this._indexedDBService=a,this._sanitizer=u,this._route=f,this._socialService=g,this.snackBar=b,this.lightning=S,this._dialog=T,this._angorConfigService=$,this._angorConfirmationService=D,this.eventService=U,this.darkMode=!1,this.isLoading=!0,this.errorMessage=null,this._unsubscribeAll=new Lt.B,this.followers=[],this.following=[],this.allPublicKeys=[],this.suggestions=[],this.isCurrentUserProfile=!1,this.isFollowing=!1,this.showEmojiPicker=!1,this.showCommentEmojiPicker=!1,this.lightningResponse=null,this.lightningInvoice=null,this.paymentInvoice="",this.invoiceAmount="?",this.isLiked=!1,this.isPreview=!1,this.posts=[],this.likes=[],this.myLikes=[],this.myLikedNoteIds=[],this.isLoadingPosts=!0,this.noEventsMessage="";this.paginator=new v(0,0,12e3)}ngOnInit(){this.updateSuggestionList(),this._angorConfigService.config$.subscribe(t=>{"auto"===t.scheme?this.detectSystemTheme():this.darkMode="dark"===t.scheme}),this._route.paramMap.subscribe(t=>{const r=t.get("pubkey");this.routePubKey=r;const o=this._signerService.getPublicKey();this.currentUserPubKey=o,(r||o)&&(this.isCurrentUserProfile=r===o),this.routePubKey=r||o,this.loadProfile(this.routePubKey),r||(this.isCurrentUserProfile=!0),this.loadCurrentUserProfile()}),this._indexedDBService.getMetadataStream().pipe((0,jt.Q)(this._unsubscribeAll)).subscribe(t=>{t&&t.pubkey===this.currentUserPubKey&&(this.currentUserMetadata=t.metadata,this._changeDetectorRef.detectChanges())}),this.routePubKey&&this._indexedDBService.getMetadataStream().pipe((0,jt.Q)(this._unsubscribeAll)).subscribe(t=>{t&&t.pubkey===this.routePubKey&&(this.metadata=t.metadata,this._changeDetectorRef.detectChanges())}),this._socialService.getFollowersObservable().pipe((0,jt.Q)(this._unsubscribeAll)).subscribe(t=>{this.followers.push(t.pubkey),this._changeDetectorRef.detectChanges()}),this._socialService.getFollowingObservable().pipe((0,jt.Q)(this._unsubscribeAll)).subscribe(t=>{t.tags.filter(o=>"p"===o[0]).forEach(o=>{this.following.push({nostrPubKey:o[1]})}),this._changeDetectorRef.detectChanges()})}ngOnDestroy(){this._unsubscribeAll.next(null),this._unsubscribeAll.complete()}loadProfile(t){var r=this;return(0,y.A)(function*(){if(r.isLoading=!0,r.errorMessage=null,r.metadata=null,r.followers=[],r.following=[],r._changeDetectorRef.detectChanges(),!t)return r.errorMessage="No public key found. Please log in again.",r.isLoading=!1,void r._changeDetectorRef.detectChanges();try{const o=yield r._metadataService.fetchMetadataWithCache(t);o&&(r.metadata=o,r._changeDetectorRef.detectChanges()),r.followers=yield r._socialService.getFollowers(t);const a=r._signerService.getPublicKey();r.isFollowing=r.followers.includes(a),r.following=yield r._socialService.getFollowing(t),r._changeDetectorRef.detectChanges()}catch(o){console.error("Failed to load profile data:",o),r.errorMessage="Failed to load profile data. Please try again later.",r._changeDetectorRef.detectChanges()}finally{r.isLoading=!1,r._changeDetectorRef.detectChanges()}})()}loadCurrentUserProfile(){var t=this;return(0,y.A)(function*(){try{t.currentUserMetadata=null,t.currentUserPubKey=t._signerService.getPublicKey();const r=yield t._metadataService.fetchMetadataWithCache(t.currentUserPubKey);r&&(t.currentUserMetadata=r),t._changeDetectorRef.detectChanges()}catch(r){console.error("Failed to load profile data:",r),t.errorMessage="Failed to load profile data. Please try again later.",t._changeDetectorRef.detectChanges()}finally{t._changeDetectorRef.detectChanges()}})()}getSafeUrl(t){return this._sanitizer.bypassSecurityTrustUrl(t)}toggleFollow(){var t=this;return(0,y.A)(function*(){try{const r=t._signerService.getPublicKey(),o=t.routePubKey||t.currentUserPubKey;if(!o||!r)return void console.error("Public key missing. Unable to toggle follow.");t.isFollowing?(yield t._socialService.unfollow(o),console.log(`Unfollowed ${o}`),t.followers=t.followers.filter(a=>a!==r)):(yield t._socialService.follow(o),console.log(`Followed ${o}`),t.followers.push(r)),t.isFollowing=!t.isFollowing,t._changeDetectorRef.detectChanges()}catch(r){console.error("Failed to toggle follow:",r)}})()}openSnackBar(t,r){this.snackBar.open(t,r,{duration:1300})}getLightningInfo(){let t="";if(this.metadata?.lud06){const{words:r}=V.I.decode(this.metadata.lud06,5e3),o=new Uint8Array(V.I.fromWords(r));t=(new TextDecoder).decode(Uint8Array.from(o))}else if(this.metadata?.lud16?.toLowerCase().startsWith("lnurl")){const{words:r}=V.I.decode(this.metadata.lud16,5e3),o=new Uint8Array(V.I.fromWords(r));t=(new TextDecoder).decode(Uint8Array.from(o))}else this.metadata?.lud16&&(t=this.lightning.getLightningAddress(this.metadata.lud16));""!==t?this.lightning.getLightning(t).subscribe(r=>{this.lightningResponse=r,"Failed"===this.lightningResponse.status?this.openSnackBar("Failed to lookup lightning address","dismiss"):this.lightningResponse.callback?this.openZapDialog():this.openSnackBar("couldn't find user's lightning address","dismiss")}):this.openSnackBar("No lightning address found","dismiss")}zap(){var t=this;return(0,y.A)(function*(){t.metadata&&(t.metadata.lud06||t.metadata.lud16)?t.getLightningInfo():t.openSnackBar("user can't receive zaps","dismiss")})()}openZapDialog(){this._dialog.open(jc,{width:"405px",maxHeight:"90vh",data:this.metadata})}openReceiveZapDialog(){this._dialog.open(wc,{width:"405px",maxHeight:"90vh",data:this.metadata})}toggleLike(){this.isLiked=!this.isLiked,this.isLiked&&setTimeout(()=>{this.isLiked=!1,this.isLiked=!0},300)}addEmoji(t){this.eventInput.nativeElement.value+=t.emoji.native,this.showEmojiPicker=!1}toggleEmojiPicker(){this.showCommentEmojiPicker=!1,this.showEmojiPicker=!this.showEmojiPicker}addEmojiTocomment(t){this.commentInput.nativeElement.value+=t.emoji.native,this.showCommentEmojiPicker=!1}toggleCommentEmojiPicker(){this.showEmojiPicker=!1,this.showCommentEmojiPicker=!this.showCommentEmojiPicker}detectSystemTheme(){const t=window.matchMedia("(prefers-color-scheme: dark)");this.darkMode=t.matches,t.addEventListener("change",r=>{this.darkMode=r.matches})}openConfirmationDialog(){this._angorConfirmationService.open({title:"Share Event",message:'Are you sure you want to share this event on your profile? This action is permanent and cannot be undone.',icon:{show:!0,name:"heroicons_solid:share",color:"primary"},actions:{confirm:{show:!0,label:"Yes, Share",color:"primary"},cancel:{show:!0,label:"Cancel"}},dismissible:!0}).afterClosed().subscribe(r=>{console.log(r)})}togglePreview(){this.isPreview=!this.isPreview}sendEvent(){""!=this.eventInput.nativeElement.value&&this.eventService.sendTextEvent(this.eventInput.nativeElement.value).then(()=>{this._changeDetectorRef.markForCheck()}).catch(t=>{console.error("Failed to send Event:",t)})}updateSuggestionList(){this._indexedDBService.getSuggestionUsers().then(t=>{this.suggestions=t,this._changeDetectorRef.detectChanges()}).catch(t=>{console.error("Error updating suggestion list:",t)})}static#t=this.\u0275fac=function(r){return new(r||e)(i.rXU(i.gRc),i.rXU(An.T),i.rXU(Gt.A),i.rXU(Dc.n),i.rXU(kt.up),i.rXU(dt.nX),i.rXU(Oc),i.rXU(Ri),i.rXU(ss),i.rXU(Ce.bZ),i.rXU(Fc.P),i.rXU($c.m),i.rXU(Wt))};static#e=this.\u0275cmp=i.VBU({type:e,selectors:[["profile"]],viewQuery:function(r,o){if(1&r&&(i.GBs(Gc,5),i.GBs(zc,5)),2&r){let a;i.mGM(a=i.lsd())&&(o.eventInput=a.first),i.mGM(a=i.lsd())&&(o.commentInput=a.first)}},standalone:!0,features:[i.aNF],decls:72,vars:28,consts:[["defaultAvatar",""],["profileMenu","matMenu"],["listEventMenu","matMenu"],["listCard08Menu","matMenu"],["eventInput",""],["postCardMenu01","matMenu"],["expandableComments","angorCard"],["postCardMenu02","matMenu"],["commentInput",""],[1,"flex","min-w-0","flex-auto","flex-col"],[1,"bg-card","flex","flex-col","shadow"],["onerror","this.onerror=null; this.src='/images/pages/profile/cover.jpg';",1,"h-40","object-cover","lg:h-80",3,"src","alt"],[1,"bg-card","mx-auto","flex","w-full","max-w-5xl","flex-0","flex-col","items-center","px-8","lg:h-18","lg:flex-row"],[1,"-mt-26","flex-shrink-0","rounded-full","lg:-mt-22"],[4,"ngIf","ngIfElse"],[1,"mt-4","flex","flex-grow","flex-col","items-center","lg:ml-8","lg:mt-0","lg:items-start"],[1,"max-w-full","truncate","text-lg","font-bold","leading-tight","lg:max-w-[25rem]",2,"white-space","nowrap","overflow","hidden","text-overflow","ellipsis"],[1,"text-secondary","max-w-full","truncate","leading-tight","lg:max-w-[25rem]",2,"white-space","nowrap","overflow","hidden","text-overflow","ellipsis"],[1,"mx-8","hidden","h-8","flex-shrink-0","border-l-2","lg:flex"],[1,"mt-6","flex","flex-shrink-0","items-center","space-x-6","lg:mt-0"],[1,"flex","flex-col","items-center"],[1,"font-bold"],[1,"text-secondary","text-sm","font-medium"],[1,"mb-4","mt-8","flex","flex-shrink-0","items-center","space-x-6","lg:m-0","lg:ml-auto"],[4,"ngIf"],["mat-icon-button","",3,"matMenuTriggerFor"],[1,"icon-size-5",3,"svgIcon"],["mat-menu-item","",3,"click",4,"ngIf"],[1,"my-2"],["mat-menu-item","",3,"routerLink",4,"ngIf"],["mat-menu-item","",4,"ngIf"],[1,"mx-auto","flex","w-full","max-w-5xl","flex-auto","justify-center","p-6","sm:p-8"],[1,"mr-8","hidden","flex-col","items-start","lg:flex"],["class","flex w-full max-w-80 flex-col p-8",4,"ngIf"],["class","flex w-full max-w-80 flex-col px-8 pb-4 pt-6",3,"ngClass",4,"ngIf"],[1,"mt-8","flex","w-full","max-w-80","flex-col","px-8","pb-4","pt-6"],[1,"flex","items-center","justify-between"],[1,"text-2xl","font-semibold","leading-tight"],[1,"-mr-3"],["mat-menu-item",""],[1,"mt-5","flex","flex-col"],[1,"flex","items-center"],["src","images/cards/coffee-shop-01-320x200.jpg","alt","Card cover image",1,"mr-4","h-14","w-14","rounded","object-cover"],[1,"flex","min-w-0","flex-col"],[1,"font-medium","leading-none"],[1,"mt-1","truncate","text-md","leading-none"],[1,"text-secondary","mt-2","text-md","leading-none"],[1,"-mx-3","mt-6","flex","items-center"],["mat-button","",1,"px-3",3,"color","routerLink"],[1,"flex","w-full","flex-col","items-start"],["class","mb-8 flex w-full flex-col p-6 pb-6 sm:p-8",4,"ngIf"],["class","mb-8 flex w-full flex-col bg-primary-50 dark:bg-primary-800",4,"ngIf"],[1,"mb-8","w-full",3,"pubkeys"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"ring-bg-card","h-32","min-h-32","w-32","min-w-32","max-w-fit","rounded-full","object-cover","ring-4",3,"src","alt"],["src","/images/avatars/avatar-placeholder.png","onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"ring-bg-card","h-32","min-h-32","w-32","min-w-32","rounded-full","object-cover","ring-4",3,"alt"],["mat-icon-button","",3,"click","matTooltip"],[3,"svgIcon"],["mat-menu-item","",3,"click"],[1,"mr-3","icon-size-5",3,"svgIcon"],["mat-menu-item","",3,"routerLink"],[1,"flex","w-full","max-w-80","flex-col","p-8"],[1,"mt-4"],["mat-flat-button","",1,"mt-8","px-6",3,"color","routerLink"],[1,"flex","w-full","max-w-80","flex-col","px-8","pb-4","pt-6",3,"ngClass"],["class","flex flex-col",4,"ngIf"],[1,"flex","flex-col"],["class","mt-6 flex justify-between",4,"ngFor","ngForOf"],[1,"mt-6","flex","justify-between"],["class","h-14 w-14 rounded-full object-cover","onerror","this.onerror=null; this.src='/images/pages/profile/cover.jpg';","role","button",3,"src","alt","matTooltip","routerLink",4,"ngFor","ngForOf"],["onerror","this.onerror=null; this.src='/images/pages/profile/cover.jpg';","role","button",1,"h-14","w-14","rounded-full","object-cover",3,"src","alt","matTooltip","routerLink"],[1,"mb-8","flex","w-full","flex-col","p-6","pb-6","sm:p-8"],[1,"flex","justify-between"],[1,"text-xl","font-semibold"],[1,"-mr-4","ml-auto",3,"change","color"],[1,"mt-8","flex","flex-col","items-start","sm:flex-row"],[1,"mb-6","flex","items-center","sm:mb-0"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"mr-4","h-12","w-12","min-w-12","rounded-full","object-cover",3,"src","alt"],[1,"sm:hidden"],[1,"w-full",3,"subscriptSizing"],["matInput","","cdkTextareaAutosize","",3,"placeholder","rows"],[1,"-mx-3","mt-6","flex","items-center","justify-between","sm:mt-8"],["mat-button","",1,"mr-1","px-3",3,"click"],[1,"ml-2"],["class","emoji-picker-container-global",4,"ngIf"],["mat-button","",1,"mr-1","hidden","px-3","sm:inline-flex"],["mat-button","",1,"px-3",3,"matMenuTriggerFor"],["mat-menu-item","",1,"sm:hidden"],["mat-button","",1,"mr-1","flex","px-3",3,"click"],[1,"emoji-picker-container-global"],[3,"emojiClick","darkMode"],[1,"mb-8","flex","w-full","flex-col","bg-primary-50","dark:bg-primary-800"],[1,"mx-6","mb-4","mt-6","flex","items-center","sm:mx-8"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"mr-4","h-10","w-10","rounded-full",3,"src","alt"],[1,"font-semibold","leading-none"],[1,"text-secondary","mt-1","text-sm","leading-none"],["mat-icon-button","",1,"-mr-4","ml-auto",3,"matMenuTriggerFor"],[1,"mx-6","mb-6","mt-2","sm:mx-8"],[1,"relative","mb-4"],[1,"mx-3","flex","items-center","sm:mx-5"],[1,"text-red-500","icon-size-5",3,"ngClass","svgIcon"],["mat-button","",1,"mr-1","px-3"],[1,"mx-6","mb-6","mt-4","border-b","sm:mx-8"],[1,"mx-6","mb-4","flex","flex-col","sm:mx-8","sm:mb-6","sm:flex-row","sm:items-center"],["src","images/avatars/avatar-placeholder.png","alt","Card cover image",1,"text-card","m-0.5","h-6","w-6","rounded-full","ring-2","ring-white"],["src","images/avatars/avatar-placeholder.png","alt","Card cover image",1,"text-card","m-0.5","-ml-3","h-6","w-6","rounded-full","ring-2","ring-white"],[1,"ml-3","text-md","tracking-tight"],[1,"hidden","flex-auto","sm:flex"],[1,"mt-4","flex","items-center","sm:mt-0"],["mat-button","",1,"-ml-2","mr-1","px-3","sm:ml-0"],["mat-button","",1,"px-3","sm:-mr-4",3,"click"],[1,"mr-1"],[1,"rotate-0","transition-transform","duration-150","ease-in-out","icon-size-5",3,"ngClass","svgIcon"],["angorCardExpansion",""],[1,"m-0","border-b"],[1,"mx-4","mb-3","mt-6","flex","flex-col","sm:mx-8"],[1,"flex","items-start"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"mr-5","h-12","w-12","rounded-full","object-cover",3,"src","alt"],[1,"mt-3","flex","items-center","justify-between"],["mat-icon-button","",3,"click"],["mat-icon-button",""],["mat-button","",1,"mr-1","flex","px-3"]],template:function(r,o){if(1&r&&(i.j41(0,"div",9)(1,"div",10)(2,"div"),i.nrm(3,"img",11),i.k0s(),i.j41(4,"div",12)(5,"div",13),i.DNE(6,Zc,2,2,"ng-container",14)(7,Xc,1,1,"ng-template",null,0,i.C5r),i.k0s(),i.j41(9,"div",15)(10,"div",16),i.EFF(11),i.k0s(),i.j41(12,"div",17),i.EFF(13),i.k0s()(),i.nrm(14,"div",18),i.j41(15,"div",19)(16,"div",20)(17,"span",21),i.EFF(18),i.k0s(),i.j41(19,"span",22),i.EFF(20,"FOLLOWERS"),i.k0s()(),i.j41(21,"div",20)(22,"span",21),i.EFF(23),i.k0s(),i.j41(24,"span",22),i.EFF(25,"FOLLOWING"),i.k0s()()(),i.nrm(26,"div",18),i.j41(27,"div",23),i.DNE(28,Jc,3,2,"div",24),i.j41(29,"div")(30,"button",25),i.nrm(31,"mat-icon",26),i.k0s(),i.j41(32,"mat-menu",null,1),i.DNE(34,Qc,5,1,"button",27)(35,tu,5,1,"button",27),i.nrm(36,"mat-divider",28),i.DNE(37,eu,5,2,"button",29)(38,nu,5,1,"button",30)(39,ru,5,1,"button",30),i.k0s()()()()(),i.j41(40,"div",31)(41,"div",32),i.DNE(42,iu,7,4,"angor-card",33)(43,cu,12,8,"angor-card",34),i.j41(44,"angor-card",35)(45,"div",36)(46,"div",37),i.EFF(47," Last projects "),i.k0s(),i.j41(48,"div",38)(49,"button",25),i.nrm(50,"mat-icon",26),i.k0s(),i.j41(51,"mat-menu",null,2)(53,"button",39),i.EFF(54,"Search for groups"),i.k0s()()()(),i.j41(55,"div",40)(56,"div",41),i.nrm(57,"img",42),i.j41(58,"div",43)(59,"div",44),i.EFF(60," The Port Cafe "),i.k0s(),i.j41(61,"div",45),i.EFF(62," Best cafe of the downtown New York "),i.k0s(),i.j41(63,"div",46),i.EFF(64," 1.2k followers "),i.k0s()()()(),i.j41(65,"div",47)(66,"a",48),i.EFF(67," See all Project "),i.k0s()()()(),i.j41(68,"div",49),i.DNE(69,fu,62,19,"angor-card",50)(70,du,98,33,"angor-card",51),i.nrm(71,"app-event-list",52),i.k0s()()()),2&r){const a=i.sdS(8),u=i.sdS(33),f=i.sdS(52);i.R7$(3),i.FS9("alt",(null==o.metadata?null:o.metadata.display_name)||(null==o.metadata?null:o.metadata.name)||"Banner"),i.Y8G("src",(null==o.metadata?null:o.metadata.banner)||"/images/pages/profile/cover.jpg",i.B4B),i.R7$(3),i.Y8G("ngIf",null==o.metadata?null:o.metadata.picture)("ngIfElse",a),i.R7$(5),i.SpI(" ",(null==o.metadata?null:o.metadata.display_name)||(null==o.metadata?null:o.metadata.name)||"Unknown User"," "),i.R7$(2),i.SpI(" ",(null==o.metadata?null:o.metadata.username)||(null==o.metadata?null:o.metadata.name)," "),i.R7$(5),i.JRh(o.followers.length),i.R7$(5),i.JRh(o.following.length),i.R7$(5),i.Y8G("ngIf",!o.isCurrentUserProfile),i.R7$(2),i.Y8G("matMenuTriggerFor",u),i.R7$(),i.Y8G("svgIcon","heroicons_solid:ellipsis-vertical"),i.R7$(3),i.Y8G("ngIf",!o.isCurrentUserProfile),i.R7$(),i.Y8G("ngIf",o.isCurrentUserProfile),i.R7$(2),i.Y8G("ngIf",o.isCurrentUserProfile),i.R7$(),i.Y8G("ngIf",!o.isCurrentUserProfile),i.R7$(),i.Y8G("ngIf",!o.isCurrentUserProfile),i.R7$(3),i.Y8G("ngIf",(null==o.metadata?null:o.metadata.about)&&""!==o.metadata.about.trim()),i.R7$(),i.Y8G("ngIf",o.suggestions.length>0),i.R7$(6),i.Y8G("matMenuTriggerFor",f),i.R7$(),i.Y8G("svgIcon","heroicons_solid:ellipsis-vertical"),i.R7$(16),i.Y8G("color","primary")("routerLink",i.lJ4(25,as)),i.R7$(3),i.Y8G("ngIf",o.isCurrentUserProfile),i.R7$(),i.Y8G("ngIf",o.isPreview),i.R7$(),i.Y8G("pubkeys",i.eq3(26,qc,o.routePubKey))}},dependencies:[dt.Wk,_.n,tt.m_,tt.An,I.Hl,I.It,I.$z,I.iY,K.Cn,K.kk,K.fb,K.Cp,j.RG,j.rl,at.fS,at.fg,A.xb,A.EE,B.w,B.q,O.uc,O.oV,m.YU,m.MD,m.Sq,m.bT,C.YN,it,G.Ic,L.sG,nt.D6,Cn,me],styles:[".emoji-picker-container-global{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:9999;width:350px;max-width:100%}.heart-beat{animation:heartBeatAnimation .3s ease-in-out}@keyframes heartBeatAnimation{0%{transform:scale(1)}30%{transform:scale(2)}60%{transform:scale(1)}to{transform:scale(1)}}.loading-spinner{display:flex;justify-content:center;align-items:center;margin:20px 0}.loading-spinner .spinner{border:4px solid rgba(0,0,0,.1);border-left-color:#009fb5;border-radius:50%;width:30px;height:30px;animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}\n"],encapsulation:2,changeDetection:0})}return e})()}]},2577:(bt,N,M)=>{const y=M(531),_=M(8715),A=M(465),m=M(5510);function C(I,B,j,tt,at){const K=[].slice.call(arguments,1),nt=K.length,L="function"==typeof K[nt-1];if(!L&&!y())throw new Error("Callback required as last argument");if(!L){if(nt<1)throw new Error("Too few arguments provided");return 1===nt?(j=B,B=tt=void 0):2===nt&&!B.getContext&&(tt=j,j=B,B=void 0),new Promise(function(O,dt){try{const G=_.create(j,tt);O(I(G,B,tt))}catch(G){dt(G)}})}if(nt<2)throw new Error("Too few arguments provided");2===nt?(at=j,j=B,B=tt=void 0):3===nt&&(B.getContext&&typeof at>"u"?(at=tt,tt=void 0):(at=tt,tt=j,j=B,B=void 0));try{const O=_.create(j,tt);at(null,I(O,B,tt))}catch(O){at(O)}}N.mo=C.bind(null,A.render),N.dY=C.bind(null,A.renderToDataURL),N.toString=C.bind(null,function(I,B,j){return m.render(I,j)})},531:bt=>{bt.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},919:(bt,N,M)=>{const E=M(2656).getSymbolSize;N.getRowColCoords=function(_){if(1===_)return[];const A=Math.floor(_/7)+2,m=E(_),C=145===m?26:2*Math.ceil((m-13)/(2*A-2)),I=[m-7];for(let B=1;B{const E=M(838),y=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function _(A){this.mode=E.ALPHANUMERIC,this.data=A}_.getBitsLength=function(m){return 11*Math.floor(m/2)+m%2*6},_.prototype.getLength=function(){return this.data.length},_.prototype.getBitsLength=function(){return _.getBitsLength(this.data.length)},_.prototype.write=function(m){let C;for(C=0;C+2<=this.data.length;C+=2){let I=45*y.indexOf(this.data[C]);I+=y.indexOf(this.data[C+1]),m.put(I,11)}this.data.length%2&&m.put(y.indexOf(this.data[C]),6)},bt.exports=_},4481:bt=>{function N(){this.buffer=[],this.length=0}N.prototype={get:function(M){const E=Math.floor(M/8);return 1==(this.buffer[E]>>>7-M%8&1)},put:function(M,E){for(let y=0;y>>E-y-1&1))},getLengthInBits:function(){return this.length},putBit:function(M){const E=Math.floor(this.length/8);this.buffer.length<=E&&this.buffer.push(0),M&&(this.buffer[E]|=128>>>this.length%8),this.length++}},bt.exports=N},8038:bt=>{function N(M){if(!M||M<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=M,this.data=new Uint8Array(M*M),this.reservedBit=new Uint8Array(M*M)}N.prototype.set=function(M,E,y,_){const A=M*this.size+E;this.data[A]=y,_&&(this.reservedBit[A]=!0)},N.prototype.get=function(M,E){return this.data[M*this.size+E]},N.prototype.xor=function(M,E,y){this.data[M*this.size+E]^=y},N.prototype.isReserved=function(M,E){return this.reservedBit[M*this.size+E]},bt.exports=N},1736:(bt,N,M)=>{const E=M(3174),y=M(838);function _(A){this.mode=y.BYTE,"string"==typeof A&&(A=E(A)),this.data=new Uint8Array(A)}_.getBitsLength=function(m){return 8*m},_.prototype.getLength=function(){return this.data.length},_.prototype.getBitsLength=function(){return _.getBitsLength(this.data.length)},_.prototype.write=function(A){for(let m=0,C=this.data.length;m{const E=M(139),y=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],_=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];N.getBlocksCount=function(m,C){switch(C){case E.L:return y[4*(m-1)+0];case E.M:return y[4*(m-1)+1];case E.Q:return y[4*(m-1)+2];case E.H:return y[4*(m-1)+3];default:return}},N.getTotalCodewordsCount=function(m,C){switch(C){case E.L:return _[4*(m-1)+0];case E.M:return _[4*(m-1)+1];case E.Q:return _[4*(m-1)+2];case E.H:return _[4*(m-1)+3];default:return}}},139:(bt,N)=>{N.L={bit:1},N.M={bit:0},N.Q={bit:3},N.H={bit:2},N.isValid=function(y){return y&&typeof y.bit<"u"&&y.bit>=0&&y.bit<4},N.from=function(y,_){if(N.isValid(y))return y;try{return function M(E){if("string"!=typeof E)throw new Error("Param is not a string");switch(E.toLowerCase()){case"l":case"low":return N.L;case"m":case"medium":return N.M;case"q":case"quartile":return N.Q;case"h":case"high":return N.H;default:throw new Error("Unknown EC Level: "+E)}}(y)}catch{return _}}},9202:(bt,N,M)=>{const E=M(2656).getSymbolSize;N.getPositions=function(A){const m=E(A);return[[0,0],[m-7,0],[0,m-7]]}},9211:(bt,N,M)=>{const E=M(2656),A=E.getBCHDigit(1335);N.getEncodedBits=function(C,I){const B=C.bit<<3|I;let j=B<<10;for(;E.getBCHDigit(j)-A>=0;)j^=1335<{const M=new Uint8Array(512),E=new Uint8Array(256);(function(){let _=1;for(let A=0;A<255;A++)M[A]=_,E[_]=A,_<<=1,256&_&&(_^=285);for(let A=255;A<512;A++)M[A]=M[A-255]})(),N.log=function(_){if(_<1)throw new Error("log("+_+")");return E[_]},N.exp=function(_){return M[_]},N.mul=function(_,A){return 0===_||0===A?0:M[E[_]+E[A]]}},1971:(bt,N,M)=>{const E=M(838),y=M(2656);function _(A){this.mode=E.KANJI,this.data=A}_.getBitsLength=function(m){return 13*m},_.prototype.getLength=function(){return this.data.length},_.prototype.getBitsLength=function(){return _.getBitsLength(this.data.length)},_.prototype.write=function(A){let m;for(m=0;m=33088&&C<=40956)C-=33088;else{if(!(C>=57408&&C<=60351))throw new Error("Invalid SJIS character: "+this.data[m]+"\nMake sure your charset is UTF-8");C-=49472}C=192*(C>>>8&255)+(255&C),A.put(C,13)}},bt.exports=_},9366:(bt,N)=>{N.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};function E(y,_,A){switch(y){case N.Patterns.PATTERN000:return(_+A)%2==0;case N.Patterns.PATTERN001:return _%2==0;case N.Patterns.PATTERN010:return A%3==0;case N.Patterns.PATTERN011:return(_+A)%3==0;case N.Patterns.PATTERN100:return(Math.floor(_/2)+Math.floor(A/3))%2==0;case N.Patterns.PATTERN101:return _*A%2+_*A%3==0;case N.Patterns.PATTERN110:return(_*A%2+_*A%3)%2==0;case N.Patterns.PATTERN111:return(_*A%3+(_+A)%2)%2==0;default:throw new Error("bad maskPattern:"+y)}}N.isValid=function(_){return null!=_&&""!==_&&!isNaN(_)&&_>=0&&_<=7},N.from=function(_){return N.isValid(_)?parseInt(_,10):void 0},N.getPenaltyN1=function(_){const A=_.size;let m=0,C=0,I=0,B=null,j=null;for(let tt=0;tt=5&&(m+=C-5+3),B=K,C=1),K=_.get(at,tt),K===j?I++:(I>=5&&(m+=I-5+3),j=K,I=1)}C>=5&&(m+=C-5+3),I>=5&&(m+=I-5+3)}return m},N.getPenaltyN2=function(_){const A=_.size;let m=0;for(let C=0;C=10&&(1488===C||93===C)&&m++,I=I<<1&2047|_.get(j,B),j>=10&&(1488===I||93===I)&&m++}return 40*m},N.getPenaltyN4=function(_){let A=0;const m=_.data.length;for(let I=0;I{const E=M(1604),y=M(6082);N.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},N.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},N.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},N.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},N.MIXED={bit:-1},N.getCharCountIndicator=function(m,C){if(!m.ccBits)throw new Error("Invalid mode: "+m);if(!E.isValid(C))throw new Error("Invalid version: "+C);return C>=1&&C<10?m.ccBits[0]:C<27?m.ccBits[1]:m.ccBits[2]},N.getBestModeForData=function(m){return y.testNumeric(m)?N.NUMERIC:y.testAlphanumeric(m)?N.ALPHANUMERIC:y.testKanji(m)?N.KANJI:N.BYTE},N.toString=function(m){if(m&&m.id)return m.id;throw new Error("Invalid mode")},N.isValid=function(m){return m&&m.bit&&m.ccBits},N.from=function(m,C){if(N.isValid(m))return m;try{return function _(A){if("string"!=typeof A)throw new Error("Param is not a string");switch(A.toLowerCase()){case"numeric":return N.NUMERIC;case"alphanumeric":return N.ALPHANUMERIC;case"kanji":return N.KANJI;case"byte":return N.BYTE;default:throw new Error("Unknown mode: "+A)}}(m)}catch{return C}}},7035:(bt,N,M)=>{const E=M(838);function y(_){this.mode=E.NUMERIC,this.data=_.toString()}y.getBitsLength=function(A){return 10*Math.floor(A/3)+(A%3?A%3*3+1:0)},y.prototype.getLength=function(){return this.data.length},y.prototype.getBitsLength=function(){return y.getBitsLength(this.data.length)},y.prototype.write=function(A){let m,C,I;for(m=0;m+3<=this.data.length;m+=3)C=this.data.substr(m,3),I=parseInt(C,10),A.put(I,10);const B=this.data.length-m;B>0&&(C=this.data.substr(m),I=parseInt(C,10),A.put(I,3*B+1))},bt.exports=y},7767:(bt,N,M)=>{const E=M(6965);N.mul=function(_,A){const m=new Uint8Array(_.length+A.length-1);for(let C=0;C<_.length;C++)for(let I=0;I=0;){const C=m[0];for(let B=0;B{const E=M(2656),y=M(139),_=M(4481),A=M(8038),m=M(919),C=M(9202),I=M(9366),B=M(2296),j=M(6758),tt=M(8925),at=M(9211),K=M(838),nt=M(7939);function V(ot,it,lt){const ht=ot.size,p=at.getEncodedBits(it,lt);let s,l;for(s=0;s<15;s++)l=1==(p>>s&1),ot.set(s<6?s:s<8?s+1:ht-15+s,8,l,!0),ot.set(8,s<8?ht-s-1:s<9?15-s-1+1:15-s-1,l,!0);ot.set(ht-8,8,1,!0)}function Pt(ot,it,lt,ht){let p;if(Array.isArray(ot))p=nt.fromArray(ot);else{if("string"!=typeof ot)throw new Error("Invalid data");{let v=it;if(!v){const k=nt.rawSplit(ot);v=tt.getBestVersionForData(k,lt)}p=nt.fromString(ot,v||40)}}const s=tt.getBestVersionForData(p,lt);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(it){if(it=0&&h<=6&&(0===d||6===d)||d>=0&&d<=6&&(0===h||6===h)||h>=2&&h<=4&&d>=2&&d<=4,!0)}}(d,it),function O(ot){const it=ot.size;for(let lt=8;lt=7&&function G(ot,it){const lt=ot.size,ht=tt.getEncodedBits(it);let p,s,l;for(let h=0;h<18;h++)p=Math.floor(h/3),s=h%3+lt-8-3,l=1==(ht>>h&1),ot.set(p,s,l,!0),ot.set(s,p,l,!0)}(d,it),function i(ot,it){const lt=ot.size;let ht=-1,p=lt-1,s=7,l=0;for(let h=lt-1;h>0;h-=2)for(6===h&&h--;;){for(let d=0;d<2;d++)if(!ot.isReserved(p,h-d)){let v=!1;l>>s&1)),ot.set(p,h-d,v),s--,-1===s&&(l++,s=7)}if(p+=ht,p<0||lt<=p){p-=ht,ht=-ht;break}}}(d,l),isNaN(ht)&&(ht=I.getBestMask(d,V.bind(null,d,lt))),I.applyMask(ht,d),V(d,lt,ht),{modules:d,version:it,errorCorrectionLevel:lt,maskPattern:ht,segments:p}}N.create=function(it,lt){if(typeof it>"u"||""===it)throw new Error("No input text");let p,s,ht=y.M;return typeof lt<"u"&&(ht=y.from(lt.errorCorrectionLevel,y.M),p=tt.from(lt.version),s=I.from(lt.maskPattern),lt.toSJISFunc&&E.setToSJISFunction(lt.toSJISFunc)),Pt(it,p,ht,s)}},6758:(bt,N,M)=>{const E=M(7767);function y(_){this.genPoly=void 0,this.degree=_,this.degree&&this.initialize(this.degree)}y.prototype.initialize=function(A){this.degree=A,this.genPoly=E.generateECPolynomial(this.degree)},y.prototype.encode=function(A){if(!this.genPoly)throw new Error("Encoder not initialized");const m=new Uint8Array(A.length+this.degree);m.set(A);const C=E.mod(m,this.genPoly),I=this.degree-C.length;if(I>0){const B=new Uint8Array(this.degree);return B.set(C,I),B}return C},bt.exports=y},6082:(bt,N)=>{const M="[0-9]+";let y="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";y=y.replace(/u/g,"\\u");const _="(?:(?![A-Z0-9 $%*+\\-./:]|"+y+")(?:.|[\r\n]))+";N.KANJI=new RegExp(y,"g"),N.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),N.BYTE=new RegExp(_,"g"),N.NUMERIC=new RegExp(M,"g"),N.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const A=new RegExp("^"+y+"$"),m=new RegExp("^"+M+"$"),C=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");N.testKanji=function(B){return A.test(B)},N.testNumeric=function(B){return m.test(B)},N.testAlphanumeric=function(B){return C.test(B)}},7939:(bt,N,M)=>{const E=M(838),y=M(7035),_=M(387),A=M(1736),m=M(1971),C=M(6082),I=M(2656),B=M(243);function j(G){return unescape(encodeURIComponent(G)).length}function tt(G,V,i){const ut=[];let kt;for(;null!==(kt=G.exec(i));)ut.push({data:kt[0],index:kt.index,mode:V,length:kt[0].length});return ut}function at(G){const V=tt(C.NUMERIC,E.NUMERIC,G),i=tt(C.ALPHANUMERIC,E.ALPHANUMERIC,G);let ut,kt;return I.isKanjiModeEnabled()?(ut=tt(C.BYTE,E.BYTE,G),kt=tt(C.KANJI,E.KANJI,G)):(ut=tt(C.BYTE_KANJI,E.BYTE,G),kt=[]),V.concat(i,ut,kt).sort(function(ot,it){return ot.index-it.index}).map(function(ot){return{data:ot.data,mode:ot.mode,length:ot.length}})}function K(G,V){switch(V){case E.NUMERIC:return y.getBitsLength(G);case E.ALPHANUMERIC:return _.getBitsLength(G);case E.KANJI:return m.getBitsLength(G);case E.BYTE:return A.getBitsLength(G)}}function dt(G,V){let i;const ut=E.getBestModeForData(G);if(i=E.from(V,ut),i!==E.BYTE&&i.bit=0?V[V.length-1]:null;return ut&&ut.mode===i.mode?(V[V.length-1].data+=i.data,V):(V.push(i),V)},[])}(it))},N.rawSplit=function(V){return N.fromArray(at(V,I.isKanjiModeEnabled()))}},2656:(bt,N)=>{let M;const E=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];N.getSymbolSize=function(_){if(!_)throw new Error('"version" cannot be null or undefined');if(_<1||_>40)throw new Error('"version" should be in range from 1 to 40');return 4*_+17},N.getSymbolTotalCodewords=function(_){return E[_]},N.getBCHDigit=function(y){let _=0;for(;0!==y;)_++,y>>>=1;return _},N.setToSJISFunction=function(_){if("function"!=typeof _)throw new Error('"toSJISFunc" is not a valid function.');M=_},N.isKanjiModeEnabled=function(){return typeof M<"u"},N.toSJIS=function(_){return M(_)}},1604:(bt,N)=>{N.isValid=function(E){return!isNaN(E)&&E>=1&&E<=40}},8925:(bt,N,M)=>{const E=M(2656),y=M(2296),_=M(139),A=M(838),m=M(1604),I=E.getBCHDigit(7973);function j(K,nt){return A.getCharCountIndicator(K,nt)+4}function tt(K,nt){let L=0;return K.forEach(function(O){const dt=j(O.mode,nt);L+=dt+O.getBitsLength()}),L}N.from=function(nt,L){return m.isValid(nt)?parseInt(nt,10):L},N.getCapacity=function(nt,L,O){if(!m.isValid(nt))throw new Error("Invalid QR Code version");typeof O>"u"&&(O=A.BYTE);const V=8*(E.getSymbolTotalCodewords(nt)-y.getTotalCodewordsCount(nt,L));if(O===A.MIXED)return V;const i=V-j(O,nt);switch(O){case A.NUMERIC:return Math.floor(i/10*3);case A.ALPHANUMERIC:return Math.floor(i/11*2);case A.KANJI:return Math.floor(i/13);default:return Math.floor(i/8)}},N.getBestVersionForData=function(nt,L){let O;const dt=_.from(L,_.M);if(Array.isArray(nt)){if(nt.length>1)return function at(K,nt){for(let L=1;L<=40;L++)if(tt(K,L)<=N.getCapacity(L,nt,A.MIXED))return L}(nt,dt);if(0===nt.length)return 1;O=nt[0]}else O=nt;return function B(K,nt,L){for(let O=1;O<=40;O++)if(nt<=N.getCapacity(O,L,K))return O}(O.mode,O.getLength(),dt)},N.getEncodedBits=function(nt){if(!m.isValid(nt)||nt<7)throw new Error("Invalid QR Code version");let L=nt<<12;for(;E.getBCHDigit(L)-I>=0;)L^=7973<{const E=M(8428);N.render=function(m,C,I){let B=I,j=C;typeof B>"u"&&(!C||!C.getContext)&&(B=C,C=void 0),C||(j=function _(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}()),B=E.getOptions(B);const tt=E.getImageWidth(m.modules.size,B),at=j.getContext("2d"),K=at.createImageData(tt,tt);return E.qrToImageData(K.data,m,B),function y(A,m,C){A.clearRect(0,0,m.width,m.height),m.style||(m.style={}),m.height=C,m.width=C,m.style.height=C+"px",m.style.width=C+"px"}(at,j,tt),at.putImageData(K,0,0),j},N.renderToDataURL=function(m,C,I){let B=I;return typeof B>"u"&&(!C||!C.getContext)&&(B=C,C=void 0),B||(B={}),N.render(m,C,B).toDataURL(B.type||"image/png",(B.rendererOpts||{}).quality)}},5510:(bt,N,M)=>{const E=M(8428);function y(m,C){const I=m.a/255,B=C+'="'+m.hex+'"';return I<1?B+" "+C+'-opacity="'+I.toFixed(2).slice(1)+'"':B}function _(m,C,I){let B=m+C;return typeof I<"u"&&(B+=" "+I),B}N.render=function(C,I,B){const j=E.getOptions(I),tt=C.modules.size,at=C.modules.data,K=tt+2*j.margin,nt=j.color.light.a?"':"",L="0&&nt>0&&m[K-1]||(B+=tt?_("M",nt+I,.5+L+I):_("m",j,0),j=0,tt=!1),nt+1',G=''+nt+L+"\n";return"function"==typeof B&&B(null,G),G}},8428:(bt,N)=>{function M(E){if("number"==typeof E&&(E=E.toString()),"string"!=typeof E)throw new Error("Color should be defined as hex string");let y=E.slice().replace("#","").split("");if(y.length<3||5===y.length||y.length>8)throw new Error("Invalid hex color: "+E);(3===y.length||4===y.length)&&(y=Array.prototype.concat.apply([],y.map(function(A){return[A,A]}))),6===y.length&&y.push("F","F");const _=parseInt(y.join(""),16);return{r:_>>24&255,g:_>>16&255,b:_>>8&255,a:255&_,hex:"#"+y.slice(0,6).join("")}}N.getOptions=function(y){y||(y={}),y.color||(y.color={});const A=y.width&&y.width>=21?y.width:void 0;return{width:A,scale:A?4:y.scale||4,margin:typeof y.margin>"u"||null===y.margin||y.margin<0?4:y.margin,color:{dark:M(y.color.dark||"#000000ff"),light:M(y.color.light||"#ffffffff")},type:y.type,rendererOpts:y.rendererOpts||{}}},N.getScale=function(y,_){return _.width&&_.width>=y+2*_.margin?_.width/(y+2*_.margin):_.scale},N.getImageWidth=function(y,_){const A=N.getScale(y,_);return Math.floor((y+2*_.margin)*A)},N.qrToImageData=function(y,_,A){const m=_.modules.size,C=_.modules.data,I=N.getScale(m,A),B=Math.floor((m+2*A.margin)*I),j=A.margin*I,tt=[A.color.light,A.color.dark];for(let at=0;at=j&&K>=j&&at=65&&l<=70?l-55:l>=97&&l<=102?l-87:l-48&15}function B(p,s,l){var h=I(p,l);return l-1>=s&&(h|=I(p,l-1)<<4),h}function j(p,s,l,h){for(var d=0,v=Math.min(p.length,l),k=s;k=49?R-49+10:R>=17?R-17+10:R}return d}m.isBN=function(s){return s instanceof m||null!==s&&"object"==typeof s&&s.constructor.wordSize===m.wordSize&&Array.isArray(s.words)},m.max=function(s,l){return s.cmp(l)>0?s:l},m.min=function(s,l){return s.cmp(l)<0?s:l},m.prototype._init=function(s,l,h){if("number"==typeof s)return this._initNumber(s,l,h);if("object"==typeof s)return this._initArray(s,l,h);"hex"===l&&(l=16),_(l===(0|l)&&l>=2&&l<=36);var d=0;"-"===(s=s.toString().replace(/\s+/g,""))[0]&&(d++,this.negative=1),d=0;d-=3)this.words[v]|=(k=s[d]|s[d-1]<<8|s[d-2]<<16)<>>26-R&67108863,(R+=24)>=26&&(R-=26,v++);else if("le"===h)for(d=0,v=0;d>>26-R&67108863,(R+=24)>=26&&(R-=26,v++);return this.strip()},m.prototype._parseHex=function(s,l,h){this.length=Math.ceil((s.length-l)/6),this.words=new Array(this.length);for(var d=0;d=l;d-=2)R=B(s,l,d)<=18?(v-=18,this.words[k+=1]|=R>>>26):v+=8;else for(d=(s.length-l)%2==0?l+1:l;d=18?(v-=18,this.words[k+=1]|=R>>>26):v+=8;this.strip()},m.prototype._parseBase=function(s,l,h){this.words=[0],this.length=1;for(var d=0,v=1;v<=67108863;v*=l)d++;d--,v=v/l|0;for(var k=s.length-h,R=k%d,w=Math.min(k,k-R)+h,c=0,x=h;x1&&0===this.words[this.length-1];)this.length--;return this._normSign()},m.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},m.prototype.inspect=function(){return(this.red?""};var tt=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],at=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],K=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function L(p,s,l){l.negative=s.negative^p.negative;var h=p.length+s.length|0;l.length=h,h=h-1|0;var d=0|p.words[0],v=0|s.words[0],k=d*v,w=k/67108864|0;l.words[0]=67108863&k;for(var c=1;c>>26,ft=67108863&w,mt=Math.min(c,s.length-1),gt=Math.max(0,c-p.length+1);gt<=mt;gt++)x+=(k=(d=0|p.words[c-gt|0])*(v=0|s.words[gt])+ft)/67108864|0,ft=67108863&k;l.words[c]=0|ft,w=0|x}return 0!==w?l.words[c]=0|w:l.length--,l.strip()}m.prototype.toString=function(s,l){var h;if(l=0|l||1,16===(s=s||10)||"hex"===s){h="";for(var d=0,v=0,k=0;k>>24-d&16777215)||k!==this.length-1?tt[6-w.length]+w+h:w+h,(d+=2)>=26&&(d-=26,k--)}for(0!==v&&(h=v.toString(16)+h);h.length%l!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}if(s===(0|s)&&s>=2&&s<=36){var c=at[s],x=K[s];h="";var ft=this.clone();for(ft.negative=0;!ft.isZero();){var mt=ft.modn(x).toString(s);h=(ft=ft.idivn(x)).isZero()?mt+h:tt[c-mt.length]+mt+h}for(this.isZero()&&(h="0"+h);h.length%l!=0;)h="0"+h;return 0!==this.negative&&(h="-"+h),h}_(!1,"Base should be between 2 and 36")},m.prototype.toNumber=function(){var s=this.words[0];return 2===this.length?s+=67108864*this.words[1]:3===this.length&&1===this.words[2]?s+=4503599627370496+67108864*this.words[1]:this.length>2&&_(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-s:s},m.prototype.toJSON=function(){return this.toString(16)},m.prototype.toBuffer=function(s,l){return _(typeof C<"u"),this.toArrayLike(C,s,l)},m.prototype.toArray=function(s,l){return this.toArrayLike(Array,s,l)},m.prototype.toArrayLike=function(s,l,h){var d=this.byteLength(),v=h||Math.max(1,d);_(d<=v,"byte array longer than desired length"),_(v>0,"Requested array length <= 0"),this.strip();var w,c,k="le"===l,R=new s(v),x=this.clone();if(k){for(c=0;!x.isZero();c++)w=x.andln(255),x.iushrn(8),R[c]=w;for(;c=4096&&(h+=13,l>>>=13),l>=64&&(h+=7,l>>>=7),l>=8&&(h+=4,l>>>=4),l>=2&&(h+=2,l>>>=2),h+l},m.prototype._zeroBits=function(s){if(0===s)return 26;var l=s,h=0;return 8191&l||(h+=13,l>>>=13),127&l||(h+=7,l>>>=7),15&l||(h+=4,l>>>=4),3&l||(h+=2,l>>>=2),1&l||h++,h},m.prototype.bitLength=function(){var l=this._countBits(this.words[this.length-1]);return 26*(this.length-1)+l},m.prototype.zeroBits=function(){if(this.isZero())return 0;for(var s=0,l=0;ls.length?this.clone().ior(s):s.clone().ior(this)},m.prototype.uor=function(s){return this.length>s.length?this.clone().iuor(s):s.clone().iuor(this)},m.prototype.iuand=function(s){var l;l=this.length>s.length?s:this;for(var h=0;hs.length?this.clone().iand(s):s.clone().iand(this)},m.prototype.uand=function(s){return this.length>s.length?this.clone().iuand(s):s.clone().iuand(this)},m.prototype.iuxor=function(s){var l,h;this.length>s.length?(l=this,h=s):(l=s,h=this);for(var d=0;ds.length?this.clone().ixor(s):s.clone().ixor(this)},m.prototype.uxor=function(s){return this.length>s.length?this.clone().iuxor(s):s.clone().iuxor(this)},m.prototype.inotn=function(s){_("number"==typeof s&&s>=0);var l=0|Math.ceil(s/26),h=s%26;this._expand(l),h>0&&l--;for(var d=0;d0&&(this.words[d]=~this.words[d]&67108863>>26-h),this.strip()},m.prototype.notn=function(s){return this.clone().inotn(s)},m.prototype.setn=function(s,l){_("number"==typeof s&&s>=0);var h=s/26|0,d=s%26;return this._expand(h+1),this.words[h]=l?this.words[h]|1<s.length?(h=this,d=s):(h=s,d=this);for(var v=0,k=0;k>>26;for(;0!==v&&k>>26;if(this.length=h.length,0!==v)this.words[this.length]=v,this.length++;else if(h!==this)for(;ks.length?this.clone().iadd(s):s.clone().iadd(this)},m.prototype.isub=function(s){if(0!==s.negative){s.negative=0;var l=this.iadd(s);return s.negative=1,l._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(s),this.negative=1,this._normSign();var d,v,h=this.cmp(s);if(0===h)return this.negative=0,this.length=1,this.words[0]=0,this;h>0?(d=this,v=s):(d=s,v=this);for(var k=0,R=0;R>26,this.words[R]=67108863&l;for(;0!==k&&R>26,this.words[R]=67108863&l;if(0===k&&R>>13,xt=0|d[1],Mt=8191&xt,St=xt>>>13,Ut=0|d[2],Ct=8191&Ut,Tt=Ut>>>13,Ye=0|d[3],Yt=8191&Ye,Kt=Ye>>>13,Yn=0|d[4],Ft=8191&Yn,zt=Yn>>>13,Kn=0|d[5],Zt=8191&Kn,qt=Kn>>>13,Zn=0|d[6],Ht=8191&Zn,Xt=Zn>>>13,Sn=0|d[7],Jt=8191&Sn,Qt=Sn>>>13,Xn=0|d[8],te=8191&Xn,ee=Xn>>>13,Ar=0|d[9],pe=8191&Ar,ve=Ar>>>13,Tr=0|v[0],ne=8191&Tr,re=Tr>>>13,Jn=0|v[1],ie=8191&Jn,$t=Jn>>>13,Qn=0|v[2],oe=8191&Qn,se=Qn>>>13,Cn=0|v[3],Lt=8191&Cn,jt=Cn>>>13,rn=0|v[4],ae=8191&rn,Dt=rn>>>13,hn=0|v[5],Vt=8191&hn,Gt=hn>>>13,An=0|v[6],Wt=8191&An,le=An>>>13,tr=0|v[7],ce=8191&tr,ue=tr>>>13,er=0|v[8],fe=8191&er,he=er>>>13,nr=0|v[9],de=8191&nr,me=nr>>>13;h.negative=s.negative^l.negative,h.length=19;var Ce=(R+(w=Math.imul(mt,ne))|0)+((8191&(c=(c=Math.imul(mt,re))+Math.imul(gt,ne)|0))<<13)|0;R=((x=Math.imul(gt,re))+(c>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,w=Math.imul(Mt,ne),c=(c=Math.imul(Mt,re))+Math.imul(St,ne)|0,x=Math.imul(St,re);var dn=(R+(w=w+Math.imul(mt,ie)|0)|0)+((8191&(c=(c=c+Math.imul(mt,$t)|0)+Math.imul(gt,ie)|0))<<13)|0;R=((x=x+Math.imul(gt,$t)|0)+(c>>>13)|0)+(dn>>>26)|0,dn&=67108863,w=Math.imul(Ct,ne),c=(c=Math.imul(Ct,re))+Math.imul(Tt,ne)|0,x=Math.imul(Tt,re),w=w+Math.imul(Mt,ie)|0,c=(c=c+Math.imul(Mt,$t)|0)+Math.imul(St,ie)|0,x=x+Math.imul(St,$t)|0;var mn=(R+(w=w+Math.imul(mt,oe)|0)|0)+((8191&(c=(c=c+Math.imul(mt,se)|0)+Math.imul(gt,oe)|0))<<13)|0;R=((x=x+Math.imul(gt,se)|0)+(c>>>13)|0)+(mn>>>26)|0,mn&=67108863,w=Math.imul(Yt,ne),c=(c=Math.imul(Yt,re))+Math.imul(Kt,ne)|0,x=Math.imul(Kt,re),w=w+Math.imul(Ct,ie)|0,c=(c=c+Math.imul(Ct,$t)|0)+Math.imul(Tt,ie)|0,x=x+Math.imul(Tt,$t)|0,w=w+Math.imul(Mt,oe)|0,c=(c=c+Math.imul(Mt,se)|0)+Math.imul(St,oe)|0,x=x+Math.imul(St,se)|0;var Tn=(R+(w=w+Math.imul(mt,Lt)|0)|0)+((8191&(c=(c=c+Math.imul(mt,jt)|0)+Math.imul(gt,Lt)|0))<<13)|0;R=((x=x+Math.imul(gt,jt)|0)+(c>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,w=Math.imul(Ft,ne),c=(c=Math.imul(Ft,re))+Math.imul(zt,ne)|0,x=Math.imul(zt,re),w=w+Math.imul(Yt,ie)|0,c=(c=c+Math.imul(Yt,$t)|0)+Math.imul(Kt,ie)|0,x=x+Math.imul(Kt,$t)|0,w=w+Math.imul(Ct,oe)|0,c=(c=c+Math.imul(Ct,se)|0)+Math.imul(Tt,oe)|0,x=x+Math.imul(Tt,se)|0,w=w+Math.imul(Mt,Lt)|0,c=(c=c+Math.imul(Mt,jt)|0)+Math.imul(St,Lt)|0,x=x+Math.imul(St,jt)|0;var Rn=(R+(w=w+Math.imul(mt,ae)|0)|0)+((8191&(c=(c=c+Math.imul(mt,Dt)|0)+Math.imul(gt,ae)|0))<<13)|0;R=((x=x+Math.imul(gt,Dt)|0)+(c>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,w=Math.imul(Zt,ne),c=(c=Math.imul(Zt,re))+Math.imul(qt,ne)|0,x=Math.imul(qt,re),w=w+Math.imul(Ft,ie)|0,c=(c=c+Math.imul(Ft,$t)|0)+Math.imul(zt,ie)|0,x=x+Math.imul(zt,$t)|0,w=w+Math.imul(Yt,oe)|0,c=(c=c+Math.imul(Yt,se)|0)+Math.imul(Kt,oe)|0,x=x+Math.imul(Kt,se)|0,w=w+Math.imul(Ct,Lt)|0,c=(c=c+Math.imul(Ct,jt)|0)+Math.imul(Tt,Lt)|0,x=x+Math.imul(Tt,jt)|0,w=w+Math.imul(Mt,ae)|0,c=(c=c+Math.imul(Mt,Dt)|0)+Math.imul(St,ae)|0,x=x+Math.imul(St,Dt)|0;var gn=(R+(w=w+Math.imul(mt,Vt)|0)|0)+((8191&(c=(c=c+Math.imul(mt,Gt)|0)+Math.imul(gt,Vt)|0))<<13)|0;R=((x=x+Math.imul(gt,Gt)|0)+(c>>>13)|0)+(gn>>>26)|0,gn&=67108863,w=Math.imul(Ht,ne),c=(c=Math.imul(Ht,re))+Math.imul(Xt,ne)|0,x=Math.imul(Xt,re),w=w+Math.imul(Zt,ie)|0,c=(c=c+Math.imul(Zt,$t)|0)+Math.imul(qt,ie)|0,x=x+Math.imul(qt,$t)|0,w=w+Math.imul(Ft,oe)|0,c=(c=c+Math.imul(Ft,se)|0)+Math.imul(zt,oe)|0,x=x+Math.imul(zt,se)|0,w=w+Math.imul(Yt,Lt)|0,c=(c=c+Math.imul(Yt,jt)|0)+Math.imul(Kt,Lt)|0,x=x+Math.imul(Kt,jt)|0,w=w+Math.imul(Ct,ae)|0,c=(c=c+Math.imul(Ct,Dt)|0)+Math.imul(Tt,ae)|0,x=x+Math.imul(Tt,Dt)|0,w=w+Math.imul(Mt,Vt)|0,c=(c=c+Math.imul(Mt,Gt)|0)+Math.imul(St,Vt)|0,x=x+Math.imul(St,Gt)|0;var In=(R+(w=w+Math.imul(mt,Wt)|0)|0)+((8191&(c=(c=c+Math.imul(mt,le)|0)+Math.imul(gt,Wt)|0))<<13)|0;R=((x=x+Math.imul(gt,le)|0)+(c>>>13)|0)+(In>>>26)|0,In&=67108863,w=Math.imul(Jt,ne),c=(c=Math.imul(Jt,re))+Math.imul(Qt,ne)|0,x=Math.imul(Qt,re),w=w+Math.imul(Ht,ie)|0,c=(c=c+Math.imul(Ht,$t)|0)+Math.imul(Xt,ie)|0,x=x+Math.imul(Xt,$t)|0,w=w+Math.imul(Zt,oe)|0,c=(c=c+Math.imul(Zt,se)|0)+Math.imul(qt,oe)|0,x=x+Math.imul(qt,se)|0,w=w+Math.imul(Ft,Lt)|0,c=(c=c+Math.imul(Ft,jt)|0)+Math.imul(zt,Lt)|0,x=x+Math.imul(zt,jt)|0,w=w+Math.imul(Yt,ae)|0,c=(c=c+Math.imul(Yt,Dt)|0)+Math.imul(Kt,ae)|0,x=x+Math.imul(Kt,Dt)|0,w=w+Math.imul(Ct,Vt)|0,c=(c=c+Math.imul(Ct,Gt)|0)+Math.imul(Tt,Vt)|0,x=x+Math.imul(Tt,Gt)|0,w=w+Math.imul(Mt,Wt)|0,c=(c=c+Math.imul(Mt,le)|0)+Math.imul(St,Wt)|0,x=x+Math.imul(St,le)|0;var Bn=(R+(w=w+Math.imul(mt,ce)|0)|0)+((8191&(c=(c=c+Math.imul(mt,ue)|0)+Math.imul(gt,ce)|0))<<13)|0;R=((x=x+Math.imul(gt,ue)|0)+(c>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,w=Math.imul(te,ne),c=(c=Math.imul(te,re))+Math.imul(ee,ne)|0,x=Math.imul(ee,re),w=w+Math.imul(Jt,ie)|0,c=(c=c+Math.imul(Jt,$t)|0)+Math.imul(Qt,ie)|0,x=x+Math.imul(Qt,$t)|0,w=w+Math.imul(Ht,oe)|0,c=(c=c+Math.imul(Ht,se)|0)+Math.imul(Xt,oe)|0,x=x+Math.imul(Xt,se)|0,w=w+Math.imul(Zt,Lt)|0,c=(c=c+Math.imul(Zt,jt)|0)+Math.imul(qt,Lt)|0,x=x+Math.imul(qt,jt)|0,w=w+Math.imul(Ft,ae)|0,c=(c=c+Math.imul(Ft,Dt)|0)+Math.imul(zt,ae)|0,x=x+Math.imul(zt,Dt)|0,w=w+Math.imul(Yt,Vt)|0,c=(c=c+Math.imul(Yt,Gt)|0)+Math.imul(Kt,Vt)|0,x=x+Math.imul(Kt,Gt)|0,w=w+Math.imul(Ct,Wt)|0,c=(c=c+Math.imul(Ct,le)|0)+Math.imul(Tt,Wt)|0,x=x+Math.imul(Tt,le)|0,w=w+Math.imul(Mt,ce)|0,c=(c=c+Math.imul(Mt,ue)|0)+Math.imul(St,ce)|0,x=x+Math.imul(St,ue)|0;var qe=(R+(w=w+Math.imul(mt,fe)|0)|0)+((8191&(c=(c=c+Math.imul(mt,he)|0)+Math.imul(gt,fe)|0))<<13)|0;R=((x=x+Math.imul(gt,he)|0)+(c>>>13)|0)+(qe>>>26)|0,qe&=67108863,w=Math.imul(pe,ne),c=(c=Math.imul(pe,re))+Math.imul(ve,ne)|0,x=Math.imul(ve,re),w=w+Math.imul(te,ie)|0,c=(c=c+Math.imul(te,$t)|0)+Math.imul(ee,ie)|0,x=x+Math.imul(ee,$t)|0,w=w+Math.imul(Jt,oe)|0,c=(c=c+Math.imul(Jt,se)|0)+Math.imul(Qt,oe)|0,x=x+Math.imul(Qt,se)|0,w=w+Math.imul(Ht,Lt)|0,c=(c=c+Math.imul(Ht,jt)|0)+Math.imul(Xt,Lt)|0,x=x+Math.imul(Xt,jt)|0,w=w+Math.imul(Zt,ae)|0,c=(c=c+Math.imul(Zt,Dt)|0)+Math.imul(qt,ae)|0,x=x+Math.imul(qt,Dt)|0,w=w+Math.imul(Ft,Vt)|0,c=(c=c+Math.imul(Ft,Gt)|0)+Math.imul(zt,Vt)|0,x=x+Math.imul(zt,Gt)|0,w=w+Math.imul(Yt,Wt)|0,c=(c=c+Math.imul(Yt,le)|0)+Math.imul(Kt,Wt)|0,x=x+Math.imul(Kt,le)|0,w=w+Math.imul(Ct,ce)|0,c=(c=c+Math.imul(Ct,ue)|0)+Math.imul(Tt,ce)|0,x=x+Math.imul(Tt,ue)|0,w=w+Math.imul(Mt,fe)|0,c=(c=c+Math.imul(Mt,he)|0)+Math.imul(St,fe)|0,x=x+Math.imul(St,he)|0;var on=(R+(w=w+Math.imul(mt,de)|0)|0)+((8191&(c=(c=c+Math.imul(mt,me)|0)+Math.imul(gt,de)|0))<<13)|0;R=((x=x+Math.imul(gt,me)|0)+(c>>>13)|0)+(on>>>26)|0,on&=67108863,w=Math.imul(pe,ie),c=(c=Math.imul(pe,$t))+Math.imul(ve,ie)|0,x=Math.imul(ve,$t),w=w+Math.imul(te,oe)|0,c=(c=c+Math.imul(te,se)|0)+Math.imul(ee,oe)|0,x=x+Math.imul(ee,se)|0,w=w+Math.imul(Jt,Lt)|0,c=(c=c+Math.imul(Jt,jt)|0)+Math.imul(Qt,Lt)|0,x=x+Math.imul(Qt,jt)|0,w=w+Math.imul(Ht,ae)|0,c=(c=c+Math.imul(Ht,Dt)|0)+Math.imul(Xt,ae)|0,x=x+Math.imul(Xt,Dt)|0,w=w+Math.imul(Zt,Vt)|0,c=(c=c+Math.imul(Zt,Gt)|0)+Math.imul(qt,Vt)|0,x=x+Math.imul(qt,Gt)|0,w=w+Math.imul(Ft,Wt)|0,c=(c=c+Math.imul(Ft,le)|0)+Math.imul(zt,Wt)|0,x=x+Math.imul(zt,le)|0,w=w+Math.imul(Yt,ce)|0,c=(c=c+Math.imul(Yt,ue)|0)+Math.imul(Kt,ce)|0,x=x+Math.imul(Kt,ue)|0,w=w+Math.imul(Ct,fe)|0,c=(c=c+Math.imul(Ct,he)|0)+Math.imul(Tt,fe)|0,x=x+Math.imul(Tt,he)|0;var Nn=(R+(w=w+Math.imul(Mt,de)|0)|0)+((8191&(c=(c=c+Math.imul(Mt,me)|0)+Math.imul(St,de)|0))<<13)|0;R=((x=x+Math.imul(St,me)|0)+(c>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,w=Math.imul(pe,oe),c=(c=Math.imul(pe,se))+Math.imul(ve,oe)|0,x=Math.imul(ve,se),w=w+Math.imul(te,Lt)|0,c=(c=c+Math.imul(te,jt)|0)+Math.imul(ee,Lt)|0,x=x+Math.imul(ee,jt)|0,w=w+Math.imul(Jt,ae)|0,c=(c=c+Math.imul(Jt,Dt)|0)+Math.imul(Qt,ae)|0,x=x+Math.imul(Qt,Dt)|0,w=w+Math.imul(Ht,Vt)|0,c=(c=c+Math.imul(Ht,Gt)|0)+Math.imul(Xt,Vt)|0,x=x+Math.imul(Xt,Gt)|0,w=w+Math.imul(Zt,Wt)|0,c=(c=c+Math.imul(Zt,le)|0)+Math.imul(qt,Wt)|0,x=x+Math.imul(qt,le)|0,w=w+Math.imul(Ft,ce)|0,c=(c=c+Math.imul(Ft,ue)|0)+Math.imul(zt,ce)|0,x=x+Math.imul(zt,ue)|0,w=w+Math.imul(Yt,fe)|0,c=(c=c+Math.imul(Yt,he)|0)+Math.imul(Kt,fe)|0,x=x+Math.imul(Kt,he)|0;var pn=(R+(w=w+Math.imul(Ct,de)|0)|0)+((8191&(c=(c=c+Math.imul(Ct,me)|0)+Math.imul(Tt,de)|0))<<13)|0;R=((x=x+Math.imul(Tt,me)|0)+(c>>>13)|0)+(pn>>>26)|0,pn&=67108863,w=Math.imul(pe,Lt),c=(c=Math.imul(pe,jt))+Math.imul(ve,Lt)|0,x=Math.imul(ve,jt),w=w+Math.imul(te,ae)|0,c=(c=c+Math.imul(te,Dt)|0)+Math.imul(ee,ae)|0,x=x+Math.imul(ee,Dt)|0,w=w+Math.imul(Jt,Vt)|0,c=(c=c+Math.imul(Jt,Gt)|0)+Math.imul(Qt,Vt)|0,x=x+Math.imul(Qt,Gt)|0,w=w+Math.imul(Ht,Wt)|0,c=(c=c+Math.imul(Ht,le)|0)+Math.imul(Xt,Wt)|0,x=x+Math.imul(Xt,le)|0,w=w+Math.imul(Zt,ce)|0,c=(c=c+Math.imul(Zt,ue)|0)+Math.imul(qt,ce)|0,x=x+Math.imul(qt,ue)|0,w=w+Math.imul(Ft,fe)|0,c=(c=c+Math.imul(Ft,he)|0)+Math.imul(zt,fe)|0,x=x+Math.imul(zt,he)|0;var Pn=(R+(w=w+Math.imul(Yt,de)|0)|0)+((8191&(c=(c=c+Math.imul(Yt,me)|0)+Math.imul(Kt,de)|0))<<13)|0;R=((x=x+Math.imul(Kt,me)|0)+(c>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,w=Math.imul(pe,ae),c=(c=Math.imul(pe,Dt))+Math.imul(ve,ae)|0,x=Math.imul(ve,Dt),w=w+Math.imul(te,Vt)|0,c=(c=c+Math.imul(te,Gt)|0)+Math.imul(ee,Vt)|0,x=x+Math.imul(ee,Gt)|0,w=w+Math.imul(Jt,Wt)|0,c=(c=c+Math.imul(Jt,le)|0)+Math.imul(Qt,Wt)|0,x=x+Math.imul(Qt,le)|0,w=w+Math.imul(Ht,ce)|0,c=(c=c+Math.imul(Ht,ue)|0)+Math.imul(Xt,ce)|0,x=x+Math.imul(Xt,ue)|0,w=w+Math.imul(Zt,fe)|0,c=(c=c+Math.imul(Zt,he)|0)+Math.imul(qt,fe)|0,x=x+Math.imul(qt,he)|0;var Ln=(R+(w=w+Math.imul(Ft,de)|0)|0)+((8191&(c=(c=c+Math.imul(Ft,me)|0)+Math.imul(zt,de)|0))<<13)|0;R=((x=x+Math.imul(zt,me)|0)+(c>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,w=Math.imul(pe,Vt),c=(c=Math.imul(pe,Gt))+Math.imul(ve,Vt)|0,x=Math.imul(ve,Gt),w=w+Math.imul(te,Wt)|0,c=(c=c+Math.imul(te,le)|0)+Math.imul(ee,Wt)|0,x=x+Math.imul(ee,le)|0,w=w+Math.imul(Jt,ce)|0,c=(c=c+Math.imul(Jt,ue)|0)+Math.imul(Qt,ce)|0,x=x+Math.imul(Qt,ue)|0,w=w+Math.imul(Ht,fe)|0,c=(c=c+Math.imul(Ht,he)|0)+Math.imul(Xt,fe)|0,x=x+Math.imul(Xt,he)|0;var Un=(R+(w=w+Math.imul(Zt,de)|0)|0)+((8191&(c=(c=c+Math.imul(Zt,me)|0)+Math.imul(qt,de)|0))<<13)|0;R=((x=x+Math.imul(qt,me)|0)+(c>>>13)|0)+(Un>>>26)|0,Un&=67108863,w=Math.imul(pe,Wt),c=(c=Math.imul(pe,le))+Math.imul(ve,Wt)|0,x=Math.imul(ve,le),w=w+Math.imul(te,ce)|0,c=(c=c+Math.imul(te,ue)|0)+Math.imul(ee,ce)|0,x=x+Math.imul(ee,ue)|0,w=w+Math.imul(Jt,fe)|0,c=(c=c+Math.imul(Jt,he)|0)+Math.imul(Qt,fe)|0,x=x+Math.imul(Qt,he)|0;var rr=(R+(w=w+Math.imul(Ht,de)|0)|0)+((8191&(c=(c=c+Math.imul(Ht,me)|0)+Math.imul(Xt,de)|0))<<13)|0;R=((x=x+Math.imul(Xt,me)|0)+(c>>>13)|0)+(rr>>>26)|0,rr&=67108863,w=Math.imul(pe,ce),c=(c=Math.imul(pe,ue))+Math.imul(ve,ce)|0,x=Math.imul(ve,ue),w=w+Math.imul(te,fe)|0,c=(c=c+Math.imul(te,he)|0)+Math.imul(ee,fe)|0,x=x+Math.imul(ee,he)|0;var Ae=(R+(w=w+Math.imul(Jt,de)|0)|0)+((8191&(c=(c=c+Math.imul(Jt,me)|0)+Math.imul(Qt,de)|0))<<13)|0;R=((x=x+Math.imul(Qt,me)|0)+(c>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,w=Math.imul(pe,fe),c=(c=Math.imul(pe,he))+Math.imul(ve,fe)|0,x=Math.imul(ve,he);var sn=(R+(w=w+Math.imul(te,de)|0)|0)+((8191&(c=(c=c+Math.imul(te,me)|0)+Math.imul(ee,de)|0))<<13)|0;R=((x=x+Math.imul(ee,me)|0)+(c>>>13)|0)+(sn>>>26)|0,sn&=67108863;var an=(R+(w=Math.imul(pe,de))|0)+((8191&(c=(c=Math.imul(pe,me))+Math.imul(ve,de)|0))<<13)|0;return R=((x=Math.imul(ve,me))+(c>>>13)|0)+(an>>>26)|0,an&=67108863,k[0]=Ce,k[1]=dn,k[2]=mn,k[3]=Tn,k[4]=Rn,k[5]=gn,k[6]=In,k[7]=Bn,k[8]=qe,k[9]=on,k[10]=Nn,k[11]=pn,k[12]=Pn,k[13]=Ln,k[14]=Un,k[15]=rr,k[16]=Ae,k[17]=sn,k[18]=an,0!==R&&(k[19]=R,h.length++),h};function G(p,s,l){return(new V).mulp(p,s,l)}function V(p,s){this.x=p,this.y=s}Math.imul||(O=L),m.prototype.mulTo=function(s,l){var h,d=this.length+s.length;return h=10===this.length&&10===s.length?O(this,s,l):d<63?L(this,s,l):d<1024?function dt(p,s,l){l.negative=s.negative^p.negative,l.length=p.length+s.length;for(var h=0,d=0,v=0;v>>26)|0)>>>26,k&=67108863}l.words[v]=R,h=k,k=d}return 0!==h?l.words[v]=h:l.length--,l.strip()}(this,s,l):G(this,s,l),h},V.prototype.makeRBT=function(s){for(var l=new Array(s),h=m.prototype._countBits(s)-1,d=0;d>=1;return d},V.prototype.permute=function(s,l,h,d,v,k){for(var R=0;R>>=1)v++;return 1<>>=13),v>>>=13;for(k=2*l;k>=26,l+=d/67108864|0,l+=v>>>26,this.words[h]=67108863&v}return 0!==l&&(this.words[h]=l,this.length++),this},m.prototype.muln=function(s){return this.clone().imuln(s)},m.prototype.sqr=function(){return this.mul(this)},m.prototype.isqr=function(){return this.imul(this.clone())},m.prototype.pow=function(s){var l=function nt(p){for(var s=new Array(p.bitLength()),l=0;l>>d}return s}(s);if(0===l.length)return new m(1);for(var h=this,d=0;d=0);var v,l=s%26,h=(s-l)/26,d=67108863>>>26-l<<26-l;if(0!==l){var k=0;for(v=0;v>>26-l}k&&(this.words[v]=k,this.length++)}if(0!==h){for(v=this.length-1;v>=0;v--)this.words[v+h]=this.words[v];for(v=0;v=0),d=l?(l-l%26)/26:0;var v=s%26,k=Math.min((s-v)/26,this.length),R=67108863^67108863>>>v<k)for(this.length-=k,c=0;c=0&&(0!==x||c>=d);c--){var ft=0|this.words[c];this.words[c]=x<<26-v|ft>>>v,x=ft&R}return w&&0!==x&&(w.words[w.length++]=x),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},m.prototype.ishrn=function(s,l,h){return _(0===this.negative),this.iushrn(s,l,h)},m.prototype.shln=function(s){return this.clone().ishln(s)},m.prototype.ushln=function(s){return this.clone().iushln(s)},m.prototype.shrn=function(s){return this.clone().ishrn(s)},m.prototype.ushrn=function(s){return this.clone().iushrn(s)},m.prototype.testn=function(s){_("number"==typeof s&&s>=0);var l=s%26,h=(s-l)/26;return!(this.length<=h||!(this.words[h]&1<=0);var l=s%26,h=(s-l)/26;return _(0===this.negative,"imaskn works only with positive numbers"),this.length<=h?this:(0!==l&&h++,this.length=Math.min(h,this.length),0!==l&&(this.words[this.length-1]&=67108863^67108863>>>l<=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},m.prototype.isubn=function(s){if(_("number"==typeof s),_(s<67108864),s<0)return this.iaddn(-s);if(0!==this.negative)return this.negative=0,this.iaddn(s),this.negative=1,this;if(this.words[0]-=s,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l>26)-(w/67108864|0),this.words[v+h]=67108863&k}for(;v>26,this.words[v+h]=67108863&k;if(0===R)return this.strip();for(_(-1===R),R=0,v=0;v>26,this.words[v]=67108863&k;return this.negative=1,this.strip()},m.prototype._wordDiv=function(s,l){var h,d=this.clone(),v=s,k=0|v.words[v.length-1];0!=(h=26-this._countBits(k))&&(v=v.ushln(h),d.iushln(h),k=0|v.words[v.length-1]);var c,w=d.length-v.length;if("mod"!==l){(c=new m(null)).length=w+1,c.words=new Array(c.length);for(var x=0;x=0;mt--){var gt=67108864*(0|d.words[v.length+mt])+(0|d.words[v.length+mt-1]);for(gt=Math.min(gt/k|0,67108863),d._ishlnsubmul(v,gt,mt);0!==d.negative;)gt--,d.negative=0,d._ishlnsubmul(v,1,mt),d.isZero()||(d.negative^=1);c&&(c.words[mt]=gt)}return c&&c.strip(),d.strip(),"div"!==l&&0!==h&&d.iushrn(h),{div:c||null,mod:d}},m.prototype.divmod=function(s,l,h){return _(!s.isZero()),this.isZero()?{div:new m(0),mod:new m(0)}:0!==this.negative&&0===s.negative?(k=this.neg().divmod(s,l),"mod"!==l&&(d=k.div.neg()),"div"!==l&&(v=k.mod.neg(),h&&0!==v.negative&&v.iadd(s)),{div:d,mod:v}):0===this.negative&&0!==s.negative?(k=this.divmod(s.neg(),l),"mod"!==l&&(d=k.div.neg()),{div:d,mod:k.mod}):this.negative&s.negative?(k=this.neg().divmod(s.neg(),l),"div"!==l&&(v=k.mod.neg(),h&&0!==v.negative&&v.isub(s)),{div:k.div,mod:v}):s.length>this.length||this.cmp(s)<0?{div:new m(0),mod:this}:1===s.length?"div"===l?{div:this.divn(s.words[0]),mod:null}:"mod"===l?{div:null,mod:new m(this.modn(s.words[0]))}:{div:this.divn(s.words[0]),mod:new m(this.modn(s.words[0]))}:this._wordDiv(s,l);var d,v,k},m.prototype.div=function(s){return this.divmod(s,"div",!1).div},m.prototype.mod=function(s){return this.divmod(s,"mod",!1).mod},m.prototype.umod=function(s){return this.divmod(s,"mod",!0).mod},m.prototype.divRound=function(s){var l=this.divmod(s);if(l.mod.isZero())return l.div;var h=0!==l.div.negative?l.mod.isub(s):l.mod,d=s.ushrn(1),v=s.andln(1),k=h.cmp(d);return k<0||1===v&&0===k?l.div:0!==l.div.negative?l.div.isubn(1):l.div.iaddn(1)},m.prototype.modn=function(s){_(s<=67108863);for(var l=(1<<26)%s,h=0,d=this.length-1;d>=0;d--)h=(l*h+(0|this.words[d]))%s;return h},m.prototype.idivn=function(s){_(s<=67108863);for(var l=0,h=this.length-1;h>=0;h--){var d=(0|this.words[h])+67108864*l;this.words[h]=d/s|0,l=d%s}return this.strip()},m.prototype.divn=function(s){return this.clone().idivn(s)},m.prototype.egcd=function(s){_(0===s.negative),_(!s.isZero());var l=this,h=s.clone();l=0!==l.negative?l.umod(s):l.clone();for(var d=new m(1),v=new m(0),k=new m(0),R=new m(1),w=0;l.isEven()&&h.isEven();)l.iushrn(1),h.iushrn(1),++w;for(var c=h.clone(),x=l.clone();!l.isZero();){for(var ft=0,mt=1;!(l.words[0]&mt)&&ft<26;++ft,mt<<=1);if(ft>0)for(l.iushrn(ft);ft-- >0;)(d.isOdd()||v.isOdd())&&(d.iadd(c),v.isub(x)),d.iushrn(1),v.iushrn(1);for(var gt=0,xt=1;!(h.words[0]&xt)&><26;++gt,xt<<=1);if(gt>0)for(h.iushrn(gt);gt-- >0;)(k.isOdd()||R.isOdd())&&(k.iadd(c),R.isub(x)),k.iushrn(1),R.iushrn(1);l.cmp(h)>=0?(l.isub(h),d.isub(k),v.isub(R)):(h.isub(l),k.isub(d),R.isub(v))}return{a:k,b:R,gcd:h.iushln(w)}},m.prototype._invmp=function(s){_(0===s.negative),_(!s.isZero());var ft,l=this,h=s.clone();l=0!==l.negative?l.umod(s):l.clone();for(var d=new m(1),v=new m(0),k=h.clone();l.cmpn(1)>0&&h.cmpn(1)>0;){for(var R=0,w=1;!(l.words[0]&w)&&R<26;++R,w<<=1);if(R>0)for(l.iushrn(R);R-- >0;)d.isOdd()&&d.iadd(k),d.iushrn(1);for(var c=0,x=1;!(h.words[0]&x)&&c<26;++c,x<<=1);if(c>0)for(h.iushrn(c);c-- >0;)v.isOdd()&&v.iadd(k),v.iushrn(1);l.cmp(h)>=0?(l.isub(h),d.isub(v)):(h.isub(l),v.isub(d))}return(ft=0===l.cmpn(1)?d:v).cmpn(0)<0&&ft.iadd(s),ft},m.prototype.gcd=function(s){if(this.isZero())return s.abs();if(s.isZero())return this.abs();var l=this.clone(),h=s.clone();l.negative=0,h.negative=0;for(var d=0;l.isEven()&&h.isEven();d++)l.iushrn(1),h.iushrn(1);for(;;){for(;l.isEven();)l.iushrn(1);for(;h.isEven();)h.iushrn(1);var v=l.cmp(h);if(v<0){var k=l;l=h,h=k}else if(0===v||0===h.cmpn(1))break;l.isub(h)}return h.iushln(d)},m.prototype.invm=function(s){return this.egcd(s).a.umod(s)},m.prototype.isEven=function(){return!(1&this.words[0])},m.prototype.isOdd=function(){return!(1&~this.words[0])},m.prototype.andln=function(s){return this.words[0]&s},m.prototype.bincn=function(s){_("number"==typeof s);var l=s%26,h=(s-l)/26,d=1<>>26,this.words[k]=R&=67108863}return 0!==v&&(this.words[k]=v,this.length++),this},m.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},m.prototype.cmpn=function(s){var h,l=s<0;if(0!==this.negative&&!l)return-1;if(0===this.negative&&l)return 1;if(this.strip(),this.length>1)h=1;else{l&&(s=-s),_(s<=67108863,"Number is too big");var d=0|this.words[0];h=d===s?0:ds.length)return 1;if(this.length=0;h--){var d=0|this.words[h],v=0|s.words[h];if(d!==v){dv&&(l=1);break}}return l},m.prototype.gtn=function(s){return 1===this.cmpn(s)},m.prototype.gt=function(s){return 1===this.cmp(s)},m.prototype.gten=function(s){return this.cmpn(s)>=0},m.prototype.gte=function(s){return this.cmp(s)>=0},m.prototype.ltn=function(s){return-1===this.cmpn(s)},m.prototype.lt=function(s){return-1===this.cmp(s)},m.prototype.lten=function(s){return this.cmpn(s)<=0},m.prototype.lte=function(s){return this.cmp(s)<=0},m.prototype.eqn=function(s){return 0===this.cmpn(s)},m.prototype.eq=function(s){return 0===this.cmp(s)},m.red=function(s){return new lt(s)},m.prototype.toRed=function(s){return _(!this.red,"Already a number in reduction context"),_(0===this.negative,"red works only with positives"),s.convertTo(this)._forceRed(s)},m.prototype.fromRed=function(){return _(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},m.prototype._forceRed=function(s){return this.red=s,this},m.prototype.forceRed=function(s){return _(!this.red,"Already a number in reduction context"),this._forceRed(s)},m.prototype.redAdd=function(s){return _(this.red,"redAdd works only with red numbers"),this.red.add(this,s)},m.prototype.redIAdd=function(s){return _(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,s)},m.prototype.redSub=function(s){return _(this.red,"redSub works only with red numbers"),this.red.sub(this,s)},m.prototype.redISub=function(s){return _(this.red,"redISub works only with red numbers"),this.red.isub(this,s)},m.prototype.redShl=function(s){return _(this.red,"redShl works only with red numbers"),this.red.shl(this,s)},m.prototype.redMul=function(s){return _(this.red,"redMul works only with red numbers"),this.red._verify2(this,s),this.red.mul(this,s)},m.prototype.redIMul=function(s){return _(this.red,"redMul works only with red numbers"),this.red._verify2(this,s),this.red.imul(this,s)},m.prototype.redSqr=function(){return _(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},m.prototype.redISqr=function(){return _(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},m.prototype.redSqrt=function(){return _(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},m.prototype.redInvm=function(){return _(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},m.prototype.redNeg=function(){return _(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},m.prototype.redPow=function(s){return _(this.red&&!s.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,s)};var i={k256:null,p224:null,p192:null,p25519:null};function ut(p,s){this.name=p,this.p=new m(s,16),this.n=this.p.bitLength(),this.k=new m(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function kt(){ut.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function Pt(){ut.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function ot(){ut.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function it(){ut.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function lt(p){if("string"==typeof p){var s=m._prime(p);this.m=s.p,this.prime=s}else _(p.gtn(1),"modulus must be greater than 1"),this.m=p,this.prime=null}function ht(p){lt.call(this,p),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new m(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}ut.prototype._tmp=function(){var s=new m(null);return s.words=new Array(Math.ceil(this.n/13)),s},ut.prototype.ireduce=function(s){var h,l=s;do{this.split(l,this.tmp),h=(l=(l=this.imulK(l)).iadd(this.tmp)).bitLength()}while(h>this.n);var d=h0?l.isub(this.p):void 0!==l.strip?l.strip():l._strip(),l},ut.prototype.split=function(s,l){s.iushrn(this.n,0,l)},ut.prototype.imulK=function(s){return s.imul(this.k)},A(kt,ut),kt.prototype.split=function(s,l){for(var h=4194303,d=Math.min(s.length,9),v=0;v>>22,k=R}s.words[v-10]=k>>>=22,s.length-=0===k&&s.length>10?10:9},kt.prototype.imulK=function(s){s.words[s.length]=0,s.words[s.length+1]=0,s.length+=2;for(var l=0,h=0;h>>=26,s.words[h]=v,l=d}return 0!==l&&(s.words[s.length++]=l),s},m._prime=function(s){if(i[s])return i[s];var l;if("k256"===s)l=new kt;else if("p224"===s)l=new Pt;else if("p192"===s)l=new ot;else{if("p25519"!==s)throw new Error("Unknown prime "+s);l=new it}return i[s]=l,l},lt.prototype._verify1=function(s){_(0===s.negative,"red works only with positives"),_(s.red,"red works only with red numbers")},lt.prototype._verify2=function(s,l){_(!(s.negative|l.negative),"red works only with positives"),_(s.red&&s.red===l.red,"red works only with red numbers")},lt.prototype.imod=function(s){return this.prime?this.prime.ireduce(s)._forceRed(this):s.umod(this.m)._forceRed(this)},lt.prototype.neg=function(s){return s.isZero()?s.clone():this.m.sub(s)._forceRed(this)},lt.prototype.add=function(s,l){this._verify2(s,l);var h=s.add(l);return h.cmp(this.m)>=0&&h.isub(this.m),h._forceRed(this)},lt.prototype.iadd=function(s,l){this._verify2(s,l);var h=s.iadd(l);return h.cmp(this.m)>=0&&h.isub(this.m),h},lt.prototype.sub=function(s,l){this._verify2(s,l);var h=s.sub(l);return h.cmpn(0)<0&&h.iadd(this.m),h._forceRed(this)},lt.prototype.isub=function(s,l){this._verify2(s,l);var h=s.isub(l);return h.cmpn(0)<0&&h.iadd(this.m),h},lt.prototype.shl=function(s,l){return this._verify1(s),this.imod(s.ushln(l))},lt.prototype.imul=function(s,l){return this._verify2(s,l),this.imod(s.imul(l))},lt.prototype.mul=function(s,l){return this._verify2(s,l),this.imod(s.mul(l))},lt.prototype.isqr=function(s){return this.imul(s,s.clone())},lt.prototype.sqr=function(s){return this.mul(s,s)},lt.prototype.sqrt=function(s){if(s.isZero())return s.clone();var l=this.m.andln(3);if(_(l%2==1),3===l){var h=this.m.add(new m(1)).iushrn(2);return this.pow(s,h)}for(var d=this.m.subn(1),v=0;!d.isZero()&&0===d.andln(1);)v++,d.iushrn(1);_(!d.isZero());var k=new m(1).toRed(this),R=k.redNeg(),w=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new m(2*c*c).toRed(this);0!==this.pow(c,w).cmp(R);)c.redIAdd(R);for(var x=this.pow(c,d),ft=this.pow(s,d.addn(1).iushrn(1)),mt=this.pow(s,d),gt=v;0!==mt.cmp(k);){for(var xt=mt,Mt=0;0!==xt.cmp(k);Mt++)xt=xt.redSqr();_(Mt=0;v--){for(var x=l.words[v],ft=c-1;ft>=0;ft--){var mt=x>>ft&1;k!==d[0]&&(k=this.sqr(k)),0!==mt||0!==R?(R<<=1,R|=mt,(4==++w||0===v&&0===ft)&&(k=this.mul(k,d[R]),w=0,R=0)):w=0}c=26}return k},lt.prototype.convertTo=function(s){var l=s.umod(this.m);return l===s?l.clone():l},lt.prototype.convertFrom=function(s){var l=s.clone();return l.red=null,l},m.mont=function(s){return new ht(s)},A(ht,lt),ht.prototype.convertTo=function(s){return this.imod(s.ushln(this.shift))},ht.prototype.convertFrom=function(s){var l=this.imod(s.mul(this.rinv));return l.red=null,l},ht.prototype.imul=function(s,l){if(s.isZero()||l.isZero())return s.words[0]=0,s.length=1,s;var h=s.imul(l),d=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=h.isub(d).iushrn(this.shift),k=v;return v.cmp(this.m)>=0?k=v.isub(this.m):v.cmpn(0)<0&&(k=v.iadd(this.m)),k._forceRed(this)},ht.prototype.mul=function(s,l){if(s.isZero()||l.isZero())return new m(0)._forceRed(this);var h=s.mul(l),d=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=h.isub(d).iushrn(this.shift),k=v;return v.cmp(this.m)>=0?k=v.isub(this.m):v.cmpn(0)<0&&(k=v.iadd(this.m)),k._forceRed(this)},ht.prototype.invm=function(s){return this.imod(s._invmp(this.m).mul(this.r2))._forceRed(this)}}(bt=M.nmd(bt),this)},7374:function(bt){bt.exports=function(){"use strict";var M=6e4,E=36e5,y="millisecond",_="second",A="minute",m="hour",C="day",I="week",B="month",j="quarter",tt="year",at="date",K="Invalid Date",nt=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,L=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,O={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(p){var s=["th","st","nd","rd"],l=p%100;return"["+p+(s[(l-20)%10]||s[l]||s[0])+"]"}},dt=function(p,s,l){var h=String(p);return!h||h.length>=s?p:""+Array(s+1-h.length).join(l)+p},G={s:dt,z:function(p){var s=-p.utcOffset(),l=Math.abs(s),h=Math.floor(l/60),d=l%60;return(s<=0?"+":"-")+dt(h,2,"0")+":"+dt(d,2,"0")},m:function p(s,l){if(s.date()1)return p(k[0])}else{var R=s.name;i[R]=s,d=R}return!h&&d&&(V=d),d||!h&&V},ot=function(p,s){if(kt(p))return p.clone();var l="object"==typeof s?s:{};return l.date=p,l.args=arguments,new lt(l)},it=G;it.l=Pt,it.i=kt,it.w=function(p,s){return ot(p,{locale:s.$L,utc:s.$u,x:s.$x,$offset:s.$offset})};var lt=function(){function p(l){this.$L=Pt(l.locale,null,!0),this.parse(l),this.$x=this.$x||l.x||{},this[ut]=!0}var s=p.prototype;return s.parse=function(l){this.$d=function(h){var d=h.date,v=h.utc;if(null===d)return new Date(NaN);if(it.u(d))return new Date;if(d instanceof Date)return new Date(d);if("string"==typeof d&&!/Z$/i.test(d)){var k=d.match(nt);if(k){var R=k[2]-1||0,w=(k[7]||"0").substring(0,3);return v?new Date(Date.UTC(k[1],R,k[3]||1,k[4]||0,k[5]||0,k[6]||0,w)):new Date(k[1],R,k[3]||1,k[4]||0,k[5]||0,k[6]||0,w)}}return new Date(d)}(l),this.init()},s.init=function(){var l=this.$d;this.$y=l.getFullYear(),this.$M=l.getMonth(),this.$D=l.getDate(),this.$W=l.getDay(),this.$H=l.getHours(),this.$m=l.getMinutes(),this.$s=l.getSeconds(),this.$ms=l.getMilliseconds()},s.$utils=function(){return it},s.isValid=function(){return this.$d.toString()!==K},s.isSame=function(l,h){var d=ot(l);return this.startOf(h)<=d&&d<=this.endOf(h)},s.isAfter=function(l,h){return ot(l)0,i<=V.r||!V.r){i<=1&&G>0&&(V=O[G-1]);var ut=L[V.l];tt&&(i=tt(""+i)),K="string"==typeof ut?ut.replace("%d",i):ut(i,I,V.l,nt);break}}if(I)return K;var kt=nt?L.future:L.past;return"function"==typeof kt?kt(K):kt.replace("%s",K)},y.to=function(C,I){return A(C,I,this,!0)},y.from=function(C,I){return A(C,I,this)};var m=function(C){return C.$u?E.utc():E()};y.toNow=function(C){return this.to(m(this),C)},y.fromNow=function(C){return this.from(m(this),C)}}}()},243:bt=>{"use strict";var N={single_source_shortest_paths:function(M,E,y){var _={},A={};A[E]=0;var C,I,B,j,tt,K,m=N.PriorityQueue.make();for(m.push(E,0);!m.empty();)for(B in j=(C=m.pop()).cost,tt=M[I=C.value]||{})tt.hasOwnProperty(B)&&(K=j+tt[B],(typeof A[B]>"u"||A[B]>K)&&(A[B]=K,m.push(B,K),_[B]=I));if(typeof y<"u"&&typeof A[y]>"u"){var O=["Could not find a path from ",E," to ",y,"."].join("");throw new Error(O)}return _},extract_shortest_path_from_predecessor_list:function(M,E){for(var y=[],_=E;_;)y.push(_),_=M[_];return y.reverse(),y},find_path:function(M,E,y){var _=N.single_source_shortest_paths(M,E,y);return N.extract_shortest_path_from_predecessor_list(_,y)},PriorityQueue:{make:function(M){var _,E=N.PriorityQueue,y={};for(_ in M=M||{},E)E.hasOwnProperty(_)&&(y[_]=E[_]);return y.queue=[],y.sorter=M.sorter||E.default_sorter,y},default_sorter:function(M,E){return M.cost-E.cost},push:function(M,E){this.queue.push({value:M,cost:E}),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};bt.exports=N},3174:bt=>{"use strict";bt.exports=function(M){for(var E=[],y=M.length,_=0;_=55296&&A<=56319&&y>_+1){var m=M.charCodeAt(_+1);m>=56320&&m<=57343&&(A=1024*(A-55296)+m-56320+65536,_+=1)}A<128?E.push(A):A<2048?(E.push(A>>6|192),E.push(63&A|128)):A<55296||A>=57344&&A<65536?(E.push(A>>12|224),E.push(A>>6&63|128),E.push(63&A|128)):A>=65536&&A<=1114111?(E.push(A>>18|240),E.push(A>>12&63|128),E.push(A>>6&63|128),E.push(63&A|128)):E.push(239,191,189)}return new Uint8Array(E).buffer}},7790:()=>{},9183:(bt,N,M)=>{"use strict";M.d(N,{D6:()=>K,LG:()=>tt});var E=M(4438),y=M(177),_=M(6600);const A=["determinateSpinner"];function m(nt,L){if(1&nt&&(E.qSk(),E.j41(0,"svg",11),E.nrm(1,"circle",12),E.k0s()),2&nt){const O=E.XpG();E.BMQ("viewBox",O._viewBox()),E.R7$(),E.xc7("stroke-dasharray",O._strokeCircumference(),"px")("stroke-dashoffset",O._strokeCircumference()/2,"px")("stroke-width",O._circleStrokeWidth(),"%"),E.BMQ("r",O._circleRadius())}}const C=new E.nKC("mat-progress-spinner-default-options",{providedIn:"root",factory:function I(){return{diameter:B}}}),B=100;let tt=(()=>{class nt{get color(){return this._color||this._defaultColor}set color(O){this._color=O}constructor(O,dt,G){this._elementRef=O,this._defaultColor="primary",this._value=0,this._diameter=B,this._noopAnimations="NoopAnimations"===dt&&!!G&&!G._forceAnimations,this.mode="mat-spinner"===O.nativeElement.nodeName.toLowerCase()?"indeterminate":"determinate",G&&(G.color&&(this.color=this._defaultColor=G.color),G.diameter&&(this.diameter=G.diameter),G.strokeWidth&&(this.strokeWidth=G.strokeWidth))}get value(){return"determinate"===this.mode?this._value:0}set value(O){this._value=Math.max(0,Math.min(100,O||0))}get diameter(){return this._diameter}set diameter(O){this._diameter=O||0}get strokeWidth(){return this._strokeWidth??this.diameter/10}set strokeWidth(O){this._strokeWidth=O||0}_circleRadius(){return(this.diameter-10)/2}_viewBox(){const O=2*this._circleRadius()+this.strokeWidth;return`0 0 ${O} ${O}`}_strokeCircumference(){return 2*Math.PI*this._circleRadius()}_strokeDashOffset(){return"determinate"===this.mode?this._strokeCircumference()*(100-this._value)/100:null}_circleStrokeWidth(){return this.strokeWidth/this.diameter*100}static#t=this.\u0275fac=function(dt){return new(dt||nt)(E.rXU(E.aKT),E.rXU(E.bc$,8),E.rXU(C))};static#e=this.\u0275cmp=E.VBU({type:nt,selectors:[["mat-progress-spinner"],["mat-spinner"]],viewQuery:function(dt,G){if(1&dt&&E.GBs(A,5),2&dt){let V;E.mGM(V=E.lsd())&&(G._determinateCircle=V.first)}},hostAttrs:["role","progressbar","tabindex","-1",1,"mat-mdc-progress-spinner","mdc-circular-progress"],hostVars:18,hostBindings:function(dt,G){2&dt&&(E.BMQ("aria-valuemin",0)("aria-valuemax",100)("aria-valuenow","determinate"===G.mode?G.value:null)("mode",G.mode),E.HbH("mat-"+G.color),E.xc7("width",G.diameter,"px")("height",G.diameter,"px")("--mdc-circular-progress-size",G.diameter+"px")("--mdc-circular-progress-active-indicator-width",G.diameter+"px"),E.AVh("_mat-animation-noopable",G._noopAnimations)("mdc-circular-progress--indeterminate","indeterminate"===G.mode))},inputs:{color:"color",mode:"mode",value:[2,"value","value",E.Udg],diameter:[2,"diameter","diameter",E.Udg],strokeWidth:[2,"strokeWidth","strokeWidth",E.Udg]},exportAs:["matProgressSpinner"],standalone:!0,features:[E.GFd,E.aNF],decls:14,vars:11,consts:[["circle",""],["determinateSpinner",""],["aria-hidden","true",1,"mdc-circular-progress__determinate-container"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__determinate-circle-graphic"],["cx","50%","cy","50%",1,"mdc-circular-progress__determinate-circle"],["aria-hidden","true",1,"mdc-circular-progress__indeterminate-container"],[1,"mdc-circular-progress__spinner-layer"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-left"],[3,"ngTemplateOutlet"],[1,"mdc-circular-progress__gap-patch"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-right"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__indeterminate-circle-graphic"],["cx","50%","cy","50%"]],template:function(dt,G){if(1&dt&&(E.DNE(0,m,2,8,"ng-template",null,0,E.C5r),E.j41(2,"div",2,1),E.qSk(),E.j41(4,"svg",3),E.nrm(5,"circle",4),E.k0s()(),E.joV(),E.j41(6,"div",5)(7,"div",6)(8,"div",7),E.eu8(9,8),E.k0s(),E.j41(10,"div",9),E.eu8(11,8),E.k0s(),E.j41(12,"div",10),E.eu8(13,8),E.k0s()()()),2&dt){const V=E.sdS(1);E.R7$(4),E.BMQ("viewBox",G._viewBox()),E.R7$(),E.xc7("stroke-dasharray",G._strokeCircumference(),"px")("stroke-dashoffset",G._strokeDashOffset(),"px")("stroke-width",G._circleStrokeWidth(),"%"),E.BMQ("r",G._circleRadius()),E.R7$(4),E.Y8G("ngTemplateOutlet",V),E.R7$(2),E.Y8G("ngTemplateOutlet",V),E.R7$(2),E.Y8G("ngTemplateOutlet",V)}},dependencies:[y.T3],styles:[".mat-mdc-progress-spinner{display:block;overflow:hidden;line-height:0;position:relative;direction:ltr;transition:opacity 250ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-progress-spinner circle{stroke-width:var(--mdc-circular-progress-active-indicator-width)}.mat-mdc-progress-spinner._mat-animation-noopable,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__determinate-circle{transition:none !important}.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-circle-graphic,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__spinner-layer,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container{animation:none !important}.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container circle{stroke-dasharray:0 !important}.cdk-high-contrast-active .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic,.cdk-high-contrast-active .mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle{stroke:currentColor;stroke:CanvasText}.mdc-circular-progress__determinate-container,.mdc-circular-progress__indeterminate-circle-graphic,.mdc-circular-progress__indeterminate-container,.mdc-circular-progress__spinner-layer{position:absolute;width:100%;height:100%}.mdc-circular-progress__determinate-container{transform:rotate(-90deg)}.mdc-circular-progress--indeterminate .mdc-circular-progress__determinate-container{opacity:0}.mdc-circular-progress__indeterminate-container{font-size:0;letter-spacing:0;white-space:nowrap;opacity:0}.mdc-circular-progress--indeterminate .mdc-circular-progress__indeterminate-container{opacity:1;animation:mdc-circular-progress-container-rotate 1568.2352941176ms linear infinite}.mdc-circular-progress__determinate-circle-graphic,.mdc-circular-progress__indeterminate-circle-graphic{fill:rgba(0,0,0,0)}.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:var(--mdc-circular-progress-active-indicator-color, var(--mat-app-primary))}.cdk-high-contrast-active .mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,.cdk-high-contrast-active .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:CanvasText}.mdc-circular-progress__determinate-circle{transition:stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1)}.mdc-circular-progress__gap-patch{position:absolute;top:0;left:47.5%;box-sizing:border-box;width:5%;height:100%;overflow:hidden}.mdc-circular-progress__gap-patch .mdc-circular-progress__indeterminate-circle-graphic{left:-900%;width:2000%;transform:rotate(180deg)}.mdc-circular-progress__circle-clipper .mdc-circular-progress__indeterminate-circle-graphic{width:200%}.mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{left:-100%}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-left .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-left-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-right-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress__circle-clipper{display:inline-flex;position:relative;width:50%;height:100%;overflow:hidden}.mdc-circular-progress--indeterminate .mdc-circular-progress__spinner-layer{animation:mdc-circular-progress-spinner-layer-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}@keyframes mdc-circular-progress-container-rotate{to{transform:rotate(360deg)}}@keyframes mdc-circular-progress-spinner-layer-rotate{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes mdc-circular-progress-left-spin{from{transform:rotate(265deg)}50%{transform:rotate(130deg)}to{transform:rotate(265deg)}}@keyframes mdc-circular-progress-right-spin{from{transform:rotate(-265deg)}50%{transform:rotate(-130deg)}to{transform:rotate(-265deg)}}"],encapsulation:2,changeDetection:0})}return nt})(),K=(()=>{class nt{static#t=this.\u0275fac=function(dt){return new(dt||nt)};static#e=this.\u0275mod=E.$C({type:nt});static#n=this.\u0275inj=E.G2t({imports:[y.MD,_.yE]})}return nt})()}}]); \ No newline at end of file diff --git a/index.html b/index.html index 880338f..73343ac 100644 --- a/index.html +++ b/index.html @@ -41,5 +41,5 @@ - + diff --git a/ngsw.json b/ngsw.json index 6070753..be7f4fe 100644 --- a/ngsw.json +++ b/ngsw.json @@ -1,6 +1,6 @@ { "configVersion": 1, - "timestamp": 1728937577587, + "timestamp": 1728964457174, "index": "/index.html", "assetGroups": [], "dataGroups": [], diff --git a/runtime.756c77d0646da9da.js b/runtime.553adc18dfa73941.js similarity index 97% rename from runtime.756c77d0646da9da.js rename to runtime.553adc18dfa73941.js index 821a208..d026ec3 100644 --- a/runtime.756c77d0646da9da.js +++ b/runtime.553adc18dfa73941.js @@ -1 +1 @@ -(()=>{"use strict";var e,v={},g={};function r(e){var n=g[e];if(void 0!==n)return n.exports;var a=g[e]={id:e,loaded:!1,exports:{}};return v[e].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}r.m=v,e=[],r.O=(n,a,i,o)=>{if(!a){var t=1/0;for(f=0;f=o)&&Object.keys(r.O).every(p=>r.O[p](a[d]))?a.splice(d--,1):(u=!1,o0&&e[f-1][2]>o;f--)e[f]=e[f-1];e[f]=[a,i,o]},r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},r.d=(e,n)=>{for(var a in n)r.o(n,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:n[a]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((n,a)=>(r.f[a](e,n),n),[])),r.u=e=>(76===e?"common":e)+"."+{19:"dca136d279779f74",73:"755a3e942e4826f1",76:"b1ab1f4db0c69f24",221:"2750310af10a6f8e",253:"5887fdcffeddb0c0",258:"aad42a92879fbe06",450:"6fcf963f9814fa47",514:"f75b666c45905874",541:"ba33ac199fd9733b",588:"9e3eddece19ee7e1",770:"29ee0ce2f9a56908",774:"5eee3e57ce1baaa8",907:"7de62f59f625e1c8",963:"8904432f72c602a9"}[e]+".js",r.miniCssF=e=>{},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="angor:";r.l=(a,i,o,f)=>{if(e[a])e[a].push(i);else{var t,u;if(void 0!==o)for(var d=document.getElementsByTagName("script"),l=0;l{t.onerror=t.onload=null,clearTimeout(b);var h=e[a];if(delete e[a],t.parentNode&&t.parentNode.removeChild(t),h&&h.forEach(_=>_(p)),m)return m(p)},b=setTimeout(s.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=s.bind(null,t.onerror),t.onload=s.bind(null,t.onload),u&&document.head.appendChild(t)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:n=>n},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={121:0};r.f.j=(i,o)=>{var f=r.o(e,i)?e[i]:void 0;if(0!==f)if(f)o.push(f[2]);else if(121!=i){var t=new Promise((c,s)=>f=e[i]=[c,s]);o.push(f[2]=t);var u=r.p+r.u(i),d=new Error;r.l(u,c=>{if(r.o(e,i)&&(0!==(f=e[i])&&(e[i]=void 0),f)){var s=c&&("load"===c.type?"missing":c.type),b=c&&c.target&&c.target.src;d.message="Loading chunk "+i+" failed.\n("+s+": "+b+")",d.name="ChunkLoadError",d.type=s,d.request=b,f[1](d)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var n=(i,o)=>{var d,l,[f,t,u]=o,c=0;if(f.some(b=>0!==e[b])){for(d in t)r.o(t,d)&&(r.m[d]=t[d]);if(u)var s=u(r)}for(i&&i(o);c{"use strict";var e,v={},g={};function r(e){var n=g[e];if(void 0!==n)return n.exports;var a=g[e]={id:e,loaded:!1,exports:{}};return v[e].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}r.m=v,e=[],r.O=(n,a,i,o)=>{if(!a){var t=1/0;for(f=0;f=o)&&Object.keys(r.O).every(p=>r.O[p](a[d]))?a.splice(d--,1):(u=!1,o0&&e[f-1][2]>o;f--)e[f]=e[f-1];e[f]=[a,i,o]},r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},r.d=(e,n)=>{for(var a in n)r.o(n,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:n[a]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((n,a)=>(r.f[a](e,n),n),[])),r.u=e=>(76===e?"common":e)+"."+{19:"dca136d279779f74",73:"d601847698554c7d",76:"b1ab1f4db0c69f24",221:"2750310af10a6f8e",253:"5887fdcffeddb0c0",258:"aad42a92879fbe06",450:"6fcf963f9814fa47",514:"f75b666c45905874",541:"ba33ac199fd9733b",588:"9e3eddece19ee7e1",770:"29ee0ce2f9a56908",774:"5eee3e57ce1baaa8",907:"7de62f59f625e1c8",963:"8904432f72c602a9"}[e]+".js",r.miniCssF=e=>{},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="angor:";r.l=(a,i,o,f)=>{if(e[a])e[a].push(i);else{var t,u;if(void 0!==o)for(var d=document.getElementsByTagName("script"),l=0;l{t.onerror=t.onload=null,clearTimeout(b);var h=e[a];if(delete e[a],t.parentNode&&t.parentNode.removeChild(t),h&&h.forEach(_=>_(p)),m)return m(p)},b=setTimeout(s.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=s.bind(null,t.onerror),t.onload=s.bind(null,t.onload),u&&document.head.appendChild(t)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:n=>n},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={121:0};r.f.j=(i,o)=>{var f=r.o(e,i)?e[i]:void 0;if(0!==f)if(f)o.push(f[2]);else if(121!=i){var t=new Promise((c,s)=>f=e[i]=[c,s]);o.push(f[2]=t);var u=r.p+r.u(i),d=new Error;r.l(u,c=>{if(r.o(e,i)&&(0!==(f=e[i])&&(e[i]=void 0),f)){var s=c&&("load"===c.type?"missing":c.type),b=c&&c.target&&c.target.src;d.message="Loading chunk "+i+" failed.\n("+s+": "+b+")",d.name="ChunkLoadError",d.type=s,d.request=b,f[1](d)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var n=(i,o)=>{var d,l,[f,t,u]=o,c=0;if(f.some(b=>0!==e[b])){for(d in t)r.o(t,d)&&(r.m[d]=t[d]);if(u)var s=u(r)}for(i&&i(o);c