import{s as E}from"./chunk-BT7H_Nq3.js";import{r as H,a as P,o as M,i as T,n as $}from"./chunk-Ci5y0mdV.js";const g="dapp3-banner",b=44,w=32,C=2e3;async function I(){return(await chrome.runtime.sendMessage({type:"get-tab-ctx"}))?.ctx??null}async function z(){try{const t=await chrome.runtime.sendMessage({type:"get-helios-status"});return t?.ok?t.status:null}catch{return null}}function F(t,e){if(t.trustedDirectly)return{dot:"caution",label:"RPC-trusted",title:"This page was resolved by trusting your RPC directly (Helios bypassed). The name→content mapping was not verified against Ethereum consensus."};if(!e)return{dot:"ok",label:"Helios-verified",title:"Name resolution was verified by Helios against Ethereum consensus."};switch(e.state){case"synced":return{dot:"ok",label:"Helios-verified",title:"Name resolution was verified by Helios against Ethereum consensus."};case"syncing":case"booting":return{dot:"syncing",label:`Helios ${e.state}…`,title:`Helios is ${e.state}. This page was resolved earlier; Helios is catching up for subsequent resolutions.`};case"idle":return{dot:"syncing",label:"Helios idle",title:"Helios has not started yet for this session."};case"error":return{dot:"warn",label:"Helios error",title:`Helios error: ${e.error??"unknown"}`}}}function k(){const t=location.pathname+location.search+location.hash;return t==="/"?"":t}function N(){return location.href}function D(t){const e=t.trim().replace(/^https?:\/\//i,"");if(!e)return null;const o=e.match(/^([^\/\?#]+)(.*)$/);if(!o||!o[1])return null;const i=o[1].toLowerCase(),a=o[2]||"/";return/^(?:[a-z0-9-]+\.)+(?:eth|gwei)$/.test(i)?`http://${i}${a.startsWith("/")||a.startsWith("?")||a.startsWith("#")?a:`/${a}`}`:null}function U(){const t=document.createElement("div");t.id=g,t.style.cssText=["position:fixed","top:0","left:0","right:0",`height:${b}px`,"z-index:2147483647","pointer-events:auto","margin:0","padding:0","border:0","display:block"].join(";");const e=t.attachShadow({mode:"closed"}),o=document.createElement("style");o.textContent=`
    :host { all: initial; }
    * { box-sizing: border-box; }
    .bar {
      display: flex; align-items: center; gap: 10px;
      height: ${b}px; padding: 0 10px 0 12px;
      font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
      -webkit-font-smoothing: antialiased;
      background: #09090b; color: #f4f4f5;
      border-bottom: 1px solid #27272a;
    }
    .brand-mark {
      all: unset;
      cursor: pointer;
      display: inline-flex; align-items: center; justify-content: center;
      width: 20px; height: 20px; border-radius: 4px;
      background: #18181b; border: 1px solid #27272a;
      flex: none;
      transition: background-color 150ms, border-color 150ms;
    }
    .brand-mark:hover { background: #27272a; border-color: #3f3f46; }
    .brand-mark svg { width: 12px; height: 12px; display: block; }
    .status {
      display: inline-flex; align-items: center; gap: 7px;
      padding: 3px 8px; border-radius: 4px;
      background: #18181b; border: 1px solid #27272a;
    }
    .dot { width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; flex: none; }
    .dot.ok { background: #10b981; }
    .dot.syncing {
      background: #fbbf24;
      animation: pulse 1.4s ease-in-out infinite;
    }
    .dot.caution { background: #fbbf24; }
    .dot.warn { background: #f43f5e; }
    @keyframes pulse {
      0%, 100% { opacity: 1; }
      50%      { opacity: 0.4; }
    }
    .statelabel {
      color: #a1a1aa; font-weight: 500;
      font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
    }
    .status.ok  .statelabel  { color: #6ee7b7; }
    .status.caution .statelabel { color: #fbbf24; }
    .status.warn .statelabel { color: #fb7185; }
    .left, .right {
      display: inline-flex; align-items: center; gap: 10px;
      flex: 1 1 0; min-width: 0;
    }
    .right { justify-content: flex-end; }
    .identity {
      display: inline-flex; align-items: center; gap: 8px;
      flex: 0 1 560px; min-width: 0;
      height: 24px; padding: 0 10px;
      background: #18181b; border: 1px solid #27272a;
      border-radius: 12px;
      transition: border-color 150ms, background-color 150ms;
    }
    .identity:hover { background: #1f1f22; }
    .identity:focus-within {
      background: #09090b;
      border-color: #3f3f46;
    }
    .identity svg.magnifier {
      width: 12px; height: 12px; color: #71717a; flex: none; display: block;
      transition: color 150ms;
    }
    .identity:focus-within svg.magnifier { color: #a1a1aa; }
    .identity .urlfield {
      flex: 1 1 auto; min-width: 0;
      font: 500 12px/1 "SF Mono", Menlo, Monaco, ui-monospace, monospace;
      color: #6ee7b7;
      text-align: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      outline: none;
      cursor: text;
    }
    .identity .urlfield:empty::before {
      content: attr(data-placeholder);
      color: #52525b;
    }
    .identity .urlfield .u-host { color: #6ee7b7; }
    .identity .urlfield .u-path { color: #6ee7b7; opacity: 0.5; }
    .identity .urlfield::selection,
    .identity .urlfield *::selection {
      background: rgba(16, 185, 129, 0.3); color: #a7f3d0;
    }
    .pin-wrap {
      display: none;
      position: relative;
      flex: none;
      align-items: center;
      justify-content: center;
    }
    .pin-wrap.show { display: inline-flex; }
    .pin-badge {
      all: unset;
      display: inline-flex;
      align-items: center; justify-content: center;
      width: 20px; height: 20px; border-radius: 4px;
      color: #6ee7b7;
      cursor: help;
      transition: background-color 150ms, color 150ms, outline-color 150ms;
    }
    .pin-badge:hover,
    .pin-badge:focus-visible { background: #27272a; color: #a7f3d0; }
    .pin-badge:focus-visible {
      outline: 1px solid #3f3f46;
      outline-offset: 1px;
    }
    .pin-badge.pending {
      color: #fbbf24;
      animation: pulse 1.4s ease-in-out infinite;
    }
    .pin-badge.indirect { color: #a1a1aa; }
    .pin-badge.error { color: #fb7185; }
    .pin-badge svg { width: 14px; height: 14px; display: block; }
    .pin-popover {
      position: absolute;
      top: calc(100% + 8px);
      left: 50%;
      transform: translate(-50%, -4px);
      width: max-content;
      min-width: 220px;
      max-width: 280px;
      padding: 9px 10px;
      border-radius: 6px;
      border: 1px solid #27272a;
      background: #18181b;
      box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
      color: #e4e4e7;
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      z-index: 4;
      transition:
        opacity 120ms ease,
        transform 120ms ease,
        visibility 120ms ease;
    }
    .pin-popover::before {
      content: "";
      position: absolute;
      left: 50%;
      top: -5px;
      width: 8px;
      height: 8px;
      transform: translateX(-50%) rotate(45deg);
      background: #18181b;
      border-left: 1px solid #27272a;
      border-top: 1px solid #27272a;
    }
    .pin-wrap:hover .pin-popover,
    .pin-wrap:focus-within .pin-popover {
      opacity: 1;
      visibility: visible;
      transform: translate(-50%, 0);
    }
    .pin-popover-title,
    .pin-popover-detail,
    .pin-popover-size {
      display: block;
      white-space: normal;
    }
    .pin-popover-title {
      color: #f4f4f5;
      font: 600 12px/1.25 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    }
    .pin-popover-detail {
      margin-top: 4px;
      color: #a1a1aa;
      font: 500 11px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    }
    .pin-popover-size {
      margin-top: 6px;
      color: #6ee7b7;
      font: 600 11px/1.25 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    }
    .star-btn {
      all: unset;
      display: inline-flex; align-items: center; justify-content: center;
      width: 20px; height: 20px; border-radius: 4px;
      color: #71717a; cursor: pointer; flex: none;
      transition: color 150ms, background-color 150ms;
    }
    .star-btn:hover { background: #27272a; color: #e4e4e7; }
    .star-btn svg { width: 14px; height: 14px; display: block; }
    .star-btn.favorited { color: #fbbf24; }
    .star-btn.favorited:hover { color: #fcd34d; }
    .identity:has(.urlfield.shake) { border-color: #f43f5e; }
    .urlfield.shake { animation: shake 0.4s ease; }
    @keyframes shake {
      0%, 100% { transform: translateX(0); }
      25%      { transform: translateX(-3px); }
      75%      { transform: translateX(3px); }
    }
    .menu-wrap { position: relative; }
    .menu-btn {
      all: unset;
      display: inline-flex; align-items: center; justify-content: center;
      width: 26px; height: 26px; border-radius: 4px;
      color: #a1a1aa; cursor: pointer;
      font-size: 16px; line-height: 1;
      transition: background-color 150ms, color 150ms;
    }
    .menu-btn:hover { background: #27272a; color: #f4f4f5; }
    .bookmarks-btn,
    .ens-history-link {
      all: unset;
      display: inline-flex; align-items: center;
      height: 22px; padding: 0 10px; border-radius: 4px;
      color: #a1a1aa; cursor: pointer;
      font: 500 11px/1 inherit;
      transition: background-color 150ms, color 150ms;
      text-decoration: none;
    }
    .bookmarks-btn:hover,
    .ens-history-link:hover { background: #27272a; color: #f4f4f5; }
    .ens-history-link[hidden] { display: none; }
    .menu {
      position: absolute; top: calc(100% + 4px); right: 0;
      display: none; min-width: 220px;
      background: #18181b; color: #e4e4e7;
      border: 1px solid #27272a;
      border-radius: 6px; padding: 4px;
    }
    .menu.open { display: block; }
    .menu button {
      all: unset;
      display: flex; align-items: center; gap: 10px;
      width: 100%; box-sizing: border-box;
      padding: 7px 10px; border-radius: 4px;
      font: 500 12px/1.3 inherit; color: #e4e4e7; cursor: pointer;
      text-align: left;
      transition: background-color 150ms, color 150ms;
    }
    .menu button:hover { background: #27272a; color: #f4f4f5; }
    .menu button svg {
      width: 14px; height: 14px; flex: none; display: block;
      color: #a1a1aa;
      transition: color 150ms;
    }
    .menu button:hover svg { color: #e4e4e7; }
    .toast {
      display: none;
      color: #6ee7b7; font-weight: 500;
      font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
    }
    .toast.show { display: inline; }
    .update {
      display: none;
      align-items: center; gap: 10px;
      height: ${w}px; padding: 0 12px;
      font: 500 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
      color: #fef3c7;
      background: #1a1207;
      border-bottom: 1px solid #422006;
    }
    .update.show { display: flex; }
    .update .update-dot {
      width: 6px; height: 6px; border-radius: 50%;
      background: #fbbf24; flex: none;
    }
    .update .update-text {
      flex: 1 1 auto; min-width: 0;
      color: #fef3c7;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .update .update-text strong {
      color: #fde68a; font-weight: 600;
    }
    .update .update-actions {
      display: inline-flex; align-items: center; gap: 6px; flex: none;
    }
    .update button {
      all: unset;
      display: inline-flex; align-items: center; justify-content: center;
      height: 22px; padding: 0 10px; border-radius: 4px;
      font: 600 11px/1 inherit;
      cursor: pointer;
      transition: background-color 150ms, color 150ms, border-color 150ms;
    }
    .update button.reload {
      color: #09090b; background: #fbbf24;
    }
    .update button.reload:hover { background: #fcd34d; }
    .update button.dismiss {
      color: #fcd34d; background: transparent;
      border: 1px solid #422006;
    }
    .update button.dismiss:hover {
      background: #2a1a09; border-color: #78350f;
    }
  `;const i=document.createElement("div");i.className="bar",i.innerHTML=`
    <span class="left">
      <button type="button" class="brand-mark" title="dapp3 home" aria-label="dapp3 home">
        <svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
          <path d="M16 4 L8 17 L16 13 L24 17 Z" fill="#10b981"/>
          <path d="M16 28 L8 19 L16 15 L24 19 Z" fill="#059669"/>
        </svg>
      </button>
      <span class="status">
        <span class="dot"></span>
        <span class="statelabel"></span>
      </span>
    </span>
    <div class="identity" role="search">
      <svg class="magnifier" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
        <circle cx="7" cy="7" r="4.5"/>
        <path d="M10.5 10.5 L14 14"/>
      </svg>
      <div class="urlfield"></div>
      <span class="pin-wrap">
        <button class="pin-badge" type="button" aria-label="IPFS pin status" aria-describedby="dapp3-pin-popover">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
            <path d="M12 17v5"/>
            <path d="M5 17h14"/>
            <path d="M9 3h6l-1 7 3 4H7l3-4z"/>
          </svg>
        </button>
        <span class="pin-popover" id="dapp3-pin-popover" role="tooltip">
          <span class="pin-popover-title"></span>
          <span class="pin-popover-detail"></span>
          <span class="pin-popover-size"></span>
        </span>
      </span>
      <button class="star-btn" type="button" aria-label="favorite" title="Favorite this site">
        <svg class="star-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
          <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>
        </svg>
      </button>
    </div>
    <span class="right">
      <span class="toast">copied</span>
      <a class="ens-history-link" target="_blank" rel="noopener noreferrer" title="View ENS History" hidden>View ENS History</a>
      <button class="bookmarks-btn" type="button" title="All Bookmarks">All Bookmarks</button>
      <span class="menu-wrap">
        <button class="menu-btn" type="button" aria-label="banner menu" title="Banner options">⋯</button>
        <div class="menu" role="menu">
          <button data-act="copy" type="button">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
              <rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
              <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
            </svg>
            <span>Copy underlying URL</span>
          </button>
          <button data-act="open-limo" type="button">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
              <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>
              <polyline points="15 3 21 3 21 9"/>
              <line x1="10" y1="14" x2="21" y2="3"/>
            </svg>
            <span>Open on eth.limo gateway</span>
          </button>
          <button data-act="hide" type="button">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
              <path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/>
              <line x1="1" y1="1" x2="23" y2="23"/>
            </svg>
            <span>Hide banner for this session</span>
          </button>
          <button data-act="settings" type="button">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
              <circle cx="12" cy="12" r="3"/>
              <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/>
            </svg>
            <span>Open extension settings</span>
          </button>
        </div>
      </span>
    </span>
  `;const a=document.createElement("div");a.className="update",a.innerHTML=`
    <span class="update-dot" aria-hidden="true"></span>
    <span class="update-text">
      <strong>Updated content available.</strong>
      The verified contenthash for this name has changed since this page loaded.
    </span>
    <span class="update-actions">
      <button class="reload" type="button" data-act="reload">Reload</button>
      <button class="dismiss" type="button" data-act="dismiss" aria-label="dismiss">Dismiss</button>
    </span>
  `,e.append(o,i,a);const n=r=>e.querySelector(r);return{host:t,shadow:e,brandBtn:n(".brand-mark"),dot:n(".dot"),statusWrap:n(".status"),stateText:n(".statelabel"),urlForm:n(".identity"),urlInput:n(".urlfield"),pinWrap:n(".pin-wrap"),pinBadge:n(".pin-badge"),pinPopoverTitle:n(".pin-popover-title"),pinPopoverDetail:n(".pin-popover-detail"),pinPopoverSize:n(".pin-popover-size"),starBtn:n(".star-btn"),bookmarksBtn:n(".bookmarks-btn"),ensHistoryLink:n(".ens-history-link"),menuBtn:n(".menu-btn"),menu:n(".menu"),copyItem:n('button[data-act="copy"]'),ethLimoItem:n('button[data-act="open-limo"]'),hideItem:n('button[data-act="hide"]'),settingsItem:n('button[data-act="settings"]'),copyToast:n(".toast"),updateStrip:a,updateReloadBtn:n('.update button[data-act="reload"]'),updateDismissBtn:n('.update button[data-act="dismiss"]')}}function L(t=b){const e=()=>{if(!document.body)return!1;const i=parseFloat(getComputedStyle(document.body).marginTop)||0;return document.body.style.marginTop=`${Math.max(i,t)}px`,!0};if(e())return;const o=new MutationObserver(()=>{e()&&o.disconnect()});o.observe(document.documentElement,{childList:!0})}function R(){const t="data-dapp3-shifted",e="data-dapp3-original-top";let o=0,i=!1;const a=(s,d,u)=>{if(s.id===g||s===document.body||s===document.documentElement)return null;const f=getComputedStyle(s);if(f.position!=="fixed"&&f.position!=="sticky")return null;const h=parseFloat(f.top);if(!Number.isFinite(h)||h<-4||h>8)return null;const m=s.getBoundingClientRect();return m.height<=0||m.width<=0||m.height/u>.7||m.width/d<.5?null:h},n=()=>{if(!document.body)return;const s=window.innerWidth||document.documentElement.clientWidth,d=window.innerHeight||document.documentElement.clientHeight,u=document.body.getElementsByTagName("*");for(let f=0;f<u.length;f++){const h=u[f];if(h.hasAttribute(t))continue;const m=a(h,s,d);m!==null&&(h.setAttribute(e,String(m)),h.setAttribute(t,""),h.style.setProperty("top",`${m+o}px`,"important"))}},r=()=>{i||(i=!0,requestAnimationFrame(()=>{i=!1,n()}))},p=()=>{document.querySelectorAll(`[${t}]`).forEach(d=>{const u=parseFloat(d.getAttribute(e)||"0");d.style.setProperty("top",`${u+o}px`,"important")})};let l=null,c=null,v=!1;const x=()=>{l=new MutationObserver(()=>r()),l.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),window.addEventListener("resize",r),r()};return document.body?x():(c=new MutationObserver(()=>{document.body&&(c?.disconnect(),c=null,x())}),c.observe(document.documentElement,{childList:!0})),{setHeight(s){o!==s&&(o=s,p(),r())},teardown(){v||(v=!0,l?.disconnect(),c?.disconnect(),window.removeEventListener("resize",r),document.querySelectorAll(`[${t}]`).forEach(s=>{s.style.removeProperty("top"),s.removeAttribute(t),s.removeAttribute(e)}))}}}function A(t){const e=o=>{const i=history[o];history[o]=function(...a){const n=i.apply(this,a);return queueMicrotask(t),n}};e("pushState"),e("replaceState"),window.addEventListener("popstate",t),window.addEventListener("hashchange",t)}function j(){const t=document.title?.trim()||void 0,e=['link[rel~="icon"]','link[rel="shortcut icon"]','link[rel="apple-touch-icon"]','link[rel="apple-touch-icon-precomposed"]'];let o;for(const r of e){const l=document.querySelector(r)?.getAttribute("href");if(l)try{o=new URL(l,location.href).toString();break}catch{}}const i=document.querySelector('meta[property="og:description"]')?.getAttribute("content")?.trim(),a=document.querySelector('meta[name="description"]')?.getAttribute("content")?.trim();return{title:t,favicon:o,description:i||a||void 0}}function B(t,e){e?(t.starBtn.classList.add("favorited"),t.starBtn.setAttribute("title","Remove from favorites"),t.starBtn.setAttribute("aria-pressed","true"),t.starBtn.querySelector("svg")?.setAttribute("fill","currentColor")):(t.starBtn.classList.remove("favorited"),t.starBtn.setAttribute("title","Favorite this site"),t.starBtn.setAttribute("aria-pressed","false"),t.starBtn.querySelector("svg")?.setAttribute("fill","none"))}function O(t,e){const o=e.ensName.toLowerCase(),i=()=>$(k()||"/"),a=async()=>{const n=await T(o,i());B(t,n)};a(),t.starBtn.addEventListener("click",async n=>{n.stopPropagation();const r=i();if(t.starBtn.classList.contains("favorited"))await H(o,r);else{const l=j(),c={ensName:o,path:r,title:l.title,favicon:l.favicon,description:l.description,addedAt:Date.now()};await P(c)}}),M(n=>{const r=i(),p=n.some(l=>l.ensName===o&&l.path===r);B(t,p)}),A(()=>{a()})}function q(t,e){const o=()=>t.menu.classList.remove("open");t.menuBtn.addEventListener("click",n=>{n.stopPropagation(),t.menu.classList.toggle("open")}),document.addEventListener("click",o),document.addEventListener("keydown",n=>{n.key==="Escape"&&o()}),t.copyItem.addEventListener("click",async()=>{o();const n=N();try{await navigator.clipboard.writeText(n),t.copyToast.classList.add("show"),setTimeout(()=>t.copyToast.classList.remove("show"),1200)}catch{const r=document.createElement("textarea");r.value=n,r.style.position="fixed",r.style.opacity="0",document.body?.appendChild(r),r.select();try{document.execCommand("copy"),t.copyToast.classList.add("show"),setTimeout(()=>t.copyToast.classList.remove("show"),1200)}finally{r.remove()}}});const i=e.kind==="web3"&&!!e.contractAddress,a=!i&&/\.gwei$/.test(e.ensName??"");if(i){const n=t.ethLimoItem.querySelector("span");n&&(n.textContent="Open on w3eth.io")}else if(a){const n=t.ethLimoItem.querySelector("span");n&&(n.textContent="Open on gwei.domains gateway")}t.ethLimoItem.addEventListener("click",()=>{o();const n=k()||"/",r=n.startsWith("/")?n:`/${n}`;if(i&&e.contractAddress){const l=`https://${e.contractAddress}.w3eth.io${r}`;chrome.runtime.sendMessage({type:"open-on-w3eth",url:l}).then(c=>{c?.ok||location.assign(l)}).catch(()=>location.assign(l));return}if(a){const l=`https://${e.ensName}.domains${r}`;chrome.runtime.sendMessage({type:"open-on-gwei-domains",url:l}).catch(()=>location.assign(l));return}const p=`https://${e.ensName}.limo${r}`;chrome.runtime.sendMessage({type:"open-on-eth-limo",url:p}).catch(()=>{location.assign(p)})}),t.bookmarksBtn.addEventListener("click",n=>{n.stopPropagation(),o(),chrome.runtime.sendMessage({type:"open-bookmarks"}).catch(()=>{})}),t.brandBtn.addEventListener("click",n=>{n.stopPropagation(),o(),chrome.runtime.sendMessage({type:"open-home"}).catch(()=>{})}),t.settingsItem.addEventListener("click",()=>{o(),chrome.runtime.sendMessage({type:"open-options"}).catch(()=>{})})}function W(t,e){const o=E(t.urlInput,{shadowRoot:t.shadow,placeholder:"name.eth or name.gwei",onSubmit:i=>{const a=D(i);if(!a){o.shake();return}location.assign(a)},onEscape:()=>{o.setValue(e()),t.urlInput.blur()}});return o}function V(t){if(t==null)return"size unavailable";const e=Math.abs(t),i=[{label:"GB",value:1e9},{label:"MB",value:1e6},{label:"KB",value:1e3}].find(r=>e>=r.value)??{label:"bytes",value:1},a=t/i.value,n=i.label==="bytes"?0:a>=10?1:2;return`${a.toLocaleString(void 0,{maximumFractionDigits:n})} ${i.label}`}function y(t,e){if(t.pinWrap.classList.remove("show"),t.pinBadge.classList.remove("pending","indirect","error"),t.pinBadge.setAttribute("aria-label","IPFS pin status"),t.pinPopoverTitle.textContent="",t.pinPopoverDetail.textContent="",t.pinPopoverSize.textContent="",!e||e.state==="unpinned"||e.state==="error")return;t.pinWrap.classList.add("show"),e.state!=="pinned"&&t.pinBadge.classList.add(e.state);const o=V(e.sizeBytes);let i,a;e.state==="pending"?(i="Auto-pin in progress",a="Kubo is recursively pinning this IPFS CID."):e.state==="indirect"?(i="Available through another pin",a="This CID is covered by another local recursive pin."):e.autoPinned?(i="Auto-pinned by dapp3",a="Pinned to your local Kubo node."):(i="Pinned locally in Kubo",a="This CID is pinned in your local Kubo node."),t.pinPopoverTitle.textContent=i,t.pinPopoverDetail.textContent=a,t.pinPopoverSize.textContent=e.state==="pending"?"":`DAG size: ${o}`,t.pinBadge.setAttribute("aria-label",`${i}. ${a}${e.state==="pending"?"":` DAG size: ${o}.`}`)}async function S(t,e){if(e.kind!=="ipfs")return y(t,null),null;try{const o=await chrome.runtime.sendMessage({type:"get-ipfs-pin-status",cid:e.value}),i=o?.ok?o.status:null;return y(t,i),i}catch{return y(t,null),null}}async function _(t){if(document.getElementById(g))return;const e=U();(document.documentElement||document.body).appendChild(e.host);let o=null,i=!1;e.urlInput.addEventListener("focus",()=>i=!0),e.urlInput.addEventListener("blur",()=>i=!1);const a=()=>`${t.ensName}${k()}`,n=W(e,a),r=t.ensName.toLowerCase();/^(?:[a-z0-9-]+\.)+eth$/.test(r)?(e.ensHistoryLink.href=`https://ens.eth.sh/history/${r}`,e.ensHistoryLink.hidden=!1):(e.ensHistoryLink.hidden=!0,e.ensHistoryLink.removeAttribute("href"));const p=()=>{const{dot:s,label:d,title:u}=F(t,o);e.dot.classList.remove("ok","syncing","caution","warn"),e.dot.classList.add(s),e.dot.title=u,e.statusWrap.classList.remove("ok","syncing","caution","warn"),e.statusWrap.classList.add(s),e.stateText.textContent=d,e.stateText.title=u,i||n.setValue(a())};p();const l=R();L(),l.setHeight(b),A(p),q(e,t),O(e,t),y(e,null),t.kind==="ipfs"&&(async()=>{let s=await S(e,t);for(let d=0;s?.state==="pending"&&d<30;d++){if(await new Promise(u=>setTimeout(u,1e3)),!document.getElementById(g))return;s=await S(e,t)}})(),e.hideItem.addEventListener("click",()=>{e.menu.classList.remove("open"),l.teardown(),document.body&&(document.body.style.marginTop=""),e.host.remove()});let c=null;const v=s=>{c=s,e.updateStrip.classList.add("show"),e.host.style.height=`${b+w}px`,L(b+w),l.setHeight(b+w)},x=()=>{c=null,e.updateStrip.classList.remove("show"),e.host.style.height=`${b}px`};e.updateReloadBtn.addEventListener("click",()=>{c&&location.assign(c)}),e.updateDismissBtn.addEventListener("click",x),chrome.runtime.onMessage.addListener(s=>{if(s?.type==="ipfs-pin-status-updated"){if(s.status.cid!==t.value)return;y(e,s.status);return}if(s?.type!=="content-updated"||s.ensName.toLowerCase()!==t.ensName.toLowerCase())return;const d=new URL(s.gatewayUrl);d.pathname=location.pathname,d.search=location.search,d.hash=location.hash,v(d.toString())}),(async()=>{for(;document.getElementById(g);)o=await z(),p(),await new Promise(s=>setTimeout(s,C))})()}(async()=>{const t=await I();t&&_(t)})();
//# sourceMappingURL=chunk-DfDUUNcm.js.map
