diff --git a/btcwallet/css/main.css b/btcwallet/css/main.css
index 941e81d..e7cd9be 100644
--- a/btcwallet/css/main.css
+++ b/btcwallet/css/main.css
@@ -27,7 +27,6 @@ body {
scrollbar-gutter: stable;
color: rgba(var(--text-color), 1);
background-color: rgba(var(--background-color), 1);
- transition: background-color 0.3s;
position: relative;
display: flex;
flex-direction: column;
@@ -658,7 +657,7 @@ ol li::before {
}
#main_header {
- padding: 1.5rem max(1rem, 4vw);
+ padding: 1rem max(1rem, 4vw);
}
.app-brand {
@@ -683,7 +682,6 @@ ol li::before {
grid-template-rows: auto 1fr;
height: 100%;
width: 100%;
- transition: background-color 0.3s;
background-color: rgba(var(--foreground-color), 1);
}
@@ -823,6 +821,10 @@ ol li::before {
margin-bottom: 0.3rem;
}
+#search_query_input {
+ font-weight: 500;
+}
+
#address_balance_card {
padding: 1.5rem;
border-radius: 0.5rem;
@@ -837,6 +839,13 @@ ol li::before {
color: var(--accent-color);
}
+#filter_selector {
+ --padding: 0.3rem 0.5rem;
+}
+#filter_selector sm-chip {
+ font-weight: 500;
+}
+
.card {
padding: 0.5rem 0;
border: none;
@@ -871,21 +880,55 @@ ol li::before {
border-bottom: thin solid rgba(var(--text-color), 0.3);
}
+#tx_details__header:has(#tx_status) time {
+ text-align: left;
+ margin-right: auto;
+}
+#tx_details__header:has(:not(#tx_status)) time {
+ text-align: right;
+ margin-left: auto;
+}
+
#transactions_list {
display: grid;
gap: 2rem;
padding-bottom: 4rem;
+ padding-top: 2rem;
+}
+
+transaction-card {
+ position: relative;
+}
+transaction-card:not(:last-of-type) {
+ padding-bottom: 2rem;
+}
+transaction-card:not(:last-of-type)::after {
+ content: "";
+ position: absolute;
+ bottom: 0;
+ right: 0;
+ height: 1px;
+ width: calc(100% - 3.5rem);
+ background-color: rgba(var(--text-color), 0.2);
}
.transaction {
+ position: relative;
grid-template-columns: auto 1fr;
gap: 0.5rem 1rem;
align-items: center;
- content-visibility: auto;
- contain-intrinsic-height: 8rem;
}
-.transaction:not(:last-of-type) {
- padding-bottom: 2rem;
+.transaction.in .transaction__amount {
+ color: var(--green);
+}
+.transaction.in .transaction__amount::before {
+ content: "+";
+}
+.transaction.out .transaction__amount {
+ color: var(--danger-color);
+}
+.transaction.out .transaction__amount::before {
+ content: "-";
}
.transaction__amount {
white-space: nowrap;
@@ -893,21 +936,9 @@ ol li::before {
.transaction.out .transaction__icon .icon {
fill: var(--danger-color);
}
-.transaction.out .transaction__amount {
- color: var(--danger-color);
-}
-.transaction.out .transaction__amount::before {
- content: "- ";
-}
.transaction.in .transaction__icon .icon {
fill: var(--green);
}
-.transaction.in .transaction__amount {
- color: var(--green);
-}
-.transaction.in .transaction__amount::before {
- content: "+ ";
-}
.transaction.unconfirmed-tx .transaction__icon .icon {
fill: var(--yellow);
}
@@ -928,6 +959,7 @@ ol li::before {
.transaction__time {
font-size: 0.9rem;
color: rgba(var(--text-color), 0.8);
+ text-wrap: balance;
}
.transaction__amount {
font-size: 1rem;
@@ -954,6 +986,15 @@ ol li::before {
content: ",";
}
+#tx_details time {
+ padding: 0.3rem 0.8rem;
+ border-radius: 5rem;
+ background-color: rgba(var(--text-color), 0.06);
+ font-weight: 500;
+ font-size: 0.9rem;
+ text-wrap: balance;
+}
+
#tx_status {
display: flex;
align-items: center;
@@ -962,11 +1003,20 @@ ol li::before {
border-radius: 0.5rem;
background-color: rgba(var(--text-color), 0.03);
color: var(--danger-color);
+ width: -webkit-fit-content;
+ width: -moz-fit-content;
+ width: fit-content;
}
#tx_status .icon {
fill: var(--danger-color);
}
+#tx_amount {
+ font-size: max(2rem, 4vw);
+ font-weight: 700;
+ text-wrap: balance;
+}
+
#tx_technicals .tx-detail:first-of-type {
position: relative;
}
@@ -1197,6 +1247,7 @@ ol li::before {
}
#main_header {
grid-area: header;
+ padding: 1.5rem max(1rem, 4vw);
}
#main_navbar {
grid-area: nav;
diff --git a/btcwallet/css/main.min.css b/btcwallet/css/main.min.css
index 46f3d85..c074cd9 100644
--- a/btcwallet/css/main.min.css
+++ b/btcwallet/css/main.min.css
@@ -1 +1 @@
-*{padding:0;margin:0;box-sizing:border-box;font-family:"Roboto",sans-serif}:root{font-size:clamp(1rem,1.2vmax,1.2rem)}html,body{height:100%}body{--accent-color: #4d77ff;--accent-color-rgb: 77, 119, 255;--text-color: 20, 20, 20;--foreground-color: 252, 253, 255;--background-color: 241, 243, 248;--danger-color: rgb(225, 58, 58);--green: #1cad59;--yellow: rgb(255, 207, 65);scrollbar-width:thin;scrollbar-gutter:stable;color:rgba(var(--text-color), 1);background-color:rgba(var(--background-color), 1);transition:background-color .3s;position:relative;display:flex;flex-direction:column}body[data-theme=dark]{--accent-color: #a0b6ff;--accent-color-rgb: 160, 182, 255;--text-color: 220, 220, 220;--foreground-color: 27, 28, 29;--background-color: 21, 22, 22;--danger-color: rgb(255, 106, 106);--green: #00e676;--yellow: rgb(255, 213, 5)}body[data-theme=dark] sm-popup::part(popup){background-color:rgba(var(--foreground-color), 1)}p,strong{font-size:.9rem;max-width:65ch;line-height:1.7;color:rgba(var(--text-color), 0.9)}.warning{line-height:normal;padding:1rem;background-color:khaki;border-radius:.5rem;font-weight:500;color:rgba(0,0,0,.7)}a{text-decoration:none;color:var(--accent-color)}a:focus-visible{box-shadow:0 0 0 .1rem rgba(var(--text-color), 1) inset}button,.button{-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative;display:inline-flex;border:none;background-color:rgba(0,0,0,0);overflow:hidden;-webkit-tap-highlight-color:rgba(0,0,0,0);align-items:center;font-size:.9rem;font-weight:500;white-space:nowrap;padding:.8rem;border-radius:.5rem;justify-content:center;flex-shrink:0}button:focus-visible,.button:focus-visible{outline:var(--accent-color) solid medium}button:not(:disabled),.button:not(:disabled){color:var(--accent-color);cursor:pointer}button .icon,.button .icon{fill:var(--accent-color)}.button{display:inline-flex;background-color:rgba(var(--text-color), 0.06)}.button--primary,.button--danger{color:rgba(var(--background-color), 1) !important}.button--primary .icon,.button--danger .icon{fill:rgba(var(--background-color), 1)}.button--primary{background-color:var(--accent-color)}.button--danger{background-color:var(--danger-color)}.button--small{padding:.4rem .5rem}.button--colored{color:var(--accent-color) !important}.button--colored .icon{fill:var(--accent-color)}.cta{text-transform:uppercase;font-size:.9rem;font-weight:700;letter-spacing:.05em;padding:.8rem 1rem}.icon{width:1.2rem;height:1.2rem;fill:rgba(var(--text-color), 0.8);flex-shrink:0}.icon-only{padding:.5rem;border-radius:.3rem}button:disabled{opacity:.5}a:-webkit-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:-moz-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}details summary{display:flex;gap:.3rem;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer;align-items:center;color:var(--accent-color)}details summary .down-arrow{fill:var(--accent-color)}details[open] summary{margin-bottom:1rem}details[open]>summary .down-arrow{transform:rotate(180deg)}sm-input,sm-textarea{width:100%;--border-radius: 0.5rem;--background-color: rgba(var(--foreground-color), 1)}sm-input button .icon,sm-textarea button .icon{fill:var(--accent-color)}sm-button{--padding: 0.8rem}sm-button[variant=primary] .icon{fill:rgba(var(--background-color), 1)}sm-button[disabled] .icon{fill:rgba(var(--text-color), 0.6)}sm-button.danger{--background: var(--danger-color);color:rgba(var(--background-color), 1)}sm-spinner{--size: 1rem;--stroke-width: 0.1rem}sm-form{--gap: 1rem}sm-select{font-size:.9rem;--padding: 0.6rem 0.3rem 0.6rem 0.6rem}sm-option{font-size:.9rem}sm-chips{--gap: 0;background-color:rgba(var(--text-color), 0.06);border-radius:.5rem;padding:.3rem}sm-chip{font-size:.9rem;--border-radius: 0.3rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}sm-chip[selected]{color:rgba(var(--background-color), 1);--background: var(--accent-color)}sm-notifications{z-index:100000}ul,ol{list-style:none}ol{counter-reset:item}ol li{position:relative;display:flex;align-items:flex-start;counter-increment:item}ol li:not(:last-of-type){padding-bottom:1.5rem}ol li:not(:last-of-type)::after{content:"";position:absolute;width:.1rem;height:calc(100% - 2.2rem);background:var(--accent-color);margin-left:.7rem;margin-top:2rem}ol li::before{content:counter(item);display:flex;align-items:center;justify-content:center;text-align:center;font-size:.9rem;font-weight:500;margin-top:.15rem;margin-right:1rem;line-height:1;width:1.5rem;height:1.5rem;border-radius:100%;flex-shrink:0;color:rgba(var(--text-color), 0.8);background:rgba(var(--text-color), 0.1)}.overflow-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.wrap-around{overflow-wrap:break-word;word-wrap:break-word;word-break:break-word}.full-bleed{grid-column:1/-1}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.sticky{position:-webkit-sticky;position:sticky}.top-0{top:0}.flex{display:flex}.flex-wrap{flex-wrap:wrap}.flex-1{flex:1}.flex-direction-column{flex-direction:column}.grid{display:grid}.flow-column{grid-auto-flow:column}.gap-0-3{gap:.3rem}.gap-0-5{gap:.5rem}.gap-1{gap:1rem}.gap-1-5{gap:1.5rem}.gap-2{gap:2rem}.gap-3{gap:3rem}.text-align-right{text-align:right}.align-content-start{align-content:flex-start}.align-items-start{align-items:flex-start}.align-center{align-items:center}.align-end{align-items:flex-end}.text-center{text-align:center}.justify-start{justify-items:start}.justify-center{justify-content:center}.justify-right{margin-left:auto}.align-self-center{align-self:center}.align-self-end{align-self:end}.justify-self-center{justify-self:center}.justify-self-start{justify-self:start}.justify-self-end{justify-self:end}.flex-direction-column{flex-direction:column}.space-between{justify-content:space-between}.w-100{width:100%}.h-100{height:100%}.label{font-size:.9rem;color:rgba(var(--text-color), 0.8);font-weight:500;margin-bottom:.2rem}.button--primary .ripple,.button--danger .ripple{background:radial-gradient(circle, rgba(var(--background-color), 0.3) 0%, rgba(0, 0, 0, 0) 50%)}.ripple{height:8rem;width:8rem;position:absolute;border-radius:50%;transform:scale(0);background:radial-gradient(circle, rgba(var(--text-color), 0.3) 0%, rgba(0, 0, 0, 0) 50%);pointer-events:none}.interactive{position:relative;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.empty-state{display:grid;width:100%;padding:1.5rem 0}.observe-empty-state:empty{display:none !important}.observe-empty-state:not(:empty)+.empty-state{display:none !important}.bullet-point{display:flex;align-items:center;justify-content:center;margin:0 .8ch}.bullet-point::after{content:"";height:.4ch;width:.4ch;border-radius:.5em;background-color:var(--accent-color)}.margin-right-0-3{margin-right:.3rem}.margin-right-0-5{margin-right:.5rem}.margin-right-auto{margin-right:auto}.margin-left-0-5{margin-left:.5rem}.margin-left-auto{margin-left:auto}.margin-top-1-5{margin-top:1.5rem}.margin-bottom-0-5{margin-bottom:.5rem}.margin-bottom-1{margin-bottom:1rem}.margin-bottom-1-5{margin-bottom:1.5rem}.margin-bottom-2{margin-bottom:2rem}.icon-button{padding:.6rem;border-radius:.8rem;background-color:rgba(var(--text-color), 0.1);height:-webkit-max-content;height:-moz-max-content;height:max-content}.icon-button .icon{fill:var(--accent-color)}.page{height:100%}.page__header{display:flex;justify-content:space-between;margin-bottom:1.5rem;min-height:8rem}.page__header .grid{margin-top:auto}.page__header h1{margin-top:auto;font-size:2rem}#confirmation_popup,#prompt_popup{flex-direction:column}#confirmation_popup h4,#prompt_popup h4{margin-bottom:1.5rem}#confirmation_popup sm-button,#prompt_popup sm-button{margin:0}#confirmation_popup>.flex:last-of-type,#prompt_popup>.flex:last-of-type{padding:0;margin-top:1rem}#confirmation_popup>.flex:last-of-type sm-button:first-of-type,#prompt_popup>.flex:last-of-type sm-button:first-of-type{margin-right:.6rem;margin-left:auto}#prompt_message{margin-bottom:1.5rem}.popup__header{display:grid;gap:.5rem;width:100%;padding:0 1.5rem;align-items:center}.popup__header__close{padding:.5rem;margin-left:-0.5rem}#secondary_pages{display:flex;flex-direction:column;width:100%}#secondary_pages header{padding:1.5rem}#secondary_pages .inner-page{height:100%}#landing>section{justify-content:center;justify-items:center;align-items:center;text-align:center;padding:8vw 0}#landing h1{font-size:clamp(2rem,5vw,5rem)}#loading_page{display:grid;gap:1rem;place-content:center;place-items:center;position:fixed;top:0;left:0;width:100%;height:100%;z-index:20;background-color:rgba(var(--foreground-color), 1)}#main_header{padding:1.5rem max(1rem,4vw)}.app-brand{display:flex;gap:.3rem;align-items:center}.app-brand .icon{height:1.7rem;width:1.7rem}.app-name__company{font-size:.8rem;font-weight:500;color:rgba(var(--text-color), 0.8)}#main_card{display:grid;grid-template-columns:minmax(0, 1fr);grid-template-rows:auto 1fr;height:100%;width:100%;transition:background-color .3s;background-color:rgba(var(--foreground-color), 1)}#main_navbar{display:flex;background:rgba(var(--text-color), 0.03)}#main_navbar.hide-away{position:absolute}#main_navbar ul{display:flex;height:100%;width:100%}#main_navbar ul li{width:100%}.nav-item{position:relative;display:flex;flex:1;width:100%;flex-direction:column;align-items:center;justify-content:center;padding:.5rem .3rem;color:var(--text-color);font-size:.9rem;border-radius:.3rem;font-weight:500}.nav-item .icon{transition:transform .2s cubic-bezier(0.175, 0.885, 0.32, 1.275)}.nav-item__title{margin-top:.3rem;transition:opacity .2s,transform .2s cubic-bezier(0.175, 0.885, 0.32, 1.275)}.nav-item--active{color:var(--accent-color)}.nav-item--active .icon{fill:var(--accent-color);transform:translateY(50%)}.nav-item--active .nav-item__title{transform:translateY(100%);opacity:0}.nav-item__indicator{position:absolute;bottom:0;width:2rem;height:.3rem;background:var(--accent-color);border-radius:1rem 1rem 0 0;z-index:1}.inner-page{padding:0 1.5rem;flex:1;overflow-y:auto;align-content:start}.password-field label{display:flex}.password-field label input:checked~.visible{display:none}.password-field label input:not(:checked)~.invisible{display:none}.multi-state-button{display:grid;text-align:center;align-items:center;justify-items:center}.multi-state-button>*{grid-area:1/1/2/2}.multi-state-button button{z-index:1;width:100%}.scrolling-wrapper{overflow-y:auto}#pages_container{overflow-y:auto;padding:0 1rem}.primary-action{display:flex;padding:.8rem 1rem;gap:.5rem;white-space:normal;font-size:.9rem;border-radius:.5rem;background-color:rgba(0,0,0,0);border:thin solid rgba(var(--text-color), 0.3);text-align:left;flex-shrink:1}.primary-action .icon{fill:var(--accent-color)}#flo_id_warning{padding-bottom:1.5rem;border-bottom:thin solid rgba(var(--text-color), 0.3)}#flo_id_warning .icon{height:4rem;width:4rem;padding:1rem;background-color:#ffc107;border-radius:3rem;fill:rgba(0,0,0,.8);margin-bottom:1.5rem}.generated-id-card{display:grid;gap:1rem}.generated-id-card h5{margin-bottom:.3rem}#address_balance_card{padding:1.5rem;border-radius:.5rem;margin-top:.5rem;margin-bottom:1.5rem;background-color:rgba(var(--accent-color-rgb), 0.2)}#address_balance{font-size:1.2rem;font-weight:700;color:var(--accent-color)}.card{padding:.5rem 0;border:none}.card:not(:last-of-type){border-bottom:solid thin rgba(var(--text-color), 0.3)}.remove-card-wrapper{min-height:2rem}.sender-card{display:grid;gap:.5rem;margin-bottom:.5rem}.sender-card sm-input{border-radius:.5rem}.sender-card sm-input.error{border:var(--danger-color) solid}.receiver-card{display:grid;gap:.5rem}.balance-wrapper{padding-bottom:.5rem;border-bottom:thin solid rgba(var(--text-color), 0.3)}#transactions_list{display:grid;gap:2rem;padding-bottom:4rem}.transaction{grid-template-columns:auto 1fr;gap:.5rem 1rem;align-items:center;content-visibility:auto;contain-intrinsic-height:8rem}.transaction:not(:last-of-type){padding-bottom:2rem}.transaction__amount{white-space:nowrap}.transaction.out .transaction__icon .icon{fill:var(--danger-color)}.transaction.out .transaction__amount{color:var(--danger-color)}.transaction.out .transaction__amount::before{content:"- "}.transaction.in .transaction__icon .icon{fill:var(--green)}.transaction.in .transaction__amount{color:var(--green)}.transaction.in .transaction__amount::before{content:"+ "}.transaction.unconfirmed-tx .transaction__icon .icon{fill:var(--yellow)}.transaction__icon{display:flex;align-items:center;justify-content:center;width:2.5rem;height:2.5rem;background-color:rgba(var(--text-color), 0.03);border-radius:2rem}.transaction__receiver{font-weight:500;margin-bottom:.3rem;line-height:1.5}.transaction__time{font-size:.9rem;color:rgba(var(--text-color), 0.8)}.transaction__amount{font-size:1rem;font-weight:700}.transaction__id{font-size:.9rem}.pending-badge{font-size:.8rem;padding:.2rem .5rem;border-radius:.5rem;background-color:var(--yellow);color:rgba(0,0,0,.8);font-weight:500;justify-self:flex-start}.tx-participant:not(:last-of-type){margin-right:.5rem}.tx-participant:not(:last-of-type)::after{content:","}#tx_status{display:flex;align-items:center;gap:.5rem;padding:.6rem .8rem;border-radius:.5rem;background-color:rgba(var(--text-color), 0.03);color:var(--danger-color)}#tx_status .icon{fill:var(--danger-color)}#tx_technicals .tx-detail:first-of-type{position:relative}#tx_technicals .tx-detail:first-of-type::before{content:"";position:absolute;top:50%;left:0;transform:translateY(-50%);width:.2rem;height:calc(100% - 2rem);background-color:var(--accent-color);border-radius:0 1rem 1rem 0}.details-wrapper{display:flex;flex-wrap:wrap;gap:.5rem;width:100%}.tx-detail{display:grid;gap:.5rem;align-content:flex-start;background-color:rgba(var(--text-color), 0.03);padding:1rem;border-radius:.5rem;flex:1 1 8rem}.tx-detail .flex div{color:rgba(var(--text-color), 0.8);font-size:.9rem;font-weight:500}.tx-detail>div{font-weight:700;font-size:1rem;color:rgba(var(--text-color), 0.9)}#in_out_wrapper{display:grid;grid-template-columns:repeat(auto-fit, minmax(16rem, 1fr));gap:1rem;margin-bottom:3rem}.in-out-card{display:grid;grid-template-columns:minmax(0, 1fr) auto;gap:.5rem;padding:1rem;border-radius:.5rem;background-color:rgba(var(--text-color), 0.03)}.in-out-card:not(:last-of-type){margin-bottom:.5rem}.in-out-card>:first-child{margin-right:1rem}#selected_fee_tip{font-weight:500}#selected_fee_tip.error{color:var(--danger-color)}#selected_fee_tip.error .icon{fill:var(--danger-color)}.fab{position:absolute;right:0;bottom:0;margin:1.5rem;box-shadow:0 .5rem 1rem rgba(0,0,0,.2);z-index:2}#scroll_to_top{border-radius:3rem;background-color:rgba(var(--foreground-color), 1)}#txid{font-size:.9rem}.user-action-result__icon{justify-self:center;height:4rem;width:4rem;border-radius:5rem;-webkit-animation:popup 1s;animation:popup 1s}.user-action-result__icon.success{fill:rgba(var(--background-color), 1);padding:1rem;background-color:#0bbe56}.user-action-result__icon.failed{background-color:rgba(var(--text-color), 0.03);fill:var(--danger-color)}@-webkit-keyframes popup{0%{opacity:0;transform:scale(0.2) translateY(600%)}10%{transform:scale(0.2) translateY(5rem);opacity:1}40%{transform:scale(0.2) translateY(0)}80%{transform:scale(1.1) translateY(0)}100%{transform:scale(1) translateY(0)}}@keyframes popup{0%{opacity:0;transform:scale(0.2) translateY(600%)}10%{transform:scale(0.2) translateY(5rem);opacity:1}40%{transform:scale(0.2) translateY(0)}80%{transform:scale(1.1) translateY(0)}100%{transform:scale(1) translateY(0)}}.increase-fee-sender,.increase-fee-receiver{padding:1rem;border-radius:.5rem;border:solid thin rgba(var(--text-color), 0.3)}.input-action-wrapper{display:flex;gap:.5rem;flex-wrap:wrap;width:100%;align-items:start;container:input-action/inline-size}.input-action-wrapper sm-input{width:auto;flex:1;min-width:20rem}.input-action-wrapper button{min-width:7rem;min-height:3.15rem}@container input-action (max-width: 28rem){sm-input{width:100%;min-width:16rem !important}button{flex:1}}#conversion_view_selector{margin-right:auto;font-weight:500}.converted-card:not(:empty){border-radius:.5rem;padding:1rem;background-color:rgba(var(--text-color), 0.03)}.converted-card:not(:empty) sm-copy{font-weight:500;color:rgba(var(--text-color), 0.9)}@media screen and (max-width: 40rem){#main_navbar.hide-away{bottom:0;left:0;right:0}}@media screen and (min-width: 40rem){sm-popup{--width: 24rem}.popup__header{grid-column:1/-1;padding:1rem 1.5rem 0 1.5rem}body{align-items:center;justify-content:center}#main_card{grid-template-areas:"header" ".";position:relative;overflow:hidden;box-shadow:0 .1rem .2rem rgba(0,0,0,.05),0 1rem 3rem rgba(0,0,0,.2)}#main_card:not(.nav-hidden){grid-template-columns:auto 1fr;grid-template-rows:auto 1fr;grid-template-areas:"nav header" "nav ."}#main_header{grid-area:header}#main_navbar{grid-area:nav;border-top:none;flex-direction:column;background-color:rgba(37,110,255,.03)}#main_navbar ul{flex-direction:column;gap:.5rem;padding:.3rem}.nav-item{aspect-ratio:1/1}.nav-item__indicator{width:.25rem;height:50%;left:0;border-radius:0 1rem 1rem 0;bottom:auto}body[data-theme=dark] #main_navbar{background-color:rgba(0,0,0,.2)}.page{width:min(60rem,100%);margin:0 auto}#generate_btc_addr_popup,#retrieve_btc_addr_popup{--width: 28rem}#convert{width:min(72rem,100%)}#key_conversion_content{grid-template-columns:1fr 1fr;align-items:flex-start}#increase_fee_popup{--width: 30rem}}@media screen and (min-width: 48rem){.sender-card,.receiver-card{grid-template-columns:1fr 1fr}}@media(any-hover: hover){::-webkit-scrollbar{width:.5rem;height:.5rem}::-webkit-scrollbar-thumb{background:rgba(var(--text-color), 0.3);border-radius:1rem}::-webkit-scrollbar-thumb:hover{background:rgba(var(--text-color), 0.5)}.interactive:not([disabled]){transition:background-color .3s}.interactive:not([disabled]):hover{background-color:rgba(var(--text-color), 0.06)}button:not([disabled]),.button:not([disabled]){transition:background-color .3s,filter .3s}button:not([disabled]):hover,.button:not([disabled]):hover{filter:contrast(2)}}@supports(overflow: overlay){body{overflow:overlay}}.hidden{display:none !important}
\ No newline at end of file
+*{padding:0;margin:0;box-sizing:border-box;font-family:"Roboto",sans-serif}:root{font-size:clamp(1rem,1.2vmax,1.2rem)}html,body{height:100%}body{--accent-color: #4d77ff;--accent-color-rgb: 77, 119, 255;--text-color: 20, 20, 20;--foreground-color: 252, 253, 255;--background-color: 241, 243, 248;--danger-color: rgb(225, 58, 58);--green: #1cad59;--yellow: rgb(255, 207, 65);scrollbar-width:thin;scrollbar-gutter:stable;color:rgba(var(--text-color), 1);background-color:rgba(var(--background-color), 1);position:relative;display:flex;flex-direction:column}body[data-theme=dark]{--accent-color: #a0b6ff;--accent-color-rgb: 160, 182, 255;--text-color: 220, 220, 220;--foreground-color: 27, 28, 29;--background-color: 21, 22, 22;--danger-color: rgb(255, 106, 106);--green: #00e676;--yellow: rgb(255, 213, 5)}body[data-theme=dark] sm-popup::part(popup){background-color:rgba(var(--foreground-color), 1)}p,strong{font-size:.9rem;max-width:65ch;line-height:1.7;color:rgba(var(--text-color), 0.9)}.warning{line-height:normal;padding:1rem;background-color:khaki;border-radius:.5rem;font-weight:500;color:rgba(0,0,0,.7)}a{text-decoration:none;color:var(--accent-color)}a:focus-visible{box-shadow:0 0 0 .1rem rgba(var(--text-color), 1) inset}button,.button{-webkit-user-select:none;-moz-user-select:none;user-select:none;position:relative;display:inline-flex;border:none;background-color:rgba(0,0,0,0);overflow:hidden;-webkit-tap-highlight-color:rgba(0,0,0,0);align-items:center;font-size:.9rem;font-weight:500;white-space:nowrap;padding:.8rem;border-radius:.5rem;justify-content:center;flex-shrink:0}button:focus-visible,.button:focus-visible{outline:var(--accent-color) solid medium}button:not(:disabled),.button:not(:disabled){color:var(--accent-color);cursor:pointer}button .icon,.button .icon{fill:var(--accent-color)}.button{display:inline-flex;background-color:rgba(var(--text-color), 0.06)}.button--primary,.button--danger{color:rgba(var(--background-color), 1) !important}.button--primary .icon,.button--danger .icon{fill:rgba(var(--background-color), 1)}.button--primary{background-color:var(--accent-color)}.button--danger{background-color:var(--danger-color)}.button--small{padding:.4rem .5rem}.button--colored{color:var(--accent-color) !important}.button--colored .icon{fill:var(--accent-color)}.cta{text-transform:uppercase;font-size:.9rem;font-weight:700;letter-spacing:.05em;padding:.8rem 1rem}.icon{width:1.2rem;height:1.2rem;fill:rgba(var(--text-color), 0.8);flex-shrink:0}.icon-only{padding:.5rem;border-radius:.3rem}button:disabled{opacity:.5}a:-webkit-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:-moz-any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}a:any-link:focus-visible{outline:rgba(var(--text-color), 1) .1rem solid}details summary{display:flex;gap:.3rem;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer;align-items:center;color:var(--accent-color)}details summary .down-arrow{fill:var(--accent-color)}details[open] summary{margin-bottom:1rem}details[open]>summary .down-arrow{transform:rotate(180deg)}sm-input,sm-textarea{width:100%;--border-radius: 0.5rem;--background-color: rgba(var(--foreground-color), 1)}sm-input button .icon,sm-textarea button .icon{fill:var(--accent-color)}sm-button{--padding: 0.8rem}sm-button[variant=primary] .icon{fill:rgba(var(--background-color), 1)}sm-button[disabled] .icon{fill:rgba(var(--text-color), 0.6)}sm-button.danger{--background: var(--danger-color);color:rgba(var(--background-color), 1)}sm-spinner{--size: 1rem;--stroke-width: 0.1rem}sm-form{--gap: 1rem}sm-select{font-size:.9rem;--padding: 0.6rem 0.3rem 0.6rem 0.6rem}sm-option{font-size:.9rem}sm-chips{--gap: 0;background-color:rgba(var(--text-color), 0.06);border-radius:.5rem;padding:.3rem}sm-chip{font-size:.9rem;--border-radius: 0.3rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}sm-chip[selected]{color:rgba(var(--background-color), 1);--background: var(--accent-color)}sm-notifications{z-index:100000}ul,ol{list-style:none}ol{counter-reset:item}ol li{position:relative;display:flex;align-items:flex-start;counter-increment:item}ol li:not(:last-of-type){padding-bottom:1.5rem}ol li:not(:last-of-type)::after{content:"";position:absolute;width:.1rem;height:calc(100% - 2.2rem);background:var(--accent-color);margin-left:.7rem;margin-top:2rem}ol li::before{content:counter(item);display:flex;align-items:center;justify-content:center;text-align:center;font-size:.9rem;font-weight:500;margin-top:.15rem;margin-right:1rem;line-height:1;width:1.5rem;height:1.5rem;border-radius:100%;flex-shrink:0;color:rgba(var(--text-color), 0.8);background:rgba(var(--text-color), 0.1)}.overflow-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.wrap-around{overflow-wrap:break-word;word-wrap:break-word;word-break:break-word}.full-bleed{grid-column:1/-1}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.sticky{position:-webkit-sticky;position:sticky}.top-0{top:0}.flex{display:flex}.flex-wrap{flex-wrap:wrap}.flex-1{flex:1}.flex-direction-column{flex-direction:column}.grid{display:grid}.flow-column{grid-auto-flow:column}.gap-0-3{gap:.3rem}.gap-0-5{gap:.5rem}.gap-1{gap:1rem}.gap-1-5{gap:1.5rem}.gap-2{gap:2rem}.gap-3{gap:3rem}.text-align-right{text-align:right}.align-content-start{align-content:flex-start}.align-items-start{align-items:flex-start}.align-center{align-items:center}.align-end{align-items:flex-end}.text-center{text-align:center}.justify-start{justify-items:start}.justify-center{justify-content:center}.justify-right{margin-left:auto}.align-self-center{align-self:center}.align-self-end{align-self:end}.justify-self-center{justify-self:center}.justify-self-start{justify-self:start}.justify-self-end{justify-self:end}.flex-direction-column{flex-direction:column}.space-between{justify-content:space-between}.w-100{width:100%}.h-100{height:100%}.label{font-size:.9rem;color:rgba(var(--text-color), 0.8);font-weight:500;margin-bottom:.2rem}.button--primary .ripple,.button--danger .ripple{background:radial-gradient(circle, rgba(var(--background-color), 0.3) 0%, rgba(0, 0, 0, 0) 50%)}.ripple{height:8rem;width:8rem;position:absolute;border-radius:50%;transform:scale(0);background:radial-gradient(circle, rgba(var(--text-color), 0.3) 0%, rgba(0, 0, 0, 0) 50%);pointer-events:none}.interactive{position:relative;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.empty-state{display:grid;width:100%;padding:1.5rem 0}.observe-empty-state:empty{display:none !important}.observe-empty-state:not(:empty)+.empty-state{display:none !important}.bullet-point{display:flex;align-items:center;justify-content:center;margin:0 .8ch}.bullet-point::after{content:"";height:.4ch;width:.4ch;border-radius:.5em;background-color:var(--accent-color)}.margin-right-0-3{margin-right:.3rem}.margin-right-0-5{margin-right:.5rem}.margin-right-auto{margin-right:auto}.margin-left-0-5{margin-left:.5rem}.margin-left-auto{margin-left:auto}.margin-top-1-5{margin-top:1.5rem}.margin-bottom-0-5{margin-bottom:.5rem}.margin-bottom-1{margin-bottom:1rem}.margin-bottom-1-5{margin-bottom:1.5rem}.margin-bottom-2{margin-bottom:2rem}.icon-button{padding:.6rem;border-radius:.8rem;background-color:rgba(var(--text-color), 0.1);height:-webkit-max-content;height:-moz-max-content;height:max-content}.icon-button .icon{fill:var(--accent-color)}.page{height:100%}.page__header{display:flex;justify-content:space-between;margin-bottom:1.5rem;min-height:8rem}.page__header .grid{margin-top:auto}.page__header h1{margin-top:auto;font-size:2rem}#confirmation_popup,#prompt_popup{flex-direction:column}#confirmation_popup h4,#prompt_popup h4{margin-bottom:1.5rem}#confirmation_popup sm-button,#prompt_popup sm-button{margin:0}#confirmation_popup>.flex:last-of-type,#prompt_popup>.flex:last-of-type{padding:0;margin-top:1rem}#confirmation_popup>.flex:last-of-type sm-button:first-of-type,#prompt_popup>.flex:last-of-type sm-button:first-of-type{margin-right:.6rem;margin-left:auto}#prompt_message{margin-bottom:1.5rem}.popup__header{display:grid;gap:.5rem;width:100%;padding:0 1.5rem;align-items:center}.popup__header__close{padding:.5rem;margin-left:-0.5rem}#secondary_pages{display:flex;flex-direction:column;width:100%}#secondary_pages header{padding:1.5rem}#secondary_pages .inner-page{height:100%}#landing>section{justify-content:center;justify-items:center;align-items:center;text-align:center;padding:8vw 0}#landing h1{font-size:clamp(2rem,5vw,5rem)}#loading_page{display:grid;gap:1rem;place-content:center;place-items:center;position:fixed;top:0;left:0;width:100%;height:100%;z-index:20;background-color:rgba(var(--foreground-color), 1)}#main_header{padding:1rem max(1rem,4vw)}.app-brand{display:flex;gap:.3rem;align-items:center}.app-brand .icon{height:1.7rem;width:1.7rem}.app-name__company{font-size:.8rem;font-weight:500;color:rgba(var(--text-color), 0.8)}#main_card{display:grid;grid-template-columns:minmax(0, 1fr);grid-template-rows:auto 1fr;height:100%;width:100%;background-color:rgba(var(--foreground-color), 1)}#main_navbar{display:flex;background:rgba(var(--text-color), 0.03)}#main_navbar.hide-away{position:absolute}#main_navbar ul{display:flex;height:100%;width:100%}#main_navbar ul li{width:100%}.nav-item{position:relative;display:flex;flex:1;width:100%;flex-direction:column;align-items:center;justify-content:center;padding:.5rem .3rem;color:var(--text-color);font-size:.9rem;border-radius:.3rem;font-weight:500}.nav-item .icon{transition:transform .2s cubic-bezier(0.175, 0.885, 0.32, 1.275)}.nav-item__title{margin-top:.3rem;transition:opacity .2s,transform .2s cubic-bezier(0.175, 0.885, 0.32, 1.275)}.nav-item--active{color:var(--accent-color)}.nav-item--active .icon{fill:var(--accent-color);transform:translateY(50%)}.nav-item--active .nav-item__title{transform:translateY(100%);opacity:0}.nav-item__indicator{position:absolute;bottom:0;width:2rem;height:.3rem;background:var(--accent-color);border-radius:1rem 1rem 0 0;z-index:1}.inner-page{padding:0 1.5rem;flex:1;overflow-y:auto;align-content:start}.password-field label{display:flex}.password-field label input:checked~.visible{display:none}.password-field label input:not(:checked)~.invisible{display:none}.multi-state-button{display:grid;text-align:center;align-items:center;justify-items:center}.multi-state-button>*{grid-area:1/1/2/2}.multi-state-button button{z-index:1;width:100%}.scrolling-wrapper{overflow-y:auto}#pages_container{overflow-y:auto;padding:0 1rem}.primary-action{display:flex;padding:.8rem 1rem;gap:.5rem;white-space:normal;font-size:.9rem;border-radius:.5rem;background-color:rgba(0,0,0,0);border:thin solid rgba(var(--text-color), 0.3);text-align:left;flex-shrink:1}.primary-action .icon{fill:var(--accent-color)}#flo_id_warning{padding-bottom:1.5rem;border-bottom:thin solid rgba(var(--text-color), 0.3)}#flo_id_warning .icon{height:4rem;width:4rem;padding:1rem;background-color:#ffc107;border-radius:3rem;fill:rgba(0,0,0,.8);margin-bottom:1.5rem}.generated-id-card{display:grid;gap:1rem}.generated-id-card h5{margin-bottom:.3rem}#search_query_input{font-weight:500}#address_balance_card{padding:1.5rem;border-radius:.5rem;margin-top:.5rem;margin-bottom:1.5rem;background-color:rgba(var(--accent-color-rgb), 0.2)}#address_balance{font-size:1.2rem;font-weight:700;color:var(--accent-color)}#filter_selector{--padding: 0.3rem 0.5rem}#filter_selector sm-chip{font-weight:500}.card{padding:.5rem 0;border:none}.card:not(:last-of-type){border-bottom:solid thin rgba(var(--text-color), 0.3)}.remove-card-wrapper{min-height:2rem}.sender-card{display:grid;gap:.5rem;margin-bottom:.5rem}.sender-card sm-input{border-radius:.5rem}.sender-card sm-input.error{border:var(--danger-color) solid}.receiver-card{display:grid;gap:.5rem}.balance-wrapper{padding-bottom:.5rem;border-bottom:thin solid rgba(var(--text-color), 0.3)}#tx_details__header:has(#tx_status) time{text-align:left;margin-right:auto}#tx_details__header:has(:not(#tx_status)) time{text-align:right;margin-left:auto}#transactions_list{display:grid;gap:2rem;padding-bottom:4rem;padding-top:2rem}transaction-card{position:relative}transaction-card:not(:last-of-type){padding-bottom:2rem}transaction-card:not(:last-of-type)::after{content:"";position:absolute;bottom:0;right:0;height:1px;width:calc(100% - 3.5rem);background-color:rgba(var(--text-color), 0.2)}.transaction{position:relative;grid-template-columns:auto 1fr;gap:.5rem 1rem;align-items:center}.transaction.in .transaction__amount{color:var(--green)}.transaction.in .transaction__amount::before{content:"+"}.transaction.out .transaction__amount{color:var(--danger-color)}.transaction.out .transaction__amount::before{content:"-"}.transaction__amount{white-space:nowrap}.transaction.out .transaction__icon .icon{fill:var(--danger-color)}.transaction.in .transaction__icon .icon{fill:var(--green)}.transaction.unconfirmed-tx .transaction__icon .icon{fill:var(--yellow)}.transaction__icon{display:flex;align-items:center;justify-content:center;width:2.5rem;height:2.5rem;background-color:rgba(var(--text-color), 0.03);border-radius:2rem}.transaction__receiver{font-weight:500;margin-bottom:.3rem;line-height:1.5}.transaction__time{font-size:.9rem;color:rgba(var(--text-color), 0.8);text-wrap:balance}.transaction__amount{font-size:1rem;font-weight:700}.transaction__id{font-size:.9rem}.pending-badge{font-size:.8rem;padding:.2rem .5rem;border-radius:.5rem;background-color:var(--yellow);color:rgba(0,0,0,.8);font-weight:500;justify-self:flex-start}.tx-participant:not(:last-of-type){margin-right:.5rem}.tx-participant:not(:last-of-type)::after{content:","}#tx_details time{padding:.3rem .8rem;border-radius:5rem;background-color:rgba(var(--text-color), 0.06);font-weight:500;font-size:.9rem;text-wrap:balance}#tx_status{display:flex;align-items:center;gap:.5rem;padding:.6rem .8rem;border-radius:.5rem;background-color:rgba(var(--text-color), 0.03);color:var(--danger-color);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}#tx_status .icon{fill:var(--danger-color)}#tx_amount{font-size:max(2rem,4vw);font-weight:700;text-wrap:balance}#tx_technicals .tx-detail:first-of-type{position:relative}#tx_technicals .tx-detail:first-of-type::before{content:"";position:absolute;top:50%;left:0;transform:translateY(-50%);width:.2rem;height:calc(100% - 2rem);background-color:var(--accent-color);border-radius:0 1rem 1rem 0}.details-wrapper{display:flex;flex-wrap:wrap;gap:.5rem;width:100%}.tx-detail{display:grid;gap:.5rem;align-content:flex-start;background-color:rgba(var(--text-color), 0.03);padding:1rem;border-radius:.5rem;flex:1 1 8rem}.tx-detail .flex div{color:rgba(var(--text-color), 0.8);font-size:.9rem;font-weight:500}.tx-detail>div{font-weight:700;font-size:1rem;color:rgba(var(--text-color), 0.9)}#in_out_wrapper{display:grid;grid-template-columns:repeat(auto-fit, minmax(16rem, 1fr));gap:1rem;margin-bottom:3rem}.in-out-card{display:grid;grid-template-columns:minmax(0, 1fr) auto;gap:.5rem;padding:1rem;border-radius:.5rem;background-color:rgba(var(--text-color), 0.03)}.in-out-card:not(:last-of-type){margin-bottom:.5rem}.in-out-card>:first-child{margin-right:1rem}#selected_fee_tip{font-weight:500}#selected_fee_tip.error{color:var(--danger-color)}#selected_fee_tip.error .icon{fill:var(--danger-color)}.fab{position:absolute;right:0;bottom:0;margin:1.5rem;box-shadow:0 .5rem 1rem rgba(0,0,0,.2);z-index:2}#scroll_to_top{border-radius:3rem;background-color:rgba(var(--foreground-color), 1)}#txid{font-size:.9rem}.user-action-result__icon{justify-self:center;height:4rem;width:4rem;border-radius:5rem;-webkit-animation:popup 1s;animation:popup 1s}.user-action-result__icon.success{fill:rgba(var(--background-color), 1);padding:1rem;background-color:#0bbe56}.user-action-result__icon.failed{background-color:rgba(var(--text-color), 0.03);fill:var(--danger-color)}@-webkit-keyframes popup{0%{opacity:0;transform:scale(0.2) translateY(600%)}10%{transform:scale(0.2) translateY(5rem);opacity:1}40%{transform:scale(0.2) translateY(0)}80%{transform:scale(1.1) translateY(0)}100%{transform:scale(1) translateY(0)}}@keyframes popup{0%{opacity:0;transform:scale(0.2) translateY(600%)}10%{transform:scale(0.2) translateY(5rem);opacity:1}40%{transform:scale(0.2) translateY(0)}80%{transform:scale(1.1) translateY(0)}100%{transform:scale(1) translateY(0)}}.increase-fee-sender,.increase-fee-receiver{padding:1rem;border-radius:.5rem;border:solid thin rgba(var(--text-color), 0.3)}.input-action-wrapper{display:flex;gap:.5rem;flex-wrap:wrap;width:100%;align-items:start;container:input-action/inline-size}.input-action-wrapper sm-input{width:auto;flex:1;min-width:20rem}.input-action-wrapper button{min-width:7rem;min-height:3.15rem}@container input-action (max-width: 28rem){sm-input{width:100%;min-width:16rem !important}button{flex:1}}#conversion_view_selector{margin-right:auto;font-weight:500}.converted-card:not(:empty){border-radius:.5rem;padding:1rem;background-color:rgba(var(--text-color), 0.03)}.converted-card:not(:empty) sm-copy{font-weight:500;color:rgba(var(--text-color), 0.9)}@media screen and (max-width: 40rem){#main_navbar.hide-away{bottom:0;left:0;right:0}}@media screen and (min-width: 40rem){sm-popup{--width: 24rem}.popup__header{grid-column:1/-1;padding:1rem 1.5rem 0 1.5rem}body{align-items:center;justify-content:center}#main_card{grid-template-areas:"header" ".";position:relative;overflow:hidden;box-shadow:0 .1rem .2rem rgba(0,0,0,.05),0 1rem 3rem rgba(0,0,0,.2)}#main_card:not(.nav-hidden){grid-template-columns:auto 1fr;grid-template-rows:auto 1fr;grid-template-areas:"nav header" "nav ."}#main_header{grid-area:header;padding:1.5rem max(1rem,4vw)}#main_navbar{grid-area:nav;border-top:none;flex-direction:column;background-color:rgba(37,110,255,.03)}#main_navbar ul{flex-direction:column;gap:.5rem;padding:.3rem}.nav-item{aspect-ratio:1/1}.nav-item__indicator{width:.25rem;height:50%;left:0;border-radius:0 1rem 1rem 0;bottom:auto}body[data-theme=dark] #main_navbar{background-color:rgba(0,0,0,.2)}.page{width:min(60rem,100%);margin:0 auto}#generate_btc_addr_popup,#retrieve_btc_addr_popup{--width: 28rem}#convert{width:min(72rem,100%)}#key_conversion_content{grid-template-columns:1fr 1fr;align-items:flex-start}#increase_fee_popup{--width: 30rem}}@media screen and (min-width: 48rem){.sender-card,.receiver-card{grid-template-columns:1fr 1fr}}@media(any-hover: hover){::-webkit-scrollbar{width:.5rem;height:.5rem}::-webkit-scrollbar-thumb{background:rgba(var(--text-color), 0.3);border-radius:1rem}::-webkit-scrollbar-thumb:hover{background:rgba(var(--text-color), 0.5)}.interactive:not([disabled]){transition:background-color .3s}.interactive:not([disabled]):hover{background-color:rgba(var(--text-color), 0.06)}button:not([disabled]),.button:not([disabled]){transition:background-color .3s,filter .3s}button:not([disabled]):hover,.button:not([disabled]):hover{filter:contrast(2)}}@supports(overflow: overlay){body{overflow:overlay}}.hidden{display:none !important}
\ No newline at end of file
diff --git a/btcwallet/css/main.scss b/btcwallet/css/main.scss
index 2b2b4c5..db13506 100644
--- a/btcwallet/css/main.scss
+++ b/btcwallet/css/main.scss
@@ -4,6 +4,7 @@
box-sizing: border-box;
font-family: "Roboto", sans-serif;
}
+
:root {
font-size: clamp(1rem, 1.2vmax, 1.2rem);
}
@@ -26,7 +27,6 @@ body {
scrollbar-gutter: stable;
color: rgba(var(--text-color), 1);
background-color: rgba(var(--background-color), 1);
- transition: background-color 0.3s;
position: relative;
display: flex;
flex-direction: column;
@@ -41,6 +41,7 @@ body[data-theme="dark"] {
--danger-color: rgb(255, 106, 106);
--green: #00e676;
--yellow: rgb(255, 213, 5);
+
sm-popup::part(popup) {
background-color: rgba(var(--foreground-color), 1);
}
@@ -53,6 +54,7 @@ strong {
line-height: 1.7;
color: rgba(var(--text-color), 0.9);
}
+
.warning {
line-height: normal;
padding: 1rem;
@@ -61,13 +63,16 @@ strong {
font-weight: 500;
color: rgba(0, 0, 0, 0.7);
}
+
a {
text-decoration: none;
color: var(--accent-color);
+
&:focus-visible {
box-shadow: 0 0 0 0.1rem rgba(var(--text-color), 1) inset;
}
}
+
button,
.button {
user-select: none;
@@ -85,43 +90,55 @@ button,
border-radius: 0.5rem;
justify-content: center;
flex-shrink: 0;
+
&:focus-visible {
outline: var(--accent-color) solid medium;
}
+
&:not(:disabled) {
color: var(--accent-color);
cursor: pointer;
}
+
.icon {
fill: var(--accent-color);
}
}
+
.button {
display: inline-flex;
background-color: rgba(var(--text-color), 0.06);
+
&--primary,
&--danger {
color: rgba(var(--background-color), 1) !important;
+
.icon {
fill: rgba(var(--background-color), 1);
}
}
+
&--primary {
background-color: var(--accent-color);
}
+
&--danger {
background-color: var(--danger-color);
}
+
&--small {
padding: 0.4rem 0.5rem;
}
+
&--colored {
color: var(--accent-color) !important;
+
.icon {
fill: var(--accent-color);
}
}
}
+
.cta {
text-transform: uppercase;
font-size: 0.9rem;
@@ -129,12 +146,14 @@ button,
letter-spacing: 0.05em;
padding: 0.8rem 1rem;
}
+
.icon {
width: 1.2rem;
height: 1.2rem;
fill: rgba(var(--text-color), 0.8);
flex-shrink: 0;
}
+
.icon-only {
padding: 0.5rem;
border-radius: 0.3rem;
@@ -155,6 +174,7 @@ details summary {
cursor: pointer;
align-items: center;
color: var(--accent-color);
+
.down-arrow {
fill: var(--accent-color);
}
@@ -164,7 +184,8 @@ details[open] {
& summary {
margin-bottom: 1rem;
}
- & > summary .down-arrow {
+
+ &>summary .down-arrow {
transform: rotate(180deg);
}
}
@@ -174,14 +195,17 @@ sm-textarea {
width: 100%;
--border-radius: 0.5rem;
--background-color: rgba(var(--foreground-color), 1);
+
button {
.icon {
fill: var(--accent-color);
}
}
}
+
sm-button {
--padding: 0.8rem;
+
&[variant="primary"] {
.icon {
fill: rgba(var(--background-color), 1);
@@ -193,56 +217,70 @@ sm-button {
fill: rgba(var(--text-color), 0.6);
}
}
+
&.danger {
--background: var(--danger-color);
color: rgba(var(--background-color), 1);
}
}
+
sm-spinner {
--size: 1rem;
--stroke-width: 0.1rem;
}
+
sm-form {
--gap: 1rem;
}
+
sm-select {
font-size: 0.9rem;
--padding: 0.6rem 0.3rem 0.6rem 0.6rem;
}
+
sm-option {
font-size: 0.9rem;
}
+
sm-chips {
--gap: 0;
background-color: rgba(var(--text-color), 0.06);
border-radius: 0.5rem;
padding: 0.3rem;
}
+
sm-chip {
font-size: 0.9rem;
--border-radius: 0.3rem;
user-select: none;
+
&[selected] {
color: rgba(var(--background-color), 1);
--background: var(--accent-color);
}
}
+
sm-notifications {
z-index: 100000;
}
+
ul,
ol {
list-style: none;
}
+
ol {
counter-reset: item;
+
li {
position: relative;
display: flex;
align-items: flex-start;
counter-increment: item;
+
&:not(:last-of-type) {
padding-bottom: 1.5rem;
+
&::after {
content: "";
position: absolute;
@@ -254,6 +292,7 @@ ol {
}
}
}
+
li::before {
content: counter(item);
display: flex;
@@ -290,6 +329,7 @@ ol {
.full-bleed {
grid-column: 1/-1;
}
+
.uppercase {
text-transform: uppercase;
}
@@ -301,6 +341,7 @@ ol {
.sticky {
position: sticky;
}
+
.top-0 {
top: 0;
}
@@ -308,12 +349,15 @@ ol {
.flex {
display: flex;
}
+
.flex-wrap {
flex-wrap: wrap;
}
+
.flex-1 {
flex: 1;
}
+
.flex-direction-column {
flex-direction: column;
}
@@ -321,6 +365,7 @@ ol {
.grid {
display: grid;
}
+
.flow-column {
grid-auto-flow: column;
}
@@ -328,6 +373,7 @@ ol {
.gap-0-3 {
gap: 0.3rem;
}
+
.gap-0-5 {
gap: 0.5rem;
}
@@ -359,9 +405,11 @@ ol {
.align-items-start {
align-items: flex-start;
}
+
.align-center {
align-items: center;
}
+
.align-end {
align-items: flex-end;
}
@@ -385,6 +433,7 @@ ol {
.align-self-center {
align-self: center;
}
+
.align-self-end {
align-self: end;
}
@@ -412,9 +461,11 @@ ol {
.w-100 {
width: 100%;
}
+
.h-100 {
height: 100%;
}
+
.label {
font-size: 0.9rem;
color: rgba(var(--text-color), 0.8);
@@ -425,32 +476,31 @@ ol {
.button--primary,
.button--danger {
.ripple {
- background: radial-gradient(
- circle,
- rgba(var(--background-color), 0.3) 0%,
- rgba(0, 0, 0, 0) 50%
- );
+ background: radial-gradient(circle,
+ rgba(var(--background-color), 0.3) 0%,
+ rgba(0, 0, 0, 0) 50%);
}
}
+
.ripple {
height: 8rem;
width: 8rem;
position: absolute;
border-radius: 50%;
transform: scale(0);
- background: radial-gradient(
- circle,
- rgba(var(--text-color), 0.3) 0%,
- rgba(0, 0, 0, 0) 50%
- );
+ background: radial-gradient(circle,
+ rgba(var(--text-color), 0.3) 0%,
+ rgba(0, 0, 0, 0) 50%);
pointer-events: none;
}
+
.interactive {
position: relative;
overflow: hidden;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
+
.empty-state {
display: grid;
width: 100%;
@@ -461,7 +511,7 @@ ol {
display: none !important;
}
-.observe-empty-state:not(:empty) + .empty-state {
+.observe-empty-state:not(:empty)+.empty-state {
display: none !important;
}
@@ -470,6 +520,7 @@ ol {
align-items: center;
justify-content: center;
margin: 0 0.8ch;
+
&::after {
content: "";
height: 0.4ch;
@@ -478,12 +529,15 @@ ol {
background-color: var(--accent-color);
}
}
+
.margin-right-0-3 {
margin-right: 0.3rem;
}
+
.margin-right-0-5 {
margin-right: 0.5rem;
}
+
.margin-right-auto {
margin-right: auto;
}
@@ -491,21 +545,27 @@ ol {
.margin-left-0-5 {
margin-left: 0.5rem;
}
+
.margin-left-auto {
margin-left: auto;
}
+
.margin-top-1-5 {
margin-top: 1.5rem;
}
+
.margin-bottom-0-5 {
margin-bottom: 0.5rem;
}
+
.margin-bottom-1 {
margin-bottom: 1rem;
}
+
.margin-bottom-1-5 {
margin-bottom: 1.5rem;
}
+
.margin-bottom-2 {
margin-bottom: 2rem;
}
@@ -515,44 +575,55 @@ ol {
border-radius: 0.8rem;
background-color: rgba(var(--text-color), 0.1);
height: max-content;
+
.icon {
fill: var(--accent-color);
}
}
+
.page {
height: 100%;
+
&__header {
display: flex;
justify-content: space-between;
margin-bottom: 1.5rem;
min-height: 8rem;
+
.grid {
margin-top: auto;
}
+
h1 {
margin-top: auto;
font-size: 2rem;
}
}
}
+
#confirmation_popup,
#prompt_popup {
flex-direction: column;
+
h4 {
margin-bottom: 1.5rem;
}
+
sm-button {
margin: 0;
}
- & > .flex:last-of-type {
+
+ &>.flex:last-of-type {
padding: 0;
margin-top: 1rem;
+
sm-button:first-of-type {
margin-right: 0.6rem;
margin-left: auto;
}
}
}
+
#prompt_message {
margin-bottom: 1.5rem;
}
@@ -569,29 +640,35 @@ ol {
padding: 0.5rem;
margin-left: -0.5rem;
}
+
#secondary_pages {
display: flex;
flex-direction: column;
width: 100%;
+
header {
padding: 1.5rem;
}
+
.inner-page {
height: 100%;
}
}
+
#landing {
- & > section {
+ &>section {
justify-content: center;
justify-items: center;
align-items: center;
text-align: center;
padding: 8vw 0;
}
+
h1 {
font-size: clamp(2rem, 5vw, 5rem);
}
}
+
#loading_page {
display: grid;
gap: 1rem;
@@ -605,18 +682,22 @@ ol {
z-index: 20;
background-color: rgba(var(--foreground-color), 1);
}
+
#main_header {
- padding: 1.5rem max(1rem, 4vw);
+ padding: 1rem max(1rem, 4vw);
}
+
.app-brand {
display: flex;
gap: 0.3rem;
align-items: center;
+
.icon {
height: 1.7rem;
width: 1.7rem;
}
}
+
.app-name {
&__company {
font-size: 0.8rem;
@@ -624,31 +705,35 @@ ol {
color: rgba(var(--text-color), 0.8);
}
}
+
#main_card {
display: grid;
grid-template-columns: minmax(0, 1fr);
grid-template-rows: auto 1fr;
height: 100%;
width: 100%;
- transition: background-color 0.3s;
background-color: rgba(var(--foreground-color), 1);
}
#main_navbar {
display: flex;
background: rgba(var(--text-color), 0.03);
+
&.hide-away {
position: absolute;
}
+
ul {
display: flex;
height: 100%;
width: 100%;
+
li {
width: 100%;
}
}
}
+
.nav-item {
position: relative;
display: flex;
@@ -662,25 +747,31 @@ ol {
font-size: 0.9rem;
border-radius: 0.3rem;
font-weight: 500;
+
.icon {
transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
+
&__title {
margin-top: 0.3rem;
transition: opacity 0.2s,
transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
+
&--active {
color: var(--accent-color);
+
.icon {
fill: var(--accent-color);
transform: translateY(50%);
}
+
.nav-item__title {
transform: translateY(100%);
opacity: 0;
}
}
+
&__indicator {
position: absolute;
bottom: 0;
@@ -691,6 +782,7 @@ ol {
z-index: 1;
}
}
+
.inner-page {
padding: 0 1.5rem;
flex: 1;
@@ -701,34 +793,42 @@ ol {
.password-field {
label {
display: flex;
- input:checked ~ .visible {
+
+ input:checked~.visible {
display: none;
}
- input:not(:checked) ~ .invisible {
+
+ input:not(:checked)~.invisible {
display: none;
}
}
}
+
.multi-state-button {
display: grid;
text-align: center;
align-items: center;
justify-items: center;
- & > * {
+
+ &>* {
grid-area: 1/1/2/2;
}
+
button {
z-index: 1;
width: 100%;
}
}
+
.scrolling-wrapper {
overflow-y: auto;
}
+
#pages_container {
overflow-y: auto;
padding: 0 1rem;
}
+
.primary-action {
display: flex;
padding: 0.8rem 1rem;
@@ -740,13 +840,16 @@ ol {
border: thin solid rgba(var(--text-color), 0.3);
text-align: left;
flex-shrink: 1;
+
.icon {
fill: var(--accent-color);
}
}
+
#flo_id_warning {
padding-bottom: 1.5rem;
border-bottom: thin solid rgba(var(--text-color), 0.3);
+
.icon {
height: 4rem;
width: 4rem;
@@ -757,13 +860,20 @@ ol {
margin-bottom: 1.5rem;
}
}
+
.generated-id-card {
display: grid;
gap: 1rem;
+
h5 {
margin-bottom: 0.3rem;
}
}
+
+#search_query_input {
+ font-weight: 500;
+}
+
#address_balance_card {
padding: 1.5rem;
border-radius: 0.5rem;
@@ -771,85 +881,148 @@ ol {
margin-bottom: 1.5rem;
background-color: rgba(var(--accent-color-rgb), 0.2);
}
+
#address_balance {
font-size: 1.2rem;
font-weight: 700;
color: var(--accent-color);
}
+
+#filter_selector {
+ --padding: 0.3rem 0.5rem;
+
+ sm-chip {
+ font-weight: 500;
+ }
+}
+
.card {
padding: 0.5rem 0;
border: none;
+
&:not(:last-of-type) {
border-bottom: solid thin rgba(var(--text-color), 0.3);
}
}
+
.remove-card-wrapper {
min-height: 2rem;
}
+
.sender-card {
display: grid;
gap: 0.5rem;
margin-bottom: 0.5rem;
+
sm-input {
border-radius: 0.5rem;
+
&.error {
border: var(--danger-color) solid;
}
}
}
+
.receiver-card {
display: grid;
gap: 0.5rem;
}
+
.balance-wrapper {
padding-bottom: 0.5rem;
border-bottom: thin solid rgba(var(--text-color), 0.3);
}
+#tx_details__header {
+ &:has(#tx_status) {
+ time {
+ text-align: left;
+ margin-right: auto;
+ }
+ }
+
+ &:has(:not(#tx_status)) {
+ time {
+ text-align: right;
+ margin-left: auto;
+ }
+ }
+}
+
#transactions_list {
display: grid;
gap: 2rem;
padding-bottom: 4rem;
+ padding-top: 2rem;
}
+
+transaction-card {
+ position: relative;
+
+ &:not(:last-of-type) {
+ padding-bottom: 2rem;
+
+ &::after {
+ content: '';
+ position: absolute;
+ bottom: 0;
+ right: 0;
+ height: 1px;
+ width: calc(100% - 3.5rem);
+ background-color: rgba(var(--text-color), 0.2);
+ }
+ }
+}
+
.transaction {
+ position: relative;
grid-template-columns: auto 1fr;
gap: 0.5rem 1rem;
align-items: center;
- content-visibility: auto;
- contain-intrinsic-height: 8rem;
- &:not(:last-of-type) {
- padding-bottom: 2rem;
+
+ &.in {
+ .transaction__amount {
+ color: var(--green);
+
+ &::before {
+ content: "+";
+ }
+ }
}
+
+ &.out {
+ .transaction__amount {
+ color: var(--danger-color);
+
+ &::before {
+ content: "-";
+ }
+ }
+ }
+
&__amount {
white-space: nowrap;
}
+
&.out {
.transaction__icon .icon {
fill: var(--danger-color);
}
- .transaction__amount {
- color: var(--danger-color);
- &::before {
- content: "- ";
- }
- }
}
+
&.in {
.transaction__icon .icon {
fill: var(--green);
}
- .transaction__amount {
- color: var(--green);
- &::before {
- content: "+ ";
- }
- }
+
}
+
&.unconfirmed-tx {
.transaction__icon .icon {
fill: var(--yellow);
}
}
+
&__icon {
display: flex;
align-items: center;
@@ -859,23 +1032,29 @@ ol {
background-color: rgba(var(--text-color), 0.03);
border-radius: 2rem;
}
+
&__receiver {
font-weight: 500;
margin-bottom: 0.3rem;
line-height: 1.5;
}
+
&__time {
font-size: 0.9rem;
color: rgba(var(--text-color), 0.8);
+ text-wrap: balance;
}
+
&__amount {
font-size: 1rem;
font-weight: 700;
}
+
&__id {
font-size: 0.9rem;
}
}
+
.pending-badge {
font-size: 0.8rem;
padding: 0.2rem 0.5rem;
@@ -885,14 +1064,28 @@ ol {
font-weight: 500;
justify-self: flex-start;
}
+
.tx-participant {
&:not(:last-of-type) {
&::after {
content: ",";
}
+
margin-right: 0.5rem;
}
}
+
+#tx_details {
+ time {
+ padding: 0.3rem 0.8rem;
+ border-radius: 5rem;
+ background-color: rgba(var(--text-color), 0.06);
+ font-weight: 500;
+ font-size: 0.9rem;
+ text-wrap: balance;
+ }
+}
+
#tx_status {
display: flex;
align-items: center;
@@ -901,13 +1094,23 @@ ol {
border-radius: 0.5rem;
background-color: rgba(var(--text-color), 0.03);
color: var(--danger-color);
+ width: fit-content;
+
.icon {
fill: var(--danger-color);
}
}
+
+#tx_amount {
+ font-size: max(2rem, 4vw);
+ font-weight: 700;
+ text-wrap: balance;
+}
+
#tx_technicals {
.tx-detail:first-of-type {
position: relative;
+
&::before {
content: "";
position: absolute;
@@ -921,12 +1124,14 @@ ol {
}
}
}
+
.details-wrapper {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
width: 100%;
}
+
.tx-detail {
display: grid;
gap: 0.5rem;
@@ -935,23 +1140,27 @@ ol {
padding: 1rem;
border-radius: 0.5rem;
flex: 1 1 8rem;
+
.flex div {
color: rgba(var(--text-color), 0.8);
font-size: 0.9rem;
font-weight: 500;
}
- & > div {
+
+ &>div {
font-weight: 700;
font-size: 1rem;
color: rgba(var(--text-color), 0.9);
}
}
+
#in_out_wrapper {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
gap: 1rem;
margin-bottom: 3rem;
}
+
.in-out-card {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
@@ -959,22 +1168,28 @@ ol {
padding: 1rem;
border-radius: 0.5rem;
background-color: rgba(var(--text-color), 0.03);
+
&:not(:last-of-type) {
margin-bottom: 0.5rem;
}
- & > :first-child {
+
+ &> :first-child {
margin-right: 1rem;
}
}
+
#selected_fee_tip {
font-weight: 500;
+
&.error {
color: var(--danger-color);
+
.icon {
fill: var(--danger-color);
}
}
}
+
.fab {
position: absolute;
right: 0;
@@ -983,48 +1198,59 @@ ol {
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
z-index: 2;
}
+
#scroll_to_top {
border-radius: 3rem;
background-color: rgba(var(--foreground-color), 1);
}
+
#txid {
font-size: 0.9rem;
}
+
.user-action-result__icon {
justify-self: center;
height: 4rem;
width: 4rem;
border-radius: 5rem;
animation: popup 1s;
+
&.success {
fill: rgba(var(--background-color), 1);
padding: 1rem;
background-color: #0bbe56;
}
+
&.failed {
background-color: rgba(var(--text-color), 0.03);
fill: var(--danger-color);
}
}
+
@keyframes popup {
0% {
opacity: 0;
transform: scale(0.2) translateY(600%);
}
+
10% {
transform: scale(0.2) translateY(5rem);
opacity: 1;
}
+
40% {
transform: scale(0.2) translateY(0);
}
+
80% {
transform: scale(1.1) translateY(0);
}
+
100% {
transform: scale(1) translateY(0);
}
}
+
.increase-fee-sender,
.increase-fee-receiver {
padding: 1rem;
@@ -1039,38 +1265,46 @@ ol {
width: 100%;
align-items: start;
container: input-action / inline-size;
+
sm-input {
width: auto;
flex: 1;
min-width: 20rem;
}
+
button {
min-width: 7rem;
min-height: 3.15rem;
}
}
+
@container input-action (max-width: 28rem) {
sm-input {
width: 100%;
min-width: 16rem !important;
}
+
button {
flex: 1;
}
}
+
#conversion_view_selector {
margin-right: auto;
font-weight: 500;
}
+
.converted-card:not(:empty) {
border-radius: 0.5rem;
padding: 1rem;
background-color: rgba(var(--text-color), 0.03);
+
sm-copy {
font-weight: 500;
color: rgba(var(--text-color), 0.9);
}
}
+
@media screen and (max-width: 40rem) {
#main_navbar {
&.hide-away {
@@ -1080,14 +1314,17 @@ ol {
}
}
}
+
@media screen and (min-width: 40rem) {
sm-popup {
--width: 24rem;
}
+
.popup__header {
grid-column: 1/-1;
padding: 1rem 1.5rem 0 1.5rem;
}
+
body {
align-items: center;
justify-content: center;
@@ -1095,32 +1332,41 @@ ol {
#main_card {
grid-template-areas: "header" ".";
+
&:not(.nav-hidden) {
grid-template-columns: auto 1fr;
grid-template-rows: auto 1fr;
grid-template-areas: "nav header" "nav .";
}
+
position: relative;
overflow: hidden;
box-shadow: 0 0.1rem 0.2rem rgba(0, 0, 0, 0.05),
- 0 1rem 3rem rgba(0, 0, 0, 0.2);
+ 0 1rem 3rem rgba(0, 0, 0, 0.2);
}
+
#main_header {
grid-area: header;
+ padding: 1.5rem max(1rem, 4vw);
+
}
+
#main_navbar {
grid-area: nav;
border-top: none;
flex-direction: column;
background-color: rgba(37 110 255/ 0.03);
+
ul {
flex-direction: column;
gap: 0.5rem;
padding: 0.3rem;
}
}
+
.nav-item {
aspect-ratio: 1/1;
+
&__indicator {
width: 0.25rem;
height: 50%;
@@ -1129,36 +1375,45 @@ ol {
bottom: auto;
}
}
+
body[data-theme="dark"] {
#main_navbar {
background-color: rgba(0 0 0/ 0.2);
}
}
+
.page {
width: min(60rem, 100%);
margin: 0 auto;
}
+
#generate_btc_addr_popup,
#retrieve_btc_addr_popup {
--width: 28rem;
}
+
#convert {
width: min(72rem, 100%);
}
+
#key_conversion_content {
grid-template-columns: 1fr 1fr;
align-items: flex-start;
}
+
#increase_fee_popup {
--width: 30rem;
}
}
+
@media screen and (min-width: 48rem) {
+
.sender-card,
.receiver-card {
grid-template-columns: 1fr 1fr;
}
}
+
@media (any-hover: hover) {
::-webkit-scrollbar {
width: 0.5rem;
@@ -1168,24 +1423,30 @@ ol {
::-webkit-scrollbar-thumb {
background: rgba(var(--text-color), 0.3);
border-radius: 1rem;
+
&:hover {
background: rgba(var(--text-color), 0.5);
}
}
+
.interactive:not([disabled]) {
transition: background-color 0.3s;
+
&:hover {
background-color: rgba(var(--text-color), 0.06);
}
}
+
button:not([disabled]),
.button:not([disabled]) {
transition: background-color 0.3s, filter 0.3s;
+
&:hover {
filter: contrast(2);
}
}
}
+
@supports (overflow: overlay) {
body {
overflow: overlay;
@@ -1194,4 +1455,4 @@ ol {
.hidden {
display: none !important;
-}
+}
\ No newline at end of file
diff --git a/btcwallet/index.html b/btcwallet/index.html
index 681f941..c16cfef 100644
--- a/btcwallet/index.html
+++ b/btcwallet/index.html
@@ -105,14 +105,22 @@
-
-
Transactions
-
- All
- Sent
- Received
-
+
+
Transactions
+
+ All
+ Sent
+ Received
+
+
+
+
+ Show current value
+
+
Balance and transactions will appear here
@@ -566,7 +574,7 @@
else
return relativeTime.from(timestamp)
default:
- return `${month} ${date}, ${year} at ${finalHours}`;
+ return `${month} ${date} ${year}, ${finalHours}`;
}
} catch (e) {
console.error(e);
@@ -591,7 +599,11 @@
return M.join(' ');
}
window.addEventListener('hashchange', e => routeTo(window.location.hash))
- let selectedCurrency = 'btc'
+ let selectedCurrency = 'btc';
+ let historicPriceApis = {
+ active: 0,
+ list: ['https://utility-api.ranchimall.net']
+ };
window.addEventListener("load", () => {
const [browserName, browserVersion] = detectBrowser().split(' ');
const supportedVersions = {
@@ -620,15 +632,24 @@
createRipple(e, e.target.closest("button, .interactive"));
}
});
+ btcOperator.checkIfTor()
+ .then(isTor => {
+ if (isTor)
+ historicPriceApis.list.push('http://omwkzk6bd6zuragdqsrhdyzgxzre7yx4vzrou4vzftintzc2dmagp6qd.onion:8257')
+ })
getExchangeRate()
.then(() => {
- selectedCurrency = localStorage.getItem('btc-wallet-currency') || 'btc'
+ selectedCurrency = localStorage.getItem('btc-wallet-currency') || 'btc';
+ showCurrentValue = localStorage.getItem('btc-wallet-show-current-value') === 'true' || false;
setTimeout(() => {
- document.getElementById('currency_selector').value = selectedCurrency
+ document.getElementById('currency_selector').value = selectedCurrency;
+ document.getElementById('show_current_value').checked = showCurrentValue;
+ getRef('show_current_value').classList.toggle('hidden', selectedCurrency === 'btc')
}, 100)
})
.catch(e => {
- selectedCurrency = 'btc'
+ selectedCurrency = 'btc';
+ showCurrentValue = false;
// console.error(e)
getRef('currency_selector').classList.add('hidden')
}).finally(() => {
@@ -812,6 +833,7 @@
}
}
if (pagesData.lastPage !== pageId) {
+ closePopup()
document.querySelectorAll('.page').forEach(page => page.classList.add('hidden'))
getRef(pageId).classList.remove('hidden')
getRef(pageId).animate([{ opacity: 0 }, { opacity: 1 }], { duration: 300, fill: 'forwards', easing: 'ease' })
@@ -1155,17 +1177,27 @@
}
return {
isValid: parseFloat(value) >= minValidAmount[selectedCurrency],
- errorText: `Amount must be greater than ${getConvertedAmount(minValidAmount.btc, true)} ${selectedCurrency.toUpperCase()}`
+ errorText: `Amount must be greater than ${getConvertedAmount(minValidAmount.btc, { shouldFormatAmount: true })} ${selectedCurrency.toUpperCase()}`
}
}
}
]
}
- let transactionsLazyLoader
- let txDetailsAbortController
- const render = {
- transactionCard(transactionDetails) {
- let { address, amount, time, txid, sender, receiver, type, block } = transactionDetails;
+ function toYDM(timestamp) {
+ const date = new Date(timestamp)
+ return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`
+ }
+ let showCurrentValue = false
+ function handleValuationTypeChange(e) {
+ showCurrentValue = e.target.checked;
+ document.querySelectorAll('transaction-card').forEach(transactionCard => transactionCard.render())
+ localStorage.setItem('btc-wallet-show-current-value', showCurrentValue)
+ }
+ class TransactionCard extends HTMLElement {
+ render = (transactionDetails) => {
+ if (transactionDetails)
+ this.transactionDetails = transactionDetails
+ let { address, amount, time, txid, sender, receiver, type, block, historicPrice } = this.transactionDetails;
let transactionReceiver
let icon
const transactingAddresses = (receiver || sender || [])
@@ -1188,16 +1220,21 @@
}
const queriedAddress = pagesData.params?.query || getRef('search_query_input').value.trim()
const isSender = type === 'out' || type === 'self'
- const className = `transaction grid ${type} ${isUnconfirmed ? 'unconfirmed-tx' : ''}`
- return html.node/*html*/`
-
+ const className = `transaction grid ${type} ${isUnconfirmed ? 'unconfirmed-tx' : ''}`;
+ const valuationDelta = historicPrice && historicPrice[selectedCurrency] ? getConvertedAmount(amount) - getConvertedAmount(amount, { onDate: time }) : 0;
+ const amountOptions = { shouldFormatAmount: true }
+ if (selectedCurrency !== 'btc' && !showCurrentValue && historicPrice && historicPrice[selectedCurrency]) {
+ amountOptions.onDate = time;
+ }
+ renderElem(this, html`
+
${icon}
-
+
${time ? html`
` : ''}
-
${getConvertedAmount(amount, true)}
+
${getConvertedAmount(amount, amountOptions)}
${transactionReceiver}
@@ -1229,42 +1266,87 @@
` : ''}
- `;
+ `);
+ }
+ }
+ window.customElements.define('transaction-card', TransactionCard);
+ async function getHistoricPrice(dates = []) {
+ try {
+ if (!dates.length) return [];
+ if (!Array.isArray(dates)) dates = [dates];
+ const datesToFetch = dates.filter(date => !mappedHistoricPrices.has(date));
+ if (datesToFetch.length) {
+ const historicPrices = await fetch(`${historicPriceApis.list[historicPriceApis.active]}/price-history?dates=${dates.join()}`).then(res => res.json())
+ historicPrices.forEach(price => {
+ // map historic price to txs
+ // historic price is per day, so we need to find the price for the day of the tx
+ mappedHistoricPrices.set(toYDM(price.date), {
+ usd: price.usd,
+ inr: price.inr
+ })
+ })
+ }
+ return dates.map(date => mappedHistoricPrices.get(date))
+ } catch (err) {
+ if (historicPriceApis.active < historicPriceApis.list.length - 1) {
+ historicPriceApis.active++
+ return getHistoricPrice(dates)
+ } else {
+ throw err
+ }
+ }
+ }
+
+ let transactionsLazyLoader
+ let txDetailsAbortController
+ const mappedHistoricPrices = new Map()
+ const render = {
+ transactionCard(transactionDetails) {
+ const transactionCard = document.createElement('transaction-card')
+ transactionCard.render(transactionDetails)
+ return transactionCard
},
async transactions(address) {
try {
getRef('address_details').classList.remove('hidden')
getRef('transactions_list').innerHTML = '
';
getRef('address_balance').innerHTML = '
';
- btcOperator.getAddressData(address).then(result => {
- getRef('address_balance').value = getConvertedAmount(result.balance, true);
- getRef('address_balance').dataset.btcAmount = result.balance;
- getRef('address_balance').parentElement.classList.remove('hidden')
- getRef('filter_selector').classList.remove('hidden')
- // render transactions
- if (result.txs.length) {
- let allTransactions = result.txs;
- const filter = getRef('filter_selector').value;
- if (filter !== 'all') {
- allTransactions = allTransactions.filter(t => filter === 'sent' ? t.type === 'out' : t.type === 'in')
+ const { txs, balance } = await btcOperator.getAddressData(address)
+ getRef('address_balance').value = getConvertedAmount(balance, { shouldFormatAmount: true });
+ getRef('address_balance').dataset.btcAmount = balance;
+ getRef('address_balance').parentElement.classList.remove('hidden')
+ getRef('filter_selector').classList.remove('hidden')
+ // render transactions
+ if (txs.length) {
+ const dates = txs.map(tx => toYDM(tx.time))
+ await getHistoricPrice(dates)
+ txs.forEach(tx => {
+ const historicPrice = mappedHistoricPrices.get(toYDM(tx.time))
+ if (historicPrice) {
+ tx.historicPrice = historicPrice
}
- if (transactionsLazyLoader) {
- transactionsLazyLoader.update(allTransactions)
- } else {
- transactionsLazyLoader = new LazyLoader('#transactions_list', allTransactions, render.transactionCard)
- }
- transactionsLazyLoader.init()
- getRef('transactions_list').previousElementSibling.classList.remove('hidden');
- } else {
- getRef('transactions_list').textContent = 'No transactions found';
+ })
+ let allTransactions = txs;
+ const filter = getRef('filter_selector').value;
+ if (filter !== 'all') {
+ allTransactions = allTransactions.filter(t => filter === 'sent' ? t.type === 'out' : t.type === 'in')
}
- }).catch(error => {
- console.error(error)
- getRef('filter_selector').classList.add('hidden')
- getRef('transactions_list').textContent = `The data service is temporarily unavailable due to over-usage. Please try again in an hour.`;
- }).finally(_ => getRef('check_address_button').disabled = false)
+ if (transactionsLazyLoader) {
+ transactionsLazyLoader.update(allTransactions)
+ } else {
+ transactionsLazyLoader = new LazyLoader('#transactions_list', allTransactions, render.transactionCard)
+ }
+ transactionsLazyLoader.init()
+ getRef('transactions_list').previousElementSibling.classList.remove('hidden');
+ } else {
+ getRef('transactions_list').textContent = 'No transactions found';
+ }
} catch (err) {
notify(err, 'error');
+ getRef('filter_selector').classList.add('hidden')
+ getRef('transactions_list').textContent = `The data service is temporarily unavailable due to over-usage. Please try again in an hour.`;
+ } finally {
+ getRef('check_address_button').disabled = false
}
},
addressDetails(address) {
@@ -1278,19 +1360,44 @@
txDetailsAbortController.abort()
}
txDetailsAbortController = new AbortController();
- btcOperator.getTx(txid).then(result => {
+ btcOperator.getTx(txid).then(async result => {
const { block, time, size, fee, inputs, outputs, confirmations = 0, total_input_value, total_output_value } = result;
- const isUnconfirmed = block < 0 || block === null || block === undefined
+ const isUnconfirmed = block < 0 || block === null || block === undefined;
+ let transactionAmount = 0;
+ if (outputs.length > 1) {
+ transactionAmount = outputs.reduce((acc, { address, value }) => {
+ if (inputs.find(input => input.address === address)) return acc;
+ return acc + value;
+ }, 0);
+ } else {
+ transactionAmount = outputs[0].value;
+ }
+ let amountOptions = { shouldFormatAmount: true }
+ let dataset = {}
+ if (selectedCurrency !== 'btc') {
+ if (!mappedHistoricPrices.get(toYDM(time)))
+ await getHistoricPrice(toYDM(time))
+ if (!showCurrentValue && selectedCurrency !== 'btc' && mappedHistoricPrices.has(toYDM(time))) {
+ amountOptions.onDate = time;
+ dataset.onDate = time
+ }
+ }
renderElem(getRef('tx_details'), html`
-
Transaction Details
-
- ${time ? html`
-
- `: ''}
- ${isUnconfirmed ? html`
-
- Unconfirmed
-
` : ''}
+
+
+
Amount
+
${getConvertedAmount(transactionAmount, amountOptions)}
${isUnconfirmed ? html`
@@ -1330,7 +1437,7 @@
Fee
-
${getConvertedAmount(fee, true)}
+
${getConvertedAmount(fee, amountOptions)}
@@ -1344,14 +1451,14 @@
Total Inputs
- ${getConvertedAmount(total_input_value, true)}
+ ${getConvertedAmount(total_input_value, amountOptions)}
-
${getConvertedAmount(total_output_value, true)}
+
${getConvertedAmount(total_output_value, amountOptions)}
@@ -1372,7 +1479,7 @@
${inputs.map(input => html`
${input.address}
- ${getConvertedAmount(input.value, true)}
+ ${getConvertedAmount(input.value, amountOptions)}
`)}
@@ -1386,7 +1493,7 @@
${outputs.map(output => html`
${output.address}
- ${getConvertedAmount(output.value, true)}
+ ${getConvertedAmount(output.value, amountOptions)}
`)}
@@ -1426,14 +1533,14 @@
usd: `
`,
inr: `
`
}
- function formatAmount(amount = 0) {
+ function formatAmount(amount = 0, currency = selectedCurrency) {
// check if amount is a string and convert it to a number
if (typeof amount === 'string') {
amount = parseFloat(amount)
}
if (!amount)
return '0';
- return amount.toLocaleString(undefined, { style: 'currency', currency: selectedCurrency, minimumFractionDigits: 0, maximumFractionDigits: selectedCurrency === 'btc' ? 8 : 2 })
+ return amount.toLocaleString(undefined, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: selectedCurrency === 'btc' ? 8 : 2 })
}
let globalExchangeRate = {}
async function getExchangeRate() {
@@ -1449,13 +1556,20 @@
}).catch(err => reject(err))
})
}
- function getConvertedAmount(amount, shouldFormatAmount = false) {
+ function getConvertedAmount(amount, { shouldFormatAmount = false, onDate } = {}) {
// check if amount is a string and convert it to a number
if (typeof amount === 'string') {
amount = parseFloat(amount)
}
let convertedAmount = amount;
- if (globalExchangeRate[selectedCurrency])
+ if (onDate && selectedCurrency !== 'btc') {
+ const historicPrice = mappedHistoricPrices.get(toYDM(onDate));
+ if (historicPrice) {
+ convertedAmount = parseFloat((amount * historicPrice[selectedCurrency]).toFixed(8))
+ } else {
+ convertedAmount = parseFloat((amount * globalExchangeRate[selectedCurrency]).toFixed(8))
+ }
+ } else if (globalExchangeRate[selectedCurrency])
convertedAmount = parseFloat((amount * globalExchangeRate[selectedCurrency]).toFixed(8))
if (shouldFormatAmount)
convertedAmount = formatAmount(convertedAmount)
@@ -1467,8 +1581,10 @@
let previouslySelectedCurrency = localStorage.getItem('btc-wallet-currency') || 'btc';
getRef('currency_selector').addEventListener('change', e => {
selectedCurrency = e.target.value;
+ getRef('show_current_value').classList.toggle('hidden', selectedCurrency === 'btc')
localStorage.setItem('btc-wallet-currency', selectedCurrency);
document.querySelectorAll('.currency-symbol').forEach(el => el.innerHTML = currencyIcons[selectedCurrency])
+ document.querySelectorAll('transaction-card').forEach(el => el.render())
document.querySelectorAll('.amount-shown').forEach(el => {
if (el.tagName.includes('SM-')) {
const originalAmount = parseFloat(el.value.trim());
@@ -1494,8 +1610,8 @@
el.value = convertedAmount
el.isValid // trigger validation
} else {
- if (el.dataset.btcAmount === undefined) return
- el.textContent = getConvertedAmount(el.dataset.btcAmount, true)
+ if (el.dataset.btcAmount === undefined) return;
+ el.textContent = getConvertedAmount(el.dataset.btcAmount, { shouldFormatAmount: true, onDate: parseInt(el.dataset.onDate) })
}
})
previouslySelectedCurrency = selectedCurrency
@@ -1761,11 +1877,11 @@
senderBalances.forEach(el => el.innerHTML = '
');
Promise.all(addresses.map((addr, index) => btcOperator.getBalance(addr))).then(balances => {
balances.forEach((balance, index) => {
- senderBalances[index].textContent = getConvertedAmount(balance, true);
+ senderBalances[index].textContent = getConvertedAmount(balance, { shouldFormatAmount: true });
senderBalances[index].dataset.btcAmount = balance;
totalBalance += balance;
})
- getRef("total_balance").textContent = `${getConvertedAmount(totalBalance, true)}`;
+ getRef("total_balance").textContent = `${getConvertedAmount(totalBalance, { shouldFormatAmount: true })}`;
getRef("total_balance").dataset.btcAmount = totalBalance;
}).catch(err => {
console.error(err);
@@ -1814,7 +1930,7 @@
renderElem(getRef('fees_wrapper'), html`
- Approximate fee: ${getConvertedAmount(fees, true)}
+ Approximate fee: ${getConvertedAmount(fees, { shouldFormatAmount: true })}
*Exact fee will be calculated after you fill all the required fields
@@ -1862,7 +1978,7 @@
renderElem(getRef('fees_wrapper'), html`
`)
const [senders, privKeys, receivers, amounts] = getTransactionInputs();
btcOperator.createTx(senders, receivers, amounts).then(({ fee }) => {
- renderElem(getRef('fees_wrapper'), html`
${getConvertedAmount(fee, true)} `)
+ renderElem(getRef('fees_wrapper'), html`
${getConvertedAmount(fee, { shouldFormatAmount: true })} `)
getRef('send_transaction').disabled = false;
getRef('fees_section').classList.remove('hidden')
getRef('error_section').classList.add('hidden')
@@ -1921,7 +2037,7 @@
Transaction ID
-
Check transaction status
+
Check transaction status
`)
break;
}
@@ -1954,14 +2070,14 @@
Receivers
${receivers.map((receiver, index) => html`-
- ${receiver} ${getConvertedAmount(amounts[index], true)}
+ ${receiver} ${getConvertedAmount(amounts[index], { shouldFormatAmount: true })}
`)}
Fee
- ${getConvertedAmount(fee, true)}
+ ${getConvertedAmount(fee, { shouldFormatAmount: true })}
`,
@@ -2099,16 +2215,16 @@
Amount
-
${getConvertedAmount(value, true)}
+
${getConvertedAmount(value, { shouldFormatAmount: true })}
`)}
- Previous fee: ${getConvertedAmount(previousFee, true)} ${recommendedFee ? html`| Recommended fee: ${getConvertedAmount(recommendedFee, true)}` : ''}
+ Previous fee: ${getConvertedAmount(previousFee, { shouldFormatAmount: true })} ${recommendedFee ? html`| Recommended fee: ${getConvertedAmount(recommendedFee, { shouldFormatAmount: true })}` : ''}
-
+
diff --git a/btcwallet/index.min.html b/btcwallet/index.min.html
new file mode 100644
index 0000000..9abf639
--- /dev/null
+++ b/btcwallet/index.min.html
@@ -0,0 +1,347 @@
+ Bitcoin Wallet Getting Bitcoin Wallet ready
RanchiMall
Bitcoin Wallet
BTC INR USD
Transactions
All Sent Received Show current value
Balance and transactions will appear here
Senders
Total balance:
FLO BTC ETH
\ No newline at end of file
diff --git a/btcwallet/scripts/components.js b/btcwallet/scripts/components.js
index d57e03e..dd8e0e7 100644
--- a/btcwallet/scripts/components.js
+++ b/btcwallet/scripts/components.js
@@ -6,6 +6,7 @@ const smForm = document.createElement("template"); smForm.innerHTML = ' ', customElements.define("sm-input", class SmInput extends HTMLElement { static hasAppendedStyles = !1; #validationState = { validatedFor: void 0, isValid: !1, errorMessage: "Please fill out this field." }; constructor() { super(), this.attachShadow({ mode: "open" }).append(smInput.content.cloneNode(!0)), this.inputParent = this.shadowRoot.querySelector(".input"), this.input = this.shadowRoot.querySelector("input"), this.clearBtn = this.shadowRoot.querySelector(".clear"), this.placeholderElement = this.shadowRoot.querySelector(".placeholder"), this.outerContainer = this.shadowRoot.querySelector(".outer-container"), this.optionList = this.shadowRoot.querySelector(".datalist"), this._helperText = "", this.isRequired = !1, this.datalist = [], this.validationFunction = void 0, this.reflectedAttributes = ["value", "required", "disabled", "type", "inputmode", "readonly", "min", "max", "pattern", "minlength", "maxlength", "step", "list", "autocomplete"] } static get observedAttributes() { return ["value", "placeholder", "required", "disabled", "type", "inputmode", "readonly", "min", "max", "pattern", "minlength", "maxlength", "step", "helper-text", "error-text", "list"] } get value() { return this.input.value } set value(val) { val !== this.input.value && (this.input.value = val, this._value = val, this.checkInput()) } get placeholder() { return this.getAttribute("placeholder") } set placeholder(val) { this.setAttribute("placeholder", val) } get type() { return this.getAttribute("type") } set type(val) { this.setAttribute("type", val) } get validity() { return this.input.validity } get disabled() { return this.hasAttribute("disabled") } set disabled(value) { value ? (this.inputParent.classList.add("disabled"), this.setAttribute("disabled", "")) : (this.inputParent.classList.remove("disabled"), this.removeAttribute("disabled")) } get readOnly() { return this.hasAttribute("readonly") } set readOnly(value) { value ? this.setAttribute("readonly", "") : this.removeAttribute("readonly") } set customValidation(val) { val && (this.validationFunction = val) } set errorText(val) { this.#validationState.errorText = val } showError = (errorText = this.#validationState.errorText) => { const appendedNew = this.appendFeedbackElement(); this.feedbackPopover.innerHTML = ` ${errorText} `, this.feedbackPopover.dataset.state = "error", appendedNew && this.feedbackPopover.animate([{ transform: "scale(0.95)", opacity: 0 }, { transform: "scale(1)", opacity: 1 }], { duration: 200, easing: "ease", fill: "forwards" }) }; set helperText(val) { this._helperText = val } get isValid() { if (this.#validationState.validatedFor === this.input.value) return this.#validationState.isValid; const _isValid = this.input.checkValidity(); let _validity = { isValid: !0, errorText: "" }; return this.validationFunction && (_validity = this.validationFunction(this.input.value, this)), _isValid && _validity.isValid ? (this.setAttribute("valid", ""), this.removeAttribute("invalid"), this.hideFeedback()) : (this.removeAttribute("valid"), this.setAttribute("invalid", ""), "" !== this.value.trim() && (_validity.errorText || this.#validationState.errorText) && this.showError(_validity.errorText || this.#validationState.errorText)), this.#validationState.validatedFor = this.input.value, this.#validationState.isValid = _isValid && _validity.isValid, this.#validationState.errorText = _validity.errorText || this.#validationState.errorText, this.#validationState.isValid } reset = () => { this.value = "" }; clear = () => { this.value = "", this.input.focus(), this.fireEvent() }; focusIn = () => { this.input.focus() }; focusOut = () => { this.input.blur() }; fireEvent = () => { let event = new Event("input", { bubbles: !0, cancelable: !0, composed: !0 }); this.dispatchEvent(event) }; searchDatalist = searchKey => { const filteredData = this.datalist.filter((item => item.toLowerCase().includes(searchKey.toLowerCase()))); if (filteredData.sort(((a, b) => a.toLowerCase().indexOf(searchKey.toLowerCase()) - b.toLowerCase().indexOf(searchKey.toLowerCase()))), filteredData.length) { if (this.optionList.children.length > filteredData.length) { const optionsToRemove = this.optionList.children.length - filteredData.length; for (let i = 0; i < optionsToRemove; i++)this.optionList.removeChild(this.optionList.lastChild) } filteredData.forEach(((item, index) => { if (this.optionList.children[index]) this.optionList.children[index].textContent = item; else { const option = document.createElement("li"); option.textContent = item, option.classList.add("datalist-item"), option.setAttribute("tabindex", "0"), this.optionList.appendChild(option) } })), this.optionList.classList.remove("hidden") } else this.optionList.classList.add("hidden") }; checkInput = e => { this.hasAttribute("readonly") || ("" !== this.input.value ? this.clearBtn.classList.remove("hidden") : this.clearBtn.classList.add("hidden")), this.hasAttribute("placeholder") && "" !== this.getAttribute("placeholder").trim() && ("" !== this.input.value ? (this.shouldAnimatePlaceholder && this.inputParent.classList.add("animate-placeholder"), this.placeholderElement.classList.toggle("hidden", !this.shouldAnimatePlaceholder), this.datalist.length && (this.searchTimeout && clearTimeout(this.searchTimeout), this.searchTimeout = setTimeout((() => { this.searchDatalist(this.input.value.trim()) }), 100))) : (this.shouldAnimatePlaceholder && this.inputParent.classList.remove("animate-placeholder"), this.placeholderElement.classList.remove("hidden"), this.hideFeedback(), this.datalist.length && (this.optionList.innerHTML = "", this.optionList.classList.add("hidden")))) }; allowOnlyNum = e => { e.ctrlKey || 1 === e.key.length && (("." !== e.key || !e.target.value.includes(".") && 0 !== e.target.value.length) && ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "."].includes(e.key) || e.preventDefault()) }; handleOptionClick = e => { this.input.value = e.target.textContent, this.optionList.classList.add("hidden"), this.input.focus() }; handleInputNavigation = e => { "ArrowDown" === e.key ? (e.preventDefault(), this.optionList.children.length && this.optionList.children[0].focus()) : "ArrowUp" === e.key && (e.preventDefault(), this.optionList.children.length && this.optionList.children[this.optionList.children.length - 1].focus()) }; handleDatalistNavigation = e => { "ArrowUp" === e.key ? (e.preventDefault(), this.shadowRoot.activeElement.previousElementSibling ? this.shadowRoot.activeElement.previousElementSibling.focus() : this.input.focus()) : "ArrowDown" === e.key ? (e.preventDefault(), this.shadowRoot.activeElement.nextElementSibling ? this.shadowRoot.activeElement.nextElementSibling.focus() : this.input.focus()) : "Enter" !== e.key && " " !== e.key || (e.preventDefault(), this.input.value = e.target.textContent, this.optionList.classList.add("hidden"), this.input.focus()) }; handleFocus = e => { this.datalist.length && this.searchDatalist(this.input.value.trim()) }; handleBlur = e => { this.datalist.length && this.optionList.classList.add("hidden") }; applyGlobalCustomValidation = () => { if (void 0 !== window.smCompConfig && window.smCompConfig["sm-input"]) { const config = window.smCompConfig["sm-input"].find((config => this.matches(config.selector))); this.customValidation = config?.customValidation } }; updatePosition = () => { requestAnimationFrame((() => { if (this.dimensions = this.getBoundingClientRect(), this.scrollingParentDimensions = this.scrollingParent.getBoundingClientRect(), 0 === this.dimensions.width || 0 === this.dimensions.height) return; let topOffset = this.dimensions.top - this.scrollingParentDimensions.top + this.dimensions.height, leftOffset = this.dimensions.left - this.scrollingParentDimensions.left; const maxWidth = this.dimensions.width; this.feedbackPopover.style = `top: ${topOffset}px; left: ${leftOffset}px; max-width: ${maxWidth}px;` })) }; appendFeedbackElement = () => { if (this.feedbackPopover) return !1; this.feedbackPopover = document.createElement("div"), this.feedbackPopover.className = "feedback-popover", this.feedbackPopover.setAttribute("aria-live", "polite"), this.containment = this.closest("[data-sm-containment]"), this.scrollingParent = this.getNearestScrollingParent(this); return (this.containment || this.scrollingParent).appendChild(this.feedbackPopover), "" === this.scrollingParent.style.position && (this.scrollingParent.style.position = "relative"), this.containment || (this.observerHidFeedback = !1, this.intersectionObserver = new IntersectionObserver((entries => { if (this.feedbackPopover) if (entries[0].isIntersecting) { if (!this.observerHidFeedback) return; this.feedbackPopover.classList.remove("hidden"), this.observerHidFeedback = !1 } else this.feedbackPopover.classList.add("hidden"), this.observerHidFeedback = !0 })).observe(this)), this.updatePosition(), window.addEventListener("resize", this.updatePosition, { passive: !0 }), !0 }; getNearestScrollingParent = element => { let parent = element.parentNode; for (; parent;) { if (parent.scrollHeight > parent.clientHeight || parent.scrollWidth > parent.clientWidth || parent.tagName.includes("SM-") || parent.hasAttribute("data-scrollable")) return parent; parent = parent.parentNode } return document.body }; hideFeedback = () => { this.feedbackPopover && (this.feedbackPopover.animate([{ transform: "none", opacity: 1 }, { transform: "scale(0.95)", opacity: 0 }], { duration: 100, easing: "ease-in-out", fill: "forwards" }).onfinish = () => { this.intersectionObserver?.disconnect(), this.feedbackPopover.remove(), this.feedbackPopover = null, window.removeEventListener("resize", this.updatePosition, { passive: !0 }) }) }; connectedCallback() { SmInput.hasAppendedStyles || (document.head.insertAdjacentHTML("beforeend", ""), SmInput.hasAppendedStyles = !0), this.shouldAnimatePlaceholder = this.hasAttribute("animate"), this.shouldAnimatePlaceholder && "" !== this.placeholderElement && this.value && (this.inputParent.classList.add("animate-placeholder"), this.placeholderElement.classList.remove("hidden")), this.setAttribute("role", "textbox"), "loading" === document.readyState ? window.addEventListener("load", this.applyGlobalCustomValidation, { once: !0 }) : this.applyGlobalCustomValidation(), this.input.addEventListener("input", this.checkInput), this.clearBtn.addEventListener("click", this.clear), this.datalist.length && (this.optionList.addEventListener("click", this.handleOptionClick), this.input.addEventListener("keydown", this.handleInputNavigation), this.optionList.addEventListener("keydown", this.handleDatalistNavigation)), this.input.addEventListener("focusin", this.handleFocus), this.addEventListener("focusout", this.handleBlur) } attributeChangedCallback(name, oldValue, newValue) { if (oldValue !== newValue) switch (this.reflectedAttributes.includes(name) && (this.hasAttribute(name) ? this.input.setAttribute(name, this.getAttribute(name) ? this.getAttribute(name) : "") : this.input.removeAttribute(name)), name) { case "placeholder": this.placeholderElement.textContent = newValue, this.setAttribute("aria-label", newValue); break; case "value": this.checkInput(); break; case "type": this.hasAttribute("type") && "number" === this.getAttribute("type") ? (this.input.setAttribute("inputmode", "decimal"), this.input.addEventListener("keydown", this.allowOnlyNum)) : this.input.removeEventListener("keydown", this.allowOnlyNum); break; case "helper-text": this._helperText = newValue; break; case "error-text": this.#validationState.errorText = newValue; break; case "required": this.isRequired = this.hasAttribute("required"), this.isRequired ? this.setAttribute("aria-required", "true") : this.setAttribute("aria-required", "false"); break; case "readonly": this.hasAttribute("readonly") ? this.inputParent.classList.add("readonly") : this.inputParent.classList.remove("readonly"); break; case "disabled": this.hasAttribute("disabled") ? this.inputParent.classList.add("disabled") : this.inputParent.classList.remove("disabled"); break; case "list": this.hasAttribute("list") && "" !== this.getAttribute("list").trim() && (this.datalist = this.getAttribute("list").split(",")) } } disconnectedCallback() { this.input.removeEventListener("input", this.checkInput), this.clearBtn.removeEventListener("click", this.clear), this.input.removeEventListener("keydown", this.allowOnlyNum), this.optionList.removeEventListener("click", this.handleOptionClick), this.input.removeEventListener("keydown", this.handleInputNavigation), this.optionList.removeEventListener("keydown", this.handleDatalistNavigation), this.input.removeEventListener("focusin", this.handleFocus), this.removeEventListener("focusout", this.handleBlur), window.removeEventListener("resize", this.updatePosition, { passive: !0 }), this.feedbackPopover && this.feedbackPopover.remove(), this.intersectionObserver && this.intersectionObserver.disconnect() } });
const smNotifications = document.createElement("template"); smNotifications.innerHTML = " ", customElements.define("sm-notifications", class extends HTMLElement { constructor() { super(), this.shadow = this.attachShadow({ mode: "open" }).append(smNotifications.content.cloneNode(!0)), this.notificationPanel = this.shadowRoot.querySelector(".notification-panel"), this.animationOptions = { duration: 300, fill: "forwards", easing: "cubic-bezier(0.175, 0.885, 0.32, 1.275)" }, this.push = this.push.bind(this), this.createNotification = this.createNotification.bind(this), this.removeNotification = this.removeNotification.bind(this), this.clearAll = this.clearAll.bind(this), this.remove = this.remove.bind(this), this.handleTouchMove = this.handleTouchMove.bind(this), this.startX = 0, this.currentX = 0, this.endX = 0, this.swipeDistance = 0, this.swipeDirection = "", this.swipeThreshold = 0, this.startTime = 0, this.swipeTime = 0, this.swipeTimeThreshold = 200, this.currentTarget = null, this.notificationTimeout = 5e3, this.mediaQuery = window.matchMedia("(min-width: 640px)"), this.handleOrientationChange = this.handleOrientationChange.bind(this), this.isBigViewport = !1 } set timeout(value) { isNaN(value) || (this.notificationTimeout = value) } randString(length) { let result = ""; const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; for (let i = 0; i < length; i++)result += characters.charAt(Math.floor(52 * Math.random())); return result } createNotification(message, options = {}) { const { pinned: pinned = !1, icon: icon, action: action, timeout: timeout = this.notificationTimeout } = options, notification = document.createElement("div"); return notification.id = this.randString(8), notification.className = "notification " + (pinned ? "pinned" : ""), notification.style.setProperty("--timeout", `${timeout}ms`), notification.innerHTML = ` ${icon ? `${icon}
` : ""} ${action ? `` : ""} `, action && notification.querySelector(".action").addEventListener("click", action.callback), notification.querySelector(".close").addEventListener("click", (() => { this.removeNotification(notification) })), pinned || setTimeout((() => { this.removeNotification(notification, this.isBigViewport ? "left" : "top") }), timeout), notification } push(message, options = {}) { const notification = this.createNotification(message, options); return this.isBigViewport ? this.notificationPanel.append(notification) : this.notificationPanel.prepend(notification), notification.scrollIntoView({ behavior: "smooth" }), this.notificationPanel.animate([{ transform: `translateY(${this.isBigViewport ? "" : "-"}${notification.clientHeight}px)` }, { transform: "none" }], this.animationOptions), notification.animate([{ transform: "translateY(-1rem)", opacity: "0" }, { transform: "none", opacity: "1" }], this.animationOptions).onfinish = e => { e.target.commitStyles(), e.target.cancel() }, notification.id } removeNotification(notification, direction = "left") { if (!notification) return; const sign = "left" === direction || "top" === direction ? "-" : "+"; this.isBigViewport || "top" !== direction ? notification.animate([{ transform: this.currentX ? `translateX(${this.currentX}px)` : "none", opacity: "1" }, { transform: `translateX(calc(${sign}${Math.abs(this.currentX)}px ${sign} 1rem))`, opacity: "0" }], this.animationOptions).onfinish = () => { notification.remove() } : notification.animate([{ transform: this.currentX ? `translateY(${this.currentX}px)` : "none", opacity: "1" }, { transform: `translateY(calc(${sign}${Math.abs(this.currentX)}px ${sign} 1rem))`, opacity: "0" }], this.animationOptions).onfinish = () => { notification.remove() } } remove(id) { const notification = this.notificationPanel.querySelector(`#${id}`); notification && this.removeNotification(notification) } clearAll() { Array.from(this.notificationPanel.children).forEach((child => { this.removeNotification(child) })) } handleTouchMove(e) { this.currentX = e.touches[0].clientX - this.startX, this.currentTarget.style.transform = `translateX(${this.currentX}px)` } handleOrientationChange(e) { this.isBigViewport = e.matches, e.matches } connectedCallback() { this.handleOrientationChange(this.mediaQuery), this.mediaQuery.addEventListener("change", this.handleOrientationChange), this.notificationPanel.addEventListener("touchstart", (e => { e.target.closest(".close") ? this.removeNotification(e.target.closest(".notification")) : e.target.closest(".notification") && (this.swipeThreshold = e.target.closest(".notification").getBoundingClientRect().width / 2, this.currentTarget = e.target.closest(".notification"), this.startTime = Date.now(), this.startX = e.touches[0].clientX, this.startY = e.touches[0].clientY, this.notificationPanel.addEventListener("touchmove", this.handleTouchMove, { passive: !0 })) }), { passive: !0 }), this.notificationPanel.addEventListener("touchend", (e => { this.endX = e.changedTouches[0].clientX, this.endY = e.changedTouches[0].clientY, this.swipeDistance = Math.abs(this.endX - this.startX), this.swipeTime = Date.now() - this.startTime, this.endX > this.startX ? this.swipeDirection = "right" : this.swipeDirection = "left", this.swipeTime < this.swipeTimeThreshold ? this.swipeDistance > 50 && this.removeNotification(this.currentTarget, this.swipeDirection) : this.swipeDistance > this.swipeThreshold ? this.removeNotification(this.currentTarget, this.swipeDirection) : this.currentTarget.animate([{ transform: `translateX(${this.currentX}px)` }, { transform: "none" }], this.animationOptions).onfinish = e => { e.target.commitStyles(), e.target.cancel() }, this.notificationPanel.removeEventListener("touchmove", this.handleTouchMove), this.currentX = 0 })) } disconnectedCallback() { mediaQueryList.removeEventListener("change", handleOrientationChange) } });
class Stack { constructor() { this.items = [] } push(element) { this.items.push(element) } pop() { return 0 == this.items.length ? "Underflow" : this.items.pop() } peek() { return this.items[this.items.length - 1] } } const popupStack = new Stack, smPopup = document.createElement("template"); smPopup.innerHTML = '', customElements.define("sm-popup", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smPopup.content.cloneNode(!0)), this.allowClosing = !1, this.isOpen = !1, this.offset = 0, this.touchStartY = 0, this.touchEndY = 0, this.touchStartTime = 0, this.touchEndTime = 0, this.touchEndAnimation = void 0, this.focusable, this.autoFocus, this.mutationObserver, this.popupContainer = this.shadowRoot.querySelector(".popup-container"), this.backdrop = this.shadowRoot.querySelector(".backdrop"), this.dialogBox = this.shadowRoot.querySelector(".popup"), this.popupBodySlot = this.shadowRoot.querySelector(".popup-body slot"), this.popupHeader = this.shadowRoot.querySelector(".popup-top") } static get observedAttributes() { return ["open"] } get open() { return this.isOpen } animateTo = (element, keyframes, options) => { const anime = element.animate(keyframes, { ...options, fill: "both" }); return anime.finished.then((() => { anime.commitStyles(), anime.cancel() })), anime }; resumeScrolling = () => { const scrollY = document.body.style.top; window.scrollTo(0, -1 * parseInt(scrollY || "0")), document.body.style.overflow = "", document.body.style.top = "initial" }; setStateOpen = () => { if (!this.isOpen || this.offset) { const animOptions = { duration: 300, easing: "ease" }, initialAnimation = window.innerWidth > 640 ? "scale(1.1)" : `translateY(${this.offset ? `${this.offset}px` : "100%"})`; this.animateTo(this.dialogBox, [{ opacity: this.offset ? 1 : 0, transform: initialAnimation }, { opacity: 1, transform: "none" }], animOptions) } }; show = (options = {}) => { const { pinned: pinned = !1, payload: payload } = options; if (this.isOpen) return; const animOptions = { duration: 300, easing: "ease" }; return this.payload = payload, popupStack.push({ popup: this, permission: pinned }), popupStack.items.length > 1 && this.animateTo(popupStack.items[popupStack.items.length - 2].popup.shadowRoot.querySelector(".popup"), [{ transform: "none" }, { transform: window.innerWidth > 640 ? "scale(0.95)" : "translateY(-1.5rem)" }], animOptions), this.popupContainer.classList.remove("hide"), this.offset || (this.backdrop.animate([{ opacity: 0 }, { opacity: 1 }], animOptions).onfinish = () => { this.resolveOpen(this.payload) }, this.dispatchEvent(new CustomEvent("popupopened", { bubbles: !0, composed: !0, detail: { payload: this.payload } })), document.body.style.overflow = "hidden", document.body.style.top = `-${window.scrollY}px`), this.setStateOpen(), this.pinned = pinned, this.isOpen = !0, setTimeout((() => { const elementToFocus = this.autoFocus || this.focusable?.[0] || this.dialogBox; elementToFocus && (elementToFocus.tagName.includes("-") ? elementToFocus.focusIn() : elementToFocus.focus()) }), 0), this.hasAttribute("open") || (this.setAttribute("open", ""), this.addEventListener("keydown", this.detectFocus), this.resizeObserver.observe(this), this.mutationObserver.observe(this, { attributes: !0, childList: !0, subtree: !0 }), this.popupHeader.addEventListener("touchstart", this.handleTouchStart, { passive: !0 }), this.backdrop.addEventListener("mousedown", this.handleSoftDismiss)), { opened: new Promise((resolve => { this.resolveOpen = resolve })), closed: new Promise((resolve => { this.resolveClose = resolve })) } }; hide = (options = {}) => { const { payload: payload } = options, animOptions = { duration: 150, easing: "ease" }; this.backdrop.animate([{ opacity: 1 }, { opacity: 0 }], animOptions), this.animateTo(this.dialogBox, [{ opacity: 1, transform: window.innerWidth > 640 ? "none" : `translateY(${this.offset ? `${this.offset}px` : "0"})` }, { opacity: 0, transform: window.innerWidth > 640 ? "scale(1.1)" : "translateY(100%)" }], animOptions).finished.finally((() => { this.popupContainer.classList.add("hide"), this.dialogBox.style = "", this.removeAttribute("open"), this.forms.length && this.forms.forEach((form => form.reset())), this.dispatchEvent(new CustomEvent("popupclosed", { bubbles: !0, composed: !0, detail: { payload: payload || this.payload } })), this.resolveClose(payload || this.payload), this.isOpen = !1 })), popupStack.pop(), popupStack.items.length ? this.animateTo(popupStack.items[popupStack.items.length - 1].popup.shadowRoot.querySelector(".popup"), [{ transform: window.innerWidth > 640 ? "scale(0.95)" : "translateY(-1.5rem)" }, { transform: "none" }], animOptions) : this.resumeScrolling(), this.resizeObserver.disconnect(), this.mutationObserver.disconnect(), this.removeEventListener("keydown", this.detectFocus), this.popupHeader.removeEventListener("touchstart", this.handleTouchStart, { passive: !0 }), this.backdrop.removeEventListener("mousedown", this.handleSoftDismiss) }; handleTouchStart = e => { this.offset = 0, this.popupHeader.addEventListener("touchmove", this.handleTouchMove, { passive: !0 }), this.popupHeader.addEventListener("touchend", this.handleTouchEnd, { passive: !0 }), this.touchStartY = e.changedTouches[0].clientY, this.touchStartTime = e.timeStamp }; handleTouchMove = e => { this.touchStartY < e.changedTouches[0].clientY && (this.offset = e.changedTouches[0].clientY - this.touchStartY, this.touchEndAnimation = window.requestAnimationFrame((() => { this.dialogBox.style.transform = `translateY(${this.offset}px)` }))) }; handleTouchEnd = e => { if (this.touchEndTime = e.timeStamp, cancelAnimationFrame(this.touchEndAnimation), this.touchEndY = e.changedTouches[0].clientY, this.threshold = .3 * this.dialogBox.getBoundingClientRect().height, this.touchEndTime - this.touchStartTime > 200) if (this.touchEndY - this.touchStartY > this.threshold) { if (this.pinned) return void this.setStateOpen(); this.hide() } else this.setStateOpen(); else if (this.touchEndY > this.touchStartY) { if (this.pinned) return void this.setStateOpen(); this.hide() } this.popupHeader.removeEventListener("touchmove", this.handleTouchMove, { passive: !0 }), this.popupHeader.removeEventListener("touchend", this.handleTouchEnd, { passive: !0 }) }; detectFocus = e => { if ("Tab" === e.key) { if (!this.focusable.length) return; if (!this.firstFocusable) for (let i = 0; i < this.focusable.length; i++)if (!this.focusable[i].disabled) { this.firstFocusable = this.focusable[i]; break } if (!this.lastFocusable) for (let i = this.focusable.length - 1; i >= 0; i--)if (!this.focusable[i].disabled) { this.lastFocusable = this.focusable[i]; break } e.shiftKey && document.activeElement === this.firstFocusable ? (e.preventDefault(), this.lastFocusable.tagName.includes("SM-") ? this.lastFocusable.focusIn() : this.lastFocusable.focus()) : e.shiftKey || document.activeElement !== this.lastFocusable || (e.preventDefault(), this.firstFocusable.tagName.includes("SM-") ? this.firstFocusable.focusIn() : this.firstFocusable.focus()) } }; updateFocusableList = () => { this.focusable = this.querySelectorAll('sm-button:not([disabled]), button:not([disabled]), [href], sm-input, input:not([readonly]), sm-select, select, sm-checkbox, sm-textarea, textarea, [tabindex]:not([tabindex="-1"])'), this.autoFocus = this.querySelector("[autofocus]"), this.firstFocusable = null, this.lastFocusable = null }; handleSoftDismiss = () => { this.pinned ? this.dialogBox.animate([{ transform: "translateX(-1rem)" }, { transform: "translateX(1rem)" }, { transform: "translateX(-0.5rem)" }, { transform: "translateX(0.5rem)" }, { transform: "translateX(0)" }], { duration: 300, easing: "ease" }) : this.hide() }; debounce = (callback, wait) => { let timeoutId = null; return (...args) => { window.clearTimeout(timeoutId), timeoutId = window.setTimeout((() => { callback.apply(null, args) }), wait) } }; connectedCallback() { this.popupBodySlot.addEventListener("slotchange", this.debounce((() => { this.forms = this.querySelectorAll("sm-form"), this.updateFocusableList() }), 0)), this.resizeObserver = new ResizeObserver((entries => { entries.forEach((entry => { if (entry.contentBoxSize) { const contentBoxSize = Array.isArray(entry.contentBoxSize) ? entry.contentBoxSize[0] : entry.contentBoxSize; this.threshold = .3 * contentBoxSize.blockSize.height } else this.threshold = .3 * entry.contentRect.height })) })), this.mutationObserver = new MutationObserver((entries => { this.updateFocusableList() })) } disconnectedCallback() { this.resizeObserver.disconnect(), this.mutationObserver.disconnect(), this.removeEventListener("keydown", this.detectFocus), this.popupHeader.removeEventListener("touchstart", this.handleTouchStart, { passive: !0 }), this.backdrop.removeEventListener("mousedown", this.handleSoftDismiss) } attributeChangedCallback(name) { "open" === name && this.hasAttribute("open") && this.show() } });
+const smSwitch = document.createElement("template"); smSwitch.innerHTML = '\t', customElements.define("sm-switch", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smSwitch.content.cloneNode(!0)), this.switch = this.shadowRoot.querySelector(".switch"), this.input = this.shadowRoot.querySelector("input"), this.isChecked = !1, this.isDisabled = !1 } static get observedAttributes() { return ["disabled", "checked"] } get disabled() { return this.isDisabled } set disabled(val) { val ? this.setAttribute("disabled", "") : this.removeAttribute("disabled") } get checked() { return this.isChecked } set checked(value) { value ? this.setAttribute("checked", "") : this.removeAttribute("checked") } get value() { return this.isChecked } reset() { } dispatch = () => { this.dispatchEvent(new CustomEvent("change", { bubbles: !0, composed: !0, detail: { value: this.isChecked } })) }; connectedCallback() { this.addEventListener("keydown", (e => { " " !== e.key || this.isDisabled || (e.preventDefault(), this.input.click()) })), this.input.addEventListener("click", (e => { this.input.checked ? this.checked = !0 : this.checked = !1, this.dispatch() })) } attributeChangedCallback(name, oldValue, newValue) { oldValue !== newValue && ("disabled" === name ? this.hasAttribute("disabled") ? (this.disabled = !0, this.inert = !0) : (this.disabled = !1, this.inert = !1) : "checked" === name && (this.hasAttribute("checked") ? (this.isChecked = !0, this.input.checked = !0) : (this.isChecked = !1, this.input.checked = !1))) } });
const smSelect = document.createElement("template"); smSelect.innerHTML = '', customElements.define("sm-select", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smSelect.content.cloneNode(!0)), this.focusIn = this.focusIn.bind(this), this.reset = this.reset.bind(this), this.open = this.open.bind(this), this.collapse = this.collapse.bind(this), this.toggle = this.toggle.bind(this), this.handleOptionsNavigation = this.handleOptionsNavigation.bind(this), this.handleOptionSelection = this.handleOptionSelection.bind(this), this.handleKeydown = this.handleKeydown.bind(this), this.handleClickOutside = this.handleClickOutside.bind(this), this.selectOption = this.selectOption.bind(this), this.debounce = this.debounce.bind(this), this.elementsChanged = this.elementsChanged.bind(this), this.availableOptions = [], this.previousOption, this.isOpen = !1, this.label = "", this.defaultSelected = "", this.isUnderViewport = !1, this.animationOptions = { duration: 300, fill: "forwards", easing: "ease" }, this.optionList = this.shadowRoot.querySelector(".options"), this.selection = this.shadowRoot.querySelector(".selection"), this.selectedOptionText = this.shadowRoot.querySelector(".selected-option-text") } static get observedAttributes() { return ["disabled", "label", "readonly"] } get value() { return this.getAttribute("value") } set value(t) { const e = this.availableOptions.find(e => e.getAttribute("value") === t); e ? (this.setAttribute("value", t), this.selectOption(e)) : console.warn(`There is no option with ${t} as value`) } debounce(t, e) { let n = null; return (...i) => { window.clearTimeout(n), n = window.setTimeout(() => { t.apply(null, i) }, e) } } reset(t = !0) { if (this.availableOptions[0] && this.previousOption !== this.availableOptions[0]) { const e = this.availableOptions.find(t => t.hasAttribute("selected")) || this.availableOptions[0]; this.value = e.getAttribute("value"), t && this.fireEvent() } } selectOption(t) { this.previousOption !== t && (this.querySelectorAll("[selected").forEach(t => t.removeAttribute("selected")), this.selectedOptionText.textContent = `${this.label}${t.textContent}`, t.setAttribute("selected", ""), this.previousOption = t) } focusIn() { this.selection.focus() } open() { this.availableOptions.forEach(t => t.setAttribute("tabindex", 0)), this.optionList.classList.remove("hidden"), this.isUnderViewport = this.getBoundingClientRect().bottom + this.optionList.getBoundingClientRect().height > window.innerHeight, this.isUnderViewport ? this.setAttribute("isUnder", "") : this.removeAttribute("isUnder"), this.optionList.animate([{ transform: `translateY(${this.isUnderViewport ? "" : "-"}0.5rem)`, opacity: 0 }, { transform: "translateY(0)", opacity: 1 }], this.animationOptions), this.setAttribute("open", ""), this.style.zIndex = 1e3, (this.availableOptions.find(t => t.hasAttribute("selected")) || this.availableOptions[0]).focus(), document.addEventListener("mousedown", this.handleClickOutside), this.isOpen = !0 } collapse() { this.removeAttribute("open"), this.optionList.animate([{ transform: "translateY(0)", opacity: 1 }, { transform: `translateY(${this.isUnderViewport ? "" : "-"}0.5rem)`, opacity: 0 }], this.animationOptions).onfinish = (() => { this.availableOptions.forEach(t => t.removeAttribute("tabindex")), document.removeEventListener("mousedown", this.handleClickOutside), this.optionList.classList.add("hidden"), this.isOpen = !1, this.style.zIndex = "auto" }) } toggle() { this.isOpen || this.hasAttribute("disabled") ? this.collapse() : this.open() } fireEvent() { this.dispatchEvent(new CustomEvent("change", { bubbles: !0, composed: !0, detail: { value: this.value } })) } handleOptionsNavigation(t) { "ArrowUp" === t.key ? (t.preventDefault(), document.activeElement.previousElementSibling ? document.activeElement.previousElementSibling.focus() : this.availableOptions[this.availableOptions.length - 1].focus()) : "ArrowDown" === t.key && (t.preventDefault(), document.activeElement.nextElementSibling ? document.activeElement.nextElementSibling.focus() : this.availableOptions[0].focus()) } handleOptionSelection(t) { this.previousOption !== document.activeElement && (this.value = document.activeElement.getAttribute("value"), this.fireEvent()) } handleClick(t) { t.target === this ? this.toggle() : (this.handleOptionSelection(), this.collapse()) } handleKeydown(t) { t.target === this ? this.isOpen && "ArrowDown" === t.key ? (t.preventDefault(), (this.availableOptions.find(t => t.hasAttribute("selected")) || this.availableOptions[0]).focus(), this.handleOptionSelection(t)) : " " === t.key && (t.preventDefault(), this.toggle()) : (this.handleOptionsNavigation(t), this.handleOptionSelection(t), ["Enter", " ", "Escape", "Tab"].includes(t.key) && (t.preventDefault(), this.collapse(), this.focusIn())) } handleClickOutside(t) { this.isOpen && !this.contains(t.target) && this.collapse() } elementsChanged() { this.availableOptions = [...this.querySelectorAll("sm-option")], this.reset(!1), this.defaultSelected = this.value } connectedCallback() { this.setAttribute("role", "listbox"), this.hasAttribute("disabled") || this.hasAttribute("readonly") || (this.selection.setAttribute("tabindex", "0"), this.addEventListener("click", this.handleClick), this.addEventListener("keydown", this.handleKeydown)); const t = this.debounce(this.elementsChanged, 100); this.shadowRoot.querySelector("slot").addEventListener("slotchange", t), this.mutationObserver = new MutationObserver(e => { let n = !1; if (e.forEach(e => { switch (e.type) { case "childList": t(); break; case "attributes": n = !0 } }), n) { const t = this.availableOptions.find(t => t.hasAttribute("selected")) || this.availableOptions[0]; this.selectedOptionText.textContent = `${this.label}${t.textContent}`, this.setAttribute("value", t.getAttribute("value")) } }), this.mutationObserver.observe(this, { subtree: !0, childList: !0, attributeFilter: ["selected"] }), new IntersectionObserver((t, e) => { t.forEach(t => { if (t.isIntersecting) { const t = this.selection.getBoundingClientRect().left; t < window.innerWidth / 2 ? this.setAttribute("align-select", "left") : this.setAttribute("align-select", "right") } }) }).observe(this) } disconnectedCallback() { this.removeEventListener("click", this.handleClick), this.removeEventListener("keydown", this.handleKeydown) } attributeChangedCallback(t) { "disabled" === t || "readonly" === t ? this.hasAttribute("disabled") || this.hasAttribute("readonly") ? (this.selection.removeAttribute("tabindex"), this.removeEventListener("click", this.handleClick), this.removeEventListener("keydown", this.handleKeydown)) : (this.selection.setAttribute("tabindex", "0"), this.addEventListener("click", this.handleClick), this.addEventListener("keydown", this.handleKeydown)) : "label" === t && (this.label = this.hasAttribute("label") ? `${this.getAttribute("label")} ` : "") } }); const smOption = document.createElement("template"); smOption.innerHTML = '
', customElements.define("sm-option", class extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(smOption.content.cloneNode(!0)) } connectedCallback() { this.setAttribute("role", "option") } });
const spinner = document.createElement("template"); spinner.innerHTML = ''; class SpinnerLoader extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(spinner.content.cloneNode(!0)) } } window.customElements.define("sm-spinner", SpinnerLoader);
const themeToggle = document.createElement("template"); themeToggle.innerHTML = ' '; class ThemeToggle extends HTMLElement { constructor() { super(), this.attachShadow({ mode: "open" }).append(themeToggle.content.cloneNode(!0)), this.isChecked = !1, this.hasTheme = "light", this.toggleState = this.toggleState.bind(this), this.fireEvent = this.fireEvent.bind(this), this.handleThemeChange = this.handleThemeChange.bind(this) } static get observedAttributes() { return ["checked"] } daylight() { this.hasTheme = "light", document.body.dataset.theme = "light", this.setAttribute("aria-checked", "false") } nightlight() { this.hasTheme = "dark", document.body.dataset.theme = "dark", this.setAttribute("aria-checked", "true") } toggleState() { if (!document.startViewTransition) return this.toggleAttribute("checked"), void this.fireEvent(); document.startViewTransition(() => { this.toggleAttribute("checked"), this.fireEvent() }) } handleKeyDown(e) { " " === e.key && this.toggleState() } handleThemeChange(e) { e.detail.theme !== this.hasTheme && ("dark" === e.detail.theme ? this.setAttribute("checked", "") : this.removeAttribute("checked")) } fireEvent() { this.dispatchEvent(new CustomEvent("themechange", { bubbles: !0, composed: !0, detail: { theme: this.hasTheme } })) } connectedCallback() { this.setAttribute("role", "switch"), this.setAttribute("aria-label", "theme toggle"), "dark" === localStorage.getItem(`${window.location.hostname}-theme`) ? (this.nightlight(), this.setAttribute("checked", "")) : "light" === localStorage.getItem(`${window.location.hostname}-theme`) ? (this.daylight(), this.removeAttribute("checked")) : window.matchMedia("(prefers-color-scheme: dark)").matches ? (this.nightlight(), this.setAttribute("checked", "")) : (this.daylight(), this.removeAttribute("checked")), this.addEventListener("click", this.toggleState), this.addEventListener("keydown", this.handleKeyDown), document.addEventListener("themechange", this.handleThemeChange) } disconnectedCallback() { this.removeEventListener("click", this.toggleState), this.removeEventListener("keydown", this.handleKeyDown), document.removeEventListener("themechange", this.handleThemeChange) } attributeChangedCallback(e, t, n) { "checked" === e && (this.hasAttribute("checked") ? (this.nightlight(), localStorage.setItem(`${window.location.hostname}-theme`, "dark")) : (this.daylight(), localStorage.setItem(`${window.location.hostname}-theme`, "light"))) } } window.customElements.define("theme-toggle", ThemeToggle);
diff --git a/btcwallet/scripts/components.min.js b/btcwallet/scripts/components.min.js
index 856d088..a4b149d 100644
--- a/btcwallet/scripts/components.min.js
+++ b/btcwallet/scripts/components.min.js
@@ -1 +1 @@
-const smChips=document.createElement("template");smChips.innerHTML='',customElements.define("sm-chips",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smChips.content.cloneNode(!0)),this.chipsWrapper=this.shadowRoot.querySelector(".sm-chips"),this.coverLeft=this.shadowRoot.querySelector(".cover--left"),this.coverRight=this.shadowRoot.querySelector(".cover--right"),this.navButtonLeft=this.shadowRoot.querySelector(".nav-button--left"),this.navButtonRight=this.shadowRoot.querySelector(".nav-button--right"),this.slottedOptions=void 0,this._value=void 0,this.scrollDistance=0,this.assignedElements=[],this.scrollLeft=this.scrollLeft.bind(this),this.scrollRight=this.scrollRight.bind(this),this.fireEvent=this.fireEvent.bind(this),this.setSelectedOption=this.setSelectedOption.bind(this)}get value(){return this._value}set value(t){this.setSelectedOption(t)}scrollLeft(){this.chipsWrapper.scrollBy({left:-this.scrollDistance,behavior:"smooth"})}scrollRight(){this.chipsWrapper.scrollBy({left:this.scrollDistance,behavior:"smooth"})}setSelectedOption(t){this._value!==t&&(this._value=t,this.assignedElements.forEach((e=>{e.value==t?(e.setAttribute("selected",""),e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})):e.removeAttribute("selected")})))}fireEvent(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this._value}}))}connectedCallback(){this.setAttribute("role","listbox");const t=this.shadowRoot.querySelector("slot");t.addEventListener("slotchange",(e=>{n.disconnect(),i.disconnect(),this.observeSelf.disconnect(),clearTimeout(this.slotChangeTimeout),this.slotChangeTimeout=setTimeout((()=>{this.assignedElements=t.assignedElements(),this.assignedElements.forEach((t=>{t.hasAttribute("selected")&&(this._value=t.value)})),this.observeSelf.observe(this)}),0)}));const e=new ResizeObserver((t=>{t.forEach((t=>{if(t.contentBoxSize){const e=Array.isArray(t.contentBoxSize)?t.contentBoxSize[0]:t.contentBoxSize;this.scrollDistance=.6*e.inlineSize}else this.scrollDistance=.6*t.contentRect.width}))}));e.observe(this),this.observeSelf=new IntersectionObserver(((t,e)=>{t.forEach((t=>{t.isIntersecting&&!this.hasAttribute("multiline")&&this.assignedElements.length>0&&(n.observe(this.assignedElements[0]),i.observe(this.assignedElements[this.assignedElements.length-1]),e.unobserve(this))}))}),{threshold:1}),this.chipsWrapper.addEventListener("option-clicked",(t=>{this._value!==t.target.value&&(this.setSelectedOption(t.target.value),this.fireEvent())}));const n=new IntersectionObserver((t=>{t.forEach((t=>{t.isIntersecting?(this.navButtonLeft.classList.add("hide"),this.coverLeft.classList.add("hide")):(this.navButtonLeft.classList.remove("hide"),this.coverLeft.classList.remove("hide"))}))}),{threshold:1,root:this}),i=new IntersectionObserver((t=>{t.forEach((t=>{t.isIntersecting?(this.navButtonRight.classList.add("hide"),this.coverRight.classList.add("hide")):(this.navButtonRight.classList.remove("hide"),this.coverRight.classList.remove("hide"))}))}),{threshold:1,root:this});this.navButtonLeft.addEventListener("click",this.scrollLeft),this.navButtonRight.addEventListener("click",this.scrollRight)}disconnectedCallback(){this.navButtonLeft.removeEventListener("click",this.scrollLeft),this.navButtonRight.removeEventListener("click",this.scrollRight)}});const smChip=document.createElement("template");smChip.innerHTML=' ',customElements.define("sm-chip",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smChip.content.cloneNode(!0)),this._value=void 0,this.radioButton=this.shadowRoot.querySelector("input"),this.fireEvent=this.fireEvent.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}get value(){return this._value}fireEvent(){this.dispatchEvent(new CustomEvent("option-clicked",{bubbles:!0,composed:!0,detail:{value:this._value}}))}handleKeyDown(t){"Enter"!==t.key&&"Space"!==t.key||this.fireEvent()}connectedCallback(){this.setAttribute("role","option"),this.setAttribute("tabindex","0"),this._value=this.getAttribute("value"),this.addEventListener("click",this.fireEvent),this.addEventListener("keydown",this.handleKeyDown)}disconnectedCallback(){this.removeEventListener("click",this.fireEvent),this.removeEventListener("keydown",this.handleKeyDown)}});const smCopy=document.createElement("template");smCopy.innerHTML='',customElements.define("sm-copy",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smCopy.content.cloneNode(!0)),this.copyContent=this.shadowRoot.querySelector(".copy-content"),this.copyButton=this.shadowRoot.querySelector(".copy-button"),this.copy=this.copy.bind(this)}static get observedAttributes(){return["value"]}set value(t){this.setAttribute("value",t)}get value(){return this.getAttribute("value")}fireEvent(){this.dispatchEvent(new CustomEvent("copy",{composed:!0,bubbles:!0,cancelable:!0}))}copy(){navigator.clipboard.writeText(this.getAttribute("value")).then((t=>this.fireEvent())).catch((t=>console.error(t)))}connectedCallback(){this.copyButton.addEventListener("click",this.copy)}attributeChangedCallback(t,n,o){if("value"===t){const t=this.copyContent.querySelector("slot");if(!t)return;const n=t.assignedNodes();n&&n.length||(t.textContent=o)}}disconnectedCallback(){this.copyButton.removeEventListener("click",this.copy)}});const smForm=document.createElement("template");smForm.innerHTML=' ',customElements.define("sm-form",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smForm.content.cloneNode(!0)),this.form=this.shadowRoot.querySelector("form"),this.invalidFieldsCount,this.skipSubmit=!1,this.isFormValid=void 0,this.supportedElements="input, sm-input, sm-textarea, sm-checkbox, tags-input, file-input, sm-switch, sm-radio",this.formElements=[],this._requiredElements=[]}static get observedAttributes(){return["skip-submit"]}get validity(){return this.isFormValid}debounce=(callback,wait)=>{let timeoutId=null;return(...args)=>{window.clearTimeout(timeoutId),timeoutId=window.setTimeout((()=>{callback.apply(null,args)}),wait)}};_checkValidity=()=>{this.submitButton&&0!==this._requiredElements.length&&(this.invalidFieldsCount=0,this._requiredElements.forEach((([elem,isWC])=>{(!elem.disabled&&isWC&&!elem.isValid||!isWC&&!elem.checkValidity())&&this.invalidFieldsCount++})),this.isFormValid!==(0===this.invalidFieldsCount)&&(this.isFormValid=0===this.invalidFieldsCount,this.dispatchEvent(new CustomEvent(this.isFormValid?"valid":"invalid",{bubbles:!0,composed:!0})),this.skipSubmit||(this.submitButton.disabled=!this.isFormValid)))};handleKeydown=e=>{if("Enter"===e.key&&e.target.tagName.includes("INPUT"))if(0===this.invalidFieldsCount)this.submitButton&&this.submitButton.click(),this.dispatchEvent(new CustomEvent("submit",{bubbles:!0,composed:!0}));else for(const[elem,isWC]of this._requiredElements)if(isWC?!elem.isValid:!elem.checkValidity()){(elem?.shadowRoot?.lastElementChild||elem).animate([{transform:"translateX(-1rem)"},{transform:"translateX(1rem)"},{transform:"translateX(-0.5rem)"},{transform:"translateX(0.5rem)"},{transform:"translateX(0)"}],{duration:300,easing:"ease"}),isWC?(elem.focusIn(),"SM-INPUT"===elem.tagName&&""===elem.value.trim()&&elem.showError()):elem.focus();break}};reset=()=>{this.formElements.forEach((([elem,isWC])=>{if(isWC)elem.reset();else switch(elem.type){case"checkbox":case"radio":elem.checked=!1;break;default:elem.value=""}})),this._checkValidity()};elementsChanged=()=>{this.formElements=[...this.querySelectorAll(this.supportedElements)].map((elem=>[elem,elem.tagName.includes("-")])),this._requiredElements=this.formElements.filter((([elem])=>elem.hasAttribute("required"))),this.submitButton=this.querySelector('[variant="primary"], [type="submit"]'),this.resetButton=this.querySelector('[type="reset"]'),this.resetButton&&this.resetButton.addEventListener("click",this.reset),this._checkValidity()};connectedCallback(){const updateFormDecedents=this.debounce(this.elementsChanged,100);this.addEventListener("input",this.debounce(this._checkValidity,100)),this.addEventListener("keydown",this.debounce(this.handleKeydown,100)),this.shadowRoot.querySelector("slot").addEventListener("slotchange",updateFormDecedents),this.mutationObserver=new MutationObserver((mutations=>{mutations.forEach((mutation=>{("childList"===mutation.type&&[...mutation.addedNodes].some((node=>1===node.nodeType&&node.querySelector(this.supportedElements)))||[...mutation.removedNodes].some((node=>1===node.nodeType&&node.querySelector(this.supportedElements))))&&updateFormDecedents()}))})),this.mutationObserver.observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(name,oldValue,newValue){"skip-submit"===name&&(this.skipSubmit=null!==newValue)}disconnectedCallback(){this.removeEventListener("input",this.debounce(this._checkValidity,100)),this.removeEventListener("keydown",this.debounce(this.handleKeydown,100)),this.mutationObserver.disconnect()}});const smInput=document.createElement("template");smInput.innerHTML=' ',customElements.define("sm-input",class SmInput extends HTMLElement{static hasAppendedStyles=!1;#validationState={validatedFor:void 0,isValid:!1,errorMessage:"Please fill out this field."};constructor(){super(),this.attachShadow({mode:"open"}).append(smInput.content.cloneNode(!0)),this.inputParent=this.shadowRoot.querySelector(".input"),this.input=this.shadowRoot.querySelector("input"),this.clearBtn=this.shadowRoot.querySelector(".clear"),this.placeholderElement=this.shadowRoot.querySelector(".placeholder"),this.outerContainer=this.shadowRoot.querySelector(".outer-container"),this.optionList=this.shadowRoot.querySelector(".datalist"),this._helperText="",this.isRequired=!1,this.datalist=[],this.validationFunction=void 0,this.reflectedAttributes=["value","required","disabled","type","inputmode","readonly","min","max","pattern","minlength","maxlength","step","list","autocomplete"]}static get observedAttributes(){return["value","placeholder","required","disabled","type","inputmode","readonly","min","max","pattern","minlength","maxlength","step","helper-text","error-text","list"]}get value(){return this.input.value}set value(val){val!==this.input.value&&(this.input.value=val,this._value=val,this.checkInput())}get placeholder(){return this.getAttribute("placeholder")}set placeholder(val){this.setAttribute("placeholder",val)}get type(){return this.getAttribute("type")}set type(val){this.setAttribute("type",val)}get validity(){return this.input.validity}get disabled(){return this.hasAttribute("disabled")}set disabled(value){value?(this.inputParent.classList.add("disabled"),this.setAttribute("disabled","")):(this.inputParent.classList.remove("disabled"),this.removeAttribute("disabled"))}get readOnly(){return this.hasAttribute("readonly")}set readOnly(value){value?this.setAttribute("readonly",""):this.removeAttribute("readonly")}set customValidation(val){val&&(this.validationFunction=val)}set errorText(val){this.#validationState.errorText=val}showError=(errorText=this.#validationState.errorText)=>{const appendedNew=this.appendFeedbackElement();this.feedbackPopover.innerHTML=` ${errorText} `,this.feedbackPopover.dataset.state="error",appendedNew&&this.feedbackPopover.animate([{transform:"scale(0.95)",opacity:0},{transform:"scale(1)",opacity:1}],{duration:200,easing:"ease",fill:"forwards"})};set helperText(val){this._helperText=val}get isValid(){if(this.#validationState.validatedFor===this.input.value)return this.#validationState.isValid;const _isValid=this.input.checkValidity();let _validity={isValid:!0,errorText:""};return this.validationFunction&&(_validity=this.validationFunction(this.input.value,this)),_isValid&&_validity.isValid?(this.setAttribute("valid",""),this.removeAttribute("invalid"),this.hideFeedback()):(this.removeAttribute("valid"),this.setAttribute("invalid",""),""!==this.value.trim()&&(_validity.errorText||this.#validationState.errorText)&&this.showError(_validity.errorText||this.#validationState.errorText)),this.#validationState.validatedFor=this.input.value,this.#validationState.isValid=_isValid&&_validity.isValid,this.#validationState.errorText=_validity.errorText||this.#validationState.errorText,this.#validationState.isValid}reset=()=>{this.value=""};clear=()=>{this.value="",this.input.focus(),this.fireEvent()};focusIn=()=>{this.input.focus()};focusOut=()=>{this.input.blur()};fireEvent=()=>{let event=new Event("input",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(event)};searchDatalist=searchKey=>{const filteredData=this.datalist.filter((item=>item.toLowerCase().includes(searchKey.toLowerCase())));if(filteredData.sort(((a,b)=>a.toLowerCase().indexOf(searchKey.toLowerCase())-b.toLowerCase().indexOf(searchKey.toLowerCase()))),filteredData.length){if(this.optionList.children.length>filteredData.length){const optionsToRemove=this.optionList.children.length-filteredData.length;for(let i=0;i{if(this.optionList.children[index])this.optionList.children[index].textContent=item;else{const option=document.createElement("li");option.textContent=item,option.classList.add("datalist-item"),option.setAttribute("tabindex","0"),this.optionList.appendChild(option)}})),this.optionList.classList.remove("hidden")}else this.optionList.classList.add("hidden")};checkInput=e=>{this.hasAttribute("readonly")||(""!==this.input.value?this.clearBtn.classList.remove("hidden"):this.clearBtn.classList.add("hidden")),this.hasAttribute("placeholder")&&""!==this.getAttribute("placeholder").trim()&&(""!==this.input.value?(this.shouldAnimatePlaceholder&&this.inputParent.classList.add("animate-placeholder"),this.placeholderElement.classList.toggle("hidden",!this.shouldAnimatePlaceholder),this.datalist.length&&(this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((()=>{this.searchDatalist(this.input.value.trim())}),100))):(this.shouldAnimatePlaceholder&&this.inputParent.classList.remove("animate-placeholder"),this.placeholderElement.classList.remove("hidden"),this.hideFeedback(),this.datalist.length&&(this.optionList.innerHTML="",this.optionList.classList.add("hidden"))))};allowOnlyNum=e=>{e.ctrlKey||1===e.key.length&&(("."!==e.key||!e.target.value.includes(".")&&0!==e.target.value.length)&&["0","1","2","3","4","5","6","7","8","9","."].includes(e.key)||e.preventDefault())};handleOptionClick=e=>{this.input.value=e.target.textContent,this.optionList.classList.add("hidden"),this.input.focus()};handleInputNavigation=e=>{"ArrowDown"===e.key?(e.preventDefault(),this.optionList.children.length&&this.optionList.children[0].focus()):"ArrowUp"===e.key&&(e.preventDefault(),this.optionList.children.length&&this.optionList.children[this.optionList.children.length-1].focus())};handleDatalistNavigation=e=>{"ArrowUp"===e.key?(e.preventDefault(),this.shadowRoot.activeElement.previousElementSibling?this.shadowRoot.activeElement.previousElementSibling.focus():this.input.focus()):"ArrowDown"===e.key?(e.preventDefault(),this.shadowRoot.activeElement.nextElementSibling?this.shadowRoot.activeElement.nextElementSibling.focus():this.input.focus()):"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.input.value=e.target.textContent,this.optionList.classList.add("hidden"),this.input.focus())};handleFocus=e=>{this.datalist.length&&this.searchDatalist(this.input.value.trim())};handleBlur=e=>{this.datalist.length&&this.optionList.classList.add("hidden")};applyGlobalCustomValidation=()=>{if(void 0!==window.smCompConfig&&window.smCompConfig["sm-input"]){const config=window.smCompConfig["sm-input"].find((config=>this.matches(config.selector)));this.customValidation=config?.customValidation}};updatePosition=()=>{requestAnimationFrame((()=>{if(this.dimensions=this.getBoundingClientRect(),this.scrollingParentDimensions=this.scrollingParent.getBoundingClientRect(),0===this.dimensions.width||0===this.dimensions.height)return;let topOffset=this.dimensions.top-this.scrollingParentDimensions.top+this.dimensions.height,leftOffset=this.dimensions.left-this.scrollingParentDimensions.left;const maxWidth=this.dimensions.width;this.feedbackPopover.style=`top: ${topOffset}px; left: ${leftOffset}px; max-width: ${maxWidth}px;`}))};appendFeedbackElement=()=>!this.feedbackPopover&&(this.feedbackPopover=document.createElement("div"),this.feedbackPopover.className="feedback-popover",this.feedbackPopover.setAttribute("aria-live","polite"),this.containment=this.closest("[data-sm-containment]"),this.scrollingParent=this.getNearestScrollingParent(this),(this.containment||this.scrollingParent).appendChild(this.feedbackPopover),""===this.scrollingParent.style.position&&(this.scrollingParent.style.position="relative"),this.containment||(this.observerHidFeedback=!1,this.intersectionObserver=new IntersectionObserver((entries=>{if(this.feedbackPopover)if(entries[0].isIntersecting){if(!this.observerHidFeedback)return;this.feedbackPopover.classList.remove("hidden"),this.observerHidFeedback=!1}else this.feedbackPopover.classList.add("hidden"),this.observerHidFeedback=!0})).observe(this)),this.updatePosition(),window.addEventListener("resize",this.updatePosition,{passive:!0}),!0);getNearestScrollingParent=element=>{let parent=element.parentNode;for(;parent;){if(parent.scrollHeight>parent.clientHeight||parent.scrollWidth>parent.clientWidth||parent.tagName.includes("SM-")||parent.hasAttribute("data-scrollable"))return parent;parent=parent.parentNode}return document.body};hideFeedback=()=>{this.feedbackPopover&&(this.feedbackPopover.animate([{transform:"none",opacity:1},{transform:"scale(0.95)",opacity:0}],{duration:100,easing:"ease-in-out",fill:"forwards"}).onfinish=()=>{this.intersectionObserver?.disconnect(),this.feedbackPopover.remove(),this.feedbackPopover=null,window.removeEventListener("resize",this.updatePosition,{passive:!0})})};connectedCallback(){SmInput.hasAppendedStyles||(document.head.insertAdjacentHTML("beforeend",""),SmInput.hasAppendedStyles=!0),this.shouldAnimatePlaceholder=this.hasAttribute("animate"),this.shouldAnimatePlaceholder&&""!==this.placeholderElement&&this.value&&(this.inputParent.classList.add("animate-placeholder"),this.placeholderElement.classList.remove("hidden")),this.setAttribute("role","textbox"),"loading"===document.readyState?window.addEventListener("load",this.applyGlobalCustomValidation,{once:!0}):this.applyGlobalCustomValidation(),this.input.addEventListener("input",this.checkInput),this.clearBtn.addEventListener("click",this.clear),this.datalist.length&&(this.optionList.addEventListener("click",this.handleOptionClick),this.input.addEventListener("keydown",this.handleInputNavigation),this.optionList.addEventListener("keydown",this.handleDatalistNavigation)),this.input.addEventListener("focusin",this.handleFocus),this.addEventListener("focusout",this.handleBlur)}attributeChangedCallback(name,oldValue,newValue){if(oldValue!==newValue)switch(this.reflectedAttributes.includes(name)&&(this.hasAttribute(name)?this.input.setAttribute(name,this.getAttribute(name)?this.getAttribute(name):""):this.input.removeAttribute(name)),name){case"placeholder":this.placeholderElement.textContent=newValue,this.setAttribute("aria-label",newValue);break;case"value":this.checkInput();break;case"type":this.hasAttribute("type")&&"number"===this.getAttribute("type")?(this.input.setAttribute("inputmode","decimal"),this.input.addEventListener("keydown",this.allowOnlyNum)):this.input.removeEventListener("keydown",this.allowOnlyNum);break;case"helper-text":this._helperText=newValue;break;case"error-text":this.#validationState.errorText=newValue;break;case"required":this.isRequired=this.hasAttribute("required"),this.isRequired?this.setAttribute("aria-required","true"):this.setAttribute("aria-required","false");break;case"readonly":this.hasAttribute("readonly")?this.inputParent.classList.add("readonly"):this.inputParent.classList.remove("readonly");break;case"disabled":this.hasAttribute("disabled")?this.inputParent.classList.add("disabled"):this.inputParent.classList.remove("disabled");break;case"list":this.hasAttribute("list")&&""!==this.getAttribute("list").trim()&&(this.datalist=this.getAttribute("list").split(","))}}disconnectedCallback(){this.input.removeEventListener("input",this.checkInput),this.clearBtn.removeEventListener("click",this.clear),this.input.removeEventListener("keydown",this.allowOnlyNum),this.optionList.removeEventListener("click",this.handleOptionClick),this.input.removeEventListener("keydown",this.handleInputNavigation),this.optionList.removeEventListener("keydown",this.handleDatalistNavigation),this.input.removeEventListener("focusin",this.handleFocus),this.removeEventListener("focusout",this.handleBlur),window.removeEventListener("resize",this.updatePosition,{passive:!0}),this.feedbackPopover&&this.feedbackPopover.remove(),this.intersectionObserver&&this.intersectionObserver.disconnect()}});const smNotifications=document.createElement("template");smNotifications.innerHTML=" ",customElements.define("sm-notifications",class extends HTMLElement{constructor(){super(),this.shadow=this.attachShadow({mode:"open"}).append(smNotifications.content.cloneNode(!0)),this.notificationPanel=this.shadowRoot.querySelector(".notification-panel"),this.animationOptions={duration:300,fill:"forwards",easing:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"},this.push=this.push.bind(this),this.createNotification=this.createNotification.bind(this),this.removeNotification=this.removeNotification.bind(this),this.clearAll=this.clearAll.bind(this),this.remove=this.remove.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.startX=0,this.currentX=0,this.endX=0,this.swipeDistance=0,this.swipeDirection="",this.swipeThreshold=0,this.startTime=0,this.swipeTime=0,this.swipeTimeThreshold=200,this.currentTarget=null,this.notificationTimeout=5e3,this.mediaQuery=window.matchMedia("(min-width: 640px)"),this.handleOrientationChange=this.handleOrientationChange.bind(this),this.isBigViewport=!1}set timeout(value){isNaN(value)||(this.notificationTimeout=value)}randString(length){let result="";for(let i=0;i${icon}`:""} ${action?``:""} `,action&¬ification.querySelector(".action").addEventListener("click",action.callback),notification.querySelector(".close").addEventListener("click",(()=>{this.removeNotification(notification)})),pinned||setTimeout((()=>{this.removeNotification(notification,this.isBigViewport?"left":"top")}),timeout),notification}push(message,options={}){const notification=this.createNotification(message,options);return this.isBigViewport?this.notificationPanel.append(notification):this.notificationPanel.prepend(notification),notification.scrollIntoView({behavior:"smooth"}),this.notificationPanel.animate([{transform:`translateY(${this.isBigViewport?"":"-"}${notification.clientHeight}px)`},{transform:"none"}],this.animationOptions),notification.animate([{transform:"translateY(-1rem)",opacity:"0"},{transform:"none",opacity:"1"}],this.animationOptions).onfinish=e=>{e.target.commitStyles(),e.target.cancel()},notification.id}removeNotification(notification,direction="left"){if(!notification)return;const sign="left"===direction||"top"===direction?"-":"+";this.isBigViewport||"top"!==direction?notification.animate([{transform:this.currentX?`translateX(${this.currentX}px)`:"none",opacity:"1"},{transform:`translateX(calc(${sign}${Math.abs(this.currentX)}px ${sign} 1rem))`,opacity:"0"}],this.animationOptions).onfinish=()=>{notification.remove()}:notification.animate([{transform:this.currentX?`translateY(${this.currentX}px)`:"none",opacity:"1"},{transform:`translateY(calc(${sign}${Math.abs(this.currentX)}px ${sign} 1rem))`,opacity:"0"}],this.animationOptions).onfinish=()=>{notification.remove()}}remove(id){const notification=this.notificationPanel.querySelector(`#${id}`);notification&&this.removeNotification(notification)}clearAll(){Array.from(this.notificationPanel.children).forEach((child=>{this.removeNotification(child)}))}handleTouchMove(e){this.currentX=e.touches[0].clientX-this.startX,this.currentTarget.style.transform=`translateX(${this.currentX}px)`}handleOrientationChange(e){this.isBigViewport=e.matches,e.matches}connectedCallback(){this.handleOrientationChange(this.mediaQuery),this.mediaQuery.addEventListener("change",this.handleOrientationChange),this.notificationPanel.addEventListener("touchstart",(e=>{e.target.closest(".close")?this.removeNotification(e.target.closest(".notification")):e.target.closest(".notification")&&(this.swipeThreshold=e.target.closest(".notification").getBoundingClientRect().width/2,this.currentTarget=e.target.closest(".notification"),this.startTime=Date.now(),this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY,this.notificationPanel.addEventListener("touchmove",this.handleTouchMove,{passive:!0}))}),{passive:!0}),this.notificationPanel.addEventListener("touchend",(e=>{this.endX=e.changedTouches[0].clientX,this.endY=e.changedTouches[0].clientY,this.swipeDistance=Math.abs(this.endX-this.startX),this.swipeTime=Date.now()-this.startTime,this.endX>this.startX?this.swipeDirection="right":this.swipeDirection="left",this.swipeTime50&&this.removeNotification(this.currentTarget,this.swipeDirection):this.swipeDistance>this.swipeThreshold?this.removeNotification(this.currentTarget,this.swipeDirection):this.currentTarget.animate([{transform:`translateX(${this.currentX}px)`},{transform:"none"}],this.animationOptions).onfinish=e=>{e.target.commitStyles(),e.target.cancel()},this.notificationPanel.removeEventListener("touchmove",this.handleTouchMove),this.currentX=0}))}disconnectedCallback(){mediaQueryList.removeEventListener("change",handleOrientationChange)}});class Stack{constructor(){this.items=[]}push(element){this.items.push(element)}pop(){return 0==this.items.length?"Underflow":this.items.pop()}peek(){return this.items[this.items.length-1]}}const popupStack=new Stack,smPopup=document.createElement("template");smPopup.innerHTML='',customElements.define("sm-popup",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smPopup.content.cloneNode(!0)),this.allowClosing=!1,this.isOpen=!1,this.offset=0,this.touchStartY=0,this.touchEndY=0,this.touchStartTime=0,this.touchEndTime=0,this.touchEndAnimation=void 0,this.focusable,this.autoFocus,this.mutationObserver,this.popupContainer=this.shadowRoot.querySelector(".popup-container"),this.backdrop=this.shadowRoot.querySelector(".backdrop"),this.dialogBox=this.shadowRoot.querySelector(".popup"),this.popupBodySlot=this.shadowRoot.querySelector(".popup-body slot"),this.popupHeader=this.shadowRoot.querySelector(".popup-top")}static get observedAttributes(){return["open"]}get open(){return this.isOpen}animateTo=(element,keyframes,options)=>{const anime=element.animate(keyframes,{...options,fill:"both"});return anime.finished.then((()=>{anime.commitStyles(),anime.cancel()})),anime};resumeScrolling=()=>{const scrollY=document.body.style.top;window.scrollTo(0,-1*parseInt(scrollY||"0")),document.body.style.overflow="",document.body.style.top="initial"};setStateOpen=()=>{if(!this.isOpen||this.offset){const animOptions={duration:300,easing:"ease"},initialAnimation=window.innerWidth>640?"scale(1.1)":`translateY(${this.offset?`${this.offset}px`:"100%"})`;this.animateTo(this.dialogBox,[{opacity:this.offset?1:0,transform:initialAnimation},{opacity:1,transform:"none"}],animOptions)}};show=(options={})=>{const{pinned:pinned=!1,payload:payload}=options;if(this.isOpen)return;const animOptions={duration:300,easing:"ease"};return this.payload=payload,popupStack.push({popup:this,permission:pinned}),popupStack.items.length>1&&this.animateTo(popupStack.items[popupStack.items.length-2].popup.shadowRoot.querySelector(".popup"),[{transform:"none"},{transform:window.innerWidth>640?"scale(0.95)":"translateY(-1.5rem)"}],animOptions),this.popupContainer.classList.remove("hide"),this.offset||(this.backdrop.animate([{opacity:0},{opacity:1}],animOptions).onfinish=()=>{this.resolveOpen(this.payload)},this.dispatchEvent(new CustomEvent("popupopened",{bubbles:!0,composed:!0,detail:{payload:this.payload}})),document.body.style.overflow="hidden",document.body.style.top=`-${window.scrollY}px`),this.setStateOpen(),this.pinned=pinned,this.isOpen=!0,setTimeout((()=>{const elementToFocus=this.autoFocus||this.focusable?.[0]||this.dialogBox;elementToFocus&&(elementToFocus.tagName.includes("-")?elementToFocus.focusIn():elementToFocus.focus())}),0),this.hasAttribute("open")||(this.setAttribute("open",""),this.addEventListener("keydown",this.detectFocus),this.resizeObserver.observe(this),this.mutationObserver.observe(this,{attributes:!0,childList:!0,subtree:!0}),this.popupHeader.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),this.backdrop.addEventListener("mousedown",this.handleSoftDismiss)),{opened:new Promise((resolve=>{this.resolveOpen=resolve})),closed:new Promise((resolve=>{this.resolveClose=resolve}))}};hide=(options={})=>{const{payload:payload}=options,animOptions={duration:150,easing:"ease"};this.backdrop.animate([{opacity:1},{opacity:0}],animOptions),this.animateTo(this.dialogBox,[{opacity:1,transform:window.innerWidth>640?"none":`translateY(${this.offset?`${this.offset}px`:"0"})`},{opacity:0,transform:window.innerWidth>640?"scale(1.1)":"translateY(100%)"}],animOptions).finished.finally((()=>{this.popupContainer.classList.add("hide"),this.dialogBox.style="",this.removeAttribute("open"),this.forms.length&&this.forms.forEach((form=>form.reset())),this.dispatchEvent(new CustomEvent("popupclosed",{bubbles:!0,composed:!0,detail:{payload:payload||this.payload}})),this.resolveClose(payload||this.payload),this.isOpen=!1})),popupStack.pop(),popupStack.items.length?this.animateTo(popupStack.items[popupStack.items.length-1].popup.shadowRoot.querySelector(".popup"),[{transform:window.innerWidth>640?"scale(0.95)":"translateY(-1.5rem)"},{transform:"none"}],animOptions):this.resumeScrolling(),this.resizeObserver.disconnect(),this.mutationObserver.disconnect(),this.removeEventListener("keydown",this.detectFocus),this.popupHeader.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),this.backdrop.removeEventListener("mousedown",this.handleSoftDismiss)};handleTouchStart=e=>{this.offset=0,this.popupHeader.addEventListener("touchmove",this.handleTouchMove,{passive:!0}),this.popupHeader.addEventListener("touchend",this.handleTouchEnd,{passive:!0}),this.touchStartY=e.changedTouches[0].clientY,this.touchStartTime=e.timeStamp};handleTouchMove=e=>{this.touchStartY{this.dialogBox.style.transform=`translateY(${this.offset}px)`})))};handleTouchEnd=e=>{if(this.touchEndTime=e.timeStamp,cancelAnimationFrame(this.touchEndAnimation),this.touchEndY=e.changedTouches[0].clientY,this.threshold=.3*this.dialogBox.getBoundingClientRect().height,this.touchEndTime-this.touchStartTime>200)if(this.touchEndY-this.touchStartY>this.threshold){if(this.pinned)return void this.setStateOpen();this.hide()}else this.setStateOpen();else if(this.touchEndY>this.touchStartY){if(this.pinned)return void this.setStateOpen();this.hide()}this.popupHeader.removeEventListener("touchmove",this.handleTouchMove,{passive:!0}),this.popupHeader.removeEventListener("touchend",this.handleTouchEnd,{passive:!0})};detectFocus=e=>{if("Tab"===e.key){if(!this.focusable.length)return;if(!this.firstFocusable)for(let i=0;i=0;i--)if(!this.focusable[i].disabled){this.lastFocusable=this.focusable[i];break}e.shiftKey&&document.activeElement===this.firstFocusable?(e.preventDefault(),this.lastFocusable.tagName.includes("SM-")?this.lastFocusable.focusIn():this.lastFocusable.focus()):e.shiftKey||document.activeElement!==this.lastFocusable||(e.preventDefault(),this.firstFocusable.tagName.includes("SM-")?this.firstFocusable.focusIn():this.firstFocusable.focus())}};updateFocusableList=()=>{this.focusable=this.querySelectorAll('sm-button:not([disabled]), button:not([disabled]), [href], sm-input, input:not([readonly]), sm-select, select, sm-checkbox, sm-textarea, textarea, [tabindex]:not([tabindex="-1"])'),this.autoFocus=this.querySelector("[autofocus]"),this.firstFocusable=null,this.lastFocusable=null};handleSoftDismiss=()=>{this.pinned?this.dialogBox.animate([{transform:"translateX(-1rem)"},{transform:"translateX(1rem)"},{transform:"translateX(-0.5rem)"},{transform:"translateX(0.5rem)"},{transform:"translateX(0)"}],{duration:300,easing:"ease"}):this.hide()};debounce=(callback,wait)=>{let timeoutId=null;return(...args)=>{window.clearTimeout(timeoutId),timeoutId=window.setTimeout((()=>{callback.apply(null,args)}),wait)}};connectedCallback(){this.popupBodySlot.addEventListener("slotchange",this.debounce((()=>{this.forms=this.querySelectorAll("sm-form"),this.updateFocusableList()}),0)),this.resizeObserver=new ResizeObserver((entries=>{entries.forEach((entry=>{if(entry.contentBoxSize){const contentBoxSize=Array.isArray(entry.contentBoxSize)?entry.contentBoxSize[0]:entry.contentBoxSize;this.threshold=.3*contentBoxSize.blockSize.height}else this.threshold=.3*entry.contentRect.height}))})),this.mutationObserver=new MutationObserver((entries=>{this.updateFocusableList()}))}disconnectedCallback(){this.resizeObserver.disconnect(),this.mutationObserver.disconnect(),this.removeEventListener("keydown",this.detectFocus),this.popupHeader.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),this.backdrop.removeEventListener("mousedown",this.handleSoftDismiss)}attributeChangedCallback(name){"open"===name&&this.hasAttribute("open")&&this.show()}});const smSelect=document.createElement("template");smSelect.innerHTML='',customElements.define("sm-select",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smSelect.content.cloneNode(!0)),this.focusIn=this.focusIn.bind(this),this.reset=this.reset.bind(this),this.open=this.open.bind(this),this.collapse=this.collapse.bind(this),this.toggle=this.toggle.bind(this),this.handleOptionsNavigation=this.handleOptionsNavigation.bind(this),this.handleOptionSelection=this.handleOptionSelection.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.handleClickOutside=this.handleClickOutside.bind(this),this.selectOption=this.selectOption.bind(this),this.debounce=this.debounce.bind(this),this.elementsChanged=this.elementsChanged.bind(this),this.availableOptions=[],this.previousOption,this.isOpen=!1,this.label="",this.defaultSelected="",this.isUnderViewport=!1,this.animationOptions={duration:300,fill:"forwards",easing:"ease"},this.optionList=this.shadowRoot.querySelector(".options"),this.selection=this.shadowRoot.querySelector(".selection"),this.selectedOptionText=this.shadowRoot.querySelector(".selected-option-text")}static get observedAttributes(){return["disabled","label","readonly"]}get value(){return this.getAttribute("value")}set value(t){const e=this.availableOptions.find((e=>e.getAttribute("value")===t));e?(this.setAttribute("value",t),this.selectOption(e)):console.warn(`There is no option with ${t} as value`)}debounce(t,e){let n=null;return(...i)=>{window.clearTimeout(n),n=window.setTimeout((()=>{t.apply(null,i)}),e)}}reset(t=!0){if(this.availableOptions[0]&&this.previousOption!==this.availableOptions[0]){const e=this.availableOptions.find((t=>t.hasAttribute("selected")))||this.availableOptions[0];this.value=e.getAttribute("value"),t&&this.fireEvent()}}selectOption(t){this.previousOption!==t&&(this.querySelectorAll("[selected").forEach((t=>t.removeAttribute("selected"))),this.selectedOptionText.textContent=`${this.label}${t.textContent}`,t.setAttribute("selected",""),this.previousOption=t)}focusIn(){this.selection.focus()}open(){this.availableOptions.forEach((t=>t.setAttribute("tabindex",0))),this.optionList.classList.remove("hidden"),this.isUnderViewport=this.getBoundingClientRect().bottom+this.optionList.getBoundingClientRect().height>window.innerHeight,this.isUnderViewport?this.setAttribute("isUnder",""):this.removeAttribute("isUnder"),this.optionList.animate([{transform:`translateY(${this.isUnderViewport?"":"-"}0.5rem)`,opacity:0},{transform:"translateY(0)",opacity:1}],this.animationOptions),this.setAttribute("open",""),this.style.zIndex=1e3,(this.availableOptions.find((t=>t.hasAttribute("selected")))||this.availableOptions[0]).focus(),document.addEventListener("mousedown",this.handleClickOutside),this.isOpen=!0}collapse(){this.removeAttribute("open"),this.optionList.animate([{transform:"translateY(0)",opacity:1},{transform:`translateY(${this.isUnderViewport?"":"-"}0.5rem)`,opacity:0}],this.animationOptions).onfinish=()=>{this.availableOptions.forEach((t=>t.removeAttribute("tabindex"))),document.removeEventListener("mousedown",this.handleClickOutside),this.optionList.classList.add("hidden"),this.isOpen=!1,this.style.zIndex="auto"}}toggle(){this.isOpen||this.hasAttribute("disabled")?this.collapse():this.open()}fireEvent(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value}}))}handleOptionsNavigation(t){"ArrowUp"===t.key?(t.preventDefault(),document.activeElement.previousElementSibling?document.activeElement.previousElementSibling.focus():this.availableOptions[this.availableOptions.length-1].focus()):"ArrowDown"===t.key&&(t.preventDefault(),document.activeElement.nextElementSibling?document.activeElement.nextElementSibling.focus():this.availableOptions[0].focus())}handleOptionSelection(t){this.previousOption!==document.activeElement&&(this.value=document.activeElement.getAttribute("value"),this.fireEvent())}handleClick(t){t.target===this?this.toggle():(this.handleOptionSelection(),this.collapse())}handleKeydown(t){t.target===this?this.isOpen&&"ArrowDown"===t.key?(t.preventDefault(),(this.availableOptions.find((t=>t.hasAttribute("selected")))||this.availableOptions[0]).focus(),this.handleOptionSelection(t)):" "===t.key&&(t.preventDefault(),this.toggle()):(this.handleOptionsNavigation(t),this.handleOptionSelection(t),["Enter"," ","Escape","Tab"].includes(t.key)&&(t.preventDefault(),this.collapse(),this.focusIn()))}handleClickOutside(t){this.isOpen&&!this.contains(t.target)&&this.collapse()}elementsChanged(){this.availableOptions=[...this.querySelectorAll("sm-option")],this.reset(!1),this.defaultSelected=this.value}connectedCallback(){this.setAttribute("role","listbox"),this.hasAttribute("disabled")||this.hasAttribute("readonly")||(this.selection.setAttribute("tabindex","0"),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeydown));const t=this.debounce(this.elementsChanged,100);this.shadowRoot.querySelector("slot").addEventListener("slotchange",t),this.mutationObserver=new MutationObserver((e=>{let n=!1;if(e.forEach((e=>{switch(e.type){case"childList":t();break;case"attributes":n=!0}})),n){const t=this.availableOptions.find((t=>t.hasAttribute("selected")))||this.availableOptions[0];this.selectedOptionText.textContent=`${this.label}${t.textContent}`,this.setAttribute("value",t.getAttribute("value"))}})),this.mutationObserver.observe(this,{subtree:!0,childList:!0,attributeFilter:["selected"]}),new IntersectionObserver(((t,e)=>{t.forEach((t=>{if(t.isIntersecting){this.selection.getBoundingClientRect().left *{ padding: 0; margin: 0; -webkit-box-sizing: border-box; box-sizing: border-box;} :host{ display: -webkit-box; display: -ms-flexbox; display: flex; overflow: hidden; border-radius: var(--border-radius, 0.3rem);}.option{ position: relative; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; width: 100%; gap: 0.5rem; padding: var(--padding, 0.6rem 1rem); cursor: pointer; outline: none; user-select: none;}.option::before{ position: absolute; content: \'\'; display: block; width: 0.2rem; height: 1em; left: 0; border-radius: 0 1em 1em 0; background: rgba(var(--text-color,(17,17,17)), 0.5); transition: all 0.2s ease-in-out; opacity: 0;}:host(:focus){ outline: none; background: rgba(var(--text-color,(17,17,17)), 0.1);}:host(:focus) .option::before{ opacity: 1}:host([selected]) .option::before{ opacity: 1; background: var(--accent-color, teal);}@media (hover: hover){ .option:hover{ background: rgba(var(--text-color,(17,17,17)), 0.1); } :host(:not([selected]):hover) .option::before{ opacity: 1 }}
',customElements.define("sm-option",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smOption.content.cloneNode(!0))}connectedCallback(){this.setAttribute("role","option")}});const spinner=document.createElement("template");spinner.innerHTML='';class SpinnerLoader extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(spinner.content.cloneNode(!0))}}window.customElements.define("sm-spinner",SpinnerLoader);const themeToggle=document.createElement("template");themeToggle.innerHTML=' ';class ThemeToggle extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(themeToggle.content.cloneNode(!0)),this.isChecked=!1,this.hasTheme="light",this.toggleState=this.toggleState.bind(this),this.fireEvent=this.fireEvent.bind(this),this.handleThemeChange=this.handleThemeChange.bind(this)}static get observedAttributes(){return["checked"]}daylight(){this.hasTheme="light",document.body.dataset.theme="light",this.setAttribute("aria-checked","false")}nightlight(){this.hasTheme="dark",document.body.dataset.theme="dark",this.setAttribute("aria-checked","true")}toggleState(){if(!document.startViewTransition)return this.toggleAttribute("checked"),void this.fireEvent();document.startViewTransition((()=>{this.toggleAttribute("checked"),this.fireEvent()}))}handleKeyDown(e){" "===e.key&&this.toggleState()}handleThemeChange(e){e.detail.theme!==this.hasTheme&&("dark"===e.detail.theme?this.setAttribute("checked",""):this.removeAttribute("checked"))}fireEvent(){this.dispatchEvent(new CustomEvent("themechange",{bubbles:!0,composed:!0,detail:{theme:this.hasTheme}}))}connectedCallback(){this.setAttribute("role","switch"),this.setAttribute("aria-label","theme toggle"),"dark"===localStorage.getItem(`${window.location.hostname}-theme`)?(this.nightlight(),this.setAttribute("checked","")):"light"===localStorage.getItem(`${window.location.hostname}-theme`)?(this.daylight(),this.removeAttribute("checked")):window.matchMedia("(prefers-color-scheme: dark)").matches?(this.nightlight(),this.setAttribute("checked","")):(this.daylight(),this.removeAttribute("checked")),this.addEventListener("click",this.toggleState),this.addEventListener("keydown",this.handleKeyDown),document.addEventListener("themechange",this.handleThemeChange)}disconnectedCallback(){this.removeEventListener("click",this.toggleState),this.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("themechange",this.handleThemeChange)}attributeChangedCallback(e,t,n){"checked"===e&&(this.hasAttribute("checked")?(this.nightlight(),localStorage.setItem(`${window.location.hostname}-theme`,"dark")):(this.daylight(),localStorage.setItem(`${window.location.hostname}-theme`,"light")))}}window.customElements.define("theme-toggle",ThemeToggle);
\ No newline at end of file
+const smChips=document.createElement("template");smChips.innerHTML='',customElements.define("sm-chips",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smChips.content.cloneNode(!0)),this.chipsWrapper=this.shadowRoot.querySelector(".sm-chips"),this.coverLeft=this.shadowRoot.querySelector(".cover--left"),this.coverRight=this.shadowRoot.querySelector(".cover--right"),this.navButtonLeft=this.shadowRoot.querySelector(".nav-button--left"),this.navButtonRight=this.shadowRoot.querySelector(".nav-button--right"),this.slottedOptions=void 0,this._value=void 0,this.scrollDistance=0,this.assignedElements=[],this.scrollLeft=this.scrollLeft.bind(this),this.scrollRight=this.scrollRight.bind(this),this.fireEvent=this.fireEvent.bind(this),this.setSelectedOption=this.setSelectedOption.bind(this)}get value(){return this._value}set value(t){this.setSelectedOption(t)}scrollLeft(){this.chipsWrapper.scrollBy({left:-this.scrollDistance,behavior:"smooth"})}scrollRight(){this.chipsWrapper.scrollBy({left:this.scrollDistance,behavior:"smooth"})}setSelectedOption(t){this._value!==t&&(this._value=t,this.assignedElements.forEach((e=>{e.value==t?(e.setAttribute("selected",""),e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})):e.removeAttribute("selected")})))}fireEvent(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this._value}}))}connectedCallback(){this.setAttribute("role","listbox");const t=this.shadowRoot.querySelector("slot");t.addEventListener("slotchange",(e=>{n.disconnect(),i.disconnect(),this.observeSelf.disconnect(),clearTimeout(this.slotChangeTimeout),this.slotChangeTimeout=setTimeout((()=>{this.assignedElements=t.assignedElements(),this.assignedElements.forEach((t=>{t.hasAttribute("selected")&&(this._value=t.value)})),this.observeSelf.observe(this)}),0)}));const e=new ResizeObserver((t=>{t.forEach((t=>{if(t.contentBoxSize){const e=Array.isArray(t.contentBoxSize)?t.contentBoxSize[0]:t.contentBoxSize;this.scrollDistance=.6*e.inlineSize}else this.scrollDistance=.6*t.contentRect.width}))}));e.observe(this),this.observeSelf=new IntersectionObserver(((t,e)=>{t.forEach((t=>{t.isIntersecting&&!this.hasAttribute("multiline")&&this.assignedElements.length>0&&(n.observe(this.assignedElements[0]),i.observe(this.assignedElements[this.assignedElements.length-1]),e.unobserve(this))}))}),{threshold:1}),this.chipsWrapper.addEventListener("option-clicked",(t=>{this._value!==t.target.value&&(this.setSelectedOption(t.target.value),this.fireEvent())}));const n=new IntersectionObserver((t=>{t.forEach((t=>{t.isIntersecting?(this.navButtonLeft.classList.add("hide"),this.coverLeft.classList.add("hide")):(this.navButtonLeft.classList.remove("hide"),this.coverLeft.classList.remove("hide"))}))}),{threshold:1,root:this}),i=new IntersectionObserver((t=>{t.forEach((t=>{t.isIntersecting?(this.navButtonRight.classList.add("hide"),this.coverRight.classList.add("hide")):(this.navButtonRight.classList.remove("hide"),this.coverRight.classList.remove("hide"))}))}),{threshold:1,root:this});this.navButtonLeft.addEventListener("click",this.scrollLeft),this.navButtonRight.addEventListener("click",this.scrollRight)}disconnectedCallback(){this.navButtonLeft.removeEventListener("click",this.scrollLeft),this.navButtonRight.removeEventListener("click",this.scrollRight)}});const smChip=document.createElement("template");smChip.innerHTML=' ',customElements.define("sm-chip",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smChip.content.cloneNode(!0)),this._value=void 0,this.radioButton=this.shadowRoot.querySelector("input"),this.fireEvent=this.fireEvent.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}get value(){return this._value}fireEvent(){this.dispatchEvent(new CustomEvent("option-clicked",{bubbles:!0,composed:!0,detail:{value:this._value}}))}handleKeyDown(t){"Enter"!==t.key&&"Space"!==t.key||this.fireEvent()}connectedCallback(){this.setAttribute("role","option"),this.setAttribute("tabindex","0"),this._value=this.getAttribute("value"),this.addEventListener("click",this.fireEvent),this.addEventListener("keydown",this.handleKeyDown)}disconnectedCallback(){this.removeEventListener("click",this.fireEvent),this.removeEventListener("keydown",this.handleKeyDown)}});const smCopy=document.createElement("template");smCopy.innerHTML='',customElements.define("sm-copy",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smCopy.content.cloneNode(!0)),this.copyContent=this.shadowRoot.querySelector(".copy-content"),this.copyButton=this.shadowRoot.querySelector(".copy-button"),this.copy=this.copy.bind(this)}static get observedAttributes(){return["value"]}set value(t){this.setAttribute("value",t)}get value(){return this.getAttribute("value")}fireEvent(){this.dispatchEvent(new CustomEvent("copy",{composed:!0,bubbles:!0,cancelable:!0}))}copy(){navigator.clipboard.writeText(this.getAttribute("value")).then((t=>this.fireEvent())).catch((t=>console.error(t)))}connectedCallback(){this.copyButton.addEventListener("click",this.copy)}attributeChangedCallback(t,n,o){if("value"===t){const t=this.copyContent.querySelector("slot");if(!t)return;const n=t.assignedNodes();n&&n.length||(t.textContent=o)}}disconnectedCallback(){this.copyButton.removeEventListener("click",this.copy)}});const smForm=document.createElement("template");smForm.innerHTML=' ',customElements.define("sm-form",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smForm.content.cloneNode(!0)),this.form=this.shadowRoot.querySelector("form"),this.invalidFieldsCount,this.skipSubmit=!1,this.isFormValid=void 0,this.supportedElements="input, sm-input, sm-textarea, sm-checkbox, tags-input, file-input, sm-switch, sm-radio",this.formElements=[],this._requiredElements=[]}static get observedAttributes(){return["skip-submit"]}get validity(){return this.isFormValid}debounce=(callback,wait)=>{let timeoutId=null;return(...args)=>{window.clearTimeout(timeoutId),timeoutId=window.setTimeout((()=>{callback.apply(null,args)}),wait)}};_checkValidity=()=>{this.submitButton&&0!==this._requiredElements.length&&(this.invalidFieldsCount=0,this._requiredElements.forEach((([elem,isWC])=>{(!elem.disabled&&isWC&&!elem.isValid||!isWC&&!elem.checkValidity())&&this.invalidFieldsCount++})),this.isFormValid!==(0===this.invalidFieldsCount)&&(this.isFormValid=0===this.invalidFieldsCount,this.dispatchEvent(new CustomEvent(this.isFormValid?"valid":"invalid",{bubbles:!0,composed:!0})),this.skipSubmit||(this.submitButton.disabled=!this.isFormValid)))};handleKeydown=e=>{if("Enter"===e.key&&e.target.tagName.includes("INPUT"))if(0===this.invalidFieldsCount)this.submitButton&&this.submitButton.click(),this.dispatchEvent(new CustomEvent("submit",{bubbles:!0,composed:!0}));else for(const[elem,isWC]of this._requiredElements)if(isWC?!elem.isValid:!elem.checkValidity()){(elem?.shadowRoot?.lastElementChild||elem).animate([{transform:"translateX(-1rem)"},{transform:"translateX(1rem)"},{transform:"translateX(-0.5rem)"},{transform:"translateX(0.5rem)"},{transform:"translateX(0)"}],{duration:300,easing:"ease"}),isWC?(elem.focusIn(),"SM-INPUT"===elem.tagName&&""===elem.value.trim()&&elem.showError()):elem.focus();break}};reset=()=>{this.formElements.forEach((([elem,isWC])=>{if(isWC)elem.reset();else switch(elem.type){case"checkbox":case"radio":elem.checked=!1;break;default:elem.value=""}})),this._checkValidity()};elementsChanged=()=>{this.formElements=[...this.querySelectorAll(this.supportedElements)].map((elem=>[elem,elem.tagName.includes("-")])),this._requiredElements=this.formElements.filter((([elem])=>elem.hasAttribute("required"))),this.submitButton=this.querySelector('[variant="primary"], [type="submit"]'),this.resetButton=this.querySelector('[type="reset"]'),this.resetButton&&this.resetButton.addEventListener("click",this.reset),this._checkValidity()};connectedCallback(){const updateFormDecedents=this.debounce(this.elementsChanged,100);this.addEventListener("input",this.debounce(this._checkValidity,100)),this.addEventListener("keydown",this.debounce(this.handleKeydown,100)),this.shadowRoot.querySelector("slot").addEventListener("slotchange",updateFormDecedents),this.mutationObserver=new MutationObserver((mutations=>{mutations.forEach((mutation=>{("childList"===mutation.type&&[...mutation.addedNodes].some((node=>1===node.nodeType&&node.querySelector(this.supportedElements)))||[...mutation.removedNodes].some((node=>1===node.nodeType&&node.querySelector(this.supportedElements))))&&updateFormDecedents()}))})),this.mutationObserver.observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(name,oldValue,newValue){"skip-submit"===name&&(this.skipSubmit=null!==newValue)}disconnectedCallback(){this.removeEventListener("input",this.debounce(this._checkValidity,100)),this.removeEventListener("keydown",this.debounce(this.handleKeydown,100)),this.mutationObserver.disconnect()}});const smInput=document.createElement("template");smInput.innerHTML=' ',customElements.define("sm-input",class SmInput extends HTMLElement{static hasAppendedStyles=!1;#validationState={validatedFor:void 0,isValid:!1,errorMessage:"Please fill out this field."};constructor(){super(),this.attachShadow({mode:"open"}).append(smInput.content.cloneNode(!0)),this.inputParent=this.shadowRoot.querySelector(".input"),this.input=this.shadowRoot.querySelector("input"),this.clearBtn=this.shadowRoot.querySelector(".clear"),this.placeholderElement=this.shadowRoot.querySelector(".placeholder"),this.outerContainer=this.shadowRoot.querySelector(".outer-container"),this.optionList=this.shadowRoot.querySelector(".datalist"),this._helperText="",this.isRequired=!1,this.datalist=[],this.validationFunction=void 0,this.reflectedAttributes=["value","required","disabled","type","inputmode","readonly","min","max","pattern","minlength","maxlength","step","list","autocomplete"]}static get observedAttributes(){return["value","placeholder","required","disabled","type","inputmode","readonly","min","max","pattern","minlength","maxlength","step","helper-text","error-text","list"]}get value(){return this.input.value}set value(val){val!==this.input.value&&(this.input.value=val,this._value=val,this.checkInput())}get placeholder(){return this.getAttribute("placeholder")}set placeholder(val){this.setAttribute("placeholder",val)}get type(){return this.getAttribute("type")}set type(val){this.setAttribute("type",val)}get validity(){return this.input.validity}get disabled(){return this.hasAttribute("disabled")}set disabled(value){value?(this.inputParent.classList.add("disabled"),this.setAttribute("disabled","")):(this.inputParent.classList.remove("disabled"),this.removeAttribute("disabled"))}get readOnly(){return this.hasAttribute("readonly")}set readOnly(value){value?this.setAttribute("readonly",""):this.removeAttribute("readonly")}set customValidation(val){val&&(this.validationFunction=val)}set errorText(val){this.#validationState.errorText=val}showError=(errorText=this.#validationState.errorText)=>{const appendedNew=this.appendFeedbackElement();this.feedbackPopover.innerHTML=` ${errorText} `,this.feedbackPopover.dataset.state="error",appendedNew&&this.feedbackPopover.animate([{transform:"scale(0.95)",opacity:0},{transform:"scale(1)",opacity:1}],{duration:200,easing:"ease",fill:"forwards"})};set helperText(val){this._helperText=val}get isValid(){if(this.#validationState.validatedFor===this.input.value)return this.#validationState.isValid;const _isValid=this.input.checkValidity();let _validity={isValid:!0,errorText:""};return this.validationFunction&&(_validity=this.validationFunction(this.input.value,this)),_isValid&&_validity.isValid?(this.setAttribute("valid",""),this.removeAttribute("invalid"),this.hideFeedback()):(this.removeAttribute("valid"),this.setAttribute("invalid",""),""!==this.value.trim()&&(_validity.errorText||this.#validationState.errorText)&&this.showError(_validity.errorText||this.#validationState.errorText)),this.#validationState.validatedFor=this.input.value,this.#validationState.isValid=_isValid&&_validity.isValid,this.#validationState.errorText=_validity.errorText||this.#validationState.errorText,this.#validationState.isValid}reset=()=>{this.value=""};clear=()=>{this.value="",this.input.focus(),this.fireEvent()};focusIn=()=>{this.input.focus()};focusOut=()=>{this.input.blur()};fireEvent=()=>{let event=new Event("input",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(event)};searchDatalist=searchKey=>{const filteredData=this.datalist.filter((item=>item.toLowerCase().includes(searchKey.toLowerCase())));if(filteredData.sort(((a,b)=>a.toLowerCase().indexOf(searchKey.toLowerCase())-b.toLowerCase().indexOf(searchKey.toLowerCase()))),filteredData.length){if(this.optionList.children.length>filteredData.length){const optionsToRemove=this.optionList.children.length-filteredData.length;for(let i=0;i{if(this.optionList.children[index])this.optionList.children[index].textContent=item;else{const option=document.createElement("li");option.textContent=item,option.classList.add("datalist-item"),option.setAttribute("tabindex","0"),this.optionList.appendChild(option)}})),this.optionList.classList.remove("hidden")}else this.optionList.classList.add("hidden")};checkInput=e=>{this.hasAttribute("readonly")||(""!==this.input.value?this.clearBtn.classList.remove("hidden"):this.clearBtn.classList.add("hidden")),this.hasAttribute("placeholder")&&""!==this.getAttribute("placeholder").trim()&&(""!==this.input.value?(this.shouldAnimatePlaceholder&&this.inputParent.classList.add("animate-placeholder"),this.placeholderElement.classList.toggle("hidden",!this.shouldAnimatePlaceholder),this.datalist.length&&(this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((()=>{this.searchDatalist(this.input.value.trim())}),100))):(this.shouldAnimatePlaceholder&&this.inputParent.classList.remove("animate-placeholder"),this.placeholderElement.classList.remove("hidden"),this.hideFeedback(),this.datalist.length&&(this.optionList.innerHTML="",this.optionList.classList.add("hidden"))))};allowOnlyNum=e=>{e.ctrlKey||1===e.key.length&&(("."!==e.key||!e.target.value.includes(".")&&0!==e.target.value.length)&&["0","1","2","3","4","5","6","7","8","9","."].includes(e.key)||e.preventDefault())};handleOptionClick=e=>{this.input.value=e.target.textContent,this.optionList.classList.add("hidden"),this.input.focus()};handleInputNavigation=e=>{"ArrowDown"===e.key?(e.preventDefault(),this.optionList.children.length&&this.optionList.children[0].focus()):"ArrowUp"===e.key&&(e.preventDefault(),this.optionList.children.length&&this.optionList.children[this.optionList.children.length-1].focus())};handleDatalistNavigation=e=>{"ArrowUp"===e.key?(e.preventDefault(),this.shadowRoot.activeElement.previousElementSibling?this.shadowRoot.activeElement.previousElementSibling.focus():this.input.focus()):"ArrowDown"===e.key?(e.preventDefault(),this.shadowRoot.activeElement.nextElementSibling?this.shadowRoot.activeElement.nextElementSibling.focus():this.input.focus()):"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.input.value=e.target.textContent,this.optionList.classList.add("hidden"),this.input.focus())};handleFocus=e=>{this.datalist.length&&this.searchDatalist(this.input.value.trim())};handleBlur=e=>{this.datalist.length&&this.optionList.classList.add("hidden")};applyGlobalCustomValidation=()=>{if(void 0!==window.smCompConfig&&window.smCompConfig["sm-input"]){const config=window.smCompConfig["sm-input"].find((config=>this.matches(config.selector)));this.customValidation=config?.customValidation}};updatePosition=()=>{requestAnimationFrame((()=>{if(this.dimensions=this.getBoundingClientRect(),this.scrollingParentDimensions=this.scrollingParent.getBoundingClientRect(),0===this.dimensions.width||0===this.dimensions.height)return;let topOffset=this.dimensions.top-this.scrollingParentDimensions.top+this.dimensions.height,leftOffset=this.dimensions.left-this.scrollingParentDimensions.left;const maxWidth=this.dimensions.width;this.feedbackPopover.style=`top: ${topOffset}px; left: ${leftOffset}px; max-width: ${maxWidth}px;`}))};appendFeedbackElement=()=>!this.feedbackPopover&&(this.feedbackPopover=document.createElement("div"),this.feedbackPopover.className="feedback-popover",this.feedbackPopover.setAttribute("aria-live","polite"),this.containment=this.closest("[data-sm-containment]"),this.scrollingParent=this.getNearestScrollingParent(this),(this.containment||this.scrollingParent).appendChild(this.feedbackPopover),""===this.scrollingParent.style.position&&(this.scrollingParent.style.position="relative"),this.containment||(this.observerHidFeedback=!1,this.intersectionObserver=new IntersectionObserver((entries=>{if(this.feedbackPopover)if(entries[0].isIntersecting){if(!this.observerHidFeedback)return;this.feedbackPopover.classList.remove("hidden"),this.observerHidFeedback=!1}else this.feedbackPopover.classList.add("hidden"),this.observerHidFeedback=!0})).observe(this)),this.updatePosition(),window.addEventListener("resize",this.updatePosition,{passive:!0}),!0);getNearestScrollingParent=element=>{let parent=element.parentNode;for(;parent;){if(parent.scrollHeight>parent.clientHeight||parent.scrollWidth>parent.clientWidth||parent.tagName.includes("SM-")||parent.hasAttribute("data-scrollable"))return parent;parent=parent.parentNode}return document.body};hideFeedback=()=>{this.feedbackPopover&&(this.feedbackPopover.animate([{transform:"none",opacity:1},{transform:"scale(0.95)",opacity:0}],{duration:100,easing:"ease-in-out",fill:"forwards"}).onfinish=()=>{this.intersectionObserver?.disconnect(),this.feedbackPopover.remove(),this.feedbackPopover=null,window.removeEventListener("resize",this.updatePosition,{passive:!0})})};connectedCallback(){SmInput.hasAppendedStyles||(document.head.insertAdjacentHTML("beforeend",""),SmInput.hasAppendedStyles=!0),this.shouldAnimatePlaceholder=this.hasAttribute("animate"),this.shouldAnimatePlaceholder&&""!==this.placeholderElement&&this.value&&(this.inputParent.classList.add("animate-placeholder"),this.placeholderElement.classList.remove("hidden")),this.setAttribute("role","textbox"),"loading"===document.readyState?window.addEventListener("load",this.applyGlobalCustomValidation,{once:!0}):this.applyGlobalCustomValidation(),this.input.addEventListener("input",this.checkInput),this.clearBtn.addEventListener("click",this.clear),this.datalist.length&&(this.optionList.addEventListener("click",this.handleOptionClick),this.input.addEventListener("keydown",this.handleInputNavigation),this.optionList.addEventListener("keydown",this.handleDatalistNavigation)),this.input.addEventListener("focusin",this.handleFocus),this.addEventListener("focusout",this.handleBlur)}attributeChangedCallback(name,oldValue,newValue){if(oldValue!==newValue)switch(this.reflectedAttributes.includes(name)&&(this.hasAttribute(name)?this.input.setAttribute(name,this.getAttribute(name)?this.getAttribute(name):""):this.input.removeAttribute(name)),name){case"placeholder":this.placeholderElement.textContent=newValue,this.setAttribute("aria-label",newValue);break;case"value":this.checkInput();break;case"type":this.hasAttribute("type")&&"number"===this.getAttribute("type")?(this.input.setAttribute("inputmode","decimal"),this.input.addEventListener("keydown",this.allowOnlyNum)):this.input.removeEventListener("keydown",this.allowOnlyNum);break;case"helper-text":this._helperText=newValue;break;case"error-text":this.#validationState.errorText=newValue;break;case"required":this.isRequired=this.hasAttribute("required"),this.isRequired?this.setAttribute("aria-required","true"):this.setAttribute("aria-required","false");break;case"readonly":this.hasAttribute("readonly")?this.inputParent.classList.add("readonly"):this.inputParent.classList.remove("readonly");break;case"disabled":this.hasAttribute("disabled")?this.inputParent.classList.add("disabled"):this.inputParent.classList.remove("disabled");break;case"list":this.hasAttribute("list")&&""!==this.getAttribute("list").trim()&&(this.datalist=this.getAttribute("list").split(","))}}disconnectedCallback(){this.input.removeEventListener("input",this.checkInput),this.clearBtn.removeEventListener("click",this.clear),this.input.removeEventListener("keydown",this.allowOnlyNum),this.optionList.removeEventListener("click",this.handleOptionClick),this.input.removeEventListener("keydown",this.handleInputNavigation),this.optionList.removeEventListener("keydown",this.handleDatalistNavigation),this.input.removeEventListener("focusin",this.handleFocus),this.removeEventListener("focusout",this.handleBlur),window.removeEventListener("resize",this.updatePosition,{passive:!0}),this.feedbackPopover&&this.feedbackPopover.remove(),this.intersectionObserver&&this.intersectionObserver.disconnect()}});const smNotifications=document.createElement("template");smNotifications.innerHTML=" ",customElements.define("sm-notifications",class extends HTMLElement{constructor(){super(),this.shadow=this.attachShadow({mode:"open"}).append(smNotifications.content.cloneNode(!0)),this.notificationPanel=this.shadowRoot.querySelector(".notification-panel"),this.animationOptions={duration:300,fill:"forwards",easing:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"},this.push=this.push.bind(this),this.createNotification=this.createNotification.bind(this),this.removeNotification=this.removeNotification.bind(this),this.clearAll=this.clearAll.bind(this),this.remove=this.remove.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.startX=0,this.currentX=0,this.endX=0,this.swipeDistance=0,this.swipeDirection="",this.swipeThreshold=0,this.startTime=0,this.swipeTime=0,this.swipeTimeThreshold=200,this.currentTarget=null,this.notificationTimeout=5e3,this.mediaQuery=window.matchMedia("(min-width: 640px)"),this.handleOrientationChange=this.handleOrientationChange.bind(this),this.isBigViewport=!1}set timeout(value){isNaN(value)||(this.notificationTimeout=value)}randString(length){let result="";for(let i=0;i${icon}`:""} ${action?``:""} `,action&¬ification.querySelector(".action").addEventListener("click",action.callback),notification.querySelector(".close").addEventListener("click",(()=>{this.removeNotification(notification)})),pinned||setTimeout((()=>{this.removeNotification(notification,this.isBigViewport?"left":"top")}),timeout),notification}push(message,options={}){const notification=this.createNotification(message,options);return this.isBigViewport?this.notificationPanel.append(notification):this.notificationPanel.prepend(notification),notification.scrollIntoView({behavior:"smooth"}),this.notificationPanel.animate([{transform:`translateY(${this.isBigViewport?"":"-"}${notification.clientHeight}px)`},{transform:"none"}],this.animationOptions),notification.animate([{transform:"translateY(-1rem)",opacity:"0"},{transform:"none",opacity:"1"}],this.animationOptions).onfinish=e=>{e.target.commitStyles(),e.target.cancel()},notification.id}removeNotification(notification,direction="left"){if(!notification)return;const sign="left"===direction||"top"===direction?"-":"+";this.isBigViewport||"top"!==direction?notification.animate([{transform:this.currentX?`translateX(${this.currentX}px)`:"none",opacity:"1"},{transform:`translateX(calc(${sign}${Math.abs(this.currentX)}px ${sign} 1rem))`,opacity:"0"}],this.animationOptions).onfinish=()=>{notification.remove()}:notification.animate([{transform:this.currentX?`translateY(${this.currentX}px)`:"none",opacity:"1"},{transform:`translateY(calc(${sign}${Math.abs(this.currentX)}px ${sign} 1rem))`,opacity:"0"}],this.animationOptions).onfinish=()=>{notification.remove()}}remove(id){const notification=this.notificationPanel.querySelector(`#${id}`);notification&&this.removeNotification(notification)}clearAll(){Array.from(this.notificationPanel.children).forEach((child=>{this.removeNotification(child)}))}handleTouchMove(e){this.currentX=e.touches[0].clientX-this.startX,this.currentTarget.style.transform=`translateX(${this.currentX}px)`}handleOrientationChange(e){this.isBigViewport=e.matches,e.matches}connectedCallback(){this.handleOrientationChange(this.mediaQuery),this.mediaQuery.addEventListener("change",this.handleOrientationChange),this.notificationPanel.addEventListener("touchstart",(e=>{e.target.closest(".close")?this.removeNotification(e.target.closest(".notification")):e.target.closest(".notification")&&(this.swipeThreshold=e.target.closest(".notification").getBoundingClientRect().width/2,this.currentTarget=e.target.closest(".notification"),this.startTime=Date.now(),this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY,this.notificationPanel.addEventListener("touchmove",this.handleTouchMove,{passive:!0}))}),{passive:!0}),this.notificationPanel.addEventListener("touchend",(e=>{this.endX=e.changedTouches[0].clientX,this.endY=e.changedTouches[0].clientY,this.swipeDistance=Math.abs(this.endX-this.startX),this.swipeTime=Date.now()-this.startTime,this.endX>this.startX?this.swipeDirection="right":this.swipeDirection="left",this.swipeTime50&&this.removeNotification(this.currentTarget,this.swipeDirection):this.swipeDistance>this.swipeThreshold?this.removeNotification(this.currentTarget,this.swipeDirection):this.currentTarget.animate([{transform:`translateX(${this.currentX}px)`},{transform:"none"}],this.animationOptions).onfinish=e=>{e.target.commitStyles(),e.target.cancel()},this.notificationPanel.removeEventListener("touchmove",this.handleTouchMove),this.currentX=0}))}disconnectedCallback(){mediaQueryList.removeEventListener("change",handleOrientationChange)}});class Stack{constructor(){this.items=[]}push(element){this.items.push(element)}pop(){return 0==this.items.length?"Underflow":this.items.pop()}peek(){return this.items[this.items.length-1]}}const popupStack=new Stack,smPopup=document.createElement("template");smPopup.innerHTML='',customElements.define("sm-popup",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smPopup.content.cloneNode(!0)),this.allowClosing=!1,this.isOpen=!1,this.offset=0,this.touchStartY=0,this.touchEndY=0,this.touchStartTime=0,this.touchEndTime=0,this.touchEndAnimation=void 0,this.focusable,this.autoFocus,this.mutationObserver,this.popupContainer=this.shadowRoot.querySelector(".popup-container"),this.backdrop=this.shadowRoot.querySelector(".backdrop"),this.dialogBox=this.shadowRoot.querySelector(".popup"),this.popupBodySlot=this.shadowRoot.querySelector(".popup-body slot"),this.popupHeader=this.shadowRoot.querySelector(".popup-top")}static get observedAttributes(){return["open"]}get open(){return this.isOpen}animateTo=(element,keyframes,options)=>{const anime=element.animate(keyframes,{...options,fill:"both"});return anime.finished.then((()=>{anime.commitStyles(),anime.cancel()})),anime};resumeScrolling=()=>{const scrollY=document.body.style.top;window.scrollTo(0,-1*parseInt(scrollY||"0")),document.body.style.overflow="",document.body.style.top="initial"};setStateOpen=()=>{if(!this.isOpen||this.offset){const animOptions={duration:300,easing:"ease"},initialAnimation=window.innerWidth>640?"scale(1.1)":`translateY(${this.offset?`${this.offset}px`:"100%"})`;this.animateTo(this.dialogBox,[{opacity:this.offset?1:0,transform:initialAnimation},{opacity:1,transform:"none"}],animOptions)}};show=(options={})=>{const{pinned:pinned=!1,payload:payload}=options;if(this.isOpen)return;const animOptions={duration:300,easing:"ease"};return this.payload=payload,popupStack.push({popup:this,permission:pinned}),popupStack.items.length>1&&this.animateTo(popupStack.items[popupStack.items.length-2].popup.shadowRoot.querySelector(".popup"),[{transform:"none"},{transform:window.innerWidth>640?"scale(0.95)":"translateY(-1.5rem)"}],animOptions),this.popupContainer.classList.remove("hide"),this.offset||(this.backdrop.animate([{opacity:0},{opacity:1}],animOptions).onfinish=()=>{this.resolveOpen(this.payload)},this.dispatchEvent(new CustomEvent("popupopened",{bubbles:!0,composed:!0,detail:{payload:this.payload}})),document.body.style.overflow="hidden",document.body.style.top=`-${window.scrollY}px`),this.setStateOpen(),this.pinned=pinned,this.isOpen=!0,setTimeout((()=>{const elementToFocus=this.autoFocus||this.focusable?.[0]||this.dialogBox;elementToFocus&&(elementToFocus.tagName.includes("-")?elementToFocus.focusIn():elementToFocus.focus())}),0),this.hasAttribute("open")||(this.setAttribute("open",""),this.addEventListener("keydown",this.detectFocus),this.resizeObserver.observe(this),this.mutationObserver.observe(this,{attributes:!0,childList:!0,subtree:!0}),this.popupHeader.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),this.backdrop.addEventListener("mousedown",this.handleSoftDismiss)),{opened:new Promise((resolve=>{this.resolveOpen=resolve})),closed:new Promise((resolve=>{this.resolveClose=resolve}))}};hide=(options={})=>{const{payload:payload}=options,animOptions={duration:150,easing:"ease"};this.backdrop.animate([{opacity:1},{opacity:0}],animOptions),this.animateTo(this.dialogBox,[{opacity:1,transform:window.innerWidth>640?"none":`translateY(${this.offset?`${this.offset}px`:"0"})`},{opacity:0,transform:window.innerWidth>640?"scale(1.1)":"translateY(100%)"}],animOptions).finished.finally((()=>{this.popupContainer.classList.add("hide"),this.dialogBox.style="",this.removeAttribute("open"),this.forms.length&&this.forms.forEach((form=>form.reset())),this.dispatchEvent(new CustomEvent("popupclosed",{bubbles:!0,composed:!0,detail:{payload:payload||this.payload}})),this.resolveClose(payload||this.payload),this.isOpen=!1})),popupStack.pop(),popupStack.items.length?this.animateTo(popupStack.items[popupStack.items.length-1].popup.shadowRoot.querySelector(".popup"),[{transform:window.innerWidth>640?"scale(0.95)":"translateY(-1.5rem)"},{transform:"none"}],animOptions):this.resumeScrolling(),this.resizeObserver.disconnect(),this.mutationObserver.disconnect(),this.removeEventListener("keydown",this.detectFocus),this.popupHeader.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),this.backdrop.removeEventListener("mousedown",this.handleSoftDismiss)};handleTouchStart=e=>{this.offset=0,this.popupHeader.addEventListener("touchmove",this.handleTouchMove,{passive:!0}),this.popupHeader.addEventListener("touchend",this.handleTouchEnd,{passive:!0}),this.touchStartY=e.changedTouches[0].clientY,this.touchStartTime=e.timeStamp};handleTouchMove=e=>{this.touchStartY{this.dialogBox.style.transform=`translateY(${this.offset}px)`})))};handleTouchEnd=e=>{if(this.touchEndTime=e.timeStamp,cancelAnimationFrame(this.touchEndAnimation),this.touchEndY=e.changedTouches[0].clientY,this.threshold=.3*this.dialogBox.getBoundingClientRect().height,this.touchEndTime-this.touchStartTime>200)if(this.touchEndY-this.touchStartY>this.threshold){if(this.pinned)return void this.setStateOpen();this.hide()}else this.setStateOpen();else if(this.touchEndY>this.touchStartY){if(this.pinned)return void this.setStateOpen();this.hide()}this.popupHeader.removeEventListener("touchmove",this.handleTouchMove,{passive:!0}),this.popupHeader.removeEventListener("touchend",this.handleTouchEnd,{passive:!0})};detectFocus=e=>{if("Tab"===e.key){if(!this.focusable.length)return;if(!this.firstFocusable)for(let i=0;i=0;i--)if(!this.focusable[i].disabled){this.lastFocusable=this.focusable[i];break}e.shiftKey&&document.activeElement===this.firstFocusable?(e.preventDefault(),this.lastFocusable.tagName.includes("SM-")?this.lastFocusable.focusIn():this.lastFocusable.focus()):e.shiftKey||document.activeElement!==this.lastFocusable||(e.preventDefault(),this.firstFocusable.tagName.includes("SM-")?this.firstFocusable.focusIn():this.firstFocusable.focus())}};updateFocusableList=()=>{this.focusable=this.querySelectorAll('sm-button:not([disabled]), button:not([disabled]), [href], sm-input, input:not([readonly]), sm-select, select, sm-checkbox, sm-textarea, textarea, [tabindex]:not([tabindex="-1"])'),this.autoFocus=this.querySelector("[autofocus]"),this.firstFocusable=null,this.lastFocusable=null};handleSoftDismiss=()=>{this.pinned?this.dialogBox.animate([{transform:"translateX(-1rem)"},{transform:"translateX(1rem)"},{transform:"translateX(-0.5rem)"},{transform:"translateX(0.5rem)"},{transform:"translateX(0)"}],{duration:300,easing:"ease"}):this.hide()};debounce=(callback,wait)=>{let timeoutId=null;return(...args)=>{window.clearTimeout(timeoutId),timeoutId=window.setTimeout((()=>{callback.apply(null,args)}),wait)}};connectedCallback(){this.popupBodySlot.addEventListener("slotchange",this.debounce((()=>{this.forms=this.querySelectorAll("sm-form"),this.updateFocusableList()}),0)),this.resizeObserver=new ResizeObserver((entries=>{entries.forEach((entry=>{if(entry.contentBoxSize){const contentBoxSize=Array.isArray(entry.contentBoxSize)?entry.contentBoxSize[0]:entry.contentBoxSize;this.threshold=.3*contentBoxSize.blockSize.height}else this.threshold=.3*entry.contentRect.height}))})),this.mutationObserver=new MutationObserver((entries=>{this.updateFocusableList()}))}disconnectedCallback(){this.resizeObserver.disconnect(),this.mutationObserver.disconnect(),this.removeEventListener("keydown",this.detectFocus),this.popupHeader.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),this.backdrop.removeEventListener("mousedown",this.handleSoftDismiss)}attributeChangedCallback(name){"open"===name&&this.hasAttribute("open")&&this.show()}});const smSwitch=document.createElement("template");smSwitch.innerHTML='\t',customElements.define("sm-switch",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smSwitch.content.cloneNode(!0)),this.switch=this.shadowRoot.querySelector(".switch"),this.input=this.shadowRoot.querySelector("input"),this.isChecked=!1,this.isDisabled=!1}static get observedAttributes(){return["disabled","checked"]}get disabled(){return this.isDisabled}set disabled(val){val?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get checked(){return this.isChecked}set checked(value){value?this.setAttribute("checked",""):this.removeAttribute("checked")}get value(){return this.isChecked}reset(){}dispatch=()=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.isChecked}}))};connectedCallback(){this.addEventListener("keydown",(e=>{" "!==e.key||this.isDisabled||(e.preventDefault(),this.input.click())})),this.input.addEventListener("click",(e=>{this.input.checked?this.checked=!0:this.checked=!1,this.dispatch()}))}attributeChangedCallback(name,oldValue,newValue){oldValue!==newValue&&("disabled"===name?this.hasAttribute("disabled")?(this.disabled=!0,this.inert=!0):(this.disabled=!1,this.inert=!1):"checked"===name&&(this.hasAttribute("checked")?(this.isChecked=!0,this.input.checked=!0):(this.isChecked=!1,this.input.checked=!1)))}});const smSelect=document.createElement("template");smSelect.innerHTML='',customElements.define("sm-select",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smSelect.content.cloneNode(!0)),this.focusIn=this.focusIn.bind(this),this.reset=this.reset.bind(this),this.open=this.open.bind(this),this.collapse=this.collapse.bind(this),this.toggle=this.toggle.bind(this),this.handleOptionsNavigation=this.handleOptionsNavigation.bind(this),this.handleOptionSelection=this.handleOptionSelection.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.handleClickOutside=this.handleClickOutside.bind(this),this.selectOption=this.selectOption.bind(this),this.debounce=this.debounce.bind(this),this.elementsChanged=this.elementsChanged.bind(this),this.availableOptions=[],this.previousOption,this.isOpen=!1,this.label="",this.defaultSelected="",this.isUnderViewport=!1,this.animationOptions={duration:300,fill:"forwards",easing:"ease"},this.optionList=this.shadowRoot.querySelector(".options"),this.selection=this.shadowRoot.querySelector(".selection"),this.selectedOptionText=this.shadowRoot.querySelector(".selected-option-text")}static get observedAttributes(){return["disabled","label","readonly"]}get value(){return this.getAttribute("value")}set value(t){const e=this.availableOptions.find((e=>e.getAttribute("value")===t));e?(this.setAttribute("value",t),this.selectOption(e)):console.warn(`There is no option with ${t} as value`)}debounce(t,e){let n=null;return(...i)=>{window.clearTimeout(n),n=window.setTimeout((()=>{t.apply(null,i)}),e)}}reset(t=!0){if(this.availableOptions[0]&&this.previousOption!==this.availableOptions[0]){const e=this.availableOptions.find((t=>t.hasAttribute("selected")))||this.availableOptions[0];this.value=e.getAttribute("value"),t&&this.fireEvent()}}selectOption(t){this.previousOption!==t&&(this.querySelectorAll("[selected").forEach((t=>t.removeAttribute("selected"))),this.selectedOptionText.textContent=`${this.label}${t.textContent}`,t.setAttribute("selected",""),this.previousOption=t)}focusIn(){this.selection.focus()}open(){this.availableOptions.forEach((t=>t.setAttribute("tabindex",0))),this.optionList.classList.remove("hidden"),this.isUnderViewport=this.getBoundingClientRect().bottom+this.optionList.getBoundingClientRect().height>window.innerHeight,this.isUnderViewport?this.setAttribute("isUnder",""):this.removeAttribute("isUnder"),this.optionList.animate([{transform:`translateY(${this.isUnderViewport?"":"-"}0.5rem)`,opacity:0},{transform:"translateY(0)",opacity:1}],this.animationOptions),this.setAttribute("open",""),this.style.zIndex=1e3,(this.availableOptions.find((t=>t.hasAttribute("selected")))||this.availableOptions[0]).focus(),document.addEventListener("mousedown",this.handleClickOutside),this.isOpen=!0}collapse(){this.removeAttribute("open"),this.optionList.animate([{transform:"translateY(0)",opacity:1},{transform:`translateY(${this.isUnderViewport?"":"-"}0.5rem)`,opacity:0}],this.animationOptions).onfinish=()=>{this.availableOptions.forEach((t=>t.removeAttribute("tabindex"))),document.removeEventListener("mousedown",this.handleClickOutside),this.optionList.classList.add("hidden"),this.isOpen=!1,this.style.zIndex="auto"}}toggle(){this.isOpen||this.hasAttribute("disabled")?this.collapse():this.open()}fireEvent(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{value:this.value}}))}handleOptionsNavigation(t){"ArrowUp"===t.key?(t.preventDefault(),document.activeElement.previousElementSibling?document.activeElement.previousElementSibling.focus():this.availableOptions[this.availableOptions.length-1].focus()):"ArrowDown"===t.key&&(t.preventDefault(),document.activeElement.nextElementSibling?document.activeElement.nextElementSibling.focus():this.availableOptions[0].focus())}handleOptionSelection(t){this.previousOption!==document.activeElement&&(this.value=document.activeElement.getAttribute("value"),this.fireEvent())}handleClick(t){t.target===this?this.toggle():(this.handleOptionSelection(),this.collapse())}handleKeydown(t){t.target===this?this.isOpen&&"ArrowDown"===t.key?(t.preventDefault(),(this.availableOptions.find((t=>t.hasAttribute("selected")))||this.availableOptions[0]).focus(),this.handleOptionSelection(t)):" "===t.key&&(t.preventDefault(),this.toggle()):(this.handleOptionsNavigation(t),this.handleOptionSelection(t),["Enter"," ","Escape","Tab"].includes(t.key)&&(t.preventDefault(),this.collapse(),this.focusIn()))}handleClickOutside(t){this.isOpen&&!this.contains(t.target)&&this.collapse()}elementsChanged(){this.availableOptions=[...this.querySelectorAll("sm-option")],this.reset(!1),this.defaultSelected=this.value}connectedCallback(){this.setAttribute("role","listbox"),this.hasAttribute("disabled")||this.hasAttribute("readonly")||(this.selection.setAttribute("tabindex","0"),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeydown));const t=this.debounce(this.elementsChanged,100);this.shadowRoot.querySelector("slot").addEventListener("slotchange",t),this.mutationObserver=new MutationObserver((e=>{let n=!1;if(e.forEach((e=>{switch(e.type){case"childList":t();break;case"attributes":n=!0}})),n){const t=this.availableOptions.find((t=>t.hasAttribute("selected")))||this.availableOptions[0];this.selectedOptionText.textContent=`${this.label}${t.textContent}`,this.setAttribute("value",t.getAttribute("value"))}})),this.mutationObserver.observe(this,{subtree:!0,childList:!0,attributeFilter:["selected"]}),new IntersectionObserver(((t,e)=>{t.forEach((t=>{if(t.isIntersecting){this.selection.getBoundingClientRect().left *{ padding: 0; margin: 0; -webkit-box-sizing: border-box; box-sizing: border-box;} :host{ display: -webkit-box; display: -ms-flexbox; display: flex; overflow: hidden; border-radius: var(--border-radius, 0.3rem);}.option{ position: relative; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; width: 100%; gap: 0.5rem; padding: var(--padding, 0.6rem 1rem); cursor: pointer; outline: none; user-select: none;}.option::before{ position: absolute; content: \'\'; display: block; width: 0.2rem; height: 1em; left: 0; border-radius: 0 1em 1em 0; background: rgba(var(--text-color,(17,17,17)), 0.5); transition: all 0.2s ease-in-out; opacity: 0;}:host(:focus){ outline: none; background: rgba(var(--text-color,(17,17,17)), 0.1);}:host(:focus) .option::before{ opacity: 1}:host([selected]) .option::before{ opacity: 1; background: var(--accent-color, teal);}@media (hover: hover){ .option:hover{ background: rgba(var(--text-color,(17,17,17)), 0.1); } :host(:not([selected]):hover) .option::before{ opacity: 1 }}
',customElements.define("sm-option",class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(smOption.content.cloneNode(!0))}connectedCallback(){this.setAttribute("role","option")}});const spinner=document.createElement("template");spinner.innerHTML='';class SpinnerLoader extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(spinner.content.cloneNode(!0))}}window.customElements.define("sm-spinner",SpinnerLoader);const themeToggle=document.createElement("template");themeToggle.innerHTML=' ';class ThemeToggle extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).append(themeToggle.content.cloneNode(!0)),this.isChecked=!1,this.hasTheme="light",this.toggleState=this.toggleState.bind(this),this.fireEvent=this.fireEvent.bind(this),this.handleThemeChange=this.handleThemeChange.bind(this)}static get observedAttributes(){return["checked"]}daylight(){this.hasTheme="light",document.body.dataset.theme="light",this.setAttribute("aria-checked","false")}nightlight(){this.hasTheme="dark",document.body.dataset.theme="dark",this.setAttribute("aria-checked","true")}toggleState(){if(!document.startViewTransition)return this.toggleAttribute("checked"),void this.fireEvent();document.startViewTransition((()=>{this.toggleAttribute("checked"),this.fireEvent()}))}handleKeyDown(e){" "===e.key&&this.toggleState()}handleThemeChange(e){e.detail.theme!==this.hasTheme&&("dark"===e.detail.theme?this.setAttribute("checked",""):this.removeAttribute("checked"))}fireEvent(){this.dispatchEvent(new CustomEvent("themechange",{bubbles:!0,composed:!0,detail:{theme:this.hasTheme}}))}connectedCallback(){this.setAttribute("role","switch"),this.setAttribute("aria-label","theme toggle"),"dark"===localStorage.getItem(`${window.location.hostname}-theme`)?(this.nightlight(),this.setAttribute("checked","")):"light"===localStorage.getItem(`${window.location.hostname}-theme`)?(this.daylight(),this.removeAttribute("checked")):window.matchMedia("(prefers-color-scheme: dark)").matches?(this.nightlight(),this.setAttribute("checked","")):(this.daylight(),this.removeAttribute("checked")),this.addEventListener("click",this.toggleState),this.addEventListener("keydown",this.handleKeyDown),document.addEventListener("themechange",this.handleThemeChange)}disconnectedCallback(){this.removeEventListener("click",this.toggleState),this.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("themechange",this.handleThemeChange)}attributeChangedCallback(e,t,n){"checked"===e&&(this.hasAttribute("checked")?(this.nightlight(),localStorage.setItem(`${window.location.hostname}-theme`,"dark")):(this.daylight(),localStorage.setItem(`${window.location.hostname}-theme`,"light")))}}window.customElements.define("theme-toggle",ThemeToggle);
\ No newline at end of file