{"ast":null,"code":"import _asyncToGenerator from \"/home/mleku/src/orly.dev/next/signer/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { inject } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { IconButtonComponent, NavComponent, NostrHelper, StorageService, ToastComponent } from '@common';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"@angular/forms\";\nfunction KeysComponent_Conditional_4_Template(rf, ctx) {\n  if (rf & 1) {\n    const _r2 = i0.ɵɵgetCurrentView();\n    i0.ɵɵelementStart(0, \"span\");\n    i0.ɵɵtext(1, \"Public Key\");\n    i0.ɵɵelementEnd();\n    i0.ɵɵelementStart(2, \"div\", 8)(3, \"span\", 9);\n    i0.ɵɵtext(4, \"NPUB\");\n    i0.ɵɵelementEnd();\n    i0.ɵɵelementStart(5, \"div\", 10);\n    i0.ɵɵelement(6, \"input\", 11, 1);\n    i0.ɵɵelementStart(8, \"button\", 12);\n    i0.ɵɵlistener(\"click\", function KeysComponent_Conditional_4_Template_button_click_8_listener() {\n      i0.ɵɵrestoreView(_r2);\n      const ctx_r2 = i0.ɵɵnextContext();\n      const toast_r4 = i0.ɵɵreference(6);\n      ctx_r2.copyToClipboard(ctx_r2.identity.pubkeyNpub);\n      return i0.ɵɵresetView(toast_r4.show(\"Copied to clipboard\"));\n    });\n    i0.ɵɵelement(9, \"i\", 13);\n    i0.ɵɵelementEnd()()();\n    i0.ɵɵelementStart(10, \"div\", 8)(11, \"span\", 9);\n    i0.ɵɵtext(12, \"HEX\");\n    i0.ɵɵelementEnd();\n    i0.ɵɵelementStart(13, \"div\", 10);\n    i0.ɵɵelement(14, \"input\", 14, 2);\n    i0.ɵɵelementStart(16, \"button\", 12);\n    i0.ɵɵlistener(\"click\", function KeysComponent_Conditional_4_Template_button_click_16_listener() {\n      i0.ɵɵrestoreView(_r2);\n      const ctx_r2 = i0.ɵɵnextContext();\n      const toast_r4 = i0.ɵɵreference(6);\n      ctx_r2.copyToClipboard(ctx_r2.identity.pubkeyHex);\n      return i0.ɵɵresetView(toast_r4.show(\"Copied to clipboard\"));\n    });\n    i0.ɵɵelement(17, \"i\", 13);\n    i0.ɵɵelementEnd()()();\n    i0.ɵɵelementStart(18, \"span\", 15);\n    i0.ɵɵtext(19, \"Private Key\");\n    i0.ɵɵelementEnd();\n    i0.ɵɵelementStart(20, \"div\", 8)(21, \"span\", 9);\n    i0.ɵɵtext(22, \"NSEC\");\n    i0.ɵɵelementEnd();\n    i0.ɵɵelementStart(23, \"div\", 10);\n    i0.ɵɵelement(24, \"input\", 16, 3);\n    i0.ɵɵelementStart(26, \"button\", 12);\n    i0.ɵɵlistener(\"click\", function KeysComponent_Conditional_4_Template_button_click_26_listener() {\n      i0.ɵɵrestoreView(_r2);\n      const ctx_r2 = i0.ɵɵnextContext();\n      const toast_r4 = i0.ɵɵreference(6);\n      ctx_r2.copyToClipboard(ctx_r2.identity.privkeyNsec);\n      return i0.ɵɵresetView(toast_r4.show(\"Copied to clipboard\"));\n    });\n    i0.ɵɵelement(27, \"i\", 13);\n    i0.ɵɵelementEnd();\n    i0.ɵɵelementStart(28, \"button\", 12);\n    i0.ɵɵlistener(\"click\", function KeysComponent_Conditional_4_Template_button_click_28_listener() {\n      i0.ɵɵrestoreView(_r2);\n      const privkeyNsecInput_r5 = i0.ɵɵreference(25);\n      const ctx_r2 = i0.ɵɵnextContext();\n      return i0.ɵɵresetView(ctx_r2.toggleType(privkeyNsecInput_r5));\n    });\n    i0.ɵɵelement(29, \"i\", 17);\n    i0.ɵɵelementEnd()()();\n    i0.ɵɵelementStart(30, \"div\", 8)(31, \"span\", 9);\n    i0.ɵɵtext(32, \"HEX\");\n    i0.ɵɵelementEnd();\n    i0.ɵɵelementStart(33, \"div\", 10);\n    i0.ɵɵelement(34, \"input\", 18, 4);\n    i0.ɵɵelementStart(36, \"button\", 12);\n    i0.ɵɵlistener(\"click\", function KeysComponent_Conditional_4_Template_button_click_36_listener() {\n      i0.ɵɵrestoreView(_r2);\n      const ctx_r2 = i0.ɵɵnextContext();\n      const toast_r4 = i0.ɵɵreference(6);\n      ctx_r2.copyToClipboard(ctx_r2.identity.privkeyHex);\n      return i0.ɵɵresetView(toast_r4.show(\"Copied to clipboard\"));\n    });\n    i0.ɵɵelement(37, \"i\", 13);\n    i0.ɵɵelementEnd();\n    i0.ɵɵelementStart(38, \"button\", 12);\n    i0.ɵɵlistener(\"click\", function KeysComponent_Conditional_4_Template_button_click_38_listener() {\n      i0.ɵɵrestoreView(_r2);\n      const privkeyHexInput_r6 = i0.ɵɵreference(35);\n      const ctx_r2 = i0.ɵɵnextContext();\n      return i0.ɵɵresetView(ctx_r2.toggleType(privkeyHexInput_r6));\n    });\n    i0.ɵɵelement(39, \"i\", 17);\n    i0.ɵɵelementEnd()()();\n    i0.ɵɵelementStart(40, \"span\", 15);\n    i0.ɵɵtext(41, \"Encrypted Key (NIP-49)\");\n    i0.ɵɵelementEnd();\n    i0.ɵɵelementStart(42, \"button\", 19);\n    i0.ɵɵlistener(\"click\", function KeysComponent_Conditional_4_Template_button_click_42_listener() {\n      i0.ɵɵrestoreView(_r2);\n      const ctx_r2 = i0.ɵɵnextContext();\n      return i0.ɵɵresetView(ctx_r2.navigateToNcryptsec());\n    });\n    i0.ɵɵtext(43, \" Get ncryptsec\\n\");\n    i0.ɵɵelementEnd();\n  }\n  if (rf & 2) {\n    const pubkeyNpubInput_r7 = i0.ɵɵreference(7);\n    const pubkeyHexInput_r8 = i0.ɵɵreference(15);\n    const privkeyNsecInput_r5 = i0.ɵɵreference(25);\n    const privkeyHexInput_r6 = i0.ɵɵreference(35);\n    const ctx_r2 = i0.ɵɵnextContext();\n    i0.ɵɵadvance(6);\n    i0.ɵɵproperty(\"ngModel\", ctx_r2.identity.pubkeyNpub)(\"readOnly\", true);\n    i0.ɵɵadvance(3);\n    i0.ɵɵclassProp(\"bi-eye\", pubkeyNpubInput_r7.type === \"password\")(\"bi-eye-slash\", pubkeyNpubInput_r7.type === \"text\");\n    i0.ɵɵadvance(5);\n    i0.ɵɵproperty(\"ngModel\", ctx_r2.identity.pubkeyHex)(\"readOnly\", true);\n    i0.ɵɵadvance(3);\n    i0.ɵɵclassProp(\"bi-eye\", pubkeyHexInput_r8.type === \"password\")(\"bi-eye-slash\", pubkeyHexInput_r8.type === \"text\");\n    i0.ɵɵadvance(7);\n    i0.ɵɵproperty(\"ngModel\", ctx_r2.identity.privkeyNsec)(\"readOnly\", true);\n    i0.ɵɵadvance(5);\n    i0.ɵɵclassProp(\"bi-eye\", privkeyNsecInput_r5.type === \"password\")(\"bi-eye-slash\", privkeyNsecInput_r5.type === \"text\");\n    i0.ɵɵadvance(5);\n    i0.ɵɵproperty(\"ngModel\", ctx_r2.identity.privkeyHex)(\"readOnly\", true);\n    i0.ɵɵadvance(5);\n    i0.ɵɵclassProp(\"bi-eye\", privkeyHexInput_r6.type === \"password\")(\"bi-eye-slash\", privkeyHexInput_r6.type === \"text\");\n  }\n}\nexport let KeysComponent = /*#__PURE__*/(() => {\n  class KeysComponent extends NavComponent {\n    identity;\n    #activatedRoute = inject(ActivatedRoute);\n    #storage = inject(StorageService);\n    #router = inject(Router);\n    ngOnInit() {\n      const identityId = this.#activatedRoute.parent?.snapshot.params['id'];\n      if (!identityId) {\n        return;\n      }\n      this.#initialize(identityId);\n    }\n    copyToClipboard(text) {\n      navigator.clipboard.writeText(text);\n    }\n    toggleType(element) {\n      if (element.type === 'password') {\n        element.type = 'text';\n      } else {\n        element.type = 'password';\n      }\n    }\n    navigateToNcryptsec() {\n      if (!this.identity) return;\n      this.#router.navigateByUrl(`/edit-identity/${this.identity.id}/ncryptsec`);\n    }\n    #initialize(identityId) {\n      var _this = this;\n      return _asyncToGenerator(function* () {\n        const identity = _this.#storage.getBrowserSessionHandler().browserSessionData?.identities.find(x => x.id === identityId);\n        if (!identity) {\n          return;\n        }\n        const pubkey = NostrHelper.pubkeyFromPrivkey(identity.privkey);\n        _this.identity = {\n          id: identity.id,\n          nick: identity.nick,\n          privkeyHex: identity.privkey,\n          privkeyNsec: NostrHelper.privkey2nsec(identity.privkey),\n          pubkeyHex: pubkey,\n          pubkeyNpub: NostrHelper.pubkey2npub(pubkey)\n        };\n      })();\n    }\n    static ɵfac = /*@__PURE__*/(() => {\n      let ɵKeysComponent_BaseFactory;\n      return function KeysComponent_Factory(__ngFactoryType__) {\n        return (ɵKeysComponent_BaseFactory || (ɵKeysComponent_BaseFactory = i0.ɵɵgetInheritedFactory(KeysComponent)))(__ngFactoryType__ || KeysComponent);\n      };\n    })();\n    static ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n      type: KeysComponent,\n      selectors: [[\"app-keys\"]],\n      features: [i0.ɵɵInheritDefinitionFeature],\n      decls: 7,\n      vars: 2,\n      consts: [[\"toast\", \"\"], [\"pubkeyNpubInput\", \"\"], [\"pubkeyHexInput\", \"\"], [\"privkeyNsecInput\", \"\"], [\"privkeyHexInput\", \"\"], [1, \"header-pane\"], [\"icon\", \"chevron-left\", 3, \"click\"], [3, \"bottom\"], [1, \"sam-mt-h\", \"sam-flex-row\", \"gap\"], [1, \"text-muted\", 2, \"width\", \"48px\"], [1, \"input-group\"], [\"id\", \"pubkeyNpubInput\", \"type\", \"text\", 1, \"form-control\", 3, \"ngModel\", \"readOnly\"], [\"type\", \"button\", 1, \"btn\", \"btn-outline-secondary\", 3, \"click\"], [1, \"bi\", \"bi-copy\"], [\"id\", \"pubkeyHexInput\", \"type\", \"text\", 1, \"form-control\", 3, \"ngModel\", \"readOnly\"], [1, \"sam-mt-2\"], [\"id\", \"privkeyNsecInput\", \"type\", \"password\", 1, \"form-control\", 3, \"ngModel\", \"readOnly\"], [1, \"bi\", \"bi-eye\"], [\"id\", \"privkeyHexInput\", \"type\", \"password\", 1, \"form-control\", 3, \"ngModel\", \"readOnly\"], [1, \"btn\", \"btn-primary\", \"sam-mt-h\", 3, \"click\"]],\n      template: function KeysComponent_Template(rf, ctx) {\n        if (rf & 1) {\n          const _r1 = i0.ɵɵgetCurrentView();\n          i0.ɵɵelementStart(0, \"div\", 5)(1, \"lib-icon-button\", 6);\n          i0.ɵɵlistener(\"click\", function KeysComponent_Template_lib_icon_button_click_1_listener() {\n            i0.ɵɵrestoreView(_r1);\n            return i0.ɵɵresetView(ctx.navigateBack());\n          });\n          i0.ɵɵelementEnd();\n          i0.ɵɵelementStart(2, \"span\");\n          i0.ɵɵtext(3, \"Keys\");\n          i0.ɵɵelementEnd()();\n          i0.ɵɵtemplate(4, KeysComponent_Conditional_4_Template, 44, 24);\n          i0.ɵɵelement(5, \"lib-toast\", 7, 0);\n        }\n        if (rf & 2) {\n          i0.ɵɵadvance(4);\n          i0.ɵɵconditional(ctx.identity ? 4 : -1);\n          i0.ɵɵadvance();\n          i0.ɵɵproperty(\"bottom\", 16);\n        }\n      },\n      dependencies: [IconButtonComponent, FormsModule, i1.DefaultValueAccessor, i1.NgControlStatus, i1.NgModel, ToastComponent],\n      styles: [\"[_nghost-%COMP%] {\\n  height: 100%;\\n  overflow-y: auto;\\n  display: flex;\\n  flex-direction: column;\\n  padding-left: var(--size);\\n  padding-right: var(--size);\\n}\\n[_nghost-%COMP%]   .header-pane[_ngcontent-%COMP%] {\\n  display: flex;\\n  flex-direction: row;\\n  column-gap: var(--size-h);\\n  align-items: center;\\n  padding-bottom: var(--size);\\n  background-color: var(--background);\\n  position: sticky;\\n  top: 0;\\n}\"]\n    });\n  }\n  return KeysComponent;\n})();","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}