diff --git a/404.html b/404.html index 5472229..a5fd448 100644 --- a/404.html +++ b/404.html @@ -41,5 +41,5 @@ - + diff --git a/57.344f315dd5c6f584.js b/57.344f315dd5c6f584.js deleted file mode 100644 index 66d7049..0000000 --- a/57.344f315dd5c6f584.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkangor=self.webpackChunkangor||[]).push([[57],{4057:(N,I,r)=>{r.d(I,{q:()=>U});var y=r(9345),e=r(177),t=r(4438),_=r(8834),$=r(1997),j=r(9213),k=r(9115),g=r(5245),p=r(467),m=r(8703),u=r(7291);let v=(()=>{class s{constructor(o,c){this._changeDetectorRef=o,this._storageService=c,this.userChange=new t.bkB}ngOnInit(){this.loadUserProfile(),this.subscription=this._storageService.profile$.subscribe(o=>{o&&o.pubKey===this.pubkey&&(this.user=o.metadata,this.userChange.emit(this.user),this._changeDetectorRef.detectChanges())})}loadUserProfile(){var o=this;return(0,p.A)(function*(){const c=yield o._storageService.getProfile(o.pubkey);o.user=c||{},o.userChange.emit(o.user),o._changeDetectorRef.detectChanges()})()}get displayName(){return this.user?.display_name||this.user?.name||this.shortenPubkey(this.pubkey)}get displayAvatar(){return this.user?.picture||this.avatarUrl||"/images/avatars/avatar-placeholder.png"}shortenPubkey(o){return o?`${o.slice(0,8)}...${o.slice(-8)}`:""}ngOnDestroy(){this.subscription&&this.subscription.unsubscribe()}static{this.\u0275fac=function(c){return new(c||s)(t.rXU(t.gRc),t.rXU(u.n))}}static{this.\u0275cmp=t.VBU({type:s,selectors:[["app-post-profile"]],inputs:{pubkey:"pubkey",avatarUrl:"avatarUrl",created_at:"created_at"},outputs:{userChange:"userChange"},standalone:!0,features:[t.aNF],decls:9,vars:7,consts:[[1,"flex","items-center"],[1,"flex","items-center","group",3,"href"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"mr-4","h-10","w-10","rounded-full","object-cover",3,"src","alt"],[1,"flex","flex-col"],[1,"font-semibold","leading-none"],[1,"text-secondary","mt-1","text-sm","leading-none"]],template:function(c,i){1&c&&(t.j41(0,"div",0)(1,"a",1),t.nrm(2,"img",2),t.j41(3,"div",3)(4,"span",4),t.EFF(5),t.k0s(),t.j41(6,"span",5),t.EFF(7),t.nI1(8,"ago"),t.k0s()()()()),2&c&&(t.R7$(),t.Y8G("href","/profile/"+i.pubkey,t.B4B),t.R7$(),t.Y8G("src",i.displayAvatar,t.B4B)("alt",i.displayName),t.R7$(3),t.JRh(i.displayName),t.R7$(2),t.JRh(t.bMT(8,5,i.created_at)))},dependencies:[e.MD,m.g]})}}return s})();var E=r(413),x=r(5351),D=r(5416),w=r(2507);let T=(()=>{class s{constructor(){this.dialog=(0,t.WQX)(x.bZ),this.snackBar=(0,t.WQX)(D.UG)}canUseZap(o){var c=this;return(0,p.A)(function*(){return!(!o||!o.lud06&&!o.lud16)||(c.openSnackBar("Using Zap is not possible. Please complete your profile to include lud06 or lud16."),!1)})()}openSnackBar(o,c="dismiss"){this.snackBar.open(o,c,{duration:3e3})}openZapDialog(o="",c){var i=this;return(0,p.A)(function*(){(yield i.canUseZap(c))&&i.dialog.open(w.r,{width:"405px",maxHeight:"90vh",data:{lud16:c.lud16,lud06:c.lud06,pubkey:c.pubkey,eventId:o}})})()}static{this.\u0275fac=function(c){return new(c||s)}}static{this.\u0275prov=t.jDH({token:s,factory:s.\u0275fac,providedIn:"root"})}}return s})();function S(s,b){return this.trackByFn}const F=s=>["/post",s],G=s=>({"large-font":s});function P(s,b){if(1&s&&(t.j41(0,"div",26),t.nrm(1,"iframe",28),t.k0s()),2&s){const o=t.XpG().$implicit;t.R7$(),t.Y8G("src",o.safeWord,t.f$h)}}function Z(s,b){if(1&s&&(t.j41(0,"div",26),t.nrm(1,"img",29),t.k0s()),2&s){const o=t.XpG().$implicit;t.R7$(),t.Y8G("src",o.safeWord,t.B4B)}}function B(s,b){if(1&s&&(t.j41(0,"div",26)(1,"video",30),t.nrm(2,"source",31),t.EFF(3," Your browser does not support the video tag. "),t.k0s()()),2&s){const o=t.XpG().$implicit;t.R7$(2),t.Y8G("src",o.safeWord,t.B4B)}}function Y(s,b){if(1&s&&(t.j41(0,"div",26)(1,"audio",32),t.nrm(2,"source",33),t.EFF(3," Your browser does not support the audio element. "),t.k0s()()),2&s){const o=t.XpG().$implicit;t.R7$(2),t.Y8G("src",o.safeWord,t.B4B)}}function A(s,b){if(1&s&&(t.j41(0,"div",27)(1,"a",34)(2,"span",35),t.EFF(3),t.k0s()()()),2&s){const o=t.XpG().$implicit;t.R7$(),t.Y8G("href",o.word,t.B4B),t.R7$(2),t.JRh(o.word)}}function M(s,b){if(1&s&&(t.j41(0,"div",27)(1,"span",36),t.EFF(2),t.k0s()()),2&s){const o=t.XpG().$implicit,c=t.XpG(2);t.R7$(),t.Y8G("ngClass",t.eq3(2,G,c.isSingleEmojiOrWord(o))),t.R7$(),t.SpI(" ",o.trim()," ")}}function O(s,b){if(1&s&&(t.j41(0,"div",25),t.DNE(1,P,2,1,"div",26)(2,Z,2,1,"div",26)(3,B,4,1,"div",26)(4,Y,4,1,"div",26)(5,A,4,2,"div",27)(6,M,3,4,"div",27),t.k0s()),2&s){const o=b.$implicit;t.R7$(),t.vxM("youtube"===o.token?1:-1),t.R7$(),t.vxM("image"===o.token?2:-1),t.R7$(),t.vxM("video"===o.token?3:-1),t.R7$(),t.vxM("audio"===o.token?4:-1),t.R7$(),t.vxM("link"===o.token?5:-1),t.R7$(),t.vxM(o.token?-1:6)}}function W(s,b){if(1&s&&t.Z7z(0,O,7,6,"div",25,S,!0),2&s){const o=t.XpG();t.Dyx(o.parseContent.parseContent(o.item.content))}}let U=(()=>{class s{constructor(){this.user=new t.bkB,this.storageService=(0,t.WQX)(u.n),this.zapService=(0,t.WQX)(T),this.parseContent=(0,t.WQX)(E.m)}openZapDialog(o,c){this.zapService.openZapDialog(o,c)}getProfile(){}isSingleEmojiOrWord(o){const c=o.trim(),i=/^\w+$/.test(c),h=/^[\p{Emoji}]+$/u.test(c);return i||h}static{this.\u0275fac=function(c){return new(c||s)}}static{this.\u0275cmp=t.VBU({type:s,selectors:[["app-post"]],inputs:{item:"item"},outputs:{user:"user"},standalone:!0,features:[t.aNF],decls:64,vars:19,consts:[["expandableCard02","angorCard"],["postCardMenu02","matMenu"],[1,"flex","w-full","flex-col"],[1,"mx-6","mb-4","mt-6","flex","items-center","sm:mx-8"],[3,"userChange","pubkey","avatarUrl","created_at"],["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-3","flex","items-center","sm:mx-5"],["mat-button","",1,"mr-1","px-3"],[1,"text-red-500","icon-size-5",3,"svgIcon"],[1,"ml-2"],[1,"text-blue-500","icon-size-5",3,"svgIcon"],[1,"text-green-500","icon-size-5",3,"svgIcon"],["mat-button","",1,"mr-1","px-3",3,"click"],[1,"text-orange-500","icon-size-5",3,"svgIcon"],[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"],[1,"hidden","flex-auto","sm:flex"],[1,"mt-4","flex","items-center","sm:mt-0"],["mat-button","",1,"px-3","sm:-mr-4",3,"routerLink"],[1,"mr-1"],[1,"inline-block","whitespace-pre-wrap","break-words"],[1,"relative","mb-4","block"],[1,"mx-6","mb-6","mt-2","sm:mx-8"],["width","560","height","315","frameborder","0","allowfullscreen","",3,"src"],["alt","Embedded Image",1,"max-h-140","object-cover",2,"width","100%",3,"src"],["controls","",2,"width","100%"],["type","video/mp4",3,"src"],["controls",""],["type","audio/mpeg",3,"src"],["target","_blank",1,"inline-block","break-words","text-blue-500","underline",3,"href"],[1,"inline-block","break-words"],[1,"inline-block","break-words",3,"ngClass"]],template:function(c,i){if(1&c){const h=t.RV6();t.j41(0,"angor-card",2,0)(2,"div",3)(3,"app-post-profile",4),t.bIt("userChange",function(a){return t.eBV(h),t.Njj(i.user=a)}),t.k0s(),t.j41(4,"button",5),t.nrm(5,"mat-icon",6),t.k0s(),t.j41(6,"mat-menu",null,1)(8,"button",7)(9,"span",8),t.nrm(10,"mat-icon",9),t.j41(11,"span"),t.EFF(12,"Save post"),t.k0s()()(),t.j41(13,"button",7)(14,"span",8),t.nrm(15,"mat-icon",9),t.j41(16,"span"),t.EFF(17,"Hide post"),t.k0s()()(),t.j41(18,"button",7)(19,"span",8),t.nrm(20,"mat-icon",9),t.j41(21,"span"),t.EFF(22,"Snooze for 30 days"),t.k0s()()(),t.j41(23,"button",7)(24,"span",8),t.nrm(25,"mat-icon",9),t.j41(26,"span"),t.EFF(27,"Hide all"),t.k0s()()(),t.nrm(28,"mat-divider",10),t.j41(29,"button",7)(30,"span",8),t.nrm(31,"mat-icon",9),t.j41(32,"span"),t.EFF(33,"Report post"),t.k0s()()(),t.j41(34,"button",7)(35,"span",8),t.nrm(36,"mat-icon",9),t.j41(37,"span"),t.EFF(38,"Turn on notifications for this post"),t.k0s()()()()(),t.DNE(39,W,2,0),t.j41(40,"div",11)(41,"button",12),t.nrm(42,"mat-icon",13),t.j41(43,"span",14),t.EFF(44,"Unlike"),t.k0s()(),t.j41(45,"button",12),t.nrm(46,"mat-icon",15),t.j41(47,"span",14),t.EFF(48,"Comment"),t.k0s()(),t.j41(49,"button",12),t.nrm(50,"mat-icon",16),t.j41(51,"span",14),t.EFF(52,"Share"),t.k0s()(),t.j41(53,"button",17),t.bIt("click",function(){return t.eBV(h),t.Njj(i.openZapDialog(i.item.id,i.user))}),t.nrm(54,"mat-icon",18),t.j41(55,"span",14),t.EFF(56,"Zap"),t.k0s()()(),t.nrm(57,"hr",19),t.j41(58,"div",20),t.nrm(59,"div",21),t.j41(60,"div",22)(61,"button",23)(62,"span",24),t.EFF(63,"Read More ..."),t.k0s()()()()()}if(2&c){const h=t.sdS(7);t.R7$(3),t.Y8G("pubkey",null==i.item?null:i.item.pubkey)("avatarUrl","/images/avatars/avatar-placeholder.png")("created_at",i.item.created_at),t.R7$(),t.Y8G("matMenuTriggerFor",h),t.R7$(),t.Y8G("svgIcon","heroicons_solid:ellipsis-vertical"),t.R7$(5),t.Y8G("svgIcon","heroicons_solid:arrow-up-tray"),t.R7$(5),t.Y8G("svgIcon","heroicons_solid:eye-slash"),t.R7$(5),t.Y8G("svgIcon","heroicons_solid:clock"),t.R7$(5),t.Y8G("svgIcon","heroicons_solid:minus-circle"),t.R7$(6),t.Y8G("svgIcon","heroicons_solid:exclamation-triangle"),t.R7$(5),t.Y8G("svgIcon","heroicons_solid:bell"),t.R7$(3),t.vxM(i.item.content?39:-1),t.R7$(3),t.Y8G("svgIcon","heroicons_solid:heart"),t.R7$(4),t.Y8G("svgIcon","heroicons_solid:chat-bubble-left-ellipsis"),t.R7$(4),t.Y8G("svgIcon","heroicons_solid:share"),t.R7$(4),t.Y8G("svgIcon","heroicons_solid:bolt"),t.R7$(7),t.Y8G("routerLink",t.eq3(17,F,i.item.id))}},dependencies:[y.n,v,j.m_,j.An,$.w,$.q,k.Cn,k.kk,k.fb,k.Cp,g.iI,g.Wk,e.MD,e.YU,_.$z]})}}return s})()},2507:(N,I,r)=>{r.d(I,{r:()=>c});var y=r(467),e=r(4438),t=r(9417),_=r(5351),$=r(5416),j=r(6182),k=r(7673),g=r(9437),p=r(1626);let m=(()=>{class i{constructor(n){this.http=n}getLightning(n){return this.http.get(n).pipe((0,g.W)(a=>(console.error("Failed to fetch Lightning response:",a),(0,k.of)({status:"Failed"}))))}getLightningInvoice(n,a){return this.http.get(`${n}?amount=${a}`).pipe((0,g.W)(d=>(console.error("Failed to fetch Lightning invoice:",d),(0,k.of)({pr:"",status:"Failed"}))))}getLightningAddress(n){try{const[a,l]=n.split("@");return`https://${l}/.well-known/lnurlp/${a}`}catch{return console.error("Invalid Lightning address format:",n),""}}sendZapRequest(n,a,l,d){const f=encodeURIComponent(JSON.stringify(a));return this.http.get(`${n}?amount=${l}&nostr=${f}&lnurl=${d}`).pipe((0,g.W)(C=>(console.error("Failed to send zap request:",C),(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(n){return console.error("WebLN login failed:",n),!1}})()}hasWebln(){return!!window.webln}sendPayment(n){var a=this;return(0,y.A)(function*(){try{return a.hasWebln()?yield window.webln.sendPayment(n):(console.error("WebLN is not available"),null)}catch(l){throw console.error("Payment failed:",l),l}})()}payInvoice(n){var a=this;return(0,y.A)(function*(){if((yield a.login())&&a.hasWebln())try{return!!(yield a.sendPayment(n))}catch(d){return console.error("Failed to pay invoice:",d),!1}return console.error("WebLN not available or login failed"),!1})()}static{this.\u0275fac=function(a){return new(a||i)(e.KVO(p.Qq))}}static{this.\u0275prov=e.jDH({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var u=r(719),v=r(6324),E=r(6231),x=r(8834),D=r(9213),w=r(5398),T=r(177),S=r(1997),F=r(2102),G=r(9042),P=r(2798),Z=r(882),B=r(4823),Y=r(5766),A=r(9706);function M(i,h){if(1&i){const n=e.RV6();e.j41(0,"button",15),e.bIt("click",function(){let l;const d=e.eBV(n).$implicit,f=e.XpG(2);return e.Njj(null==(l=f.sendZapForm.get("amount"))?null:l.setValue(d.value))}),e.j41(1,"mat-icon",16),e.EFF(2),e.k0s(),e.j41(3,"span",17),e.EFF(4),e.k0s()()}if(2&i){const n=h.$implicit;e.R7$(2),e.JRh(n.icon),e.R7$(2),e.JRh(n.label)}}function O(i,h){1&i&&(e.j41(0,"mat-error"),e.EFF(1," Zap amount is required "),e.k0s())}function W(i,h){1&i&&(e.j41(0,"mat-error"),e.EFF(1," Minimum amount is 1 sat "),e.k0s())}function U(i,h){if(1&i){const n=e.RV6();e.j41(0,"mat-dialog-content",5)(1,"div",6),e.DNE(2,M,5,2,"button",7),e.k0s(),e.nrm(3,"mat-divider"),e.j41(4,"div",8)(5,"mat-form-field",9)(6,"mat-label"),e.EFF(7,"Zap Amount"),e.k0s(),e.nrm(8,"input",10),e.j41(9,"mat-hint",11),e.EFF(10,"Amount in sats"),e.k0s(),e.DNE(11,O,2,0,"mat-error",12)(12,W,2,0,"mat-error",12),e.k0s(),e.j41(13,"mat-form-field",9)(14,"mat-label"),e.EFF(15,"Comment"),e.k0s(),e.nrm(16,"input",13),e.j41(17,"mat-hint",11),e.EFF(18),e.k0s()()(),e.j41(19,"mat-dialog-actions",11)(20,"button",14),e.bIt("click",function(){e.eBV(n);const l=e.XpG();return e.Njj(l.onSubmit())}),e.EFF(21," Create Invoice "),e.k0s()()()}if(2&i){let n,a,l;const d=e.XpG();e.R7$(2),e.Y8G("ngForOf",d.zapButtons),e.R7$(2),e.Y8G("formGroup",d.sendZapForm),e.R7$(7),e.Y8G("ngIf",null==(n=d.sendZapForm.get("amount"))?null:n.hasError("required")),e.R7$(),e.Y8G("ngIf",null==(a=d.sendZapForm.get("amount"))?null:a.hasError("min")),e.R7$(6),e.SpI(" ",(null==(l=d.sendZapForm.get("comment"))||null==l.value?null:l.value.length)||0,"/100 "),e.R7$(2),e.Y8G("disabled",d.sendZapForm.invalid)}}function s(i,h){if(1&i&&(e.j41(0,"div",21)(1,"span",22),e.EFF(2),e.k0s(),e.nrm(3,"mat-divider",23)(4,"qrcode",24),e.k0s()),2&i){const n=e.XpG(2);e.R7$(2),e.SpI("Scan with phone to pay (",n.invoiceAmount," sats)"),e.R7$(2),e.Y8G("qrdata",n.lightningInvoice)("matTooltip","Lightning Invoice")("errorCorrectionLevel","M")}}function b(i,h){if(1&i){const n=e.RV6();e.j41(0,"div",25)(1,"mat-form-field",26)(2,"mat-label"),e.EFF(3,"Invoice Address"),e.k0s(),e.nrm(4,"input",27),e.j41(5,"button",28),e.bIt("click",function(){e.eBV(n);const l=e.XpG(2);return e.Njj(l.copyInvoice())}),e.nrm(6,"mat-icon",29),e.k0s()()()}if(2&i){const n=e.XpG(2);e.R7$(4),e.Y8G("value",n.lightningInvoice),e.R7$(),e.Y8G("matTooltip","Copy Invoice"),e.R7$(),e.Y8G("svgIcon","heroicons_outline:clipboard-document")}}function o(i,h){if(1&i&&(e.j41(0,"mat-dialog-content",18),e.DNE(1,s,5,4,"div",19)(2,b,7,3,"div",20),e.k0s()),2&i){const n=e.XpG();e.R7$(),e.Y8G("ngIf",n.displayQRCode),e.R7$(),e.Y8G("ngIf",n.showInvoiceSection&&n.lightningInvoice)}}let c=(()=>{class i{constructor(n){this.util=n,this.formBuilder=(0,e.WQX)(t.ok),this.lightningService=(0,e.WQX)(m),this.signerService=(0,e.WQX)(v.A),this.relayService=(0,e.WQX)(E.b),this.dialogRef=(0,e.WQX)(_.CP),this.snackBar=(0,e.WQX)($.UG),this.clipboard=(0,e.WQX)(j.B0),this.data=(0,e.WQX)(_.Vh),this.lightningInvoice="",this.payRequest=null,this.displayQRCode=!1,this.showInvoiceSection=!1,this.loading=!1,this.invoiceAmount=0,this.error="",this.zapButtons=[{icon:"thumb_up",label:"21",value:21},{icon:"favorite",label:"50",value:50},{icon:"emoji_emotions",label:"100",value:100},{icon:"star",label:"500",value:500},{icon:"celebration",label:"1k",value:1e3},{icon:"rocket",label:"5k",value:5e3},{icon:"local_fire_department",label:"10k",value:1e4},{icon:"flash_on",label:"100k",value:1e5},{icon:"diamond",label:"500k",value:5e5}]}ngOnInit(){this.initializeForm()}initializeForm(){this.sendZapForm=this.formBuilder.group({lightningAddress:[this.data.lud16||this.data.lud06,[t.k0.required,this.validateLightningAddress]],amount:["",[t.k0.required,t.k0.min(1)]],comment:[""]})}validateLightningAddress(n){return n.value.includes("@")?null:{invalidFormat:!0}}onSubmit(){var n=this;return(0,y.A)(function*(){n.sendZapForm.invalid?n.showError("Please fill out the form correctly."):(n.loading=!0,yield n.fetchPayRequest())})()}getCallbackUrl(n){if(n.includes("@")){const[a,l]=n.split("@");return`https://${l}/.well-known/lnurlp/${a}`}return n.toLowerCase().startsWith("lnurl")?this.util.convertBech32ToText(n).toString():null}fetchPayRequest(){var n=this;return(0,y.A)(function*(){n.resetState();const a=n.data.lud16||n.data.lud06;if(!a)return void n.showError("Lightning Address is required.");let l=n.getCallbackUrl(a);try{const d=yield fetch(l);if(!d.ok)throw new Error("Failed to fetch pay request.");const f=yield d.json();if("ERROR"===f.status)return void n.showError(f.reason||"Error fetching the pay request.");n.payRequest=f,n.showInvoiceSection=!1,n.configureAmountValidators(),yield n.generateInvoice()}catch(d){n.showError(d.message||"Error connecting to the server.")}finally{n.loading=!1}})()}generateInvoice(){var n=this;return(0,y.A)(function*(){const a=n.sendZapForm.get("amount")?.value,l=n.sendZapForm.get("comment")?.value,d=n.data.eventId||null;if(!n.payRequest)return void n.showError("Pay request is not loaded.");n.invoiceAmount=a;const f=new URL(n.payRequest.callback),R=new URLSearchParams({amount:(1e3*a).toString()});if(l&&n.payRequest.commentAllowed&&R.set("comment",l),d){const C=yield n.createAndSignZapRequest(d,l);R.set("nostr",JSON.stringify(C))}try{const C=yield fetch(`${f.origin}${f.pathname}?${R.toString()}`);if(!C.ok)throw new Error("Failed to fetch invoice.");const X=yield C.json();if("ERROR"===X.status)return void n.showError(X.reason||"Error fetching the invoice.");n.lightningInvoice=X.pr,n.showInvoiceSection=!0,n.toggleQRCodeDisplay(!0)}catch(C){n.showError(C.message||"Error fetching the invoice.")}})()}configureAmountValidators(){if(!this.payRequest)return;const n=(this.payRequest.minSendable||1e3)/1e3,a=(this.payRequest.maxSendable||21e6)/1e3,l=this.sendZapForm.get("amount");l?.setValidators([t.k0.required,t.k0.min(n),t.k0.max(a)]),l?.updateValueAndValidity()}createAndSignZapRequest(n,a){var l=this;return(0,y.A)(function*(){try{const d=l.createZapRequestData(n,a);let f;if(l.signerService.isUsingSecretKey()){const R=yield l.signerService.getDecryptedSecretKey();if(!R)throw new Error("Private key could not be retrieved.");const C=(0,Y.aT)(R);f=(0,u.pC)(d,C)}else f=yield l.signerService.signEventWithExtension(d);if(!f)throw new Error("Signing failed. Signed event is null.");return f}catch(d){throw console.error("Error creating and signing zap request:",d),new Error("Failed to create and sign zap request.")}})()}createZapRequestData(n,a){return{kind:9734,content:a||"",tags:[["e",n],["p",this.payRequest?.nostrPubkey||""],["relays",...this.relayService.getConnectedRelays()]],pubkey:this.signerService.getPublicKey(),created_at:Math.floor(Date.now()/1e3)}}copyInvoice(){this.lightningInvoice?(this.clipboard.copy(this.lightningInvoice),this.showSuccess("Invoice copied to clipboard")):this.showError("No invoice available to copy")}toggleQRCodeDisplay(n=!1){this.displayQRCode=!!n||!this.displayQRCode}resetState(){this.error="",this.loading=!0,this.lightningInvoice=""}showError(n){this.error=n,this.loading=!1,this.snackBar.open(n,"Dismiss",{duration:2e3})}showSuccess(n){this.snackBar.open(n,"Dismiss",{duration:2e3})}closeDialog(){this.dialogRef.close()}static{this.\u0275fac=function(a){return new(a||i)(e.rXU(A.FP))}}static{this.\u0275cmp=e.VBU({type:i,selectors:[["app-send-dialog"]],standalone:!0,features:[e.aNF],decls:7,vars:4,consts:[[1,"absolute","right-0","top-0","pr-4","pt-4"],["mat-icon-button","","aria-label","Close",3,"matDialogClose"],[1,"text-secondary",3,"svgIcon"],["class","p-0 mt-4",4,"ngIf"],["class","flex flex-col items-center justify-center text-center p-1 mt-4",4,"ngIf"],[1,"p-0","mt-4"],[1,"preset-buttons"],["class","mr-1 px-3","mat-button","",3,"click",4,"ngFor","ngForOf"],[1,"zap-form",3,"formGroup"],["appearance","outline",1,"sats-input"],["matInput","","formControlName","amount","placeholder","Enter amount in sats, e.g., 100","type","number","aria-label","Zap Amount"],["align","end"],[4,"ngIf"],["matInput","","formControlName","comment","placeholder","Optional comment, e.g., as a gift...","aria-label","Comment","maxlength","100"],["mat-raised-button","","color","primary",3,"click","disabled"],["mat-button","",1,"mr-1","px-3",3,"click"],[1,"text-orange-500","icon-size-5"],[1,"ml-2"],[1,"flex","flex-col","items-center","justify-center","text-center","p-1","mt-4"],["class","w-full flex flex-col items-center",4,"ngIf"],["class","w-full max-w-md",4,"ngIf"],[1,"w-full","flex","flex-col","items-center"],[1,"mb-2"],[1,"w-full","mb-4"],[1,"qrcode-image","m-auto",3,"qrdata","matTooltip","errorCorrectionLevel"],[1,"w-full","max-w-md"],["appearance","outline",1,"w-full"],["matInput","","readonly","","aria-label","Invoice Address",3,"value"],["mat-icon-button","","matSuffix","","aria-label","Copy Invoice",3,"click","matTooltip"],[3,"svgIcon"]],template:function(a,l){1&a&&(e.j41(0,"div",0)(1,"button",1),e.nrm(2,"mat-icon",2),e.k0s()(),e.j41(3,"h1"),e.EFF(4,"\u26a1Zap"),e.k0s(),e.DNE(5,U,22,6,"mat-dialog-content",3)(6,o,3,2,"mat-dialog-content",4)),2&a&&(e.R7$(),e.Y8G("matDialogClose",void 0),e.R7$(),e.Y8G("svgIcon","heroicons_outline:x-mark"),e.R7$(3),e.Y8G("ngIf",!l.showInvoiceSection||!l.lightningInvoice),e.R7$(),e.Y8G("ngIf",l.showInvoiceSection&&l.lightningInvoice))},dependencies:[Z.vg,x.Hl,x.$z,x.iY,D.m_,D.An,t.YN,t.me,t.Q0,t.BC,t.cb,t.tU,F.nJ,F.rl,t.X1,t.j4,t.JD,T.MD,T.Sq,T.bT,P.Ve,F.MV,F.TL,F.yw,F.RG,G.fS,G.fg,_.Yi,_.E7,w.f,w.c,S.q,B.oV,_.tx],styles:[".preset-buttons[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;justify-items:center;margin-bottom:20px}.preset-buttons[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{font-size:14px;font-weight:700;display:flex;align-items:center;justify-content:center;max-height:60px!important}.sats-input[_ngcontent-%COMP%]{margin-top:20px;width:100%}.lightning-buttons[_ngcontent-%COMP%]{margin:5px 0}"]})}}return i})()},6182:(N,I,r)=>{r.d(I,{B0:()=>_});var y=r(177),e=r(4438);class t{constructor(p,m){this._document=m;const u=this._textarea=this._document.createElement("textarea"),v=u.style;v.position="fixed",v.top=v.opacity="0",v.left="-999em",u.setAttribute("aria-hidden","true"),u.value=p,u.readOnly=!0,(this._document.fullscreenElement||this._document.body).appendChild(u)}copy(){const p=this._textarea;let m=!1;try{if(p){const u=this._document.activeElement;p.select(),p.setSelectionRange(0,p.value.length),m=this._document.execCommand("copy"),u&&u.focus()}}catch{}return m}destroy(){const p=this._textarea;p&&(p.remove(),this._textarea=void 0)}}let _=(()=>{class g{constructor(m){this._document=m}copy(m){const u=this.beginCopy(m),v=u.copy();return u.destroy(),v}beginCopy(m){return new t(m,this._document)}static{this.\u0275fac=function(u){return new(u||g)(e.KVO(y.qQ))}}static{this.\u0275prov=e.jDH({token:g,factory:g.\u0275fac,providedIn:"root"})}}return g})()}}]); \ No newline at end of file diff --git a/57.3d93a953c8d5a9a3.js b/57.3d93a953c8d5a9a3.js new file mode 100644 index 0000000..fe0103e --- /dev/null +++ b/57.3d93a953c8d5a9a3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkangor=self.webpackChunkangor||[]).push([[57],{4057:(N,I,r)=>{r.d(I,{q:()=>U});var y=r(9345),e=r(177),t=r(4438),_=r(8834),$=r(1997),j=r(9213),k=r(9115),g=r(5245),p=r(467),m=r(8703),u=r(7291);let v=(()=>{class s{constructor(o,c){this._changeDetectorRef=o,this._storageService=c,this.userChange=new t.bkB}ngOnInit(){this.loadUserProfile(),this.subscription=this._storageService.profile$.subscribe(o=>{o&&o.pubKey===this.pubkey&&(this.user=o.metadata,this.userChange.emit(this.user),this._changeDetectorRef.detectChanges())})}loadUserProfile(){var o=this;return(0,p.A)(function*(){const c=yield o._storageService.getProfile(o.pubkey);o.user=c||{},o.userChange.emit(o.user),o._changeDetectorRef.detectChanges()})()}get displayName(){return this.user?.display_name||this.user?.name||this.shortenPubkey(this.pubkey)}get displayAvatar(){return this.user?.picture||this.avatarUrl||"/images/avatars/avatar-placeholder.png"}shortenPubkey(o){return o?`${o.slice(0,8)}...${o.slice(-8)}`:""}ngOnDestroy(){this.subscription&&this.subscription.unsubscribe()}static{this.\u0275fac=function(c){return new(c||s)(t.rXU(t.gRc),t.rXU(u.n))}}static{this.\u0275cmp=t.VBU({type:s,selectors:[["app-post-profile"]],inputs:{pubkey:"pubkey",avatarUrl:"avatarUrl",created_at:"created_at"},outputs:{userChange:"userChange"},standalone:!0,features:[t.aNF],decls:9,vars:7,consts:[[1,"flex","items-center"],[1,"flex","items-center","group",3,"href"],["onerror","this.onerror=null; this.src='/images/avatars/avatar-placeholder.png';",1,"mr-4","h-10","w-10","rounded-full","object-cover",3,"src","alt"],[1,"flex","flex-col"],[1,"font-semibold","leading-none"],[1,"text-secondary","mt-1","text-sm","leading-none"]],template:function(c,i){1&c&&(t.j41(0,"div",0)(1,"a",1),t.nrm(2,"img",2),t.j41(3,"div",3)(4,"span",4),t.EFF(5),t.k0s(),t.j41(6,"span",5),t.EFF(7),t.nI1(8,"ago"),t.k0s()()()()),2&c&&(t.R7$(),t.Y8G("href","/profile/"+i.pubkey,t.B4B),t.R7$(),t.Y8G("src",i.displayAvatar,t.B4B)("alt",i.displayName),t.R7$(3),t.JRh(i.displayName),t.R7$(2),t.JRh(t.bMT(8,5,i.created_at)))},dependencies:[e.MD,m.g]})}}return s})();var E=r(413),x=r(5351),D=r(5416),w=r(2507);let T=(()=>{class s{constructor(){this.dialog=(0,t.WQX)(x.bZ),this.snackBar=(0,t.WQX)(D.UG)}canUseZap(o){var c=this;return(0,p.A)(function*(){return!(!o||!o.lud06&&!o.lud16)||(c.openSnackBar("Using Zap is not possible. Please complete your profile to include lud06 or lud16."),!1)})()}openSnackBar(o,c="dismiss"){this.snackBar.open(o,c,{duration:3e3})}openZapDialog(o="",c){var i=this;return(0,p.A)(function*(){(yield i.canUseZap(c))&&i.dialog.open(w.r,{width:"405px",maxHeight:"90vh",data:{lud16:c.lud16,lud06:c.lud06,pubkey:c.pubkey,eventId:o}})})()}static{this.\u0275fac=function(c){return new(c||s)}}static{this.\u0275prov=t.jDH({token:s,factory:s.\u0275fac,providedIn:"root"})}}return s})();function S(s,b){return this.trackByFn}const F=s=>["/post",s],G=s=>({"large-font":s});function P(s,b){if(1&s&&(t.j41(0,"div",26),t.nrm(1,"iframe",28),t.k0s()),2&s){const o=t.XpG().$implicit;t.R7$(),t.Y8G("src",o.safeWord,t.f$h)}}function Z(s,b){if(1&s&&(t.j41(0,"div",26),t.nrm(1,"img",29),t.k0s()),2&s){const o=t.XpG().$implicit;t.R7$(),t.Y8G("src",o.safeWord,t.B4B)}}function B(s,b){if(1&s&&(t.j41(0,"div",26)(1,"video",30),t.nrm(2,"source",31),t.EFF(3," Your browser does not support the video tag. "),t.k0s()()),2&s){const o=t.XpG().$implicit;t.R7$(2),t.Y8G("src",o.safeWord,t.B4B)}}function Y(s,b){if(1&s&&(t.j41(0,"div",26)(1,"audio",32),t.nrm(2,"source",33),t.EFF(3," Your browser does not support the audio element. "),t.k0s()()),2&s){const o=t.XpG().$implicit;t.R7$(2),t.Y8G("src",o.safeWord,t.B4B)}}function A(s,b){if(1&s&&(t.j41(0,"div",27)(1,"a",34)(2,"span",35),t.EFF(3),t.k0s()()()),2&s){const o=t.XpG().$implicit;t.R7$(),t.Y8G("href",o.word,t.B4B),t.R7$(2),t.JRh(o.word)}}function M(s,b){if(1&s&&(t.j41(0,"div",27)(1,"span",36),t.EFF(2),t.k0s()()),2&s){const o=t.XpG().$implicit,c=t.XpG(2);t.R7$(),t.Y8G("ngClass",t.eq3(2,G,c.isSingleEmojiOrWord(o))),t.R7$(),t.SpI("",o.trim()," ")}}function O(s,b){if(1&s&&(t.j41(0,"div",25),t.DNE(1,P,2,1,"div",26)(2,Z,2,1,"div",26)(3,B,4,1,"div",26)(4,Y,4,1,"div",26)(5,A,4,2,"div",27)(6,M,3,4,"div",27),t.k0s()),2&s){const o=b.$implicit;t.R7$(),t.vxM("youtube"===o.token?1:-1),t.R7$(),t.vxM("image"===o.token?2:-1),t.R7$(),t.vxM("video"===o.token?3:-1),t.R7$(),t.vxM("audio"===o.token?4:-1),t.R7$(),t.vxM("link"===o.token?5:-1),t.R7$(),t.vxM(o.token?-1:6)}}function W(s,b){if(1&s&&t.Z7z(0,O,7,6,"div",25,S,!0),2&s){const o=t.XpG();t.Dyx(o.parseContent.parseContent(o.item.content))}}let U=(()=>{class s{constructor(){this.user=new t.bkB,this.storageService=(0,t.WQX)(u.n),this.zapService=(0,t.WQX)(T),this.parseContent=(0,t.WQX)(E.m)}openZapDialog(o,c){this.zapService.openZapDialog(o,c)}getProfile(){}isSingleEmojiOrWord(o){const c=o.trim(),i=/^\w+$/.test(c),h=/^[\p{Emoji}]+$/u.test(c);return i||h}static{this.\u0275fac=function(c){return new(c||s)}}static{this.\u0275cmp=t.VBU({type:s,selectors:[["app-post"]],inputs:{item:"item"},outputs:{user:"user"},standalone:!0,features:[t.aNF],decls:64,vars:19,consts:[["expandableCard02","angorCard"],["postCardMenu02","matMenu"],[1,"flex","w-full","flex-col"],[1,"mx-6","mb-4","mt-6","flex","items-center","sm:mx-8"],[3,"userChange","pubkey","avatarUrl","created_at"],["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-3","flex","items-center","sm:mx-5"],["mat-button","",1,"mr-1","px-3"],[1,"text-red-500","icon-size-5",3,"svgIcon"],[1,"ml-2"],[1,"text-blue-500","icon-size-5",3,"svgIcon"],[1,"text-green-500","icon-size-5",3,"svgIcon"],["mat-button","",1,"mr-1","px-3",3,"click"],[1,"text-orange-500","icon-size-5",3,"svgIcon"],[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"],[1,"hidden","flex-auto","sm:flex"],[1,"mt-4","flex","items-center","sm:mt-0"],["mat-button","",1,"px-3","sm:-mr-4",3,"routerLink"],[1,"mr-1"],[1,"inline-block","whitespace-pre-wrap","break-words"],[1,"relative","mb-4","block"],[1,"mx-6","mb-6","mt-2","sm:mx-8"],["width","560","height","315","frameborder","0","allowfullscreen","",3,"src"],["alt","Embedded Image",1,"max-h-140","object-cover",2,"width","100%",3,"src"],["controls","",2,"width","100%"],["type","video/mp4",3,"src"],["controls",""],["type","audio/mpeg",3,"src"],["target","_blank",1,"inline-block","break-words","text-blue-500","underline",3,"href"],[1,"inline-block","break-words"],[1,"inline-block","break-words",3,"ngClass"]],template:function(c,i){if(1&c){const h=t.RV6();t.j41(0,"angor-card",2,0)(2,"div",3)(3,"app-post-profile",4),t.bIt("userChange",function(a){return t.eBV(h),t.Njj(i.user=a)}),t.k0s(),t.j41(4,"button",5),t.nrm(5,"mat-icon",6),t.k0s(),t.j41(6,"mat-menu",null,1)(8,"button",7)(9,"span",8),t.nrm(10,"mat-icon",9),t.j41(11,"span"),t.EFF(12,"Save post"),t.k0s()()(),t.j41(13,"button",7)(14,"span",8),t.nrm(15,"mat-icon",9),t.j41(16,"span"),t.EFF(17,"Hide post"),t.k0s()()(),t.j41(18,"button",7)(19,"span",8),t.nrm(20,"mat-icon",9),t.j41(21,"span"),t.EFF(22,"Snooze for 30 days"),t.k0s()()(),t.j41(23,"button",7)(24,"span",8),t.nrm(25,"mat-icon",9),t.j41(26,"span"),t.EFF(27,"Hide all"),t.k0s()()(),t.nrm(28,"mat-divider",10),t.j41(29,"button",7)(30,"span",8),t.nrm(31,"mat-icon",9),t.j41(32,"span"),t.EFF(33,"Report post"),t.k0s()()(),t.j41(34,"button",7)(35,"span",8),t.nrm(36,"mat-icon",9),t.j41(37,"span"),t.EFF(38,"Turn on notifications for this post"),t.k0s()()()()(),t.DNE(39,W,2,0),t.j41(40,"div",11)(41,"button",12),t.nrm(42,"mat-icon",13),t.j41(43,"span",14),t.EFF(44,"Unlike"),t.k0s()(),t.j41(45,"button",12),t.nrm(46,"mat-icon",15),t.j41(47,"span",14),t.EFF(48,"Comment"),t.k0s()(),t.j41(49,"button",12),t.nrm(50,"mat-icon",16),t.j41(51,"span",14),t.EFF(52,"Share"),t.k0s()(),t.j41(53,"button",17),t.bIt("click",function(){return t.eBV(h),t.Njj(i.openZapDialog(i.item.id,i.user))}),t.nrm(54,"mat-icon",18),t.j41(55,"span",14),t.EFF(56,"Zap"),t.k0s()()(),t.nrm(57,"hr",19),t.j41(58,"div",20),t.nrm(59,"div",21),t.j41(60,"div",22)(61,"button",23)(62,"span",24),t.EFF(63,"Read More ..."),t.k0s()()()()()}if(2&c){const h=t.sdS(7);t.R7$(3),t.Y8G("pubkey",null==i.item?null:i.item.pubkey)("avatarUrl","/images/avatars/avatar-placeholder.png")("created_at",i.item.created_at),t.R7$(),t.Y8G("matMenuTriggerFor",h),t.R7$(),t.Y8G("svgIcon","heroicons_solid:ellipsis-vertical"),t.R7$(5),t.Y8G("svgIcon","heroicons_solid:arrow-up-tray"),t.R7$(5),t.Y8G("svgIcon","heroicons_solid:eye-slash"),t.R7$(5),t.Y8G("svgIcon","heroicons_solid:clock"),t.R7$(5),t.Y8G("svgIcon","heroicons_solid:minus-circle"),t.R7$(6),t.Y8G("svgIcon","heroicons_solid:exclamation-triangle"),t.R7$(5),t.Y8G("svgIcon","heroicons_solid:bell"),t.R7$(3),t.vxM(i.item.content?39:-1),t.R7$(3),t.Y8G("svgIcon","heroicons_solid:heart"),t.R7$(4),t.Y8G("svgIcon","heroicons_solid:chat-bubble-left-ellipsis"),t.R7$(4),t.Y8G("svgIcon","heroicons_solid:share"),t.R7$(4),t.Y8G("svgIcon","heroicons_solid:bolt"),t.R7$(7),t.Y8G("routerLink",t.eq3(17,F,i.item.id))}},dependencies:[y.n,v,j.m_,j.An,$.w,$.q,k.Cn,k.kk,k.fb,k.Cp,g.iI,g.Wk,e.MD,e.YU,_.$z]})}}return s})()},2507:(N,I,r)=>{r.d(I,{r:()=>c});var y=r(467),e=r(4438),t=r(9417),_=r(5351),$=r(5416),j=r(6182),k=r(7673),g=r(9437),p=r(1626);let m=(()=>{class i{constructor(n){this.http=n}getLightning(n){return this.http.get(n).pipe((0,g.W)(a=>(console.error("Failed to fetch Lightning response:",a),(0,k.of)({status:"Failed"}))))}getLightningInvoice(n,a){return this.http.get(`${n}?amount=${a}`).pipe((0,g.W)(d=>(console.error("Failed to fetch Lightning invoice:",d),(0,k.of)({pr:"",status:"Failed"}))))}getLightningAddress(n){try{const[a,l]=n.split("@");return`https://${l}/.well-known/lnurlp/${a}`}catch{return console.error("Invalid Lightning address format:",n),""}}sendZapRequest(n,a,l,d){const f=encodeURIComponent(JSON.stringify(a));return this.http.get(`${n}?amount=${l}&nostr=${f}&lnurl=${d}`).pipe((0,g.W)(C=>(console.error("Failed to send zap request:",C),(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(n){return console.error("WebLN login failed:",n),!1}})()}hasWebln(){return!!window.webln}sendPayment(n){var a=this;return(0,y.A)(function*(){try{return a.hasWebln()?yield window.webln.sendPayment(n):(console.error("WebLN is not available"),null)}catch(l){throw console.error("Payment failed:",l),l}})()}payInvoice(n){var a=this;return(0,y.A)(function*(){if((yield a.login())&&a.hasWebln())try{return!!(yield a.sendPayment(n))}catch(d){return console.error("Failed to pay invoice:",d),!1}return console.error("WebLN not available or login failed"),!1})()}static{this.\u0275fac=function(a){return new(a||i)(e.KVO(p.Qq))}}static{this.\u0275prov=e.jDH({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var u=r(719),v=r(6324),E=r(6231),x=r(8834),D=r(9213),w=r(5398),T=r(177),S=r(1997),F=r(2102),G=r(9042),P=r(2798),Z=r(882),B=r(4823),Y=r(5766),A=r(9706);function M(i,h){if(1&i){const n=e.RV6();e.j41(0,"button",15),e.bIt("click",function(){let l;const d=e.eBV(n).$implicit,f=e.XpG(2);return e.Njj(null==(l=f.sendZapForm.get("amount"))?null:l.setValue(d.value))}),e.j41(1,"mat-icon",16),e.EFF(2),e.k0s(),e.j41(3,"span",17),e.EFF(4),e.k0s()()}if(2&i){const n=h.$implicit;e.R7$(2),e.JRh(n.icon),e.R7$(2),e.JRh(n.label)}}function O(i,h){1&i&&(e.j41(0,"mat-error"),e.EFF(1," Zap amount is required "),e.k0s())}function W(i,h){1&i&&(e.j41(0,"mat-error"),e.EFF(1," Minimum amount is 1 sat "),e.k0s())}function U(i,h){if(1&i){const n=e.RV6();e.j41(0,"mat-dialog-content",5)(1,"div",6),e.DNE(2,M,5,2,"button",7),e.k0s(),e.nrm(3,"mat-divider"),e.j41(4,"div",8)(5,"mat-form-field",9)(6,"mat-label"),e.EFF(7,"Zap Amount"),e.k0s(),e.nrm(8,"input",10),e.j41(9,"mat-hint",11),e.EFF(10,"Amount in sats"),e.k0s(),e.DNE(11,O,2,0,"mat-error",12)(12,W,2,0,"mat-error",12),e.k0s(),e.j41(13,"mat-form-field",9)(14,"mat-label"),e.EFF(15,"Comment"),e.k0s(),e.nrm(16,"input",13),e.j41(17,"mat-hint",11),e.EFF(18),e.k0s()()(),e.j41(19,"mat-dialog-actions",11)(20,"button",14),e.bIt("click",function(){e.eBV(n);const l=e.XpG();return e.Njj(l.onSubmit())}),e.EFF(21," Create Invoice "),e.k0s()()()}if(2&i){let n,a,l;const d=e.XpG();e.R7$(2),e.Y8G("ngForOf",d.zapButtons),e.R7$(2),e.Y8G("formGroup",d.sendZapForm),e.R7$(7),e.Y8G("ngIf",null==(n=d.sendZapForm.get("amount"))?null:n.hasError("required")),e.R7$(),e.Y8G("ngIf",null==(a=d.sendZapForm.get("amount"))?null:a.hasError("min")),e.R7$(6),e.SpI(" ",(null==(l=d.sendZapForm.get("comment"))||null==l.value?null:l.value.length)||0,"/100 "),e.R7$(2),e.Y8G("disabled",d.sendZapForm.invalid)}}function s(i,h){if(1&i&&(e.j41(0,"div",21)(1,"span",22),e.EFF(2),e.k0s(),e.nrm(3,"mat-divider",23)(4,"qrcode",24),e.k0s()),2&i){const n=e.XpG(2);e.R7$(2),e.SpI("Scan with phone to pay (",n.invoiceAmount," sats)"),e.R7$(2),e.Y8G("qrdata",n.lightningInvoice)("matTooltip","Lightning Invoice")("errorCorrectionLevel","M")}}function b(i,h){if(1&i){const n=e.RV6();e.j41(0,"div",25)(1,"mat-form-field",26)(2,"mat-label"),e.EFF(3,"Invoice Address"),e.k0s(),e.nrm(4,"input",27),e.j41(5,"button",28),e.bIt("click",function(){e.eBV(n);const l=e.XpG(2);return e.Njj(l.copyInvoice())}),e.nrm(6,"mat-icon",29),e.k0s()()()}if(2&i){const n=e.XpG(2);e.R7$(4),e.Y8G("value",n.lightningInvoice),e.R7$(),e.Y8G("matTooltip","Copy Invoice"),e.R7$(),e.Y8G("svgIcon","heroicons_outline:clipboard-document")}}function o(i,h){if(1&i&&(e.j41(0,"mat-dialog-content",18),e.DNE(1,s,5,4,"div",19)(2,b,7,3,"div",20),e.k0s()),2&i){const n=e.XpG();e.R7$(),e.Y8G("ngIf",n.displayQRCode),e.R7$(),e.Y8G("ngIf",n.showInvoiceSection&&n.lightningInvoice)}}let c=(()=>{class i{constructor(n){this.util=n,this.formBuilder=(0,e.WQX)(t.ok),this.lightningService=(0,e.WQX)(m),this.signerService=(0,e.WQX)(v.A),this.relayService=(0,e.WQX)(E.b),this.dialogRef=(0,e.WQX)(_.CP),this.snackBar=(0,e.WQX)($.UG),this.clipboard=(0,e.WQX)(j.B0),this.data=(0,e.WQX)(_.Vh),this.lightningInvoice="",this.payRequest=null,this.displayQRCode=!1,this.showInvoiceSection=!1,this.loading=!1,this.invoiceAmount=0,this.error="",this.zapButtons=[{icon:"thumb_up",label:"21",value:21},{icon:"favorite",label:"50",value:50},{icon:"emoji_emotions",label:"100",value:100},{icon:"star",label:"500",value:500},{icon:"celebration",label:"1k",value:1e3},{icon:"rocket",label:"5k",value:5e3},{icon:"local_fire_department",label:"10k",value:1e4},{icon:"flash_on",label:"100k",value:1e5},{icon:"diamond",label:"500k",value:5e5}]}ngOnInit(){this.initializeForm()}initializeForm(){this.sendZapForm=this.formBuilder.group({lightningAddress:[this.data.lud16||this.data.lud06,[t.k0.required,this.validateLightningAddress]],amount:["",[t.k0.required,t.k0.min(1)]],comment:[""]})}validateLightningAddress(n){return n.value.includes("@")?null:{invalidFormat:!0}}onSubmit(){var n=this;return(0,y.A)(function*(){n.sendZapForm.invalid?n.showError("Please fill out the form correctly."):(n.loading=!0,yield n.fetchPayRequest())})()}getCallbackUrl(n){if(n.includes("@")){const[a,l]=n.split("@");return`https://${l}/.well-known/lnurlp/${a}`}return n.toLowerCase().startsWith("lnurl")?this.util.convertBech32ToText(n).toString():null}fetchPayRequest(){var n=this;return(0,y.A)(function*(){n.resetState();const a=n.data.lud16||n.data.lud06;if(!a)return void n.showError("Lightning Address is required.");let l=n.getCallbackUrl(a);try{const d=yield fetch(l);if(!d.ok)throw new Error("Failed to fetch pay request.");const f=yield d.json();if("ERROR"===f.status)return void n.showError(f.reason||"Error fetching the pay request.");n.payRequest=f,n.showInvoiceSection=!1,n.configureAmountValidators(),yield n.generateInvoice()}catch(d){n.showError(d.message||"Error connecting to the server.")}finally{n.loading=!1}})()}generateInvoice(){var n=this;return(0,y.A)(function*(){const a=n.sendZapForm.get("amount")?.value,l=n.sendZapForm.get("comment")?.value,d=n.data.eventId||null;if(!n.payRequest)return void n.showError("Pay request is not loaded.");n.invoiceAmount=a;const f=new URL(n.payRequest.callback),R=new URLSearchParams({amount:(1e3*a).toString()});if(l&&n.payRequest.commentAllowed&&R.set("comment",l),d){const C=yield n.createAndSignZapRequest(d,l);R.set("nostr",JSON.stringify(C))}try{const C=yield fetch(`${f.origin}${f.pathname}?${R.toString()}`);if(!C.ok)throw new Error("Failed to fetch invoice.");const X=yield C.json();if("ERROR"===X.status)return void n.showError(X.reason||"Error fetching the invoice.");n.lightningInvoice=X.pr,n.showInvoiceSection=!0,n.toggleQRCodeDisplay(!0)}catch(C){n.showError(C.message||"Error fetching the invoice.")}})()}configureAmountValidators(){if(!this.payRequest)return;const n=(this.payRequest.minSendable||1e3)/1e3,a=(this.payRequest.maxSendable||21e6)/1e3,l=this.sendZapForm.get("amount");l?.setValidators([t.k0.required,t.k0.min(n),t.k0.max(a)]),l?.updateValueAndValidity()}createAndSignZapRequest(n,a){var l=this;return(0,y.A)(function*(){try{const d=l.createZapRequestData(n,a);let f;if(l.signerService.isUsingSecretKey()){const R=yield l.signerService.getDecryptedSecretKey();if(!R)throw new Error("Private key could not be retrieved.");const C=(0,Y.aT)(R);f=(0,u.pC)(d,C)}else f=yield l.signerService.signEventWithExtension(d);if(!f)throw new Error("Signing failed. Signed event is null.");return f}catch(d){throw console.error("Error creating and signing zap request:",d),new Error("Failed to create and sign zap request.")}})()}createZapRequestData(n,a){return{kind:9734,content:a||"",tags:[["e",n],["p",this.payRequest?.nostrPubkey||""],["relays",...this.relayService.getConnectedRelays()]],pubkey:this.signerService.getPublicKey(),created_at:Math.floor(Date.now()/1e3)}}copyInvoice(){this.lightningInvoice?(this.clipboard.copy(this.lightningInvoice),this.showSuccess("Invoice copied to clipboard")):this.showError("No invoice available to copy")}toggleQRCodeDisplay(n=!1){this.displayQRCode=!!n||!this.displayQRCode}resetState(){this.error="",this.loading=!0,this.lightningInvoice=""}showError(n){this.error=n,this.loading=!1,this.snackBar.open(n,"Dismiss",{duration:2e3})}showSuccess(n){this.snackBar.open(n,"Dismiss",{duration:2e3})}closeDialog(){this.dialogRef.close()}static{this.\u0275fac=function(a){return new(a||i)(e.rXU(A.FP))}}static{this.\u0275cmp=e.VBU({type:i,selectors:[["app-send-dialog"]],standalone:!0,features:[e.aNF],decls:7,vars:4,consts:[[1,"absolute","right-0","top-0","pr-4","pt-4"],["mat-icon-button","","aria-label","Close",3,"matDialogClose"],[1,"text-secondary",3,"svgIcon"],["class","p-0 mt-4",4,"ngIf"],["class","flex flex-col items-center justify-center text-center p-1 mt-4",4,"ngIf"],[1,"p-0","mt-4"],[1,"preset-buttons"],["class","mr-1 px-3","mat-button","",3,"click",4,"ngFor","ngForOf"],[1,"zap-form",3,"formGroup"],["appearance","outline",1,"sats-input"],["matInput","","formControlName","amount","placeholder","Enter amount in sats, e.g., 100","type","number","aria-label","Zap Amount"],["align","end"],[4,"ngIf"],["matInput","","formControlName","comment","placeholder","Optional comment, e.g., as a gift...","aria-label","Comment","maxlength","100"],["mat-raised-button","","color","primary",3,"click","disabled"],["mat-button","",1,"mr-1","px-3",3,"click"],[1,"text-orange-500","icon-size-5"],[1,"ml-2"],[1,"flex","flex-col","items-center","justify-center","text-center","p-1","mt-4"],["class","w-full flex flex-col items-center",4,"ngIf"],["class","w-full max-w-md",4,"ngIf"],[1,"w-full","flex","flex-col","items-center"],[1,"mb-2"],[1,"w-full","mb-4"],[1,"qrcode-image","m-auto",3,"qrdata","matTooltip","errorCorrectionLevel"],[1,"w-full","max-w-md"],["appearance","outline",1,"w-full"],["matInput","","readonly","","aria-label","Invoice Address",3,"value"],["mat-icon-button","","matSuffix","","aria-label","Copy Invoice",3,"click","matTooltip"],[3,"svgIcon"]],template:function(a,l){1&a&&(e.j41(0,"div",0)(1,"button",1),e.nrm(2,"mat-icon",2),e.k0s()(),e.j41(3,"h1"),e.EFF(4,"\u26a1Zap"),e.k0s(),e.DNE(5,U,22,6,"mat-dialog-content",3)(6,o,3,2,"mat-dialog-content",4)),2&a&&(e.R7$(),e.Y8G("matDialogClose",void 0),e.R7$(),e.Y8G("svgIcon","heroicons_outline:x-mark"),e.R7$(3),e.Y8G("ngIf",!l.showInvoiceSection||!l.lightningInvoice),e.R7$(),e.Y8G("ngIf",l.showInvoiceSection&&l.lightningInvoice))},dependencies:[Z.vg,x.Hl,x.$z,x.iY,D.m_,D.An,t.YN,t.me,t.Q0,t.BC,t.cb,t.tU,F.nJ,F.rl,t.X1,t.j4,t.JD,T.MD,T.Sq,T.bT,P.Ve,F.MV,F.TL,F.yw,F.RG,G.fS,G.fg,_.Yi,_.E7,w.f,w.c,S.q,B.oV,_.tx],styles:[".preset-buttons[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;justify-items:center;margin-bottom:20px}.preset-buttons[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{font-size:14px;font-weight:700;display:flex;align-items:center;justify-content:center;max-height:60px!important}.sats-input[_ngcontent-%COMP%]{margin-top:20px;width:100%}.lightning-buttons[_ngcontent-%COMP%]{margin:5px 0}"]})}}return i})()},6182:(N,I,r)=>{r.d(I,{B0:()=>_});var y=r(177),e=r(4438);class t{constructor(p,m){this._document=m;const u=this._textarea=this._document.createElement("textarea"),v=u.style;v.position="fixed",v.top=v.opacity="0",v.left="-999em",u.setAttribute("aria-hidden","true"),u.value=p,u.readOnly=!0,(this._document.fullscreenElement||this._document.body).appendChild(u)}copy(){const p=this._textarea;let m=!1;try{if(p){const u=this._document.activeElement;p.select(),p.setSelectionRange(0,p.value.length),m=this._document.execCommand("copy"),u&&u.focus()}}catch{}return m}destroy(){const p=this._textarea;p&&(p.remove(),this._textarea=void 0)}}let _=(()=>{class g{constructor(m){this._document=m}copy(m){const u=this.beginCopy(m),v=u.copy();return u.destroy(),v}beginCopy(m){return new t(m,this._document)}static{this.\u0275fac=function(u){return new(u||g)(e.KVO(y.qQ))}}static{this.\u0275prov=e.jDH({token:g,factory:g.\u0275fac,providedIn:"root"})}}return g})()}}]); \ No newline at end of file diff --git a/index.html b/index.html index 5472229..a5fd448 100644 --- a/index.html +++ b/index.html @@ -41,5 +41,5 @@ - + diff --git a/ngsw.json b/ngsw.json index badc072..4127f9b 100644 --- a/ngsw.json +++ b/ngsw.json @@ -1,6 +1,6 @@ { "configVersion": 1, - "timestamp": 1731573957518, + "timestamp": 1731574081499, "index": "/index.html", "assetGroups": [], "dataGroups": [], diff --git a/runtime.e53738bc4c5e7108.js b/runtime.7f93af8b65b28265.js similarity index 59% rename from runtime.e53738bc4c5e7108.js rename to runtime.7f93af8b65b28265.js index c0f2179..83461f8 100644 --- a/runtime.e53738bc4c5e7108.js +++ b/runtime.7f93af8b65b28265.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[c]))?a.splice(c--,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:"f5eff9f0fb41d2a5",57:"344f315dd5c6f584",76:"03a793f7dff21ff4",96:"63ffb306f6cc4cf6",190:"35d506b6b0cdfe18",218:"54ab485af9f1c101",258:"74e10dcd2177d092",307:"0d2dc6d8646989b4",364:"352dcb18a587bd74",408:"44ab5c4c49586401",450:"6b828714c4539eff",514:"9c340e033925930a",539:"af0130483732a56f",541:"1f78b02e4fe053bd",551:"e12e45c28bc44f03",588:"380d9cba851daca3",632:"616768ba8230661a",706:"f94f8011d50aa043",770:"ad7e41f782174dcc",865:"e320a31fbe74bda0"}[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 c=document.getElementsByTagName("script"),l=0;l{t.onerror=t.onload=null,clearTimeout(s);var h=e[a];if(delete e[a],t.parentNode&&t.parentNode.removeChild(t),h&&h.forEach(_=>_(p)),m)return m(p)},s=setTimeout(b.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=b.bind(null,t.onerror),t.onload=b.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((d,b)=>f=e[i]=[d,b]);o.push(f[2]=t);var u=r.p+r.u(i),c=new Error;r.l(u,d=>{if(r.o(e,i)&&(0!==(f=e[i])&&(e[i]=void 0),f)){var b=d&&("load"===d.type?"missing":d.type),s=d&&d.target&&d.target.src;c.message="Loading chunk "+i+" failed.\n("+b+": "+s+")",c.name="ChunkLoadError",c.type=b,c.request=s,f[1](c)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var n=(i,o)=>{var c,l,[f,t,u]=o,d=0;if(f.some(s=>0!==e[s])){for(c in t)r.o(t,c)&&(r.m[c]=t[c]);if(u)var b=u(r)}for(i&&i(o);d{"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,c)=>{if(!a){var t=1/0;for(f=0;f=c)&&Object.keys(r.O).every(p=>r.O[p](a[o]))?a.splice(o--,1):(u=!1,c0&&e[f-1][2]>c;f--)e[f]=e[f-1];e[f]=[a,i,c]},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:"f5eff9f0fb41d2a5",57:"3d93a953c8d5a9a3",76:"03a793f7dff21ff4",96:"63ffb306f6cc4cf6",190:"35d506b6b0cdfe18",218:"54ab485af9f1c101",258:"74e10dcd2177d092",307:"0d2dc6d8646989b4",364:"352dcb18a587bd74",408:"44ab5c4c49586401",450:"6b828714c4539eff",514:"9c340e033925930a",539:"af0130483732a56f",541:"1f78b02e4fe053bd",551:"e12e45c28bc44f03",588:"380d9cba851daca3",632:"616768ba8230661a",706:"f94f8011d50aa043",770:"ad7e41f782174dcc",865:"e320a31fbe74bda0"}[e]+".js",r.miniCssF=e=>{},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="angor:";r.l=(a,i,c,f)=>{if(e[a])e[a].push(i);else{var t,u;if(void 0!==c)for(var o=document.getElementsByTagName("script"),l=0;l{t.onerror=t.onload=null,clearTimeout(s);var h=e[a];if(delete e[a],t.parentNode&&t.parentNode.removeChild(t),h&&h.forEach(_=>_(p)),m)return m(p)},s=setTimeout(b.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=b.bind(null,t.onerror),t.onload=b.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,c)=>{var f=r.o(e,i)?e[i]:void 0;if(0!==f)if(f)c.push(f[2]);else if(121!=i){var t=new Promise((d,b)=>f=e[i]=[d,b]);c.push(f[2]=t);var u=r.p+r.u(i),o=new Error;r.l(u,d=>{if(r.o(e,i)&&(0!==(f=e[i])&&(e[i]=void 0),f)){var b=d&&("load"===d.type?"missing":d.type),s=d&&d.target&&d.target.src;o.message="Loading chunk "+i+" failed.\n("+b+": "+s+")",o.name="ChunkLoadError",o.type=b,o.request=s,f[1](o)}},"chunk-"+i,i)}else e[i]=0},r.O.j=i=>0===e[i];var n=(i,c)=>{var o,l,[f,t,u]=c,d=0;if(f.some(s=>0!==e[s])){for(o in t)r.o(t,o)&&(r.m[o]=t[o]);if(u)var b=u(r)}for(i&&i(c);d