{"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 { Router } from '@angular/router';\nimport { StartupService, StorageService } from '@common';\nimport { getNewStorageServiceConfig } from '../../../common/data/get-new-storage-service-config';\nimport * as i0 from \"@angular/core\";\nexport let HomeComponent = /*#__PURE__*/(() => {\n  class HomeComponent {\n    router = inject(Router);\n    #storage = inject(StorageService);\n    #startup = inject(StartupService);\n    onUploadAndImport(event) {\n      var _this = this;\n      return _asyncToGenerator(function* () {\n        const file = event.target.files?.[0];\n        if (!file) return;\n        try {\n          const text = yield file.text();\n          const vault = JSON.parse(text);\n          yield _this.#storage.deleteVault(true);\n          yield _this.#storage.importVault(vault);\n          _this.#storage.isInitialized = false;\n          _this.#startup.startOver(getNewStorageServiceConfig());\n        } catch (error) {\n          console.log(error);\n        }\n      })();\n    }\n    static ɵfac = function HomeComponent_Factory(__ngFactoryType__) {\n      return new (__ngFactoryType__ || HomeComponent)();\n    };\n    static ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n      type: HomeComponent,\n      selectors: [[\"app-vault-create-home\"]],\n      decls: 18,\n      vars: 0,\n      consts: [[1, \"vertically-centered\"], [1, \"sam-flex-column\", \"center\"], [1, \"sam-flex-column\", \"gap\", 2, \"align-items\", \"center\"], [1, \"title\"], [1, \"logo-frame\"], [\"src\", \"logo.svg\", \"height\", \"120\", \"width\", \"120\", \"alt\", \"\"], [\"type\", \"button\", 1, \"sam-mt-2\", \"btn\", \"btn-primary\", 3, \"click\"], [1, \"sam-flex-row\", \"gap-h\"], [1, \"bi\", \"bi-plus-circle\", 2, \"height\", \"22px\"], [1, \"sam-text-muted\"], [1, \"btn\", \"btn-secondary\"], [1, \"bi\", \"bi-upload\"], [\"type\", \"file\", \"accept\", \".json\", 1, \"file-input\", 3, \"change\"]],\n      template: function HomeComponent_Template(rf, ctx) {\n        if (rf & 1) {\n          i0.ɵɵelementStart(0, \"div\", 0)(1, \"div\", 1)(2, \"div\", 2)(3, \"span\", 3);\n          i0.ɵɵtext(4, \"Smesh Signer\");\n          i0.ɵɵelementEnd();\n          i0.ɵɵelementStart(5, \"div\", 4);\n          i0.ɵɵelement(6, \"img\", 5);\n          i0.ɵɵelementEnd();\n          i0.ɵɵelementStart(7, \"button\", 6);\n          i0.ɵɵlistener(\"click\", function HomeComponent_Template_button_click_7_listener() {\n            return ctx.router.navigateByUrl(\"/vault-create/new\");\n          });\n          i0.ɵɵelementStart(8, \"div\", 7);\n          i0.ɵɵelement(9, \"i\", 8);\n          i0.ɵɵelementStart(10, \"span\");\n          i0.ɵɵtext(11, \"Create a new vault\");\n          i0.ɵɵelementEnd()()();\n          i0.ɵɵelementStart(12, \"span\", 9);\n          i0.ɵɵtext(13, \"or\");\n          i0.ɵɵelementEnd();\n          i0.ɵɵelementStart(14, \"label\", 10);\n          i0.ɵɵelement(15, \"i\", 11);\n          i0.ɵɵtext(16, \" Import vault from file \");\n          i0.ɵɵelementStart(17, \"input\", 12);\n          i0.ɵɵlistener(\"change\", function HomeComponent_Template_input_change_17_listener($event) {\n            return ctx.onUploadAndImport($event);\n          });\n          i0.ɵɵelementEnd()()()()();\n        }\n      },\n      styles: [\"[_nghost-%COMP%] {\\n  height: 100%;\\n  display: flex;\\n  flex-direction: column;\\n}\\n[_nghost-%COMP%]   .vertically-centered[_ngcontent-%COMP%] {\\n  height: 100%;\\n  display: flex;\\n  justify-content: center;\\n  align-items: center;\\n}\\n[_nghost-%COMP%]   .title[_ngcontent-%COMP%] {\\n  font-size: 20px;\\n  font-weight: 500;\\n  margin-bottom: var(--size);\\n}\\n[_nghost-%COMP%]   .sync-note[_ngcontent-%COMP%] {\\n  font-size: 12px;\\n  text-align: center;\\n}\\n[_nghost-%COMP%]   .link-btn[_ngcontent-%COMP%] {\\n  background: transparent;\\n  border: none;\\n  color: var(--muted-foreground);\\n  font-size: 0.8rem;\\n  cursor: pointer;\\n  padding: 4px 8px;\\n  margin-top: 4px;\\n}\\n[_nghost-%COMP%]   .link-btn[_ngcontent-%COMP%]:hover {\\n  color: var(--foreground);\\n  text-decoration: underline;\\n}\\n[_nghost-%COMP%]   .file-input[_ngcontent-%COMP%] {\\n  position: absolute;\\n  visibility: hidden;\\n}\"]\n    });\n  }\n  return HomeComponent;\n})();","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}