UNPKG

@peculiar/fortify-webcomponents

Version:

Web-components for creating CSR or Certificate and viewing certificates list using Fortify

45 lines 28.1 kB
var __awaiter=this&&this.__awaiter||function(t,e,a,r){function o(t){return t instanceof a?t:new a((function(e){e(t)}))}return new(a||(a=Promise))((function(a,i){function n(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r["throw"](t))}catch(t){i(t)}}function s(t){t.done?a(t.value):o(t.value).then(n,c)}s((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,n=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return n.next=c(0),n["throw"]=c(1),n["return"]=c(2),typeof Symbol==="function"&&(n[Symbol.iterator]=function(){return this}),n;function c(t){return function(e){return s([t,e])}}function s(c){if(r)throw new TypeError("Generator is already executing.");while(n&&(n=0,c[0]&&(a=0)),a)try{if(r=1,o&&(i=c[0]&2?o["return"]:c[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;if(o=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:a.label++;return{value:c[1],done:false};case 5:a.label++;o=c[1];c=[0];continue;case 7:c=a.ops.pop();a.trys.pop();continue;default:if(!(i=a.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){a=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(c[0]===6&&a.label<i[1]){a.label=i[1];i=c;break}if(i&&a.label<i[2]){a.label=i[2];a.ops.push(c);break}if(i[2])a.ops.pop();a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t];o=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,e,a){if(a||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++){if(i||!(r in e)){if(!i)i=Array.prototype.slice.call(e,0,r);i[r]=e[r]}}return t.concat(i||Array.prototype.slice.call(e))}; /*! * © Peculiar Ventures https://peculiarventures.com/ - BSD 3-Clause License */import{h,r as registerInstance,c as createEvent,H as Host}from"./index-BA3hMeq-.js";import{X as X509Certificate}from"./x509_certificate-pTmrnePc.js";import{bj as l10n,bk as dateShort,bl as OIDs}from"./ssh_certificate-CDwMJyak.js";import{T as Typography}from"./typography-BgpGT7g-.js";import{B as Button}from"./button-Dh0mVZGn.js";import{D as DownloadIcon}from"./download-D2awqjja.js";import{A as ArrowTopIcon,a as ArrowBottomIcon}from"./arrow_top-1RC-EMIC.js";import"./utils-Bx6Iov6q.js"; /*! * © Peculiar Ventures https://peculiarventures.com/ - MIT License */ /** * @license * Copyright (c) Peculiar Ventures, LLC. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var CertificateSummary=function(t){var e=t.certificate,a=t.showIssuer;var r=function(t,e){return h("tr",null,h("td",null,h(Typography,{variant:"b2",color:"gray-9"},t)),h("td",null,h(Typography,{variant:"b2",color:"black"},e)))};return h("table",null,h("tbody",null,r(l10n.getString("subjectName"),e.subjectToString()),a&&r(l10n.getString("issuerName"),e.issuerToString()),r(l10n.getString("serialNumber"),e.serialNumber),r(l10n.getString("version"),e.version),r(l10n.getString("validity"),e.validity),r(l10n.getString("issued"),dateShort(e.notBefore)),r(l10n.getString("expired"),dateShort(e.notAfter))))}; /*! * © Peculiar Ventures https://peculiarventures.com/ - MIT License */ /** * @license * Copyright (c) Peculiar Ventures, LLC. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var DetailsIcon=function(t){var e=t.color,a=e===void 0?"secondary":e;return h("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"31",fill:"none"},h("path",{fill:"var(--pv-color-".concat(a,")"),d:"M6.71 19.79a1 1 0 0 0-.33-.21 1 1 0 0 0-.76 0 1 1 0 0 0-.33.21 1 1 0 0 0-.21.33 1 1 0 0 0 .21 1.09c.097.088.209.16.33.21a.94.94 0 0 0 .76 0 1.15 1.15 0 0 0 .33-.21 1 1 0 0 0 .21-1.09 1 1 0 0 0-.21-.33ZM10 11.5h14a1 1 0 0 0 0-2H10a1 1 0 0 0 0 2Zm-3.29 3.29a1 1 0 0 0-1.09-.21 1.15 1.15 0 0 0-.33.21 1 1 0 0 0-.21.33.94.94 0 0 0 0 .76c.05.121.122.233.21.33.097.088.209.16.33.21a.94.94 0 0 0 .76 0 1.15 1.15 0 0 0 .33-.21 1.15 1.15 0 0 0 .21-.33.94.94 0 0 0 0-.76 1 1 0 0 0-.21-.33ZM24 14.5H10a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2ZM6.71 9.79a1 1 0 0 0-.33-.21 1 1 0 0 0-1.09.21 1.15 1.15 0 0 0-.21.33.94.94 0 0 0 0 .76c.05.121.122.233.21.33.097.088.209.16.33.21a1 1 0 0 0 1.09-.21 1.15 1.15 0 0 0 .21-.33.94.94 0 0 0 0-.76 1.15 1.15 0 0 0-.21-.33ZM24 19.5H10a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2Z"}))}; /*! * © Peculiar Ventures https://peculiarventures.com/ - MIT License */ /** * @license * Copyright (c) Peculiar Ventures, LLC. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var LinkIcon=function(t){var e=t.color,a=e===void 0?"secondary":e;return h("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"31",fill:"none"},h("path",{fill:"var(--pv-color-".concat(a,")"),d:"M21 14.32a1 1 0 0 0-1 1v7.18a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-11a1 1 0 0 1 1-1h7.18a1 1 0 0 0 0-2H8a3 3 0 0 0-3 3v11a3 3 0 0 0 3 3h11a3 3 0 0 0 3-3v-7.18a1 1 0 0 0-1-1Zm3.92-8.2a1 1 0 0 0-.54-.54A1 1 0 0 0 24 5.5h-6a1 1 0 1 0 0 2h3.59l-10.3 10.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219L23 8.91v3.59a1 1 0 0 0 2 0v-6a1.001 1.001 0 0 0-.08-.38Z"}))}; /*! * © Peculiar Ventures https://peculiarventures.com/ - MIT License */ /** * @license * Copyright (c) Peculiar Ventures, LLC. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var CrossIcon=function(t){var e=t.color,a=e===void 0?"gray-9":e;return h("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",fill:"none"},h("path",{fill:"var(--pv-color-".concat(a,")"),"fill-rule":"evenodd",d:"m16.37 15 5.442 5.44c.25.252.25.663 0 .914l-.459.457a.646.646 0 0 1-.913 0L15 16.371l-5.44 5.44a.648.648 0 0 1-.915 0l-.457-.457a.649.649 0 0 1 0-.913L13.63 15 8.188 9.56a.649.649 0 0 1 0-.914l.457-.457a.648.648 0 0 1 .915 0l5.44 5.44 5.44-5.44a.646.646 0 0 1 .913 0l.46.457c.25.25.25.662 0 .913L16.37 15Z","clip-rule":"evenodd"}))};var certificatesViewerCss=function(){return"*{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-moz-text-size-adjust:none;-ms-text-size-adjust:none;text-size-adjust:none;-webkit-text-size-adjust:none;-webkit-tap-highlight-color:transparent;font-family:var(--pv-font-family, inherit)}.t-h1{font-weight:var(--pv-text-h1-weight);font-size:var(--pv-text-h1-size);line-height:var(--pv-text-h1-height);letter-spacing:var(--pv-text-h1-spacing)}.t-h2{font-weight:var(--pv-text-h2-weight);font-size:var(--pv-text-h2-size);line-height:var(--pv-text-h2-height);letter-spacing:var(--pv-text-h2-spacing)}.t-h3{font-weight:var(--pv-text-h3-weight);font-size:var(--pv-text-h3-size);line-height:var(--pv-text-h3-height);letter-spacing:var(--pv-text-h3-spacing)}.t-h4{font-weight:var(--pv-text-h4-weight);font-size:var(--pv-text-h4-size);line-height:var(--pv-text-h4-height);letter-spacing:var(--pv-text-h4-spacing)}.t-h5{font-weight:var(--pv-text-h5-weight);font-size:var(--pv-text-h5-size);line-height:var(--pv-text-h5-height);letter-spacing:var(--pv-text-h5-spacing)}.t-s1{font-weight:var(--pv-text-s1-weight);font-size:var(--pv-text-s1-size);line-height:var(--pv-text-s1-height);letter-spacing:var(--pv-text-s1-spacing)}.t-s2{font-weight:var(--pv-text-s2-weight);font-size:var(--pv-text-s2-size);line-height:var(--pv-text-s2-height);letter-spacing:var(--pv-text-s2-spacing)}.t-b1{font-weight:var(--pv-text-b1-weight);font-size:var(--pv-text-b1-size);line-height:var(--pv-text-b1-height);letter-spacing:var(--pv-text-b1-spacing)}.t-b2{font-weight:var(--pv-text-b2-weight);font-size:var(--pv-text-b2-size);line-height:var(--pv-text-b2-height);letter-spacing:var(--pv-text-b2-spacing)}.t-b3{font-weight:var(--pv-text-b3-weight);font-size:var(--pv-text-b3-size);line-height:var(--pv-text-b3-height);letter-spacing:var(--pv-text-b3-spacing)}.t-btn1{font-weight:var(--pv-text-btn1-weight);font-size:var(--pv-text-btn1-size);line-height:var(--pv-text-btn1-height);letter-spacing:var(--pv-text-btn1-spacing)}.t-btn2{font-weight:var(--pv-text-btn2-weight);font-size:var(--pv-text-btn2-size);line-height:var(--pv-text-btn2-height);letter-spacing:var(--pv-text-btn2-spacing)}.t-c1{font-weight:var(--pv-text-c1-weight);font-size:var(--pv-text-c1-size);line-height:var(--pv-text-c1-height);letter-spacing:var(--pv-text-c1-spacing)}.t-c2{font-weight:var(--pv-text-c2-weight);font-size:var(--pv-text-c2-size);line-height:var(--pv-text-c2-height);letter-spacing:var(--pv-text-c2-spacing)}.c-primary-tint-5{--pv-color-base:var(--pv-color-primary-tint-5)}.c-primary-tint-4{--pv-color-base:var(--pv-color-primary-tint-4)}.c-primary-tint-3{--pv-color-base:var(--pv-color-primary-tint-3)}.c-primary-tint-2{--pv-color-base:var(--pv-color-primary-tint-2)}.c-primary-tint-1{--pv-color-base:var(--pv-color-primary-tint-1)}.c-primary{--pv-color-base:var(--pv-color-primary)}.c-primary-shade-1{--pv-color-base:var(--pv-color-primary-shade-1)}.c-primary-shade-2{--pv-color-base:var(--pv-color-primary-shade-2)}.c-primary-shade-3{--pv-color-base:var(--pv-color-primary-shade-3)}.c-primary-shade-4{--pv-color-base:var(--pv-color-primary-shade-4)}.c-primary-shade-5{--pv-color-base:var(--pv-color-primary-shade-5)}.c-primary-contrast{--pv-color-base:var(--pv-color-primary-contrast)}.c-secondary-tint-5{--pv-color-base:var(--pv-color-secondary-tint-5)}.c-secondary-tint-4{--pv-color-base:var(--pv-color-secondary-tint-4)}.c-secondary-tint-3{--pv-color-base:var(--pv-color-secondary-tint-3)}.c-secondary-tint-2{--pv-color-base:var(--pv-color-secondary-tint-2)}.c-secondary-tint-1{--pv-color-base:var(--pv-color-secondary-tint-1)}.c-secondary{--pv-color-base:var(--pv-color-secondary)}.c-secondary-shade-1{--pv-color-base:var(--pv-color-secondary-shade-1)}.c-secondary-shade-2{--pv-color-base:var(--pv-color-secondary-shade-2)}.c-secondary-shade-3{--pv-color-base:var(--pv-color-secondary-shade-3)}.c-secondary-shade-4{--pv-color-base:var(--pv-color-secondary-shade-4)}.c-secondary-shade-5{--pv-color-base:var(--pv-color-secondary-shade-5)}.c-secondary-contrast{--pv-color-base:var(--pv-color-secondary-contrast)}.c-wrong-tint-5{--pv-color-base:var(--pv-color-wrong-tint-5)}.c-wrong-tint-4{--pv-color-base:var(--pv-color-wrong-tint-4)}.c-wrong-tint-3{--pv-color-base:var(--pv-color-wrong-tint-3)}.c-wrong-tint-2{--pv-color-base:var(--pv-color-wrong-tint-2)}.c-wrong-tint-1{--pv-color-base:var(--pv-color-wrong-tint-1)}.c-wrong{--pv-color-base:var(--pv-color-wrong)}.c-wrong-shade-1{--pv-color-base:var(--pv-color-wrong-shade-1)}.c-wrong-shade-2{--pv-color-base:var(--pv-color-wrong-shade-2)}.c-wrong-shade-3{--pv-color-base:var(--pv-color-wrong-shade-3)}.c-wrong-shade-4{--pv-color-base:var(--pv-color-wrong-shade-4)}.c-wrong-shade-5{--pv-color-base:var(--pv-color-wrong-shade-5)}.c-wrong-contrast{--pv-color-base:var(--pv-color-wrong-contrast)}.c-attention-tint-5{--pv-color-base:var(--pv-color-attention-tint-5)}.c-attention-tint-4{--pv-color-base:var(--pv-color-attention-tint-4)}.c-attention-tint-3{--pv-color-base:var(--pv-color-attention-tint-3)}.c-attention-tint-2{--pv-color-base:var(--pv-color-attention-tint-2)}.c-attention-tint-1{--pv-color-base:var(--pv-color-attention-tint-1)}.c-attention{--pv-color-base:var(--pv-color-attention)}.c-attention-shade-1{--pv-color-base:var(--pv-color-attention-shade-1)}.c-attention-shade-2{--pv-color-base:var(--pv-color-attention-shade-2)}.c-attention-shade-3{--pv-color-base:var(--pv-color-attention-shade-3)}.c-attention-shade-4{--pv-color-base:var(--pv-color-attention-shade-4)}.c-attention-shade-5{--pv-color-base:var(--pv-color-attention-shade-5)}.c-success-tint-5{--pv-color-base:var(--pv-color-success-tint-5)}.c-success-tint-4{--pv-color-base:var(--pv-color-success-tint-4)}.c-success-tint-3{--pv-color-base:var(--pv-color-success-tint-3)}.c-success-tint-2{--pv-color-base:var(--pv-color-success-tint-2)}.c-success-tint-1{--pv-color-base:var(--pv-color-success-tint-1)}.c-success{--pv-color-base:var(--pv-color-success)}.c-success-shade-1{--pv-color-base:var(--pv-color-success-shade-1)}.c-success-shade-2{--pv-color-base:var(--pv-color-success-shade-2)}.c-success-shade-3{--pv-color-base:var(--pv-color-success-shade-3)}.c-success-shade-4{--pv-color-base:var(--pv-color-success-shade-4)}.c-success-shade-5{--pv-color-base:var(--pv-color-success-shade-5)}.c-black{--pv-color-base:var(--pv-color-black)}.c-gray-10{--pv-color-base:var(--pv-color-gray-10)}.c-gray-9{--pv-color-base:var(--pv-color-gray-9)}.c-gray-8{--pv-color-base:var(--pv-color-gray-8)}.c-gray-7{--pv-color-base:var(--pv-color-gray-7)}.c-gray-6{--pv-color-base:var(--pv-color-gray-6)}.c-gray-5{--pv-color-base:var(--pv-color-gray-5)}.c-gray-4{--pv-color-base:var(--pv-color-gray-4)}.c-gray-3{--pv-color-base:var(--pv-color-gray-3)}.c-gray-2{--pv-color-base:var(--pv-color-gray-2)}.c-gray-1{--pv-color-base:var(--pv-color-gray-1)}.c-white{--pv-color-base:var(--pv-color-white)}.c-extra-1{--pv-color-base:var(--pv-color-extra-1)}.c-extra-2{--pv-color-base:var(--pv-color-extra-2)}.typography{color:var(--pv-color-base)}.button{display:-ms-inline-flexbox;display:inline-flex;cursor:pointer;background:transparent;border:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;text-decoration:none;outline:none;font-family:inherit;border-radius:4px;height:calc(var(--pv-size-base) * 6);min-width:calc(var(--pv-size-base) * 6);padding:0 calc(var(--pv-size-base) * 2);-webkit-transition:background-color 200ms ease 0s;transition:background-color 200ms ease 0s;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;gap:calc(var(--pv-size-base) * 2);font-size:0}.button.m_no_padding{padding:0}.button:hover{background-color:var(--pv-color-gray-3)}.button:focus{background-color:var(--pv-color-gray-4)}.button:active{background-color:var(--pv-color-gray-5)}:host{display:block;width:100%;word-wrap:break-word;min-width:280px;overflow:auto;position:relative}.search_section{padding:calc(var(--pv-size-base) * 4);border-bottom:1px solid var(--pv-color-gray-4)}.input_search{height:calc(var(--pv-size-base) * 8);width:100%;outline:none;background-color:var(--pv-color-gray-1);padding:0 calc(var(--pv-size-base) * 2);border:1px solid var(--pv-color-gray-7);border-radius:4px;-webkit-transition:background-color 200ms ease 0s, color 200ms ease 0s, border-color 200ms ease 0s;transition:background-color 200ms ease 0s, color 200ms ease 0s, border-color 200ms ease 0s}.input_search::-webkit-input-placeholder{color:var(--pv-color-gray-9)}.input_search::-moz-placeholder{color:var(--pv-color-gray-9)}.input_search:-ms-input-placeholder{color:var(--pv-color-gray-9)}.input_search::-ms-input-placeholder{color:var(--pv-color-gray-9)}.input_search::placeholder{color:var(--pv-color-gray-9)}table{width:100%;table-layout:fixed;border-collapse:collapse;border-spacing:0}table td,table th{border-bottom:1px solid var(--pv-color-gray-4);vertical-align:top;text-align:left}table td:first-child,table th:first-child{padding-right:0;width:calc(var(--pv-size-base) * 10)}table td:last-child,table th:last-child{padding-left:0;width:calc(var(--pv-size-base) * 10)}table th{padding:calc(var(--pv-size-base) * 2) calc(var(--pv-size-base) * 4)}table th.col_action{padding:0}table td{padding:calc(var(--pv-size-base) * 4)}table tr.m_expanded{background:var(--pv-color-gray-1)}table tr.m_expanded>td{border-bottom:none}table tr.expanded_summary{background:var(--pv-color-gray-1)}table tr.expanded_summary table{table-layout:initial}table tr.expanded_summary table td{border-bottom:none;padding:calc(var(--pv-size-base) * 2)}table tr.expanded_summary table td:first-child{width:200px}table tr.expanded_summary table td:last-child{width:auto}.button_table_cell{margin-top:-3px}.status_wrapper{text-align:center;height:calc(var(--pv-size-base) * 16);vertical-align:middle}.modal_wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1;-webkit-animation:fadeIn 200ms;animation:fadeIn 200ms;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.modal_backdrop{background:var(--pv-color-black);z-index:-1;position:fixed;top:0;right:0;bottom:0;left:0;opacity:0.5}.modal_container{background:var(--pv-color-white);width:100%;display:-ms-flexbox;display:flex;max-height:calc(100% - 60px);-ms-flex-direction:column;flex-direction:column;margin:calc(var(--pv-size-base) * 6);position:relative;outline:none;-webkit-box-shadow:var(--pv-shadow-dark-hight);box-shadow:var(--pv-shadow-dark-hight);overflow:hidden;border:0px;padding:0px;max-width:640px;border-radius:4px}.modal_header{padding:calc(var(--pv-size-base) * 3) calc(var(--pv-size-base) * 4);display:-ms-flexbox;display:flex;-ms-flex:0 0 auto;flex:0 0 auto;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;gap:calc(var(--pv-size-base) * 2);border-bottom:1px solid var(--pv-color-gray-5)}.modal_content{-ms-flex:1 1 auto;flex:1 1 auto;overflow:auto}:host([data-mobile-screen-view=true]) table,:host([data-mobile-screen-view=true]) tbody,:host([data-mobile-screen-view=true]) tr,:host([data-mobile-screen-view=true]) td{display:block;width:100% !important;padding:0;border:none}:host([data-mobile-screen-view=true]) thead{display:none}:host([data-mobile-screen-view=true]) table tr{padding:calc(var(--pv-size-base) * 2) 0}:host([data-mobile-screen-view=true]) table .expanded_summary{padding:0}:host([data-mobile-screen-view=true]) table .certificate_row{border-bottom:1px solid var(--pv-color-gray-5);padding:calc(var(--pv-size-base) * 2) calc(var(--pv-size-base) * 4)}:host([data-mobile-screen-view=true]) table .certificate_row_actions{padding-top:calc(var(--pv-size-base) * 6)}:host([data-mobile-screen-view=true]) table .certificate_row_actions td{display:-ms-flexbox;display:flex;-ms-flex-pack:right;justify-content:right;gap:calc(var(--pv-size-base) * 4)}:host([data-mobile-screen-view=true]) .button_table_cell{margin-top:0}"};var CertificatesViewer=function(){function t(t){var e=this;registerInstance(this,t);this.detailsOpen=createEvent(this,"detailsOpen");this.detailsClose=createEvent(this,"detailsClose");this.isHasRoots=false;this.certificates=[];this.filterWithSearch=true;this.highlightWithSearch=true;this.mobileMediaQueryString="(max-width: 900px)";this.mobileScreenView=false;this.search="";this.certificatesDecoded=[];this.isDecodeInProcess=true;this.handleClickDetails=function(t){e.certificateSelectedForDetails=t;e.detailsOpen.emit(t)};this.handleModalClose=function(){e.certificateSelectedForDetails=undefined;e.detailsClose.emit()};this.handleSearch=function(t){var a=t.target;e.search=a.value.trim()}}t.prototype.handleMediaQueryChange=function(t){this.mobileScreenView=t.matches};t.prototype.componentWillLoad=function(){this.certificatesDecodeAndSet();{this.mobileMediaQuery=window.matchMedia(this.mobileMediaQueryString);this.mobileMediaQuery.addEventListener("change",this.handleMediaQueryChange.bind(this));this.mobileScreenView=this.mobileMediaQuery.matches}};t.prototype.disconnectedCallback=function(){this.mobileMediaQuery.removeEventListener("change",this.handleMediaQueryChange.bind(this))};t.prototype.watchCertificates=function(t,e){if(JSON.stringify(t)!==JSON.stringify(e)){this.certificatesDecodeAndSet()}};t.prototype.certificatesDecodeAndSet=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,a,r,o,i,n;return __generator(this,(function(c){switch(c.label){case 0:t=false;if(!Array.isArray(this.certificates)){return[2]}e=[];a=0,r=this.certificates;c.label=1;case 1:if(!(a<r.length))return[3,6];o=r[a];c.label=2;case 2:c.trys.push([2,4,,5]);i=new X509Certificate(o.value);return[4,i.getThumbprint("SHA-1")];case 3:c.sent();e.push({body:i,tests:o.tests,name:o.name});if(!t&&i.isRoot){t=true}return[3,5];case 4:n=c.sent();console.error("Error certificate parse:",n);return[3,5];case 5:a++;return[3,1];case 6:this.isHasRoots=t;this.isDecodeInProcess=false;this.certificatesDecoded=e;return[2]}}))}))};t.prototype.getCertificateName=function(t){if(typeof t.name==="function"){return t.name(t.body)}return t.name||t.body.commonName};t.prototype.handleClickDownloadAsPem=function(t){t.body.downloadAsPEM(this.getCertificateName(t))};t.prototype.handleClickDownloadAsDer=function(t){t.body.downloadAsDER(this.getCertificateName(t))};t.prototype.handleClickRow=function(t){var e=this.expandedRow===t;this.expandedRow=e?undefined:t};t.prototype.getMaxColSpanValue=function(){var t=5;if(!this.isHasRoots){t+=1}return t};t.prototype.renderCertificateButtonActions=function(t){var e=this;var a,r,o;var i=t.tests&&(t.tests.expired||t.tests.revoked||t.tests.valid);return h("peculiar-button-menu",{class:"button_table_cell",groups:__spreadArray([{title:l10n.getString("previewCertificate"),options:[{text:l10n.getString("viewDetails"),startIcon:h(DetailsIcon,null),onClick:function(){return e.handleClickDetails(t.body)}}]},{title:l10n.getString("downloadOptions"),options:[{text:l10n.getString("download.pem"),startIcon:h(DownloadIcon,null),onClick:function(){return e.handleClickDownloadAsPem(t)}},{text:l10n.getString("download.der"),startIcon:h(DownloadIcon,null),onClick:function(){return e.handleClickDownloadAsDer(t)}}]}],i?[{title:l10n.getString("testURLs"),options:__spreadArray(__spreadArray(__spreadArray([],((a=t.tests)===null||a===void 0?void 0:a.valid)?[{text:l10n.getString("valid"),href:t.tests.valid,startIcon:h(LinkIcon,null)}]:[],true),((r=t.tests)===null||r===void 0?void 0:r.revoked)?[{text:l10n.getString("revoked"),href:t.tests.revoked,startIcon:h(LinkIcon,null)}]:[],true),((o=t.tests)===null||o===void 0?void 0:o.expired)?[{text:l10n.getString("expired"),href:t.tests.expired,startIcon:h(LinkIcon,null)}]:[],true)}]:[],true)})};t.prototype.renderExpandedRow=function(t){var e=this.getMaxColSpanValue()-2;return h("tr",{class:"expanded_summary"},h("td",null),h("td",{colSpan:e},h(CertificateSummary,{certificate:t,showIssuer:!t.isRoot})),h("td",null))};t.prototype.renderCertificatesRows=function(){var t=this;var e=this.highlightWithSearch?this.search:"";var a=[];this.certificatesDecoded.forEach((function(r,o){var i=o===t.expandedRow;var n=OIDs[r.body.signature.algorithm]||r.body.signature.algorithm;if(t.filterWithSearch&&t.search){var c=[n,r.body.issuerCommonName,t.getCertificateName(r),r.body.thumbprints["SHA-1"]].join(" ").toLowerCase();if(c.indexOf(t.search.toLowerCase())===-1){return}}if(t.mobileScreenView){a.push([h("tr",{class:{certificate_row:true,m_expanded:i},key:r.body.thumbprints["SHA-1"]},h("td",null,h("table",null,h("tbody",null,!t.isHasRoots&&h("tr",null,h("td",null,h(Typography,{variant:"b2",color:"gray-9"},l10n.getString("issuer"))),h("td",null,h(Typography,{variant:"b2",color:"black"},h("peculiar-highlight-words",{search:e},r.body.issuerCommonName)))),h("tr",null,h("td",null,h(Typography,{variant:"b2",color:"gray-9"},l10n.getString("name"))),h("td",null,h(Typography,{variant:"b2",color:"black"},h("peculiar-highlight-words",{search:e},t.getCertificateName(r))))),h("tr",null,h("td",null,h(Typography,{variant:"b2",color:"gray-9"},l10n.getString("publicKey"))),h("td",null,h(Typography,{variant:"b2",color:"black"},h("peculiar-highlight-words",{search:e},n)))),h("tr",null,h("td",null,h(Typography,{variant:"b2",color:"gray-9"},l10n.getString("fingerprint"),"  (SHA-1)")),h("td",null,h(Typography,{variant:"b2",color:"black"},h("peculiar-highlight-words",{search:e},r.body.thumbprints["SHA-1"])))),i&&t.renderExpandedRow(r.body),h("tr",{class:"certificate_row_actions"},h("td",null,t.renderCertificateButtonActions(r),h(Button,{startIcon:i?h(ArrowTopIcon,null):h(ArrowBottomIcon,null),onClick:t.handleClickRow.bind(t,o)})))))))]);return}a.push([h("tr",{class:{m_expanded:i},key:r.body.thumbprints["SHA-1"]},h("td",null,h(Button,{startIcon:i?h(ArrowTopIcon,null):h(ArrowBottomIcon,null),class:"button_table_cell",onClick:t.handleClickRow.bind(t,o)})),!t.isHasRoots&&h("td",null,h(Typography,null,h("peculiar-highlight-words",{search:e},r.body.issuerCommonName))),h("td",null,h(Typography,null,h("peculiar-highlight-words",{search:e},t.getCertificateName(r)))),h("td",null,h(Typography,null,h("peculiar-highlight-words",{search:e},n))),h("td",null,h(Typography,null,h("peculiar-highlight-words",{search:e},r.body.thumbprints["SHA-1"]))),h("td",null,t.renderCertificateButtonActions(r))),i&&t.renderExpandedRow(r.body)])}));return a};t.prototype.renderCertificateDetailsModal=function(){if(!this.certificateSelectedForDetails){return null}return h("div",{class:"modal_wrapper",role:"presentation","aria-hidden":"false",part:"presentation"},h("div",{class:"modal_backdrop","aria-hidden":"true",onClick:this.handleModalClose}),h("div",{class:"modal_container",role:"dialog",part:"presentation_container"},h("header",{class:"modal_header"},h(Typography,{variant:"h4"},l10n.getString("certificateDetails")),h(Button,{startIcon:h(CrossIcon,null),onClick:this.handleModalClose})),h("div",{class:"modal_content"},h("peculiar-certificate-viewer",{certificate:this.certificateSelectedForDetails,mobileMediaQueryString:this.mobileMediaQueryString}))))};t.prototype.renderSearch=function(){if(!this.filterWithSearch&&!this.highlightWithSearch){return null}return h("div",{class:"search_section"},h("input",{type:"search",value:"",class:"input_search t-b3 c-black",disabled:!this.certificatesDecoded.length,placeholder:"Search",onInput:this.handleSearch}))};t.prototype.renderEmptyState=function(){var t=this.getMaxColSpanValue();return h("tr",null,h("td",{class:"status_wrapper",colSpan:t},h(Typography,{variant:"b1"},"There are no certificates available.")))};t.prototype.renderEmptySearchState=function(){var t=this.getMaxColSpanValue();return h("tr",null,h("td",{class:"status_wrapper",colSpan:t},h(Typography,{variant:"b1"},"No results found for “",this.search,"“")))};t.prototype.renderLoadingState=function(){return h("div",{class:"loading_container"},h("peculiar-circular-progress",null))};t.prototype.renderTableBody=function(){if(this.isDecodeInProcess){return null}if(!this.certificatesDecoded.length){return this.renderEmptyState()}var t=this.renderCertificatesRows();if(this.search&&!t.length){return this.renderEmptySearchState()}return t};t.prototype.render=function(){return h(Host,{key:"894edb33a53c1128d812c2fd7a5b230a4b13493c","data-mobile-screen-view":String(this.mobileScreenView)},this.renderSearch(),h("table",{key:"998d37ab98be6743f1564fafb4ce9fc70b79e358"},!this.mobileScreenView&&h("thead",{key:"4728e09450b6285cbc2f69cf0a0e06135910558f"},h("tr",{key:"70bf5be60e50b9d7109e27128b661044778e0ded"},h("th",{key:"cf0fef5df1b42d0bce49d3bf0af2d91b82de6d05"}),!this.isHasRoots&&h("th",{key:"59f00d345883dfb3c81a97278583821543ce6808",class:"col_issuer"},h(Typography,{key:"54ce8fba1ab5355ac1f82ccc3aa62945351a3632",variant:"s2"},l10n.getString("issuer"))),h("th",{key:"9aea7911edafca1482f31e2ca3316d2cde40fd78",class:"col_name"},h(Typography,{key:"2a0145b0cc56543ed4b5170a8773c3c43e5e64f9",variant:"s2"},l10n.getString("name"))),h("th",{key:"9eab414d9b1558d6a5b9938f55165aeca5baa54e",class:"col_public_key"},h(Typography,{key:"cbdcb1013bbf12ac88e63ca2d268c55854803297",variant:"s2"},l10n.getString("publicKey"))),h("th",{key:"06adb89146693583a0dad86644b2c8b399e25c0e",class:"col_fingerprint"},h(Typography,{key:"eca0440721f16953219f014edb8d3742f312f704",variant:"s2"},l10n.getString("fingerprint"),"  (SHA-1)")),h("th",{key:"56b7fdf83f5c45cf524a8cce81dbca584b9b5fa8"}))),h("tbody",{key:"01ccda1abfa846a8b0cdc00588b106398358ed88"},this.renderTableBody())),this.renderCertificateDetailsModal(),this.isDecodeInProcess&&this.renderLoadingState())};Object.defineProperty(t,"watchers",{get:function(){return{certificates:["watchCertificates"]}},enumerable:false,configurable:true});return t}();CertificatesViewer.style=certificatesViewerCss();export{CertificatesViewer as peculiar_certificates_viewer}; //# sourceMappingURL=peculiar-certificates-viewer.entry.js.map